Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 7 months ago
parent
commit
3bfc4a0d8b
  1. 12
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java
  2. 8
      hzims-service/hzims-middle/src/main/resources/db/2.0.0.sql
  3. 2
      hzims-service/operational/src/main/resources/db/2.0.1.sql
  4. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml
  5. 50
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SpecialDeviceInspectionServiceImpl.java

12
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java

@ -32,18 +32,22 @@ public class RehearsalExportDTO {
private Date scheduledEndTime; private Date scheduledEndTime;
@ApiModelProperty("演练地点") @ApiModelProperty("演练地点")
@ExcelProperty(value = "演练地点", index = 4) @ExcelProperty(value = "演练地点", index = 2)
private String location; private String location;
@ApiModelProperty("演练状态") @ApiModelProperty("演练状态")
@ExcelProperty(value = "演练状态", index = 5) @ExcelProperty(value = "演练状态", index = 6)
private String rehearsalStatus; private String rehearsalStatus;
@ApiModelProperty("计划开始时间") @ApiModelProperty("计划开始时间")
@ExcelProperty(value = "计划开始时间", index = 2) @ExcelProperty(value = "计划开始时间", index = 3)
private String startTime; private String startTime;
@ApiModelProperty("计划结束时间") @ApiModelProperty("计划结束时间")
@ExcelProperty(value = "计划结束时间", index = 3) @ExcelProperty(value = "计划结束时间", index = 4)
private String endTime; private String endTime;
@ApiModelProperty("总指挥")
@ExcelProperty(value = "总指挥", index = 5)
private String commander;
} }

8
hzims-service/hzims-middle/src/main/resources/db/2.0.0.sql

