Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java
zhongwei
ty 8 months ago
parent
commit
8beb838884
  1. 4
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java
  2. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/dto/OperDefectRepeatRatioDTO.java
  3. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java
  4. 6
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpWarehouseOutController.java
  5. 7
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpWarehouseOutMapper.java
  6. 5
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpWarehouseOutServiceImpl.java
  7. 3
      hzims-service/equipment/src/main/resources/db/2.0.0.sql.1
  8. 50
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java
  9. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java
  10. 10
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java
  11. 11
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java
  12. 7
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java
  13. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml
  14. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java
  15. 11
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java
  16. 1
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java
  17. 59
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/level/LevelAlarmRegular.java
  18. 139
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/level/LevelAlarmWebSocket.java
  19. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmQueryMapper.java
  20. 31
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java
  21. 5
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java
  22. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmService.java
  23. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java
  24. 136
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  25. 244
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  26. 107
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java
  27. 8
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java
  28. 50
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java
  29. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  30. 7
      hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmQueryMapper.xml
  31. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/wrapper/OfflineRecordWrapper.java
  32. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/InspectionTaskSMS.java
  33. 22
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  34. 24
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  35. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskVo.java
  36. 2
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  37. 4
      hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgPushRecordWrapper.java
  38. 4
      hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgSmsRecordWrapper.java
  39. 4
      hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordHistoryWrapper.java
  40. 4
      hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordWrapper.java
  41. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java
  42. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/excel/BaseExport.java
  43. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessLibraryService.java
  44. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  45. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  46. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java
  47. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessStatisticsServiceImpl.java
  48. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  49. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/wrapper/AreaMapWrapper.java
  50. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java
  51. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  52. 76
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
  53. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectWrapper.java
  54. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperFaultWrapper.java
  55. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperPhenomenonWrapper.java
  56. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/feign/DutyGroupClient.java
  57. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyClassMapper.java
  58. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyChangeServiceImpl.java
  59. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java
  60. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java
  61. 28
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  62. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  63. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/OverConfigController.java
  64. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverConfigService.java
  65. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverDetailsService.java
  66. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverConfigServiceImpl.java
  67. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverDetailsServiceImpl.java
  68. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/GenerateWrapper.java
  69. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OtherWrapper.java
  70. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OverConfigWrapper.java
  71. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OverDetailsWrapper.java
  72. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OverWrapper.java
  73. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/PowerWrapper.java
  74. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/RainfallWrapper.java
  75. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/SolveWrapper.java
  76. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/StorageWrapper.java
  77. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/UseWrapper.java
  78. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java
  79. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/BusinessFileDto.java
  80. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/ScanDto.java
  81. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  82. 162
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/ScanServiceImpl.java
  83. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  84. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenancePlanController.java
  85. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  86. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java
  87. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java
  88. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
  89. 88
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  90. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/schedule/OperPersonalCreateMonthReport.java
  91. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java
  92. 18
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java
  93. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  94. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  95. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/workOrder/service/impl/DistributeWorkOrderServiceImpl.java
  96. BIN
      hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx
  97. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ReviewController.java
  98. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/scheduled/SafeToolTypePushUserTask.java
  99. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/EmergencyPlanServiceImpl.java
  100. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/ImsMonAlarmInfoWrapper.java
  101. Some files were not shown because too many files have changed in this diff Show More

4
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java

@ -64,4 +64,8 @@ public interface AlarmConstants {
List<String> HZ3000_TYPES = Arrays.asList("0","1","2","3","4","5","6","7","8","9","10","11","12"); List<String> HZ3000_TYPES = Arrays.asList("0","1","2","3","4","5","6","7","8","9","10","11","12");
String SMS_MESSAGE_TEMPLATE_CODE = "aliyun-alert-push"; String SMS_MESSAGE_TEMPLATE_CODE = "aliyun-alert-push";
String FDP_INVALID_STATUS = "1.0";
String FDP_INVALID_ZOME_STATUS = "1";
} }

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/dto/OperDefectRepeatRatioDTO.java

@ -27,9 +27,13 @@ public class OperDefectRepeatRatioDTO {
// @ApiModelProperty(value = "缺陷等级名称") // @ApiModelProperty(value = "缺陷等级名称")
// private String defectLevelName; // private String defectLevelName;
@ApiModelProperty(value = "发生数量") @ApiModelProperty(value = "重复缺陷发生数量")
private Long happenNum = 0L; private Long happenNum = 0L;
@ApiModelProperty(value = "缺陷发生总数")
private Long happenSumNum = 0L;
@ApiModelProperty(value = "占总缺陷的比率") @ApiModelProperty(value = "占总缺陷的比率")
private Double happenRatio = 0.0; private Double happenRatio = 0.0;

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java

@ -70,6 +70,9 @@ public interface MainConstants {
// 集中监控数据处理 // 集中监控数据处理
String CENTRALIZED_MONITORING = "centralizedMonitoring"; String CENTRALIZED_MONITORING = "centralizedMonitoring";
// 清理历史告警数据
String CLEAR_HISTORY_ALARM = "clearHistoryAlarm";
// 开停机告警 // 开停机告警
String START_STOP_ALARM = "startStopAlarm"; String START_STOP_ALARM = "startStopAlarm";

6
hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpWarehouseOutController.java

@ -11,7 +11,6 @@ import com.hnac.hzims.spare.entity.SpWarehouseOutEntity;
import com.hnac.hzims.spare.service.ISpWarehouseOutService; import com.hnac.hzims.spare.service.ISpWarehouseOutService;
import com.hnac.hzims.spare.vo.SpWarehouseExportVO; import com.hnac.hzims.spare.vo.SpWarehouseExportVO;
import com.hnac.hzims.spare.vo.SpWarehouseOutVO; import com.hnac.hzims.spare.vo.SpWarehouseOutVO;
import com.hnac.hzims.vo.VoteChartVo;
import com.hnac.hzinfo.log.annotation.Business; import com.hnac.hzinfo.log.annotation.Business;
import com.hnac.hzinfo.log.annotation.Operate; import com.hnac.hzinfo.log.annotation.Operate;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -39,7 +38,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 控制器 * 控制器
* *
@ -81,6 +79,7 @@ public class SpWarehouseOutController extends BladeController {
IPage<SpWarehouseOutVO> pages = sp_warehouse_outService.selectPageList(Condition.getPage(query),warehouseOutVO); IPage<SpWarehouseOutVO> pages = sp_warehouse_outService.selectPageList(Condition.getPage(query),warehouseOutVO);
return R.data(pages); return R.data(pages);
} }
/** /**
* 分页 代码自定义代号 * 分页 代码自定义代号
*/ */
@ -120,6 +119,7 @@ public class SpWarehouseOutController extends BladeController {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* 工单预警 * 工单预警
*/ */
@ -165,7 +165,6 @@ public class SpWarehouseOutController extends BladeController {
return R.status(sp_warehouse_outService.saveOrUpdate(sp_warehouse_out)); return R.status(sp_warehouse_outService.saveOrUpdate(sp_warehouse_out));
} }
/** /**
* 删除 代码自定义代号 * 删除 代码自定义代号
*/ */
@ -176,6 +175,7 @@ public class SpWarehouseOutController extends BladeController {
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(sp_warehouse_outService.deleteLogic(Func.toLongList(ids))); return R.status(sp_warehouse_outService.deleteLogic(Func.toLongList(ids)));
} }
/** /**
* 完成流程 修改状态 * 完成流程 修改状态
*/ */

7
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpWarehouseOutMapper.java

@ -1,10 +1,8 @@
package com.hnac.hzims.spare.mapper; package com.hnac.hzims.spare.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.spare.entity.SpWarehouseOutEntity; import com.hnac.hzims.spare.entity.SpWarehouseOutEntity;
import com.hnac.hzims.spare.vo.SpWarehouseOutVO; import com.hnac.hzims.spare.vo.SpWarehouseOutVO;
import feign.Param;
import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
@ -19,6 +17,7 @@ import java.util.Map;
public interface SpWarehouseOutMapper extends UserDataScopeBaseMapper<SpWarehouseOutEntity> { public interface SpWarehouseOutMapper extends UserDataScopeBaseMapper<SpWarehouseOutEntity> {
String selectMaxCode(Map<String,Object> params); String selectMaxCode(Map<String,Object> params);
/** /**
* 分页列表 * 分页列表
* @param page * @param page
@ -27,8 +26,10 @@ public interface SpWarehouseOutMapper extends UserDataScopeBaseMapper<SpWarehous
*/ */
@UserDataAuth @UserDataAuth
List<SpWarehouseOutVO> selectPageList(IPage<SpWarehouseOutVO> page, Map<String,Object> params); List<SpWarehouseOutVO> selectPageList(IPage<SpWarehouseOutVO> page, Map<String,Object> params);
// @UserDataAuth
@UserDataAuth
List<SpWarehouseOutVO> selectListByCondition( Map<String,Object> params); List<SpWarehouseOutVO> selectListByCondition( Map<String,Object> params);
/** /**
* 根据工单ID查询出库单编码 * 根据工单ID查询出库单编码
* @param ticketId * @param ticketId

5
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpWarehouseOutServiceImpl.java

@ -17,15 +17,12 @@ import com.hnac.hzims.spare.vo.WtSpBasicVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springblade.core.launch.constant.FlowConstant;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDictBizClient; import org.springblade.system.feign.IDictBizClient;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
@ -34,13 +31,11 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类

3
hzims-service/equipment/src/main/resources/db/2.0.0.sql.1

@ -33,3 +33,6 @@ update equipment.hzims_em_definition set type = '2' where type = '0';
update bladex.blade_dict set dict_key = '2' where id = 1675699613977288706; update bladex.blade_dict set dict_key = '2' where id = 1675699613977288706;
update equipment.hzims_em_definition set type = '2' where type = '0'; update equipment.hzims_em_definition set type = '2' where type = '0';
-- 修改故障诊断任务表的字符集
ALTER TABLE hzims_fdp_task CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

50
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java

@ -92,38 +92,32 @@ public class AlarmConfigDetailServiceImpl extends BaseServiceImpl<AlarmConfigDet
AlarmHandleMarkVo mark = new AlarmHandleMarkVo(); AlarmHandleMarkVo mark = new AlarmHandleMarkVo();
mark.setIsRightTabulation(0); mark.setIsRightTabulation(0);
mark.setIsSmallBell(0); mark.setIsSmallBell(0);
switch (type){ mark.setIsShowAlert(1);
case 2: mark.setIsMask(1);
mark.setIsShowAlert(0); mark.setIsBroadcast(1);
mark.setIsMask(1); mark.setIsPlatformMessage(1);
mark.setIsBroadcast(0); mark.setIsShortMessage(1);
mark.setIsPlatformMessage(0); mark.setIsWxMessage(1);
mark.setIsShortMessage(0); if(2 == type){
mark.setIsWxMessage(0); mark.setIsShowAlert(0);
break; mark.setIsMask(1);
case 3: mark.setIsBroadcast(0);
case 5: mark.setIsPlatformMessage(0);
mark.setIsShowAlert(1); mark.setIsShortMessage(0);
mark.setIsMask(1); mark.setIsWxMessage(0);
mark.setIsBroadcast(1); }else if(13 == type || 14 == type){
mark.setIsPlatformMessage(1); mark.setIsShowAlert(0);
mark.setIsShortMessage(1); mark.setIsMask(0);
mark.setIsWxMessage(1); mark.setIsBroadcast(1);
break; mark.setIsPlatformMessage(0);
case 13: mark.setIsShortMessage(0);
case 14: mark.setIsWxMessage(0);
mark.setIsShowAlert(0); mark.setIsSmallBell(1);
mark.setIsMask(0);
mark.setIsBroadcast(1);
mark.setIsPlatformMessage(0);
mark.setIsShortMessage(0);
mark.setIsWxMessage(0);
mark.setIsSmallBell(1);
break;
} }
return mark; return mark;
} }
/** /**
* 等级告警默认处理标识 * 等级告警默认处理标识
* @param type * @param type

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java

@ -111,7 +111,7 @@ public class AlarmConfigServiceImpl extends BaseServiceImpl<AlarmConfigMapper, A
.eq(AlarmConfigDetailEntity::getAlarmType,source) .eq(AlarmConfigDetailEntity::getAlarmType,source)
.eq(AlarmConfigDetailEntity::getAlarmChiledType,type) .eq(AlarmConfigDetailEntity::getAlarmChiledType,type)
); );
if(ObjectUtil.isEmpty(config)){ if(ObjectUtil.isEmpty(detail)){
return detailService.defaultMark(source,type); return detailService.defaultMark(source,type);
} }
AlarmHandleMarkVo mark = new AlarmHandleMarkVo(); AlarmHandleMarkVo mark = new AlarmHandleMarkVo();

10
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java

@ -46,12 +46,11 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
// 步骤1.查询告警数据对应站点 // 步骤1.查询告警数据对应站点
R<List<StationEntity>> result = stationClient.querySatationByCodes(alarms.stream().map(AlarmEntity::getStationId).collect(Collectors.toList())); R<List<StationEntity>> result = stationClient.querySatationByCodes(alarms.stream().map(AlarmEntity::getStationId).collect(Collectors.toList()));
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
log.error("alarm query station is null : {}",alarms.stream().map(AlarmEntity::getAlarmId).collect(Collectors.toList())); log.error("alarm_query_station_is_null : {}",alarms.stream().map(AlarmEntity::getAlarmId).collect(Collectors.toList()));
return false; return false;
} }
// 步骤2.遍历保存告警数据 // 步骤2.遍历保存告警数据
alarms.forEach(alarm->{ alarms.forEach(alarm->{
List<StationEntity> stations = result.getData().stream().filter(o->o.getCode().equals(alarm.getStationId())).collect(Collectors.toList()); List<StationEntity> stations = result.getData().stream().filter(o->o.getCode().equals(alarm.getStationId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return; return;
@ -64,10 +63,9 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
// 步骤4.根据站点查询配置标识 // 步骤4.根据站点查询配置标识
AlarmHandleMarkVo mark = alarmConfigService.mark(alarm.getStationId(),alarm.getAlarmSource(),alarm.getAlarmType()); AlarmHandleMarkVo mark = alarmConfigService.mark(alarm.getStationId(),alarm.getAlarmSource(),alarm.getAlarmType());
if(ObjectUtil.isEmpty(mark)){ if(ObjectUtil.isEmpty(mark)){
log.error("alarm obtain mark is null : {}",alarm.getAlarmId()); log.error("alarm_obtain_mark_is_null : {}",alarm.getAlarmId());
return; return;
} }
// 步骤5.告警处理标识赋值 // 步骤5.告警处理标识赋值
alarm.setIsRightTabulation(mark.getIsRightTabulation()); alarm.setIsRightTabulation(mark.getIsRightTabulation());
alarm.setIsBroadcast(mark.getIsBroadcast()); alarm.setIsBroadcast(mark.getIsBroadcast());
@ -77,11 +75,10 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
alarm.setIsSmallBell(mark.getIsSmallBell()); alarm.setIsSmallBell(mark.getIsSmallBell());
alarm.setIsShortMessage(mark.getIsShortMessage()); alarm.setIsShortMessage(mark.getIsShortMessage());
alarm.setIsWxMessage(mark.getIsWxMessage()); alarm.setIsWxMessage(mark.getIsWxMessage());
// 步骤6.保存当日告警数据 // 步骤6.保存当日告警数据
boolean isSave = alarmService.save(alarm); boolean isSave = alarmService.save(alarm);
if(!isSave){ if(!isSave){
log.error("alarm save fail : {}",alarm.getAlarmId()); log.error("alarm_save_fail : {}",alarm.getAlarmId());
return; return;
} }
@ -90,4 +87,5 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
}); });
return true; return true;
} }
} }

11
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java

@ -2,10 +2,12 @@ package com.hnac.hzims.alarm.mqtt;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.source.service.FdpAlarmService;
import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService;
import com.hnac.hzims.alarm.source.service.FdpAlarmService;
import com.hnac.hzinfo.subscribe.SubscribeCallBack; import com.hnac.hzinfo.subscribe.SubscribeCallBack;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -18,6 +20,7 @@ import java.util.Map;
*/ */
@Service @Service
@Slf4j
public class FdpMqttConsumer implements SubscribeCallBack { public class FdpMqttConsumer implements SubscribeCallBack {
@Autowired @Autowired
private FdpAlarmService fdpAlarmService; private FdpAlarmService fdpAlarmService;
@ -25,11 +28,15 @@ public class FdpMqttConsumer implements SubscribeCallBack {
private AlarmSaveService alarmSaveService; private AlarmSaveService alarmSaveService;
@Override @Override
public void onMessage(Map<String, Object> data) { public void onMessage(Map<String, Object> data) {
System.out.println("监听到消息"+data.toString());
String s = JSONObject.toJSONString(data); String s = JSONObject.toJSONString(data);
log.error("监听Fdp消息 : {}" ,s);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = fdpAlarmService.receiveMessage(s); List<AlarmEntity> alarmEntities = fdpAlarmService.receiveMessage(s);
if(CollectionUtil.isEmpty(alarmEntities)){
return;
}
log.error("监听Fdp有效消息 : {}" ,alarmEntities.get(0).getAlarmId());
//统一数据处理 //统一数据处理
try { try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);

7
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java

@ -6,6 +6,7 @@ import com.hnac.hzims.alarm.source.service.SystemAlarmService;
import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService;
import com.hnac.hzinfo.subscribe.SubscribeCallBack; import com.hnac.hzinfo.subscribe.SubscribeCallBack;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -31,11 +32,15 @@ public class HZ300MqttConsumer implements SubscribeCallBack {
log.error("HZ3000队列监听到消息 : {}",data); log.error("HZ3000队列监听到消息 : {}",data);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data)); List<AlarmEntity> alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data));
if(CollectionUtil.isEmpty(alarmEntities)){
log.error("HZ3000消息转换数据异常");
return;
}
//统一数据处理 //统一数据处理
try { try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);
}catch (Exception e){ }catch (Exception e){
log.error("HZ3000告警数据处理报错(HZ300Alarm):"+e); log.error("HZ3000告警数据处理报错(HZ300Alarm):{}" , e.getMessage());
} }
} }
} }

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml

@ -4,9 +4,10 @@
<select id="selectHandlePage" resultType="com.hnac.hzims.alarm.config.vo.AlarmHandleVo"> <select id="selectHandlePage" resultType="com.hnac.hzims.alarm.config.vo.AlarmHandleVo">
SELECT H.*,S.NAME AS STATION_NAME SELECT H.*,S.NAME AS STATION_NAME,F.PROCESS_INSTANCE_ID
FROM HZIMS_ALARM_HANDLE H FROM HZIMS_ALARM_HANDLE H
LEFT JOIN HZIMS_OPERATION.HZIMS_STATION S ON H.STATION_CODE = S.CODE LEFT JOIN HZIMS_OPERATION.HZIMS_STATION S ON H.STATION_CODE = S.CODE
LEFT JOIN HZIMS_ALARM_HANDLE_FLOW F ON H.ALARM_ID = F.ALARM_ID
<where> <where>
H.IS_DELETED = 0 H.IS_DELETED = 0
<if test="param.stationCode != null"> <if test="param.stationCode != null">

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/wrapper/HandleWrapper.java

