Browse Source

Merge remote-tracking branch 'origin/20210716' into 20210716

lihui001 3 years ago
parent
commit
d65e909087

+ 14 - 0
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/measurementsettlement/MeasurementSettlementDto.java

@@ -2,6 +2,7 @@ package com.zcxk.rmcp.api.dto.measurementsettlement;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.zcxk.core.utils.DateUtil;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -90,11 +91,13 @@ public class MeasurementSettlementDto {
      * 截止日期
      */
     @ApiModelProperty(value = "截止日期")
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     private Date clearingEndDate;
     /**
      * 开始日期
      */
     @ApiModelProperty(value = "开始日期")
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     private Date clearingStartDate;
     /**
      * 创建时间
@@ -135,4 +138,15 @@ public class MeasurementSettlementDto {
     @ApiModelProperty(value = "租户id",hidden = true)
     @JsonIgnore
     private String tenantId;
+    @JsonIgnore
+    private String billingPeriodStr;
+    public String getBillingPeriodStr() {
+        if(billingPeriod!=null){
+            billingPeriodStr= DateUtil.format(billingPeriod,"yyyyMM");
+        }
+        return billingPeriodStr;
+    }
+
+
+
 }

+ 2 - 0
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/measurementsettlement/WaterConsumptionUpdateDto.java

@@ -17,4 +17,6 @@ public class WaterConsumptionUpdateDto {
 
     @ApiModelProperty(value="用水量")
     private double waterConsumption;
+    @ApiModelProperty(value="电子号")
+    private String meterNo;
 }

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/DeviceAlarmMapper.xml

@@ -287,7 +287,7 @@
       <if test="dto.endDate != null"> and rda.last_alarm_time <![CDATA[ <= ]]> #{dto.endDate}</if>
       <include refid="permissionCondition"/>
     </where>
-    order by rda.last_alarm_time,rda.id desc
+    order by rda.last_alarm_time desc,rda.id desc
   </select>
 
   <update id="deleteByDeviceId">

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/DeviceMapper.xml

@@ -551,7 +551,7 @@
       <if test="dto.endDate != null"> and rd.install_date <![CDATA[ <= ]]> #{dto.endDate}</if>
       <include refid="permissionCondition"/>
     </where>
-    order by rd.create_date,rd.id desc
+    order by rd.create_date desc,rd.id desc
   </select>
 
   <select id="findList_COUNT" resultType="Long">

+ 6 - 6
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/MeasurementInstanceMapper.xml

@@ -165,7 +165,7 @@
     </update>
     <update id="modifyTheNumberOfAudits">
         update rmcp_measurement_instance set number_of_water_meters_reviewed=
-          (select count(*) from rmcp_measurement_record where plan_id=#{id})
+          (select count(*) from rmcp_measurement_record where plan_id=#{id} and approval_status=1)
                                 where id=#{id}
     </update>
     <update id="modifyAllTheNumberOfAudits">
@@ -193,29 +193,29 @@
         <if test="userCondition.tenantId != null">and ms.tenant_id = #{userCondition.tenantId}</if>
         <if test="userCondition.userType!=null and userCondition.userType!=-999 and userCondition.userType!=-9999 and  userCondition.programItems != null and userCondition.programItems.size() > 0">
             <if test="userCondition.permissionType == 5 or userCondition.permissionType == 2">
-                and ( ms.dept_org_id in
+                and ( mi.dept_org_id in
                 <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=",">
                     #{item.orgId}
                 </foreach>
                 or
-                ms.company_org_id in
+                mi.company_org_id in
                 <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=",">
                     #{item.orgId}
                 </foreach>
                 )
             </if>
             <if test="userCondition.permissionType == 4 or userCondition.permissionType == 3">
-                and ms.dept_org_id in
+                and mi.dept_org_id in
                 <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=",">
                     #{item.orgId}
                 </foreach>
             </if>
             <if test="userCondition.permissionType == 1">
-                and ms.company_org_id in
+                and mi.company_org_id in
                 <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=",">
                     #{item.orgId}
                 </foreach>
-                and (ms.dept_org_id is null or ms.dept_org_id =0)
+                and (mi.dept_org_id is null or mi.dept_org_id =0)
             </if>
         </if>
     </sql>

+ 30 - 5
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/DeviceServiceImpl.java

@@ -20,16 +20,15 @@ import com.zcxk.rmcp.api.dto.device.DeviceInputDto;
 import com.zcxk.rmcp.api.dto.device.DeviceQueryDto;
 import com.zcxk.rmcp.api.dto.device.ValveDto;
 import com.zcxk.rmcp.api.enums.DeviceStatusEnum;
+import com.zcxk.rmcp.api.enums.OperationTypeEnum;
 import com.zcxk.rmcp.api.enums.RmcpErrorEnum;
 import com.zcxk.rmcp.api.enums.ValveStatusEnum;
 import com.zcxk.rmcp.api.vo.*;
 import com.zcxk.rmcp.core.dao.DeviceAlarmMapper;
+import com.zcxk.rmcp.core.dao.DeviceCommandMapper;
 import com.zcxk.rmcp.core.dao.DeviceMapper;
 import com.zcxk.rmcp.core.dao.InstallListMapper;
-import com.zcxk.rmcp.core.entity.Community;
-import com.zcxk.rmcp.core.entity.Device;
-import com.zcxk.rmcp.core.entity.Org;
-import com.zcxk.rmcp.core.entity.Product;
+import com.zcxk.rmcp.core.entity.*;
 import com.zcxk.rmcp.web.excel.download.adapter.DeviceExcelFillAdapter;
 import com.zcxk.rmcp.web.excel.download.service.DeviceDownloadExcelServiceImpl;
 import com.zcxk.rmcp.web.excel.model.DeviceImportData;
@@ -82,6 +81,8 @@ public class DeviceServiceImpl implements DeviceService{
     private DeviceAlarmMapper deviceAlarmMapper;
     @Autowired
     private MongoTemplate mongoTemplate;
+    @Resource
+    private DeviceCommandMapper deviceCommandMapper;
 
     @Override
     public int insertSelective(Device record) {
@@ -535,7 +536,31 @@ public class DeviceServiceImpl implements DeviceService{
 
     @Override
     public void batchValve(ValveDto dto) {
-        log.info("begin batchValve dto:{}",JSON.toJSON(dto));
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        log.info("begin batchValve dto:{}",JSON.toJSONString(dto));
+        if (!dto.getIds().isEmpty()) {
+            for (Long deviceId : dto.getIds()) {
+                DeviceCommand deviceCommand = new DeviceCommand();
+                deviceCommand.setDeviceId(deviceId);
+                deviceCommand.setCommandType(dto.getValveStatus());
+                deviceCommand.setCommandStatus(0);
+                deviceCommand.setOperationType(OperationTypeEnum.HAND.getCode());
+                deviceCommand.setRemark("");
+                deviceCommand.setCommandId("");
+                deviceCommand.setIssueDate(LocalDateTime.now());
+                deviceCommand.setParams("");
+                deviceCommand.setPlatform(1);
+                deviceCommand.setRelationId("");
+                deviceCommand.setPushStatus(0);
+                deviceCommand.setTenantId(loginUser.getTenantId());
+                deviceCommand.setCreateDate(LocalDateTime.now());
+                deviceCommand.setCreateBy(UserUtil.getUsername());
+                deviceCommand.setUpdateDate(LocalDateTime.now());
+                deviceCommand.setUpdateBy(UserUtil.getUsername());
+                deviceCommand.setStatus(StatusEnum.OK.getCode());
+                deviceCommandMapper.insertSelective(deviceCommand);
+            }
+        }
         log.info("end batchValve");
     }