Browse Source

实收信息查询修改
交易金额大于零判断

wangli 4 years ago
parent
commit
3bbd2cbd12

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/commom/model/ResultStatus.java

@@ -65,7 +65,7 @@ public enum ResultStatus {
     OPERATE_RECORD_NOT_EXIT(-704,"未查询到有效记录"),
     ClOSING_ACCCOUNT_ERROR_EXIT(-705,"添加失败:账期已存在,不允许重复添加"),
     ClOSING_ACCCOUNT_ERROR_NOT_EXIT(-706,"结账失败:账期不存在"),
-    PAYFEE_TRANSAMOUNT_BELOW_ZERO(-707,"客户预存账户余额不足"),
+    PAYFEE_TRANSAMOUNT_BELOW_ZERO(-707,"交易金额必须大于零"),
     PAYFEE_QUERY_NO_CUSTOMER(-708,"未查询到有效客户信息"),
     WATER_PROPERTY_EDIT_EXIT(-709,"该用水性质已被应用,无法编辑"),
     WATER_PROPERTY_DELETE_EXIT(-709,"该用水性质已被应用,无法删除"),

+ 21 - 16
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayFeeServiceImp.java

@@ -52,6 +52,10 @@ public class PayFeeServiceImp implements PayFeeService {
     BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
 
     public PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype){
+        //交易金额不可为负数
+        if(transAmount.compareTo(BigDecimal.ZERO)!=1){
+            throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
+        }
 //        String result="";   //执行结果描述
         String result="<br>实收金额:"+String.format("%.2f",transAmount)+"元";
         BigDecimal fees=BigDecimal.ZERO;    //抵扣金额
@@ -101,10 +105,7 @@ public class PayFeeServiceImp implements PayFeeService {
         //如果传入时间则用传入的时间做交易时间
         LocalDateTime localDateTime=LocalDateTime.now();
 
-        //交易金额不可为负数
-        if(transAmount.compareTo(BigDecimal.ZERO)==-1){
-            throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
-        }
+
 
         //生成批次号
         // 微信:W  现金、预存账户:C 银行:B 支付宝:A
@@ -273,6 +274,10 @@ public class PayFeeServiceImp implements PayFeeService {
     */
    @Transactional(rollbackFor = Exception.class)
     public String payFee(String accountnumber, String metercode, BigDecimal transAmount, Integer payway , LocalDateTime transTime, List<BigInteger> receivableIds,Integer siteId,Integer customerId,Integer userId) {
+       //交易金额不可为负数
+       if(transAmount.compareTo(BigDecimal.ZERO)!=1){
+           throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
+       }
         LoginUser loginUser = UserUtil.getCurrentUser();
         if(loginUser !=null){
             if(siteId==null  )
@@ -346,10 +351,7 @@ public class PayFeeServiceImp implements PayFeeService {
         if(transTime != null){
             localDateTime=transTime;
         }
-        //交易金额不可为负数
-        if(transAmount.compareTo(BigDecimal.ZERO)==-1){
-            throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
-        }
+
 
         //生成批次号
        // 微信:W  现金、预存账户:C 银行:B 支付宝:A
@@ -514,6 +516,11 @@ public class PayFeeServiceImp implements PayFeeService {
      */
     @Transactional(rollbackFor = Exception.class)
     public PayfeeResult rechargefeeCounter(String  accountId , BigDecimal transAmount, Integer payway ){
+
+        //交易金额不可为负数
+        if(transAmount.compareTo(BigDecimal.ZERO)!=1){
+            throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
+        }
         LoginUser loginUser = UserUtil.getCurrentUser();
 
         Integer siteId = loginUser.getSiteId();
@@ -535,10 +542,7 @@ public class PayFeeServiceImp implements PayFeeService {
         //如果传入时间则用传入的时间做交易时间
         LocalDateTime localDateTime=LocalDateTime.now();
 
-        //交易金额不可为负数
-        if(transAmount.compareTo(BigDecimal.ZERO)==-1){
-            throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
-        }
+
 
         //根据客户id
         PayCustomRechargeDto payCustomRechargeDto = null;
@@ -576,6 +580,10 @@ public class PayFeeServiceImp implements PayFeeService {
      */
     @Transactional(rollbackFor = Exception.class)
     public String rechargefee(String accountnumber, String metercode, BigDecimal transAmount, Integer payway , LocalDateTime transTime,Integer siteId,Integer customerId,Integer userId){
+        //交易金额不可为负数
+        if(transAmount.compareTo(BigDecimal.ZERO)!=1){
+            throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
+        }
         LoginUser loginUser = UserUtil.getCurrentUser();
         if(loginUser !=null) {
             if (siteId == null) {
@@ -603,10 +611,7 @@ public class PayFeeServiceImp implements PayFeeService {
         if(transTime != null){
             localDateTime=transTime;
         }
-        //交易金额不可为负数
-        if(transAmount.compareTo(BigDecimal.ZERO)==-1){
-            throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
-        }
+
 
         //根据客编或者水编获取客户信息
         PayCustomRechargeDto payCustomRechargeDto = null;

+ 1 - 1
smart-city-platform/src/main/resources/mapper/pay/PayPayReceivedMapper.xml

@@ -88,7 +88,7 @@
             max(rece.create_date) as "transtime",
             max(rece.invoice_id) as "invoiceId",
             max(canceltime) as "canceltime",
-            (select name from sc_user where id= max(reced.cancelperson)) as "cancelperson",
+            (select name from sc_user where id= max(rece.cancelperson)) as "cancelperson",
             rece.year as "year",
             rece.month as "month"
         from pay_pay_received rece