@ -21,8 +21,7 @@ public class HandleWrapper extends BaseEntityWrapper<AlarmHandleVo,AlarmHandleVo
if(ObjectUtil.isEmpty(createUser)){ if(ObjectUtil.isEmpty(createUser)){
return entity; return entity;
} }
assert entity != null; entity.setUserName(createUser.getRealName());
entity.setUserName(Optional.ofNullable(createUser.getName()).orElse(null));
return entity; return entity;
} }
} }

11
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java

@ -26,8 +26,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.hnac.hzims.alarm.config.constants.AlarmConstants.EARLY; import static com.hnac.hzims.alarm.config.constants.AlarmConstants.*;
import static com.hnac.hzims.alarm.config.constants.AlarmConstants.EARLY_WARNING;
/** /**
* 等级告警实现类 * 等级告警实现类
@ -73,8 +72,10 @@ public class FdpAlarmServiceImpl implements FdpAlarmService {
if (ObjectUtils.isEmpty(alarms)) { if (ObjectUtils.isEmpty(alarms)) {
return new ArrayList<>(); return new ArrayList<>();
} }
AlarmEntity entity = getAlarmEntity(alarms); if(FDP_INVALID_STATUS.equals(alarms.getStatus()) || FDP_INVALID_ZOME_STATUS.equals(alarms.getStatus())){
return Collections.singletonList(entity); return Collections.singletonList(getAlarmEntity(alarms));
}
return new ArrayList<>();
} }
private AlarmEntity getAlarmEntity(FdpAlarmVo item) { private AlarmEntity getAlarmEntity(FdpAlarmVo item) {
@ -87,7 +88,7 @@ public class FdpAlarmServiceImpl implements FdpAlarmService {
entity.setAlarmType(EARLY); entity.setAlarmType(EARLY);
entity.setDeviceCode(item.getDeviceId()); entity.setDeviceCode(item.getDeviceId());
entity.setDeviceName(item.getDeviceName()); entity.setDeviceName(item.getDeviceName());
entity.setAlarmStatus(0); entity.setAlarmStatus(1);
entity.setAlarmValue(item.getInfo()); entity.setAlarmValue(item.getInfo());
entity.setStationId(item.getStation()); entity.setStationId(item.getStation());
entity.setDiagReason(item.getDiagReason()); entity.setDiagReason(item.getDiagReason());

1
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java

@ -74,7 +74,6 @@ public class SystemAlarmServiceImpl implements SystemAlarmService {
public List<AlarmEntity> receiveMessage(String message) { public List<AlarmEntity> receiveMessage(String message) {
// 对象转换 // 对象转换
SystemAlarmVo systemAlarm = JSONObject.parseObject(message, SystemAlarmVo.class); SystemAlarmVo systemAlarm = JSONObject.parseObject(message, SystemAlarmVo.class);
log.error("HZ3000告警对象转换后:{}",systemAlarm);
if (ObjectUtils.isEmpty(systemAlarm)) { if (ObjectUtils.isEmpty(systemAlarm)) {
return new ArrayList<>(); return new ArrayList<>();
} }

59
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/level/LevelAlarmRegular.java

@ -1,59 +0,0 @@
package com.hnac.hzims.alarm.ws.level;
import com.hnac.hzims.alarm.source.service.LevelAlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.net.URI;
/**
* @author ysj
*/
@Slf4j
@Component
@EnableScheduling
public class LevelAlarmRegular {
@Autowired
private LevelAlarmService levelService;
private LevelAlarmWebSocket socket;
@Value("${hzims.level.wss-url}")
private String level_wss_url;
// 两分钟进行一次检查链接是否存活,不存活了重新建立链接
@Scheduled(cron = "0 0/2 * * * ?")
private void regular(){
// 检查链接存活状态
if(ObjectUtil.isEmpty(socket) || !socket.isOpen()){
log.error("level websocket survival check : {}","死亡");
this.createSocket();
if(ObjectUtil.isNotEmpty(socket) && socket.isOpen()){
String message = levelService.message();
if(!StringUtil.isEmpty(message)){
socket.send(message);
}
}
log.error("level websocket survival check : {}","重新建立链接");
}else{
log.error("level websocket survival check : {}","存活");
}
}
// 创建websocket链接
private void createSocket() {
try{
socket = new LevelAlarmWebSocket(new URI(level_wss_url));
socket.connectBlocking();
}catch (Exception e){
log.error("level create error : {}",e.getMessage());
}
}
}

139
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/level/LevelAlarmWebSocket.java

@ -1,139 +0,0 @@
package com.hnac.hzims.alarm.ws.level;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.source.service.LevelAlarmService;
import com.hnac.hzims.alarm.monitor.service.AlarmSaveService;
import lombok.extern.slf4j.Slf4j;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringUtil;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.net.Socket;
import java.net.URI;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.List;
import java.util.Optional;
/**
* @author ysj
*/
@Slf4j
public class LevelAlarmWebSocket extends WebSocketClient {
private final LevelAlarmService levelService;
private AlarmSaveService alarmSaveService;
/**
* 构造等级告警websocket
* @param uri
*/
public LevelAlarmWebSocket(URI uri) {
super(uri);
levelService = SpringUtil.getBean(LevelAlarmService.class);
connection(this);
}
// 链接到服务器回调接口
@Override
public void onOpen(ServerHandshake handshakedata) {
log.error("systemAlarm websocket open");
}
// 接收到服务器消息回调接口
@Override
public void onMessage(String message) {
if(StringUtil.isEmpty(message)){
log.error("level alarm on message is null");
}else{
// 告警数据转化
List<AlarmEntity> alarmEntities = levelService.receiveMessage(message);
// 等级告警数据处理
try {
//websocket 消息推送保存
alarmSaveService.save(alarmEntities);
}catch (Exception e){
throw new ServiceException("集中监控告警数据处理报错(levelAlarm):"+e);
}
}
}
// 与服务器链接中断回调接口
@Override
public void onClose(int code, String reason, boolean remote) {
log.error("level alarm websocket close");
}
// 与服务器通讯异常触发
@Override
public void onError(Exception e) {
log.error("level alarm websocket error : {}",e.getMessage());
}
/**
* 建立链接
* @param webSocket
*/
private void connection(LevelAlarmWebSocket webSocket) {
SSLContext context = init();
if(Optional.ofNullable(context).isPresent()){
Socket socket = create(context);
if(Optional.ofNullable(socket).isPresent()){
webSocket.setSocket(socket);
}
}
}
/**
* 创建Socket
* @param context
* @return
*/
private Socket create(SSLContext context) {
Socket socket = null;
try{
socket = context.getSocketFactory().createSocket();
}catch (Exception e){
log.error("level alarm socket create error : {}",e.getMessage());
}
return socket;
}
/**
* 协议初始化
* @return SSLContext
*/
private SSLContext init() {
SSLContext SSL = null;
try{
SSL = SSLContext.getInstance("TLS");
SSL.init(null, new TrustManager[]{new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain,
String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}}, new SecureRandom());
}catch (Exception e){
log.error("level alarm SSL init error : {}",e.getMessage());
}
return SSL;
}
}

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmQueryMapper.java

@ -2,11 +2,12 @@ package com.hnac.hzims.scheduled.mapper.alarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import org.apache.ibatis.annotations.Param;
/** /**
* @author ysj * @author ysj
*/ */
public interface AlarmQueryMapper extends BaseMapper<AlarmEntity> { public interface AlarmQueryMapper extends BaseMapper<AlarmEntity> {
void clear(@Param("alarmTime") String param);
} }

31
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java

@ -1,6 +1,7 @@
package com.hnac.hzims.scheduled.scheduled; package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.alarm.AlarmService;
import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService; import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
@ -13,8 +14,7 @@ import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import static com.hnac.hzims.operational.main.constant.MainConstants.INTERRUPT_ALARM; import static com.hnac.hzims.operational.main.constant.MainConstants.*;
import static com.hnac.hzims.operational.main.constant.MainConstants.START_STOP_ALARM;
/** /**
@ -26,10 +26,22 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.START_STOP_
public class AlarmScheduledTask { public class AlarmScheduledTask {
@Autowired @Autowired
private AlarmQueryService alarmQueryService; private AlarmService alarmService;
@Autowired
private InterruptionAlarmService interruptionService; /**
* 实时告警数据清除
* @return ReturnT<String>
*/
@XxlJob(CLEAR_HISTORY_ALARM)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> clearHistoryAlarm(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
}
alarmService.clearHistoryAlarm(param);
return new ReturnT<>("SUCCESS");
}
/** /**
* 开停机告警 * 开停机告警
@ -41,17 +53,22 @@ public class AlarmScheduledTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
alarmQueryService.startStopAlarm(param); alarmService.startStopAlarm(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
/**
* 数据通讯中断
* @param param
* @return
*/
@XxlJob(INTERRUPT_ALARM) @XxlJob(INTERRUPT_ALARM)
//@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> interruption(String param) { public ReturnT<String> interruption(String param) {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
interruptionService.interruption(param); alarmService.interruption(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
} }

5
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java

@ -10,10 +10,7 @@ import java.util.List;
*/ */
public interface AlarmQueryService extends BaseService<AlarmEntity> { public interface AlarmQueryService extends BaseService<AlarmEntity> {
void startStopAlarm(String param); void clear(String param);
List<String> bells(List<String> codes); List<String> bells(List<String> codes);
List<String> aborts(List<String> codes);
} }

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmService.java

@ -0,0 +1,13 @@
package com.hnac.hzims.scheduled.service.alarm;
/**
* @author ysj
*/
public interface AlarmService {
void startStopAlarm(String param);
void clearHistoryAlarm(String param);
void interruption(String param);
}

6
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java

@ -3,10 +3,14 @@ package com.hnac.hzims.scheduled.service.alarm;
import com.hnac.hzims.business.interruption.entity.InterruptionEntity; import com.hnac.hzims.business.interruption.entity.InterruptionEntity;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.List;
/** /**
* @author ysj * @author ysj
*/ */
public interface InterruptionAlarmService extends BaseService<InterruptionEntity> { public interface InterruptionAlarmService extends BaseService<InterruptionEntity> {
void interruption(String param);
List<String> aborts(List<String> codes);
} }

136
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java

@ -34,115 +34,9 @@ import java.util.stream.Collectors;
public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, AlarmEntity> implements AlarmQueryService { public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, AlarmEntity> implements AlarmQueryService {
private final StationService stationService;
private final RedisTemplate redisTemplate;
private final static String start_stop_cache_final = "hzims:operation:start:stop:key";
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
/**
* 开停机告警
* @param param
*/
@Override @Override
public void startStopAlarm(String param) { public void clear(String param) {
// 获取站点开关机状态 this.baseMapper.clear(param);
Map<String,Integer> startStopMap = (HashMap<String, Integer>) redisTemplate.opsForValue().get(start_stop_cache_final);
// 查询接入水电站点
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>()
.eq(StationEntity::getDataOrigin,0)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){
return;
}
Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历
reals.forEach(real->{
// 过滤站点
List<StationEntity> list = stations.stream().filter(item -> item.getRefDept().equals(real.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
// 确定站点
StationEntity station = list.get(0);
// 数据初始化记录
if(CollectionUtil.isEmpty(startStopMap)){
if(Math.abs(real.getActivePower()) > 0){
refresh.put(real.getDeviceCode(),1);
}else{
refresh.put(real.getDeviceCode(),0);
}
return;
}
// 比对开机状态
if(Math.abs(real.getActivePower()) > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1);
// 记录开机告警
this.saveStartStopAlarm(station,real,1);
}else{
refresh.put(real.getDeviceCode(),0);
}
}else{
if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0);
// 记录关机告警
this.saveStartStopAlarm(station,real,0);
}else{
refresh.put(real.getDeviceCode(),1);
}
}
});
redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
}
/**
* 保存站点设备开关机告警
* @param station
* @param real
* @param state
*/
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) {
AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode());
alarm.setStationName(station.getName());
alarm.setDeviceCode(real.getDeviceCode());
alarm.setDeviceName(real.getDeviceName());
alarm.setAlarmId(station.getCode() + "_" + Func.randomUUID());
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_关机");
alarm.setAlarmSource(AlarmConstants.START_STOP_WARNING);
alarm.setAlarmType(AlarmConstants.STOP);
if(state == 1){
alarm.setAlarmType(AlarmConstants.START);
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_开机");
}
alarm.setStatus(0);
alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0);
alarm.setIsShowAlert(1);
alarm.setIsSmallBell(1);
alarm.setIsMask(1);
alarm.setIsBroadcast(0);
alarm.setIsPlatformMessage(1);
alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser());
alarm.setUpdateUser(station.getUpdateUser());
alarm.setUpdateTime(station.getUpdateTime());
this.save(alarm);
} }
/** /**
@ -162,30 +56,4 @@ public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, Ala
} }
return alarms.stream().map(AlarmEntity::getStationId).distinct().collect(Collectors.toList()); return alarms.stream().map(AlarmEntity::getStationId).distinct().collect(Collectors.toList());
} }
/**
* 查询站点数据中断
* @param codes
* @return
*/
@Override
public List<String> aborts(List<String> codes) {
List<AlarmEntity> alarms = this.list(Wrappers.<AlarmEntity>lambdaQuery()
.in(AlarmEntity::getStationId,codes)
.eq(AlarmEntity::getAlarmSource, AlarmConstants.HZ3000_ALARM)
.in(AlarmEntity::getAlarmType, Arrays.asList(AlarmConstants.INTERRUPT,AlarmConstants.ABNORMAL))
);
if(CollectionUtil.isEmpty(alarms)){
return new ArrayList<>();
}
return alarms.stream().collect(Collectors.groupingBy(AlarmEntity::getStationId)).values().stream().map(alarmEntities -> {
// 站点最近的一条数据中断、数据异常告警
AlarmEntity alarm = alarmEntities.stream().sorted(Comparator.comparing(AlarmEntity::getCreateTime).reversed()).collect(Collectors.toList()).get(0);
// 状态为中断
if (alarm.getAlarmStatus().equals(0)) {
return alarm.getStationId();
}
return "";
}).filter(StringUtil::isNotBlank).distinct().collect(Collectors.toList());
}
} }

244
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java

@ -0,0 +1,244 @@
package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.business.interruption.constants.InterruptionConstants;
import com.hnac.hzims.business.interruption.entity.InterruptionEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.alarm.AlarmService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
public class AlarmServiceImpl implements AlarmService {
private final StationService stationService;
private final AlarmQueryService alarmQueryService;
private final InterruptionAlarmServiceImpl interruptionAlarmService;
private final ISoeClient soeClient;
private final RedisTemplate redisTemplate;
private final static String start_stop_cache_final = "hzims:operation:start:stop:key";
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
/**
* 开停机告警
* @param param
*/
@Override
public void startStopAlarm(String param) {
// 获取站点开关机状态
Map<String,Integer> startStopMap = (HashMap<String, Integer>) redisTemplate.opsForValue().get(start_stop_cache_final);
// 查询接入水电站点
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>()
.eq(StationEntity::getDataOrigin,0)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){
return;
}
Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历
reals.forEach(real->{
// 过滤站点
List<StationEntity> list = stations.stream().filter(item -> item.getRefDept().equals(real.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
// 确定站点
StationEntity station = list.get(0);
// 数据初始化记录
if(CollectionUtil.isEmpty(startStopMap)){
if(Math.abs(real.getActivePower()) > 0){
refresh.put(real.getDeviceCode(),1);
}else{
refresh.put(real.getDeviceCode(),0);
}
return;
}
// 比对开机状态
if(Math.abs(real.getActivePower()) > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1);
// 记录开机告警
this.saveStartStopAlarm(station,real,1);
}else{
refresh.put(real.getDeviceCode(),0);
}
}else{
if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0);
// 记录关机告警
this.saveStartStopAlarm(station,real,0);
}else{
refresh.put(real.getDeviceCode(),1);
}
}
});
redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
}
/**
* 清理历史告警数据
* @param param
*/
@Override
public void clearHistoryAlarm(String param) {
this.alarmQueryService.clear(param);
}
/**
* 保存站点设备开关机告警
* @param station
* @param real
* @param state
*/
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) {
AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode());
alarm.setStationName(station.getName());
alarm.setDeviceCode(real.getDeviceCode());
alarm.setDeviceName(real.getDeviceName());
alarm.setAlarmId(station.getCode() + "_" + Func.randomUUID());
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_关机");
alarm.setAlarmSource(AlarmConstants.START_STOP_WARNING);
alarm.setAlarmType(AlarmConstants.STOP);
if(state == 1){
alarm.setAlarmType(AlarmConstants.START);
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_开机");
}
alarm.setStatus(0);
alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0);
alarm.setIsShowAlert(1);
alarm.setIsSmallBell(1);
alarm.setIsMask(1);
alarm.setIsBroadcast(0);
alarm.setIsPlatformMessage(1);
alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser());
alarm.setUpdateUser(station.getUpdateUser());
alarm.setUpdateTime(station.getUpdateTime());
this.alarmQueryService.save(alarm);
}
/**
* 数据中断告警
* @param param
*/
@Override
public void interruption(String param) {
// 查询接入站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getDataOrigin,"0")
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 查询告警数据: 间隔10分钟
SoeQueryConditionByStation query = new SoeQueryConditionByStation();
query.setTypes(InterruptionConstants.INTERRUPTION_TYPE);
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Calendar calendar = Calendar.getInstance();
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
calendar.add(Calendar.MINUTE,-360);
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false);
query.setPage(1);
query.setLimit(1000);
Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query);
// 未查询到告警信息
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())) {
return;
}
// 中断告警数据
List<SoeData> soes = result.getData().getRecords();
// 查询当天数据中断告警记录
List<InterruptionEntity> saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 批量保存中断告警数据
this.interruptionAlarmService.saveBatch(soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{
InterruptionEntity entity = new InterruptionEntity();
List<StationEntity> soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList());
if(!CollectionUtil.isEmpty(soeStations)){
entity.setStationId(soeStations.get(0).getCode());
entity.setStationName(soeStations.get(0).getName());
entity.setCreateDept(soeStations.get(0).getRefDept());
entity.setTenantId(soeStations.get(0).getTenantId());
}
entity.setAlarmId(soe.getId());
entity.setRealId(soe.getRealId());
entity.setSoeExplain(soe.getSoeExplain());
entity.setType(soe.getSoeType());
entity.setAlarmTime(soe.getTs());
entity.setStatus(0);
// 通讯中断恢复
if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){
entity.setStatus(1);
}
return entity;
}).collect(Collectors.toList()));
}
/**
* 查询当天数据中断告警记录
* @param stations
* @return
*/
private List<InterruptionEntity> saveInterruptions(List<String> stations) {
Calendar calendar = Calendar.getInstance();
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
return this.interruptionAlarmService.list(Wrappers.<InterruptionEntity>lambdaQuery()
.in(InterruptionEntity::getStationId,stations)
.ge(InterruptionEntity::getCreateTime,start)
.le(InterruptionEntity::getCreateTime,end)
);
}
}

