Преглед на файлове

Merge branch '20200918' of http://114.135.61.188:53000/ZONIOT/water-iot into 20200918

oppadmin преди 4 години
родител
ревизия
4fd4873932
променени са 22 файла, в които са добавени 384 реда и са изтрити 105 реда
  1. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java
  2. 16 1
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayBaseAccountController.java
  3. 24 0
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayFeeController.java
  4. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayBaseAccountMapper.java
  5. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayRechargeaccountMapper.java
  6. 55 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/BankCancelPayFeeParm.java
  7. 26 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/AccountInfo.java
  8. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/PayBaseCustomerandmeterrela.java
  9. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/EstimateMsgSendService.java
  10. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/EstimatedValveService.java
  11. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/impl/EstimatedValveServiceImpl.java
  12. 5 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java
  13. 143 4
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayFeeServiceImp.java
  14. 12 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayMessagetemplateServiceImp.java
  15. 1 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayPayReceivedServiceImpl.java
  16. 4 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayBaseAccountService.java
  17. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayFeeService.java
  18. 8 8
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java
  19. 31 85
      smart-city-platform/src/main/resources/application-prd.properties
  20. 4 0
      smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml
  21. 19 3
      smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml
  22. 21 0
      smart-city-platform/src/main/resources/mapper/pay/PayRechargeaccountMapper.xml

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java

@@ -92,7 +92,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/payFee/payFee")
                 .antMatchers("/payFee/payFee","/payFee/checkBill","/payFee/payFeeAmount","/payFee/queryUserInfo")
                 .antMatchers("/amount/synDeviceReplaceRecord")
-                .antMatchers("/pay/synAccountInfo")
+                .antMatchers("/pay/synAccountInfo","/pay/getAccountInfoByMetercode")
                 .antMatchers("/printinvoice/InvoicePrintRequest")
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
                 .antMatchers("/device/synArchies")

+ 16 - 1
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayBaseAccountController.java

@@ -6,6 +6,7 @@ import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 import com.bz.smart_city.service.pay.PayBaseAccountService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -15,7 +16,10 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Crated by Zjy on 2020-04-22 9:45
@@ -150,5 +154,16 @@ public class PayBaseAccountController {
             return new AjaxMessage(1,"未查询到有效数据","");
         }
     }
-
+    @PostMapping("/getAccountInfoByMetercode")
+    @ApiOperation("根据水表编码获取客户信息")
+    public AjaxMessage<List<AccountInfo>> getAccountInfoByMetercode(
+            @ApiParam(value = "水表编码") @RequestBody Map<String,Object> args){
+        if(args.containsKey("metercodes")){
+            List<String> metercodes = (List<String>)args.get("metercodes");
+            if(metercodes.size() > 0){
+                return new AjaxMessage<>(ResultStatus.OK,payBaseAccountService.getAccountInfoByMetercode(metercodes));
+            }
+        }
+        return new AjaxMessage(ResultStatus.ERROR,"查询条件为空");
+    }
 }

+ 24 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayFeeController.java

@@ -292,7 +292,31 @@ public class PayFeeController {
         }
     }
 
+    @PostMapping("/cancelPayFee")
+    @ApiOperation(value = "银行缴费接口——冲正")
+    public BankPayfeeMsg cancelPayFee(@RequestBody BankCancelPayFeeParm bankCancelPayFeeParm){
 
+
+        try{
+            String parmCheck = bankCancelPayFeeParm.checkParmIsNull();
+            if(StringUtils.isNotBlank(parmCheck)){
+                return new BankPayfeeMsg("0002",parmCheck);
+            }
+            PayPayAgentbranch payPayAgentbranch =  payFeeService.selectPayAgentbranchInfo(bankCancelPayFeeParm.getAgentCode(), customerId);
+            if(null == payPayAgentbranch || null == payPayAgentbranch.getId()){
+                return new BankPayfeeMsg("0003","代收单位不存在");
+            }
+            if(null == payPayAgentbranch.getPaykey() ||!bankCancelPayFeeParm.getAgentPwd().equals(payPayAgentbranch.getPaykey())){
+                return new BankPayfeeMsg("0004","代收单位密钥错误");
+            }
+
+//            return payFeeService.payfeeByBank(payPayAgentbranch,bankPayFeeParm.getOrderCode(),bankPayFeeParm.getAccountNumber(),bankPayFeeParm.getMoney(),bankPayFeeParm.getPayTime());
+        return payFeeService.cancelPayFee(payPayAgentbranch,bankCancelPayFeeParm);
+        }catch (Exception e){
+            e.printStackTrace();
+            return new BankPayfeeMsg("0005","系统异常");
+        }
+    }
 }
 
 

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayBaseAccountMapper.java

