Browse Source

Merge branch '20200908' into 20201014

# Conflicts:
#	smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java
lin 4 năm trước cách đây
mục cha
commit
7faa376173
23 tập tin đã thay đổi với 297 bổ sung28 xóa
  1. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java
  2. 11 0
      smart-city-platform/src/main/java/com/bz/smart_city/controller/DeviceController.java
  3. 6 2
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayBaseAccountController.java
  4. 26 5
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/archives/PayBaseCustomerandmeterrelaController.java
  5. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/DeviceValveRecordMapper.java
  6. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayBaseAccountMapper.java
  7. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayInvoiceMapper.java
  8. 14 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PrintInvoiceData.java
  9. 21 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/udip/CommandRspNotifyResult.java
  10. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/WaterMeterErrorDays.java
  11. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayMeter.java
  12. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/DeviceService.java
  13. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/DeviceValveRecordService.java
  14. 40 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceServiceImpl.java
  15. 4 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceValveRecordServiceImpl.java
  16. 6 6
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java
  17. 30 3
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayInvoiceServiceImpl.java
  18. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayBaseAccountService.java
  19. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayinvoiceService.java
  20. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java
  21. 4 0
      smart-city-platform/src/main/resources/mapper/DeviceValveRecordMapper.xml
  22. 90 3
      smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml
  23. 26 2
      smart-city-platform/src/main/resources/mapper/pay/PayInvoiceMapper.xml

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

@@ -106,6 +106,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
                 .antMatchers("/device/synArchies","/installPlan/syncPlan")
                 .antMatchers("/druid/**").antMatchers("/syncData/**")
+                .antMatchers("/device/valve/update");
                 .antMatchers("/integration/user/save","/integration/user/del");
 
     }

+ 11 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/DeviceController.java

@@ -5,6 +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.*;
+import com.bz.smart_city.dto.udip.CommandRspNotifyResult;
 import com.bz.smart_city.entity.Device;
 import com.bz.smart_city.entity.WaterRelatedDevice;
 import com.bz.smart_city.service.BuildingService;
@@ -368,4 +369,14 @@ public class DeviceController {
         return new AjaxMessage<>(ResultStatus.OK,msg);
     }
 
+    @ResponseBody
+    @PostMapping("/valve/update")
+    @ApiOperation(value = "开关阀门")
+    public AjaxMessage valveUpdate(
+            @ApiParam(value = "结果", required = true) @RequestBody(required = true) CommandRspNotifyResult result
+    ) {
+        deviceService.valveUpdate(result);
+        return new AjaxMessage(ResultStatus.OK);
+    }
+
 }

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

