Browse Source

Merge remote-tracking branch 'origin/0727' into 0727

lin 4 years ago
parent
commit
58dfc7873d
34 changed files with 919 additions and 144 deletions
  1. 8 4
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayChargeSurveyController.java
  2. 2 3
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayFeeController.java
  3. 59 6
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayInvoiceController.java
  4. 2 24
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayPayReceiveContorller.java
  5. 13 4
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayChargeSurveyMapper.java
  6. 2 1
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayFeeMapper.java
  7. 21 2
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayInvoiceMapper.java
  8. 30 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayAmountSurveyDto.java
  9. 21 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayAmountSurveyListDto.java
  10. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayBaseAccountSelectAccountnumberDto.java
  11. 6 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayChargeSurveyDto.java
  12. 8 1
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayInvoiceDto.java
  13. 11 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayTransactionSurveyDto.java
  14. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PayfeeAccountInfoDto.java
  15. 4 1
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PayfeeReceivableInfo.java
  16. 31 22
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PrintInvoiceData.java
  17. 35 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PrintReceivedInfo.java
  18. 10 6
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayAmountSurvey.java
  19. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayInvoice.java
  20. 62 8
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/BaseClosingAccountInfoServiceImpl.java
  21. 3 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java
  22. 162 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayChargeSurveyServiceImpl.java
  23. 5 4
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayFeeServiceImp.java
  24. 104 21
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayInvoiceServiceImpl.java
  25. 7 7
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayPayReceivedServiceImpl.java
  26. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayChargeSurveyService.java
  27. 1 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayFeeService.java
  28. 1 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayPayReceivedService.java
  29. 18 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayinvoiceService.java
  30. 2 1
      smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml
  31. 96 1
      smart-city-platform/src/main/resources/mapper/pay/PayChargeSurveyMapper.xml
  32. 166 5
      smart-city-platform/src/main/resources/mapper/pay/PayInvoiceMapper.xml
  33. 4 1
      smart-city-platform/src/main/resources/mapper/pay/PayPayReceivedMapper.xml
  34. 15 13
      smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

+ 8 - 4
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayChargeSurveyController.java

@@ -5,10 +5,7 @@ import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.dto.LoginUser;
-import com.bz.smart_city.dto.pay.BaseClosingAccountInfoDto;
-import com.bz.smart_city.dto.pay.PayChargeSurveyDto;
-import com.bz.smart_city.dto.pay.PayFeeSueveyDto;
-import com.bz.smart_city.dto.pay.PayTransactionSurveyDto;
+import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.pay.PayTransactionSurvey;
 import com.bz.smart_city.entity.pay.archives.CustomerListInfo;
 import com.bz.smart_city.service.pay.PayChargeSurveyService;
@@ -56,4 +53,11 @@ public class PayChargeSurveyController {
         PayFeeSueveyDto payFeeSueveyDto = payChargeSurveyService.feeSurvey();
         return new AjaxMessage<PayFeeSueveyDto>(ResultStatus.OK, payFeeSueveyDto);
     }
+
+    @PostMapping("/amountSurvey")
+    @ApiOperation(value = "计费系统-水量概况")
+    public AjaxMessage<PayAmountSurveyDto> amountSurvey(){
+        PayAmountSurveyDto payAmountSurveyDto = payChargeSurveyService.amountSurver();
+        return new AjaxMessage<PayAmountSurveyDto>(ResultStatus.OK, payAmountSurveyDto);
+    }
 }

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