107
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java

@ -2,28 +2,19 @@ package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.business.interruption.constants.InterruptionConstants; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.business.interruption.entity.InterruptionEntity; import com.hnac.hzims.business.interruption.entity.InterruptionEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.alarm.InterruptionAlrmMapper; import com.hnac.hzims.scheduled.mapper.alarm.InterruptionAlrmMapper;
import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService; import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.util.ArrayList;
import java.util.Calendar; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -36,85 +27,27 @@ import java.util.stream.Collectors;
@DS("alarm") @DS("alarm")
public class InterruptionAlarmServiceImpl extends BaseServiceImpl<InterruptionAlrmMapper, InterruptionEntity> implements InterruptionAlarmService { public class InterruptionAlarmServiceImpl extends BaseServiceImpl<InterruptionAlrmMapper, InterruptionEntity> implements InterruptionAlarmService {
private final StationService stationService;
private final ISoeClient soeClient;
/** /**
* 数据中断告警 * 查询站点数据中断
* @param param * @param codes
* @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) public List<String> aborts(List<String> codes) {
public void interruption(String param) { List<InterruptionEntity> alarms = this.list(Wrappers.<InterruptionEntity>lambdaQuery()
// 查询接入站点 .in(InterruptionEntity::getStationId,codes)
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getDataOrigin,"0")
); );
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(alarms)){
return; return new ArrayList<>();
} }
// 查询告警数据: 间隔10分钟 return alarms.stream().collect(Collectors.groupingBy(InterruptionEntity::getStationId)).values().stream().map(alarmEntities -> {
SoeQueryConditionByStation query = new SoeQueryConditionByStation(); // 站点最近的一条数据中断、数据异常告警
query.setTypes(InterruptionConstants.INTERRUPTION_TYPE); InterruptionEntity alarm = alarmEntities.stream().sorted(Comparator.comparing(InterruptionEntity::getCreateTime).reversed()).collect(Collectors.toList()).get(0);
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); // 状态为中断
Calendar calendar = Calendar.getInstance(); if (alarm.getStatus().equals(0)) {
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER)); return alarm.getStationId();
calendar.add(Calendar.MINUTE,-10);
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false);
query.setPage(1);
query.setLimit(1000);
Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query);
// 未查询到告警信息
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())) {
return;
}
// 中断告警数据
List<SoeData> soes = result.getData().getRecords();
// 查询当天数据中断告警记录
List<InterruptionEntity> saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 批量保存中断告警数据
this.saveBatch(soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{
InterruptionEntity entity = new InterruptionEntity();
List<StationEntity> soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList());
if(!CollectionUtil.isEmpty(soeStations)){
entity.setStationId(soeStations.get(0).getCode());
entity.setStationName(soeStations.get(0).getName());
entity.setCreateDept(soeStations.get(0).getRefDept());
entity.setTenantId(soeStations.get(0).getTenantId());
}
entity.setAlarmId(soe.getId());
entity.setRealId(soe.getRealId());
entity.setSoeExplain(soe.getSoeExplain());
entity.setType(soe.getSoeType());
entity.setAlarmTime(soe.getTs());
entity.setStatus(0);
// 通讯中断恢复
if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){
entity.setStatus(1);
} }
return entity; return "";
}).collect(Collectors.toList())); }).filter(StringUtil::isNotBlank).distinct().collect(Collectors.toList());
}
/**
* 查询当天数据中断告警记录
* @param stations
* @return
*/
private List<InterruptionEntity> saveInterruptions(List<String> stations) {
Calendar calendar = Calendar.getInstance();
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
return this.list(Wrappers.<InterruptionEntity>lambdaQuery()
.in(InterruptionEntity::getStationId,stations)
.ge(InterruptionEntity::getCreateTime,start)
.le(InterruptionEntity::getCreateTime,end)
);
} }
} }

8
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java

@ -63,7 +63,7 @@ public class DutyServiceImpl extends BaseServiceImpl<DutyMapper, ImsDutyMainEnti
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(item.getManagerId())); User user = UserCache.getUser(Long.valueOf(item.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
item.setManagerName(user.getName()); item.setManagerName(user.getRealName());
item.setManagerPhone(user.getPhone()); item.setManagerPhone(user.getPhone());
} }
// FIXME 上网 // FIXME 上网
@ -117,7 +117,7 @@ public class DutyServiceImpl extends BaseServiceImpl<DutyMapper, ImsDutyMainEnti
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId())); User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
dutyInfoVo.setManagerName(user.getName()); dutyInfoVo.setManagerName(user.getRealName());
dutyInfoVo.setManagerPhone(user.getPhone()); dutyInfoVo.setManagerPhone(user.getPhone());
} }
// 发电量 // 发电量
@ -143,7 +143,7 @@ public class DutyServiceImpl extends BaseServiceImpl<DutyMapper, ImsDutyMainEnti
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId())); User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
dutyInfoVo.setManagerName(user.getName()); dutyInfoVo.setManagerName(user.getRealName());
dutyInfoVo.setManagerPhone(user.getPhone()); dutyInfoVo.setManagerPhone(user.getPhone());
} }
dutyInfoVo.setGeneratingCapacity(0); dutyInfoVo.setGeneratingCapacity(0);
@ -183,7 +183,7 @@ public class DutyServiceImpl extends BaseServiceImpl<DutyMapper, ImsDutyMainEnti
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId())); User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
dutyMainInfoVo.setManagerName(user.getName()); dutyMainInfoVo.setManagerName(user.getRealName());
dutyMainInfoVo.setManagerPhone(user.getPhone()); dutyMainInfoVo.setManagerPhone(user.getPhone());
} }
return dutyMainInfoVo; return dutyMainInfoVo;

50
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -24,7 +24,10 @@ import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.equipment.PlanService; import com.hnac.hzims.scheduled.service.equipment.PlanService;
import com.hnac.hzims.scheduled.service.inspect.TaskService; import com.hnac.hzims.scheduled.service.inspect.TaskService;
import com.hnac.hzims.scheduled.service.operation.business.*; import com.hnac.hzims.scheduled.service.operation.business.AccessService;
import com.hnac.hzims.scheduled.service.operation.business.DutyService;
import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService;
import com.hnac.hzims.scheduled.service.operation.business.PhenomenonService;
import com.hnac.hzims.scheduled.service.operation.fill.*; import com.hnac.hzims.scheduled.service.operation.fill.*;
import com.hnac.hzims.scheduled.service.operation.home.ShowService; import com.hnac.hzims.scheduled.service.operation.home.ShowService;
import com.hnac.hzims.scheduled.service.operation.plate.DataService; import com.hnac.hzims.scheduled.service.operation.plate.DataService;
@ -77,6 +80,7 @@ public class ShowServiceImpl implements ShowService {
private final OverService overService; private final OverService overService;
private final PlanService planService; private final PlanService planService;
private final PowerService powerService; private final PowerService powerService;
private final WindService windService;
private final SolveService solveService; private final SolveService solveService;
private final OtherService otherService; private final OtherService otherService;
private final AccessService accessService; private final AccessService accessService;
@ -319,27 +323,35 @@ public class ShowServiceImpl implements ShowService {
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return target; return target;
} }
QueryWrapper<PowerEntity> queryWrapper = new QueryWrapper<PowerEntity>() {{ // 计划发电量
in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); List<PlanGenerationEntity> plans = planService.planGeneration(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null, DateUtil.format(new Date(),"yyyy"));
eq("type", HomePageConstant.WIND_POWER_TYPE); // 填报信息
likeRight("mon", DateUtil.format(new Date(),"yyyy")); List<WindEntity> winds = windService.list(Wrappers.<WindEntity>lambdaQuery()
}}; .in(WindEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))
List<PowerEntity> list = powerService.list(queryWrapper); .likeRight(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy")));
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(winds)){
return target; return target;
} }
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); double power = winds.stream().mapToDouble(WindEntity::getPower).sum();
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 装机容量 // 装机容量
target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum()); target.setTaget_one(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum());
// 发电量 // 发电量
target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum()); target.setTaget_two(power);
if(Math.abs(plan) > 0){ if(Math.abs(plan) > 0){
// 发电完成率 // 发电完成率
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); target.setTaget_three(BigDecimal.valueOf(power / plan * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
} }
// 双票合格率 // 双票合格率
target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, RoundingMode.HALF_UP).doubleValue()); LocalDate firstDay = LocalDate.now().withDayOfYear(1);
LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN);
R<List<Dept>> result = sysClient.getDeptList();
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList());
DoublePassRateVO pass = ticketService.doublePassRate(areas, firstDateTime, LocalDateTime.now());
if (ObjectUtil.isNotEmpty(pass)) {
target.setTaget_four(Double.valueOf(pass.getDoublePassRate()));
}
return target; return target;
} }
@ -433,6 +445,12 @@ public class ShowServiceImpl implements ShowService {
TargetVo target = new TargetVo(); TargetVo target = new TargetVo();
target.setType(HomePageConstant.DISTRIBUTION_NETWORK); target.setType(HomePageConstant.DISTRIBUTION_NETWORK);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.DISTRIBUTION_NETWORK)); target.setTypeName(DictCache.getValue("stationType", HomePageConstant.DISTRIBUTION_NETWORK));
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.DISTRIBUTION_NETWORK));
if(CollectionUtil.isEmpty(stations)){
return target;
}
// 线程池 // 线程池
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("network-taget-pool-%d").build(); ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("network-taget-pool-%d").build();
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(3, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(3, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
@ -446,6 +464,7 @@ public class ShowServiceImpl implements ShowService {
List<OverEntity> overs = overService.list(new QueryWrapper<OverEntity>() {{ List<OverEntity> overs = overService.list(new QueryWrapper<OverEntity>() {{
ge("create_time", firstDateTime); ge("create_time", firstDateTime);
le("create_time", LocalDateTime.now()); le("create_time", LocalDateTime.now());
in("create_dept",stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
}}); }});
if(CollectionUtil.isEmpty(overs)){ if(CollectionUtil.isEmpty(overs)){
countDownLatch.countDown(); countDownLatch.countDown();
@ -468,6 +487,7 @@ public class ShowServiceImpl implements ShowService {
List<SolveEntity> solves = solveService.list(new QueryWrapper<SolveEntity>() {{ List<SolveEntity> solves = solveService.list(new QueryWrapper<SolveEntity>() {{
ge("create_time", firstDateTime); ge("create_time", firstDateTime);
le("create_time", LocalDateTime.now()); le("create_time", LocalDateTime.now());
in("create_dept",stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
}}); }});
if(CollectionUtil.isEmpty(solves)){ if(CollectionUtil.isEmpty(solves)){
countDownLatch.countDown(); countDownLatch.countDown();
@ -481,6 +501,7 @@ public class ShowServiceImpl implements ShowService {
List<OtherEntity> others = otherService.list(new QueryWrapper<OtherEntity>() {{ List<OtherEntity> others = otherService.list(new QueryWrapper<OtherEntity>() {{
ge("create_time", firstDateTime); ge("create_time", firstDateTime);
le("create_time", LocalDateTime.now()); le("create_time", LocalDateTime.now());
in("create_dept",stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
}}); }});
if(CollectionUtil.isEmpty(others)){ if(CollectionUtil.isEmpty(others)){
countDownLatch.countDown(); countDownLatch.countDown();
@ -648,6 +669,7 @@ public class ShowServiceImpl implements ShowService {
return null; return null;
} }
list = R.getData(); list = R.getData();
} }
// 根据参数查询有效站点 // 根据参数查询有效站点
List<StationEntity> stationList = this.stationByParams(list,deptId,typeList,serveType); List<StationEntity> stationList = this.stationByParams(list,deptId,typeList,serveType);

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java

@ -19,6 +19,7 @@ import com.hnac.hzims.operational.main.vo.RealStationVo;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity; import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService;
import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService; import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService;
import com.hnac.hzims.scheduled.service.operation.alarm.RecordService; import com.hnac.hzims.scheduled.service.operation.alarm.RecordService;
import com.hnac.hzims.scheduled.service.operation.monitor.MonitorService; import com.hnac.hzims.scheduled.service.operation.monitor.MonitorService;
@ -56,14 +57,25 @@ import java.util.stream.Stream;
public class MonitorServiceImpl implements MonitorService { public class MonitorServiceImpl implements MonitorService {
private final RecordService alertService; private final RecordService alertService;
private final StationService stationService; private final StationService stationService;
private final AlarmQueryService alarmQueryService; private final AlarmQueryService alarmQueryService;
private final StationAttributeService attbtService; private final StationAttributeService attbtService;
private final WorkshopInfoService workshopInfoService; private final WorkshopInfoService workshopInfoService;
private final StationAttrConfigService attrConfigService; private final StationAttrConfigService attrConfigService;
private final InterruptionAlarmService interruptionAlarmService;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final ISysClient sysClient; private final ISysClient sysClient;
private final RedisClient redisClient; private final RedisClient redisClient;
private final IAnalyseDataSearchClient analyseDataSearchClient; private final IAnalyseDataSearchClient analyseDataSearchClient;
@Value("${hzims.equipment.emInfo.emInfoList}") @Value("${hzims.equipment.emInfo.emInfoList}")
@ -294,7 +306,7 @@ public class MonitorServiceImpl implements MonitorService {
// 铃铛 // 铃铛
List<String> bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); List<String> bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 数据中断 // 数据中断
List<String> aborts = alarmQueryService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); List<String> aborts = interruptionAlarmService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 隐藏设备列表 // 隐藏设备列表
List<String> hideList = attrConfigService.getHideList(); List<String> hideList = attrConfigService.getHideList();
// 分割,每个map限制10个长度 // 分割,每个map限制10个长度

7
hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmQueryMapper.xml

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.alarm.show.mapper.AlarmMapper"> <mapper namespace="com.hnac.hzims.scheduled.mapper.alarm.AlarmQueryMapper">
<delete id="clear">
delete from hzims_alarm
where alarm_time &lt; #{alarmTime}
</delete>
</mapper> </mapper>

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/wrapper/OfflineRecordWrapper.java

@ -24,8 +24,8 @@ public class OfflineRecordWrapper extends BaseEntityWrapper<OfflineRecordEntity,
OfflineRecordVO vo = BeanUtil.copy(entity, OfflineRecordVO.class); OfflineRecordVO vo = BeanUtil.copy(entity, OfflineRecordVO.class);
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser.getName()); vo.setCreateUserName(createUser.getRealName());
vo.setUpdateUserName(updateUser.getName()); vo.setUpdateUserName(updateUser.getRealName());
return vo; return vo;
} }

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/InspectionTaskSMS.java

@ -31,7 +31,7 @@ public class InspectionTaskSMS extends TaskEntity {
*/ */
public void setSmsDetail(){ public void setSmsDetail(){
User user = UserCache.getUser(this.getUserId()); User user = UserCache.getUser(this.getUserId());
this.setCnName(user.getName()); this.setCnName(user.getRealName());
this.setPhone(user.getPhone()); this.setPhone(user.getPhone());
this.setLoginName(user.getAccount()); this.setLoginName(user.getAccount());
} }

22
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -180,9 +180,10 @@
order by t.UPDATE_TIME desc order by t.UPDATE_TIME desc
</select> </select>
<select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,u.USER_ID as userIds,u.USER_NAME from HZ_ST_EX_TASK t SELECT t.*,u.USER_ID as userIds,u.USER_NAME as userNames
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID from
and u.IS_DELETED=0 HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID and u.IS_DELETED=0
where t.IS_DELETED=0 where t.IS_DELETED=0
<if test="task.userId != null "> <if test="task.userId != null ">
and u.USER_ID=#{task.userId} and u.USER_ID=#{task.userId}
@ -191,12 +192,15 @@
order by t.UPDATE_TIME desc order by t.UPDATE_TIME desc
</select> </select>
<select id="getAllExportList" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <select id="getAllExportList" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,b.USER_ID as userIds,(SELECT group_concat(u .user_name) FROM HZ_ST_EX_TASK_USER u WHERE t.ID=u.TASK_ID SELECT
<if test="task.userId != null "> t.*, b.USER_ID as userIds,
and u.USER_ID=#{task.userId} (SELECT group_concat(u.user_name) FROM HZ_ST_EX_TASK_USER u WHERE t.ID=u.TASK_ID
</if>) AS userNames from HZ_ST_EX_TASK t <if test="task.userId != null ">
LEFT JOIN HZ_ST_EX_TASK_USER b on t.ID=b.TASK_ID and u.USER_ID=#{task.userId}
and b.IS_DELETED=0 </if>) AS userNames
from
HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER b on t.ID=b.TASK_ID and b.IS_DELETED=0
where t.IS_DELETED=0 where t.IS_DELETED=0
<if test="task.userId != null "> <if test="task.userId != null ">
and u.USER_ID=#{task.userId} and u.USER_ID=#{task.userId}

24
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzinfo.inspect.task.service.impl; package com.hnac.hzinfo.inspect.task.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -10,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity; import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity;
import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient; import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient;
@ -51,6 +53,7 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -60,6 +63,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -364,7 +368,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
taskReportVO.setCompleteSituation(finishSituation); taskReportVO.setCompleteSituation(finishSituation);
taskReportVO.setIncompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getUndoneTask())).collect(Collectors.summingInt(TaskCountVO::getUndoneTask))); taskReportVO.setIncompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getUndoneTask())).collect(Collectors.summingInt(TaskCountVO::getUndoneTask)));
taskReportVO.setIncompleteSituation(undoSituation); taskReportVO.setIncompleteSituation(undoSituation);
taskReportVO.setUserName(user.getName()); taskReportVO.setUserName(user.getRealName());
result.add(taskReportVO); result.add(taskReportVO);
} }
}); });
@ -531,14 +535,18 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
query.setCurrent(taskDTO.getCurrent()); query.setCurrent(taskDTO.getCurrent());
IPage<TaskVo> pages = Condition.getPage(query); IPage<TaskVo> pages = Condition.getPage(query);
List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO); List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO);
list = list.stream().map(taskVo -> { list = list.stream().peek(taskVo -> {
// 获取机器人信息 // 获取机器人信息
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) { if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) {
if (Func.isNotEmpty( ObjectUtil.isNotEmpty(taskVo.getUserId()))) { if (Func.isNotEmpty( ObjectUtil.isNotEmpty(taskVo.getUserId()))) {
taskVo.setRobot(robotService.getDetailByUserId(taskVo.getUserId())); taskVo.setRobot(robotService.getDetailByUserId(taskVo.getUserId()));
} }
} }
return taskVo; // 巡检时长计算
if (ObjectUtil.isNotEmpty(taskVo.getStartTime()) && ObjectUtil.isNotEmpty(taskVo.getEndTime())) {
long inspectTime = DateUtil.between(taskVo.getStartTime(), taskVo.getEndTime()).toMinutes();
taskVo.setInspectTime(Optional.of(inspectTime).orElse(0L));
}
}).collect(Collectors.toList()); }).collect(Collectors.toList());
pages.setRecords(list); pages.setRecords(list);
BladePage<TaskVo> bladePage = BladePage.of(pages); BladePage<TaskVo> bladePage = BladePage.of(pages);
@ -599,7 +607,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
@Override @Override
public List<TaskVo> getListPageAuth(IPage<TaskVo> page, TaskListQuery task) { public List<TaskVo> getListPageAuth(IPage<TaskVo> page, TaskListQuery task) {
List<TaskVo> re = this.baseMapper.getListPageAuth(page, task); List<TaskVo> re = this.baseMapper.getListPageAuth(page, task);
setVoInfo(re); setVoInfo(re);
return re; return re;
} }
@ -1002,9 +1010,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} else { } else {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds); queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds);
} }
queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME",startTime); queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME",startTime);
queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME",endTime); queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME",endTime);
taskEntities= baseMapper.selectList(queryWrapper); taskEntities= baseMapper.selectList(queryWrapper);
List<VoteChartVo> res=new ArrayList<>(); List<VoteChartVo> res=new ArrayList<>();
if (CollectionUtil.isNotEmpty(taskEntities)) { if (CollectionUtil.isNotEmpty(taskEntities)) {
VoteChartVo all = getVoteChartVo(taskEntities); VoteChartVo all = getVoteChartVo(taskEntities);
@ -1030,7 +1038,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
List<TaskVo> taskEntities = super.baseMapper.getAllExportList(task); List<TaskVo> taskEntities = super.baseMapper.getAllExportList(task);
List<InspectTaskExportVO> list=new ArrayList<>(); List<InspectTaskExportVO> list=new ArrayList<>();
if (CollectionUtils.isNotEmpty(taskEntities)){ if (CollectionUtils.isNotEmpty(taskEntities)){
list=taskEntities.parallelStream().map(taskVo -> { list=taskEntities.parallelStream().map(taskVo -> {
InspectTaskExportVO resEntity=new InspectTaskExportVO(); InspectTaskExportVO resEntity=new InspectTaskExportVO();
try { try {
if (ObjectUtil.isNotEmpty(taskVo.getCreateDept())) { if (ObjectUtil.isNotEmpty(taskVo.getCreateDept())) {

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskVo.java

@ -29,4 +29,7 @@ public class TaskVo extends TaskEntity {
@ApiModelProperty("执行名称,按逗号分隔") @ApiModelProperty("执行名称,按逗号分隔")
private String userNames; private String userNames;
@ApiModelProperty("巡检时长/分钟")
private Long inspectTime;
} }

2
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java

@ -187,7 +187,7 @@ public class MessageClient extends BladeController implements IMessageClient{
if (ObjectUtil.isEmpty(user)||ObjectUtil.isEmpty(user.getPhone())){ if (ObjectUtil.isEmpty(user)||ObjectUtil.isEmpty(user.getPhone())){
continue; continue;
} }
record.setPusherName(user.getName()); record.setPusherName(user.getRealName());
record.setPusher(pushId.toString()); record.setPusher(pushId.toString());
record.setPushType(MessageConstants.IMMEDIATELY); record.setPushType(MessageConstants.IMMEDIATELY);
record.setDeptName(Func.isNotEmpty(record.getDeptName()) ? record.getDeptName() : this.getDeptNameById(record.getDeptId())); record.setDeptName(Func.isNotEmpty(record.getDeptName()) ? record.getDeptName() : this.getDeptNameById(record.getDeptId()));

4
hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgPushRecordWrapper.java

@ -24,8 +24,8 @@ public class MsgPushRecordWrapper extends BaseEntityWrapper<MsgPushRecordEntity,
MsgPushRecordVO vo = BeanUtil.copy(entity, MsgPushRecordVO.class); MsgPushRecordVO vo = BeanUtil.copy(entity, MsgPushRecordVO.class);
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser.getName()); vo.setCreateUserName(createUser.getRealName());
vo.setUpdateUserName(updateUser.getName()); vo.setUpdateUserName(updateUser.getRealName());
return vo; return vo;
} }

4
hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgSmsRecordWrapper.java

@ -25,8 +25,8 @@ public class MsgSmsRecordWrapper extends BaseEntityWrapper<MsgSmsRecordEntity, M
MsgSmsRecordVO vo = BeanUtil.copy(entity, MsgSmsRecordVO.class); MsgSmsRecordVO vo = BeanUtil.copy(entity, MsgSmsRecordVO.class);
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser.getName()); vo.setCreateUserName(createUser.getRealName());
vo.setUpdateUserName(updateUser.getName()); vo.setUpdateUserName(updateUser.getRealName());
return vo; return vo;
} }

4
hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordHistoryWrapper.java

@ -24,8 +24,8 @@ public class MsgWsRecordHistoryWrapper extends BaseEntityWrapper<MsgWsRecordHist
MsgWsRecordHistoryVO vo = BeanUtil.copy(entity, MsgWsRecordHistoryVO.class); MsgWsRecordHistoryVO vo = BeanUtil.copy(entity, MsgWsRecordHistoryVO.class);
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser.getName()); vo.setCreateUserName(createUser.getRealName());
vo.setUpdateUserName(updateUser.getName()); vo.setUpdateUserName(updateUser.getRealName());
return vo; return vo;
} }

4
hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordWrapper.java

@ -25,9 +25,9 @@ public class MsgWsRecordWrapper extends BaseEntityWrapper<MsgWsRecordEntity, Msg
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
if(null != entity.getUpdateUser()) { if(null != entity.getUpdateUser()) {
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setUpdateUserName(updateUser.getName()); vo.setUpdateUserName(updateUser.getRealName());
} }
vo.setCreateUserName(createUser.getName()); vo.setCreateUserName(createUser.getRealName());
return vo; return vo;
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java

@ -114,7 +114,7 @@ public class OperAccessLibraryController extends BladeController {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@PostMapping(value = "/import") @PostMapping(value = "/import")
@Operate(label = "检修库导入",type = com.hnac.hzinfo.log.contants.BusinessType.IMPORT,risk = Risk.LOW,ignore = false) @Operate(label = "检修库导入",type = com.hnac.hzinfo.log.contants.BusinessType.IMPORT,risk = Risk.LOW,ignore = false)
public void libraryImport(@RequestParam MultipartFile file) { public R libraryImport(@RequestParam MultipartFile file) {
service.libraryImport(file); return R.data(service.libraryImport(file));
} }
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/excel/BaseExport.java

@ -12,6 +12,6 @@ public abstract class BaseExport {
protected String getUserName(Long uid) { protected String getUserName(Long uid) {
User user = UserCache.getUser(uid); User user = UserCache.getUser(uid);
return user != null ? user.getName() : uid != null ? uid.toString() : StringUtils.EMPTY; return user != null ? user.getRealName() : uid != null ? uid.toString() : StringUtils.EMPTY;
} }
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessLibraryService.java

@ -30,5 +30,5 @@ public interface IOperAccessLibraryService extends BaseService<OperAccessLibrary
void downLoad(); void downLoad();
void libraryImport(MultipartFile file); String libraryImport(MultipartFile file);
} }

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

@ -126,20 +126,20 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
entity.setActStartTime(new Date()); entity.setActStartTime(new Date());
if (ObjectUtil.isNotEmpty(entity.getTechLead())){ if (ObjectUtil.isNotEmpty(entity.getTechLead())){
User user = UserCache.getUser(entity.getTechLead()); User user = UserCache.getUser(entity.getTechLead());
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getRealName())){
entity.setTechLeadName(user.getName()); entity.setTechLeadName(user.getRealName());
} }
} }
if (ObjectUtil.isNotEmpty(entity.getManager())){ if (ObjectUtil.isNotEmpty(entity.getManager())){
User user = UserCache.getUser(entity.getManager()); User user = UserCache.getUser(entity.getManager());
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getRealName())){
entity.setManagerName(user.getName()); entity.setManagerName(user.getRealName());
} }
} }
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getUserName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getUserName())){
entity.setCreateUserName(user.getUserName()); entity.setCreateUserName(user.getNickName());
entity.setUpdateUserName(user.getUserName()); entity.setUpdateUserName(user.getNickName());
} }
planService.save(entity); planService.save(entity);
} }

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java

