From f87850bb6c6109a3bda06ab474575631407bbf09 Mon Sep 17 00:00:00 2001 From: chenjiahe <763432473@qq.com> Date: 星期五, 01 三月 2024 19:09:12 +0800 Subject: [PATCH] 爆款活动-退款处理 --- phi_platform_user/src/main/java/com/hx/phip/tool/refund/OrderRefundCancelTool.java | 80 ++++++++++++++++++++++++--------------- 1 files changed, 49 insertions(+), 31 deletions(-) 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 f1595d3..3f864c5 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 @@ -446,44 +446,62 @@ //鏌ユ壘鏄惁澶勭悊浜嗚禒閫佺殑澧炲�奸噾 SqlSentence sqlSentence = new SqlSentence(); Map<String,Object> values = new HashMap<>(); - values.put("isDel",102); + values.put("isDel",RefundUserAssets.DEL_BURST); values.put("orderId",refundRecord.getOrderId()); sqlSentence.sqlSentence("SELECT * FROM refund_user_assets rua WHERE rua.isDel = #{m.isDel} AND rua.status = 1 AND rua.amountStatus IN(1,3) AND rua.orderId = #{m.orderId}",values); List<RefundUserAssets> refundUserAssetsList = commonService.selectList(RefundUserAssetsMapper.class,sqlSentence); if(refundUserAssetsList.size() == 0){ - return; - } - - for(RefundUserAssets refundUserAssets:refundUserAssetsList){ - //鍒ゆ柇鏄惁宸茬粡瀛樺湪浜嗗埆鐨勮禒閫佽褰� - if(OrderTool.getActivityGive(refundUserAssets.getUserId(),ordersTotal.getActivityPageCode(),commonService).size() == 0){ - //鏄惁鏈夋墸鍑忕敤鎴疯祫浜� - if(refundUserAssets.getAmountStatus() == RefundUserAssets.AMOUNT_STATUS_NORMAL){ - orderNodeBuilder.append("锛屾椿鍔ㄨ禒閫佸鍔犳垚鍔�"); - UserMoneyUtil.setNewUserMoneyUnclaimed(refundUserAssets.getUserId(),refundRecord.getRemarks(),"閫�娆句綔搴�:娲诲姩璧犻�佽祫閲戝洖閫�浣滃簾",refundUserAssets.getOperatorId() - ,refundRecord.getOrderId(),refundRecord.getOperatorAppCode(),refundUserAssets.getId(),refundUserAssets.getAmount().negate(),refundUserAssets.getAmountType() - ,OperationReasonConstants.OP_REASON_BRING_NEW_USER_GIFT_RETRU_CANCEL,commonService,UserMoneyUnclaimed.YES); - }else if(refundUserAssets.getAmountStatus() == RefundUserAssets.AMOUNT_STATUS_NOT_RECEIVE){ - //鐢ㄦ埛鏈鍙栬褰曪紝杩樺師 - orderNodeBuilder.append("锛屾椿鍔ㄨ禒閫佺敤鎴锋湭棰嗗彇锛屼綔搴熺殑棰嗗彇璁板綍杩樺師"); - values.clear(); - values.put("id",refundUserAssets.getUserMoneyUnclaimedId()); - values.put("status",UserMoneyUnclaimed.STATUS_WAI); - sqlSentence.sqlUpdate("isDel = 0,isValid = 1 WHERE id = #{m.id} AND isDel = 1 AND isValid = 0 AND status = #{m.status}",values); - if(commonService.updateWhere(UserMoneyUnclaimedMapper.class,sqlSentence) != 1){ - throw new TipsException("娲诲姩璧犻�佽祫浜ц褰曠姸鎬佸凡鍙樺寲[浣滃簾]锛�"); + //---鏃犳搷浣滆褰� + //鑾峰彇鏈夋晥鐨勶紝濡傛灉鏈夛紝閭d箞灏变笉鍋氬鐞� + UserMoneyUnclaimed userMoneyUnclaimed = OrderTool.getActivityGiveByOrder(ordersTotal,BaseEntity.YES,commonService); + if(userMoneyUnclaimed != null){ + return; + } + //鑾峰彇鏃犳晥鐨勶紝濡傛灉鏈夛紝閭d箞灏辫澶勭悊瑙勫垯锛屾病鏈夊氨璺宠繃 + userMoneyUnclaimed = OrderTool.getActivityGiveByOrder(ordersTotal,BaseEntity.NO,commonService); + if(userMoneyUnclaimed == null){ + return; + } + Integer opType = BaseEntity.YES; + if(userMoneyUnclaimed.getStatus() == UserMoneyUnclaimed.STATUS_SUCCEED){ + opType = BaseEntity.NO; + } + //澧炲�奸噾鍒拌处澶勭悊 + userMoneyUnclaimed = UserMoneyUtil.setUserMoneyHandle(userMoneyUnclaimed.getUserId(), UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND,userMoneyUnclaimed.getOpNumber(),opType, OperationReasonConstants.OP_REASON_INVITE_ORDER,userMoneyUnclaimed.getOriginSubject(),userMoneyUnclaimed.getRemarks(),userMoneyUnclaimed.getOperatorId() + ,ordersTotal.getId(),ordersTotal.getActivityPageCode(),userMoneyUnclaimed.getMoneyRuleId(),commonService); + }else{ + //鏈夋搷浣滆褰� + for(RefundUserAssets refundUserAssets:refundUserAssetsList){ + //鍒ゆ柇鏄惁宸茬粡瀛樺湪浜嗗埆鐨勮禒閫佽褰� + if(OrderTool.getActivityGive(refundUserAssets.getUserId(),ordersTotal.getActivityPageCode(),BaseEntity.YES,commonService).size() == 0){ + //鏄惁鏈夋墸鍑忕敤鎴疯祫浜� + if(refundUserAssets.getAmountStatus() == RefundUserAssets.AMOUNT_STATUS_NORMAL){ + orderNodeBuilder.append("锛屾椿鍔ㄨ禒閫佸鍔犳垚鍔�"); + UserMoneyUtil.setNewUserMoneyUnclaimed(refundUserAssets.getUserId(),refundRecord.getRemarks(),"閫�娆句綔搴�:娲诲姩璧犻�佽祫閲戝洖閫�浣滃簾",refundUserAssets.getOperatorId() + ,refundRecord.getOrderId(),refundRecord.getOperatorAppCode(),refundUserAssets.getId(),refundUserAssets.getAmount().negate(),refundUserAssets.getAmountType() + ,OperationReasonConstants.OP_REASON_BRING_NEW_USER_GIFT_RETRU_CANCEL,commonService,UserMoneyUnclaimed.YES); + }else if(refundUserAssets.getAmountStatus() == RefundUserAssets.AMOUNT_STATUS_NOT_RECEIVE){ + //鐢ㄦ埛鏈鍙栬褰曪紝杩樺師 + orderNodeBuilder.append("锛屾椿鍔ㄨ禒閫佺敤鎴锋湭棰嗗彇锛屼綔搴熺殑棰嗗彇璁板綍杩樺師"); + values.clear(); + values.put("id",refundUserAssets.getUserMoneyUnclaimedId()); + values.put("status",UserMoneyUnclaimed.STATUS_WAI); + sqlSentence.sqlUpdate("isDel = 0,isValid = 1 WHERE id = #{m.id} AND isDel = 1 AND isValid = 0 AND status = #{m.status}",values); + if(commonService.updateWhere(UserMoneyUnclaimedMapper.class,sqlSentence) != 1){ + throw new TipsException("娲诲姩璧犻�佽祫浜ц褰曠姸鎬佸凡鍙樺寲[浣滃簾]锛�"); + } } } - } - //璁板綍浣滃簾 - values.clear(); - values.put("id",refundUserAssets.getId()); - values.put("status",RefundUserAssets.STATUS_CANCEL); - values.put("oldStatus",RefundUserAssets.STATUS_NORMAL); - sqlSentence.sqlSentence("status = #{m.status} WHERE id = #{m.id} AND status = #{m.oldStatus}",values); - if(commonService.updateWhere(RefundUserAssetsMapper.class,sqlSentence) != 1){ - throw new TipsException("娲诲姩璧犻�佽祫浜ч��娆捐褰曠姸鎬佸凡鍙樺寲[浣滃簾]锛�"); + //璁板綍浣滃簾 + values.clear(); + values.put("id",refundUserAssets.getId()); + values.put("status",RefundUserAssets.STATUS_CANCEL); + values.put("oldStatus",RefundUserAssets.STATUS_NORMAL); + sqlSentence.sqlSentence("status = #{m.status} WHERE id = #{m.id} AND status = #{m.oldStatus}",values); + if(commonService.updateWhere(RefundUserAssetsMapper.class,sqlSentence) != 1){ + throw new TipsException("娲诲姩璧犻�佽祫浜ч��娆捐褰曠姸鎬佸凡鍙樺寲[浣滃簾]锛�"); + } } } } -- Gitblit v1.8.0