Browse Source

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

wangli 4 năm trước cách đây
mục cha
commit
0ecd62129d

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

@@ -1,6 +1,7 @@
 package com.bz.smart_city.dto.pay;
 
 import com.bz.smart_city.entity.pay.InstallPlan;
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -15,18 +16,31 @@ import java.util.List;
 @Data
 public class InstallPlanInputDTO extends InstallPlan {
 
-    @ApiModelProperty(value="地址", position = 101,example = "广东省深圳市宝安区福永大道")
+    @ApiModelProperty(value = "地址", position = 101, example = "广东省深圳市宝安区福永大道")
     private String adrress;
 
-    @ApiModelProperty(value="水表设备类型", position = 102)
+    @ApiModelProperty(value = "水表设备类型", position = 102)
     List<Integer> deviceTypeIds;
 
-    @ApiModelProperty(value="安装数据", position = 103)
+    @ApiModelProperty(value = "安装数据", position = 103)
     List<InstallPlanDataDTO> InstallPlanDataList;
 
-    @ApiModelProperty(value = "结算方式id",position = 104,example = "1")
+    @ApiModelProperty(value = "结算方式id", position = 104, example = "1")
     private Integer calculateway_id;
 
-    @ApiModelProperty(value = "用水性质id",position = 105,example = "1")
+    @ApiModelProperty(value = "用水性质id", position = 105, example = "1")
     private BigInteger waterproperty_id;
-}
+
+    @ApiModelProperty(value = "水表档案号")
+    private String meterCode;
+
+    @ApiModelProperty(value = "用户名称")
+    private String userName;
+
+    @ApiModelProperty(value = "联系电话")
+    private String telephone;
+
+    @ApiModelProperty(value = "身份证号")
+    private String idcardno;
+
+}

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/excel/download/template/InstallPlanDownloadExcelTemplate.java

@@ -53,7 +53,7 @@ public class InstallPlanDownloadExcelTemplate extends AbstractDownloadExcelTempl
         filePath = getFilePath();
         templatePath = "excel/payBaseAccountTemplate20210130.xlsx";
 
-        DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+        DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyyMMdd");
         LocalDateTime date = LocalDateTime.now();
         downloadName = "批量创建装表计划模板"+ "_" + date.format(f);
 

+ 22 - 6
smart-city-platform/src/main/java/com/bz/smart_city/excel/resolver/InstallPlanResolverExcelTemplate.java

@@ -138,10 +138,10 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
                     Cell doorNoCell = row.getCell(3);
                     Cell deviceTypeCell = row.getCell(4);
                     Cell fileNoCell = row.getCell(5);
-/*                    Cell userNameCell = row.getCell(6);
+                    Cell userNameCell = row.getCell(6);
                     Cell userPhoneCell = row.getCell(7);
                     Cell idCardCell = row.getCell(8);
-                    Cell remarkCell = row.getCell(9);*/
+                    Cell remarkCell = row.getCell(9);
 
                     buildingCell.setCellType(CellType.STRING);
                     unitCell.setCellType(CellType.STRING);
@@ -149,9 +149,10 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
                     doorNoCell.setCellType(CellType.STRING);
                     deviceTypeCell.setCellType(CellType.STRING);
                     fileNoCell.setCellType(CellType.STRING);
-/*                    userNameCell.setCellType(CellType.STRING);
+                    userNameCell.setCellType(CellType.STRING);
                     userPhoneCell.setCellType(CellType.STRING);
-                    idCardCell.setCellType(CellType.STRING);*/
+                    idCardCell.setCellType(CellType.STRING);
+                    remarkCell.setCellType(CellType.STRING);
 
                     if (StringUtils.equals("", buildingCell.getStringCellValue().trim()) &&
                             StringUtils.equals("", floorCell.getStringCellValue().trim()) &&
@@ -177,11 +178,24 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
                         continue;
                     }
 
-                    log.info("Row info = building={},unit={},floor={},doorNo={},deviceType={},fileNo={}",buildingCell.getStringCellValue(),unitCell.getStringCellValue(),floorCell.getStringCellValue(),
-                            doorNoCell.getStringCellValue(),deviceTypeCell.getStringCellValue(),fileNoCell.getStringCellValue());
+                    log.info("Row info = building={},unit={},floor={},doorNo={},deviceType={}",buildingCell.getStringCellValue(),unitCell.getStringCellValue(),floorCell.getStringCellValue(),
+                            doorNoCell.getStringCellValue(),deviceTypeCell.getStringCellValue());
                     //deviceTypeSet.add(deviceTypeCell.getStringCellValue().trim());
 
                     InstallPlanInputDTO installPlanInput = new InstallPlanInputDTO();