@ -128,10 +128,10 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(entity.getAccessMaterials()), OperAccessMaterialEntity.class); List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(entity.getAccessMaterials()), OperAccessMaterialEntity.class);
if (ObjectUtil.isNotEmpty(entity.getHandler())){ if (ObjectUtil.isNotEmpty(entity.getHandler())){
User user = UserCache.getUser(entity.getHandler()); User user = UserCache.getUser(entity.getHandler());
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getRealName())){
entity.setHandlerName(user.getName()); entity.setHandlerName(user.getRealName());
entity.setCreateUserName(user.getName()); entity.setCreateUserName(user.getRealName());
entity.setUpdateUserName(user.getName()); entity.setUpdateUserName(user.getRealName());
} }
} }
taskService.save(entity); taskService.save(entity);

33
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java

@ -22,6 +22,7 @@ import com.hnac.hzims.operational.util.PdfUtils;
import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; import com.hnac.hzims.safeproduct.feign.IDangerSourceClient;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
@ -32,6 +33,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictCache; import org.springblade.system.cache.DictCache;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
@ -149,7 +151,7 @@ public class OperAccessLibraryServiceImpl extends BaseServiceImpl<OperAccessLibr
* @param file * @param file
*/ */
@Override @Override
public void libraryImport(MultipartFile file){ public String libraryImport(MultipartFile file){
// 文件名检查 // 文件名检查
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
if(!fileName.endsWith(PdfUtils.XLS_SUFFIX) && !fileName.endsWith(PdfUtils.XLSX_SUFFIX)){ if(!fileName.endsWith(PdfUtils.XLS_SUFFIX) && !fileName.endsWith(PdfUtils.XLSX_SUFFIX)){
@ -169,6 +171,7 @@ public class OperAccessLibraryServiceImpl extends BaseServiceImpl<OperAccessLibr
throw new ServiceException("请填写导入检修库数据!"); throw new ServiceException("请填写导入检修库数据!");
} }
List<OperAccessLibraryDetailEntity> details = new ArrayList<>(); List<OperAccessLibraryDetailEntity> details = new ArrayList<>();
StringBuilder failBuilder = new StringBuilder();
Long libraryId = null; Long libraryId = null;
for (int i = 2; i <= rows + 1; i++) { for (int i = 2; i <= rows + 1; i++) {
// 读取左上端单元格 // 读取左上端单元格
@ -178,27 +181,43 @@ public class OperAccessLibraryServiceImpl extends BaseServiceImpl<OperAccessLibr
continue; continue;
} }
if( (i - 1) % 4 == 1){ if( (i - 1) % 4 == 1){
if(StringUtils.isEmpty(row.getCell(1).getStringCellValue())){ if(StringUtils.isEmpty(row.getCell(1).getStringCellValue())
|| StringUtils.isEmpty(row.getCell(2).getStringCellValue())
|| ObjectUtil.isEmpty(row.getCell(3).getDateCellValue())){
failBuilder.append((int)row.getCell(0).getNumericCellValue()).append(",");
continue; continue;
} }
OperAccessLibraryEntity library = new OperAccessLibraryEntity(); OperAccessLibraryEntity library = new OperAccessLibraryEntity();
row.getCell(1).setCellType(CellType.STRING);
library.setEmName(row.getCell(1).getStringCellValue()); library.setEmName(row.getCell(1).getStringCellValue());
library.setGradeCode(DictCache.getValue("gradeCode",row.getCell(2).getStringCellValue())); library.setGradeCode(DictCache.getValue("gradeCode",row.getCell(2).getStringCellValue()));
library.setLastServiceTime(row.getCell(3).getDateCellValue()); library.setLastServiceTime(row.getCell(3).getDateCellValue());
library.setPeriod((int)row.getCell(4).getNumericCellValue()); if(!ObjectUtil.isEmpty(row.getCell(4).getNumericCellValue())){
library.setStopHours((int)row.getCell(5).getNumericCellValue()); library.setPeriod((int)row.getCell(4).getNumericCellValue());
}
if(!ObjectUtil.isEmpty(row.getCell(5).getNumericCellValue())){
library.setPeriod((int)row.getCell(5).getNumericCellValue());
}
this.save(library); this.save(library);
libraryId = library.getId(); libraryId = library.getId();
} }
if(StringUtils.isNotEmpty(row.getCell(6).getStringCellValue())){ //设置单元格类型
row.getCell(6).setCellType(CellType.STRING);
row.getCell(7).setCellType(CellType.STRING);
if(StringUtils.isNotEmpty(row.getCell(6).getStringCellValue())
&& StringUtils.isNotEmpty(row.getCell(7).getStringCellValue())){
OperAccessLibraryDetailEntity detail = new OperAccessLibraryDetailEntity(); OperAccessLibraryDetailEntity detail = new OperAccessLibraryDetailEntity();
detail.setName(row.getCell(6).getStringCellValue()); detail.setName(row.getCell(6).getRichStringCellValue().getString());
detail.setContent(row.getCell(7).getStringCellValue()); detail.setContent(row.getCell(7).getRichStringCellValue().getString());
detail.setPid(libraryId); detail.setPid(libraryId);
details.add(detail); details.add(detail);
} }
} }
this.libraryDetailService.saveBatch(details); this.libraryDetailService.saveBatch(details);
if(failBuilder.length() > 0){
return "导入完成,序号:" + failBuilder.substring(0,failBuilder.toString().length()-1) + "数据未填写或者必传项未填写,未导入成功!";
}
return "导入完成";
} }
/** /**

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessStatisticsServiceImpl.java

@ -46,14 +46,14 @@ public class OperAccessStatisticsServiceImpl extends BaseServiceImpl<OperAccessS
public R doSave(OperAccessStatisticsDTO req) { public R doSave(OperAccessStatisticsDTO req) {
if (ObjectUtil.isNotEmpty(req.getManager())){ if (ObjectUtil.isNotEmpty(req.getManager())){
User user = UserCache.getUser(req.getManager()); User user = UserCache.getUser(req.getManager());
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getRealName())){
req.setManagerName(user.getName()); req.setManagerName(user.getRealName());
} }
} }
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getUserName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getNickName())){
req.setCreateUserName(user.getUserName()); req.setCreateUserName(user.getNickName());
req.setUpdateUserName(user.getUserName()); req.setUpdateUserName(user.getNickName());
} }
boolean save = super.save(req); boolean save = super.save(req);
return R.status(save); return R.status(save);

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -111,14 +111,14 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
req.setCode("TASK" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999))); req.setCode("TASK" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999)));
if (ObjectUtil.isNotEmpty(req.getHandler())){ if (ObjectUtil.isNotEmpty(req.getHandler())){
User user = UserCache.getUser(req.getHandler()); User user = UserCache.getUser(req.getHandler());
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getRealName())){
req.setHandlerName(user.getName()); req.setHandlerName(user.getRealName());
} }
} }
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getUserName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getNickName())){
req.setCreateUserName(user.getUserName()); req.setCreateUserName(user.getNickName());
req.setUpdateUserName(user.getUserName()); req.setUpdateUserName(user.getNickName());
} }
List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(req.getAccessMaterials()), OperAccessMaterialEntity.class); List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(req.getAccessMaterials()), OperAccessMaterialEntity.class);
if (super.save(req)) { if (super.save(req)) {

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/wrapper/AreaMapWrapper.java

@ -26,7 +26,7 @@ public class AreaMapWrapper extends BaseEntityWrapper<AreaMapEntity, AreaMapVo>
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(createUser.getName()); vo.setUserName(createUser.getRealName());
return vo; return vo;
} }
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java

@ -11,8 +11,8 @@ import org.springframework.stereotype.Component;
@Data @Data
public class RedisKeyConstants { public class RedisKeyConstants {
public static String MAINTENANCE_TASK_DELAY_LIST = "hzims:operation:maintenance:end:delay:tasks"; public static String MAINTENANCE_TASK_DELAY_LIST = "hzims:operation:maintenance:delay:tasks";
public static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:end:delay:tasks"; public static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:end:tasks";
/**根据realId获取实时数据**/ /**根据realId获取实时数据**/
@Value("${hzims.operation.realIdKey}") @Value("${hzims.operation.realIdKey}")

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -101,12 +101,12 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
} }
if (ObjectUtil.isNotEmpty(entity.getFinder())&&StringUtils.isBlank(entity.getFinderName())){ if (ObjectUtil.isNotEmpty(entity.getFinder())&&StringUtils.isBlank(entity.getFinderName())){
User user = UserCache.getUser(entity.getFinder()); User user = UserCache.getUser(entity.getFinder());
if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getName())) { if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getRealName())) {
entity.setFinderName(user.getName()); entity.setFinderName(user.getRealName());
} }
} }
if (StringUtils.isNotBlank(AuthUtil.getUserName())){ if (StringUtils.isNotBlank(AuthUtil.getNickName())){
entity.setCreateUserName(AuthUtil.getUserName()); entity.setCreateUserName(AuthUtil.getNickName());
} }
//加锁 //加锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + entity.getCreateDept(), entity.getCreateDept(), 30, TimeUnit.SECONDS); Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + entity.getCreateDept(), entity.getCreateDept(), 30, TimeUnit.SECONDS);

76
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java

