Browse Source

1开户导入添加阀控规则

Xiaojh 4 years ago
parent
commit
720b7fe590

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

@@ -59,7 +59,8 @@ public class EstimatedDayServiceImpl implements EstimatedDayService, Initializin
         boolean exists = jobAndTriggerService.isExists(entity);
         if(!exists) {
             //String cron = "0 */2 * * * ?";
-            String cron = "0 0 0 * * ?";
+            //String cron = "0 0 0 * * ?";
+            String cron = "0 40 8 * * ?";
             log.info("预计费每天统计:" + cron);
             log.info("预计费每天统计:" + "站点ID:"+siteId+"水司ID:"+customerId);
             entity.setCronExpression(cron);

+ 15 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/importfile/AsyncTaskImportService.java

@@ -5,6 +5,7 @@ import com.bz.smart_city.commom.util.FileUtil;
 import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.commom.util.Util;
 import com.bz.smart_city.dao.pay.PayBaseAccountMapper;
+import com.bz.smart_city.dao.pay.PayControlRuleMapper;
 import com.bz.smart_city.dao.pay.PayRechargeaccountMapper;
 import com.bz.smart_city.dao.pay.archives.PayBaseCustomerandmeterrelaMapper;
 import com.bz.smart_city.dto.LoginUser;
@@ -13,6 +14,7 @@ import com.bz.smart_city.entity.Import;
 import com.bz.smart_city.entity.Message;
 import com.bz.smart_city.entity.Organization;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
+import com.bz.smart_city.entity.pay.PayControlRule;
 import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
 import com.bz.smart_city.excel.resolver.InstallPlanResolverExcelTemplate;
 import com.bz.smart_city.service.ImportService;
@@ -67,6 +69,8 @@ public class AsyncTaskImportService {
     private PayBaseAccountService payBaseAccountService;
     @Autowired
     private InstallPlanResolverExcelTemplate installPlanResolverExcelTemplate;
+    @Resource
+    private PayControlRuleMapper payControlRuleMapper;
 
     @Value("${files.path}")
     private String filesPath;
@@ -131,8 +135,9 @@ public class AsyncTaskImportService {
                                Cell officeNameCell = row.getCell(14);//机构名称
                                Cell housetypeCell = row.getCell(16);//住房类型
                                Cell customergroupCell = row.getCell(18);//开户分组
-                               Cell vatnoCell = row.getCell(20);//公司税号
-                               Cell emailCell = row.getCell(21);//电子邮箱
+                               Cell vatnoCell = row.getCell(19);//公司税号
+                               Cell emailCell = row.getCell(20);//电子邮箱
+                               Cell controlCell = row.getCell(21);//阀控规则
                                Cell c_remark = row.getCell(22);//备注
 
                                if (accountnumberCell == null || StringUtils.equals("",accountnumberCell.getStringCellValue())) {
@@ -183,6 +188,7 @@ public class AsyncTaskImportService {
                                String email = emailCell.getStringCellValue().trim();
                                String housetype = housetypeCell.getStringCellValue().trim();
                                String customerGroup = customergroupCell.getStringCellValue().trim();
+                               String contollName = controlCell.getStringCellValue().trim();
 
                                //去重
                                if(!number_maps.containsKey(accountnumber)){
@@ -240,6 +246,8 @@ public class AsyncTaskImportService {
                                PayBaseCustomerandmeterrela device = payBaseCustomerandmeterrelaMapper.getDeviceId(loginUser.getSiteId(),loginUser.getCustomerId(),metercode);
                                //根据用水性质名称寻找用水性质id
                                PayBaseCustomerandmeterrela property = payBaseCustomerandmeterrelaMapper.getWaterPropertyId(loginUser.getSiteId(),loginUser.getCustomerId(),propertyName);
+                               //根据阀控规则名称寻找阀控ID
+                               List<PayControlRule> contollList = payControlRuleMapper.findList(null,contollName,customerId);
                                //根据机构名称寻找机构id
                                Organization office =  null;
                                if(StringUtils.isNotBlank(officeName)){
@@ -329,7 +337,9 @@ public class AsyncTaskImportService {
                                    customer.setHousetype(value);//住房类型
                                    value = paySysDictService.getDictValue("开户分组",customerGroup,siteId,customerId);
                                    customer.setCustomergroup(value);//开户分组
-
+                                   customer.setValveRuleName(contollName);
+                                   customer.setValveRuleName(contollName);
+                                   customer.setValveRuleId(contollList != null && contollList.size() >0 ? String.valueOf(contollList.get(0).getId()) : "");
                                    customer.setOpendate(LocalDateTime.now());
                                    customer.setWaterPropertyId(property.getWaterPropertyId());
                                    payBaseCustomerandmeterrelaMapper.update(customer);
@@ -378,6 +388,8 @@ public class AsyncTaskImportService {
                                    customer.setCustomergroup(value);//开户分组
                                    customer.setOpendate(LocalDateTime.now());
                                    customer.setWaterPropertyId(property.getWaterPropertyId());
+                                   customer.setValveRuleName(contollName);
+                                   customer.setValveRuleId(contollList != null && contollList.size() >0 ? String.valueOf(contollList.get(0).getId()) : "");
                                    customerList.add(customer);
                                }
 

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

@@ -87,6 +87,9 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
     @Resource
     private BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
 
+    @Resource
+    private PayControlRuleMapper payControlRuleMapper;
+
 
     @Value("${files.path}")
     private String filesPath;
@@ -875,6 +878,8 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             List<PaySysDictSelectDto> houseList  = paySysDictMapper.getAll(null,null,"住房类型",siteId,customerId);
             //7.查找开户分组集合
             List<PaySysDictSelectDto> customerList  = paySysDictMapper.getAll(null,null,"开户分组",siteId,customerId);
+            //8.阀控规则集合
+            List<PayControlRule> controList = payControlRuleMapper.findList(null,null,customerId);
             //列表数据将存储到指定的excel文件路径
             FileOutputStream out = new FileOutputStream(filePath);
             //这里的context是jxls框架上的context内容
@@ -887,6 +892,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             context.putVar("organizationList", organizationList);
             context.putVar("houseList", houseList);
             context.putVar("customerList", customerList);
+            context.putVar("controList",controList);
             //将List<Exam>列表数据按照模板文件中的格式生成到scoreOutput.xls文件中
             JxlsHelper.getInstance().processTemplate(in, out, context);
             log.info("save file success");

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


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

@@ -72,6 +72,7 @@
         AS c WHERE a.watermeter_id=c.watermeter_id AND a.read_date = c.read_date)  rd on rd.watermeter_id = scd.id
         <where>
             scd.customer_id =#{customerId} and scd.account_id is not null
+            and scd.water_meter_no is not null
             <if test="startDate != null">
                 and scd.date_create &gt;=#{startDate}
             </if>