Browse Source

微信缴费,退款是,生成已缴账单传入待缴账单创建人,退款更新缴费记录退款人为微信的openId

huangpeng 4 months ago
parent
commit
f3b9247530

+ 1 - 1
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/SwRefundRequestRecordService.java

@@ -14,5 +14,5 @@ import com.rongwei.rwcommon.base.R;
 public interface SwRefundRequestRecordService  extends IService<SwRefundRequestRecordDO> {
 
 
-    R refundApplication( String id);
+    R refundApplication(String id, String openId);
 }

+ 10 - 2
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwBillingRecordServiceImpl.java

@@ -238,6 +238,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
         }
         List<SwBillManagementPaidDo> paidList = new ArrayList<>();
         SwBillManagementPaidDo paid;
+        Date now = new Date();
         for (SwBillManagementUnpaidDo unpaid : list) {
             paid = new SwBillManagementPaidDo();
             BeanUtils.copyProperties(unpaid, paid);
@@ -245,8 +246,15 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
             paid.setStatus(PAIDINSTATUS)
                     //缴费记录ID
                     .setPaymentrecordid(add.getId())
-                            .setPaymentdate(new Date());
-            ZHSWCommonUtils.initModelGeneralParameters(paid, null);
+                            .setPaymentdate(now);
+       //     ZHSWCommonUtils.initModelGeneralParameters(paid, null);
+            paid.setDeleted("0");
+            paid.setCreatedate(now);
+            paid.setCreateuserid(unpaid.getCreateuserid());
+            paid.setCreateusername(unpaid.getCreateusername());
+            paid.setModifydate(now);
+            paid.setModifyuserid(unpaid.getModifyuserid());
+            paid.setModifyusername(unpaid.getModifyusername());
             paidList.add(paid);
         }
         // 保存已缴费账单

+ 13 - 8
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwRefundRequestRecordServiceImpl.java

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwe.zhsw.system.domain.*;
 import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
-import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.zhsw.system.dao.SwRefundRequestRecordDao;
 import com.rongwei.zhsw.system.service.*;
@@ -25,8 +24,7 @@ import java.util.List;
 import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
 
 import static com.rongwei.zhsw.system.utils.SaveConstans.billInfo.PENDINGSTATUS;
-import static com.rongwei.zhsw.system.utils.SaveConstans.billReccord.FULLREFUNDSTATUS;
-import static com.rongwei.zhsw.system.utils.SaveConstans.billReccord.PARTIALREFUNDSTATUS;
+import static com.rongwei.zhsw.system.utils.SaveConstans.billReccord.*;
 import static com.rongwei.zhsw.system.utils.SaveConstans.refundApply.*;
 
 /**
@@ -57,7 +55,7 @@ public class SwRefundRequestRecordServiceImpl extends ServiceImpl<SwRefundReques
 
     @Override
     @Transactional
-    public R refundApplication(String id) {
+    public R refundApplication(String id, String openId) {
 
         log.info("开始退款申请");
 
@@ -76,7 +74,7 @@ public class SwRefundRequestRecordServiceImpl extends ServiceImpl<SwRefundReques
         try {
 
             // 1.缴费记录表更新:
-            updateBillRecord(refundRequestRecordDO,currentUser);
+            updateBillRecord(refundRequestRecordDO,currentUser,openId);
 
             //2. 更新退款记录
             processRefundSuccess(refundRequestRecordDO, currentUser,REFUNDSUCCESSFUL);
@@ -198,15 +196,22 @@ public class SwRefundRequestRecordServiceImpl extends ServiceImpl<SwRefundReques
      *
      * @param refundRequestRecordDO
      * @param currentUser
+     * @param openId
      */
-    private void updateBillRecord(SwRefundRequestRecordDO refundRequestRecordDO, SysUserVo currentUser) {
+    private void updateBillRecord(SwRefundRequestRecordDO refundRequestRecordDO, SysUserVo currentUser, String openId) {
         // 将对应的 【退款金额】【退款人】【退款时间】记录到 缴费记录表中, 当前用户
         SwBillingRecordDo swBillingRecordUpdateDo = new SwBillingRecordDo();
         swBillingRecordUpdateDo.setId(refundRequestRecordDO.getPaymentrecordid());
         swBillingRecordUpdateDo.setRefundtime(new Date());
-        swBillingRecordUpdateDo.setRefundoperatorid(currentUser.getId());
-        swBillingRecordUpdateDo.setRefundoperatorname(currentUser.getName());
         swBillingRecordUpdateDo.setRefundamount(refundRequestRecordDO.getRefundamount());
+        //微信退款传入 缴费记录 openid
+        if (refundRequestRecordDO.getDatasource().equals(DATASOURCEWECHAT)){
+            swBillingRecordUpdateDo.setRefundoperatorid(openId);
+            swBillingRecordUpdateDo.setRefundoperatorname(openId);
+        }else {
+            swBillingRecordUpdateDo.setRefundoperatorid(currentUser.getId());
+            swBillingRecordUpdateDo.setRefundoperatorname(currentUser.getName());
+        }
 
 
         //全额退款 系统需要同时缴费记录的缴费 状态 更新为 “全部退款” 状态, 金额不做更新

+ 2 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/utils/SaveConstans.java

@@ -59,6 +59,8 @@ public class SaveConstans {
          */
         public static final String DATASOURCEBALANCEDEDUCTION = "2";
 
+        public static final String DATASOURCEWECHAT = "3";
+
 
         /**
          * 账单报表修正   --已修正状态

+ 6 - 1
zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/RefundServiceImpl.java

@@ -21,6 +21,7 @@ import com.rongwei.zhsw.system.dao.CommonBusinessDao;
 import com.rongwei.zhsw.system.service.impl.SwBillingRecordServiceImpl;
 import com.rongwei.zhsw.system.service.impl.SwEnterpriseConfigInfoServiceImpl;
 import com.rongwei.zhsw.system.service.impl.SwRefundRequestRecordServiceImpl;
+import com.rongwei.zhsw.system.utils.WeChatUtils;
 import com.rongwei.zhsw.system.utils.WxRefundApi;
 import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
 import com.rongwei.zhsw.system.wechat.RefundService;
@@ -256,7 +257,11 @@ public class RefundServiceImpl implements RefundService {
         // 更新缴费记录相关信息
         swRefundRequestRecordService.getBaseMapper().updateWeChatRefundInfo(deKey, outRefundNo,
                 refundId, analysisStr, weChatRefundNoticeVo.getSuccessTime(), "3");
-        swRefundRequestRecordService.refundApplication(swRefundRequestRecordDO.getId());
+
+        //获取微信标识
+        String openId = WeChatUtils.getCurrentWeChatOpenId();
+
+        swRefundRequestRecordService.refundApplication(swRefundRequestRecordDO.getId(),openId);
         return ResponseEntity.status(HttpStatus.OK).body("");
     }
 }

+ 1 - 1
zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/SwRefundRequestRecordController.java

@@ -19,6 +19,6 @@ public class SwRefundRequestRecordController {
     @PostMapping("/refundApplication")
     @ResponseBody
     public R refundApplication(@RequestBody Map<String, Object> map) {
-        return swRefundRequestRecordService.refundApplication(map.get("id").toString());
+        return swRefundRequestRecordService.refundApplication(map.get("id").toString(), null);
     }
 }