@ -1,12 +1,12 @@
-- 线下工作票流程 -- 线下工作票流程
INSERT INTO `process_dict` (`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) VALUES (13, 13, 'offlineWorkTicket', 'offlineWorkTicket', '线下工作票', '线下工作票', 'Y', 0, NULL, '2023-12-28 16:35:10', '2023-12-28 16:35:14', '线下工作票流程'); INSERT INTO `process_dict` (`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) VALUES (13, 13, 'offlineWorkTicket', 'offlineWorkTicket', '线下工作票', '线下工作票', 'Y', 0, NULL, '2023-12-28 16:35:10', '2023-12-28 16:35:14', '线下工作票流程');
-- 工作任务单流程 -- 工作任务单流程
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (14, 14, 'WORK_TASK', 'WORK_TASK', '工作任务单V4', '工作任务单', 'Y', 0, NULL, '2023-07-25 18:35:01', '2024-01-09 14:48:18', '工作任务单流程'); insert into `process_dict` (`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) values (14, 14, 'work_task', 'work_task', '工作任务单v4', '工作任务单', 'y', 0, null, '2023-07-25 18:35:01', '2024-01-09 14:48:18', '工作任务单流程');
-- 风险排查流程 -- 风险排查流程
INSERT INTO `PROCESS_DICT`(`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (10, 10, 'HAZARD_RISK', 'HAZARD_RISK', '风险排查', '风险排查', 'Y', 0, NULL, '2023-07-25 18:35:01', '2023-09-19 22:35:40', '风险排查流程'); insert into `process_dict`(`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) values (10, 10, 'hazard_risk', 'hazard_risk', '风险排查', '风险排查', 'y', 0, null, '2023-07-25 18:35:01', '2023-09-19 22:35:40', '风险排查流程');
-- 告警处理流程 -- 告警处理流程
INSERT INTO `PROCESS_DICT`(`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (11, 11, 'DEALALARM', 'DEALALARM', '告警处理流程', '告警处理流程', 'Y', 0, NULL, '2024-02-19 16:56:10', '2024-02-19 16:56:34', '告警处理流程'); insert into `process_dict`(`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) values (11, 11, 'dealalarm', 'dealalarm', '告警处理流程', '告警处理流程', 'y', 0, null, '2024-02-19 16:56:10', '2024-02-19 16:56:34', '告警处理流程');
-- 隐患排查流程 -- 隐患排查流程
INSERT INTO `PROCESS_DICT`(`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (12, 12, 'HIDDENDANGERCHECK', 'HIDDENDANGERCHECK', '隐患排查', '隐患排查', 'Y', 0, NULL, '2023-07-25 18:35:01', '2023-07-25 18:35:01', '隐患排查流程'); insert into `process_dict`(`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) values (12, 12, 'hiddendangercheck', 'hiddendangercheck', '隐患排查', '隐患排查', 'y', 0, null, '2023-07-25 18:35:01', '2023-07-25 18:35:01', '隐患排查流程');
-- 日志记录表添加错误日志字段 -- 日志记录表添加错误日志字段
alter table `hzims_workflow_operation_log` add column `fault_log` varchar(255) default null comment '错误日志'; alter table `hzims_workflow_operation_log` add column `fault_log` varchar(255) default null comment '错误日志';

2
hzims-service/operational/src/main/resources/db/2.0.1.sql

@ -104,3 +104,5 @@ ALTER TABLE `hzims_oper_phenomenon` ADD COLUMN `PRINCIPAL_NAME` varchar(255) CHA
ALTER TABLE `hzims_oper_phenomenon` ADD COLUMN `PLAN_HANDLER_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消缺处理人'; ALTER TABLE `hzims_oper_phenomenon` ADD COLUMN `PLAN_HANDLER_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消缺处理人';
ALTER TABLE `hz_ims_duty_analyse_example` ADD COLUMN `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '配置名称';

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml

@ -73,7 +73,7 @@
<select id="getRehearsalByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.RehearsalExportDTO"> <select id="getRehearsalByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.RehearsalExportDTO">
SELECT SELECT
unit, subject, scheduled_start_time, scheduled_end_time, location, rehearsal_status unit, subject, scheduled_start_time, scheduled_end_time, location, rehearsal_status, commander
FROM FROM
hzims_rehearsal_plan hzims_rehearsal_plan
WHERE WHERE

50
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SpecialDeviceInspectionServiceImpl.java

@ -10,11 +10,15 @@ import com.hnac.hzims.safeproduct.enums.DeviceStatusEnum;
import com.hnac.hzims.safeproduct.mapper.SpecialDeviceInspectionMapper; import com.hnac.hzims.safeproduct.mapper.SpecialDeviceInspectionMapper;
import com.hnac.hzims.safeproduct.service.ISpecialDeviceInspectionService; import com.hnac.hzims.safeproduct.service.ISpecialDeviceInspectionService;
import com.hnac.hzims.safeproduct.service.ISpecialDeviceService; import com.hnac.hzims.safeproduct.service.ISpecialDeviceService;
import com.xxl.job.core.util.DateUtil;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
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;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -35,17 +39,32 @@ public class SpecialDeviceInspectionServiceImpl extends ServiceImpl<SpecialDevic
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean saveInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity) { public boolean saveInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity) {
Long deviceId = specialDeviceInspectionEntity.getDeviceId();
// 获取对应特种设备
SpecialDeviceEntity specialDeviceEntity = deviceService.getById(deviceId);
// 计算下一次检验时间
Integer period = specialDeviceEntity.getInspectionPeriod();
Date nextInspectDate = DateUtil.addDays(specialDeviceInspectionEntity.getInspectionTime(), period);
specialDeviceInspectionEntity.setNextInspectionTime(nextInspectDate);
specialDeviceEntity.setInspectionNextTime(nextInspectDate);
// 获取上一次检验时间
QueryWrapper<SpecialDeviceInspectionEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SpecialDeviceInspectionEntity::getDeviceId, deviceId)
.orderByDesc(SpecialDeviceInspectionEntity::getInspectionTime);
List<SpecialDeviceInspectionEntity> list = this.list(queryWrapper);
if (CollectionUtil.isNotEmpty(list)) {
SpecialDeviceInspectionEntity lastDeviceInspection = list.get(0);
Date lastInspectionTime = lastDeviceInspection.getInspectionTime();
specialDeviceInspectionEntity.setLastInspectionTime(lastInspectionTime);
specialDeviceEntity.setInspectionLastTime(lastInspectionTime);
}
// 本次检验时间
specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime());
boolean save = this.save(specialDeviceInspectionEntity); boolean save = this.save(specialDeviceInspectionEntity);
if (save) { if (save) {
SpecialDeviceEntity specialDeviceEntity = deviceService.getById(specialDeviceInspectionEntity.getDeviceId());
if (specialDeviceEntity != null) {
specialDeviceEntity.setInspectionLastTime(specialDeviceInspectionEntity.getLastInspectionTime());
specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime());
specialDeviceEntity.setInspectionNextTime(specialDeviceInspectionEntity.getNextInspectionTime());
specialDeviceEntity.setDeviceStatus(DeviceStatusEnum.NORMAL.getValue()); specialDeviceEntity.setDeviceStatus(DeviceStatusEnum.NORMAL.getValue());
return deviceService.updateById(specialDeviceEntity); return deviceService.updateById(specialDeviceEntity);
} }
}
return false; return false;
} }
@ -55,10 +74,23 @@ public class SpecialDeviceInspectionServiceImpl extends ServiceImpl<SpecialDevic
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean updateInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity) { public boolean updateInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity) {
Long deviceId = specialDeviceInspectionEntity.getDeviceId();
// 获取对应特种设备
SpecialDeviceEntity specialDeviceEntity = deviceService.getById(deviceId);
// 计算下一次检验时间
Integer period = specialDeviceEntity.getInspectionPeriod();
Date nextInspectDate = DateUtil.addDays(specialDeviceInspectionEntity.getInspectionTime(), period);
specialDeviceInspectionEntity.setNextInspectionTime(nextInspectDate);
// 更新设备检验记录
boolean update = this.updateById(specialDeviceInspectionEntity); boolean update = this.updateById(specialDeviceInspectionEntity);
if (update) { // 获取按检验时间倒序排列的检验记录数据
SpecialDeviceEntity specialDeviceEntity = deviceService.getById(specialDeviceInspectionEntity.getDeviceId()); QueryWrapper<SpecialDeviceInspectionEntity> queryWrapper = new QueryWrapper<>();
if (specialDeviceEntity != null) { queryWrapper.lambda().eq(SpecialDeviceInspectionEntity::getDeviceId, deviceId)
.orderByDesc(SpecialDeviceInspectionEntity::getInspectionTime);
List<SpecialDeviceInspectionEntity> list = this.list(queryWrapper);
if (CollectionUtil.isNotEmpty(list)) {
// 仅最新的检验记录对特种设备的检验时间造成影响
if (specialDeviceInspectionEntity.getId().equals(list.get(0).getId()) && update) {
specialDeviceEntity.setInspectionLastTime(specialDeviceInspectionEntity.getLastInspectionTime()); specialDeviceEntity.setInspectionLastTime(specialDeviceInspectionEntity.getLastInspectionTime());
specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime()); specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime());
specialDeviceEntity.setInspectionNextTime(specialDeviceInspectionEntity.getNextInspectionTime()); specialDeviceEntity.setInspectionNextTime(specialDeviceInspectionEntity.getNextInspectionTime());

Loading…
Cancel
Save