@ -730,26 +730,29 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
sheet.addMergedRegion(repeat_religon); sheet.addMergedRegion(repeat_religon);
currentRow++; currentRow++;
//表头2
CellRangeAddress repeat_head2_cell_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2);
sheet.addMergedRegion(repeat_head2_cell_religon);
HSSFRow repeat_head2 = sheet.createRow(currentRow); HSSFRow repeat_head2 = sheet.createRow(currentRow);
this.setFullHeadCell(wb, repeat_head2, (short) 9, 0); this.setFullHeadCell(wb, repeat_head2, (short) 9, 0);
HSSFCell repeat_head2_cell1 = repeat_head2.getCell(3); HSSFCell repeat_head2_cell1 = repeat_head2.getCell(1);
CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 1, (short) 2);
sheet.addMergedRegion(repeat_head2_cell1_religon); sheet.addMergedRegion(repeat_head2_cell1_religon);
repeat_head2_cell1.setCellValue("发生数量"); repeat_head2_cell1.setCellValue("重复发生数量");
HSSFCell repeat_head2_cell2 = repeat_head2.getCell(5); HSSFCell repeat_head2_cell2 = repeat_head2.getCell(3);
CellRangeAddress repeat_head2_cell2_religon = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); CellRangeAddress repeat_head2_cell2_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4);
sheet.addMergedRegion(repeat_head2_cell2_religon); sheet.addMergedRegion(repeat_head2_cell2_religon);
repeat_head2_cell2.setCellValue("占重复缺陷总数的比率(%)"); repeat_head2_cell2.setCellValue("占重复缺陷总数的比率(%)");
HSSFCell repeat_head2_cell3 = repeat_head2.getCell(7);
CellRangeAddress repeat_head2_cell3_religon = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); HSSFCell repeat_head2_cell3 = repeat_head2.getCell(5);
CellRangeAddress repeat_head2_cell3_religon = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6);
sheet.addMergedRegion(repeat_head2_cell3_religon); sheet.addMergedRegion(repeat_head2_cell3_religon);
repeat_head2_cell3.setCellValue("占总缺陷的比率(%)"); repeat_head2_cell3.setCellValue("总发生数量");
HSSFCell repeat_head2_cell4 = repeat_head2.getCell(7);
CellRangeAddress repeat_head2_cell4_religon = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8);
sheet.addMergedRegion(repeat_head2_cell4_religon);
repeat_head2_cell4.setCellValue("占总缺陷的比率(%)");
currentRow++; currentRow++;
@ -759,8 +762,6 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
this.setFullHeadCell(wb, repeat_row, (short) 9, 1); this.setFullHeadCell(wb, repeat_row, (short) 9, 1);
//第一列 //第一列
HSSFCell repeat_cell1 = repeat_row.getCell(0); HSSFCell repeat_cell1 = repeat_row.getCell(0);
CellRangeAddress repeat_content_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2);
sheet.addMergedRegion(repeat_content_religon);
if ("1".equals(repeat.get(i).getDefectLevel())) { if ("1".equals(repeat.get(i).getDefectLevel())) {
repeat_cell1.setCellValue("一类缺陷"); repeat_cell1.setCellValue("一类缺陷");
} else if ("2".equals(repeat.get(i).getDefectLevel())) { } else if ("2".equals(repeat.get(i).getDefectLevel())) {
@ -771,22 +772,28 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel()); repeat_cell1.setCellValue(repeat.get(i).getDefectLevel());
} }
//第二列 //第二列
HSSFCell repeat_cell2 = repeat_row.getCell(3); HSSFCell repeat_cell2 = repeat_row.getCell(1);
CellRangeAddress repeat_content_religon1 = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); CellRangeAddress repeat_content_religon1 = new CellRangeAddress(currentRow, currentRow, (short) 1, (short) 2);
sheet.addMergedRegion(repeat_content_religon1); sheet.addMergedRegion(repeat_content_religon1);
repeat_cell2.setCellValue(repeat.get(i).getHappenNum()); repeat_cell2.setCellValue(repeat.get(i).getHappenNum());
//第三列 //第三列
HSSFCell repeat_cell3 = repeat_row.getCell(5); HSSFCell repeat_cell3 = repeat_row.getCell(3);
CellRangeAddress repeat_content_religon2 = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); CellRangeAddress repeat_content_religon2 = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4);
sheet.addMergedRegion(repeat_content_religon2); sheet.addMergedRegion(repeat_content_religon2);
repeat_cell3.setCellValue(this.dealDouble(repeat.get(i).getRepeatRatio())); repeat_cell3.setCellValue(this.dealDouble(repeat.get(i).getRepeatRatio()));
//第四列 //第四列
HSSFCell repeat_cell4 = repeat_row.getCell(7); HSSFCell repeat_cell4 = repeat_row.getCell(5);
CellRangeAddress repeat_content_religon3 = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); CellRangeAddress repeat_content_religon3 = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6);
sheet.addMergedRegion(repeat_content_religon3); sheet.addMergedRegion(repeat_content_religon3);
repeat_cell4.setCellValue(this.dealDouble(repeat.get(i).getHappenRatio())); repeat_cell4.setCellValue(repeat.get(i).getHappenSumNum());
//第五列
HSSFCell repeat_cell5 = repeat_row.getCell(7);
CellRangeAddress repeat_content_religon4 = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8);
sheet.addMergedRegion(repeat_content_religon4);
repeat_cell5.setCellValue(this.dealDouble(repeat.get(i).getHappenRatio()));
currentRow++; currentRow++;
} }
return currentRow; return currentRow;
@ -944,7 +951,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
List<String> deptList ; List<String> deptList ;
R<List<Dept>> res = sysClient.getDeptByCurrentUser(); R<List<Dept>> res = sysClient.getDeptByCurrentUser();
if (res.isSuccess() && CollectionUtil.isNotEmpty(res.getData())) { if (res.isSuccess() && CollectionUtil.isNotEmpty(res.getData())) {
deptList = res.getData().stream().map(Dept::getId).map(s -> s.toString()).collect(Collectors.toList()); deptList = res.getData().stream().map(Dept::getId).map(Object::toString).collect(Collectors.toList());
} else { } else {
throw new WebServiceException("该用户没有此权限"); throw new WebServiceException("该用户没有此权限");
} }
@ -961,35 +968,46 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
//总缺陷数 //总缺陷数
int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum(); int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum();
//总重复缺陷数 //总重复缺陷数
int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum)); int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum();
//等级重复统计 //等级重复统计
Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum))); Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum)));
//缺陷等级分类总数统计
Map<String, IntSummaryStatistics> sums = repetStatistics.stream().collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum)));
OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO();
one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus()); one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus());
if (repeatList.get(one.getDefectLevel()) != null) { if (repeatList.get(one.getDefectLevel()) != null) {
one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum()); one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum());
one.setHappenRatio(one.getHappenNum() / Double.valueOf(total)); one.setRepeatRatio(one.getHappenNum() / (double) totalRepeat);
one.setRepeatRatio(one.getHappenNum() / Double.valueOf(totalRepeat)); }
if(sums.containsKey(one.getDefectLevel())){
one.setHappenSumNum(sums.get(one.getDefectLevel()).getSum());
one.setHappenRatio(one.getHappenSumNum() / (double) total);
} }
OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO();
two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus()); two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus());
if (repeatList.get(two.getDefectLevel()) != null) { if (repeatList.get(two.getDefectLevel()) != null) {
two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum()); two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum());
two.setHappenRatio(two.getHappenNum() / Double.valueOf(total)); two.setRepeatRatio(two.getHappenNum() / (double) totalRepeat);
two.setRepeatRatio(two.getHappenNum() / Double.valueOf(totalRepeat)); }
if(sums.containsKey(two.getDefectLevel())){
two.setHappenSumNum(sums.get(two.getDefectLevel()).getSum());
two.setHappenRatio(two.getHappenSumNum() / (double) total);
} }
OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO();
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus());
if (repeatList.get(three.getDefectLevel()) != null) { if (repeatList.get(three.getDefectLevel()) != null) {
three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum()); three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum());
three.setHappenRatio(three.getHappenNum() / Double.valueOf(total)); three.setRepeatRatio(three.getHappenNum() / (double) totalRepeat);
three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat)); }
if(sums.containsKey(three.getDefectLevel())){
three.setHappenSumNum(sums.get(three.getDefectLevel()).getSum());
three.setHappenRatio(three.getHappenSumNum() / (double) total);
} }
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio()).repeatRatio(1.00).build(); OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenSumNum(one.getHappenSumNum() + two.getHappenSumNum() + three.getHappenSumNum()).happenRatio(1.0).repeatRatio(1.00).build();
if (addUp.getHappenNum().equals(0L)) { if (addUp.getHappenNum().equals(0L)) {
addUp.setRepeatRatio(0.0); addUp.setRepeatRatio(0.0);
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectWrapper.java

@ -35,8 +35,8 @@ public class OperDefectWrapper extends BaseEntityWrapper<OperDefectEntity, OperD
OperDefectVO vo = BeanUtil.copy(entity, OperDefectVO.class); OperDefectVO vo = BeanUtil.copy(entity, OperDefectVO.class);
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser == null ? "" : createUser.getName()); vo.setCreateUserName(createUser == null ? "" : createUser.getRealName());
vo.setUpdateUserName(updateUser == null ? "" : updateUser.getName()); vo.setUpdateUserName(updateUser == null ? "" : updateUser.getRealName());
OperPhenomenonEntity phenomenonEntity = phenomenonService.getOne(Wrappers.<OperPhenomenonEntity>lambdaUpdate() OperPhenomenonEntity phenomenonEntity = phenomenonService.getOne(Wrappers.<OperPhenomenonEntity>lambdaUpdate()
.eq(OperPhenomenonEntity::getDefectCode,entity.getDefectCode()).last("limit 1")); .eq(OperPhenomenonEntity::getDefectCode,entity.getDefectCode()).last("limit 1"));
if(Func.isNotEmpty(phenomenonEntity)){ if(Func.isNotEmpty(phenomenonEntity)){

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperFaultWrapper.java

@ -40,8 +40,8 @@ public class OperFaultWrapper extends BaseEntityWrapper<OperFaultEntity, OperFau
OperFaultVO vo = BeanUtil.copy(entity, OperFaultVO.class); OperFaultVO vo = BeanUtil.copy(entity, OperFaultVO.class);
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser == null ? "" : createUser.getName()); vo.setCreateUserName(createUser == null ? "" : createUser.getRealName());
vo.setUpdateUserName(updateUser == null ? "" : updateUser.getName()); vo.setUpdateUserName(updateUser == null ? "" : updateUser.getRealName());
if(Func.isNotEmpty(entity.getSafeInfos())){ if(Func.isNotEmpty(entity.getSafeInfos())){
vo.setDangerSources(sourceClient.details(entity.getSafeInfos().split(","))); vo.setDangerSources(sourceClient.details(entity.getSafeInfos().split(",")));
} }

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperPhenomenonWrapper.java

@ -56,20 +56,20 @@ public class OperPhenomenonWrapper extends BaseEntityWrapper<OperPhenomenonEntit
OperPhenomenonVO vo = BeanUtil.copy(entity, OperPhenomenonVO.class); OperPhenomenonVO vo = BeanUtil.copy(entity, OperPhenomenonVO.class);
User createUser = UserCache.getUser(entity.getCreateUser()); User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser == null ? "" : createUser.getName()); vo.setCreateUserName(createUser == null ? "" : createUser.getRealName());
vo.setUpdateUserName(updateUser == null ? "" : updateUser.getName()); vo.setUpdateUserName(updateUser == null ? "" : updateUser.getRealName());
User userC = UserCache.getUser(entity.getConclusionPeople()); User userC = UserCache.getUser(entity.getConclusionPeople());
vo.setConclusionPeopleName(userC == null ? "" : userC.getName()); vo.setConclusionPeopleName(userC == null ? "" : userC.getRealName());
User userF = UserCache.getUser(entity.getFinder()); User userF = UserCache.getUser(entity.getFinder());
vo.setFinderName(userF == null ? "" : userF.getName()); vo.setFinderName(userF == null ? "" : userF.getRealName());
User userD = UserCache.getUser(entity.getDiscriminator()); User userD = UserCache.getUser(entity.getDiscriminator());
vo.setDiscriminatorName(userD == null ? "" : userD.getName()); vo.setDiscriminatorName(userD == null ? "" : userD.getRealName());
User userHn = UserCache.getUser(entity.getHandler()); User userHn = UserCache.getUser(entity.getHandler());
vo.setHandlerName(userHn == null ? "" : userHn.getName()); vo.setHandlerName(userHn == null ? "" : userHn.getRealName());
if(Func.isNotEmpty(entity.getSafeInfos())){ if(Func.isNotEmpty(entity.getSafeInfos())){
vo.setDangerSources(sourceClient.details(entity.getSafeInfos().split(","))); vo.setDangerSources(sourceClient.details(entity.getSafeInfos().split(",")));
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/feign/DutyGroupClient.java

@ -47,7 +47,7 @@ public class DutyGroupClient implements IDutyGroupClient {
if(CollectionUtil.isEmpty(persons)){ if(CollectionUtil.isEmpty(persons)){
return group; return group;
} }
List<String> personNames = persons.stream().filter(o-> !charge.equals(o.getPersonId())).map(o-> UserCache.getUser(o.getPersonId()).getName()).collect(Collectors.toList()); List<String> personNames = persons.stream().filter(o-> !charge.equals(o.getPersonId())).map(o-> UserCache.getUser(o.getPersonId()).getRealName()).collect(Collectors.toList());
if(CollectionUtil.isEmpty(personNames)){ if(CollectionUtil.isEmpty(personNames)){
group.setRepairPersonnelSum(0); group.setRepairPersonnelSum(0);
return group; return group;

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyClassMapper.java

@ -34,6 +34,7 @@ public interface ImsDutyClassMapper extends UserDataScopeBaseMapper<ImsDutyClass
String getClassTypeIds(@Param("createDept") Long createDept,@Param("classTypeId") Long classTypeId); String getClassTypeIds(@Param("createDept") Long createDept,@Param("classTypeId") Long classTypeId);
@UserDataAuth
List<DutyClassTypeTree> getDutyClassTree(@Param("deptId")Long deptId); List<DutyClassTypeTree> getDutyClassTree(@Param("deptId")Long deptId);
List<DutyClassTypeTree> getDutyClassByType(@Param("class_type_id") Long classTypeId); List<DutyClassTypeTree> getDutyClassByType(@Param("class_type_id") Long classTypeId);

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyChangeServiceImpl.java

@ -120,10 +120,10 @@ public class ImsDutyChangeServiceImpl extends BaseServiceImpl<ImsDutyChangeMappe
ImsDutyChangeVO vo = ImsDutyChangeWrapper.build().entityVO(detail); ImsDutyChangeVO vo = ImsDutyChangeWrapper.build().entityVO(detail);
try { try {
log.info(detail.getCreateUser() + ".............."); log.info(detail.getCreateUser() + "..............");
vo.setCreateUserName(UserCache.getUser(detail.getCreateUser()).getName()); vo.setCreateUserName(UserCache.getUser(detail.getCreateUser()).getRealName());
vo.setUpdateUserName(UserCache.getUser(detail.getUpdateUser()).getName()); vo.setUpdateUserName(UserCache.getUser(detail.getUpdateUser()).getRealName());
vo.setAcceptPersonName(UserCache.getUser(detail.getAcceptPersonId()).getName()); vo.setAcceptPersonName(UserCache.getUser(detail.getAcceptPersonId()).getRealName());
vo.setApplyPersonName(UserCache.getUser(detail.getApplyPersonId()).getName()); vo.setApplyPersonName(UserCache.getUser(detail.getApplyPersonId()).getRealName());
ImsSchedulingVo imsSchedulingVo1 = dutyMainService.getByIdOneV2(detail.getAcceptDutyId()); ImsSchedulingVo imsSchedulingVo1 = dutyMainService.getByIdOneV2(detail.getAcceptDutyId());
vo.setAcceptDutyMainVo(imsSchedulingVo1); vo.setAcceptDutyMainVo(imsSchedulingVo1);
ImsSchedulingVo imsSchedulingVo = dutyMainService.getByIdOneV2(detail.getApplyDutyId()); ImsSchedulingVo imsSchedulingVo = dutyMainService.getByIdOneV2(detail.getApplyDutyId());

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java

@ -81,11 +81,11 @@ public class ImsDutyEmergencyServiceImpl extends BaseServiceImpl<ImsDutyEmergenc
collect= records.stream().map(sig -> { collect= records.stream().map(sig -> {
R<User> user = userClient.userInfoById(sig.getRegistrant()); R<User> user = userClient.userInfoById(sig.getRegistrant());
if (user.isSuccess()&&ObjectUtils.isNotEmpty(user.getData())){ if (user.isSuccess()&&ObjectUtils.isNotEmpty(user.getData())){
sig.setRegistrantName(user.getData().getName()); sig.setRegistrantName(user.getData().getRealName());
} }
R<User> userR = userClient.userInfoById(sig.getChargePerson()); R<User> userR = userClient.userInfoById(sig.getChargePerson());
if (userR.isSuccess()&&ObjectUtils.isNotEmpty(userR.getData())){ if (userR.isSuccess()&&ObjectUtils.isNotEmpty(userR.getData())){
sig.setChargePersonName(userR.getData().getName()); sig.setChargePersonName(userR.getData().getRealName());
} }
ImsDutyClassEntity classEntity = imsDutyClassService.getById(sig.getDutyClass()); ImsDutyClassEntity classEntity = imsDutyClassService.getById(sig.getDutyClass());
sig.setDutyClassName(classEntity.getClassName()); sig.setDutyClassName(classEntity.getClassName());

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java

@ -166,8 +166,8 @@ public class ImsDutyGroupServiceImpl extends BaseServiceImpl<ImsDutyGroupMapper,
imsDutyGroupVO.setId(entity.getId()); imsDutyGroupVO.setId(entity.getId());
imsDutyGroupVO.setManagerId(entity.getManagerId()); imsDutyGroupVO.setManagerId(entity.getManagerId());
User user = UserCache.getUser(entity.getManagerId()); User user = UserCache.getUser(entity.getManagerId());
if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getName())){ if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getRealName())){
imsDutyGroupVO.setManagerName(user.getName()); imsDutyGroupVO.setManagerName(user.getRealName());
} }
List<ImsDutyGroupPVO> imsDutyGroupPVOS = imsDutyGroupPService.listByGroupId(entity.getId()); List<ImsDutyGroupPVO> imsDutyGroupPVOS = imsDutyGroupPService.listByGroupId(entity.getId());
if (CollectionUtil.isNotEmpty(imsDutyGroupPVOS)){ if (CollectionUtil.isNotEmpty(imsDutyGroupPVOS)){
@ -247,8 +247,8 @@ public class ImsDutyGroupServiceImpl extends BaseServiceImpl<ImsDutyGroupMapper,
for (ImsDutyGroupPVO imsDutyGroupPVo : imsDutyGroupPEntities) { for (ImsDutyGroupPVO imsDutyGroupPVo : imsDutyGroupPEntities) {
imsDutyGroupPVo.setSignage(false); imsDutyGroupPVo.setSignage(false);
User user = UserCache.getUser(imsDutyGroupPVo.getPersonId()); User user = UserCache.getUser(imsDutyGroupPVo.getPersonId());
if (ObjectUtil.isNotEmpty(user) && Func.isNotBlank(user.getName())) { if (ObjectUtil.isNotEmpty(user) && Func.isNotBlank(user.getRealName())) {
imsDutyGroupPVo.setGroupName(user.getName()); imsDutyGroupPVo.setGroupName(user.getRealName());
} else { } else {
groupIds.add(imsDutyGroupPVo.getId().toString()); groupIds.add(imsDutyGroupPVo.getId().toString());
this.baseMapper.updateManagerIdById(imsDutyGroupPVo.getGroupId()); this.baseMapper.updateManagerIdById(imsDutyGroupPVo.getGroupId());

28
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -809,9 +809,9 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
User user = UserCache.getUser(Long.valueOf(split[j])); User user = UserCache.getUser(Long.valueOf(split[j]));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
if (j == split.length - 1) { if (j == split.length - 1) {
s.setName(s.getName() + user.getName()); s.setName(s.getName() + user.getRealName());
} else { } else {
s.setName(s.getName() + user.getName() + "、"); s.setName(s.getName() + user.getRealName() + "、");
} }
} }
} }
@ -868,7 +868,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
vo.setUserId(s); vo.setUserId(s);
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
vo.setUserName(user.getName()); vo.setUserName(user.getRealName());
} }
vo.setId(id); vo.setId(id);
list.add(vo); list.add(vo);
@ -894,8 +894,8 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
R<User> user = userClient.userInfoById(Long.valueOf(s)); R<User> user = userClient.userInfoById(Long.valueOf(s));
if (user.isSuccess() && ObjectUtil.isNotEmpty(user.getData())) { if (user.isSuccess() && ObjectUtil.isNotEmpty(user.getData())) {
vo.setUserId(s); vo.setUserId(s);
if (ObjectUtil.isNotEmpty(user.getData().getName())) { if (ObjectUtil.isNotEmpty(user.getData().getRealName())) {
vo.setUserName(user.getData().getName()); vo.setUserName(user.getData().getRealName());
} }
vo.setId(id); vo.setId(id);
list.add(vo); list.add(vo);
@ -1083,7 +1083,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
dutyReportVO.setGroupName(imsDutyGroupEntity.getGroupName()); dutyReportVO.setGroupName(imsDutyGroupEntity.getGroupName());
User user = UserCache.getUser(imsDutyGroupEntity.getManagerId()); User user = UserCache.getUser(imsDutyGroupEntity.getManagerId());
if (ObjectUtil.isNotEmpty(user)){ if (ObjectUtil.isNotEmpty(user)){
dutyReportVO.setManagerName(user.getName()); dutyReportVO.setManagerName(user.getRealName());
} }
dutyReportVO.setDutyNum(v.size()); dutyReportVO.setDutyNum(v.size());
//获取值班ID //获取值班ID
@ -1264,7 +1264,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
} }
User managerUser = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId())); User managerUser = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId()));
if (ObjectUtil.isNotEmpty(managerUser)) { if (ObjectUtil.isNotEmpty(managerUser)) {
dutyMainInfoVo.setManagerName(managerUser.getName()); dutyMainInfoVo.setManagerName(managerUser.getRealName());
dutyMainInfoVo.setManagerPhone(managerUser.getPhone()); dutyMainInfoVo.setManagerPhone(managerUser.getPhone());
} }
@ -1294,7 +1294,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
vo.setCorryInfo(corryVo); vo.setCorryInfo(corryVo);
User carryManagerUser = UserCache.getUser(Long.valueOf(corryVo.getManagerId())); User carryManagerUser = UserCache.getUser(Long.valueOf(corryVo.getManagerId()));
if (ObjectUtil.isNotEmpty(carryManagerUser)) { if (ObjectUtil.isNotEmpty(carryManagerUser)) {
corryVo.setManagerName(carryManagerUser.getName()); corryVo.setManagerName(carryManagerUser.getRealName());
corryVo.setManagerPhone(carryManagerUser.getPhone()); corryVo.setManagerPhone(carryManagerUser.getPhone());
} }
} }
@ -1359,7 +1359,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(item.getManagerId())); User user = UserCache.getUser(Long.valueOf(item.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
item.setManagerName(user.getName()); item.setManagerName(user.getRealName());
item.setManagerPhone(user.getPhone()); item.setManagerPhone(user.getPhone());
} }
// FIXME 上网 // FIXME 上网
@ -1657,9 +1657,9 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
User user = restUserList.get(j); User user = restUserList.get(j);
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
if (j == restUserList.size() - 1) { if (j == restUserList.size() - 1) {
personNames += user.getName(); personNames += user.getRealName();
} else { } else {
personNames += user.getName() + "、"; personNames += user.getRealName() + "、";
} }
} }
} }
@ -1732,7 +1732,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId())); User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
dutyInfoVo.setManagerName(user.getName()); dutyInfoVo.setManagerName(user.getRealName());
dutyInfoVo.setManagerPhone(user.getPhone()); dutyInfoVo.setManagerPhone(user.getPhone());
} }
// 发电量 // 发电量
@ -1758,7 +1758,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId())); User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
dutyInfoVo.setManagerName(user.getName()); dutyInfoVo.setManagerName(user.getRealName());
dutyInfoVo.setManagerPhone(user.getPhone()); dutyInfoVo.setManagerPhone(user.getPhone());
} }
dutyInfoVo.setGeneratingCapacity(0); dutyInfoVo.setGeneratingCapacity(0);
@ -1771,7 +1771,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
AuditVo auditVo = new AuditVo(); AuditVo auditVo = new AuditVo();
auditVo.setPersonId(personId); auditVo.setPersonId(personId);
auditVo.setPersonName(user.getName()); auditVo.setPersonName(user.getRealName());
auditVo.setPhone(user.getPhone()); auditVo.setPhone(user.getPhone());
return auditVo; return auditVo;
} }

