From 7559759bcf2319c0e2f1b036121eebf93fa78021 Mon Sep 17 00:00:00 2001 From: chenjiahe <763432473@qq.com> Date: 星期三, 10 五月 2023 10:33:28 +0800 Subject: [PATCH] 作废退款 --- phi_platform_user/src/main/java/com/hx/phip/controller/order/OrderRefundController.java | 2 phi_platform_user/src/main/java/com/hx/phip/tool/refund/OrderRefundCancelTool.java | 63 +++++++++++++++++-------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/phi_platform_user/src/main/java/com/hx/phip/controller/order/OrderRefundController.java b/phi_platform_user/src/main/java/com/hx/phip/controller/order/OrderRefundController.java index 4648e37..136936c 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/controller/order/OrderRefundController.java +++ b/phi_platform_user/src/main/java/com/hx/phip/controller/order/OrderRefundController.java @@ -301,7 +301,7 @@ } /** - * 璁㈠崟閫�娆句綔搴� + * 浣滃簾璁㈠崟閫�娆惧崟 * */ @RequestMapping(value = "/verify/order/refundStatus",method = RequestMethod.POST) diff --git a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/OrderRefundCancelTool.java b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/OrderRefundCancelTool.java index 80f8e2a..d2445a5 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/OrderRefundCancelTool.java +++ b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/OrderRefundCancelTool.java @@ -24,8 +24,6 @@ import com.hx.phip.service.order.impl.OrderRefundServiceImpl; import com.hx.phip.tool.user.UserProjectTool; import com.hx.phip.util.api.UserMoneyUtil; -import com.hx.phip.vo.order.refund.RefundCarryVo; -import com.hx.phip.vo.user.UserProjectDeductionVo; import com.hx.util.StringUtils; import com.platform.exception.PlatTipsException; import com.platform.resultTool.PlatformCode; @@ -33,7 +31,6 @@ import org.slf4j.LoggerFactory; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -134,6 +131,7 @@ * @param commonService 鏄犲皠 */ public static void rechargeHandle(OrdersTotal ordersTotal, RefundRecord refundRecord,int optType, CommonService commonService){ + if(!OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())){ throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鎿嶄綔澶辫触锛屼笉鏄厖鍊煎崟锛�"); } @@ -221,7 +219,7 @@ } }else if(ActivityAction.TYPE_VALUEADDEDFUND.equals(activityAction.getType())){ //鍒ゆ柇閲戦涓嶇瓑浜�0锛屾墠鎵ц鎿嶄綔锛屼笉鐒舵搷浣滀綑棰濈殑鏃跺�欎細鐖嗘搷浣滄暟閲忔垨閲戦涓嶈兘涓�0 - if(new BigDecimal(activityAction.getWorth()).compareTo(BigDecimal.ZERO) ==0 ){ + if(new BigDecimal(activityAction.getWorth()).compareTo(BigDecimal.ZERO) == 0 ){ continue; } if(optType == 0){ @@ -282,7 +280,7 @@ } }else if(ActivityAction.TYPE_VALUEADDEDFUND.equals(ordersActivityInfoItem.getType())){ //鍒ゆ柇閲戦涓嶇瓑浜�0锛屾墠鎵ц鎿嶄綔锛屼笉鐒舵搷浣滀綑棰濈殑鏃跺�欎細鐖嗘搷浣滄暟閲忔垨閲戦涓嶈兘涓�0 - if(new BigDecimal(ordersActivityInfoItem.getWorth()).compareTo(BigDecimal.ZERO) ==0 ){ + if(new BigDecimal(ordersActivityInfoItem.getWorth()).compareTo(BigDecimal.ZERO) == 0 ){ continue; } if(optType == 0){ @@ -394,21 +392,27 @@ //鍟嗗搧绫诲瀷鍒ゆ柇 switch (refundRecordItem.getType()){ case OrderItemConstants.TYPE_RETAIL: + //鍟嗗搧/鑽搧 rerailHandleOne(refundRecordItem,commonService); break; case OrderItemConstants.TYPE_DRUG: + //澶勬柟鍗曡嵂鍝� rerailHandleOne(refundRecordItem,commonService); break; case OrderItemConstants.TYPE_PROJECT: + //椤圭洰 projectHandleOne(refundRecordItem,refundRecord,commonService); break; case OrderItemConstants.TYPE_PROMOTION: + //淇冮攢 handRefundPromotion( refundRecordItem, refundRecord, commonService); break; case OrderItemConstants.TYPE_CARD: + //鍗¢」 cardHandleOne( refundRecord, refundRecordItem, commonService); break; case OrderItemConstants.CARD_BAG: + //鍗″寘 handRefundPromotion( refundRecordItem, refundRecord, commonService); break; default:break; @@ -427,7 +431,7 @@ //鍓╀綑鍙��娆炬暟閲� if(refundRecordItem.getRefundNum() > orderItem.getHasReNum()){ - throw new TipsException("浣滃簾閫�娆炬暟閲忎笉鑳藉ぇ浜庡凡閫�娆炬暟閲�!"); + throw new TipsException(orderItem.getGoodsName()+"["+orderItem.getGoodsNo()+"]"+"浣滃簾閫�娆炬暟閲忎笉鑳藉ぇ浜庡凡閫�娆炬暟閲�!"); } //鍙樻洿閫�娆惧瓙椤逛俊鎭� @@ -449,25 +453,23 @@ if (orderItem==null){ throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鏈壘鍒板瓙璁㈠崟淇℃伅"); } + //璁$畻瀛愬崟鏄惁杩樻湁鍓╀綑鐨勫彲鎵g枟绋嬫暟 + if(refundRecordItem.getRefundNum() > orderItem.getHasReNum()){ + throw new PlatTipsException(PlatformCode.ERROR_TIPS,orderItem.getGoodsName()+"["+orderItem.getGoodsNo()+"]"+"閫�娆炬鏁板ぇ浜庡彲閫�娆℃暟[54]锛�"); + } //鎵惧埌鐢ㄦ埛椤圭洰 UserProjectItem userProjectItem = PartialRefundUtil.getUserProject(refundRecordItem.getId(),commonService); if (userProjectItem == null) { - throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鏈壘鍒扮敤鎴峰瓙椤归」鐩俊鎭�"); + throw new PlatTipsException(PlatformCode.ERROR_TIPS,orderItem.getGoodsName()+"["+orderItem.getGoodsNo()+"]"+"鏈壘鍒扮敤鎴峰瓙椤归」鐩俊鎭�"); } - if(userProjectItem.getCancelNum() < refundRecordItem.getRefundNum()){ - throw new PlatTipsException(PlatformCode.ERROR_TIPS,"浣滃簾閫�娆炬鏁板ぇ浜庡凡閫�娆℃暟锛�"); + throw new PlatTipsException(PlatformCode.ERROR_TIPS,orderItem.getGoodsName()+"["+orderItem.getGoodsNo()+"]"+"浣滃簾閫�娆炬鏁板ぇ浜庣敤鎴烽」鐩凡閫�娆℃暟锛�"); } //鐢ㄦ埛椤圭洰鎿嶄綔 - UserProjectDeductionVo userProjectDeductionVo = UserProjectTool.userProjectDeduction(userProjectItem, UserProjectUsedCon.USED_METHOD_ORDER_REFUND,UserProjectUsedCon.USED_TYPE_RETURN,refundRecordItem.getDeductionTotalUser() - ,refundRecordItem.getId(),refundRecordItem.getRefundNum(),refundRecord.getInvalidId(),refundRecord.getInvalidName(),refundRecord.getRefundShopId(),refundRecord.getRefundShopName(),"鍛樺伐澶囨敞锛�"+refundRecord.getInvalidRemarks(),commonService); - - //璁$畻瀛愬崟鏄惁杩樻湁鍓╀綑鐨勫彲鎵g枟绋嬫暟 - if(refundRecordItem.getRefundNum() > orderItem.getHasReNum()){ - throw new PlatTipsException(PlatformCode.ERROR_TIPS,"閫�娆炬鏁板ぇ浜庡瓙鍗曞彲閫�娆℃暟[54]锛�"); - } + UserProjectTool.userProjectDeduction(userProjectItem, UserProjectUsedCon.USED_METHOD_ORDER_REFUND,UserProjectUsedCon.USED_TYPE_RETURN,refundRecordItem.getDeductionTotalUser() + ,refundRecordItem.getId(),refundRecordItem.getRealRefundNum(),refundRecord.getInvalidAppId(),refundRecord.getInvalidAppName(),refundRecord.getRefundShopId(),refundRecord.getRefundShopName(),"鍛樺伐澶囨敞锛�"+refundRecord.getInvalidRemarks(),commonService); int refundStatus; if(refundRecordItem.getRefundNum().equals(orderItem.getHasReNum())){ @@ -573,33 +575,36 @@ if (orderItemSon==null){ throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鏈壘鍒颁簩绾у瓙璁㈠崟淇℃伅[02]"); } + //璁$畻瀛愬崟鏄惁杩樻湁鍓╀綑鐨勫彲鎵g枟绋嬫暟 + if(refundRecordItemSource.getRefundNum() > orderItemSon.getHasReNum()){ + throw new PlatTipsException(PlatformCode.ERROR_TIPS,orderItemSon.getGoodsName()+"["+orderItemSon.getGoodsNo()+"]"+"浣滃簾閫�娆炬鏁板ぇ浜庡凡閫�娆℃暟[56]锛�"); + } UserProjectItem userProjectItem = PartialRefundUtil.getUserProject(orderItemSon.getId(),commonService); if(userProjectItem == null){ throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鐢ㄦ埛椤圭洰鑾峰彇澶辫触[06]锛�"); } - - //璁$畻瀛愬崟鏄惁杩樻湁鍓╀綑鐨勫彲鎵g枟绋嬫暟 + //姣旇緝浣滃簾閫�娆炬暟閲� if(refundRecordItemSource.getRefundNum() > userProjectItem.getCancelNum()){ - throw new PlatTipsException(PlatformCode.ERROR_TIPS,"浣滃簾閫�娆炬鏁板ぇ浜庡凡閫�娆℃暟[56]锛�"); + throw new PlatTipsException(PlatformCode.ERROR_TIPS,orderItemSon.getGoodsName()+"["+orderItemSon.getGoodsNo()+"]"+"浣滃簾閫�娆炬鏁板ぇ浜庣敤鎴烽」鐩凡閫�娆℃暟[56]锛�"); } //澶勭悊鐢ㄦ埛椤圭洰锛屽噺鍘荤敤鎴烽」鐩暟閲� - UserProjectDeductionVo userProjectDeductionVo= UserProjectTool.userProjectDeduction(userProjectItem,UserProjectUsedCon.USED_METHOD_ORDER_REFUND,UserProjectUsedCon.USED_TYPE_RETURN,refundRecordItemSource.getDeductionTotalUser() - ,refundRecordItemSource.getId(),refundRecordItemSource.getRefundNum(),refundRecord.getOperatorAppId(),refundRecord.getOperatorAppName(),refundRecord.getRefundShopId(),refundRecord.getRefundShopName(),"鍛樺伐澶囨敞锛�"+refundRecord.getInvalidRemarks(),commonService); + UserProjectTool.userProjectDeduction(userProjectItem,UserProjectUsedCon.USED_METHOD_ORDER_REFUND,UserProjectUsedCon.USED_TYPE_RETURN,refundRecordItemSource.getDeductionTotalUser() + ,refundRecordItemSource.getId(),refundRecordItemSource.getRealRefundNum(),refundRecord.getInvalidAppId(),refundRecord.getInvalidAppName(),refundRecord.getRefundShopId(),refundRecord.getRefundShopName(),"鍛樺伐澶囨敞锛�"+refundRecord.getInvalidRemarks(),commonService); int refundStatus; - if(userProjectItem.getCancelNum().equals(refundRecordItemSource.getRefundNum())){ + if(orderItemSon.getHasReNum().equals(refundRecordItemSource.getRefundNum())){ refundStatus=OrderTotalConstants.STATUS_REFUND_NONE; }else{ refundStatus=OrderTotalConstants.STATUS_REFUND_PART; } //鏇存柊瀛愬崟淇℃伅 - PartialRefundUtil.updateOrderItemTwo(orderItemSon,refundStatus,refundRecordItemSource.getRealRefundTotal().negate(),-refundRecordItemSource.getRefundNum(),commonService); + PartialRefundUtil.updateOrderItemTwo(orderItemSon,refundStatus,refundRecordItemSource.getRealRefundTotal().negate(),-refundRecordItemSource.getRealRefundNum(),commonService); if(refundRecordItem.getType().equals(OrderItemConstants.CARD_BAG)){ - //鏄崱鍖呯殑锛屽埅闄ゅ崱鍖呬娇鐢� + //鏄崱鍖呯殑锛屾壘鍥炲崱鍖呬娇鐢ㄨ褰� userCardUsedHandle(userCardId,orderItemSon.getCardItemInfoId(),orderItemSon.getId(),orderItemSon.getOrderId(),refundRecordItemSource.getRefundNum(),commonService); } @@ -654,8 +659,8 @@ ,CommonService commonService){ //鏌ュ嚭鐢ㄦ埛,commonId锛氬崱椤圭殑缁勫悎椤规爣璇� - CardItemInfo cardItemInfo=commonService.selectOneByKey(CardItemInfoMapper.class,cardItemInfoId); - if(cardItemInfo ==null){ + CardItemInfo cardItemInfo = commonService.selectOneByKey(CardItemInfoMapper.class,cardItemInfoId); + if(cardItemInfo == null){ logger.error("鏈壘鍒拌鍗″寘鐨勭粍鍚堥」-鍗″寘浣滃簾閫�娆惧け璐�,userCardId:{},cardItemInfoId:{},sourceId:{},orderId:{},refundNum:{}",userCardId,cardItemInfoId,sourceId,orderId,refundNum); throw new PlatTipsException(PlatformCode.ERROR_TIPS,"鏈壘鍒拌鍗″寘鐨勭粍鍚堥」"); } @@ -694,11 +699,11 @@ } } - //璁$畻閫�鍥炵殑鍗℃ + //璁$畻鍗℃ int returnNum; //鍥犱负鏈変簺鏄畻娆℃暟鎶垫墸鐨勶紝鎵�浠ヨ绠� if(CardEquity.EQUITY_TYPE_TIME_CARD.equals(cardEquity.getEquityType())){ - //娆″崱锛氭�绘鏁�=寮�鍗曠殑鎬绘鏁�*姣忔鍒掓墸鐨勬鏁� + //娆″崱锛氬綋鍓嶉渶瑕佷娇鐢ㄦ�绘鏁� = 寮�鍗曠殑璐拱鏁伴噺*姣忔鍒掓墸鐨勬鏁� returnNum= refundNum * cardItemInfo.getEveryDrawNum(); }else if(CardEquity.EQUITY_TYPE_N_M.equals(cardEquity.getEquityType())){ returnNum = refundNum; @@ -709,7 +714,7 @@ if(returnNum > userCardUsedList.size()){ logger.error("鍗″寘鍙��鏁伴噺閿欒-鍗″寘浣滃簾閫�娆惧け璐�,鏌ヨ璇彞锛歿},浼犲叆鍙傛暟锛歿}",sqlSentence.getSqlSentence(), JSON.toJSONString(sqlSentence.getM())); logger.error("鍗″寘鍙��鏁伴噺閿欒-鍗″寘浣滃簾閫�娆惧け璐�,userCardId:{},cardItemInfoId:{},sourceId:{},orderId:{},refundNum:{},returnNum:{}",userCardId,cardItemInfoId,sourceId,orderId,refundNum,returnNum); - throw new TipsException("鍗″寘鍙��鏁伴噺閿欒锛�"); + throw new TipsException("鍗″寘浣滃簾閫�娆炬鏁伴噺澶т簬鍙��娆℃暟锛�"); } //宸茬粡鎿嶄綔鏁伴噺 -- Gitblit v1.8.0