Переглянути джерело

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

hym 3 роки тому
батько
коміт
4aaf3a7358
14 змінених файлів з 84 додано та 29 видалено
  1. 8 5
      zoniot-rmcp/zoniot-rmcp-alarm/src/main/java/com/bz/rmcp/alarm/service/impl/DeviceAlarmServiceImpl.java
  2. 1 1
      zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/meterreadrecord/MeterReadRecordDto.java
  3. 8 8
      zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/vo/ReadRateVo.java
  4. 15 8
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/AlarmTypeMapper.java
  5. 0 3
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/mongo/MeterReadRecordDao.java
  6. 7 0
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/AlarmTypeMapper.xml
  7. 6 0
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/ReadRate7Day.xml
  8. 6 0
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/ReadRateMonth.xml
  9. 6 0
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/ReadRateToday.xml
  10. 6 0
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/ReadRateYesterday.xml
  11. 1 1
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/DeviceController.java
  12. 12 0
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/ImportController.java
  13. 5 0
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/InstallPlanController.java
  14. 3 3
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/DeviceServiceImpl.java

+ 8 - 5
zoniot-rmcp/zoniot-rmcp-alarm/src/main/java/com/bz/rmcp/alarm/service/impl/DeviceAlarmServiceImpl.java

@@ -26,6 +26,7 @@ import com.zcxk.rmcp.core.dao.DeviceAlarmMapper;
 import com.zcxk.rmcp.core.dao.DeviceAlarmRuleMapper;
 import com.zcxk.rmcp.core.dao.DeviceMapper;
 
+import com.zcxk.rmcp.core.entity.AlarmType;
 import com.zcxk.rmcp.core.entity.Device;
 import com.zcxk.rmcp.core.entity.DeviceAlarm;
 
