Bladeren bron

feature 修改dev 配置的namespace

xiahan 4 maanden geleden
bovenliggende
commit
dc6a28d6c3

+ 17 - 30
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwBillingRecordServiceImpl.java

@@ -6,6 +6,7 @@ import com.rongwe.zhsw.system.domain.*;
 import com.rongwe.zhsw.system.dto.PaymentRequestDTO;
 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.SwBillManagementUnpaidDao;
 import com.rongwei.zhsw.system.dao.SwBillingRecordDao;
@@ -70,29 +71,20 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
     @Override
     @Transactional(rollbackFor = Exception.class)
     public R windowPayment(PaymentRequestDTO paymentRequestDTO) throws Exception {
-
         try {
-
             log.info("窗口缴费开始");
-
-            if (paymentRequestDTO.getIds()==null){
-
-                log.info("无账单缴费");
+            if (paymentRequestDTO.getIds()==null || paymentRequestDTO.getIds().isEmpty()){
+                log.debug("无账单缴费");
                 windowPaymentNoBill(paymentRequestDTO);
             }else {
-
-                log.info("有账单缴费");
+                log.debug("有账单缴费");
                 windowPaymentHasBill(paymentRequestDTO);
             }
-
             log.info("窗口缴费结束");
-
         }catch (Exception e ){
             log.error("缴费失败 {}",e.getMessage());
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return R.error(e.getMessage());
+            return R.error("缴费失败!");
         }
-
         return R.ok();
     }
 
@@ -104,6 +96,9 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
     private void windowPaymentHasBill(PaymentRequestDTO paymentRequestDTO) {
 
         List<String> ids = paymentRequestDTO.getIds();
+        if(ids==null || ids.isEmpty()){
+            throw new CustomException("参数异常");
+        }
         // 查询待缴费账单
         List<SwBillManagementUnpaidDo> unpaidBills = queryUnpaidBills(paymentRequestDTO.getIds());
 
@@ -119,11 +114,8 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
 
      */
     private void windowPaymentNoBill(PaymentRequestDTO paymentRequestDTO) {
-
-
         //生成缴费记录
         addNewBillRecord(paymentRequestDTO,null);
-
     }
 
     /**
@@ -173,7 +165,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
                 .setModifyuserid(currentUser.getId())
                 .setTenantid(currentUser.getTenantid())
                 .setDatasource(paymentRequestDTO.getDatasource())
-                 .setPaidin(paymentRequestDTO.getPaidin())
+                .setPaidin(paymentRequestDTO.getPaidin())
                 .setModifyusername(currentUser.getName());
     }
 
@@ -193,7 +185,9 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
         //根据户号获取 用户记录
         SwUserManagementDo user = swUserManagementService.getBaseMapper().
                 selectOne(new LambdaQueryWrapper<SwUserManagementDo>().eq(SwUserManagementDo::getUsernumber, paymentRequestDTO.getUsernumber()));
-
+        if(user==null){
+            throw new CustomException("户号不存在");
+        }
 
         SwBillingRecordDo add = buildBaseBillingRecord(paymentRequestDTO,currentUser,user);
 
@@ -220,24 +214,16 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
 
     private void createBills(List<SwBillManagementUnpaidDo> list, SwBillingRecordDo add, SysUserVo currentUser) {
         List<SwBillManagementPaidDo> paidList = new ArrayList<>();
-
+        SwBillManagementPaidDo paid;
         for (SwBillManagementUnpaidDo unpaid : list) {
-
-
-            SwBillManagementPaidDo paid = new SwBillManagementPaidDo();
+            paid = new SwBillManagementPaidDo();
             BeanUtils.copyProperties(unpaid, paid);
             // 新生成的 已缴费账单
             paid.setStatus(PAIDINSTATUS)
                     //缴费记录ID
-                    .setPaymentrecordid(add.getId())
-                    .setCreateuserid(currentUser.getId())
-                    .setCreateusername(currentUser.getName())
-                    .setCreatedate(new Date())
-                    .setModifydate(new Date())
-                    .setModifyuserid(currentUser.getId())
-                    .setModifyusername(currentUser.getName());
+                    .setPaymentrecordid(add.getId());
+            ZHSWCommonUtils.initModelGeneralParameters(paid,currentUser);
             paidList.add(paid);
-
         }
         // 保存已缴费账单
         swBillManagementPaidService.saveBatch(paidList);
@@ -325,6 +311,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
         String randomStr = String.format("%03d", randomNumber);
         LocalDateTime now = LocalDateTime.now();
         add.setBillingnumber(now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + randomStr);
+
     }
 
 

+ 14 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/utils/WxApi.java

@@ -3,6 +3,8 @@ package com.rongwei.zhsw.system.utils;
 import com.wechat.pay.java.core.Config;
 import com.wechat.pay.java.core.RSAAutoCertificateConfig;
 import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
+import com.wechat.pay.java.service.payments.jsapi.model.Amount;
+import com.wechat.pay.java.service.payments.jsapi.model.Payer;
 import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
 import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
 import org.springframework.core.io.ClassPathResource;
@@ -49,6 +51,18 @@ public class WxApi {
 
     public PrepayWithRequestPaymentResponse prepayWithRequestPayment() {
         PrepayRequest request = new PrepayRequest();
+        request.setAppid("wxaec1c618349b81a5");
+        request.setMchid(merchantId);
+        request.setDescription("pei pei pei");
+        request.setOutTradeNo("1217752501201407033233368018");
+        request.setNotifyUrl("https://www.weixin.qq.com/wxpay/pay.php");
+        Amount amount = new Amount();
+        amount.setTotal(100);
+        amount.setCurrency("CNY");
+        request.setAmount(amount);
+        Payer payer = new Payer();
+        payer.setOpenid("orz5h7OO73yAkf9_WQ0KIYF1iZ5U");
+        request.setPayer(payer);
         // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
         // 调用接口
         return service.prepayWithRequestPayment(request);

+ 6 - 34
zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwBillManagementPaidDo.java

@@ -1,6 +1,7 @@
 package com.rongwe.zhsw.system.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -19,7 +20,7 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @TableName("sw_bill_management_paid")
-public class SwBillManagementPaidDo implements Serializable {
+public class SwBillManagementPaidDo extends BaseDo implements Serializable {
     private static final long serialVersionUID = -12565293614671354L;
     /**
      * 主键
@@ -33,38 +34,6 @@ public class SwBillManagementPaidDo implements Serializable {
      * 扩展json格式配置
      */
     private String roption;
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-    /**
-     * 备注
-     */
-    private String remark;
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-    /**
-     * 创建人
-     */
-    private String createusername;
-    /**
-     * 修改人
-     */
-    private String modifyusername;
     /**
      * 账单编号
      */
@@ -184,7 +153,10 @@ public class SwBillManagementPaidDo implements Serializable {
      * 缴费日期
      */
     private Date paymentdate;
-
+    /**
+     * 缴费记录ID
+     */
+    private String waterusageid;
 
 }
 

+ 3 - 0
zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwBillManagementUnpaidDo.java

@@ -158,6 +158,9 @@ public class SwBillManagementUnpaidDo extends BaseDo implements Serializable {
      */
     private String meterreadingcorrectionstatus;
 
+    /**
+     * 缴费记录ID
+     */
     private String waterusageid;
 
 }

+ 2 - 2
zhsw-entity/src/main/java/com/rongwe/zhsw/system/dto/PaymentRequestDTO.java

@@ -7,11 +7,11 @@ import java.util.List;
 
 @Data
 public class PaymentRequestDTO {
-    //已缴费
+    //已缴费金额
     private BigDecimal paidin;
     //账单ids
     private List<String> ids;
-    //数据来源
+    //数据来源 缴费标识
     private String  datasource;
     //户号
     private String usernumber;