@@ -92,10 +92,9 @@ public class PayFeeController {
     @ApiOperation(value="收费界面查询客户信息,客户id是在查询出多用户时,选择某个用户")
     public AjaxMessage<List<PayfeeAccountInfoDto>> findPayfeeAccountInfo(
             @ApiParam(value = "开户id,查询多用户时,再次查询用id查询") @RequestParam(required = false)BigInteger id,
-            @ApiParam(value = "查询类型,1客户名称,2客户编码,3电话,4地址") @RequestParam(required = false)Integer queryType ,
-            @ApiParam(value = "查询内容") @RequestParam(required = false)String condition ){
+            @ApiParam(value = "查询内容,户编、户名、手机、地址") @RequestParam(required = false)String condition ){
 
-        return new AjaxMessage<List<PayfeeAccountInfoDto>>(ResultStatus.OK, payFeeService.findPayfeeAccountInfo(id, queryType , condition ));
+        return new AjaxMessage<List<PayfeeAccountInfoDto>>(ResultStatus.OK, payFeeService.findPayfeeAccountInfo(id , condition ));
     }
 
     @GetMapping("/getPayfeeDetaileBill")

+ 59 - 6
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayInvoiceController.java

@@ -6,15 +6,20 @@ import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.dto.pay.PayInvoiceDto;
 import com.bz.smart_city.dto.pay.PayMessageTemplateDto;
 import com.bz.smart_city.dto.pay.PayTransactiondetails;
+import com.bz.smart_city.dto.pay.payfee.PrintInvoiceData;
 import com.bz.smart_city.entity.pay.PayInvoice;
 import com.bz.smart_city.service.pay.PayinvoiceService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigInteger;
+import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 
 /**
@@ -30,13 +35,13 @@ public class PayInvoiceController {
     @Autowired
     private PayinvoiceService payinvoiceService;
 
-    @GetMapping("/getMessageTemplate")
+    @GetMapping("/getPrintInfoListPage")
     @ApiOperation("查询收据")
-    public AjaxMessage<Pagination<PayInvoiceDto>> getMessageTemplate(
-            @ApiParam(value = "查询条件", required = false) @RequestParam(required = false) String condition,
-            @ApiParam(value = "收据状态", required = false) @RequestParam(required = false) Integer state,
-            @ApiParam(value = "开票时间开始", required = false) @RequestParam(required = false) String startTime,
-            @ApiParam(value = "开票时间结束", required = false) @RequestParam(required = false) String endTime,
+    public AjaxMessage<Pagination<PayInvoiceDto>> getPrintInfoListPage(
+            @ApiParam(value = "查询条件,户编、户名、流水号", required = false) @RequestParam(required = false) String condition,
+            @ApiParam(value = "收据状态,2已使用 3作废", required = false) @RequestParam(required = false) Integer state,
+            @ApiParam(value = "开票时间开始 yyyyMMddHHmmss", required = false) @RequestParam(required = false) String startTime,
+            @ApiParam(value = "开票时间结束 yyyyMMddHHmmss", required = false) @RequestParam(required = false) String endTime,
             @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
             @ApiParam(value = "条数,非必传,默认10条", required = false, defaultValue = "10") @RequestParam(required = false, defaultValue = "10") int pageSize
 
@@ -55,4 +60,52 @@ public class PayInvoiceController {
         return new AjaxMessage<>(ResultStatus.OK);
     }
 
+    @GetMapping("/getPrintData")
+    @ApiOperation("获取打印数据")
+    public AjaxMessage< PrintInvoiceData> getPrintData(
+            @ApiParam(value = "缴费批次号", required = true) @RequestParam(required = true) String payseriesno,
+            @ApiParam(value = "交易类型,实收打印时为空", required = false) @RequestParam(required = false) Integer transType,
+            @ApiParam(value = "支付方式,查询返回信息的payway", required = true) @RequestParam(required = true) Integer payway ) {
+        if(transType !=null && transType==1 && payway == 4){	//单纯充值
+            return  new AjaxMessage<>(ResultStatus.OK,payinvoiceService.getPrintDataOfTrans(payseriesno));
+
+
+        }else{	//缴费
+            return  new AjaxMessage<>(ResultStatus.OK,payinvoiceService.getPrintDataOfReceived(payseriesno));
+        }
+    }
+
+    @GetMapping("/getPrintDataAgain")
+    @ApiOperation("补打票据")
+    public AjaxMessage<PrintInvoiceData> getPrintDataAgain(
+            @ApiParam(value = "票据id", required = true) @RequestParam(required = true) BigInteger id
+           ){
+
+        PayInvoiceDto payInvoiceDto = payinvoiceService.get(id);
+        String payseriesno = payinvoiceService.findPayseriesnoByPrint(id, 1);
+        if (StringUtils.isNotBlank(payseriesno)) {
+            PrintInvoiceData printInvoiceData= payinvoiceService.getPrintDataOfReceived(payseriesno);
+            printInvoiceData.setInvoiceNo(payInvoiceDto.getInvoiceno());
+            return new AjaxMessage<>(ResultStatus.OK,printInvoiceData);
+
+        } else {
+            payseriesno = payinvoiceService.findPayseriesnoByPrint(id, 2);
+            if (StringUtils.isNotBlank(payseriesno)) {
+                PrintInvoiceData printInvoiceData= payinvoiceService.getPrintDataOfTrans(payseriesno);
+                printInvoiceData.setInvoiceNo(payInvoiceDto.getInvoiceno());
+                return new AjaxMessage<>(ResultStatus.OK,printInvoiceData);
+            } else {
+                return new AjaxMessage<>(ResultStatus.OPERATE_RECORD_NOT_EXIT);
+            }
+        }
+    }
+
+    @PostMapping("/cancelPrintinfo")
+    @ApiOperation("作废票据")
+    public AjaxMessage<String> cancelPrintinfo(
+            @ApiParam(value = "票据id", required = true) @RequestParam(required = true) BigInteger id
+    ){
+        payinvoiceService.cancelPrintInfo(id);
+        return new AjaxMessage<>(ResultStatus.OK);
+    }
 }

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

@@ -73,32 +73,10 @@ public class PayPayReceiveContorller {
     @GetMapping("/findListInfo")
     @ApiOperation(value = "计费系统-查询实收下拉列表点击事件")
     public AjaxMessage<List<PayPayReceivedListDto>> findListInfo(
-        @ApiParam(value = "账期年", required = true) @RequestParam(required = true)Integer year,
-        @ApiParam(value = "账期月", required = true) @RequestParam(required = true) Integer month,
-        @ApiParam(value = "客户编码", required = true) @RequestParam(required = true)String accountnumber,
-        @ApiParam(value = "客户Id", required = true) @RequestParam(required = true)String accountId,
-        @ApiParam(value = "状态", required = false) @RequestParam(required = false) Integer state,
-        @ApiParam(value = "支付方式", required = false) @RequestParam(required = false) Integer payway,
-        @ApiParam(value = "开始日期,2020-04-08", required = false) @RequestParam(required = false) String beginDate,
-        @ApiParam(value = "结束日期,2020-04-08", required = false) @RequestParam(required = false) String endDate
+        @ApiParam(value = "交易流水号", required = true) @RequestParam(required = true)String payseriesno
     ){
-        try{
-            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            LocalDateTime startDf = null;
-            LocalDateTime endDf = null;
-            if(StringUtils.isNotBlank(beginDate)){
-                beginDate = beginDate +" 00:00:00";
-                startDf = LocalDateTime.parse(beginDate,df);
-            }
-            if(StringUtils.isNotBlank(endDate)){
-                endDate =endDate + " 23:59:59";
-                endDf = LocalDateTime.parse(endDate,df);
-            }
-            List<PayPayReceivedListDto> list = payPayReceivedService.findListByPayseriesno(year,month,accountnumber,state,payway,startDf,endDf);
+            List<PayPayReceivedListDto> list = payPayReceivedService.findListByPayseriesno(payseriesno);
             return new AjaxMessage<>(ResultStatus.OK,list);
-        }catch (Exception ex){
-            return new AjaxMessage<>(ResultStatus.ERROR,new ArrayList<PayPayReceivedListDto>());
-        }
     }
 
     @PostMapping("/cancelReceived")

+ 13 - 4
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayChargeSurveyMapper.java

@@ -1,10 +1,8 @@
 package com.bz.smart_city.dao.pay;
 
+import com.bz.smart_city.dto.pay.PayAmountSurveyListDto;
 import com.bz.smart_city.dto.pay.PayChangePeriodDto;
-import com.bz.smart_city.entity.pay.PayAccountSurvey;
-import com.bz.smart_city.entity.pay.PayChargeSurvey;
-import com.bz.smart_city.entity.pay.PayFeeSuevey;
-import com.bz.smart_city.entity.pay.PayTransactionSurvey;
+import com.bz.smart_city.entity.pay.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -64,4 +62,15 @@ public interface PayChargeSurveyMapper {
 
     public List<PayFeeSuevey> getFeeGroup(@Param("year")Integer year,@Param("month")Integer month,
                                           @Param("siteId")BigInteger siteId, @Param("customerId")BigInteger customerId);
+
+    public BigDecimal getAmountMonth(@Param("year")Integer year,@Param("month")Integer month,
+                                     @Param("siteId")BigInteger siteId, @Param("customerId")BigInteger customerId);
+
+    public void insertAmount(PayAmountSurvey payAmountSurvey);
+
+    public BigDecimal getAmountInfo(@Param("startDate")String startDate,@Param("endDate")String endDate,
+                                    @Param("siteId")BigInteger siteId, @Param("customerId")BigInteger customerId);
+
+    public List<PayAmountSurveyListDto> getAmountGroupList(@Param("year")Integer year,@Param("month")Integer month,
+                                                           @Param("siteId")BigInteger siteId, @Param("customerId")BigInteger customerId);
 }

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

@@ -3,6 +3,7 @@ package com.bz.smart_city.dao.pay;
 import com.bz.smart_city.dto.pay.PayCustomRechargeDto;
 import com.bz.smart_city.dto.pay.PayInvoiceDto;
 import com.bz.smart_city.dto.pay.payfee.*;
+import com.bz.smart_city.entity.ProgramItem;
 import com.bz.smart_city.entity.pay.BaseClosingAccountInfo;
 import com.bz.smart_city.entity.pay.PayReceivable;
 import org.apache.ibatis.annotations.Mapper;
@@ -33,7 +34,7 @@ public interface PayFeeMapper {
 
     void updateAccountState(@Param("accountId") BigInteger accountId);
 
-    List<PayfeeAccountInfoDto> findPayfeeAccountInfo(@Param("id")BigInteger id,@Param("queryType")Integer queryType ,@Param("condition")String condition,@Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+    List<PayfeeAccountInfoDto> findPayfeeAccountInfo(@Param("id")BigInteger id, @Param("condition")String condition, @Param("siteId") Integer siteId, @Param("customerId") Integer customerId,@Param("programItems") List<ProgramItem> programItems);
 
     PayfeeDetaileBill getPayfeeDetaileBill(@Param("accountId") BigInteger accountId);
 

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

@@ -1,17 +1,21 @@
 package com.bz.smart_city.dao.pay;
 
 import com.bz.smart_city.dto.pay.PayInvoiceDto;
+import com.bz.smart_city.dto.pay.PayTransactiondetails;
 import com.bz.smart_city.dto.pay.PayTransactiondetailsDto;
+import com.bz.smart_city.dto.pay.payfee.PrintInvoiceData;
+import com.bz.smart_city.dto.pay.payfee.PrintReceivedInfo;
 import com.bz.smart_city.entity.pay.PayInvoice;
 import com.bz.smart_city.entity.pay.PayPayReceived;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigInteger;
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
- * @description
+ * @description 收据打印
  * @auto wangli
  * @data 2020-07-30 8:39
  */
@@ -19,8 +23,23 @@ import java.util.List;
 public interface PayInvoiceMapper {
     void insert(PayInvoice payInvoice);
     List<PayInvoiceDto> findList(PayInvoiceDto payInvoiceDto);
+    PayInvoiceDto get(BigInteger id);
 
-    List<PayTransactiondetailsDto> findTransByPayseriesno(@Param("payseriesno") String payseriesno, @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+    List<PayTransactiondetails> findTransByPayseriesno(@Param("payseriesno") String payseriesno, @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
     List<PayPayReceived> findReceivedByPayseriesno(@Param("payseriesno") String payseriesno , @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
     void updatePrintInvoiceRecord(@Param("type") Integer type, @Param("payseriesno") String payseriesno, @Param("invoiceId") BigInteger invoiceId,@Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+    PrintInvoiceData getPrintDataOfTran(@Param("payseriesno")String payseriesno,@Param("siteId")Integer siteId,@Param("customerId")Integer customerId);
+    PrintInvoiceData getLastWaterUsedRecord(@Param("accountid")BigInteger accountId,@Param("date") LocalDateTime date, @Param("siteId")Integer siteId, @Param("customerId")Integer customerId);
+
+
+    PrintInvoiceData getDateRangeInfoPrint(@Param("payseriesno")String payseriesno,@Param("siteId")Integer siteId,@Param("customerId")Integer customerId);
+    PrintInvoiceData getAccountInfoPrint(@Param("accountId") BigInteger accountId);
+    List<PrintReceivedInfo>  getPayfeeInfoPrint(@Param("minPeriod")Integer minPeriod,@Param("maxPeriod")Integer maxPeriod,@Param("accountId")BigInteger accountId);
+    PrintInvoiceData getPayfeeRemainingPrint(@Param("accountId")BigInteger accountId,@Param("maxPeriod")Integer maxPeriod,@Param("payseriesno")String payseriesno);
+
+    String findPayseriesnoByPrint(@Param("id")BigInteger id, @Param("type")Integer type);
+
+    void deleteTransPrint(@Param("id")BigInteger id);
+    void deleteReceivedPrint(@Param("id")BigInteger id);
+    void cancelPayInvoice(@Param("id")BigInteger id,@Param("canceltime")LocalDateTime canceltime,@Param("cancelperson")BigInteger cancelperson);
 }

+ 30 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayAmountSurveyDto.java

@@ -0,0 +1,30 @@
+package com.bz.smart_city.dto.pay;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+@ApiModel("最近一年统计DTO")
+public class PayAmountSurveyDto {
+    @ApiModelProperty(value = "累计年度用水量")
+    private BigDecimal sumYearAmount;
+    @ApiModelProperty(value = "较上年比率")
+    private String lastYearRate;
+    @ApiModelProperty(value = "年比较 0下降  1上升")
+    private Integer lastYearIsUp;
+    @ApiModelProperty(value = "累计月度用水量")
+    private BigDecimal sumMonthAmount;
+    @ApiModelProperty(value = "较上月比率")
+    private String lastMonthRate;
+    @ApiModelProperty(value = "月比较 0下降  1上升")
+    private Integer lastMontIsUp;
+
+    //按月list
+    @ApiModelProperty(value = "月度list")
+    private List<PayAmountSurveyListDto> list;
+
+}

+ 21 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayAmountSurveyListDto.java

@@ -0,0 +1,21 @@
+package com.bz.smart_city.dto.pay;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel("最近一年统计DTO")
+public class PayAmountSurveyListDto {
+    @ApiModelProperty(value = "月用水量")
+    private BigDecimal sumAmount;
+    @ApiModelProperty(value = "年")
+    private Integer year;
+    @ApiModelProperty(value = "月")
+    private Integer month;
+    @ApiModelProperty(value = "2020-07")
+    private String periodDate;
+
+}

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

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.List;
 
 /**
@@ -13,6 +14,8 @@ import java.util.List;
 @Data
 @ApiModel(value = "开户管理-客户信息-按客户编号查询")
 public class PayBaseAccountSelectAccountnumberDto {
+    @ApiModelProperty(example = "0",notes = "客户id")
+    private BigInteger accountId	;
     @ApiModelProperty(example = "1",notes = "客户编号")
     private String	accountnumber	;
     @ApiModelProperty(example = "1",notes = "客户名称")

+ 6 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayChargeSurveyDto.java

@@ -14,14 +14,20 @@ public class PayChargeSurveyDto {
     private Integer accountNumber;
     @ApiModelProperty(value = "较上月")
     private String lastAccountRate;
+    @ApiModelProperty(value = "客户较上月 0下降 1上升")
+    private Integer lastAccountIsUp;
     @ApiModelProperty(value = "水表总数")
     private Integer meterNumber;
     @ApiModelProperty(value = "较上月")
     private String lastMeterRate;
+    @ApiModelProperty(value = "水表较上月 0下降 1上升")
+    private Integer lastMeterIsUp;
     @ApiModelProperty(value = "开户总数")
     private Integer customerNumber;
     @ApiModelProperty(value = "较上月")
     private String lastCustomerRate;
+    @ApiModelProperty(value = "开户较上月 0下降 1上升")
+    private Integer lastCustomerIsUp;
 
     //饼状图
     @ApiModelProperty(value = "开户率")

+ 8 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayInvoiceDto.java

@@ -1,7 +1,9 @@
 package com.bz.smart_city.dto.pay;
 
 import com.bz.smart_city.entity.ProgramItem;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -16,6 +18,7 @@ import java.util.List;
  * @data 2020-07-30 8:18
  */
 @Data
+@ApiModel("收据管理")
 public class PayInvoiceDto {
 
     @ApiModelProperty(value = "收据id")
@@ -32,14 +35,16 @@ public class PayInvoiceDto {
     private Integer state;
     @ApiModelProperty(value = "票据状态")
     private String stateLabel;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     @ApiModelProperty(value = "开票日期")
     private LocalDateTime createDate;
     @ApiModelProperty(value = "开票人")
     private String createByName;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     @ApiModelProperty(value = "作废时间")
     private LocalDateTime canceltime;
     @ApiModelProperty(value = "作废人")
-    private BigInteger cancelpersonName;
+    private String cancelpersonName;
 
 
     @ApiModelProperty(value = "数据查询(票据号、户编、户名)",  hidden = true)
@@ -48,8 +53,10 @@ public class PayInvoiceDto {
     private Integer siteId;
     @ApiModelProperty(value = "客户id",  hidden = true)
     private Integer customerId;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     @ApiModelProperty(value = "开票时间",  hidden = true)
     private LocalDateTime startTime;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     @ApiModelProperty(value = "开票时间",  hidden = true)
     private LocalDateTime endTime;
 

+ 11 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayTransactionSurveyDto.java

@@ -14,22 +14,33 @@ public class PayTransactionSurveyDto {
     private BigDecimal incomeNumber;
     @ApiModelProperty(value = "较上月比率")
     private String lastIncomeRate;
+    @ApiModelProperty(value = "收入较上月 0下降 1新增")
+    private Integer lastIncomeIsUp;
+
     @ApiModelProperty(value = "现金")
     private BigDecimal cashIncome;
     @ApiModelProperty(value = "较上月比率")
     private String lastCashRate;
+    @ApiModelProperty(value = "现金较上月 0下降 1新增")
+    private Integer lastCashIsUp;
     @ApiModelProperty(value = "微信支付")
     private BigDecimal wechatIncome;
     @ApiModelProperty(value = "较上月比率")
     private String lastWechatRate;
+    @ApiModelProperty(value = "微信较上月 0下降 1新增")
+    private Integer lastWechatIsUp;
     @ApiModelProperty(value = "支付宝支付")
     private BigDecimal alipayIncome;
     @ApiModelProperty(value = "较上月比率")
     private String lastAlipayRate;
+    @ApiModelProperty(value = "支付宝较上月 0下降 1新增")
+    private Integer lastAlipayIsUp;
     @ApiModelProperty(value = "银行收入")
     private BigDecimal bankIncome;
     @ApiModelProperty(value = "较上月比率")
     private String lastBankRate;
+    @ApiModelProperty(value = "银行较上月 0下降 1新增")
+    private Integer lastBankIsUp;
     @ApiModelProperty(value = "账期年")
     private Integer year;
     @ApiModelProperty(value = "账期月")

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

@@ -1,5 +1,6 @@
 package com.bz.smart_city.dto.pay.payfee;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -36,6 +37,7 @@ public class PayfeeAccountInfoDto {
     private String vatno;
     @ApiModelProperty(value = "电子邮箱" )
     private String email;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     @ApiModelProperty(value = "开户时间" )
     private LocalDateTime opendate;
     @ApiModelProperty(value = "水表编码" )

+ 4 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PayfeeReceivableInfo.java

@@ -1,5 +1,6 @@
 package com.bz.smart_city.dto.pay.payfee;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -7,6 +8,7 @@ import lombok.Data;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
@@ -36,6 +38,7 @@ public class PayfeeReceivableInfo {
     private BigDecimal payamount;
     @ApiModelProperty(value = "应收金额")
     private BigDecimal receivablefee;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     @ApiModelProperty(value = "创建时间")
-    private Date createDate;
+    private LocalDateTime createDate;
 }

+ 31 - 22
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PrintInvoiceData.java

@@ -1,8 +1,13 @@
 package com.bz.smart_city.dto.pay.payfee;
 
 import com.bz.smart_city.entity.pay.PayPayReceived;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -11,18 +16,23 @@ import java.util.List;
  * @auto wangli
  * @data 2020-07-30 16:18
  */
+@Data
+@ApiModel("打印信息")
 public class PrintInvoiceData {
 
-    @ApiModelProperty(value = "充值日期")
+    @ApiModelProperty(value = "票据号码")
+    private String invoiceNo ;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @ApiModelProperty(value = "充值日期" ,hidden = true)
     private LocalDateTime createDate;	//充值日期
     @ApiModelProperty(value = "本期余额")
-    private Double remaining;	//本期余额
-    @ApiModelProperty(value = "交易金额\t·实收金额")
-    private Double transamount;	//交易金额	·实收金额
+    private BigDecimal remaining;	//本期余额
+    @ApiModelProperty(value = "交易金额·实收金额")
+    private BigDecimal transamount;	//交易金额	·实收金额
     @ApiModelProperty(value = "上期金额")
-    private Double lastRemaining;	//上期金额
+    private BigDecimal lastRemaining;	//上期金额
     @ApiModelProperty(value = "客户ID")
-    private String accountId;	//客户ID
+    private BigInteger accountId;	//客户ID
     @ApiModelProperty(value = "客户名称")
     private String accountname;	//客户名称
     @ApiModelProperty(value = "客户编码")
@@ -30,29 +40,28 @@ public class PrintInvoiceData {
     @ApiModelProperty(value = "客户地址")
     private String address;	//客户地址
     @ApiModelProperty(value = "抄表止度")
-    private Double reading;	//抄表止度
+    private BigDecimal reading;	//抄表止度
     @ApiModelProperty(value = "收费日期")
     private String paydate;	//收费日期
-    @ApiModelProperty(value = "抄表日期")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @ApiModelProperty(value = "抄表日期" ,hidden = true)
     private LocalDateTime recorddate;	//抄表日期
     @ApiModelProperty(value = "应收金额")
-    private Double receivablefee;	//应收金额
+    private BigDecimal receivablefee;	//应收金额
     @ApiModelProperty(value = "上期止度")
-    private Double lastreading;	//上期止度
+    private BigDecimal lastreading;	//上期止度
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @ApiModelProperty(value = "上期抄表日期", hidden = true)
+    private LocalDateTime lastrecorddate;	//上期抄表日期
     @ApiModelProperty(value = "收费账期区间")
     private String dateRange;	//收费账期区间
     @ApiModelProperty(value = "收费员")
-    private String createUser;	//收费员
-    @ApiModelProperty(value = "水量")
-    private Integer amount;	//水量
-    @ApiModelProperty(value = "单价")
-    private Double price;	//单价
-    @ApiModelProperty(value = "单价1")
-    private Double price1;	//单价1
-    @ApiModelProperty(value = "单价3")
-    private Double price3;	//单价3
-    @ApiModelProperty(value = "单价4")
-    private Double price4;	//单价4
+    private String createBy;	//收费员
     @ApiModelProperty(value = "实收信息")
-    private List<PayPayReceived> payReceiveds;
+    private List<PrintReceivedInfo> printReceivedInfo;
+
+    @ApiModelProperty(value = "最大账期(year*12+month)" ,hidden = true)
+    private Integer maxPeriod;
+    @ApiModelProperty(value = "最小账期(year*12+month)" ,hidden = true)
+    private Integer minPeriod;
 }

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

@@ -0,0 +1,35 @@
+package com.bz.smart_city.dto.pay.payfee;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+/**
+ * @description
+ * @auto wangli
+ * @data 2020-07-31 19:25
+ */
+@Data
+@ApiModel("收据打印详情")
+public class PrintReceivedInfo {
+
+    @ApiModelProperty(value = "客户id")
+    private BigInteger accountId;
+    @ApiModelProperty(value = "收费类型")
+    private String feetypename;
+    @ApiModelProperty(value = "阶梯")
+    private String ladderlevel;
+    @ApiModelProperty(value = "阶梯标签")
+    private String ladderlevelname;
+    @ApiModelProperty(value = "水量")
+    private BigDecimal payamount;
+    @ApiModelProperty(value = "单价")
+    private BigDecimal waterbasicprice;
+    @ApiModelProperty(value = "实收金额(应收金额)")
+    private BigDecimal receivedamount;
+    @ApiModelProperty(value = "划扣金额")
+    private BigDecimal autoReceivedamount;
+}

+ 10 - 6
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayAmountSurvey.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
 
@@ -12,17 +13,20 @@ import java.time.LocalDateTime;
 @ApiModel("用水量统计表")
 public class PayAmountSurvey {
     @ApiModelProperty(value = "id", position = 1)
-    private BigInteger id;
+    private String id;
     @ApiModelProperty(value = "水量统计", position = 2)
-    private BigInteger amountNumber;
+    private BigDecimal amountNumber;
+    @ApiModelProperty(value = "水量统计", position = 2)
+    private BigDecimal lastAmountNumber;
     @ApiModelProperty(value = "账期年", position = 3)
-    private String year;
+    private Integer year;
     @ApiModelProperty(value = "账期月", position = 4)
-    private String month;
+    private Integer month;
+    private LocalDateTime periodDate;
     @ApiModelProperty(value = "创建者", hidden = true)
-    private BigInteger createBy;
+    private String createBy;
     @ApiModelProperty(value = "修改者", hidden = true)
-    private BigInteger updateBy;
+    private String updateBy;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "创建时间", hidden = true)
     private LocalDateTime createDate = LocalDateTime.now();

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

@@ -1,6 +1,7 @@
 package com.bz.smart_city.entity.pay;
 
 import com.bz.smart_city.dto.pay.BaseDto;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -35,6 +36,7 @@ public class PayInvoice extends PayBaseInfo{
     private BigInteger officeId;
     @ApiModelProperty(value = "作废人")
     private BigInteger cancelperson;
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     @ApiModelProperty(value = "作废时间")
     private LocalDateTime canceltime;
     @ApiModelProperty(value = "账期年")

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

@@ -12,6 +12,7 @@ import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.pay.BaseClosingAccountInfoDto;
 import com.bz.smart_city.dto.pay.PayBaseConfigDto;
 import com.bz.smart_city.entity.pay.PayAccountSurvey;
+import com.bz.smart_city.entity.pay.PayAmountSurvey;
 import com.bz.smart_city.entity.pay.PayChargeSurvey;
 import com.bz.smart_city.entity.pay.PayTransactionSurvey;
 import com.bz.smart_city.service.pay.BaseClosingAccountInfoService;
@@ -126,26 +127,30 @@ public class BaseClosingAccountInfoServiceImpl implements BaseClosingAccountInfo
                         BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()),null);
                 for (int i=0; i<list.size(); i++){
                     int state = list.get(i).getState();
-                    if(state == 1){
+                    /*if(state == 1){*/
                         //把历史结账数据存进去,但不包含本期未结账的
-                        //this.insertAccountNumber(list.get(i).getYear(),list.get(i).getMonth());
+                        this.insertAccountNumber(list.get(i).getYear(),list.get(i).getMonth());
                         //历史交易数据
-                        //this.insertTransaction(list.get(i).getYear(),list.get(i).getMonth());
+                        this.insertTransaction(list.get(i).getYear(),list.get(i).getMonth());
                         //历史交易数据
                         this.insertFeeSummary(list.get(i).getYear(),list.get(i).getMonth());
-                    }
+                        //历史水量
+                        this.insetAmountInfo(list.get(i).getYear(),list.get(i).getMonth());
+                    /*}*/
                 }
             }else if(count > 0){
                 //存储本期未结账数据
-                //this.insertAccountNumber(year,month);
+                this.insertAccountNumber(year,month);
                 //本期交易未结账数据
-                //this.insertTransaction(year,month);
+                this.insertTransaction(year,month);
                 //本期交易数据
                 this.insertFeeSummary(year,month);
+                //本期水量
+                this.insetAmountInfo(year,month);
             }
 
             // 更新本账期
-            /*String msg2 = year + "年" + String.format("%02d", month) + "月已经结账";
+            String msg2 = year + "年" + String.format("%02d", month) + "月已经结账";
             baseClosingAccountInfoDto.setEndTime(new Date());
             baseClosingAccountInfoDto.setRemarks(msg2);
             baseClosingAccountInfoDto.setState(1);
@@ -169,7 +174,7 @@ public class BaseClosingAccountInfoServiceImpl implements BaseClosingAccountInfo
                 baseClosingAccountInfoDto.setMonth(1);
             }
             baseClosingAccountInfoDto.setName(baseClosingAccountInfoDto.getYear()+"年"+String.format("%02d", baseClosingAccountInfoDto.getMonth())+"月");
-            this.add(baseClosingAccountInfoDto);*/
+            this.add(baseClosingAccountInfoDto);
         }else{
             message.setStatus(-707);
             message.setMsg(msg);
@@ -408,6 +413,55 @@ public class BaseClosingAccountInfoServiceImpl implements BaseClosingAccountInfo
 
     }
 
+    /**
+     * 添加水量汇总
+     * @param year
+     * @param month
+     */
+    public void insetAmountInfo(Integer year,Integer month){
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
+        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        String start = year+"-"+(String.format("%02d",month))+"-01";
+        PayAmountSurvey payAmountSurvey = new PayAmountSurvey();
+        //查询上月总数
+        Integer lastYear = null;
+        Integer lastMonth = null;
+        try {
+            if(month == 1){
+                lastYear = year-1;
+                lastMonth = 12;
+            }else{
+                lastYear = year;
+                lastMonth = month -1;
+            }
+            //获取本账期
+            BigDecimal payamount = payChargeSurveyMapper.getAmountMonth(year,month,siteId,customerId);
+            //获取上一账期
+            BigDecimal lastPayamount = payChargeSurveyMapper.getAmountMonth(lastYear,lastMonth,siteId,customerId);
+            payAmountSurvey.setAmountNumber(payamount);
+            payAmountSurvey.setLastAmountNumber(lastPayamount);
+            payAmountSurvey.setYear(year);
+            payAmountSurvey.setMonth(month);
+            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            LocalDateTime ldt = LocalDateTime.parse(start+" 00:00:00",df);
+            payAmountSurvey.setPeriodDate(ldt);
+            payAmountSurvey.setId(Util.createUUIDId());
+            payAmountSurvey.setDelFlag("0");
+            payAmountSurvey.setRemarks("");
+            payAmountSurvey.setCreateBy(loginUser.getCreateBy());
+            payAmountSurvey.setCreateDate(LocalDateTime.now());
+            payAmountSurvey.setUpdateBy(loginUser.getCreateBy());
+            payAmountSurvey.setUpdateDate(LocalDateTime.now());
+            payAmountSurvey.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
+            payAmountSurvey.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
+            payChargeSurveyMapper.insertAmount(payAmountSurvey);
+        }catch(Exception e){
+            e.printStackTrace();
+        }
+    }
+
     @Override
     public List<BaseClosingAccountInfoDto> getList(Integer year, Integer month) {
         LoginUser loginUser = UserUtil.getCurrentUser();

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

@@ -217,8 +217,10 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
                 payBaseAccountSelectAccountnumberDtoList.get(0).setPayBaseAccountTransactionsDtoList(payTransactiondetailsDtos);
             }
             payBaseAccountSelectAccountnumberDtoList.get(0).setPayBaseAccountMeterDtoList(payBaseAccountMeterDtoList);
+            return payBaseAccountSelectAccountnumberDtoList.get(0);
+        }else{
+            return null;
         }
-        return payBaseAccountSelectAccountnumberDtoList.get(0);
     }
 
     /**

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

@@ -47,12 +47,19 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
           Date lastStartMonth = startDate.getTime(); //结果
           String lastStart = sdf.format(lastStartMonth);
           System.out.println("时间:"+lastStart);*/
-          DecimalFormat df = new DecimalFormat("0.0");
+          /*DecimalFormat df = new DecimalFormat("0.0");
           BigDecimal currentIncome = new BigDecimal("100");
           BigDecimal lastIncome = new BigDecimal("80");
           BigDecimal income = currentIncome.subtract(lastIncome).divide(lastIncome).multiply(new BigDecimal("100"));
           String a = df.format(income);
-          System.out.println("收入费率:"+a);
+          System.out.println("收入费率:"+a);*/
+
+          String a = "-90.89";
+          String b = "90.89";
+
+          String a1 = a.split("-")[1];
+          String b1 = b.split("-")[1];
+          System.out.println("带负数转换:"+a1+";不带负数转换:"+b1);
       }catch (Exception e) {
           e.printStackTrace();
       }
@@ -106,7 +113,13 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             String lastAccountRate = "";
             float num =(float)((sumCurrentAccount - sumLastAccount)/(sumLastAccount != null && sumLastAccount != 0 ? sumLastAccount : 1)*100);
             lastAccountRate = df.format(num);
+
+            Integer lastAccountIsUp = num > 0  ? 1 : 0;
+            //截取字符串
+            lastAccountRate = lastAccountRate.contains("-") ? lastAccountRate.split("-")[1] : lastAccountRate;
+
             //赋值客户总数跟上月比率
+            payChargeSurveyDto.setLastAccountIsUp(lastAccountIsUp);
             payChargeSurveyDto.setAccountNumber(sumAccount);
             payChargeSurveyDto.setLastAccountRate(lastAccountRate);
 
@@ -122,7 +135,11 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             String lastMeterRate = "";
             num =(float)((sumCurrentMeter - sumLastMeter)/(sumLastMeter != null && sumLastMeter != 0 ? sumLastMeter : 1)*100);
             lastMeterRate = df.format(num);
+            Integer lastMeterIsUp = num > 0  ? 1 : 0;
+            //截取字符串
+            lastMeterRate = lastMeterRate.contains("-") ? lastMeterRate.split("-")[1] : lastMeterRate;
             //赋值水表总数跟上月比率
+            payChargeSurveyDto.setLastMeterIsUp(lastMeterIsUp);
             payChargeSurveyDto.setMeterNumber(sumMeter);
             payChargeSurveyDto.setLastMeterRate(lastMeterRate);
 
@@ -137,7 +154,11 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             String lastCusstomerRate = "";
             num =(float)((sumCurrentCustomer - sumLastCustomer)/(sumLastCustomer != null && sumLastCustomer != 0 ? sumLastCustomer : 1)*100);
             lastCusstomerRate = df.format(num);
+            Integer lastCustomerIsUp = num > 0  ? 1 : 0;
+            //截取字符串
+            lastCusstomerRate = lastCusstomerRate.contains("-") ? lastCusstomerRate.split("-")[1] : lastCusstomerRate;
             //赋值开户总数跟上月比率
+            payChargeSurveyDto.setLastCustomerIsUp(lastCustomerIsUp);
             payChargeSurveyDto.setCustomerNumber(sumCustomer);
             payChargeSurveyDto.setLastCustomerRate(lastCusstomerRate);
 
@@ -146,6 +167,7 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             String customerRate = "";
             num =(float)(sumCurrentCustomer/(sumCurrentMeter != null && sumCurrentMeter != 0 ? sumCurrentMeter : 1)*100);
             customerRate = df.format(num);
+            customerRate = customerRate.contains("-") ? customerRate.split("-")[1] : customerRate;
             payChargeSurveyDto.setCustomerRate(customerRate);
 
 
@@ -318,6 +340,9 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             BigDecimal income = currentIncome.subtract(lastIncome).divide((lastIncome != null && lastIncome.compareTo(BigDecimal.ZERO)==1 ? lastIncome : defb),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
             String lastIncomeRate = "";
             lastIncomeRate = df.format(income);
+            Integer lastIncomeIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
+            //截取字符串
+            lastIncomeRate = lastIncomeRate.contains("-") ? lastIncomeRate.split("-")[1] : lastIncomeRate;
 
             //按支付方式
             cashIncome = transactionSurver.getCashIncome();//本账期现金收入
@@ -331,18 +356,30 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             //现金
             income = cashIncome.subtract(lastcashIncome).divide((lastcashIncome != null && lastcashIncome.compareTo(BigDecimal.ZERO)==1 ? lastcashIncome : defb),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
             lastCashRate = df.format(income);
+            Integer lastCashIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
+            //截取字符串
+            lastCashRate = lastCashRate.contains("-") ? lastCashRate.split("-")[1] : lastCashRate;
 
             //微信
             income = wechatIncome.subtract(lastwechatIncome).divide((lastwechatIncome != null && lastwechatIncome.compareTo(BigDecimal.ZERO)==1 ? lastwechatIncome : defb),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
             lastWechatRate = df.format(income);
+            Integer lastWechatIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
+            //截取字符串
+            lastWechatRate = lastWechatRate.contains("-") ? lastWechatRate.split("-")[1] : lastWechatRate;
 
             //支付宝
             income = alipayIncome.subtract(lastalipayIncome).divide((lastalipayIncome != null && lastalipayIncome.compareTo(BigDecimal.ZERO)==1 ? lastalipayIncome : defb), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
             lastAlipayRate = df.format(income);
+            Integer lastAlipayIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
+            //截取字符串
+            lastAlipayRate = lastAlipayRate.contains("-") ? lastAlipayRate.split("-")[1] : lastAlipayRate;
 
             //银行
             income = bankIncome.subtract(lastbankIncome).divide((lastbankIncome != null && lastbankIncome.compareTo(BigDecimal.ZERO)==1 ? lastbankIncome : defb),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
             lastBankRate = df.format(income);
+            Integer lastBankIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
+            //截取字符串
+            lastBankRate = lastBankRate.contains("-") ? lastBankRate.split("-")[1] : lastBankRate;
 
             //饼状态占比率
             BigDecimal current = alipayIncome.add(wechatIncome).add(bankIncome).add(cashIncome);
@@ -363,17 +400,22 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             bankRate = df.format(income);
 
             //收入总数
+            payTransactionSurveyDto.setLastIncomeIsUp(lastIncomeIsUp);
             payTransactionSurveyDto.setIncomeNumber(currentIncome);
             payTransactionSurveyDto.setLastIncomeRate(lastIncomeRate);
             //按支付方式
             payTransactionSurveyDto.setCashIncome(cashIncome);
             payTransactionSurveyDto.setLastCashRate(lastCashRate);
+            payTransactionSurveyDto.setLastCashIsUp(lastCashIsUp);
             payTransactionSurveyDto.setWechatIncome(wechatIncome);
             payTransactionSurveyDto.setLastWechatRate(lastWechatRate);
+            payTransactionSurveyDto.setLastWechatIsUp(lastWechatIsUp);
             payTransactionSurveyDto.setAlipayIncome(alipayIncome);
             payTransactionSurveyDto.setLastAlipayRate(lastAlipayRate);
+            payTransactionSurveyDto.setLastAlipayIsUp(lastAlipayIsUp);
             payTransactionSurveyDto.setBankIncome(bankIncome);
             payTransactionSurveyDto.setLastBankRate(lastBankRate);
+            payTransactionSurveyDto.setLastBankIsUp(lastBankIsUp);
             //饼状图
             payTransactionSurveyDto.setCashRate(CashRate);
             payTransactionSurveyDto.setAlipayRate(alipayRate);
@@ -390,6 +432,10 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
     }
 
 
+    /**
+     * 收费概况
+     * @return
+     */
     public PayFeeSueveyDto feeSurvey(){
         PayFeeSueveyDto payFeeSveveyDto = new PayFeeSueveyDto();
         LoginUser loginUser = UserUtil.getCurrentUser();
@@ -461,5 +507,119 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
         return payFeeSveveyDto;
     }
 
+    /**
+     * 水量概况
+     * @return
+     */
+    public PayAmountSurveyDto amountSurver(){
+        PayAmountSurveyDto payAmountSurveyDto = new PayAmountSurveyDto();
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
+        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        BigDecimal defb = new BigDecimal("1.0");
+        BigDecimal defc = new BigDecimal("0.0");
+        DecimalFormat df = new DecimalFormat("0.0");
+        try {
+            List<BaseClosingAccountInfoDto> closinList = baseClosingAccountInfoMapper.getList(null,null,
+                    siteId,customerId,null);
+            Integer year = closinList.get(0).getYear();
+            Integer month = closinList.get(0).getMonth();
+            //上一账期
+            Integer lastYear = null;
+            Integer lastMonth = null;
+            if(Integer.valueOf(month) == 1){
+                lastYear = year-1;
+                lastMonth = 12;
+            }else{
+                lastYear = year;
+                lastMonth = month -1;
+            }
+
+            //先获取本年度结算水量(按自然年)
+            Calendar date = Calendar.getInstance();
+            //当前年
+            Integer currentYear = Integer.valueOf(date.get(Calendar.YEAR));
+            //当前月
+            Integer currentMont = Integer.valueOf(date.get(Calendar.MONTH));
+            String startDate = currentYear+"-"+"01";
+            String endDate = currentYear+"-"+String.format("%02d",month);
+            //当前年月累计用水量
+            BigDecimal currentAmount = payChargeSurveyMapper.getAmountInfo(startDate,endDate,siteId,customerId);
+            //去年同一时间累计用水量
+            startDate = (currentYear - 1)+"-"+"01";
+            endDate = (currentYear - 1)+"-"+String.format("%02d",month);
+            BigDecimal lastAmount = payChargeSurveyMapper.getAmountInfo(startDate,endDate,siteId,customerId);
+            //计算年同比 = 当前总数-去年同期总数│/去年同期总数
+            String lastYearRate = "";
+            BigDecimal number  = currentAmount.subtract(lastAmount).divide((lastAmount != null && lastAmount.compareTo(BigDecimal.ZERO)==1 ? lastAmount : defb),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
+            //0下降  1商社
+            Integer lastYearIsUp = number.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
+            //保留一位小数
+            lastYearRate = df.format(number);
+            //截取字符串
+            lastYearRate = lastYearRate.contains("-") ? lastYearRate.split("-")[1] : lastYearRate;
+
+            //计算月
+            //当前月
+            BigDecimal currentMAmount = payChargeSurveyMapper.getAmountMonth(year,month,siteId,customerId);
+            //去年同月
+            BigDecimal lastMAmount = payChargeSurveyMapper.getAmountMonth((year-1),month,siteId,customerId);
+            //计算月同比 = 当前总数-上月同期总数│/去年同期总数
+            number  = currentMAmount.subtract(lastMAmount).divide((lastMAmount != null && lastMAmount.compareTo(BigDecimal.ZERO)==1 ? lastMAmount : defb),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
+            //0下降  1商社
+            Integer lastMonthIsUp = number.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
+            //保留一位小数
+            String lastMonthRate = "";
+            lastMonthRate = df.format(number);
+            //截取字符串
+            lastMonthRate = lastMonthRate.contains("-") ? lastMonthRate.split("-")[1] : lastMonthRate;
+
+            //最近一年数据
+            List<PayAmountSurveyListDto> cList = new ArrayList<PayAmountSurveyListDto>();
+            PayAmountSurveyListDto dto = new PayAmountSurveyListDto();
+            dto.setPeriodDate(currentYear+"-"+String.format("%02d",month));
+            dto.setYear(currentYear);
+            dto.setMonth(month);
+            dto.setSumAmount(currentMAmount);
+            cList.add(dto);
+            List<PayAmountSurveyListDto> list = payChargeSurveyMapper.getAmountGroupList(null,null,siteId,customerId);
+            cList.addAll(list);
+            PayAmountSurveyListDto a = cList.get(cList.size() - 1);
+            Integer num = a.getMonth();
+            lastYear = a.getYear();
+            lastMonth = a.getMonth();
+            for(int i=cList.size(); i<=11; i++ ){
+                num--;
+                if(num == 0){
+                    lastYear = lastYear-1;
+                    lastMonth = 12;
+                    num = 12;
+                }else{
+                    lastYear = lastYear;
+                    lastMonth = num;
+                }
+                PayAmountSurveyListDto adto = new PayAmountSurveyListDto();
+                adto.setPeriodDate(lastYear+"-"+String.format("%02d",lastMonth));
+                adto.setYear(lastYear);
+                adto.setMonth(lastMonth);
+                adto.setSumAmount(defc);
+                cList.add(adto);
+            }
+            payAmountSurveyDto .setList(cList);
+            payAmountSurveyDto.setSumYearAmount(currentAmount);
+            payAmountSurveyDto.setLastYearIsUp(lastYearIsUp);
+            payAmountSurveyDto.setLastYearRate(lastYearRate);
+            payAmountSurveyDto.setSumMonthAmount(currentMAmount);
+            payAmountSurveyDto.setLastMonthRate(lastMonthRate);
+            payAmountSurveyDto.setLastMontIsUp(lastMonthIsUp);
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return payAmountSurveyDto;
+    }
+
+
+
 
 }

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

@@ -521,9 +521,9 @@ public class PayFeeServiceImp implements PayFeeService {
             throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
         }
 
-        //根据客编或者水编获取客户信息
+        //根据客户id
         PayCustomRechargeDto payCustomRechargeDto = null;
-        if(StringUtils.isEmpty(accountId)){
+        if(StringUtils.isNotEmpty(accountId)){
             payCustomRechargeDto= payFeeMapper.getCustomInfoByMeterOrAccount(accountId,null,null,BigInteger.valueOf(siteId),BigInteger.valueOf(customerId));
         }
 
@@ -730,9 +730,10 @@ public class PayFeeServiceImp implements PayFeeService {
         return payReceived;
     }
 
-    public List<PayfeeAccountInfoDto> findPayfeeAccountInfo(BigInteger id, Integer queryType , String condition ){
+    public List<PayfeeAccountInfoDto> findPayfeeAccountInfo(BigInteger id, String condition ){
         LoginUser loginUser = UserUtil.getCurrentUser();
-        return payFeeMapper.findPayfeeAccountInfo(id, queryType , condition ,loginUser.getSiteId(),loginUser.getCustomerId());
+        //数据权限
+        return payFeeMapper.findPayfeeAccountInfo(id, condition ,loginUser.getSiteId(),loginUser.getCustomerId(),UserUtil.getCurrentSiteProgramItems(loginUser));
     }
 
     public PayfeeDetaileBill getPayfeeDetaileBill(BigInteger id){

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

@@ -9,6 +9,7 @@ import com.bz.smart_city.dto.pay.PayMessagesendrecordDto;
 import com.bz.smart_city.dto.pay.PayTransactiondetails;
 import com.bz.smart_city.dto.pay.PayTransactiondetailsDto;
 import com.bz.smart_city.dto.pay.payfee.PrintInvoiceData;
+import com.bz.smart_city.dto.pay.payfee.PrintReceivedInfo;
 import com.bz.smart_city.entity.pay.PayInvoice;
 import com.bz.smart_city.entity.pay.PayPayReceived;
 import com.bz.smart_city.service.pay.PayinvoiceService;
@@ -38,6 +39,9 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
     public void insert(PayInvoice payInvoice) {
         payInvoiceMapper.insert(payInvoice);
     }
+    public PayInvoiceDto get(BigInteger id) {
+        return payInvoiceMapper.get(id);
+    }
 
     public List<PayInvoiceDto> findList(String condition, Integer state, String startTime, String endTime) {
         LoginUser loginUser= UserUtil.getCurrentUser();
@@ -107,16 +111,19 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
         invoice.setRemarks("");
 
         //获取同批次号的交易明细
-        List<PayTransactiondetailsDto> payTransactiondetailsList=payInvoiceMapper.findTransByPayseriesno(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
+        List<PayTransactiondetails> payTransactiondetailsList=payInvoiceMapper.findTransByPayseriesno(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
 
-        for(PayTransactiondetailsDto payTransactiondetailsDto:payTransactiondetailsList){
+        for(PayTransactiondetails payTransactiondetails:payTransactiondetailsList){
             //转预存或充值金额
-            if(payTransactiondetailsDto.getPayway()!=4&&(payTransactiondetailsDto.getTranstype()==1||payTransactiondetailsDto.getTranstype()==4)){
-                countReceivedamount = countReceivedamount.add(payTransactiondetailsDto.getTransamount()!=null?payTransactiondetailsDto.getTransamount():BigDecimal.ZERO);
+            if(payTransactiondetails.getPayway()!=4&&(payTransactiondetails.getTranstype()==1||payTransactiondetails.getTranstype()==4)){
+                countReceivedamount = countReceivedamount.add(payTransactiondetails.getTransamount()!=null?payTransactiondetails.getTransamount():BigDecimal.ZERO);
 
-                invoice.setAccountId(payTransactiondetailsDto.getAccountId());
-                invoice.setAccountname(payTransactiondetailsDto.getAccountname());
-                invoice.setAccountnumber(payTransactiondetailsDto.getAccountnumber());
+                invoice.setAccountId(payTransactiondetails.getAccountId());
+                invoice.setAccountname(payTransactiondetails.getAccountname());
+                invoice.setAccountnumber(payTransactiondetails.getAccountnumber());
+                invoice.setOfficeId(payTransactiondetails.getOfficeId());
+                invoice.setYear(payTransactiondetails.getYear());
+                invoice.setMonth(payTransactiondetails.getMonth());
             }
         }
         //获取同批次号的实收信息
@@ -130,6 +137,9 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
                 invoice.setAccountId(received.getAccountId());
                 invoice.setAccountname(received.getAccountname());
                 invoice.setAccountnumber(received.getAccountnumber());
+                invoice.setOfficeId(received.getOfficeId());
+                invoice.setYear(received.getYear());
+                invoice.setMonth(received.getMonth());
             }
 
         }
@@ -147,28 +157,101 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
     }
 
     /**
-     * 仅充值
+     * 打印收据——仅充值
      * @param payseriesno
      * @return
      */
     public PrintInvoiceData getPrintDataOfTrans(String payseriesno){
-//        PrintInvoiceData printInvoiceData=printNoticeDao.getPrintDataOfTran(payseriesno);
-//        if(printInvoiceData!=null){
-//            PrintInvoiceData  wateruserdData=printNoticeDao.getLastWaterUsedRecord(printInvoiceData.getAccountId(), printInvoiceData.getCreateDate());
-//            if(wateruserdData!=null){
-//                printInvoiceData.setReading(wateruserdData.getReading());
-//                printInvoiceData.setRecorddate(wateruserdData.getRecorddate());
-//            }
-//            printInvoiceData.setPaydate(printInvoiceData.getCreateDate());
-//        }
-//        return printInvoiceData;
-        return null;
+        LoginUser loginUser=UserUtil.getCurrentUser();
+        PrintInvoiceData printInvoiceData=payInvoiceMapper.getPrintDataOfTran(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
+        if(printInvoiceData!=null){
+            PrintInvoiceData  wateruserdData=payInvoiceMapper.getLastWaterUsedRecord(printInvoiceData.getAccountId(), printInvoiceData.getCreateDate(),loginUser.getSiteId(),loginUser.getCustomerId());
+            if(wateruserdData!=null){
+                printInvoiceData.setReading(wateruserdData.getReading());
+                printInvoiceData.setRecorddate(wateruserdData.getRecorddate());
+            }
+            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            if(printInvoiceData.getCreateDate()!=null){
+                printInvoiceData.setPaydate(df.format(printInvoiceData.getCreateDate()));
+            }else{
+                printInvoiceData.setPaydate(df.format(LocalDateTime.now()));
+            }
+        }
+        printInvoiceData.setInvoiceNo(
+                DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now())+""+(int)(Math.random()*1000));
+        return printInvoiceData;
     }
+    /**
+     * 打印收据——缴纳欠费(transtype == null || (transtype ==2 ||transtype ==4))
+     * @param payseriesno
+     * @return
+     */
     public PrintInvoiceData getPrintDataOfReceived(String payseriesno){
-        return null;
-    }
+        LoginUser loginUser=UserUtil.getCurrentUser();
+        //收费区间信息和抄表信息
+        PrintInvoiceData printInvoiceData=payInvoiceMapper.getDateRangeInfoPrint(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        if(printInvoiceData.getCreateDate()!=null){
+            printInvoiceData.setPaydate(df.format(printInvoiceData.getCreateDate()));
+        }else{
+            printInvoiceData.setPaydate(df.format(LocalDateTime.now()));
+        }
+        printInvoiceData.setDateRange(
+            printInvoiceData.getMaxPeriod()/12+""+String.format("%02d",printInvoiceData.getMaxPeriod()%12)+"————"+
+            printInvoiceData.getMinPeriod()/12+""+String.format("%02d",printInvoiceData.getMinPeriod()%12)   );
 
 
+        //缴费用户信息
+        PrintInvoiceData accountInfoPrint =payInvoiceMapper.getAccountInfoPrint(printInvoiceData.getAccountId());
+        printInvoiceData.setAccountname(accountInfoPrint.getAccountname());
+        printInvoiceData.setAccountnumber(accountInfoPrint.getAccountnumber());
+        printInvoiceData.setAddress(accountInfoPrint.getAddress());
+        printInvoiceData.setRemaining(accountInfoPrint.getRemaining());
 
+        //余额信息(/*--交易前后余额(先按批次号查询,没有再查询交易后第一条记录,还有没有就取预存账户余额)*/)
+        PrintInvoiceData payfeeRemainingPrint= payInvoiceMapper.getPayfeeRemainingPrint(printInvoiceData.getAccountId(),null,payseriesno);
+        if(payfeeRemainingPrint !=null || payfeeRemainingPrint.getRemaining() != null){
+            printInvoiceData.setRemaining(payfeeRemainingPrint.getRemaining());
+            printInvoiceData.setLastRemaining(payfeeRemainingPrint.getLastRemaining());
+        }else{
+            payfeeRemainingPrint= payInvoiceMapper.getPayfeeRemainingPrint(printInvoiceData.getAccountId(),printInvoiceData.getMaxPeriod(),null);
+            if(payfeeRemainingPrint !=null && payfeeRemainingPrint.getRemaining() != null){
+                printInvoiceData.setRemaining(payfeeRemainingPrint.getRemaining());
+                printInvoiceData.setLastRemaining(payfeeRemainingPrint.getRemaining());
+            }else{
+                printInvoiceData.setLastRemaining(printInvoiceData.getRemaining());
+            }
+        }
+
+        //收费信息
+        List<PrintReceivedInfo>  payfeeInfoPrint = payInvoiceMapper.getPayfeeInfoPrint(printInvoiceData.getMinPeriod(),printInvoiceData.getMaxPeriod(),printInvoiceData.getAccountId());
+
+
+        BigDecimal receivedFee=BigDecimal.ZERO;
+        BigDecimal debt=BigDecimal.ZERO;
+        //计算出缴纳的欠费金额
+        for(PrintReceivedInfo receivedInfo:payfeeInfoPrint){
+            debt=debt.add(receivedInfo.getReceivedamount());
+        }
+        //计算出实收金额
+        receivedFee= debt.add(printInvoiceData.getRemaining()).subtract(printInvoiceData.getLastRemaining());
+        printInvoiceData.setReceivablefee(debt);
+        printInvoiceData.setTransamount(receivedFee);
+        printInvoiceData.setPrintReceivedInfo(payfeeInfoPrint);
+        printInvoiceData.setInvoiceNo(
+            DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now())+""+(int)(Math.random()*1000));
+        return printInvoiceData;
+    }
+
+
+    public String findPayseriesnoByPrint(BigInteger id,Integer type){
+        return payInvoiceMapper.findPayseriesnoByPrint(id,type);
+    }
 
+    public void cancelPrintInfo(BigInteger id){
+        LoginUser loginUser=UserUtil.getCurrentUser();
+        payInvoiceMapper.deleteTransPrint(id);
+        payInvoiceMapper.deleteReceivedPrint(id);
+        payInvoiceMapper.cancelPayInvoice(id,LocalDateTime.now(),BigInteger.valueOf(loginUser.getId()));
+    }
 }

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

@@ -72,22 +72,22 @@ public class PayPayReceivedServiceImpl implements PayPayReceivedService {
         return new Pagination<PayPayReceivedListDto>(list);
     }
 
-    public List<PayPayReceivedListDto> findListByPayseriesno(Integer year,Integer month,String accountnumber,
-               Integer state,Integer payway,LocalDateTime beginDate,LocalDateTime endDate){
+    public List<PayPayReceivedListDto> findListByPayseriesno(String payseriesno){
 
         LoginUser loginUser = UserUtil.getCurrentUser();
         PayPayReceived received = new PayPayReceived();
-        received.setAccountnumber(accountnumber);
-        received.setState(state);
-        received.setPayway(payway);
-        received.setBeginDate(beginDate);
-        received.setEndDate(endDate);
+
+
+        received.setPayseriesno(payseriesno);
+
         received.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
         received.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
         List<PayPayReceivedListDto> receivedList = payPayReceivedMapper.findListByPayseriesno(received);
         return receivedList;
     }
 
+
+
     //取消实收
     @Transactional(rollbackFor = Exception.class)
     public int cancelReceived(BigInteger id){

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

@@ -1,5 +1,6 @@
 package com.bz.smart_city.service.pay;
 
+import com.bz.smart_city.dto.pay.PayAmountSurveyDto;
 import com.bz.smart_city.dto.pay.PayChargeSurveyDto;
 import com.bz.smart_city.dto.pay.PayFeeSueveyDto;
 import com.bz.smart_city.dto.pay.PayTransactionSurveyDto;
@@ -13,4 +14,6 @@ public interface PayChargeSurveyService {
 
     public PayFeeSueveyDto feeSurvey();
 
+    public PayAmountSurveyDto amountSurver();
+
 }

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

@@ -42,11 +42,10 @@ public interface PayFeeService {
     /**
      * 查询客户信息
      * @param id 开户id
-     * @param queryType 查询类型 1客户名称,2客户编码,3电话,4地址
      * @param condition 查询参数
      * @return
      */
-    List<PayfeeAccountInfoDto> findPayfeeAccountInfo(BigInteger id, Integer queryType , String condition );
+    List<PayfeeAccountInfoDto> findPayfeeAccountInfo(BigInteger id , String condition );
 
     /**
      * 收费界面查询账单详情

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

@@ -17,8 +17,7 @@ public interface PayPayReceivedService {
     public Pagination<PayPayReceivedListDto> findTotalList(String condition, Integer state, Integer payway, LocalDateTime beginDate,
                                                            LocalDateTime endDate, int pageNum, int pageSize);
 
-    public List<PayPayReceivedListDto> findListByPayseriesno(Integer year,Integer month,String accountnumber,
-                                                             Integer state,Integer payway,LocalDateTime beginDate,LocalDateTime endDate);
+    public List<PayPayReceivedListDto> findListByPayseriesno(String payseriesno);
 
     public int cancelReceived(BigInteger id);
 

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

@@ -7,6 +7,7 @@ import com.bz.smart_city.dto.pay.PayTransactiondetailsDto;
 import com.bz.smart_city.dto.pay.payfee.PrintInvoiceData;
 import com.bz.smart_city.entity.pay.PayInvoice;
 
+import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -22,6 +23,8 @@ public interface PayinvoiceService {
      */
     void insert(PayInvoice payInvoice);
 
+    PayInvoiceDto get(BigInteger id) ;
+
     /**
      * 列表展示查询收据信息
      * @param condition
@@ -49,16 +52,29 @@ public interface PayinvoiceService {
     void savePrintInfo(String payseriesno,String invoiceno);
 
     /**
-     * 仅充值(payway==4 && transtype ==1)
+     * 打印收据——仅充值(payway==4 && transtype ==1)
      * @param payseriesno
      * @return
      */
     PrintInvoiceData getPrintDataOfTrans(String payseriesno);
 
     /**
-     * 缴纳欠费(transtype == null || (transtype ==2 ||transtype ==4))
+     * 打印收据——缴纳欠费(transtype == null || (transtype ==2 ||transtype ==4))
      * @param payseriesno
      * @return
      */
     PrintInvoiceData getPrintDataOfReceived(String payseriesno);
+
+    /**
+     * 通过票据id查询交易批次号
+     * @param id
+     * @param type 1实收 2明细
+     */
+    String findPayseriesnoByPrint(BigInteger id,Integer type);
+
+    /**
+     * 作废票据
+     * @param id
+     */
+    void cancelPrintInfo(BigInteger id);
 }

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

@@ -343,7 +343,8 @@
             pba.name,
             pba.telephone,
             pba.idcardno,
-            pba.address
+            pba.address,
+            pba.id as "accountId"
         from pay_base_account pba
         left join pay_sys_dict psd on pba.idtype=psd.`value` and psd.type='证件类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
         left join pay_pay_rechargeaccount ppr on pba.accountnumber=ppr.accountnumber and ppr.site_id=#{siteId} and ppr.customer_id=#{customerId}

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

@@ -472,7 +472,102 @@
                 and a.customer_id =#{customerId}
             </if>
         </where>
-        ORDER BY a.period_date desc LIMIT 12
+        ORDER BY a.period_date desc LIMIT 11
     </select>
 
+    <select id="getAmountInfo" resultType="java.math.BigDecimal">
+        select
+            IFNULL(sum(payamount),0)
+        from pay_amount_waterusedamount a
+        <where>
+            <if test="startDate != null">
+                and concat(a.year,'-',LPAD(a.month, 2, 0)) &gt;=#{startDate}
+            </if>
+            <if test="endDate != null">
+                and concat(a.year,'-',LPAD(a.month, 2, 0)) &lt;=#{endDate}
+            </if>
+            <if test="siteId != null">
+                and a.site_id =#{siteId}
+            </if>
+            <if test="customerId != null">
+                and a.customer_id =#{customerId}
+            </if>
+        </where>
+    </select>
+
+    <select id="getAmountMonth" resultType="java.math.BigDecimal">
+        select
+            IFNULL(sum(payamount),0)
+        from pay_amount_waterusedamount a
+        <where>
+            <if test="siteId != null">
+                and a.site_id =#{siteId}
+            </if>
+            <if test="customerId != null">
+                and a.customer_id =#{customerId}
+            </if>
+            <if test="year != null">
+                and a.year =#{year}
+            </if>
+            <if test="month != null">
+                and a.month =#{month}
+            </if>
+        </where>
+    </select>
+
+    <select id="getAmountGroupList" resultType="com.bz.smart_city.dto.pay.PayAmountSurveyListDto">
+        select
+            IFNULL(a.amount_number,0) as "sumAmount",
+            a.year as "year",
+            a.month as "month",
+            concat(a.year,'-',LPAD(a.month, 2, 0)) as "periodDate"
+        from pay_amount_survey a
+        <where>
+            <if test="siteId != null">
+                and a.site_id =#{siteId}
+            </if>
+            <if test="customerId != null">
+                and a.customer_id =#{customerId}
+            </if>
+        </where>
+        ORDER BY a.period_date desc LIMIT 11
+    </select>
+
+    <insert id="insertAmount">
+        insert into pay_amount_survey
+        (
+            id,
+            amount_number,
+            last_amount_number,
+            year,
+            month,
+            period_date,
+            site_id,
+            customer_id,
+            create_by,
+            create_date,
+            update_by,
+            update_date,
+            remarks,
+            del_flag
+        )
+        values
+        (
+            #{id},
+            #{amountNumber},
+            #{lastAmountNumber},
+            #{year},
+            #{month},
+            #{periodDate},
+            #{siteId},
+            #{customerId},
+            #{createBy},
+            #{createDate},
+            #{updateBy},
+            #{updateDate},
+            #{remarks},
+            #{delFlag}
+        )
+    </insert>
+
 </mapper>

+ 166 - 5
smart-city-platform/src/main/resources/mapper/pay/PayInvoiceMapper.xml

@@ -51,6 +51,22 @@
         )
     </insert>
 
+    <select id="get" resultType="com.bz.smart_city.dto.pay.PayInvoiceDto">
+        select
+        a.id,
+        a.invoiceno as "invoiceno",
+        a.accountnumber as "accountnumber",
+        a.accountname as "accountname",
+        a.invoiceamount as "invoiceamount",
+        a.state as "state",
+        (case when a.state=2 then '已使用' else '作废' end ) as "stateLabel",
+        a.create_date as "createDate",
+        (select name from sc_user where id=a.create_by) as "createByName",
+        a.canceltime as "canceltime",
+        (select name from sc_user where id=a.cancelperson) as "cancelpersonName"
+        from pay_pay_invoice a
+        where a.id=#{id}
+    </select>
     <select id="findList" resultType="com.bz.smart_city.dto.pay.PayInvoiceDto">
         select
         a.id,
@@ -66,7 +82,7 @@
         (select name from sc_user where id=a.cancelperson) as "cancelpersonName"
         from pay_pay_invoice a
         <where>
-            a.type = 1
+            a.type = 2
             <if test="siteId != null">
                 and a.site_id=#{siteId}
             </if>
@@ -81,7 +97,7 @@
                 )
             </if>
 
-            <if test="year != null">
+            <if test="state != null">
                 and a.state=#{state}
             </if>
             <if test="startTime != null">
@@ -101,12 +117,15 @@
         order by a.create_date desc
     </select>
 
-    <select id="findTransByPayseriesno" resultType="com.bz.smart_city.dto.pay.PayTransactiondetailsDto">
+    <select id="findTransByPayseriesno" resultType="com.bz.smart_city.dto.pay.PayTransactiondetails">
         select
             id,
             payway,
             transtype,
             transamount,
+            year,
+            month,
+            office_id as "officeId",
             account_id as "accountId",
             accountname,
             accountnumber
@@ -121,6 +140,9 @@
             payway,
             account_id as "accountId",
             accountname,
+            office_id as "officeId",
+            year,
+            month,
             accountnumber,
             receivedamount
         from pay_pay_received
@@ -134,11 +156,150 @@
             where payseriesno=#{payseriesno} and site_id=#{siteId} and customer_id=#{customerId}
         </if>
 
-        <if test="type != null and type == 1">
-            ;update pay_pay_received set invoice_id=#{invoiceId}
+        <if test="type != null and type == 2">
+            update pay_pay_received set invoice_id=#{invoiceId}
             where payseriesno=#{payseriesno} and site_id=#{siteId} and customer_id=#{customerId}
         </if>
 
 	</update>
 
+
+    <select id="getPrintDataOfTran" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+            a.create_date AS "createDate"
+            ,a.lastrecreamaing AS "remaining"
+            ,a.transamount
+            ,a.lastrecreamaing-transamount AS "lastRemaining"
+            ,account.id AS "accountId"
+            ,account.name AS "accountname"
+            ,account.accountnumber
+            ,account.address
+            ,u.name AS "createBy"
+        from pay_pay_transactiondetails a
+        left join pay_base_account account on account.id=a.account_id
+        left join sc_user u on u.id=a.create_by
+        where a.payseriesno =#{payseriesno} and a.site_id=#{siteId} and a.customer_id=#{customerId}
+            and a.canceledrecord_id is null and a.iscanceled=0
+    </select>
+
+    <select id="getLastWaterUsedRecord"  resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+		select top 1  reading ,recorddate
+	 from amount_waterusedamount
+	 where state=2 and site_id=#{siteId} and customer_id=#{customerId} and account_id=#{accountId} and update_date &lt; #{date}
+	 order by update_date desc
+	</select>
+
+
+    <select id="getDateRangeInfoPrint" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+            amount.account_id as "accountId",
+            max(amount.year*12+amount.`month`) as  "maxPeriod",
+            min(amount.year*12+amount.`month`) as  "minPeriod",
+            max(amount.recorddate) as "recorddate",
+            min(amount.lastrecorddate) as "lastrecorddate",
+            max(amount.reading) as "reading",
+            min(amount.lastreading) as "lastreading",
+            max(reced.create_date) as "createDate",
+            (select name from sc_user where id=max(reced.create_by)) as "createBy"
+        from pay_pay_received reced
+        left join pay_pay_receivable rece on reced.receivable_id=rece.id
+        left join pay_amount_waterusedamount amount on amount.id=rece.usedamount_id
+        where reced.payseriesno=#{payseriesno} and reced.site_id=#{siteId} and reced.customer_id=#{customerId}
+        group by amount.account_id
+
+    </select>
+
+    <select id="getAccountInfoPrint"  resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+            a.id as "accountId",
+            a.accountnumber,
+            a.name as "accountname",
+            a.address,
+            r.remaining
+        from pay_base_account a
+        left join pay_pay_rechargeaccount r on a.id=r.account_id
+        where a.id=#{accountId}
+    </select>
+
+    <select id="getPayfeeInfoPrint" resultType="com.bz.smart_city.dto.pay.payfee.PrintReceivedInfo">
+        select * from (
+        select
+        a.account_id as "accountId",
+        re.feetypename,
+        re.ladderlevel,
+        (case when re.ladderlevel = 1 then '一阶'
+        when re.ladderlevel = 2 then '二阶'
+        when re.ladderlevel = 3 then '三阶'
+        when re.ladderlevel = 4 then '四阶'
+        else '' end) as "ladderlevelname",
+        re.payamount,
+        re.waterbasicprice,
+        sum(case when payway != 4 then reced.receivedamount else 0 end ) receivedamount,
+        sum(case when payway = 4 then reced.receivedamount else 0 end ) autoReceivedamount
+        from pay_amount_waterusedamount a
+        left join pay_pay_receivable re on a.id=re.usedamount_id
+        left join pay_pay_received reced on reced.receivable_id=re.id
+        where  re.feetype=1   and a.`year`*12+a.`month` >= #{minPeriod} and a.`year`*12+a.`month` &lt;= #{maxPeriod} and  a.account_id=#{accountId}
+        group by a.account_id, re.feetypename,re.ladderlevel,re.payamount,re.waterbasicprice
+        union all
+        select
+        a.account_id,
+        re.feetypename,
+        '' as "ladderlevel",
+        '' as "ladderlevelname",
+        sum(re.payamount) as "payamount",
+        max(re.waterbasicprice) as "waterbasicprice",
+        sum(case when payway != 4 then reced.receivedamount else 0 end ) receivedamount,
+        sum(case when payway = 4 then reced.receivedamount else 0 end ) autoReceivedamount
+        from pay_amount_waterusedamount a
+        left join pay_pay_receivable re on a.id=re.usedamount_id
+        left join pay_pay_received reced on reced.receivable_id=re.id
+        where  re.feetype !=1  and a.`year`*12+a.`month` >= #{minPeriod} and a.`year`*12+a.`month` &lt;= #{maxPeriod} and  a.account_id=#{accountId}
+        group by  a.account_id,re.feetypename
+        )s
+        order by s.accountId,s.feetypename,s.ladderlevel
+    </select>
+    
+    <select id="getPayfeeRemainingPrint"  resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+        lastrecreamaing as "remaining",
+        remaining as "lastRemaining"
+        from pay_pay_transactiondetails
+        <where>
+            account_id=#{accountId}
+            <if test="maxPeriod != null">
+                and create_date >= #{maxPeriod}
+            </if>
+            <if test="payseriesno != null">
+                and payseriesno=#{payseriesno}
+            </if>
+        </where>
+        order by create_date asc
+        limit 1
+    </select>
+
+
+    <select id="findPayseriesnoByPrint" resultType="java.lang.String">
+        <if test="type != null and type == 1">
+            select distinct payseriesno from pay_pay_received where invoice_id=#{id}
+        </if>
+
+        <if test="type != null and type == 2">
+            select distinct payseriesno from pay_pay_transactiondetails where invoice_id=#{id}
+        </if>
+    </select>
+
+    <update id="deleteTransPrint">
+        update pay_pay_transactiondetails set invoice_id = null where invoice_id=#{id}
+    </update>
+    <update id="deleteReceivedPrint">
+        update pay_pay_received set invoice_id = null where invoice_id=#{id}
+    </update>
+
+    <update id="cancelPayInvoice">
+        update pay_pay_invoice
+        set canceltime=#{canceltime},cancelperson=#{cancelperson},state=3
+        where id=#{id}
+
+    </update>
 </mapper>

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

@@ -44,6 +44,9 @@
             <if test="customerId != null">
                 and rece.customer_id=#{customerId}
             </if>
+            <if test="payseriesno != null">
+                and rece.payseriesno =#{payseriesno}
+            </if>
             <if test="year != null">
                 and rece.year =#{year}
             </if>
@@ -257,7 +260,7 @@
             rece.customer_id as "customerId"
         from pay_pay_received rece
         <where>
-            rece.canceledrecord_id is null
+            rece.canceledrecord_id is null and rece.state=1
             <if test="siteId != null">
                 and rece.site_id =#{siteId}
             </if>

+ 15 - 13
smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

@@ -105,8 +105,11 @@
             a.email,
             c.opendate,
             c.metercode,
-            c.housetype,
-            c.calculateway,
+            (select label from pay_sys_dict where type='住房类型' and `value`=c.housetype and site_id=#{siteId}
+            and customer_id=#{customerId}) as "housetype",
+            (select label from pay_sys_dict where type='结算方式' and `value`=c.calculateway and  site_id=#{siteId}
+            and customer_id=#{customerId}) as "calculateway",
+
             p.id as "waterPropertyId",
             p.name as "waterPropertyName"
         from pay_base_customerandmeterrela c
@@ -118,18 +121,17 @@
                and  c.id= #{id}
             </if>
             <if test="condition != null and condition != ''">
-                <if test="queryType != null and queryType == 1">
-                    and c.accountname  like concat('%',#{condition},'%')
-                </if>
-                <if test="queryType != null and queryType == 2">
-                    and c.accountnumber like concat('%',#{condition},'%')
-                </if>
-                <if test="queryType != null and queryType == 3">
-                    and a.mobilephone like concat('%',#{condition},'%')
-                </if>
-                <if test="queryType != null and queryType == 4">
-                    and a.address  like concat('%',#{condition},'%')
+                or c.accountname  like concat('%',#{condition},'%')
+                or c.accountnumber like concat('%',#{condition},'%')
+                or a.mobilephone like concat('%',#{condition},'%')
+                or a.address  like concat('%',#{condition},'%')
+            </if>
+            <if test="programItems != null and programItems.size() != 0">
+                and   <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
+                <if test="item.dimensionId == 10">
+                    c.${item.dimensionCode} = #{item.dimensionValue}
                 </if>
+            </foreach>
             </if>
         </where>