oppadmin 4 лет назад
Родитель
Сommit
84caeb733f

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

@@ -5,16 +5,14 @@ import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.dto.pay.PayControlRecordDto;
 import com.bz.smart_city.entity.pay.PayControlRecord;
+import com.bz.smart_city.entity.pay.PayControlRule;
 import com.bz.smart_city.service.pay.PayControlRecordService;
 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.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.math.BigInteger;
 import java.time.LocalDateTime;
@@ -34,8 +32,8 @@ public class PayControlRecordController {
 
 
     @GetMapping("/findList")
-    @ApiOperation(value="查询阀控记录,分页",notes=",分页")
-    public AjaxMessage<List<PayControlRecord>> findList(
+    @ApiOperation(value="查询阀控记录",notes="查询阀控记录")
+    public AjaxMessage<List<PayControlRecordDto>> findList(
             @ApiParam(value = "用户ID", required = false) @RequestParam(required = false) String accountId,
             @ApiParam(value = "水表ID", required = false) @RequestParam(required = false) String meterId,
             @ApiParam(value = "阀控规则", required = false) @RequestParam(required = false) String controlRuleId,
@@ -77,7 +75,7 @@ public class PayControlRecordController {
                 payControlRecordDto.setEndTime(LocalDateTime.parse(endTime, df));
             }
 
-            List<PayControlRecord> payControlRecordList = payControlRecordService.findList(payControlRecordDto);
+            List<PayControlRecordDto> payControlRecordList = payControlRecordService.findList(payControlRecordDto);
             return new AjaxMessage<>(ResultStatus.OK,payControlRecordList);
         }
         catch (Exception ex){
@@ -87,7 +85,7 @@ public class PayControlRecordController {
 
     @GetMapping("/findPage")
     @ApiOperation(value="查询阀控记录,分页",notes="查询阀控记录,分页")
-    public AjaxMessage<Pagination<PayControlRecord>> findPage(
+    public AjaxMessage<Pagination<PayControlRecordDto>> findPage(
             @ApiParam(value = "用户ID", required = false) @RequestParam(required = false) String accountId,
             @ApiParam(value = "水表ID", required = false) @RequestParam(required = false) String meterId,
             @ApiParam(value = "阀控规则", required = false) @RequestParam(required = false) String controlRuleId,
@@ -131,7 +129,7 @@ public class PayControlRecordController {
                 payControlRecordDto.setEndTime(LocalDateTime.parse(endTime, df));
             }
 
-            Pagination<PayControlRecord> payControlRecordPagination = payControlRecordService.findPage(payControlRecordDto,pageNum,pageSize);
+            Pagination<PayControlRecordDto> payControlRecordPagination = payControlRecordService.findPage(payControlRecordDto,pageNum,pageSize);
             return new AjaxMessage<>(ResultStatus.OK,payControlRecordPagination);
         }
         catch (Exception ex){
@@ -139,4 +137,5 @@ public class PayControlRecordController {
         }
     }
 
+
 }

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

@@ -22,13 +22,13 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("PayControlRule")
-@Api(tags = "计费系统-阀设置")
+@Api(tags = "计费系统-阀设置")
 public class PayControlRuleController {
 
     @Autowired
     PayControlRuleService payControlRuleService;
 
-    @PostMapping("add")
+    @PostMapping("/add")
     @ApiModelProperty(value = "添加阀控规则",notes = "添加阀控规则")
     public AjaxMessage add(
             @ApiParam(value = "阀控规则",required = true) @RequestBody(required = true) @Validated PayControlRule payControlRule
@@ -59,7 +59,7 @@ public class PayControlRuleController {
         }
     }
 
-    @PostMapping("edit")
+    @PostMapping("/edit")
     @ApiModelProperty(value = "编辑阀控规则",notes = "编辑阀控规则")
     public AjaxMessage edit(
             @ApiParam(value = "阀控规则",required = true) @RequestBody(required = true) @Validated PayControlRule payControlRule
@@ -82,7 +82,7 @@ public class PayControlRuleController {
         }
     }
 
-    @GetMapping("findList")
+    @GetMapping("/findList")
     @ApiModelProperty(value = "查询阀控规则",notes = "查询阀控规则")
     public AjaxMessage<List<PayControlRule>> findList(
             @ApiParam(value = "阀控规则名称",required = false) @RequestBody(required = false) String name

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

@@ -17,5 +17,5 @@ public interface PayControlRecordMapper {
     Integer add(@Param("payControlRecord")PayControlRecord payControlRecord);
 
     //查询
-    List<PayControlRecord> findList(@Param("payControlRecordDto") PayControlRecordDto payControlRecordDto);
+    List<PayControlRecordDto> findList(@Param("payControlRecordDto") PayControlRecordDto payControlRecordDto);
 }

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

@@ -16,6 +16,17 @@ import java.time.LocalDateTime;
 @ApiModel(value = "阀控查询条件")
 public class PayControlRecordDto extends PayControlRecord {
 
+    @ApiModelProperty(value = "水表电子号")
+    private LocalDateTime waterMeterNo;
+    @ApiModelProperty(value = "水表档案号")
+    private LocalDateTime meterCode;
+    @ApiModelProperty(value = "设备型号")
+    private LocalDateTime deviceModel;
+    @ApiModelProperty(value = "设备状态")
+    private LocalDateTime controlStatus;
+    @ApiModelProperty(value = "安装地址")
+    private LocalDateTime locDesc;
+
     @ApiModelProperty(value = "开始时间",  hidden = true)
     @JsonIgnore
     private LocalDateTime beginTime;

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

@@ -41,20 +41,20 @@ public class PayControlRecord {
 
 
 
-    @ApiModelProperty(example = "1",notes = "创建者",hidden = true)
+    @ApiModelProperty(example = "1",notes = "创建者")
     private BigInteger createBy;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @ApiModelProperty(example = "2020-04-17 00:00:00",notes = "创建时间",hidden = true)
+    @ApiModelProperty(example = "2020-04-17 00:00:00",notes = "创建时间")
     private LocalDateTime createDate;
-    @ApiModelProperty(example = "1",notes = "修改者",hidden = true)
+    @ApiModelProperty(example = "1",notes = "修改者")
     private BigInteger updateBy;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @ApiModelProperty(example = "2020-04-18 00:00:00",notes = "修改时间",hidden = true)
+    @ApiModelProperty(example = "2020-04-18 00:00:00",notes = "修改时间")
     private LocalDateTime updateDate;
 
-    @ApiModelProperty(example = "1",notes = "删除标记",hidden = true)
+    @ApiModelProperty(example = "1",notes = "删除标记")
     private String delFlag;
-    @ApiModelProperty(example = "1",notes = "备注",hidden = true)
+    @ApiModelProperty(example = "1",notes = "备注")
     private String remarks;
     @ApiModelProperty(example = "1",notes = "站点ID",hidden = true)
     private BigInteger siteId;

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

@@ -72,7 +72,7 @@ public class ControlDayServiceImpl implements ControlDayService, InitializingBea
 
         boolean exists = jobAndTriggerService.isExists(entity);
         if(!exists) {
-            String cron = "0 */30 * * * ?";
+            String cron = "0 0 1 * * ?";
             log.info("每天处理开关阀:" + cron);
             entity.setCronExpression(cron);
             entity.setJobClassName(ControlByDayJob.class.getName());

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

@@ -4,12 +4,14 @@ import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.util.HttpRequest;
 import com.bz.smart_city.commom.util.JacksonUtil;
 import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.CustomerMapper;
 import com.bz.smart_city.dao.DeviceMapper;
 import com.bz.smart_city.dao.pay.AmountWaterUsedAmountMapper;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.MeterSyncDto;
 import com.bz.smart_city.dto.MeterSyncInputDto;
 import com.bz.smart_city.dto.pay.PayBaseConfigDto;
+import com.bz.smart_city.entity.Customer;
 import com.bz.smart_city.entity.Device;
 import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
 import com.bz.smart_city.quartz.entity.QuartzEntity;
@@ -46,9 +48,10 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
 
     @Resource
     private AmountWaterUsedAmountMapper amountWaterUsedAmountMapper;
-
     @Resource
     private DeviceMapper deviceMapper;
+    @Resource
+    private CustomerMapper customerMapper;
 
     @Override
     public void afterPropertiesSet() {
@@ -92,7 +95,14 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
 
         log.info(String.format("水表安装信息同步siteId:%s,customerId:%s",siteId,customerId));
         //取客户编号
-        String customerNo="";
+        String customerNo= "";
+        Customer customer= customerMapper.findById(customerId);
+        if(customer != null && customer.getCustomerNo() != null){
+            customerNo = customer.getCustomerNo();
+       }
+        else
+            return;
+        /*
         List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",siteId,customerId);
         for (PayBaseConfigDto item : payBaseConfigDtos){
             if("CUSTOMER_NO".equals(item.getName().trim())){
@@ -100,7 +110,7 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
             }
         }
         if(customerNo == "")
-            return;
+            return;*/
 
         //查询未同步的数据
         String url = SyncUrl+"/api/syncData/meterSync";
@@ -131,6 +141,8 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
 
                             for(int i=0;i<meterSyncDtoList.size();i++){
 
+                                //通知营业系统更新水表编号
+
                                 String strList = JacksonUtil.obj2String(meterSyncDtoList.get(i));
                                 MeterSyncDto meterSyncDto = JacksonUtil.string2Obj(strList,MeterSyncDto.class);
                                 meterSyncDto.setCurrStatus(1);

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

@@ -23,17 +23,17 @@ public class PayControlRecordServiceImpl implements PayControlRecordService {
     PayControlRecordMapper payControlRecordMapper;
 
     @Override
-    public List<PayControlRecord> findList(PayControlRecordDto payControlRecordDto)
+    public List<PayControlRecordDto> findList(PayControlRecordDto payControlRecordDto)
     {
         return payControlRecordMapper.findList(payControlRecordDto);
     }
 
     @Override
-    public Pagination<PayControlRecord> findPage(PayControlRecordDto payControlRecordDto, int pageNum, int pageSize)
+    public Pagination<PayControlRecordDto> findPage(PayControlRecordDto payControlRecordDto, int pageNum, int pageSize)
     {
         //LoginUser loginUser = UserUtil.getCurrentUser();
         PageHelper.startPage(pageNum,pageSize);
-        List<PayControlRecord> payControlRecordList = payControlRecordMapper.findList(payControlRecordDto);
+        List<PayControlRecordDto> payControlRecordList = payControlRecordMapper.findList(payControlRecordDto);
         return new  Pagination<>(payControlRecordList);
     }
 }

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

@@ -12,8 +12,8 @@ import java.util.List;
 public interface PayControlRecordService {
 
     //查询阀控记录
-    List<PayControlRecord> findList(PayControlRecordDto payControlRecordDto);
+    List<PayControlRecordDto> findList(PayControlRecordDto payControlRecordDto);
 
-    Pagination<PayControlRecord> findPage(PayControlRecordDto payControlRecordDto,int pageNum, int pageSize);
+    Pagination<PayControlRecordDto> findPage(PayControlRecordDto payControlRecordDto,int pageNum, int pageSize);
 
 }

+ 8 - 2
smart-city-platform/src/main/resources/mapper/pay/PayControlRecordMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.bz.smart_city.dao.pay.PayControlRecordMapper">
-    <select id="findList" resultType="com.bz.smart_city.entity.pay.PayControlRecord">
+    <select id="findList" resultType="com.bz.smart_city.dto.pay.PayControlRecordDto">
         select
         pcr.id,
         pcr.account_id,
@@ -17,9 +17,15 @@
         pcr.remarks,
         pcr.site_id,
         pcr.customer_id,
-        pcrule.name as controlRuleIdName
+        pcrule.name as controlRuleIdName,
+        sc.water_meter_no,
+        sc.metercode,
+        sc.device_model,
+        sc.loc_desc,
+        sc.control_status
         from pay_control_record pcr
         left join pay_control_rule pcrule on pcr.control_rule_id = pcrule.id
+        left join sc_device sc on pcr.meter_id = sc.id
         <where>
             pcr.del_flag = 0
             <if test="payControlRecordDto.id != null"> and pcr.id = #{payControlRecordDto.id}</if>

+ 2 - 0
smart-city-platform/src/main/resources/mapper/pay/PayControlRuleMapper.xml

@@ -6,6 +6,7 @@
         pay_control_rule(
         name,
         `condition`,
+        condition_id,
         operator,
         value,
         action,
@@ -23,6 +24,7 @@
         values (
         #{payControlRule.name,jdbcType=VARCHAR},
         #{payControlRule.condition,jdbcType=VARCHAR},
+        #{payControlRule.conditionId,jdbcType=INTEGER},
         #{payControlRule.operator,jdbcType=VARCHAR},
         #{payControlRule.value,jdbcType=VARCHAR},
         #{payControlRule.action,jdbcType=VARCHAR},