22
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -342,8 +342,8 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
String userName = ""; String userName = "";
PushExtrasReq req = new PushExtrasReq(); PushExtrasReq req = new PushExtrasReq();
log.info("--------------------------req:" + req, groupEntityManagerId, userName, date); log.info("--------------------------req:" + req, groupEntityManagerId, userName, date);
if (ObjectUtil.isNotEmpty(userR.getData()) && StringUtil.isNotBlank(userR.getData().getName())) { if (ObjectUtil.isNotEmpty(userR.getData()) && StringUtil.isNotBlank(userR.getData().getRealName())) {
userName = userR.getData().getName(); userName = userR.getData().getRealName();
log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date); log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date);
} }
String format = DateUtil.format(date, PATTERN_DATETIME); String format = DateUtil.format(date, PATTERN_DATETIME);
@ -552,11 +552,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
} }
ImsSchedulingVo imsSchedulingVo = imsDutyMainServiceImpl.getByIdOneV2(entity.getId(), null);//交班人 ImsSchedulingVo imsSchedulingVo = imsDutyMainServiceImpl.getByIdOneV2(entity.getId(), null);//交班人
if (ObjectUtil.isNotEmpty(imsSchedulingVo)&&null != imsSchedulingVo.getManagerId()) { if (ObjectUtil.isNotEmpty(imsSchedulingVo)&&null != imsSchedulingVo.getManagerId()) {
imsSchedulingVo.setUserName(userClient.userInfoById(imsSchedulingVo.getManagerId()).getData().getName()); imsSchedulingVo.setUserName(userClient.userInfoById(imsSchedulingVo.getManagerId()).getData().getRealName());
} }
ImsSchedulingVo imsSchedulingVo1 = imsDutyMainServiceImpl.getByIdOneV2(null, entity.getId()); ImsSchedulingVo imsSchedulingVo1 = imsDutyMainServiceImpl.getByIdOneV2(null, entity.getId());
if (ObjectUtil.isNotEmpty(imsSchedulingVo1)&&null != imsSchedulingVo1.getManagerId()) { if (ObjectUtil.isNotEmpty(imsSchedulingVo1)&&null != imsSchedulingVo1.getManagerId()) {
imsSchedulingVo1.setUserName(userClient.userInfoById(imsSchedulingVo1.getManagerId()).getData().getName()); imsSchedulingVo1.setUserName(userClient.userInfoById(imsSchedulingVo1.getManagerId()).getData().getRealName());
}else { }else {
throw new ServiceException("没有找到接班对象值班信息,请联系管理人员,尽快进行排班!!!!"); throw new ServiceException("没有找到接班对象值班信息,请联系管理人员,尽快进行排班!!!!");
} }
@ -773,7 +773,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (ObjectUtil.isNotEmpty(groupEntityManagerId) && ObjectUtil.isNotEmpty(classEntity)) { if (ObjectUtil.isNotEmpty(groupEntityManagerId) && ObjectUtil.isNotEmpty(classEntity)) {
String userName = ""; String userName = "";
if (null != groupEntityManagerId) { if (null != groupEntityManagerId) {
userName = userClient.userInfoById(groupEntityManagerId).getData().getName(); userName = userClient.userInfoById(groupEntityManagerId).getData().getRealName();
} }
PushExtrasReq req = new PushExtrasReq(); PushExtrasReq req = new PushExtrasReq();
if (null != entity.getPreDutyId()) { if (null != entity.getPreDutyId()) {
@ -834,7 +834,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
} }
} }
} }
remondingCarryV2(carryMainentity.getDutyDate(),2, carryManagerId, user.getData().getName(), classEntity, null, carryTenantId, carryCreateDept, carryMainentity.getId(), carryMainentity.getCreateUser());//提醒接班人 remondingCarryV2(carryMainentity.getDutyDate(),2, carryManagerId, user.getData().getRealName(), classEntity, null, carryTenantId, carryCreateDept, carryMainentity.getId(), carryMainentity.getCreateUser());//提醒接班人
} }
} }
} }
@ -1157,7 +1157,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
messagePushRecordDto.setTaskId(taskId); messagePushRecordDto.setTaskId(taskId);
messagePushRecordDto.setTenantId(tenantId); messagePushRecordDto.setTenantId(tenantId);
messagePushRecordDto.setPusher(admin.getId().toString()); messagePushRecordDto.setPusher(admin.getId().toString());
messagePushRecordDto.setPusherName(admin.getName()); messagePushRecordDto.setPusherName(admin.getRealName());
messagePushRecordDto.setAccount(admin.getId().toString()); messagePushRecordDto.setAccount(admin.getId().toString());
messagePushRecordDto.setContent(" 负责人"+userName + datyTime+ "("+classEntity.getStartTime() messagePushRecordDto.setContent(" 负责人"+userName + datyTime+ "("+classEntity.getStartTime()
+ "-" + classEntity.getEndTime()+")"+" 的值班,目前已交班延迟,请尽快联系该负责人进行交班工作!"); + "-" + classEntity.getEndTime()+")"+" 的值班,目前已交班延迟,请尽快联系该负责人进行交班工作!");
@ -1620,7 +1620,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(dutyGroupId); ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(dutyGroupId);
User manager = UserCache.getUser(groupEntity.getManagerId()); User manager = UserCache.getUser(groupEntity.getManagerId());
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){ if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){
managerName=manager.getName(); managerName=manager.getRealName();
} }
}else { }else {
ImsDutyMainPersonEntity dutyMainPerson = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity dutyMainPerson = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
@ -1629,7 +1629,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}}); }});
User manager = UserCache.getUser(dutyMainPerson.getDutyChargePerson()); User manager = UserCache.getUser(dutyMainPerson.getDutyChargePerson());
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){ if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){
managerName=manager.getName(); managerName=manager.getRealName();
} }
} }
return managerName; return managerName;
@ -1643,9 +1643,9 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
User user = UserCache.getUser(Long.valueOf(split[j])); User user = UserCache.getUser(Long.valueOf(split[j]));
if (org.springblade.core.tool.utils.ObjectUtil.isNotEmpty(user)) { if (org.springblade.core.tool.utils.ObjectUtil.isNotEmpty(user)) {
if (j == split.length - 1) { if (j == split.length - 1) {
handNumber= handNumber + user.getName(); handNumber= handNumber + user.getRealName();
} else { } else {
handNumber= handNumber + user.getName()+ "、"; handNumber= handNumber + user.getRealName()+ "、";
} }
} }
} }

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/OverConfigController.java

@ -7,6 +7,7 @@ import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.fill.entity.OverConfigEntity; import com.hnac.hzims.operational.fill.entity.OverConfigEntity;
import com.hnac.hzims.operational.fill.service.OverConfigService; import com.hnac.hzims.operational.fill.service.OverConfigService;
import com.hnac.hzims.operational.fill.service.OverDetailsService;
import com.hnac.hzims.operational.fill.vo.OverConfigVo; import com.hnac.hzims.operational.fill.vo.OverConfigVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -30,6 +31,8 @@ public class OverConfigController extends BladeController {
private final OverConfigService service; private final OverConfigService service;
private final OverDetailsService detailsService;
/** /**
* 新增 * 新增
*/ */
@ -47,7 +50,7 @@ public class OverConfigController extends BladeController {
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "逻辑删除", notes = "传入id字符串以逗号分隔") @ApiOperation(value = "逻辑删除", notes = "传入id字符串以逗号分隔")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(service.deleteLogic(Func.toLongList(ids))); return R.status(detailsService.clear(Func.toLongList(ids)));
} }
/** /**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverConfigService.java

@ -8,6 +8,8 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.util.List;
/** /**
* 检修配置接口 * 检修配置接口
*/ */
@ -18,4 +20,5 @@ public interface OverConfigService extends BaseService<OverConfigEntity> {
int getSort(); int getSort();
boolean checkOverName(String overName); boolean checkOverName(String overName);
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/OverDetailsService.java

@ -16,4 +16,6 @@ import java.util.List;
public interface OverDetailsService extends BaseService<OverDetailsEntity> { public interface OverDetailsService extends BaseService<OverDetailsEntity> {
R<IPage<OverDetailsVo>> pageCondition(OverDetailsVo vo, Query query); R<IPage<OverDetailsVo>> pageCondition(OverDetailsVo vo, Query query);
boolean clear(List<Long> longList);
} }

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverConfigServiceImpl.java

@ -6,7 +6,6 @@ import com.hnac.hzims.operational.fill.entity.OverConfigEntity;
import com.hnac.hzims.operational.fill.mapper.OverConfigMapper; import com.hnac.hzims.operational.fill.mapper.OverConfigMapper;
import com.hnac.hzims.operational.fill.service.OverConfigService; import com.hnac.hzims.operational.fill.service.OverConfigService;
import com.hnac.hzims.operational.fill.vo.OverConfigVo; import com.hnac.hzims.operational.fill.vo.OverConfigVo;
import com.hnac.hzims.operational.fill.wrapper.OtherWrapper;
import com.hnac.hzims.operational.fill.wrapper.OverConfigWrapper; import com.hnac.hzims.operational.fill.wrapper.OverConfigWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/OverDetailsServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.OverConfigEntity; import com.hnac.hzims.operational.fill.entity.OverConfigEntity;
import com.hnac.hzims.operational.fill.entity.OverDetailsEntity; import com.hnac.hzims.operational.fill.entity.OverDetailsEntity;
import com.hnac.hzims.operational.fill.mapper.OverDetailsMapper; import com.hnac.hzims.operational.fill.mapper.OverDetailsMapper;
@ -11,10 +12,12 @@ import com.hnac.hzims.operational.fill.vo.OverDetailsVo;
import com.hnac.hzims.operational.fill.wrapper.OverDetailsWrapper; import com.hnac.hzims.operational.fill.wrapper.OverDetailsWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -56,4 +59,16 @@ public class OverDetailsServiceImpl extends BaseServiceImpl<OverDetailsMapper, O
return R.data(pages.setRecords(list)); return R.data(pages.setRecords(list));
} }
@Override
public boolean clear(List<Long> ids) {
List<OverDetailsEntity> details = this.list(Wrappers.<OverDetailsEntity>lambdaQuery()
.in(OverDetailsEntity::getOverConfigId,ids)
.eq(OverDetailsEntity::getIsDeleted,0)
);
if(CollectionUtil.isNotEmpty(details)){
throw new ServiceException("该检修卡分类已在检修填报数据中引用,无法删除!");
}
return this.configService.deleteLogic(ids);
}
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/GenerateWrapper.java

@ -29,7 +29,7 @@ public class GenerateWrapper extends BaseEntityWrapper<GenerateEntity, GenerateV
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OtherWrapper.java