+                    if(StringUtils.isNotBlank(userNameCell.getStringCellValue().trim())){
+                        installPlanInput.setUserName(userNameCell.getStringCellValue().trim());
+                    }
+                    if(StringUtils.isNotBlank(userPhoneCell.getStringCellValue().trim())){
+                        installPlanInput.setTelephone(userPhoneCell.getStringCellValue().trim());
+                    }
+                    if(StringUtils.isNotBlank(idCardCell.getStringCellValue().trim())){
+                        installPlanInput.setIdcardno(idCardCell.getStringCellValue().trim());
+                    }
+                    if(StringUtils.isNotBlank(remarkCell.getStringCellValue().trim())){
+                        installPlanInput.setRemark(remarkCell.getStringCellValue().trim());
+                    }
+
                     installPlanInput.setCustomerId(customerId);
                     //是否启用单元
                     if(StringUtils.equals("",unitCell.getStringCellValue().trim())){
@@ -232,6 +246,8 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
                     floorDTO.setChildren( new ArrayList());
 
                     doorNoDTO.setName(doorNoCell.getStringCellValue().trim());
+                    if(StringUtils.isNotBlank(fileNoCell.getStringCellValue().trim()))
+                        doorNoDTO.setFileNo(fileNoCell.getStringCellValue().trim());
 
                    floorDTO.getChildren().add(doorNoDTO);
 /*                    if(installPlanInput.getEnableUnit() == 1){

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

@@ -960,8 +960,6 @@ public class AmountWaterUsedAmountServiceImpl implements AmountWaterUsedAmountSe
                             //预存余额-用水金额=用水余额
                             balance = remaining.subtract(fee);
                         }
-                    }else{
-                        balance =  BigDecimal.ZERO;
                     }
                     //查询该户是否有历史欠费
                     BigDecimal historyDebt = payPayReceivableMapper.getHistoryDebt(siteId,customerId,accountId);
@@ -971,6 +969,7 @@ public class AmountWaterUsedAmountServiceImpl implements AmountWaterUsedAmountSe
                     payRechargeaccountMapper.updateBalance(balance,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()),payRechargeaccountDto.getId());
                     //修改账户用水余额字段跟预计费日期
                     log.info("【"+payRechargeaccountDto.getAccountnumber()+"】户:用水余额:"+balance+",预计费日期:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+                    balance =  BigDecimal.ZERO;
                 }
             }
         }else{

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

@@ -625,9 +625,10 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             //先获取本年度结算水量(按自然年)
             Calendar date = Calendar.getInstance();
             //当前年
-            Integer currentYear = Integer.valueOf(date.get(Calendar.YEAR));
+            //Integer currentYear = Integer.valueOf(date.get(Calendar.YEAR));
+            Integer currentYear = year;
             //当前月
-            Integer currentMont = Integer.valueOf(date.get(Calendar.MONTH));
+            Integer currentMont = month;
             String startDate = currentYear+"-"+"01";
             String endDate = currentYear+"-"+String.format("%02d",month);
             //当前年月累计用水量

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

@@ -27,6 +27,7 @@ import com.bz.smart_city.service.CommunityService;
 import com.bz.smart_city.service.pay.PayBaseAccountService;
 import com.bz.smart_city.service.pay.PayBaseConfigService;
 import com.bz.smart_city.service.pay.PaySyncDataService;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -258,20 +259,35 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                                         ++maxAccountNumber;
                                         String strAccountNumber = String.format("%s%07d", code, (maxAccountNumber));
                                         payBaseAccountDto.setAccountnumber(strAccountNumber);
+
+                                        //保存模板导入的信息
+                                        payBaseAccountDto.setRemarks(installPlanInput.getRemark());
+                                        payBaseAccountDto.setTelephone(installPlanInput.getTelephone());
+                                        payBaseAccountDto.setIdcardno(installPlanInput.getIdcardno());
+                                        payBaseAccountDto.setName(installPlanInput.getUserName());
                                         accountLists.add(payBaseAccountDto);
 
-                                        installPlanDoor.setFileNo(strAccountNumber+"01");
 
                                         //生成水表信息
                                         long deviceId = idWorker.nextId();
                                         Device device = new Device();
                                         device.setId(deviceId);
                                         device.setCommunityId(communityId);
-                                        device.setMetercode(payBaseAccountDto.getAccountnumber()+"01");
+
                                         device.setAccountId(payBaseAccountDto.getId());
                                         device.setSiteId(loginUser.getSiteId());
                                         device.setCustomerId(loginUser.getCustomerId());
                                         device.setCurrStatus(0);
+
+                                        if(StringUtils.isBlank(installPlanDoor.getFileNo())){
+                                            installPlanDoor.setFileNo(strAccountNumber+"01");
+                                            device.setMetercode(payBaseAccountDto.getAccountnumber()+"01");
+                                        }
+                                        else {
+                                            device.setMetercode(installPlanDoor.getFileNo());
+                                        }
+
+
                                         deviceList.add(device);
                                     }
                                 }
@@ -306,9 +322,6 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
             catch (Exception e){
                 return new AjaxMessage(ResultStatus.ERROR);
             }
-
-
-
         }
         return  new AjaxMessage(ResultStatus.ERROR);
     }

BIN
smart-city-platform/src/main/resources/excel/payBaseAccountTemplate20210130.xlsx


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

@@ -108,8 +108,6 @@
         control_rule_id,
         create_by,
         create_date,
-        update_by,
-        update_date,
         del_flag,
         remarks,
         site_id,
@@ -124,8 +122,6 @@
         #{payControlRecord.controlRuleId},
         #{payControlRecord.createBy},
         #{payControlRecord.createDate},
-        #{payControlRecord.createBy},
-        #{payControlRecord.createDate},
         0,
         #{payControlRecord.remarks},
         #{payControlRecord.siteId},