Authored by mali

Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.10

... ... @@ -25,7 +25,7 @@ public interface AppraiseOrderMapper {
@Param("limit")int limit);
int selectSubOrderCntNotDefinedStatus(@Param("parentOrderCode") long parentOrderCode, @Param("statusList")Collection<Integer> statusList);
int selectSubOrderCntIncludeStatus(@Param("parentOrderCode") long parentOrderCode, @Param("statusList")Collection<Integer> statusList);
AppraiseOrder selectByOrderCode(long orderCode);
... ... @@ -60,4 +60,6 @@ public interface AppraiseOrderMapper {
* @return
*/
List<AppraiseOrder> selectByOrderCodeList(@Param("orderList")List<Long> orderList);
List<AppraiseOrder> selectSubOrderStatistic(@Param("parentOrderCode")long parentOrderCode);
}
\ No newline at end of file
... ...
... ... @@ -35,4 +35,8 @@ public class AppraiseOrder {
private Integer attributes;
private Byte platformDeliveryStatus;
/**
* 状态分组统计
*/
private Integer statusCnt;
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,7 @@
<result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
<result column="attributes" jdbcType="INTEGER" property="attributes" />
<result column="platform_delivery_status" jdbcType="TINYINT" property="platformDeliveryStatus" />
<result column="status_cnt" jdbcType="INTEGER" property="statusCnt"/>
</resultMap>
<sql id="Base_Column_List">
id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status,
... ... @@ -32,16 +33,13 @@
</select>
<select id="selectSubOrderCntNotDefinedStatus" resultType="java.lang.Integer">
select
count(1)
from appraise_order
<select id="selectSubOrderCntIncludeStatus" resultType="java.lang.Integer">
select count(*) from appraise_order
where parent_order_code = #{parentOrderCode,jdbcType=INTEGER}
and status not in
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status,jdbcType=TINYINT}
</foreach>
and is_del=1
</select>
... ... @@ -272,4 +270,10 @@
#{orderCode,jdbcType=BIGINT}
</foreach>
</select>
<select id="selectSubOrderStatistic" resultMap="BaseResultMap">
select parent_order_code,status, count(*) status_cnt from ufo_order.appraise_order
where parent_order_code = #{parentOrderCode,jdbcType=BIGINT}
group by status
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -106,9 +106,9 @@ public class AppraiseController {
/**
* 给付费寄存 and 付费鉴定 发货用<br><br/>
* 鉴定结果为以下场景,寄回
* 1.瑕疵,鉴定为假,虚假发货,质检不通过取消
* 1.鉴定为假,质检不通过取消
* 2.无法鉴定
* 3.鉴定通过
* 3.鉴定通过 (实物寄存)
*
* 提供给运营平台使用
* @return
... ...
package com.yohoufo.order.event;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.function.Function;
@ToString(of = { "orderCode" })
public class SellerDepositOrderStatusConsistencyAsyncEvent
extends AsyncEvent{
@Getter@Setter
private Long orderCode;
public SellerDepositOrderStatusConsistencyAsyncEvent(Function<SellerDepositOrderStatusConsistencyAsyncEvent,Integer> function) {
super(function);
}
@Override
AsyncEvent getAsyncEvent() {
return this;
}
}
... ...
... ... @@ -63,7 +63,7 @@ public class AppraiseExpressStageBuilder {
if (status == AppraiseOrderStatus.SELLER_SEND_OUT.getCode()){
return DEPOSIT_USER_DELIVERY;
}else if (status == AppraiseOrderStatus.PLATFORM_RECEIVE.getCode()
|| status == AppraiseOrderStatus.JUDGE_PASS.getCode()){
|| status == AppraiseOrderStatus.FINISH.getCode()){
return DEPOSIT_PLATFORM_RECEIPT;
}
... ... @@ -71,7 +71,9 @@ public class AppraiseExpressStageBuilder {
// 子订单
else{
if (status == AppraiseOrderStatus.WAITING_RECEIVE.getCode()){
if (status == AppraiseOrderStatus.CHECKING_FAKE.getCode()
|| status == AppraiseOrderStatus.QUALITY_CHECK_FAKE.getCode()
|| status == AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()){
return DEPOSIT_PLATFORM_DELIVER;
}
... ...
... ... @@ -226,7 +226,6 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
add(AppraiseOrderStatus.SELLER_SEND_OUT.getCode());
add(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode());
add(AppraiseOrderStatus.JUDGE_PASS.getCode());
add(AppraiseOrderStatus.WAITING_RECEIVE.getCode());
add(AppraiseOrderStatus.CHECKING_FAKE.getCode());
add(AppraiseOrderStatus.SHAM_SEND_OUT.getCode());
add(AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode());
... ...
... ... @@ -518,7 +518,7 @@ public class AppraiseService {
/**
* 给付费寄存 and 付费鉴定 发货用<br><br/>
* 鉴定结果为以下场景,寄回
* 1.瑕疵,鉴定为假,虚假发货,质检不通过取消
* 1.鉴定为假,质检不通过取消
* 2.无法鉴定
* 3.鉴定通过
*
... ... @@ -586,15 +586,11 @@ public class AppraiseService {
return new ApiResponse();
}
AppraiseOrderStorage appraiseOrderStorage = appraiseOrderStorageMapper.selectByOrderCode(orderCode);
if (appraiseOrderStorage == null){
LOGGER.warn("appraise order storage not exist {}", orderCode);
return new ApiResponse();
}
// 子订单对应商品 1:1
AppraiseOrderGoods oneAppraiseOrderGood = appraiseOrderGoods.get(0);
inBoxFacade.sendInboxSmsWhenAppraiseFinished(uid, oneAppraiseOrderGood.getProductName(),appraiseOrderStorage.getSizeName(), oneAppraiseOrderGood.getProductCode(), wayBillCode);
inBoxFacade.sendInboxSmsWhenAppraiseFinished(uid, oneAppraiseOrderGood.getProductName(),
oneAppraiseOrderGood.getProductCode(),
wayBillCode);
}
if (appraiseOrder.getAttributes() == AppraiseOrderAttributes.PAID_DEPOSIT.getCode()) { // 鉴定寄存的订单,需要同步修改寄存表的状态
... ...
... ... @@ -695,6 +695,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return false;
}
@Autowired
private AppraiseOrderMapper appraiseOrderMapper;
@Override
public void confirmReceive(long orderCode) {
... ... @@ -703,7 +705,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
logger.info("in confirmReceive isGoodsServiceOrder, orderCode {}", orderCode);
ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.findGoodsServiceInstanceAndExt(orderCode);
existenceNode.getGoodsService().platformReceiveGoods(existenceNode.appraiseOrder);
int rows = existenceNode.getGoodsService().platformReceiveGoods(existenceNode.appraiseOrder);
if (rows==0){
return;
}
// 确认收货过来的是子订单号
Long parentOrderCode = existenceNode.getAppraiseOrder().getParentOrderCode();
if (parentOrderCode == null){
... ... @@ -714,17 +719,26 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
expressInfoService.saveOperateTransferExpressInfo(existenceNode.getAppraiseOrder().getUid(), orderCode ,expressType.getCode(),expressDataType,operateTransferCode);
return;
}
List<Integer> status = Lists.newArrayList(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(), AppraiseOrderStatus.CHECKING_FAKE.getCode());
int cnt = serviceOrderProcessor.getSubOrderCntNotDefinedStatus(parentOrderCode, status);
// 上一个状态是[卖家已发货] 该父订单下状态为[卖家已发货]的子订单数量为0,代表父订单状态应该为 [已收货]
List<Integer> status = Lists.newArrayList(AppraiseOrderStatus.SELLER_SEND_OUT.getCode());
int cnt = serviceOrderProcessor.getSubOrderCntIncludeStatus(parentOrderCode, status);
logger.info("no confirm delivery sub order cnt is {}, parentOrderCode {}", cnt, parentOrderCode);
// 父订单下所有的子订单都是 [平台已收货] or [虚假发货] 的情况
int cdt = DateUtil.getCurrentTimeSecond();
//
if (cnt == 0){
// 平台收货 内部调拨信息
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.platform_receive;
expressInfoService.saveOperateTransferExpressInfo(existenceNode.getAppraiseOrder().getUid(),parentOrderCode ,expressType.getCode(),expressDataType,operateTransferCode);
try {
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.platform_receive;
expressInfoService.saveOperateTransferExpressInfo(existenceNode.getAppraiseOrder().getUid(), parentOrderCode, expressType.getCode(), expressDataType, operateTransferCode);
}catch (Exception ex){
logger.warn("in confirmReceive isGoodsServiceOrder saveOperateTransferExpressInfo fail ,orderCode {} ", orderCode, ex);
}
//update
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_RECEIVE,
expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
appraiseOrderMapper.updateStatusByOrderCode(parentOrderCode, targetStatus.getCode(), expectedStatus.getCode(), cdt);
}
return;
... ...
... ... @@ -561,6 +561,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
List<Integer> expressInfoStatus = Lists.newArrayList(AppraiseOrderStatus.SELLER_SEND_OUT.getCode(),
AppraiseOrderStatus.JUDGE_PASS.getCode(),
AppraiseOrderStatus.CHECKING_FAKE.getCode(),
AppraiseOrderStatus.QUALITY_CHECK_FAKE.getCode(),
AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode());
/**
* 付费鉴定 and 付费寄存 物流信息
... ... @@ -579,8 +584,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
if (appraiseOrder.getAttributes() == AppraiseOrderAttributes.PAID_APPRAISE.getCode()){
// 用户发货, 待用户收货 只有这两个状态展示物流
throwServiceExceptionIf(appraiseOrder.getStatus() != AppraiseOrderStatus.SELLER_SEND_OUT.getCode()
&& appraiseOrder.getStatus() != AppraiseOrderStatus.WAITING_RECEIVE.getCode(), "不展示物流信息");
throwServiceExceptionIf(!expressInfoStatus.contains(appraiseOrder.getStatus()),
"不展示物流信息");
List<Integer> expressTypeList = getAppraiseExpressType(appraiseOrder);
if (CollectionUtils.isEmpty(expressTypeList)) {
... ... @@ -773,7 +778,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
// 用户发货
if(status == AppraiseOrderStatus.SELLER_SEND_OUT.getCode()){
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode());
}else if(status == AppraiseOrderStatus.WAITING_RECEIVE.getCode()){
}else if(status == AppraiseOrderStatus.JUDGE_PASS.getCode()
|| status == AppraiseOrderStatus.CHECKING_FAKE.getCode()
|| status == AppraiseOrderStatus.QUALITY_CHECK_FAKE.getCode()
|| status == AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()){
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_2.getCode(),
EnumExpressType.EXPRESS_TYPE_3.getCode(),
EnumExpressType.EXPRESS_TYPE_REBACK.getCode());
... ... @@ -787,7 +795,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
if (isSubOrder){
// 子订单状态: 虚假发货,质检不通过, 鉴定通过,鉴定不通过,无法鉴定,等待用户收货
if (status == AppraiseOrderStatus.WAITING_RECEIVE.getCode()){
if (status == AppraiseOrderStatus.CHECKING_FAKE.getCode()
|| status == AppraiseOrderStatus.QUALITY_CHECK_FAKE.getCode()
|| status == AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()){
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_2.getCode(),
EnumExpressType.EXPRESS_TYPE_3.getCode(),
EnumExpressType.EXPRESS_TYPE_REBACK.getCode());
... ... @@ -800,7 +810,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
// 这些状态需要展示 平台鉴定
else if (AppraiseOrderStatus.PLATFORM_RECEIVE.getCode() == status
|| AppraiseOrderStatus.JUDGE_PASS.getCode() == status) {
|| AppraiseOrderStatus.FINISH.getCode() == status) {
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(), EnumExpressType.EXPRESS_TYPE_1.getCode());
}
}
... ...
... ... @@ -107,8 +107,8 @@ public class ServiceOrderProcessor {
* @param status
* @return
*/
public int getSubOrderCntNotDefinedStatus(long parentOrderCoe, List<Integer> status){
return appraiseOrderMapper.selectSubOrderCntNotDefinedStatus(parentOrderCoe, status);
public int getSubOrderCntIncludeStatus(long parentOrderCoe, List<Integer> status){
return appraiseOrderMapper.selectSubOrderCntIncludeStatus(parentOrderCoe, status);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.yoho.message.sdk.common.model.SendMessageRspBo;
import com.yoho.message.sdk.service.ufo.IUFOSendService;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.bo.DepositOrderStatisticInfo;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
import com.yohobuy.ufo.model.order.vo.GoodsVo;
... ... @@ -18,6 +19,7 @@ import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import com.yohoufo.inboxclient.sdk.InBoxSDK;
import com.yohoufo.order.service.impl.function.BuyerNoticeSender;
import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
import com.yohoufo.order.utils.NamedThreadFactory;
import com.yohoufo.order.utils.PaymentHelper;
import lombok.NonNull;
... ... @@ -77,6 +79,9 @@ public class InBoxFacade extends BaseNoticeFacade{
@Autowired
private BuyerNoticeFacade buyerNoticeFacade;
@Autowired
private SellerDepositOrderService sellerDepositOrderService;
@Override
public Logger getLogger() {
return log;
... ... @@ -331,30 +336,29 @@ public class InBoxFacade extends BaseNoticeFacade{
* 鉴定结束发货,发送站内信和短信
* @param uid
* @param prdName
* @param sizeName
* @param productCode
* @param wayBillCode
*/
public void sendInboxSmsWhenAppraiseFinished(int uid, String prdName, String sizeName, String productCode,String wayBillCode){
public void sendInboxSmsWhenAppraiseFinished(int uid, String prdName, String productCode,String wayBillCode){
try {
executorService.execute(() -> {
String params = buildParams(prdName, sizeName, productCode);
String params = buildParams(prdName, productCode);
InboxReqVO req = buildInboxReqVO(uid, params, InboxBusinessTypeEnum.INBOX_DELIVERY_APPRAISE_FINISHED);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record sendInboxSmsWhenAppraiseFinished inbox msg, uid {}, prdName {}, resp {}",uid, prdName, resp);
log.info("record sendInboxSmsWhenAppraiseFinished inbox msg, uid {}, prdName {}, wayBillCode {}, resp {}", uid, prdName, wayBillCode, resp);
//短信
String phone = userProxyService.getMobile(uid);
if (StringUtils.isBlank(phone)){
log.warn("sendInboxSmsComm sms send fail,sellerUid {}, prdName {} timelimitDesc {}",uid, prdName);
log.warn("sendInboxSmsWhenAppraiseFinished sms send fail,sellerUid {}, prdName {} timelimitDesc {}",uid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_DELIVERY_APPRAISE_FINISHED.getContent(),prdName,sizeName,productCode,wayBillCode);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_DELIVERY_APPRAISE_FINISHED.getContent(), prdName ,productCode,wayBillCode);
sendSmsService.smsSendByMobile(content, mobileList);
log.info("sendInboxSmsWhenAppraiseFinished sms content {}, mobileList {}", content, mobileList);
});
} catch (Exception e) {
... ... @@ -1033,6 +1037,8 @@ public class InBoxFacade extends BaseNoticeFacade{
.build();
}
public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
try {
... ... @@ -1099,7 +1105,7 @@ public class InBoxFacade extends BaseNoticeFacade{
inboxParams = buildParams4SellerDepositOrder(orderCode);
break;
case JUDGE_PASS:
case JUDGE_PASS_WAIT_WAREHOUSE:
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_PASS;
//get product info 「商品名称」「尺码」「货号」
inboxParams = buildParams4SellerDepositOrder(orderCode);
... ... @@ -1112,11 +1118,15 @@ public class InBoxFacade extends BaseNoticeFacade{
break;
case FINISH:
//订单编号{},申请{}件,实收{}件,鉴定通过{}件,鉴定为假{}件,无法鉴定{}件,鉴定瑕疵{}件
DepositOrderStatisticInfo statisticInfo = sellerDepositOrderService.getAppraiseProgress(uid, orderCode);
inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
inboxParams = new Object[]{orderCode};
inboxParams = new Object[]{orderCode, statisticInfo.getApplyTotal(), statisticInfo.getReceiveTotal(),
statisticInfo.getPassNum(), statisticInfo.getFakeNum(), statisticInfo.getUnsureNum(),
statisticInfo.getFlawNum()};
//sms
smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
smsParams = new Object[]{orderCode};
smsParams = inboxParams;
break;
}
... ...
package com.yohoufo.order.service.seller.deposit;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.bo.DepositOrderStatisticInfo;
import com.yohobuy.ufo.model.order.bo.TimeoutBo;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
... ... @@ -43,15 +44,6 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
private AppraiseOrderMapper appraiseOrderMapper;
@Autowired
private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
@Autowired
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
@Autowired
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
@Autowired
private AppraiseOrderMetaService appraiseOrderMetaService;
@Autowired
... ... @@ -63,9 +55,11 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
@Autowired
private IExpressInfoService expressInfoService;
@Autowired
private SellerDepositOrderService sellerDepositOrderService;
private static final List<Integer> showEXpressInfoStatusList = Lists.newArrayList(AppraiseOrderStatus.SELLER_SEND_OUT.getCode(),
AppraiseOrderStatus.WAITING_RECEIVE.getCode(),
AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(),
AppraiseOrderStatus.JUDGE_PASS.getCode(),
AppraiseOrderStatus.CHECKING_FAKE.getCode(),
... ... @@ -74,20 +68,22 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
private static final List<Integer> showUserAddressStatusList = Lists.newArrayList(
AppraiseOrderStatus.HAS_PAYED.getCode(),
AppraiseOrderStatus.SELLER_SEND_OUT.getCode(),
AppraiseOrderStatus.WAITING_RECEIVE.getCode(),
AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(),
AppraiseOrderStatus.JUDGE_PASS.getCode(),
AppraiseOrderStatus.CHECKING_FAKE.getCode(),
AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()
);
private static final List<Integer> showAppraiseAddressStatusList = Lists.newArrayList(AppraiseOrderStatus.SELLER_SEND_OUT.getCode(),
AppraiseOrderStatus.WAITING_RECEIVE.getCode(),
AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(),
AppraiseOrderStatus.JUDGE_PASS.getCode(),
AppraiseOrderStatus.CHECKING_FAKE.getCode(),
AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()
);
private static final List<Integer> showAppraiseProgress = Lists.newArrayList(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(),
AppraiseOrderStatus.FINISH.getCode()
);
private static final List<Integer> addressUpgradableStatusList = Lists.newArrayList(AppraiseOrderStatus.HAS_PAYED.getCode());
... ... @@ -119,6 +115,11 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
if (showUserAddressStatusList.contains(pao.getStatus())){
userAddress = appraiseOrderMetaService.getHidderUserAddress(orderCode);
}
DepositOrderStatisticInfo orderStatisticInfo = null;
if (showAppraiseProgress.contains(pao.getStatus())){
orderStatisticInfo = sellerDepositOrderService.getAppraiseProgress(uid, orderCode);
}
boolean addressUpgradable = addressUpgradableStatusList.contains(pao.getStatus());
SellerDepositOrderPrdListReq sknListReq = SellerDepositOrderPrdListReq.builder()
.orderCode(orderCode)
... ... @@ -137,6 +138,7 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
.addressUpgradable(addressUpgradable)
.buttons(aos.detailButtons(oa))
.lastExpressInfoDetail(expressInfoService.getLastExpressInfoDetail(pao))
.appraiseProgress(orderStatisticInfo)
.build()
;
}
... ...
... ... @@ -3,6 +3,8 @@ package com.yohoufo.order.service.seller.deposit;
import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.AppraiseOrderBo;
import com.yohobuy.ufo.model.order.bo.DepositOrderStatisticInfo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
... ... @@ -29,6 +31,7 @@ import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.event.OrderCancelEvent;
import com.yohoufo.order.event.PayConfirmEvent;
import com.yohoufo.order.event.SellerDepositOrderCancelAsyncEvent;
import com.yohoufo.order.event.SellerDepositOrderStatusConsistencyAsyncEvent;
import com.yohoufo.order.model.PayQueryBo;
import com.yohoufo.order.model.dto.PlatformFeeDto;
import com.yohoufo.order.model.dto.SellerDepositOrderContext;
... ... @@ -52,8 +55,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class SellerDepositOrderService extends AbsGoodsServiceOrderService implements IGoodsService {
... ... @@ -329,14 +332,20 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
*/
@Override
public int appraisePass(AppraiseOrder pao){
int rows = super.appraisePass(pao);
long orderCode = pao.getOrderCode();
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.JUDGE_PASS_WAIT_WAREHOUSE,
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
if (rows == 0){
return rows;
}
Long orderCode = pao.getOrderCode();
//
triggerStatusConsistencyCheck(orderCode);
Long paidCode = pao.getParentOrderCode();
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.JUDGE_PASS;
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus);
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus);
BigDecimal left = calLeftMoney(pao.getAmount(), orderCode);
if (left.compareTo(BigDecimal.ZERO)>0){
... ... @@ -397,6 +406,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
if (rows == 0){
return rows;
}
//
Long orderCode = appraiseOrder.getOrderCode();
triggerStatusConsistencyCheck(orderCode);
//
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE;
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
... ... @@ -413,6 +426,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
if (rows == 0){
return rows;
}
//
Long orderCode = appraiseOrder.getOrderCode();
triggerStatusConsistencyCheck(orderCode);
//refund amount
new GoodsServiceRefundHandler()
.loadLogger(logger)
.loadUser(appraiseOrder.getUid())
.loadActionCase(SellerWalletDetail.Type.APPRAISE_UNSURE)
.loadRefundAction(payRefundService::refund)
.loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
.refund();
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE;
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
... ... @@ -430,6 +455,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
if (rows == 0){
return rows;
}
//
Long orderCode = appraiseOrder.getOrderCode();
triggerStatusConsistencyCheck(orderCode);
//
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT;
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
//refund amount
... ... @@ -550,16 +579,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
if (rows == 0){
return rows;
}
Long orderCode = appraiseOrder.getOrderCode();
triggerStatusConsistencyCheck(orderCode);
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE;
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus);
new GoodsServiceRefundHandler()
.loadLogger(logger)
.loadUser(appraiseOrder.getUid())
.loadActionCase(SellerWalletDetail.Type.FLAW)
.loadRefundAction(payRefundService::refund)
.loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
.loadOrder(orderCode, appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
.refund();
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
depositService.insertFakeDeposit(appraiseOrder.getUid(), orderCode, appraiseOrder.getParentOrderCode());
return rows;
}
... ... @@ -587,4 +618,121 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
}
public List<AppraiseOrderBo> getSubOrderStatistic(long orderCode){
List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
return paoList.parallelStream().map(pao->AppraiseOrderBo.builder()
.parentOrderCode(pao.getParentOrderCode())
.orderCode(orderCode).status(pao.getStatus()).statusCnt(pao.getStatusCnt()).build())
.collect(Collectors.toList());
}
private List<AppraiseOrder> buildSubOrderStatisticList(long orderCode){
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
if (Objects.isNull(appraiseOrder)){
logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
return new ArrayList<>(0);
}
long occ = findoutParentOrderCode(orderCode);
List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ);
logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList);
return paoList;
}
private Long findoutParentOrderCode(long orderCode){
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
if (Objects.isNull(appraiseOrder)){
logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
return orderCode;
}
return appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode();
}
public DepositOrderStatisticInfo getAppraiseProgress(int uid, long orderCode){
List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
//申请
int applyTotal = 0;
int shamNum = 0;
//鉴定为假
Integer fakeNum = 0;
//无法鉴定
Integer unsureNum = 0;
//鉴定通过
Integer passNum = 0;
//鉴定瑕疵
Integer flawNum = 0;
int waitingAppraiseNum = 0;
for (AppraiseOrder pao : paoList){
int cnt = pao.getStatusCnt();
AppraiseOrderStatus orderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
switch (orderStatus){
case SHAM_SEND_OUT:
shamNum = cnt;
break;
case PLATFORM_APPRAISE_UNSURE:
unsureNum = cnt;
break;
case JUDGE_PASS:
passNum = cnt;
break;
case CHECKING_FAKE:
fakeNum = cnt;
break;
case QUALITY_CHECK_FAKE:
flawNum = cnt;
break;
case PLATFORM_RECEIVE:
waitingAppraiseNum = cnt;
break;
}
applyTotal += cnt;
}
//实收
Integer receiveTotal = applyTotal - shamNum;
DepositOrderStatisticInfo dosi = DepositOrderStatisticInfo.builder()
.applyTotal(applyTotal)
.unsureNum(unsureNum)
.passNum(passNum)
.fakeNum(fakeNum)
.flawNum(flawNum)
.receiveTotal(receiveTotal)
.waitingAppraiseNum(waitingAppraiseNum)
.build();
return dosi;
}
public int platformFinishReceiveGoods(long parentCode){
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FINISH,
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
return triggerStatusChange(parentCode,targetStatus,expectedStatus);
}
public int detectAppraiseFinish(SellerDepositOrderStatusConsistencyAsyncEvent event ){
logger.info("detectAppraiseFinish event {}", event);
long orderCode = event.getOrderCode();
long parentOrderCode = findoutParentOrderCode(orderCode);
int cnt =appraiseOrderMapper.selectSubOrderCntIncludeStatus(parentOrderCode,Arrays.asList(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode()));
logger.info("detectAppraiseFinish event {},parentOrderCode {} PLATFORM_RECEIVE count {}", event, parentOrderCode, cnt);
if (cnt == 0){
int prows = platformFinishReceiveGoods(parentOrderCode);
logger.info("detectAppraiseFinish platformFinishReceiveGoods, orderCode {},parentOrderCode {} parent count {}",
orderCode, parentOrderCode, prows);
return prows;
}
return 0;
}
public void triggerStatusConsistencyCheck(long orderCode){
SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent
= new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish);
asyncEvent.setOrderCode(orderCode);
EventBusPublisher.publishEvent(asyncEvent);
}
}
... ...
... ... @@ -11,6 +11,7 @@ import com.yohoufo.order.service.support.SellerPlatformServiceFeeSupport;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -29,33 +30,11 @@ public class GoodsAmountService {
@Autowired
private SellerPlatformServiceFeeSupport sellerPlatformServiceFeeSupport;
@Autowired
private OrderDynamicConfig orderDynamicConfig;
private static Comparator<GoodsServiceFeeRateWrapper> buildGoodsServiceFeeRateWrapperComp(){
return (GoodsServiceFeeRateWrapper o1, GoodsServiceFeeRateWrapper o2) -> {
BigDecimal o1gpr = o1.getGoodsPaymentRate(), o2gpr = o2.getGoodsPaymentRate();
if (o1gpr == null){
if (o2gpr == null){
return 0;
}else{
return 1;
}
}else{
if (o2gpr == null){
return -1;
}else {
return o1gpr.compareTo(o2gpr);
}
}
};
}
public SellerOrderComputeResult getGoodsServiceFeeRate(int uid, int storageId, PrdPrice prdPrice, SkupType skupType){
public SellerOrderComputeResult getGoodsServiceFeeRate(int uid, int storageId, PrdPrice prdPrice, SkupType skupType) {
logger.info("in GoodsAmountService.getGoodsServiceFeeRate uid {}, storageId {},prdPrice {} skupType {}",
uid, storageId, prdPrice, skupType);
ServiceFeeRate rate = orderDynamicConfig.getServiceFeeRate(skupType);
... ... @@ -69,79 +48,48 @@ public class GoodsAmountService {
return highPriority;
}
}
List<ServiceFeeRate> allConfig = Lists.newArrayListWithCapacity(4);
List<ServiceFeeRate> allConfig = Lists.newArrayListWithCapacity(3);
//build One User One GoodsType 卖家不同商品类型的指定费率
allConfig.add(buildOneUserOneGoodsType(uid, skupType,rate));
CollectionUtils.addIgnoreNull(allConfig, buildOneUserOneGoodsType(uid, skupType, rate));
// build by skn
allConfig.add(buildWithSkn(prdPrice,rate));
CollectionUtils.addIgnoreNull(allConfig, buildWithSkn(prdPrice, rate));
//build by goods type 不同商品类型指定的费率
allConfig.add(buildWithGoodsType(rate));
CollectionUtils.addIgnoreNull(allConfig, buildWithGoodsType(rate));
logger.info("in GoodsAmountService.getGoodsServiceFeeRate uid {}, storageId {}, skupType {} prdPrice {} allConfig {}",
uid, storageId, skupType, prdPrice, allConfig);
// Optional<GoodsServiceFeeRateWrapper> minGSFRW = allConfig.stream()
// .min(buildGoodsServiceFeeRateWrapperComp());
SellerOrderComputeResult socr = new SellerOrderComputeResult();
// if(minGSFRW.isPresent()) {
// rate.setGoodsPaymentRate(minGSFRW.get().getGoodsPaymentRate());
// }
socr.setServiceFeeRates(allConfig);
return socr;
}
public GoodsServiceFeeRateWrapper buildWithSkn(PrdPrice prdPrice,ServiceFeeRate rate) {
GoodsServiceFeeRateWrapper gsfrw = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.SKN,rate);
if (Objects.nonNull(prdPrice)) {
gsfrw.setGoodsPaymentRate(prdPrice.getGoodsPaymentRateOfSkn());
double min = Objects.isNull(prdPrice.getGoodsPaymentMinPriceOfSkn()) ?
0 : prdPrice.getGoodsPaymentMinPriceOfSkn().doubleValue();
double max = Objects.isNull(prdPrice.getGoodsPaymentMaxPriceOfSkn()) ?
1000000 : prdPrice.getGoodsPaymentMaxPriceOfSkn().doubleValue();
gsfrw.setGoodsPaymentPriceRange(PriceRange.builder().min(min).max(max).build());
private GoodsServiceFeeRateWrapper buildWithSkn(PrdPrice prdPrice, ServiceFeeRate rate) {
if (Objects.isNull(prdPrice) || Objects.isNull(prdPrice.getGoodsPaymentRateOfSkn())) {
return null;
}
GoodsServiceFeeRateWrapper gsfrw = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.SKN, rate);
gsfrw.setGoodsPaymentRate(prdPrice.getGoodsPaymentRateOfSkn());
double min = Objects.isNull(prdPrice.getGoodsPaymentMinPriceOfSkn()) ?
0 : prdPrice.getGoodsPaymentMinPriceOfSkn().doubleValue();
double max = Objects.isNull(prdPrice.getGoodsPaymentMaxPriceOfSkn()) ?
1000000 : prdPrice.getGoodsPaymentMaxPriceOfSkn().doubleValue();
gsfrw.setGoodsPaymentPriceRange(PriceRange.builder().min(min).max(max).build());
return gsfrw;
}
public GoodsServiceFeeRateWrapper buildWithGoodsType(ServiceFeeRate rate){
GoodsServiceFeeRateWrapper gsfrw = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.GOODS_TYPE,rate);
gsfrw.setGoodsPaymentRate(rate == null ? null : rate.getGoodsPaymentRate());
return gsfrw;
private GoodsServiceFeeRateWrapper buildWithGoodsType(ServiceFeeRate rate) {
return new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.GOODS_TYPE, rate);
}
public GoodsServiceFeeRateWrapper buildOneUserOneGoodsType(int uid, SkupType skupType,ServiceFeeRate rate){
private GoodsServiceFeeRateWrapper buildOneUserOneGoodsType(int uid, SkupType skupType, ServiceFeeRate rate) {
BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(uid, skupType);
GoodsServiceFeeRateWrapper gsfrw = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.ONE_USER_ONE_GOODS_TYPE,rate);
if (Objects.isNull(feeRate)) {
return null;
}
GoodsServiceFeeRateWrapper gsfrw = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.ONE_USER_ONE_GOODS_TYPE, rate);
gsfrw.setGoodsPaymentRate(feeRate);
return gsfrw;
}
public static void main(String[] args) {
ServiceFeeRate rate = new ServiceFeeRate();
rate.setGoodsPaymentRate(BigDecimal.valueOf(0.05));
List<GoodsServiceFeeRateWrapper> allConfig = Lists.newArrayListWithCapacity(4);
GoodsServiceFeeRateWrapper gsfrw4 = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.GOODS_TYPE,rate);
gsfrw4.setGoodsPaymentRate(new BigDecimal(0.045D));
allConfig.add(gsfrw4);
GoodsServiceFeeRateWrapper gsfrw3 = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.ONE_USER_ONE_SKN,rate);
//gsfrw3.setGoodsPaymentRate(BigDecimal.ZERO);
allConfig.add(gsfrw3);
GoodsServiceFeeRateWrapper gsfrw2 = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.ONE_USER_ONE_GOODS_TYPE,rate);
gsfrw2.setGoodsPaymentRate(new BigDecimal(0.05D));
allConfig.add(gsfrw2);
GoodsServiceFeeRateWrapper gsfrw1 = new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.SKN,rate);
allConfig.add(gsfrw1);
//
GoodsServiceFeeRateWrapper minGSFRW = allConfig.stream()
.min(buildGoodsServiceFeeRateWrapperComp())
.orElse(new GoodsServiceFeeRateWrapper(GoodsServiceFeeRateDimension.GOODS_TYPE,rate));
System.out.println("test getGoodsServiceFeeRate -> " + minGSFRW);
}
}
... ...
package com.yohoufo.order.service.seller.deposit;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.AppraiseOrderBo;
import com.yohoufo.order.BaseWebTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
public class SellerDepositOrderServiceTest extends BaseWebTest {
@Autowired
private SellerDepositOrderService sellerDepositOrderService;
@Test
public void testGetSubOrderStatistic(){
//sub 36378862305176
//parent 36378836393815L
long orderCode = 36378862305176L;//
List<AppraiseOrderBo> list = sellerDepositOrderService.getSubOrderStatistic(orderCode);
System.out.println("in testGetSubOrderStatistic result" + JSONObject.toJSONString(list));
}
}
... ...
... ... @@ -35,6 +35,20 @@ datasources:
- com.yohoufo.dal.product.PriceTrendMonthMapper
- com.yohoufo.dal.product.PriceTrendHalfYearMapper
- com.yohoufo.dal.product.PriceTrendDayMapper
- com.yohoufo.dal.product.ProductImportTranItemMapper
- com.yohoufo.dal.product.TransferRecordsMapper
- com.yohoufo.dal.product.TransferRecordsHistoryMapper
- com.yohoufo.dal.product.ProductSalesMapper
- com.yohoufo.dal.product.ProductLimitSaleMapper
- com.yohoufo.dal.product.ProductSelfShelvesMapper
- com.yohoufo.dal.product.ProductSelfShelvesPicMapper
- com.yohoufo.dal.product.SecondhandFlawMapper
- com.yohoufo.dal.product.SecondhandImagesMapper
- com.yohoufo.dal.product.SecondhandInfoMapper
- com.yohoufo.dal.product.SelfSizeMapper
- com.yohoufo.dal.product.SelfSizeUidMapper
- com.yohoufo.dal.product.ProductProfitMapper
ufo_order:
servers:
... ... @@ -79,9 +93,31 @@ datasources:
- com.yohoufo.dal.order.SellerEnterApplyMapper
- com.yohoufo.dal.order.SellerFuncMapper
- com.yohoufo.dal.order.SellerLevelFuncMapper
- com.yohoufo.dal.order.OrderOverTimeMapper
- com.yohoufo.dal.order.BuyerOrderViewMapper
- com.yohoufo.dal.order.SellerJoinHistoryMapper
- com.yohoufo.dal.order.SellerChangePriceRecordMapper
- com.yohoufo.dal.order.InviteActivityMapper
- com.yohoufo.dal.order.InviteRecordMapper
- com.yohoufo.dal.order.InviterMapper
- com.yohoufo.dal.order.InviteSettlementItemMapper
- com.yohoufo.dal.order.InviteSettlementMapper
- com.yohoufo.dal.order.InviteCodeSequenceMapper
- com.yohoufo.dal.order.InviteCodeSequenceRandomMapper
- com.yohoufo.dal.order.SellerGoodsStatusFlowMapper
- com.yohoufo.dal.order.CmsPayMapper
- com.yohoufo.dal.order.OrdersPayHbfqMapper
- com.yohoufo.dal.order.BlackUserMapper
- com.yohoufo.dal.order.StorageDepositMapper
- com.yohoufo.dal.order.DepositOrderMapper
- com.yohoufo.dal.order.SellerOrderStatsConfigMapper
- com.yohoufo.dal.order.SellerOrderStatsResultMapper
- com.yohoufo.dal.order.AlipayBlackUserMapper
- com.yohoufo.dal.order.AppraiseOrderMapper
- com.yohoufo.dal.order.AppraiseOrderGoodsMapper
- com.yohoufo.dal.order.AppraiseOrderMetaMapper
- com.yohoufo.dal.order.AppraiseOrderStorageMapper
- com.yohoufo.dal.order.DepositCodeMapper
- com.yohoufo.dal.order.SellerServiceFeeRuleMapper
ufo_promotion:
... ...
... ... @@ -44,7 +44,8 @@ public class CertificationController {
public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO);
//若版本低于6.9.9, 提示升级版本
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && reqVO.getApp_version().compareTo("6.9.9") < 0){
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0){
logger.info("CertificationController.alipayCertification: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
throw new VersionNotSupportException();
}
//(1) 必要参数的校验
... ... @@ -75,7 +76,8 @@ public class CertificationController {
public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO);
//若版本低于6.9.9提示升级版本
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && reqVO.getApp_version().compareTo("6.9.9") < 0){
if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0 ){
logger.info("CertificationController.alipayCertifyResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
throw new VersionNotSupportException();
}
//(1) 校验请求的参数
... ... @@ -89,6 +91,31 @@ public class CertificationController {
}
private int compareVersion(String curVersion,String sysVersion){
boolean isCurBlank = StringUtils.isBlank(curVersion);
boolean isSysBlank = StringUtils.isBlank(sysVersion);
if(isCurBlank && isSysBlank){
return 0;
}
if(isCurBlank){
return -1;
}
if(isSysBlank){
return 1;
}
String[] curArr = curVersion.split("\\.");
String[] sysArr = sysVersion.split("\\.");
for(int i=0;i<3;i++){
int cur = Integer.parseInt(curArr[i]);
int sys = Integer.parseInt(sysArr[i]);
if(cur != sys){
return cur-sys;
}
}
return 0;
}
... ...