@ -25,7 +25,7 @@ public class OtherWrapper extends BaseEntityWrapper<OtherEntity, OtherVo> {
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
vo.setAscriptionUser(entity.getCreateUser()); vo.setAscriptionUser(entity.getCreateUser());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OverConfigWrapper.java

@ -25,7 +25,7 @@ public class OverConfigWrapper extends BaseEntityWrapper<OverConfigEntity, OverC
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(createUser.getName()); vo.setUserName(createUser.getRealName());
vo.setAscriptionUser(entity.getCreateUser()); vo.setAscriptionUser(entity.getCreateUser());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OverDetailsWrapper.java

@ -25,7 +25,7 @@ public class OverDetailsWrapper extends BaseEntityWrapper<OverDetailsEntity, Ove
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
vo.setAscriptionUser(entity.getCreateUser()); vo.setAscriptionUser(entity.getCreateUser());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/OverWrapper.java

@ -25,7 +25,7 @@ public class OverWrapper extends BaseEntityWrapper<OverEntity, OverVo> {
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
vo.setAscriptionUser(entity.getCreateUser()); vo.setAscriptionUser(entity.getCreateUser());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/PowerWrapper.java

@ -25,7 +25,7 @@ public class PowerWrapper extends BaseEntityWrapper<PowerEntity, PowerVo> {
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
vo.setAscriptionUser(entity.getCreateUser()); vo.setAscriptionUser(entity.getCreateUser());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/RainfallWrapper.java

@ -29,7 +29,7 @@ public class RainfallWrapper extends BaseEntityWrapper<RainfallEntity, RainfallV
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/SolveWrapper.java

@ -25,7 +25,7 @@ public class SolveWrapper extends BaseEntityWrapper<SolveEntity, SolveVo> {
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
vo.setAscriptionUser(entity.getCreateUser()); vo.setAscriptionUser(entity.getCreateUser());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/StorageWrapper.java

@ -29,7 +29,7 @@ public class StorageWrapper extends BaseEntityWrapper<StorageEntity, StorageVo>
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/UseWrapper.java

@ -29,7 +29,7 @@ public class UseWrapper extends BaseEntityWrapper<UseEntity, UseVo> {
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(Optional.ofNullable(createUser.getName()).orElse(null)); vo.setUserName(createUser.getRealName());
return vo; return vo;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java

@ -25,7 +25,7 @@ public class WindWrapper extends BaseEntityWrapper<WindEntity, WindVo> {
return vo; return vo;
} }
assert vo != null; assert vo != null;
vo.setUserName(createUser.getName()); vo.setUserName(createUser.getRealName());
return vo; return vo;
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/BusinessFileDto.java

@ -2,7 +2,6 @@ package com.hnac.hzims.operational.main.dto;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -25,7 +24,7 @@ public class BusinessFileDto {
private int operAccessTaskEntityCount; private int operAccessTaskEntityCount;
@ApiModelProperty(value = "消缺单") @ApiModelProperty(value = "消缺单")
private List<MainOperPhenomenonVo> operPhenomenonEntityList; private List<OperPhenomenonEntity> operPhenomenonEntityList;
@ApiModelProperty(value = "日常维护") @ApiModelProperty(value = "日常维护")
private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList; private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/ScanDto.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.main.dto;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -30,7 +31,7 @@ public class ScanDto {
private int emInfoEntityCount; private int emInfoEntityCount;
@ApiModelProperty(value = "消缺单") @ApiModelProperty(value = "消缺单")
private List<OperDefectEntity> operDefectEntityList; private List<OperPhenomenonEntity> operDefectEntityList;
@ApiModelProperty(value = "日常维护") @ApiModelProperty(value = "日常维护")
private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList; private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList;

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -1860,7 +1860,7 @@ public class HydropowerServiceImpl implements HydropowerService {
if (ObjectUtil.isEmpty(user)) { if (ObjectUtil.isEmpty(user)) {
return ""; return "";
} }
return user.getName(); return user.getRealName();
} }
/** /**
@ -1883,7 +1883,7 @@ public class HydropowerServiceImpl implements HydropowerService {
if (ObjectUtil.isEmpty(user)) { if (ObjectUtil.isEmpty(user)) {
continue; continue;
} }
builder.append(user.getName()).append(","); builder.append(user.getRealName()).append(",");
} }
if(builder.length() <= 0){ if(builder.length() <= 0){
return ""; return "";

162
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/ScanServiceImpl.java

@ -4,37 +4,27 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.monitor.feign.IMonitorClient; import com.hnac.hzims.monitor.feign.IMonitorClient;
import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperDefectService; import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo;
import com.hnac.hzims.operational.main.dto.BusinessFileDto; import com.hnac.hzims.operational.main.dto.BusinessFileDto;
import com.hnac.hzims.operational.main.dto.ScanDto; import com.hnac.hzims.operational.main.dto.ScanDto;
import com.hnac.hzims.operational.main.service.IScanService; import com.hnac.hzims.operational.main.service.IScanService;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
@Slf4j @Slf4j
@ -59,16 +49,12 @@ public class ScanServiceImpl implements IScanService {
@Override @Override
public ScanDto getData(String emCode) { public ScanDto getData(String emCode) {
ScanDto scanDto = new ScanDto(); ScanDto scanDto = new ScanDto();
//日常维护任务 //日常维护任务
List<OperMaintenanceTaskEntity> maintenanceTaskEntityList = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ List<OperMaintenanceTaskEntity> maintenanceTaskEntityList = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
and(o -> o.eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_1). eq(OperMaintenanceTaskEntity::getEmCode, emCode);
or().eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_2). ne(OperMaintenanceTaskEntity::getFlowTaskName,"结束");
or().eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_3).
or().eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_4));
orderByDesc(OperMaintenanceTaskEntity::getCreateTime); orderByDesc(OperMaintenanceTaskEntity::getCreateTime);
eq(OperMaintenanceTaskEntity::getEmCode,emCode);
}}); }});
if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){ if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){
scanDto.setOperMaintenanceTaskEntityCount(maintenanceTaskEntityList.size()); scanDto.setOperMaintenanceTaskEntityCount(maintenanceTaskEntityList.size());
@ -76,130 +62,25 @@ public class ScanServiceImpl implements IScanService {
} }
//检修任务 //检修任务
List<OperAccessTaskEntity> accessTaskEntityList = accessTaskService.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{ List<OperAccessTaskEntity> accessTaskEntityList = accessTaskService.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
and(o -> o.eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_1). eq(OperAccessTaskEntity::getEmCode, emCode);
or().eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_2). ne(OperAccessTaskEntity::getStatus, 4);
or().eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_3));
orderByDesc(OperAccessTaskEntity::getCreateTime); orderByDesc(OperAccessTaskEntity::getCreateTime);
eq(OperAccessTaskEntity::getEmCode,emCode);
}}); }});
if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){ if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){
scanDto.setOperAccessTaskEntityCount(accessTaskEntityList.size()); scanDto.setOperAccessTaskEntityCount(accessTaskEntityList.size());
scanDto.setOperAccessTaskEntityList(accessTaskEntityList); scanDto.setOperAccessTaskEntityList(accessTaskEntityList);
} }
//消缺单 //消缺单
List<OperDefectEntity> defectList = defectService.getDefectByEmCodeList(emCode); List<OperPhenomenonEntity> phenomenons = phenomenonService.list(new LambdaQueryWrapper<OperPhenomenonEntity>(){{
if (CollectionUtil.isNotEmpty(defectList)) { eq(OperPhenomenonEntity::getEmCode,emCode);
scanDto.setOperDefectEntityCount(defectList.size()); isNull(OperPhenomenonEntity::getHandleTaskId);
scanDto.setOperDefectEntityList(defectList); orderByDesc(OperPhenomenonEntity::getCreateTime);
} }});
if (CollectionUtil.isNotEmpty(phenomenons)) {
scanDto.setOperDefectEntityCount(phenomenons.size());
/*List<String> defectList = new ArrayList<>(); scanDto.setOperDefectEntityList(phenomenons);
List<String> maintenanceList = new ArrayList<>();
List<String> accesss = new ArrayList<>();
Date date = new Date();
log.info("--------------------开始时间--------:"+ DateUtil.format(date,DateUtil.PATTERN_DATETIME));
R<BladePage> defectAll = flowClient.todoList(CATEGORY_ID, null, 1, 9999);
if (defectAll.isSuccess()) {
BladePage data = defectAll.getData();
if (ObjectUtil.isNotEmpty(data) && CollectionUtil.isNotEmpty(data.getRecords())) {
List<Map> records = defectAll.getData().getRecords();
for (Map defect : records) {
if (defect.get("processDefinitionName").equals("巡检问题处理流程")) {
defectList.add(defect.get("businessId").toString());
} else if (defect.get("processDefinitionName").equals("日常维护流程")) {
maintenanceList.add(defect.get("businessId").toString());
} else if (defect.get("processDefinitionName").equals("检修任务执行流程")) {
accesss.add(defect.get("businessId").toString());
}
}
}
}
//消缺单
if (CollectionUtil.isNotEmpty(defectList)) {
List<OperDefectEntity> defectList1 = defectService.getDefectList(emCode, defectList);
if (CollectionUtil.isNotEmpty(defectList1)) {
scanDto.setOperDefectEntityCount(defectList1.size());
scanDto.setOperDefectEntityList(defectList1);
}
}
//日常维护任务
if (CollectionUtil.isNotEmpty(maintenanceList)) {
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntities = maintenanceTaskService.getByEmCode(emCode, maintenanceList);
if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntities)) {
scanDto.setOperMaintenanceTaskEntityCount(operMaintenanceTaskEntities.size());
scanDto.setOperMaintenanceTaskEntityList(operMaintenanceTaskEntities);
}
}
//检修任务
if (CollectionUtil.isNotEmpty(accesss)) {
List<OperAccessTaskEntity> operAccessTaskEntities = accessTaskService.getByEmCode(emCode, accesss);
if (CollectionUtil.isNotEmpty(operAccessTaskEntities)) {
scanDto.setOperAccessTaskEntityCount(operAccessTaskEntities.size());
scanDto.setOperAccessTaskEntityList(operAccessTaskEntities);
}
}*/
/*//消缺单
R<BladePage> defectBladePageR = flowClient.todoList(CATEGORY_ID, "巡检问题处理流程", 1, 999);
log.info("defectBladePageR--------------------:" + defectBladePageR);
if (defectBladePageR.isSuccess()) {
List<Map> defects = defectBladePageR.getData().getRecords();
if (CollectionUtil.isNotEmpty(defects)) {
for (Map defect : defects) {
defectList.add(defect.get("businessId").toString());
}
if (CollectionUtil.isNotEmpty(defectList)) {
List<OperDefectEntity> defectList1 = defectService.getDefectList(emCode, defectList);
if (CollectionUtil.isNotEmpty(defectList1)) {
scanDto.setOperDefectEntityCount(defectList1.size());
scanDto.setOperDefectEntityList(defectList1);
}
}
}
}
//日常维护任务
R<BladePage> maintenanceBladePageR = flowClient.todoList(CATEGORY_ID, "日常维护流程", 1, 999);
List<Map> maintenances = maintenanceBladePageR.getData().getRecords();
if (CollectionUtil.isNotEmpty(maintenances)) {
for (Map maintenance : maintenances) {
log.info("------------------待办--------------------" + maintenance.get("businessId").toString());
maintenanceList.add(maintenance.get("businessId").toString());
}
if (CollectionUtil.isNotEmpty(maintenanceList)) {
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntities = maintenanceTaskService.getByEmCode(emCode, maintenanceList);
if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntities)) {
scanDto.setOperMaintenanceTaskEntityCount(operMaintenanceTaskEntities.size());
scanDto.setOperMaintenanceTaskEntityList(operMaintenanceTaskEntities);
}
}
} }
//检修任务
R<BladePage> accessBladePageR = flowClient.todoList(CATEGORY_ID, "检修任务执行流程", 1, 999);
List<Map> records = accessBladePageR.getData().getRecords();
if (CollectionUtil.isNotEmpty(records)) {
for (Map record : records) {
log.info("------------------待办--------------------" + record.get("businessId").toString());
accesss.add(record.get("businessId").toString());
}
if (CollectionUtil.isNotEmpty(accesss)) {
List<OperAccessTaskEntity> operAccessTaskEntities = accessTaskService.getByEmCode(emCode, accesss);
if (CollectionUtil.isNotEmpty(operAccessTaskEntities)) {
scanDto.setOperAccessTaskEntityCount(operAccessTaskEntities.size());
scanDto.setOperAccessTaskEntityList(operAccessTaskEntities);
}
}
}*/
return scanDto; return scanDto;
} }
@Override @Override
public ScanDto getRealDataTimeAndDeviceFile(String emCode){ public ScanDto getRealDataTimeAndDeviceFile(String emCode){
@ -233,7 +114,7 @@ public class ScanServiceImpl implements IScanService {
//日常维护任务 //日常维护任务
List<OperMaintenanceTaskEntity> list = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ List<OperMaintenanceTaskEntity> list = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
eq(OperMaintenanceTaskEntity::getEmCode, emCode); eq(OperMaintenanceTaskEntity::getEmCode, emCode);
eq(OperMaintenanceTaskEntity::getStatus, 5); eq(OperMaintenanceTaskEntity::getFlowTaskName, "结束");
}}); }});
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
dto.setOperMaintenanceTaskEntityCount(list.size()); dto.setOperMaintenanceTaskEntityCount(list.size());
@ -249,15 +130,14 @@ public class ScanServiceImpl implements IScanService {
dto.setOperAccessTaskEntityList(list1); dto.setOperAccessTaskEntityList(list1);
} }
//消缺单 //消缺单
/*List<OperPhenomenonEntity> list2 = phenomenonService.list(new LambdaQueryWrapper<OperPhenomenonEntity>() {{ List<OperPhenomenonEntity> phenomenons = phenomenonService.list(new LambdaQueryWrapper<OperPhenomenonEntity>(){{
eq(OperPhenomenonEntity::getEmCode, emCode); eq(OperPhenomenonEntity::getEmCode,emCode);
eq(OperPhenomenonEntity::getConclusionStatus, 1); isNotNull(OperPhenomenonEntity::getHandleTaskId);
}});*/ orderByDesc(OperPhenomenonEntity::getCreateTime);
}});
List<MainOperPhenomenonVo> listByStatus = phenomenonService.getListByStatus(emCode, DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()); if (CollectionUtil.isNotEmpty(phenomenons)) {
if (CollectionUtil.isNotEmpty(listByStatus)) { dto.setOperPhenomenonEntityList(phenomenons);
dto.setOperPhenomenonEntityCount(listByStatus.size()); dto.setOperPhenomenonEntityCount(phenomenons.size());
dto.setOperPhenomenonEntityList(listByStatus);
} }
return dto; return dto;

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

