Prechádzať zdrojové kódy

添加阀控关联id

lin 4 rokov pred
rodič
commit
5b0a65e412

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

@@ -16,4 +16,7 @@ public class ValveCommandRequestDTO {
     private Integer operationType;
     @ApiModelProperty(value="平台 1:物联网平台 2:缴费系统、 3:计量集抄系统、 4:第三方系统")
     private Integer platform;
+    @ApiModelProperty(value="关联id")
+    private String relationId;
+
 }

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

@@ -15,5 +15,7 @@ public class ValveControlDataDto {
     private String active;
     @ApiModelProperty(value = "客户id")
     private Integer customerId;
+    @ApiModelProperty("关联id")
+    private String relationId;
 
 }

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

@@ -46,6 +46,9 @@ public class DeviceCommand {
     @ApiModelProperty(value="平台 1:物联网平台 2:缴费系统、 3:计量集抄系统、 4:第三方系统")
     private Integer platform;
 
+    @ApiModelProperty(value="关联id")
+    private String relationId;
+
     @ApiModelProperty(value="状态")
     private Integer status;
 

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

@@ -147,7 +147,7 @@ public interface DeviceService{
 
     void batchSetValve(LoginUser loginUser, Integer valveStatus, InputDeviceDto inputDeviceDto);
 
-    Boolean setValveV2(Long aLong, String valve,Integer platform);
+    Boolean setValveV2(Long aLong, String valve,Integer platform,String relationId);
 
     Integer queryValve(Long deviceId, Integer valveStatus);
 }

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

@@ -226,6 +226,7 @@ public class DeviceCommandServiceImpl implements DeviceCommandService {
         deviceCommand.setCommandId(commandId);
         deviceCommand.setIssueDate(LocalDateTime.now());
         deviceCommand.setPlatform(valveCommandRequest.getPlatform());
+        deviceCommand.setRelationId(valveCommandRequest.getRelationId());
         deviceCommand.setStatus(1);
         deviceCommand.setDateCreate(LocalDateTime.now());
         deviceCommand.setDateUpdate(LocalDateTime.now());

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

@@ -1464,7 +1464,7 @@ public  class DeviceServiceImpl implements DeviceService {
 
     }
 
-    public Boolean setValveV2(Long deviceId, String valve, Integer platform) {
+    public Boolean setValveV2(Long deviceId, String valve, Integer platform,String relationId) {
         log.info("setValveV2 deviceId={} valve={}",deviceId,valve);
         Device device = deviceMapper.findByDeviceId(deviceId);
         DeviceTypeDto deviceTypeDto = deviceTypeMapper.getById(device.getDeviceType());
@@ -1473,6 +1473,7 @@ public  class DeviceServiceImpl implements DeviceService {
         valveCommandRequest.setValveStatus(valve);
         valveCommandRequest.setOperationType(2);
         valveCommandRequest.setPlatform(platform);
+        valveCommandRequest.setRelationId(relationId);
 
         //1、执行开关阀门
         Integer deviceCommandId = deviceCommandService.executeValveCommand(device,deviceTypeDto,valveCommandRequest,"系统操作");

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

@@ -75,7 +75,7 @@ public class ValveServiceImpl implements ValveService {
         if (list.size() > 1) {
             throw new ServiceException(-900,"该水表表号出现重复");
         }
-        Boolean executeResult = deviceService.setValveV2(list.get(0),result.getValve(),4);
+        Boolean executeResult = deviceService.setValveV2(list.get(0),result.getValve(),4,result.getRelationId());
         if(!executeResult){
             throw new ServiceException(-900,"执行指令失败");
         }

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/sync/PlatformAapiServiceImpl.java

@@ -47,7 +47,7 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
             int result=-1;
             Device device = getDevice(meterNo, customerNo);
             if(device!=null){
-                deviceService.setValveV2(device.getId(),type+"",2);
+                deviceService.setValveV2(device.getId(),type+"",2,null);
                 OperatingValveRecord operatingValveRecord=new OperatingValveRecord();
                 operatingValveRecord.setCreateBy("system");
                 operatingValveRecord.setCreateDate(new Date());

+ 11 - 1
smart-city-platform/src/main/resources/mapper/DeviceCommandMapper.xml

@@ -16,6 +16,7 @@
     <result column="finish_date" property="finishDate" />
     <result column="params" property="params" />
     <result column="platform" property="platform" />
+    <result column="relation_id" property="relationId" />
     <result column="status" property="status" />
     <result column="date_create" property="dateCreate" />
     <result column="date_update" property="dateUpdate" />
@@ -25,7 +26,7 @@
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
     id, site_id, device_id, command_type, command_status, operation_type, remark, command_id,
-    issue_date, finish_date, params, platform, `status`, date_create, date_update, create_by, 
+    issue_date, finish_date, params, platform, relation_id, `status`, date_create, date_update, create_by,
     update_by
   </sql>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.DeviceCommand" useGeneratedKeys="true">
@@ -65,6 +66,9 @@
       <if test="platform != null">
         platform,
       </if>
+      <if test="relationId != null">
+        relation_id,
+      </if>
       <if test="status != null">
         `status`,
       </if>
@@ -115,6 +119,9 @@
       <if test="platform != null">
         #{platform},
       </if>
+      <if test="relationId != null">
+        #{relationId},
+      </if>
       <if test="status != null">
         #{status},
       </if>
@@ -169,6 +176,9 @@
       <if test="platform != null">
         platform = #{platform},
       </if>
+      <if test="relationId != null">
+        relation_id = #{relationId},
+      </if>
       <if test="status != null">
         `status` = #{status},
       </if>