@@ -91,11 +92,13 @@ public class DeviceAlarmServiceImpl implements DeviceAlarmService {
         List<DeviceAlarm> deviceAlarmList = new ArrayList<>();
 
         // 1,查找产品对应的告警类型,
-        AlarmTypePageDto alarmTypeDto = new AlarmTypePageDto();
-        alarmTypeDto.setTenantId(device.getTenantId());
-        alarmTypeDto.setProductCategroyId(device.getCategoryId());
-        alarmTypeDto.setDeviceTypeId(device.getProductId());
-        List<AlarmTypeDto> alarmTypeList = alarmTypeMapper.selectList(alarmTypeDto);
+        AlarmType alarmTypeCondition = new AlarmType();
+        alarmTypeCondition.setTenantId(device.getTenantId());
+        alarmTypeCondition.setProductCategroyId(device.getCategoryId());
+        alarmTypeCondition.setDeviceTypeId(device.getProductId());
+        alarmTypeCondition.setAlarmStatus(1);
+
+        List<AlarmTypeDto> alarmTypeList = alarmTypeMapper.findList(alarmTypeCondition);
         for (AlarmTypeDto alarmType : alarmTypeList) {
 
             // 2,获取规则对应的测点以及表达式进行报警判断

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/meterreadrecord/MeterReadRecordDto.java

@@ -42,6 +42,6 @@ public class MeterReadRecordDto extends BasePageDto {
     private String collectorCode;
 
     public String getDate(){
-        return ZoniotStringUtils.isNotEmpty(date) ? date + " 00:00:00" :date;
+        return ZoniotStringUtils.isNotEmpty(date) ? date + " 00:00:00" : date;
     }
 }

+ 8 - 8
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/vo/ReadRateVo.java

@@ -16,20 +16,20 @@ import java.math.BigDecimal;
 @Data
 public class ReadRateVo {
 
-    @ApiModelProperty(value="小区名字")
-    @ExcelProperty(value = {"小区名字"},index = 0)
+    @ApiModelProperty(value="小区")
+    @ExcelProperty(value = {"小区"},index = 0)
     private String communityName;
 
-    @ApiModelProperty(value="水表名字")
-    @ExcelProperty(value = {"水表名字"},index = 1)
+    @ApiModelProperty(value="水表")
+    @ExcelProperty(value = {"水表"},index = 1)
     private String categoryName;
 
-    @ApiModelProperty(value="公司名字")
-    @ExcelProperty(value = {"公司名字"},index = 2)
+    @ApiModelProperty(value="公司")
+    @ExcelProperty(value = {"公司"},index = 2)
     private String companyOrgName;
 
-    @ApiModelProperty(value="部门名字")
-    @ExcelProperty(value = {"部门名字"},index = 3)
+    @ApiModelProperty(value="部门")
+    @ExcelProperty(value = {"部门"},index = 3)
     private String deptOrgName;
 
     @ApiModelProperty(value="应抄数据")

+ 15 - 8
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/AlarmTypeMapper.java

@@ -83,22 +83,29 @@ public interface AlarmTypeMapper {
     int count();
 
 
-    /**查询告警类型所拥有的告警规则数目
-      * @param ids
+    /**
+     * 查询告警类型所拥有的告警规则数目
+     *
+     * @param ids
+     * @return java.util.List<com.zcxk.rmcp.api.dto.alarm.AlarmTypeDto>
+     * @throws
      * @description
      * @author hym
      * @updateTime 2021/8/3 9:45
-     * @return java.util.List<com.zcxk.rmcp.api.dto.alarm.AlarmTypeDto>
-     * @throws
      */
     List<AlarmTypeDto> selectTypesWithRules(List<Integer> ids);
-    /**删除告警类型
-      * @param ids
+
+    /**
+     * 删除告警类型
+     *
+     * @param ids
+     * @return void
+     * @throws
      * @description
      * @author hym
      * @updateTime 2021/8/3 9:56
-     * @return void
-     * @throws
      */
     void delete(List<Integer> ids);
+
+    List<AlarmTypeDto> findList(@Param("alarmType") AlarmType alarmType);
 }

+ 0 - 3
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/mongo/MeterReadRecordDao.java

@@ -284,11 +284,8 @@ public class MeterReadRecordDao extends BaseDao<MeterReadRecord, String> impleme
         if (ZoniotStringUtils.isNotEmpty(dto.getConcentratorId())) {
             criteria.and("concentratorId").is(dto.getConcentratorId());
         }
-
-
         // 设置用户权限过滤
         Criteria criteriaUser = criteriaUserCondition(userCondition);
-        System.out.println(criteriaUser.toString());
 
         if (ZoniotStringUtils.isNotEmpty(dto.getDeviceMeterNo())) {
             Criteria orCriteria = new Criteria();

+ 7 - 0
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/AlarmTypeMapper.xml

@@ -166,4 +166,11 @@ rt.type_desc, rt.tenant_id, rt.alarm_status    </sql>
         </foreach>
     </select>
 
+    <select id="findList" resultType="com.zcxk.rmcp.api.dto.alarm.AlarmTypeDto">
+        select id,name from rmcp_alarm_type where status = 1
+        <if test="alarmType.tenantId != null">and tenant_id = #{alarmType.tenantId}</if>
+        <if test="alarmType.productCategroyId != null">and product_categroy_id = #{alarmType.productCategroyId}</if>
+        <if test="alarmType.deviceTypeId != null">and device_type_id = #{alarmType.deviceTypeId}</if>
+        <if test="alarmType.alarmStatus != null">and alarm_status = #{alarmType.alarmStatus}</if>
+    </select>
 </mapper>

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

@@ -83,6 +83,12 @@
     <if test="dto.categoryId != null and dto.categoryId != ''">
       and rd.category_id = #{dto.categoryId}
     </if>
+    <if test="dto.readRateBegin != null and dto.readRateEnd == null">
+      and rd.read_rate >= #{dto.readRateBegin}
+    </if>
+    <if test="dto.readRateBegin == null and dto.readRateEnd != null">
+      and #{dto.readRateEnd} >= rd.read_rate
+    </if>
     <if test="dto.readRateBegin != null and dto.readRateEnd != null">
       and rd.read_rate BETWEEN #{dto.readRateBegin} and  #{dto.readRateEnd}
     </if>

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

@@ -82,6 +82,12 @@
     <if test="dto.categoryId != null and dto.categoryId != ''">
       and rd.category_id = #{dto.categoryId}
     </if>
+    <if test="dto.readRateBegin != null and dto.readRateEnd == null">
+      and rd.read_rate >= #{dto.readRateBegin}
+    </if>
+    <if test="dto.readRateBegin == null and dto.readRateEnd != null">
+      and #{dto.readRateEnd} >= rd.read_rate
+    </if>
     <if test="dto.readRateBegin != null and dto.readRateEnd != null">
       and rd.read_rate BETWEEN #{dto.readRateBegin} and  #{dto.readRateEnd}
     </if>

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

@@ -83,6 +83,12 @@
     <if test="dto.categoryId != null and dto.categoryId != ''">
       and rd.category_id = #{dto.categoryId}
     </if>
+    <if test="dto.readRateBegin != null and dto.readRateEnd == null">
+      and rd.read_rate >= #{dto.readRateBegin}
+    </if>
+    <if test="dto.readRateBegin == null and dto.readRateEnd != null">
+      and #{dto.readRateEnd} >= rd.read_rate
+    </if>
     <if test="dto.readRateBegin != null and dto.readRateEnd != null">
       and rd.read_rate BETWEEN #{dto.readRateBegin} and  #{dto.readRateEnd}
     </if>

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

@@ -83,6 +83,12 @@
     <if test="dto.categoryId != null and dto.categoryId != ''">
       and rd.category_id = #{dto.categoryId}
     </if>
+    <if test="dto.readRateBegin != null and dto.readRateEnd == null">
+      and rd.read_rate >= #{dto.readRateBegin}
+    </if>
+    <if test="dto.readRateBegin == null and dto.readRateEnd != null">
+      and #{dto.readRateEnd} >= rd.read_rate
+    </if>
     <if test="dto.readRateBegin != null and dto.readRateEnd != null">
       and rd.read_rate BETWEEN #{dto.readRateBegin} and  #{dto.readRateEnd}
     </if>

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/DeviceController.java

@@ -114,7 +114,7 @@ public class DeviceController {
     @PostMapping("allDelete")
     @ApiOperation(value = "全部删除")
     public AjaxMessage<Void> allDelete(
-            @Valid DeviceQueryDto dto
+            @RequestBody(required = true) DeviceQueryDto dto
     ) {
         deviceService.allDelele(dto);
         return AjaxMessage.success();

+ 12 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/ImportController.java

@@ -66,5 +66,17 @@ public class ImportController {
             operateLog.setCreateTime(new Date());
             userCenterClient.insert(operateLog);
         }
+        if(importType == 3){
+            LoginUser user = UserUtil.getCurrentUser();
+            OperateLogEntity operateLog = new OperateLogEntity();
+            operateLog.setUserName(user.getUsername());
+            operateLog.setPhone(user.getPhoneNumber());
+            operateLog.setTenantId(user.getTenantId());
+            operateLog.setCompanyId(user.getCompanyId());
+            operateLog.setDepartmentId(user.getDepartmentId());
+            operateLog.setOperateContent("【安装计划】批量添加");
+            operateLog.setCreateTime(new Date());
+            userCenterClient.insert(operateLog);
+        }
     }
 }

+ 5 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/InstallPlanController.java

@@ -10,6 +10,7 @@ import com.zcxk.rmcp.api.vo.DeviceStatisticsVo;
 import com.zcxk.rmcp.api.vo.InstallPlanVo;
 import com.zcxk.rmcp.api.vo.PlanStatisticsVo;
 import com.zcxk.rmcp.core.entity.InstallList;
+import com.zcxk.rmcp.web.logAdvice.LogAnnotation;
 import com.zcxk.rmcp.web.service.install.InstallListService;
 import com.zcxk.rmcp.web.service.install.InstallPlanService;
 import io.swagger.annotations.Api;
@@ -66,6 +67,7 @@ public class InstallPlanController {
 
     @PostMapping("add")
     @ApiOperation(value = "添加安装计划")
+    @LogAnnotation(module = "【安装计划】添加")
     public AjaxMessage<Void> add(
             @ApiParam(value = "安装计划", required = true) @RequestBody(required = true) @Valid InstallPlanInputDto installPlanInput
     ) {
@@ -74,6 +76,7 @@ public class InstallPlanController {
     }
 
     @PostMapping("batchDel")
+    @LogAnnotation(module = "【安装计划】删除")
     @ApiOperation(value = "批量删除安装计划")
     public AjaxMessage<Void> batchDel(
             @ApiParam(value = "安装计划id", required = true) @RequestBody(required = true)  List<Integer> ids
@@ -83,6 +86,7 @@ public class InstallPlanController {
     }
 
     @PostMapping("allDel")
+    @LogAnnotation(module = "【安装计划】全部删除")
     @ApiOperation(value = "全部删除安装计划")
     public AjaxMessage<Void> allDel(
             @ApiParam(value = "名称", required = false) @RequestParam(required = false) String name,
@@ -115,6 +119,7 @@ public class InstallPlanController {
 
     @GetMapping("downPlanTemplate")
     @ApiOperation(value = "下载计划模板", notes = "下载计划模板")
+    @LogAnnotation(module = "【安装计划】下载模板")
     public void planDownTemplate(
             @ApiParam(value = "access_token", required = true) @RequestParam(required = true) String accessToken,
             HttpServletRequest request, HttpServletResponse response

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

@@ -168,7 +168,7 @@ public class DeviceServiceImpl implements DeviceService{
 
     @Override
     public void edit(DeviceInputDto dto) {
-        log.info("begin DeviceServiceImpl edit device = {}", JSON.toJSON(dto));
+        log.info("begin DeviceServiceImpl edit device = {}", JSON.toJSONString(dto));
 
         if (deviceMapper.findByDeviceNoUnique(dto.getId(), dto.getDeviceNo()) > 0) {
             throw BusinessException.builder(RmcpErrorEnum.RMCP_DEVICE_NO_UNIQUE_ERROR);
@@ -195,7 +195,7 @@ public class DeviceServiceImpl implements DeviceService{
     @Override
     @Transactional
     public void batchDelele(List<Long> ids) {
-        log.info("begin DeviceServiceImpl batchDel ids = {}", JSON.toJSON(ids));
+        log.info("begin DeviceServiceImpl batchDel ids = {}", JSON.toJSONString(ids));
         deviceMapper.delByIds(ids);
         // 删除计划清单
         installListMapper.deleteByDeviceId(ids);
@@ -212,7 +212,7 @@ public class DeviceServiceImpl implements DeviceService{
     @Override
     @Transactional
     public void allDelele(DeviceQueryDto dto) {
-        log.info("begin DeviceServiceImpl allDel dto = {}", JSON.toJSON(dto));
+        log.info("begin DeviceServiceImpl allDel dto = {}", JSON.toJSONString(dto));
         List<DeviceVo> list = deviceMapper.findList(dto,UserUtil.getCurrentUser().getUserCondition());
         List<Long> ids = new ArrayList<>();
         if (list != null && list.size() > 0) {