@ -236,6 +236,11 @@ public class WindHomeServiceImpl implements WindHomeService {
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(stations); Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(stations);
return areas.entrySet().stream().map(entry -> { return areas.entrySet().stream().map(entry -> {
WindSubordinateVo subordinate = new WindSubordinateVo(); WindSubordinateVo subordinate = new WindSubordinateVo();
subordinate.setGeneration(0.0);
subordinate.setGenerationRate(0.0);
subordinate.setGenerationComplete(0.0);
subordinate.setFanUse(0.0);
subordinate.setFactoryUse(0.0);
// 获取第一个站点经纬度、行政编码信息 // 获取第一个站点经纬度、行政编码信息
StationEntity station = entry.getValue().get(0); StationEntity station = entry.getValue().get(0);
subordinate.setLttd(station.getLttd()); subordinate.setLttd(station.getLttd());
@ -252,11 +257,6 @@ public class WindHomeServiceImpl implements WindHomeService {
if(CollectionUtil.isNotEmpty(winds)){ if(CollectionUtil.isNotEmpty(winds)){
List<WindEntity> piece = winds.stream().filter(o->entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()).contains(o.getStationCode())).collect(Collectors.toList()); List<WindEntity> piece = winds.stream().filter(o->entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()).contains(o.getStationCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(piece)){ if(CollectionUtil.isEmpty(piece)){
subordinate.setGeneration(0.0);
subordinate.setGenerationRate(0.0);
subordinate.setGenerationComplete(0.0);
subordinate.setFanUse(0.0);
subordinate.setFactoryUse(0.0);
return subordinate; return subordinate;
} }
// 发电量 // 发电量
@ -294,8 +294,7 @@ public class WindHomeServiceImpl implements WindHomeService {
} }
} }
return subordinate; return subordinate;
}).filter(o-> Math.abs(o.getGeneration()) > 0 || Math.abs(o.getGenerationRate()) > 0 || Math.abs(o.getGenerationComplete()) > 0 }).sorted(Comparator.comparing(WindSubordinateVo::getGeneration).reversed()).collect(Collectors.toList());
|| Math.abs(o.getFactoryUse()) > 0 || Math.abs(o.getFanUse()) > 0 ).sorted(Comparator.comparing(WindSubordinateVo::getGeneration).reversed()).collect(Collectors.toList());
} }
/** /**
@ -721,7 +720,7 @@ public class WindHomeServiceImpl implements WindHomeService {
if (ObjectUtil.isEmpty(user)) { if (ObjectUtil.isEmpty(user)) {
return ""; return "";
} }
return user.getName(); return user.getRealName();
} }
/** /**
@ -744,7 +743,7 @@ public class WindHomeServiceImpl implements WindHomeService {
if (ObjectUtil.isEmpty(user)) { if (ObjectUtil.isEmpty(user)) {
continue; continue;
} }
builder.append(user.getName()).append(","); builder.append(user.getRealName()).append(",");
} }
if(builder.length() <= 0){ if(builder.length() <= 0){
return ""; return "";

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenancePlanController.java

@ -67,14 +67,14 @@ public class OperMaintenancePlanController extends BladeController {
req.setTaskType("1"); req.setTaskType("1");
if (ObjectUtil.isNotEmpty(req.getDisposer())){ if (ObjectUtil.isNotEmpty(req.getDisposer())){
User user = UserCache.getUser(req.getDisposer()); User user = UserCache.getUser(req.getDisposer());
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getRealName())){
req.setDisposerName(user.getName()); req.setDisposerName(user.getRealName());
} }
} }
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getUserName())){ if (ObjectUtil.isNotEmpty(user)&& StringUtils.isNotEmpty(user.getNickName())){
req.setCreateUserName(user.getUserName()); req.setCreateUserName(user.getNickName());
req.setUpdateUserName(user.getUserName()); req.setUpdateUserName(user.getNickName());
} }
planService.save(req); planService.save(req);
return R.data(req); return R.data(req);

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java

@ -124,6 +124,7 @@ public class OperMaintenanceTaskController extends BladeController {
public R<IPage<OperMaintenanceTaskVO>> list(@RequestBody OperMaintenanceTaskDTO req) { public R<IPage<OperMaintenanceTaskVO>> list(@RequestBody OperMaintenanceTaskDTO req) {
return taskService.list(req); return taskService.list(req);
} }
@ApiLog @ApiLog
@PostMapping("/exportMaintenance") @PostMapping("/exportMaintenance")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.maintenance.scheduled; package com.hnac.hzims.operational.maintenance.scheduled;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.common.constant.CommonConstant; import com.hnac.hzims.common.constant.CommonConstant;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
@ -17,7 +16,6 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
@ -31,6 +29,7 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.REMIND_MAINTENANCE_BECOME_TASK; import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.REMIND_MAINTENANCE_BECOME_TASK;
@Component @Component
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
@ -56,7 +55,7 @@ public class MaintenanceTaskRemindHandler {
else if(Lists.newArrayList("待领用","待执行").contains(taskEntity.getFlowTaskName())) { else if(Lists.newArrayList("待领用","待执行").contains(taskEntity.getFlowTaskName())) {
XxlJobLogger.log("开始执行id为{}的任务", Optional.ofNullable(operMaintenanceTaskEntity.getId()).orElse(0L)); XxlJobLogger.log("开始执行id为{}的任务", Optional.ofNullable(operMaintenanceTaskEntity.getId()).orElse(0L));
//日常维护任务到期消息提醒,提醒对象:执行人、项目经理角色 取出 //日常维护任务到期消息提醒,提醒对象:执行人、项目经理角色 取出
//this.sendMessage(taskEntity); this.sendMessage(taskEntity);
redisTemplate.opsForZSet().remove(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,operMaintenanceTaskEntity); redisTemplate.opsForZSet().remove(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,operMaintenanceTaskEntity);
} }
}); });
@ -84,7 +83,7 @@ public class MaintenanceTaskRemindHandler {
request.setCreateUser(taskEntity.getCreateUser()); request.setCreateUser(taskEntity.getCreateUser());
request.setTenantId(CommonConstant.TENANT_ID); request.setTenantId(CommonConstant.TENANT_ID);
R<Boolean> sendFlag = messageClient.sendAppAndWsMsgByUsers(request); R<Boolean> sendFlag = messageClient.sendAppAndWsMsgByUsers(request);
if(!(sendFlag.isSuccess() && sendFlag.getData())) { if(!sendFlag.isSuccess() || sendFlag.getData() == null) {
XxlJobLogger.log(taskEntity.getId() +"执行人消息推送失败!"); XxlJobLogger.log(taskEntity.getId() +"执行人消息推送失败!");
} }
// 任务执行人发送短信 // 任务执行人发送短信
@ -93,7 +92,7 @@ public class MaintenanceTaskRemindHandler {
request.setUserIds(listR.getData().stream().map(User::getId).map(String::valueOf).collect(Collectors.joining(","))); request.setUserIds(listR.getData().stream().map(User::getId).map(String::valueOf).collect(Collectors.joining(",")));
request.setContent("有一条待执行的日常维护任务【"+taskEntity.getTitle()+"】即将于"+ DateUtil.format(taskEntity.getPlanEndTime(),DateUtil.PATTERN_DATETIME) +"过期,请确认。"); request.setContent("有一条待执行的日常维护任务【"+taskEntity.getTitle()+"】即将于"+ DateUtil.format(taskEntity.getPlanEndTime(),DateUtil.PATTERN_DATETIME) +"过期,请确认。");
R<Boolean> result = messageClient.sendAppAndWsMsgByUsers(request); R<Boolean> result = messageClient.sendAppAndWsMsgByUsers(request);
if(!(result.isSuccess() && result.getData())) { if(!result.isSuccess() || result.getData() == null) {
XxlJobLogger.log(taskEntity.getId() +"执行人消息推送失败!"); XxlJobLogger.log(taskEntity.getId() +"执行人消息推送失败!");
} }
} }

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java

@ -61,10 +61,12 @@ public class MaintenanceTaskSchedule {
@XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE) @XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE)
public ReturnT<String> execute(String param) throws Exception { public ReturnT<String> execute(String param) throws Exception {
Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); String startDate = DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATE) + " 00:00:00";
Date endDate = DateUtil.parse(DateUtil.formatDate(DateUtil.plusDays(startDate, 1)), DateUtil.PATTERN_DATE); String endDate = DateUtil.format(DateUtil.plusDays(DateUtil.now(), 1), DateUtil.PATTERN_DATE) + " 00:00:00";
LambdaQueryWrapper<OperMaintenancePlanEntity> planQW = Wrappers.<OperMaintenancePlanEntity>lambdaQuery().isNull(OperMaintenancePlanEntity::getCreateTaskTime) LambdaQueryWrapper<OperMaintenancePlanEntity> planQW = Wrappers.<OperMaintenancePlanEntity>lambdaQuery()
.ge(OperMaintenancePlanEntity::getDisposeTime, startDate).lt(OperMaintenancePlanEntity::getDisposeTime, endDate); .isNull(OperMaintenancePlanEntity::getCreateTaskTime)
.ge(OperMaintenancePlanEntity::getDisposeTime, startDate)
.lt(OperMaintenancePlanEntity::getDisposeTime, endDate);
List<OperMaintenancePlanEntity> planList = planService.list(planQW); List<OperMaintenancePlanEntity> planList = planService.list(planQW);
XxlJobLogger.log("日常维护任务生成开始!计划ID为:"+planList.stream().map(OperMaintenancePlanEntity::getId).map(String::valueOf).collect(Collectors.joining(","))); XxlJobLogger.log("日常维护任务生成开始!计划ID为:"+planList.stream().map(OperMaintenancePlanEntity::getId).map(String::valueOf).collect(Collectors.joining(",")));
//分页插入日常维护计划 //分页插入日常维护计划

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java

@ -348,8 +348,8 @@ public class MaintenanceServiceImpl implements MaintenanceService {
String disposerName=""; String disposerName="";
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
User user = UserCache.getUser(Long.valueOf(split[i])); User user = UserCache.getUser(Long.valueOf(split[i]));
if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getName())){ if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getRealName())){
disposerName=disposerName+user.getName(); disposerName=disposerName+user.getRealName();
} }
} }
taskEntity.setDisposer(userId.replaceAll("\\^", ",")); taskEntity.setDisposer(userId.replaceAll("\\^", ","));

88
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -54,6 +53,7 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -275,7 +275,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
return Optional.ofNullable(user).map(User::getName).orElse(""); return Optional.ofNullable(user).map(User::getName).orElse("");
}).collect(Collectors.joining(",")); }).collect(Collectors.joining(","));
maintenanceReportVO.setUserName(userName); maintenanceReportVO.setUserName(userName);
fillRunReport(v, maintenanceReportVO); fillRunReport(v, maintenanceReportVO);
maintenanceReportVOList.add(maintenanceReportVO); maintenanceReportVOList.add(maintenanceReportVO);
index.getAndIncrement(); index.getAndIncrement();
}); });
@ -306,14 +306,14 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
//未完成任务 //未完成任务
List<OperMaintenanceTaskEntity> immatureTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList()); List<OperMaintenanceTaskEntity> immatureTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(immatureTask)){ if (CollectionUtil.isNotEmpty(immatureTask)){
Map<String, List<OperMaintenanceTaskEntity>> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode)); Map<String, List<OperMaintenanceTaskEntity>> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
// AtomicReference<String> immatureTaskSituation = new AtomicReference<>(""); // AtomicReference<String> immatureTaskSituation = new AtomicReference<>("");
immatureTaskTaskGroupByType.forEach((TypeCode, TypeList) -> { immatureTaskTaskGroupByType.forEach((TypeCode, TypeList) -> {
finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n")); finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
}); });
maintenanceReportVO.setIncompleteNum(immatureTask.size()); maintenanceReportVO.setIncompleteNum(immatureTask.size());
maintenanceReportVO.setIncompleteList(immatureTask.stream().map(s->String.valueOf(s.getId())).collect(Collectors.toList())); maintenanceReportVO.setIncompleteList(immatureTask.stream().map(s->String.valueOf(s.getId())).collect(Collectors.toList()));
maintenanceReportVO.setRemark(finishSituation.get()); maintenanceReportVO.setRemark(finishSituation.get());
} }
} }
@ -588,44 +588,44 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
list = maintenanceTaskEntities.parallelStream().map(maintenanceTaskVO -> { list = maintenanceTaskEntities.parallelStream().map(maintenanceTaskVO -> {
MaintenanceExportVO resEntity=new MaintenanceExportVO(); MaintenanceExportVO resEntity=new MaintenanceExportVO();
try { try {
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getCreateDept())){ if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getCreateDept())){
R<Dept> dept = sysClient.getDept(maintenanceTaskVO.getCreateDept()); R<Dept> dept = sysClient.getDept(maintenanceTaskVO.getCreateDept());
if (dept.isSuccess()&&ObjectUtil.isNotEmpty(dept.getData())){ if (dept.isSuccess()&&ObjectUtil.isNotEmpty(dept.getData())){
resEntity.setCompany(Optional.ofNullable(dept.getData().getDeptName()).orElse("")); resEntity.setCompany(Optional.ofNullable(dept.getData().getDeptName()).orElse(""));
} }
}
resEntity.setTypeCode(Optional.ofNullable(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, maintenanceTaskVO.getTypeCode())).orElse(""));
if (StringUtil.isNotBlank(maintenanceTaskVO.getEmCode())){
EmInfoEntity emInfoEntity = emInfoClient.getByCode(maintenanceTaskVO.getEmCode());
if (ObjectUtil.isNotEmpty(emInfoEntity)&&StringUtil.isNotBlank(emInfoEntity.getName())){
resEntity.setRefLibraryId(emInfoEntity.getName());
}else {
resEntity.setRefLibraryId(maintenanceTaskVO.getEmCode());
} }
} resEntity.setTypeCode(Optional.ofNullable(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, maintenanceTaskVO.getTypeCode())).orElse(""));
resEntity.setTitle(Optional.ofNullable( maintenanceTaskVO.getContent()).orElse("")); if (StringUtil.isNotBlank(maintenanceTaskVO.getEmCode())){
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getPlanEndTime())) { EmInfoEntity emInfoEntity = emInfoClient.getByCode(maintenanceTaskVO.getEmCode());
resEntity.setPlanEndTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getPlanEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); if (ObjectUtil.isNotEmpty(emInfoEntity)&&StringUtil.isNotBlank(emInfoEntity.getName())){
} resEntity.setRefLibraryId(emInfoEntity.getName());
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getDisposeTime())) { }else {
resEntity.setExecuteTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getDisposeTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); resEntity.setRefLibraryId(maintenanceTaskVO.getEmCode());
} }
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getDisposer())) { }
String disposerName = Optional.ofNullable(maintenanceTaskVO.getDisposer()).map(s->{ resEntity.setTitle(Optional.ofNullable( maintenanceTaskVO.getContent()).orElse(""));
List<String> disposerList = Arrays.stream(s.split(",")).collect(Collectors.toList()); if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getPlanEndTime())) {
return disposerList.stream().map(d ->{ resEntity.setPlanEndTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getPlanEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
User user = UserCache.getUser(Long.parseLong(d)); }
return Optional.ofNullable(user).map(User::getName).orElse(""); if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getDisposeTime())) {
}).collect(Collectors.joining(",")); resEntity.setExecuteTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getDisposeTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
}).orElse(""); }
if (StringUtil.isNotBlank(disposerName)) { if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getDisposer())) {
resEntity.setDisposer(disposerName); String disposerName = Optional.ofNullable(maintenanceTaskVO.getDisposer()).map(s->{
List<String> disposerList = Arrays.stream(s.split(",")).collect(Collectors.toList());
return disposerList.stream().map(d ->{
User user = UserCache.getUser(Long.parseLong(d));
return Optional.ofNullable(user).map(User::getName).orElse("");
}).collect(Collectors.joining(","));
}).orElse("");
if (StringUtil.isNotBlank(disposerName)) {
resEntity.setDisposer(disposerName);
}
} }
}
// resEntity.setDisposer(Optional.ofNullable(maintenanceTaskVO.getDisposerName()).orElse("")); // resEntity.setDisposer(Optional.ofNullable(maintenanceTaskVO.getDisposerName()).orElse(""));
resEntity.setPrincipal(Optional.ofNullable(maintenanceTaskVO.getWorkStandards()).orElse("")); resEntity.setPrincipal(Optional.ofNullable(maintenanceTaskVO.getWorkStandards()).orElse(""));
return resEntity; return resEntity;
}catch (Exception e){ }catch (Exception e){
log.error("日常维护导出失败---》param"+maintenanceTaskVO+"报错信息:"+e.getStackTrace()); log.error("日常维护导出失败---》param"+maintenanceTaskVO+"报错信息:"+e.getStackTrace());
return resEntity; return resEntity;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/schedule/OperPersonalCreateMonthReport.java

@ -75,7 +75,7 @@ public class OperPersonalCreateMonthReport {
} }
} }
else{ else{
log.info("{}已生成月报",user.getName()); log.info("{}已生成月报",user.getRealName());
} }
} }
}); });

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java

@ -554,7 +554,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
List<User> userListByRoleAlias = userClient.relationUserListByRoleAlias("200000", deptId, PROJECT_MANAGER).getData(); List<User> userListByRoleAlias = userClient.relationUserListByRoleAlias("200000", deptId, PROJECT_MANAGER).getData();
if (CollectionUtil.isNotEmpty(userListByRoleAlias)){ if (CollectionUtil.isNotEmpty(userListByRoleAlias)){
User user = userListByRoleAlias.get(0); User user = userListByRoleAlias.get(0);
map.put("manager", user.getName()); map.put("manager", user.getRealName());
}else { }else {
map.put("manager",""); map.put("manager","");
} }
@ -624,7 +624,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
map.put("inspectReportSum", sumList); map.put("inspectReportSum", sumList);
continue; continue;
} }
fillMapByClass(inspectReportVOList,list); fillMapByClass(inspectReport, list);
} }
map.put("inspectReportVOList", list); map.put("inspectReportVOList", list);
} }
@ -1222,9 +1222,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
int sum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoNumber).sum(); int sum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoNumber).sum();
int qualifiedNum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum(); int qualifiedNum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum();
// double ticketInfoProportion = new BigDecimal(qualifiedNum ).divide(sum,2, RoundingMode.HALF_DOWN).doubleValue(); // double ticketInfoProportion = new BigDecimal(qualifiedNum ).divide(sum,2, RoundingMode.HALF_DOWN).doubleValue();
double ticketInfoProportion = new BigDecimal(qualifiedNum ).divide(new BigDecimal(sum*100),2, RoundingMode.HALF_DOWN).doubleValue(); double ticketInfoProportion = sum == 0 ? 0 : new BigDecimal(qualifiedNum).divide(new BigDecimal(sum*100),2,
RoundingMode.HALF_DOWN).doubleValue();
String phenomenonConclusion = "5、本月开票%s张,合格率%s;"; String phenomenonConclusion = "5、本月开票%s张,合格率%s;";
conclusion.append(String.format(phenomenonConclusion,sum,ticketInfoProportion)).append(";\r\n"); conclusion.append(String.format(phenomenonConclusion, sum, ticketInfoProportion)).append(";\r\n");
}else { }else {
conclusion.append("5、本月未开票;\r\n"); conclusion.append("5、本月未开票;\r\n");
} }

18
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java

@ -104,21 +104,11 @@ public class StationController extends BladeController {
return R.status(stationService.instanceProject(req)); return R.status(stationService.instanceProject(req));
} }
@PostMapping("/updateBatch") @PostMapping("/updateBatchSort")
@ApiOperationSupport(order = 30) @ApiOperationSupport(order = 30)
@ApiOperation(value = "批量修改", notes = "传入站点列表") @ApiOperation(value = "批量修改排序", notes = "传入站点列表")
public R updateBatch(@RequestBody List<StationEntity> req) { public R updateBatchSort(@RequestBody List<StationEntity> req) {
for (StationEntity stationEntity : req) { return R.status(stationService.updateBatchSort(req));
if (StringUtil.isNotBlank(stationEntity.getCode()) || StringUtil.isNotBlank(stationEntity.getName())) {
List<StationEntity> list = stationService.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getCode, stationEntity.getCode()).or().eq(StationEntity::getName, stationEntity.getName());
}});
Assert.isTrue(CollectionUtil.isEmpty(list), () -> {
throw new ServiceException(stationEntity.getId() + "下站点名/编码已有对应记录,请找到相应记录做修改处理");
});
}
}
return R.status(stationService.updateBatchById(req));
} }
/** /**

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -144,4 +144,10 @@ public interface IStationService extends BaseService<StationEntity> {
Boolean updateStation(StationEntity station); Boolean updateStation(StationEntity station);
/**
* 批量更新站点排序
* @param req 站点列表
* @return 更新是否成功
*/
boolean updateBatchSort(List<StationEntity> req);
} }

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -896,4 +896,19 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
} }
return false; return false;
} }
/**
* 批量更新站点排序
*/
@Override
public boolean updateBatchSort(List<StationEntity> req) {
List<StationEntity> stations = new ArrayList<>();
for (StationEntity stationEntity : req) {
// 获取当前的站点信息
StationEntity station = this.getById(stationEntity.getId());
station.setSort(stationEntity.getSort());
stations.add(station);
}
return this.updateBatchById(stations);
}
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/workOrder/service/impl/DistributeWorkOrderServiceImpl.java

@ -82,7 +82,7 @@ public class DistributeWorkOrderServiceImpl implements IDistributeWorkOrderServi
publisher.setContactAddress("123123"); publisher.setContactAddress("123123");
publisher.setContactName("123123"); publisher.setContactName("123123");
publisher.setContactPhone(user.getPhone()); publisher.setContactPhone(user.getPhone());
publisher.setPublisher(user.getName()); publisher.setPublisher(user.getRealName());
publisher.setPublisherScale("123123"); publisher.setPublisherScale("123123");
orderPackageDto.setPublisher(publisher); orderPackageDto.setPublisher(publisher);
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

BIN
hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx

Binary file not shown.

1
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ReviewController.java

@ -78,6 +78,7 @@ public class ReviewController extends BladeController {
throw new ServiceException("该站点已录入数据,无法重复录入"); throw new ServiceException("该站点已录入数据,无法重复录入");
}); });
ReviewEntity entity = BeanUtil.copy(req,ReviewEntity.class); ReviewEntity entity = BeanUtil.copy(req,ReviewEntity.class);
entity.setSubmitter(AuthUtil.getUserId());
reviewService.save(entity); reviewService.save(entity);
req.getReviewStandardEntityList().stream().forEach(reviewStandardEntity -> { req.getReviewStandardEntityList().stream().forEach(reviewStandardEntity -> {
reviewStandardEntity.setReviewId(entity.getId()); reviewStandardEntity.setReviewId(entity.getId());

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/scheduled/SafeToolTypePushUserTask.java

@ -129,7 +129,7 @@ public class SafeToolTypePushUserTask {
else { else {
typeNames = typeEntityList.stream().map(SafetyToolTypeEntity::getTypeName).collect(Collectors.joining("、")); typeNames = typeEntityList.stream().map(SafetyToolTypeEntity::getTypeName).collect(Collectors.joining("、"));
} }
XxlJobLogger.log("开始推送,推送人:{}",JSONObject.toJSONString(noticeUser.getName())); XxlJobLogger.log("开始推送,推送人:{}",JSONObject.toJSONString(noticeUser.getRealName()));
if(sendType == APP_PUSH && Func.isNotEmpty(noticeUser.getPhone())){ if(sendType == APP_PUSH && Func.isNotEmpty(noticeUser.getPhone())){
//短信推送 //短信推送
String code = "safeTool"; String code = "safeTool";

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/EmergencyPlanServiceImpl.java

@ -51,7 +51,7 @@ public class EmergencyPlanServiceImpl extends BaseServiceImpl<EmergencyPlanMappe
like("file_name", req.getFileName()); like("file_name", req.getFileName());
} }
}}; }};
queryWrapper.orderByDesc("create_time");
IPage pages = super.page(Condition.getPage(query), queryWrapper); IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = EmergencyPlanWrapper.build().listVO(pages.getRecords()); List list = EmergencyPlanWrapper.build().listVO(pages.getRecords());
return R.data(pages.setRecords(list)); return R.data(pages.setRecords(list));

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/ImsMonAlarmInfoWrapper.java

@ -28,7 +28,7 @@ public class ImsMonAlarmInfoWrapper extends BaseEntityWrapper<ImsMonAlarmInfoEnt
if(entity != null){ if(entity != null){
ImsMonAlarmInfoVO vo = BeanUtil.copy(entity, ImsMonAlarmInfoVO.class); ImsMonAlarmInfoVO vo = BeanUtil.copy(entity, ImsMonAlarmInfoVO.class);
vo.setCameraName(cameraInfoService.getById(vo.getCameraId()).getName()); vo.setCameraName(cameraInfoService.getById(vo.getCameraId()).getName());
vo.setAcceptUserName(UserCache.getUser(entity.getCreateUser()).getName()); vo.setAcceptUserName(UserCache.getUser(entity.getCreateUser()).getRealName());
return vo; return vo;
} else { } else {
return null; return null;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save