@@ -46,10 +46,12 @@ public class PayBaseAccountController {
     public AjaxMessage<Pagination<PayBaseAccountSelectDto>> findList(
             @ApiParam(value = "客户编号、证件号码、手机号、地址", required = false) @RequestParam(required = false) String  queryInfo,
             @ApiParam(value = "状态(数据字典中的value)", required = false) @RequestParam(required = false) String  state,
+            @ApiParam(value = "排序参数,对应列表字段", required = false) @RequestParam(required = false) String sortColumn,
+            @ApiParam(value = "排序方式,顺序:ASC  倒序:DESC", required = false) @RequestParam(required = false) String sortOrder,
             @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
             @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") Integer pageSize)
     {
-        Pagination<PayBaseAccountSelectDto> payBaseAccountSelectDtoPagination = payBaseAccountService.findList(queryInfo,state,pageNum,pageSize);
+        Pagination<PayBaseAccountSelectDto> payBaseAccountSelectDtoPagination = payBaseAccountService.findList(queryInfo,state,sortColumn,sortOrder, pageNum,pageSize);
         return new AjaxMessage<>(ResultStatus.OK,payBaseAccountSelectDtoPagination);
     }
 
@@ -58,11 +60,13 @@ public class PayBaseAccountController {
     public AjaxMessage<Pagination<PayMeter>>findMeter(
             @ApiParam(value = "水表档案号、客户编号、安装地址",required = false) @RequestParam(required = false) String queryInfo,
             @ApiParam(value = "状态(0待验收,1待开户,2已开户)",required = false) @RequestParam(required = false) String state,
+            @ApiParam(value = "排序参数,对应列表字段", required = false) @RequestParam(required = false) String sortColumn,
+            @ApiParam(value = "排序方式,顺序:ASC  倒序:DESC", required = false) @RequestParam(required = false) String sortOrder,
             @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
             @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") Integer pageSize
     )
     {
-        Pagination<PayMeter> meterInfoPagination = payBaseAccountService.findMeter(queryInfo,state,pageNum,pageSize);
+        Pagination<PayMeter> meterInfoPagination = payBaseAccountService.findMeter(queryInfo,state, sortColumn,sortOrder,pageNum,pageSize);
         return  new AjaxMessage<>(ResultStatus.OK,meterInfoPagination);
     }
 

+ 26 - 5
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/archives/PayBaseCustomerandmeterrelaController.java

@@ -1,15 +1,16 @@
 package com.bz.smart_city.controller.pay.archives;
 
+import com.alibaba.fastjson.JSONObject;
 import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.commom.util.RedisUtil;
 import com.bz.smart_city.commom.util.UserUtil;
-import com.bz.smart_city.dto.DeviceDto;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.pay.PayCustomerDto;
 import com.bz.smart_city.dto.pay.PaySaveCustomerDto;
-import com.bz.smart_city.entity.pay.PayPayRechargeaccount;
-import com.bz.smart_city.entity.pay.archives.*;
+import com.bz.smart_city.entity.pay.archives.CustomerListInfo;
+import com.bz.smart_city.entity.pay.archives.PayAccountInfo;
 import com.bz.smart_city.service.impl.ImportServiceImpl;
 import com.bz.smart_city.service.pay.archives.PayBaseCustomerandmeterrelaService;
 import io.swagger.annotations.Api;
@@ -24,9 +25,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.math.BigDecimal;
 import java.math.BigInteger;
-import java.util.List;
 
 /**
  * @Author: xjh
@@ -44,6 +43,8 @@ public class PayBaseCustomerandmeterrelaController {
     @Autowired
     private ImportServiceImpl importServiceImpl;
 
+    @Autowired
+    private RedisUtil redisUtil;
 
     @ResponseBody
     @GetMapping("/pageOpenList")
@@ -109,12 +110,32 @@ public class PayBaseCustomerandmeterrelaController {
             paySaveCustomerDto.getFixedamount()); */
         int result = payBaseCustomerandmeterrelaService.saveCustomer(paySaveCustomerDto);
         if(result >0 ){
+            //开户成功后缓存开户信息,下次开户获取其中下拉项
+            redisUtil.set("SaveCustomerCache"+UserUtil.getCurrentUser().getId(), JSONObject.toJSONString(paySaveCustomerDto));
+
             return new AjaxMessage<>(ResultStatus.OK, result);
         }else{
             return new AjaxMessage<>(ResultStatus.ERROR);
         }
     }
 
+    @PostMapping("/getCustomerCache")
+    @ApiOperation(value = "计费系统-获取开户缓存")
+    public AjaxMessage<PaySaveCustomerDto> getCustomerCache(){
+        PaySaveCustomerDto CustomerCache= new PaySaveCustomerDto();
+        if(redisUtil.exists("SaveCustomerCache"+UserUtil.getCurrentUser().getId())){
+
+            String redisString = redisUtil.get("SaveCustomerCache"+UserUtil.getCurrentUser().getId());
+            CustomerCache =JSONObject.parseObject(redisString,PaySaveCustomerDto.class);
+        }else{
+            CustomerCache.setCalculateway(1);
+            CustomerCache.setHousetype(1);
+            CustomerCache.setCustomergroup(1);
+        }
+        return new AjaxMessage<>(ResultStatus.OK, CustomerCache);
+    }
+
+
     @PostMapping("/edit")
     @ApiOperation(value = "计费系统-编辑开户信息")
     public AjaxMessage update(@ApiParam(value = "编辑开户信息",required = true) @RequestBody(required = true) @Validated PaySaveCustomerDto paySaveCustomerDto){

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

@@ -2,10 +2,13 @@ package com.bz.smart_city.dao;
 
 import com.bz.smart_city.entity.DeviceValveRecord;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 @Mapper
 public interface DeviceValveRecordMapper {
     int insertSelective(DeviceValveRecord record);
 
     int updateByPrimaryKeySelective(DeviceValveRecord record);
+
+    DeviceValveRecord findByCommandId(@Param("commandId") String commandId);
 }

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

@@ -36,7 +36,7 @@ public interface PayBaseAccountMapper {
     //根据安装计划ID,获取关联的客户ID、预存帐户ID
     List<BigInteger> findPlanAccount(@Param("planId") BigInteger planId,@Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
-    List<PayBaseAccountSelectDto>findList(@Param("queryInfo") String queryInfo,@Param("state") String state, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId,@Param("year") Integer year,@Param("month") Integer month,@Param("programItemList") List<ProgramItem> programItemList);
+    List<PayBaseAccountSelectDto>findList(@Param("queryInfo") String queryInfo,@Param("state") String state, @Param("sortColumn") String sortColumn,@Param("sortOrder") String sortOrder, @Param("siteId") Integer siteId, @Param("customerId") Integer customerId,@Param("year") Integer year,@Param("month") Integer month,@Param("programItemList") List<ProgramItem> programItemList);
 
     List<PayBaseAccountSelectAccountnumberDto>findAccountnumberList(@Param("queryInfo") String queryInfo,@Param("payment") BigDecimal payment, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
@@ -50,7 +50,7 @@ public interface PayBaseAccountMapper {
     List<PayBaseAccountMeterDto> findWaterMeter(@Param("accountnumber") String accountnumber,@Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
     //查询水表信息  涉及到查询云平台数据的如sc_device/抄表数据的,只按customer_id过滤
-    List<PayMeter>findMeterInfo(@Param("queryInfo") String queryInfo, @Param("state") String state, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId,@Param("year") Integer year,@Param("month") Integer month,@Param("programItemList") List<ProgramItem> programItemList);
+    List<PayMeter>findMeterInfo(@Param("queryInfo") String queryInfo, @Param("state") String state,  @Param("sortColumn") String sortColumn,@Param("sortOrder") String sortOrder, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId,@Param("year") Integer year,@Param("month") Integer month,@Param("programItemList") List<ProgramItem> programItemList);
 
     void updateAccountName(@Param("type")Integer type,@Param("accountname")String accountname,@Param("accountId")BigInteger accountId);
 }

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

@@ -2,7 +2,6 @@ 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;
@@ -31,6 +30,7 @@ public interface PayInvoiceMapper {
     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 getPrintDataKailu(@Param("accountId")BigInteger accountId);
 
     PrintInvoiceData getDateRangeInfoPrint(@Param("payseriesno")String payseriesno,@Param("siteId")Integer siteId,@Param("customerId")Integer customerId);
     PrintInvoiceData getAccountInfoPrint(@Param("accountId") BigInteger accountId);

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

@@ -70,4 +70,18 @@ public class PrintInvoiceData {
     private Integer maxPeriod;
     @ApiModelProperty(value = "最小账期(year*12+month)" ,hidden = true)
     private Integer minPeriod;
+
+    @ApiModelProperty("水表表号")
+    private String eleno;
+    @ApiModelProperty("水表档案号")
+    private String metercode;
+    @ApiModelProperty("基础水价")
+    private String price1;
+    @ApiModelProperty("排污费单价")
+    private String price4;
+    @ApiModelProperty("水资源费单价")
+    private String price3;
+    @ApiModelProperty(value = "用水性质名称" )
+    private String waterPropertyName;
+
 }

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

@@ -0,0 +1,21 @@
+package com.bz.smart_city.dto.udip;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class CommandRspNotifyResult implements Serializable {
+
+    @ApiModelProperty("指令ID")
+    String commandId;
+    @ApiModelProperty(value = "水司编码")
+    private String companyCode;
+    @ApiModelProperty(value = "水表编码,设备唯一标识")
+    private String meterCode;
+    @ApiModelProperty(value = "操作结果。0:失败;1:成功")
+    private String resultCode;
+    @ApiModelProperty(value = "阀门状态。0:开阀;1: 关阀;2:阀门异常;-1:不带阀门")
+    private String valveStatus;
+}

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/WaterMeterErrorDays.java

@@ -26,6 +26,9 @@ public class WaterMeterErrorDays {
     @ApiModelProperty(value="异常结束时间")
     private Integer endDate;
 
+    @ApiModelProperty(value="水表读数")
+    private Double meterReading;
+
     @ApiModelProperty(value="状态")
     private Integer status;
 

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayMeter.java

@@ -25,7 +25,7 @@ public class PayMeter {
     @ApiModelProperty(example = "0000000001",value = "客户编号")
     private String accountnumber;
     @ApiModelProperty(example = "深圳宝安",value = "地址")
-    private String installAddress;
+    private String address;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(example = "2020-04-18 00:00:00",notes = "安装时间")
     private LocalDateTime installDate;

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

@@ -9,6 +9,7 @@ import com.bz.smart_city.dto.*;
 import com.bz.smart_city.dto.assistant.InstallListDTO;
 import com.bz.smart_city.dto.assistant.PlanBuildingDTO;
 import com.bz.smart_city.dto.assistant.PlanCommunityDTO;
+import com.bz.smart_city.dto.udip.CommandRspNotifyResult;
 import com.bz.smart_city.entity.Device;
 import com.bz.smart_city.entity.ProgramItem;
 import com.bz.smart_city.entity.Site;
@@ -130,4 +131,6 @@ public interface DeviceService{
     List<DeviceDto> queryDeviceInfoList(String deviceNo, String waterMeterNo);
 
     Integer syncDevice(Long deviceId);
+
+    void valveUpdate(CommandRspNotifyResult result);
 }

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

@@ -8,4 +8,5 @@ public interface DeviceValveRecordService{
 
     int updateByPrimaryKeySelective(DeviceValveRecord record);
 
+    DeviceValveRecord findByCommandId(String commandId);
 }

+ 40 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceServiceImpl.java

@@ -12,6 +12,7 @@ import com.bz.smart_city.dto.*;
 import com.bz.smart_city.dto.assistant.InstallListDTO;
 import com.bz.smart_city.dto.assistant.PlanBuildingDTO;
 import com.bz.smart_city.dto.assistant.PlanCommunityDTO;
+import com.bz.smart_city.dto.udip.CommandRspNotifyResult;
 import com.bz.smart_city.dto.udip.DataCommandRequestDTO;
 import com.bz.smart_city.entity.*;
 import com.bz.smart_city.excel.download.GdDeviceDownloadExcelTemplate;
@@ -1545,4 +1546,43 @@ public  class DeviceServiceImpl implements DeviceService {
             return 0;
         }
     }
+
+    @Override
+    public void valveUpdate(CommandRspNotifyResult result) {
+        log.info("begin valveUpdate result={}",JSON.toJSONString(result));
+        DeviceValveRecord deviceValveRecord = deviceValveRecordService.findByCommandId(result.getCommandId());
+        if (deviceValveRecord != null) {
+
+            WaterMeterErrorDays waterMeterErrorDays = waterMeterErrorDaysMapper.findByDeviceId(deviceValveRecord.getDeviceId());
+            Integer valveStatus = 0;
+            if("0".equals(result.getValveStatus())){
+                valveStatus = 1;//0开,1关,2故障
+            }else if("1".equals(result.getValveStatus())) {
+                valveStatus = 0;
+            }else {
+
+            }
+            deviceValveRecord.setCommandStatus(result.getResultCode());
+            deviceValveRecord.setDateUpdate(LocalDateTime.now());
+            deviceValveRecordService.updateByPrimaryKeySelective(deviceValveRecord);
+
+
+
+
+            WaterMeterErrorDays waterMeterErrorDayUpdate = new WaterMeterErrorDays();
+            waterMeterErrorDayUpdate.setDeviceId(deviceValveRecord.getDeviceId());
+            if (waterMeterErrorDays != null) {
+                waterMeterErrorDayUpdate.setValveStatus(valveStatus);
+                waterMeterErrorDaysMapper.updateByPrimaryKeySelective(waterMeterErrorDayUpdate);
+            }else {
+                waterMeterErrorDayUpdate.setValveButtonStatus(1);
+                waterMeterErrorDayUpdate.setValveStatus(valveStatus);
+                waterMeterErrorDayUpdate.setStatus(1);
+                waterMeterErrorDaysMapper.insert(waterMeterErrorDayUpdate);
+            }
+        }
+
+
+        log.info("end valveUpdate");
+    }
 }

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

@@ -30,4 +30,8 @@ public class DeviceValveRecordServiceImpl implements DeviceValveRecordService{
         return deviceValveRecordMapper.updateByPrimaryKeySelective(record);
     }
 
+    @Override
+    public DeviceValveRecord findByCommandId(String commandId) {
+        return deviceValveRecordMapper.findByCommandId(commandId);
+    }
 }

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

@@ -144,7 +144,7 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
     }
 
     @Override
-    public Pagination<PayBaseAccountSelectDto> findList(String queryInfo,String state, Integer pageNum, Integer pageSize)
+    public Pagination<PayBaseAccountSelectDto> findList(String queryInfo,String state,String sortColumn,String sortOrder, Integer pageNum, Integer pageSize)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
 
@@ -162,9 +162,9 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
         List<ProgramItem> programItemList = loginUser.getDataPermissionMap().get(loginUser.getSiteId());
 
         PageHelper.startPage(pageNum,pageSize);
-        List<PayBaseAccountSelectDto> payBaseAccountSelectDtoList= payBaseAccountMapper.findList(queryInfo,state,
-                new BigInteger(String.valueOf(loginUser.getSiteId())),
-                new BigInteger(String.valueOf(loginUser.getCustomerId())),
+        List<PayBaseAccountSelectDto> payBaseAccountSelectDtoList= payBaseAccountMapper.findList(queryInfo,state,sortColumn,sortOrder,
+               loginUser.getSiteId(),
+                loginUser.getCustomerId(),
                 year,month,programItemList);
         return  new Pagination<>(payBaseAccountSelectDtoList);
     }
@@ -274,7 +274,7 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
     }
 
     @Override
-    public Pagination<PayMeter>findMeter(String queryInfo, String state, Integer pageNum, Integer pageSize)
+    public Pagination<PayMeter>findMeter(String queryInfo, String state,String sortColumn, String sortOrder, Integer pageNum, Integer pageSize)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
         BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
@@ -295,7 +295,7 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
         List<ProgramItem> programItemList = loginUser.getDataPermissionMap().get(loginUser.getSiteId());
 
         PageHelper.startPage(pageNum,pageSize);
-        List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(queryInfo,state,siteId,customerId,year,month,programItemList);
+        List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(queryInfo,state,sortColumn,sortOrder,siteId,customerId,year,month,programItemList);
 
         return new Pagination<>(meterInfoList);
     }

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

@@ -7,9 +7,7 @@ import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.dao.pay.PayInvoiceMapper;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.pay.PayInvoiceDto;
-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;
@@ -169,7 +167,7 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
      * @param payseriesno
      * @return
      */
-    public PrintInvoiceData getPrintDataOfTrans(String payseriesno){
+    public PrintInvoiceData getPrintDataOfTrans2(String payseriesno){
         LoginUser loginUser=UserUtil.getCurrentUser();
         PrintInvoiceData printInvoiceData=payInvoiceMapper.getPrintDataOfTran(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
         if(printInvoiceData!=null){
@@ -193,11 +191,40 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
                 DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now())+""+(int)(Math.random()*1000));
         return printInvoiceData;
     }
+
+    public PrintInvoiceData getPrintDataOfTrans(String payseriesno){
+        LoginUser loginUser=UserUtil.getCurrentUser();
+        PrintInvoiceData printInvoiceData=payInvoiceMapper.getPrintDataOfTran(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
+        if(printInvoiceData!=null){
+            PrintInvoiceData printDataKailu = payInvoiceMapper.getPrintDataKailu(printInvoiceData.getAccountId());
+
+            printInvoiceData.setWaterPropertyName(printDataKailu.getWaterPropertyName());
+            printInvoiceData.setMetercode(printDataKailu.getMetercode());
+            printInvoiceData.setEleno(printDataKailu.getEleno());
+            printInvoiceData.setPrice1(printDataKailu.getPrice1());
+            printInvoiceData.setPrice4(printDataKailu.getPrice4());
+
+            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            if(printInvoiceData.getCreateDate()!=null){
+                printInvoiceData.setPaydate(df.format(printInvoiceData.getCreateDate()));
+            }else{
+                printInvoiceData.setPaydate(df.format(LocalDateTime.now()));
+            }
+        }else{
+            throw new ServiceException(ResultStatus.OPERATE_RECORD_NOT_EXIT);
+        }
+        printInvoiceData.setPrintType(1);
+        printInvoiceData.setPayseriesno(payseriesno);
+        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){
         LoginUser loginUser=UserUtil.getCurrentUser();
         //收费区间信息和抄表信息

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

@@ -24,7 +24,7 @@ public interface PayBaseAccountService {
 
     int batchInsert(List<PayBaseAccountDto> list,String code);
 
-    Pagination<PayBaseAccountSelectDto> findList(String queryInfo,String state, Integer pageNum, Integer pageSize);
+    Pagination<PayBaseAccountSelectDto> findList(String queryInfo,String state, String sortColumn,String sortOrder, Integer pageNum, Integer pageSize);
 
     PayBaseAccountSelectAccountnumberDto findAccountnumberList(String accountnumber, Integer Year);
 
@@ -34,7 +34,7 @@ public interface PayBaseAccountService {
 
     List<PaySysDictSelectDto> findState();
 
-    Pagination<PayMeter>findMeter(String queryInfo, String state, Integer pageNum, Integer pageSize);
+    Pagination<PayMeter>findMeter(String queryInfo, String state,String sortColumn, String sortOrder,  Integer pageNum, Integer pageSize);
 
     //根据安装计划ID删除用户信息
     int delByPlanId(BigInteger planId);

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

@@ -56,6 +56,7 @@ public interface PayinvoiceService {
      * @param payseriesno
      * @return
      */
+    PrintInvoiceData getPrintDataOfTrans2(String payseriesno);
     PrintInvoiceData getPrintDataOfTrans(String payseriesno);
 
     /**

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

@@ -734,7 +734,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             //1.查抄未开户水表信息集合
             List<ProgramItem> programItemList = loginUser.getDataPermissionMap().get(siteId);
             //查找待开户信息
-            List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(null,"1",siteId,customerId,null,null,programItemList);
+            List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(null,"1",null,null,siteId,customerId,null,null,programItemList);
             //2.查找用水性质集合
             List<BaseWaterPropertyDto> propertyList = baseWaterPropertyMapper.getList(null,customerId,siteId);
             //3.查找结算方式集合

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

@@ -136,4 +136,8 @@
     </set>
     where id = #{id}
   </update>
+
+  <select id="findByCommandId" resultMap="BaseResultMap">
+    select <include refid="Base_Column_List"/> from sc_device_valve_record where status = 1 and command_id = #{commandId}
+  </select>
 </mapper>

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

@@ -268,7 +268,80 @@
     </select>-->
 
     <select id="findList" resultType="com.bz.smart_city.dto.pay.PayBaseAccountSelectDto">
+
+        select
+        IFNULL(cust.waterNumber,0) AS waterNumber,
+        IFNULL(paw.sum_payamount,0) sumPayamount,
+        pba.state as state,
+        (select label from pay_sys_dict where value = pba.state and type='客户状态' and site_id = #{siteId} and customer_id = #{customerId}) stateName,
+
+        dt.remaining ,
+        (select label from pay_sys_dict where value = pba.idtype and type='证件类型' and site_id = #{siteId} and customer_id = #{customerId}) idTypeName,
+        pba.accountnumber,
+        pba.name,
+        pba.telephone,
+        pba.idcardno,
+        pba.address
+        from pay_base_account pba
+        left join (
             select
+            account_id,
+            ifnull(sum(payamount),0) sum_payamount
+            from pay_amount_waterusedamount
+            where  site_id = #{siteId} and customer_id = #{customerId}  and year=#{year} and month=#{month}
+            group by account_id
+        ) paw on paw.account_id = pba.id
+        left join (
+            select
+            rech.account_id
+            ,IFNULL(max(rech.remaining),0) - IFNULL(sum(rece.debt),0)  remaining
+            from pay_pay_rechargeaccount rech
+            left join pay_pay_receivable rece on rece.account_id=rech.account_id and rece.debt>0
+            where rech.site_id = #{siteId} and rech.customer_id = #{customerId}
+            group by rech.account_id
+        ) dt on pba.id = dt.account_id
+        left join (
+            select account_id, count(1) waterNumber,max(office_id) office_id from pay_base_customerandmeterrela
+            where site_id = #{siteId} and customer_id = #{customerId}
+            <if test="programItemList != null and programItemList.size() > 0">
+                and
+                <foreach collection="programItemList" item="item" open="(" separator=" or " close=")">
+                    <if test="item.dimensionId == 10">
+                        ${item.dimensionCode} = #{item.dimensionValue}
+                    </if>
+                </foreach>
+            </if>
+            group by account_id
+        ) cust on pba.id=cust.account_id
+        where pba.del_flag='0'  and pba.site_id=#{siteId} and pba.customer_id=#{customerId}
+        <if test="state != null and state != '' "> and pba.state=#{state}</if>
+        <if test="queryInfo != null and queryInfo != ''">
+            and (pba.accountnumber like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
+            or pba.idcardno like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
+            or pba.telephone like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
+            or pba.address like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
+            )
+        </if>
+        <if test="programItemList != null and programItemList.size() > 0">
+            and
+            ( cust.office_id is null
+            <foreach collection="programItemList" item="item" open="or" separator=" or " close=")">
+                <if test="item.dimensionId == 10">
+                    cust.${item.dimensionCode} = #{item.dimensionValue}
+                </if>
+            </foreach>
+        </if>
+        <choose>
+            <when test="sortColumn !=null and sortColumn != '' and sortOrder !=null and sortOrder != ''">
+                ORDER BY ${sortColumn} ${sortOrder}
+            </when>
+            <otherwise>
+                order by pba.create_date desc,pba.accountnumber DESC
+            </otherwise>
+        </choose>
+
+
+          <!--  select
                  cust.waterNumber AS waterNumber,
                 IFNULL(
                 (select sum(payamount) from pay_amount_waterusedamount paw
@@ -323,7 +396,7 @@
                 </foreach>
             </if>
             order by pba.create_date desc,pba.accountnumber DESC
-
+-->
     </select>
 
 
@@ -471,7 +544,7 @@
         select
             scd.water_meter_no as waterMeterNo,
             scd.metercode,
-            pba.address as installAddress,
+            pba.address as address,
             scinstall.new_meter_start as initialData,
             scinstall.is_accepted ,
             scinstall.install_time as installDate,
@@ -513,7 +586,21 @@
             </if>
         </foreach>
         </if>
-        order by scinstall.install_time DESC
+
+        <choose>
+            <when test="sortColumn !=null and sortColumn != '' and sortOrder !=null and sortOrder != ''">
+                <if test="sortColumn = 'address'">
+                    ORDER BY  pba.address
+                 </if>
+                <if test="sortColumn != 'address'">
+                    ORDER BY ${sortColumn} ${sortOrder}
+                </if>
+            </when>
+            <otherwise>
+                order by scinstall.install_time DESC
+            </otherwise>
+        </choose>
+
 
     </select>
 

+ 26 - 2
smart-city-platform/src/main/resources/mapper/pay/PayInvoiceMapper.xml

@@ -186,6 +186,30 @@
             and a.canceledrecord_id is null and a.iscanceled=0
     </select>
 
+    <select id="getPrintDataKailu" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+     select
+            d.water_meter_no as eleno
+            ,c.metercode
+            ,p.name as waterPropertyName
+            ,p.price1 as price1
+            ,p.price4 as price4
+        from pay_base_customerandmeterrela c
+        left join sc_device d on c.watermeter_id=d.id
+        left join (
+                select
+                pro.id as waterproperty_id
+								,pro.name
+                ,ifnull(max(price1.price),0) as price1
+                ,ifnull(max(price4.price),0) as price4
+                from pay_base_waterproperty pro
+								left join pay_base_priceofwaterproperty pp on pro.id=pp.waterproperty_id
+                left join pay_base_waterprice price1 on price1.id=pp.waterprice_id and price1.feetype=1 and price1.ladderlevel =1
+                left join pay_base_waterprice price4 on price4.id=pp.waterprice_id and price4.feetype=4 and price4.ladderlevel =1
+                group by pro.id,pro.name
+            ) p on c.waterproperty_id =p.waterproperty_id
+        where c.account_id=#{accountId}
+  </select>
+
     <select id="getLastWaterUsedRecord"  resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
 		select  reading ,recorddate
 	 from pay_amount_waterusedamount
@@ -198,8 +222,8 @@
     <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",
+            ifnull(max(amount.year*12+amount.`month`),0) as  "maxPeriod",
+            ifnull(min(amount.year*12+amount.`month`),0) as  "minPeriod",
             max(amount.recorddate) as "recorddate",
             min(amount.lastrecorddate) as "lastrecorddate",
             max(amount.reading) as "reading",