Przeglądaj źródła

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

lihui001 3 lat temu
rodzic
commit
1f11ef65f3

+ 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,获取规则对应的测点以及表达式进行报警判断

+ 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);
 }

+ 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>

+ 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 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/AlarmTypeServiceImpl.java

@@ -70,6 +70,9 @@ public class AlarmTypeServiceImpl implements AlarmTypeService {
         List<Integer>ids=new ArrayList<>();
         alarmTypeDtos.forEach(alarmTypeDto -> ids.add(alarmTypeDto.getId())
         );
+        if(CollectionUtils.isEmpty(ids)){
+            return 0;
+        }
         List<AlarmTypeDto>alarmTypes=alarmTypeMapper.selectTypesWithRules(ids);
         if(CollectionUtils.isEmpty(alarmTypes)){
             alarmTypeMapper.delete(ids);

+ 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) {

+ 4 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/MeasurementSettlementServiceImpl.java

@@ -167,7 +167,10 @@ public class MeasurementSettlementServiceImpl implements MeasurementSettlementSe
         measurementRecords.forEach(measurementSettlementDto -> {
             taskIds.add(measurementSettlementDto.getTaskId().intValue());
         });
-        xxlJobUtil.removeAll(taskIds);
+        if(!CollectionUtils.isEmpty(taskIds)){
+            xxlJobUtil.removeAll(taskIds);
+        }
+
     }
 
 

BIN
zoniot-rmcp/zoniot-rmcp-web/src/main/resources/excel/deviceTemplate_V2.1.xlsx