@@ -4,6 +4,7 @@ import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.ProgramItem;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
@@ -65,4 +66,6 @@ public interface PayBaseAccountMapper {
     int updateDeviceAddr(@Param("accountId")BigInteger accountId,@Param("siteId") Integer siteId, @Param("customerId") Integer customerId,@Param("address") String address);
 
     List<PayBaseAccount> getCustIdAndSiteId();
+
+    List<AccountInfo> getAccountInfoByMetercode(@Param("metercodes")List<String> metercodes);
 }

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayRechargeaccountMapper.java

@@ -22,6 +22,8 @@ public interface PayRechargeaccountMapper {
 
     PayRechargeaccountDto findById(@Param("id") BigInteger id, @Param("accountId")BigInteger accountId);
 
+    PayRechargeaccountDto findByAccountInfo(PayRechargeaccountDto payRechargeaccountDto);
+
     void update(PayRechargeaccountDto payRechargeaccountDto);
 
     void insert(PayRechargeaccountDto payRechargeaccountDto);

+ 55 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/BankCancelPayFeeParm.java

@@ -0,0 +1,55 @@
+package com.bz.smart_city.dto.pay.payfee;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * @description
+ * @auto wangli
+ * @data 2021/3/2 17:08
+ */
+@Data
+@Api("缴费冲正参数")
+public class BankCancelPayFeeParm implements Serializable {
+
+    private static final long serialVersionUID = -6936728284254923683L;
+
+    @ApiModelProperty("代收单位编号(必填)")
+    private String agentCode;
+    @ApiModelProperty("代收单位验证密钥")
+    private String agentPwd;
+    @ApiModelProperty("交易流水号(必填),银行生成流水号,系统按交易流水号进行冲正")
+    private String orderCode;
+    @ApiModelProperty("用户编号")
+    private String accountNumber;
+    @ApiModelProperty("缴费总金额(包含预存)需要缴费的金额一致")
+    private String money;
+    @ApiModelProperty("取消缴费时间,格式为yyyyMMddhhmmss")
+    private String cancelPayTime;
+
+    public String checkParmIsNull(){
+        if(StringUtils.isBlank(this.agentCode)){
+            return "代收单位编号为空";
+        }
+        if(StringUtils.isBlank(this.agentPwd)){
+            return "代收单位验证密钥为空";
+        }
+        if(StringUtils.isBlank(this.orderCode)){
+            return "交易流水号为空";
+        }
+        if(StringUtils.isBlank(this.accountNumber)){
+            return "用户编号为空";
+        }
+        if(StringUtils.isBlank(this.money)){
+            return "缴费总金额为空";
+        }
+        if(StringUtils.isBlank(this.cancelPayTime)){
+            return "取消缴费时间为空";
+        }
+        return null;
+    }
+}

+ 26 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/AccountInfo.java

@@ -0,0 +1,26 @@
+package com.bz.smart_city.entity.pay.archives;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @description
+ * @auto wangli
+ * @data 2021/2/21 9:59
+ */
+@Data
+@Api(value = "客户信息")
+public class AccountInfo {
+
+    @ApiModelProperty("水表编码")
+    private String metercode;
+    @ApiModelProperty("客户名称")
+    private String userName;
+    @ApiModelProperty("客户编码")
+    private String accountNumber;
+    @ApiModelProperty("联系电话")
+    private String phone;
+
+
+}

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/PayBaseCustomerandmeterrela.java

@@ -34,12 +34,14 @@ public class PayBaseCustomerandmeterrela {
     private String metercode;
     @ApiModelProperty(value = "业务状态", position = 7)
     private Integer businessstate;
+    private String businessstateName;
     @ApiModelProperty(value = "机构ID", position = 8)
     private BigInteger officeId;
     @ApiModelProperty(value = "住房类型", position = 9)
     private Integer housetype;
     @ApiModelProperty(value = "结算方式", position = 10)
     private Integer calculateway;
+    private String calculatewayName;
     @ApiModelProperty(value = "开户类别", position = 11)
     private Integer customercategory;
     @ApiModelProperty(value = "开户分组", position = 12)

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/EstimateMsgSendService.java

@@ -10,4 +10,5 @@ import java.math.BigInteger;
 public interface EstimateMsgSendService {
     void afterPropertiesSet();
     void send(Integer siteId, Integer customerId);
+    void saveQrtzTask(BigInteger siteId, BigInteger customerId,String sendTime);
 }

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/EstimatedValveService.java

@@ -1,5 +1,7 @@
 package com.bz.smart_city.quartz.service;
 
+import java.math.BigInteger;
+
 /**
  * @author xjh
  * @version 计费
@@ -8,4 +10,5 @@ package com.bz.smart_city.quartz.service;
 public interface EstimatedValveService {
     void afterPropertiesSet();
     void startValve(Integer siteId,Integer customerId);
+    void saveQrtzTask(BigInteger siteId, BigInteger customerId, String sendTime);
 }

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/impl/EstimatedValveServiceImpl.java

@@ -77,7 +77,7 @@ public class EstimatedValveServiceImpl implements EstimatedValveService, Initial
                 String currTime = LocalDateTime.now().format(dfYmd) + " " + sendTime;;
                 DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                 LocalDateTime localDateTime = LocalDateTime.parse(currTime,df);
-                localDateTime = localDateTime.plusMinutes(60);
+                localDateTime = localDateTime.plusMinutes(10);
                 String cron = String.format("%s %s %s * * ?",localDateTime.getSecond(),localDateTime.getMinute(),localDateTime.getHour());
                 //String cron ="0 40 14 * * ?";
                 log.info("预计费推送阀控:" + cron);

+ 5 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java

@@ -10,6 +10,7 @@ import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.ProgramItem;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 import com.bz.smart_city.service.pay.PayBaseAccountService;
 import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -403,4 +404,8 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
 
     }
 
+    @Override
+    public List<AccountInfo> getAccountInfoByMetercode(List<String> metercodes){
+        return payBaseAccountMapper.getAccountInfoByMetercode(metercodes);
+    }
 }

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

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.bz.smart_city.commom.exception.ServiceException;
+import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.HttpClientUtils;
 import com.bz.smart_city.commom.util.HttpRequest;
@@ -18,6 +19,7 @@ import com.bz.smart_city.entity.pay.*;
 import com.bz.smart_city.service.pay.PayFeeService;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -25,12 +27,10 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -66,6 +66,9 @@ public class PayFeeServiceImp implements PayFeeService {
     @Resource
     private PayControlRecordMapper payControlRecordMapper;
 
+    @Resource
+    private PayRechargeaccountMapper payRechargeaccountMapper;
+
     @Value("${Sync.Data.Url}")
     private String payValveCommondUrl;
 
@@ -1453,4 +1456,140 @@ public class PayFeeServiceImp implements PayFeeService {
         }
         return false;
     }
+
+
+    @Override
+    public BankPayfeeMsg cancelPayFee(PayPayAgentbranch payPayAgentbranch,BankCancelPayFeeParm bankCancelPayFeeParm){
+        Integer siteId=payPayAgentbranch.getSiteId();
+
+        Integer customerId = payPayAgentbranch.getCustomerId();
+        //订单号查询第三方交易记录
+        PayAgenttransactionDto payAgenttransactionDto = payFeeMapper.selectAgenttransaction(bankCancelPayFeeParm.getOrderCode());
+        if(payAgenttransactionDto != null ){
+            //获取账期
+            BaseClosingAccountInfo closingAccountInfo = payFeeMapper.getLastClosingAccount(siteId,customerId);
+            //客户编码
+            String accountnumber = payAgenttransactionDto.getAccountnumber();
+            //生成新的批次号
+            String newPayseriesno = null;
+            //取消的批次号
+            String payseriesno =payAgenttransactionDto.getPayseriesno();
+
+            if(payAgenttransactionDto.getAmount() != null && payAgenttransactionDto.getAmount().compareTo(new BigDecimal(bankCancelPayFeeParm.getMoney())) == 0){
+                if(payAgenttransactionDto.getState() != 4){
+                    //获取相同批次号相同的实收信息
+                    List<PayPayReceived> payReceiveds =  payPayReceivedMapper.findBySeriesno(payseriesno,siteId,customerId);
+                    //获取同批次号的交易明细
+                    List<PayTransactiondetails> payTransactiondetailsList = payTransactiondetailsMapper.findBySeriesno(payseriesno,siteId,customerId,null);
+
+                    //获取预存账户信息
+                    PayRechargeaccountDto rechDao = new PayRechargeaccountDto();
+                    rechDao.setSiteId(new BigInteger(String.valueOf(siteId)));
+                    rechDao.setCustomerId(new BigInteger(String.valueOf(customerId)));
+                    rechDao.setAccountnumber(payAgenttransactionDto.getAccountnumber());
+                    PayRechargeaccountDto payRechargeaccount = payRechargeaccountMapper.findByAccountInfo(rechDao);
+                    if(payRechargeaccount == null ){
+                        return new BankPayfeeMsg("3003","业务状态异常");
+                    }
+                    //作废第三方
+                    payPayReceivedMapper.cancelCheckAgentPayseriesno(payseriesno,siteId,customerId);
+                    payPayReceivedMapper.updateReceivedCancel(payseriesno,siteId,customerId);
+                    LocalDateTime time = LocalDateTime.now();
+                    //回退实收
+                    for(PayPayReceived Received:payReceiveds){
+                        if(StringUtils.isBlank(newPayseriesno)){
+                            newPayseriesno=Util.getBatchNo(payseriesno.substring(0,1),Received.getAccountnumber());
+                        }
+                        //回退实收对应的应收
+                        payPayReceivedMapper.updateDebtById(Received.getReceivableId(),Received.getReceivedamount());
+                        //作废当前实收
+                        Received.setIscanceled(1);
+
+                        Received.setCancelperson(new BigInteger("1"));
+                        Received.setCanceltime(time);
+                        Received.setState(4);//交易状态 0待对账 1入账 2对账失败 3对账成功 4作废
+                        Received.setUpdateBy(new BigInteger("1"));
+                        Received.setUpdateDate(time);
+                        Received.setId(Received.getId());
+                        payPayReceivedMapper.update(Received);
+
+                        //生成负数实收
+                        Received.setIscanceled(0);
+                        Received.setLadderlevel(Received.getLadderlevel());
+                        Received.setCanceledrecordId(Received.getId());
+                        Received.setPayseriesno(newPayseriesno);
+                        Received.setName(Received.getName()+"取消");
+                        Received.setReceivedamount(Received.getReceivedamount().negate());
+                        Received.setIscanceled(0);
+
+                        if(closingAccountInfo != null){
+                            Received.setYear(closingAccountInfo.getYear());
+                            Received.setMonth(closingAccountInfo.getMonth());
+                        }else{
+                            Received.setYear(time.getYear());
+                            Received.setMonth(time.getMonthValue());
+                        }
+                        Received.setCreateBy(new BigInteger("1"));
+                        Received.setCreateDate(time);
+                        Received.setUpdateBy(new BigInteger("1"));
+                        Received.setUpdateDate(time);
+                        Received.setRemarks("");
+                        Received.setDelFlag("0");
+                        Received.setSiteId(new BigInteger(String.valueOf(siteId)));
+                        Received.setCustomerId(new BigInteger(String.valueOf(customerId)));
+                        payPayReceivedMapper.insert(Received);
+                    }
+                    //回退交易明细
+                    for(PayTransactiondetails payTransactiondetails:payTransactiondetailsList){
+                        //回退预存账户余额
+                        BigDecimal remaining = payRechargeaccount.getRemaining();
+                        BigDecimal transamount = payTransactiondetails.getTransamount();
+                        BigDecimal backRemaining=remaining.subtract(transamount);
+                        payRechargeaccount.setRemaining(backRemaining);
+                        payRechargeaccountMapper.update(payRechargeaccount);
+
+                        payTransactiondetails.setIscanceled(1);
+                        payTransactiondetails.setCancelperson(new BigInteger(String.valueOf(siteId)));
+                        payTransactiondetails.setCanceltime(LocalDateTime.now());
+
+                        payTransactiondetails.setIscanceled(1);//标记为取消状态
+                        payTransactiondetails.setCancelperson(new BigInteger("1"));
+                        payTransactiondetails.setCanceltime(LocalDateTime.now());
+                        payTransactiondetails.setUpdateBy(new BigInteger("1"));
+                        payTransactiondetails.setUpdateDate(LocalDateTime.now());
+                        payTransactiondetailsMapper.updateCancelInfo(payTransactiondetails);
+
+                        payTransactiondetails.setPayseriesno(payseriesno);
+                        payTransactiondetails.setName(payTransactiondetails.getName()+"取消");
+                        payTransactiondetails.setIscanceled(0);
+                        payTransactiondetails.setLastrecreamaing(payRechargeaccount.getRemaining());
+                        payTransactiondetails.setTransamount(payTransactiondetails.getTransamount().negate());
+                        payTransactiondetails.setTranstime(LocalDateTime.now());
+                        if(closingAccountInfo != null){
+                            payTransactiondetails.setYear(closingAccountInfo.getYear());
+                            payTransactiondetails.setMonth(closingAccountInfo.getMonth());
+                        }else{
+                            payTransactiondetails.setYear(time.getYear());
+                            payTransactiondetails.setMonth(time.getMonthValue());
+                        }
+
+                        payTransactiondetails.setCanceledrecordId(payTransactiondetails.getId());
+
+                        if(payTransactiondetails.getTranstype()==2){
+                            payTransactiondetails.setTranstype(4);
+                            payTransactiondetails.setTranstypeLabel("账户转预存");
+                        }
+                         payTransactiondetailsMapper.insert(payTransactiondetails);
+                    }
+                    //修改客户状态
+                    payFeeMapper.updateAccountState(rechDao.getAccountId());
+                }else{
+                    return new BankPayfeeMsg("3001","不能多次冲正");
+                }
+            }else{
+                return new BankPayfeeMsg("3002","与缴费金额不一致");
+            }
+        }
+        return new BankPayfeeMsg("9999","缴费冲正成功");
+    }
 }

+ 12 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayMessagetemplateServiceImp.java

@@ -5,6 +5,8 @@ import com.bz.smart_city.dao.pay.PayMessagetemplateMapper;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.pay.PayMessageTemplateDto;
 import com.bz.smart_city.quartz.service.ControlDayService;
+import com.bz.smart_city.quartz.service.EstimateMsgSendService;
+import com.bz.smart_city.quartz.service.EstimatedValveService;
 import com.bz.smart_city.service.pay.PayMessagesendrecordService;
 import com.bz.smart_city.service.pay.PayMessagetemplateService;
 import org.apache.commons.lang3.StringUtils;
@@ -32,6 +34,10 @@ public class PayMessagetemplateServiceImp implements PayMessagetemplateService {
     @Autowired
     ControlDayService controlDayService;
 
+    @Autowired
+    EstimateMsgSendService estimateMsgSendService;
+    @Autowired
+    EstimatedValveService estimatedValveService;
     public List<PayMessageTemplateDto> getAllMessageTemplate(PayMessageTemplateDto payMessageTemplateDto){
         return payMessagetemplateMapper.getAllMessageTemplate(payMessageTemplateDto);
     }
@@ -46,6 +52,8 @@ public class PayMessagetemplateServiceImp implements PayMessagetemplateService {
         payMessageTemplateDto.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
         payMessageTemplateDto.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
 
+        //
+
         if(payMessageTemplateDto.getId() != null){
             payMessagesendrecordService.deleteQrtzTask(payMessageTemplateDto.getId());
             payMessagetemplateMapper.update(payMessageTemplateDto);
@@ -61,6 +69,10 @@ public class PayMessagetemplateServiceImp implements PayMessagetemplateService {
                 payMessagetemplateMapper.insert(payMessageTemplateDto);
             }
         }
+        //修改预计费短信
+        estimateMsgSendService.saveQrtzTask(BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()),payMessageTemplateDto.getSendTime());
+        //修改预计费短信开关阀
+        estimatedValveService.saveQrtzTask(BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()),payMessageTemplateDto.getSendTime());
         payMessagesendrecordService.saveQrtzTask(payMessageTemplateDto);
         //保存模板后判断是不是自动发送短信
 //        if(payMessageTemplateDto.getSendType() == 0     //短信

+ 1 - 2
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayPayReceivedServiceImpl.java

@@ -107,6 +107,7 @@ public class PayPayReceivedServiceImpl implements PayPayReceivedService {
      */
     public void cancelReceivedByPayseriesno(  String payseriesno) {
         LoginUser loginUser = UserUtil.getCurrentUser();
+
         //生成新的批次号,截取取消实收批次号首字母
         String newPayseriesno = null;
 
@@ -124,7 +125,6 @@ public class PayPayReceivedServiceImpl implements PayPayReceivedService {
             payPayReceivedMapper.updateDebtById(Received.getReceivableId(),Received.getReceivedamount());
             //作废当前实收
             Received.setIscanceled(1);
-            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
             LocalDateTime time = LocalDateTime.now();
             Received.setCancelperson(new BigInteger(String.valueOf(loginUser.getId())));
             Received.setCanceltime(time);
@@ -157,7 +157,6 @@ public class PayPayReceivedServiceImpl implements PayPayReceivedService {
                 Received.setMonth(closingAccountInfo.getMonth());
             }else{
                 Calendar calendar= Calendar.getInstance();
-                calendar.add(Calendar.MONTH, 1);
                 Date date=calendar.getTime();
                 Received.setYear(Integer.valueOf(DateFormatUtils.format(date,"yyyy")));
                 Received.setMonth(Integer.valueOf(DateFormatUtils.format(date,"MM")));

+ 4 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayBaseAccountService.java

@@ -1,11 +1,13 @@
 package com.bz.smart_city.service.pay;
 
 
+import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 
 import java.math.BigInteger;
 import java.util.List;
@@ -40,4 +42,6 @@ public interface PayBaseAccountService {
     List<SynAccountInfo> getSynAccountInfo(String createDate);
 
     int updateAddrs(BigInteger custoemrId,String newAddress);
+
+    List<AccountInfo> getAccountInfoByMetercode(List<String> metercodes);
 }

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayFeeService.java

@@ -136,4 +136,6 @@ public interface PayFeeService {
 
     Boolean sendValveCommond(PayValveStateInfoDto payValveStateInfo );
 
+    BankPayfeeMsg cancelPayFee(PayPayAgentbranch payPayAgentbranch,BankCancelPayFeeParm bankCancelPayFeeParm);
+
 }

+ 8 - 8
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java

@@ -1250,16 +1250,16 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             objs[4] = customer.getMetereleno() != null ? customer.getMetereleno() :"";//水表电子号
             objs[5] = customer.getMetercode() != null ? customer.getMetercode() : "";//水表档案号
             objs[6] = customer.getPropertyName() != null ? customer.getPropertyName() : "";//用水性质
-            Integer calcuState = customer.getCalculateway() != null ? customer.getCalculateway() : 10;
-            String calcuName = paySysDictService.getDiceLabel(calcuState,"结算方式",new BigInteger(String.valueOf(loginUser.getSiteId())),
-                    new BigInteger(String.valueOf(loginUser.getCustomerId())));
-            objs[7] = calcuName;//结算方式
+//            Integer calcuState = customer.getCalculateway() != null ? customer.getCalculateway() : 10;
+//            String calcuName = paySysDictService.getDiceLabel(calcuState,"结算方式",new BigInteger(String.valueOf(loginUser.getSiteId())),
+//                    new BigInteger(String.valueOf(loginUser.getCustomerId())));
+            objs[7] = customer.getCalculatewayName();//结算方式
             objs[8] = customer.getAddress() != null ? customer.getAddress() : "";//安装地址
             objs[9] = customer.getOpendate() != null ? df.format(customer.getOpendate()) : "";//开户时间
-            Integer customerState = customer.getBusinessstate() != null ? customer.getBusinessstate() : 10;
-            String businessName = paySysDictService.getDiceLabel(customerState,"开户状态",new BigInteger(String.valueOf(loginUser.getSiteId())),
-                    new BigInteger(String.valueOf(loginUser.getCustomerId())));
-            objs[10] = businessName;//开户状态
+//            Integer customerState = customer.getBusinessstate() != null ? customer.getBusinessstate() : 10;
+//            String businessName = paySysDictService.getDiceLabel(customerState,"开户状态",new BigInteger(String.valueOf(loginUser.getSiteId())),
+//                    new BigInteger(String.valueOf(loginUser.getCustomerId())));
+            objs[10] = customer.getBusinessstateName();//开户状态
 
             dataList.add(objs);
         }

+ 31 - 85
smart-city-platform/src/main/resources/application-prd.properties

@@ -1,15 +1,15 @@
-server.port=8090
+server.port=8082
 server.servlet.context-path=/api
 
 #日志配置
 logging.level.root=info
-logging.path=/mnt/prd/platform/logs
+logging.path=./logs
 
 spring.thymeleaf.prefix=classpath:/templates/
 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
 #使用druid数据源
 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
-spring.datasource.url=jdbc:mysql://172.18.110.178:3306/smart_city?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.url=jdbc:mysql://10.0.0.142:3306/smart_city_sit_toll_system?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
 spring.datasource.username=root
 spring.datasource.password=100Zone@123
 spring.datasource.druid.initial-size=5
@@ -39,7 +39,7 @@ spring.jackson.time-zone=GMT+8
 #spring.jackson.joda-date-time-format: yyyy-MM-dd HH:mm:ss
 
 # redis
-spring.redis.host=172.18.110.178
+spring.redis.host=10.0.0.141
 spring.redis.port=6379
 spring.redis.password=100Zone@123
 spring.redis.database=1
@@ -50,12 +50,22 @@ spring.redis.jedis.pool.max-idle=8
 spring.redis.jedis.pool.max-wait=-1ms
 spring.redis.jedis.pool.min-idle=2
 
-spring.activiti.database-schema-update=true
-spring.activiti.check-process-definitions=false
-spring.activiti.job-executor-activate=false
-spring.activiti.async-executor-enabled=false
-#spring.activiti.process-definition-location-prefix=classpath:/processes/
-spring.activiti.history-level=full
+
+#============== kafka ===================
+# 指定kafka 代理地址,可以多个
+spring.kafka.bootstrap-servers=47.112.15.78:9092
+
+# 指定消费者group id
+spring.kafka.consumer.group-id = water_api_jf_valveStatus_received
+spring.kafka.consumer.auto-offset-reset=latest
+spring.kafka.consumer.enable-auto-commit=true
+#spring.kafka.consumer.auto-commit-interval=100
+
+# 指定消息key和消息体的编解码方式
+spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
+spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
+
+
 
 jwt.secret=smartCity123
 jwt.expiration=36000
@@ -64,8 +74,8 @@ jwt.tokenHead=Bearer
 
 spring.servlet.multipart.max-file-size=100MB
 spring.servlet.multipart.max-request-size=100MB
-spring.servlet.multipart.location=/opt/prd/platform/data
-files.path=/opt/prd/platform/data
+spring.servlet.multipart.location=/opt/prd/JF-platform/data
+files.path=/opt/prd/JF-platform/data
 
 #微信公众号
 wechat.oa.appid=wx6b2ce547cd593413
@@ -88,10 +98,7 @@ account.apply.success.wechat.openid=oCaAI5_y1JSdffomm4tk0OX9WOuk
 qcloudsms.appid=1400187546
 qcloudsms.appkey=6de933cbd59ed87e1b27e0061fb6af66
 
-com.zcxk.kafka.alarm.topic=sc_alarm_topic
-com.zcxk.kafka.card.topic=sc_card_topic
 com.zcxk.redis.websocket.topic=sc_websocket_topic
-com.zcxk.kafka.accept_add_account.topic=sc_accept_add_account_topic
 
 # quartz
 spring.quartz.job-store-type=jdbc
@@ -110,82 +117,21 @@ spring.quartz.properties.org.quartz.threadPool.threadPriority=5
 spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
 spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock=true
 
-#netty
-#不能用localhost,否则启动报异常:Unresolved address
-#tcp监听的端口
-websocket.port=6789
-# bossGroup的线程数
-websocket.boss.thread.count=200
-# worker的线程数
-websocket.worker.thread.count=200
-#是否使用长连接
-websocket.so.keepalive=true
-websocket.so.backlog=100
-system.water.meter.lora.code=LORAWM
-
-#kafka
-#============== kafka ===================
-# 指定kafka 代理地址,可以多个
-#spring.kafka.bootstrap-servers=192.168.0.157:9092
-spring.kafka.bootstrap-servers=114.135.61.188:36377
-
-#=============== provider  =======================
-#spring.kafka.producer.retries=0
-## 每次批量发送消息的数量
-#spring.kafka.producer.batch-size=16384
-#spring.kafka.producer.buffer-memory=33554432
-#
-# 指定消息key和消息体的编解码方式
-#spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
-#spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
-#=============== consumer  =======================
-# 指定消费者group id
-spring.kafka.consumer.group-id = water_api_jf_valveStatus_received
-spring.kafka.consumer.auto-offset-reset=latest
-spring.kafka.consumer.enable-auto-commit=true
-#spring.kafka.consumer.auto-commit-interval=100
-
-# 指定消息key和消息体的编解码方式
-spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
-spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
+service.domain=http://114.135.61.186:30002
 
-#\u9AD8\u5FB7\u5730\u56FE
-geomap.apikey=bb218fd3700b37dd1e02872365cab4d5
-geomap.api.url=https://restapi.amap.com/v3/geocode/geo
-#慧联无线网关查询接口
-easylinkin.api.url.gateway.ap=http://api.easylinkin.com/api/v1/application/ap
-
-service.domain=http://www.zoniot.com
-#富锦水司推送配置
-fj.push.customer.id=24
-fj.push.company.id=HUAXU
-fj.push.url=http://211.159.148.145:6021/SDKDCHtemp/ThirdMeterEnterServlet
-fj.meter.infto.url=http://211.159.148.145:6021/SDKDCHtemp/MeterEnterServlet
-#寄修流程配置
-system.channel.send.repair.code=SendAndRepair
-
-
-#CRM信息同步配置
-crm.login.url=http://183.62.175.139:5889/hxcrm/api/Ecp.OnlineUser.secretLogin
-crm.api.ur=http://183.62.175.139:5889/hxcrm/api/Crm.SnMgt.getMeterInformationList
-crm.login.username=CRM
-crm.login.password=CRM2019
-#rabbitmq
-spring.rabbitmq.host=222.86.88.126
-spring.rabbitmq.port=5627
-spring.rabbitmq.username=hdkj
-spring.rabbitmq.password=hdkj123
-spring.rabbitmq.virtual-host=/
-spring.rabbitmq.zy.topic=zyqueue
-
-#UDIP平台集成元管理url
-udip.unit.url=http://47.112.15.78:8322
 #发票请求打印接口
 invoice.print.url=http://nnfpbox.nuonuocs.cn/shop/buyer/allow/cxfKp/cxfServerKpOrderSync.action
 invoice.query.url=http://nnfpbox.nuonuocs.cn/shop/buyer/allow/ecOd/queryElectricKp.action
+
 #抄表数据同步接口
-Sync.Data.Url=http://114.135.61.188:58080
+Sync.Data.Url=http://39.108.175.9:8090
 
 #银行代收客户id
 payfee.bank.customerId=47
 
+
+
+
+
+
+

+ 4 - 0
smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml

@@ -347,6 +347,10 @@
             customer.opendate as "opendate",
             customer.businessstate as "businessstate",
             customer.calculateway as "calculateway",
+            (select label  from pay_sys_dict
+            where type ='开户状态' and value =ifnull(customer.businessstate,10) and site_id =#{siteId} and customer_id =#{customerId}) as "businessstateName",
+            (select label  from pay_sys_dict
+            where type ='结算方式' and value =ifnull(customer.calculateway,10) and site_id =#{siteId} and customer_id =#{customerId}) as "calculatewayName",
             device.water_meter_no as "metereleno"
         from pay_base_customerandmeterrela customer
         left join pay_base_account account on account.id = customer.account_id

+ 19 - 3
smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

@@ -553,14 +553,14 @@
             IFNULL(rd.reading,0) as CurrData
         from  sc_device scd
         left join pay_base_account pba on pba.id = scd.account_id  and pba.site_id=#{siteId} and pba.customer_id=#{customerId}
-        left join pay_base_customerandmeterrela ppr on ppr.metercode = scd.metercode and ppr.site_id=#{siteId} and ppr.customer_id=#{customerId}
+        left join pay_base_customerandmeterrela ppr on ppr.watermeter_id = scd.id and ppr.site_id=#{siteId} and ppr.customer_id=#{customerId}
         left join
         (SELECT a.watermeter_id,a.reading FROM pay_amount_waterusedamount_day AS a,
         (SELECT b.watermeter_id, MAX(b.read_date) AS read_date FROM pay_amount_waterusedamount_day AS b
-        where b.reading is not null and b.customer_id=#{customerId} and b.site_id=#{siteId}
+        where b.reading > 0 and b.customer_id=#{customerId} and b.site_id=#{siteId}
         GROUP BY b.watermeter_id)
         AS c WHERE a.watermeter_id=c.watermeter_id AND a.read_date = c.read_date)  rd on rd.watermeter_id = scd.id
-        where  scd.customer_id = #{customerId} and scd.account_id is not null
+        where  scd.customer_id = #{customerId}
         <if test="queryInfo != null and queryInfo != ''">
             and (
             scd.metercode like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
@@ -658,4 +658,20 @@
         c.customer_id is not null  and c.site_id is not null
         group by c.customer_id, c.site_id
     </select>
+
+    <select id="getAccountInfoByMetercode" resultType="com.bz.smart_city.entity.pay.archives.AccountInfo">
+        select
+            d.metercode
+            ,a.`name` as "userName"
+            ,a.accountnumber as "accountNumber"
+            ,a.mobilephone as "phone"
+        from pay_base_customerandmeterrela c
+        left join pay_base_account a on c.account_id = a.id
+        left join sc_device d on c.watermeter_id =d.id
+        where d.metercode in
+        <foreach collection="metercodes" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>

+ 21 - 0
smart-city-platform/src/main/resources/mapper/pay/PayRechargeaccountMapper.xml

@@ -68,6 +68,27 @@
             </if>
         </where>
     </select>
+
+    <select id="findByAccountInfo" resultType="com.bz.smart_city.dto.pay.PayRechargeaccountDto">
+        select
+        <include refid="mainColumnInfo"/>
+        from pay_pay_rechargeaccount a
+        <where>
+
+            <if test="siteId != null">
+                and a.site_id=#{siteId}
+            </if>
+            <if test="customerId != null">
+                and a.customer_id=#{customerId}
+            </if>
+            <if test="accountId != null">
+                and a.account_id=#{accountId}
+            </if>
+            <if test="accountnumber != null">
+                and a.accountnumber=#{accountnumber}
+            </if>
+        </where>
+    </select>
     <insert id="insert" parameterType="com.bz.smart_city.dto.pay.PayRechargeaccountDto" >
         insert INTO
         pay_pay_rechargeaccount