Browse Source

#检修工作票

zhongwei
yang_shj 1 month ago
parent
commit
74d0440513
  1. 2
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmConstants.java
  2. 3
      hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java
  3. 20
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/constants/AccessTicketConstants.java
  4. 16
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketDetailReqDTO.java
  5. 19
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketPageReqDTO.java
  6. 32
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketStartProcessReqDTO.java
  7. 14
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/response/AccessTicketDetailRspDTO.java
  8. 14
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/response/AccessTicketPageRspDTO.java
  9. 13
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/response/AccessTicketStartProcessRspDTO.java
  10. 118
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/entity/AccessTicketEntity.java
  11. 17
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClientFallback.java
  12. 26
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/IAccessTicketClient.java
  13. 17
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketMeasureVo.java
  14. 134
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketPreviewVo.java
  15. 20
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketRiskFactorsVo.java
  16. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java
  17. 60
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/AccessTicketServiceImpl.java
  18. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  19. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/StartStopDurationServiceImpl.java
  20. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  21. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectTemplateMapper.xml
  22. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
  23. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java
  24. 2
      hzims-service/pom.xml
  25. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/TicketApplication.java
  26. 68
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/controller/AccessTicketController.java
  27. 27
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClient.java
  28. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/mapper/AccessTicketMapper.java
  29. 18
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/mapper/AccessTicketMapper.xml
  30. 32
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/AccessTicketService.java
  31. 441
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/impl/AccessTicketServiceImpl.java
  32. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java
  33. BIN
      hzims-service/ticket/src/main/resources/template/accessTicket/access_ticket_template.docx

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

@ -70,5 +70,5 @@ public interface AlarmConstants {
String FDP_INVALID_ZOME_STATUS = "1"; String FDP_INVALID_ZOME_STATUS = "1";
List<Integer> WHOLE_ALARM_TYPE = Arrays.asList(AlarmConstants.WARNING,AlarmConstants.FAULT,AlarmConstants.OFFSIDE,AlarmConstants.INTERRUPT,AlarmConstants.ABNORMAL,AlarmConstants.EARLY,AlarmConstants.ONE_LEVEL,AlarmConstants.TWO_LEVEL,AlarmConstants.THREE_LEVEL); List<Integer> WHOLE_ALARM_TYPE = Arrays.asList(AlarmConstants.WARNING,AlarmConstants.FAULT,AlarmConstants.OFFSIDE,AlarmConstants.INTERRUPT,AlarmConstants.CONDITION,AlarmConstants.ABNORMAL,AlarmConstants.EARLY,AlarmConstants.ONE_LEVEL,AlarmConstants.TWO_LEVEL,AlarmConstants.THREE_LEVEL);
} }

3
hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java

@ -79,6 +79,9 @@ public class TicketProcessConstant {
*/ */
public static final String OFFLINE_OPERATION_TICKET = "OperationTicketOffline"; public static final String OFFLINE_OPERATION_TICKET = "OperationTicketOffline";
public static final String ACCESS_TICKET = "access_ticket";
/**项目经理**/ /**项目经理**/
public static final String PROJECT_MANAGER = "projectManager"; public static final String PROJECT_MANAGER = "projectManager";
} }

20
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/constants/AccessTicketConstants.java

@ -0,0 +1,20 @@
package com.hnac.hzims.ticket.accessTicket.constants;
/**
* @author ysj
*/
public interface AccessTicketConstants {
// 检修工作票流程key
String ACCESS_TICKET_PROCESS_KEY = "access_ticket";
// 检修工作票流程表名
String ACCESS_TICKET_TABLE = "access_work_ticket";
// 检修完成
String ACCESS_COMPLETE = "complete";
// 检修延期
String ACCESS_EXTENSION = "extension";
}

16
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketDetailReqDTO.java

@ -0,0 +1,16 @@
package com.hnac.hzims.ticket.accessTicket.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author ysj
*/
@Data
public class AccessTicketDetailReqDTO implements Serializable {
@ApiModelProperty(value = "主键id")
private String processInstanceId;
}

19
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketPageReqDTO.java

@ -0,0 +1,19 @@
package com.hnac.hzims.ticket.accessTicket.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author ysj
*/
@Data
public class AccessTicketPageReqDTO implements Serializable {
@ApiModelProperty("开始时间 : YYYY-MM-DD HH:MM:SS")
private String startTime;
@ApiModelProperty("结束时间 : YYYY-MM-DD HH:MM:SS")
private String endTime;
}

32
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/request/AccessTicketStartProcessReqDTO.java

@ -0,0 +1,32 @@
package com.hnac.hzims.ticket.accessTicket.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author ysj
*/
@Data
public class AccessTicketStartProcessReqDTO implements Serializable {
@ApiModelProperty("是否外部单位 : 0-非外部单位 1-外部单位")
private Integer isExternal;
@ApiModelProperty("是否紧急 : 0-正常 1-紧急")
private Integer isEmergency;
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("故障描述")
private String faultDescribe;
@ApiModelProperty("图片")
private List<String> imgs;
@ApiModelProperty("视频")
private List<String> videos;
}

14
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/response/AccessTicketDetailRspDTO.java

@ -0,0 +1,14 @@
package com.hnac.hzims.ticket.accessTicket.dto.response;
import com.hnac.hzims.ticket.accessTicket.entity.AccessTicketEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author ysj
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class AccessTicketDetailRspDTO extends AccessTicketEntity {
}

14
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/response/AccessTicketPageRspDTO.java

@ -0,0 +1,14 @@
package com.hnac.hzims.ticket.accessTicket.dto.response;
import com.hnac.hzims.ticket.accessTicket.entity.AccessTicketEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author ysj
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class AccessTicketPageRspDTO extends AccessTicketEntity {
}

13
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/dto/response/AccessTicketStartProcessRspDTO.java

@ -0,0 +1,13 @@
package com.hnac.hzims.ticket.accessTicket.dto.response;
import lombok.Data;
import java.io.Serializable;
/**
* @author ysj
*/
@Data
public class AccessTicketStartProcessRspDTO implements Serializable {
}

118
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/entity/AccessTicketEntity.java

@ -0,0 +1,118 @@
package com.hnac.hzims.ticket.accessTicket.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
import java.util.Date;
/**
* @author ysj
*/
@Data
@ApiModel(value = "检修工作票",description = "检修工作票")
@TableName("access_work_ticket")
@EqualsAndHashCode(callSuper = false)
public class AccessTicketEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("是否外部单位 : 0-非外部单位 1-外部单位")
private Integer isExternal;
@ApiModelProperty("是否紧急 : 0-正常 1-紧急")
private Integer isEmergency;
@ApiModelProperty("检修编号")
private String code;
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("设备名称")
private String deviceName;
@ApiModelProperty("设备地址")
private String deviceAddress;
@ApiModelProperty("故障描述")
private String faultDescribe;
@ApiModelProperty("检修内容")
private String accessContent;
@ApiModelProperty("质量标准")
private String qualityStandard;
@ApiModelProperty("危险作业类别: 存储作业类别字典,以逗号分隔")
private String dangerous;
@ApiModelProperty("计划开始时间")
private Date planStartTime;
@ApiModelProperty("计划结束时间")
private Date planEndTime;
@ApiModelProperty("检修安全措施")
private String measures;
@ApiModelProperty("检修安全措施确认人")
private String measuresConfirmPersonnel;
@ApiModelProperty("危险因素")
private String riskFactors;
@ApiModelProperty("学习确认危险点负责人")
private String studyHead;
@ApiModelProperty("学习确认危险点成员")
private String studyMembers;
@ApiModelProperty("签发时间")
private Date issueTime;
@ApiModelProperty("签发人员")
private String issuePersonnel;
@ApiModelProperty("实际开始时间")
private Date actStartTime;
@ApiModelProperty("实际结束时间")
private Date actEndTime;
@ApiModelProperty("延期时间")
private Date extensionTime;
@ApiModelProperty("延期审核人")
private String extensionPersonnel;
@ApiModelProperty("验收时间")
private Date checkTime;
@ApiModelProperty("验收审核人")
private String checkPersonnel;
@ApiModelProperty("备注")
private String memo;
@ApiModelProperty("图片")
private String imgs;
@ApiModelProperty("视频")
private String videos;
@ApiModelProperty("当前任务名称")
private String taskName;
@ApiModelProperty("当前步骤处理人员名称")
private String nextStepOperator;
@ApiModelProperty("流程实例Id")
private String processInstanceId;
}

17
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClientFallback.java

@ -0,0 +1,17 @@
package com.hnac.hzims.ticket.accessTicket.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component;
/**
* @author ysj
*/
@Component
public class AccessTicketClientFallback implements IAccessTicketClient {
@Override
public R<Boolean> listener(ProcessWorkFlowResponse processWorkFlowResponse) {
return R.fail("执行失败!");
}
}

26
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/IAccessTicketClient.java

@ -0,0 +1,26 @@
package com.hnac.hzims.ticket.accessTicket.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.allTicket.fegin.TicketInfoAllClientFallback;
import com.hnac.hzims.ticket.constants.TicketConstants;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author ysj
*/
@FeignClient(
value = TicketConstants.APP_NAME,
fallback = AccessTicketClientFallback.class
)
public interface IAccessTicketClient {
String API_PREFIX = "/feign/accessTicket";
String ACCESS_TICKET_PROCESS_LISTENER = API_PREFIX + "/listener";
@PostMapping(ACCESS_TICKET_PROCESS_LISTENER)
R<Boolean> listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse);
}

17
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketMeasureVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.ticket.accessTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class AccessTicketMeasureVo {
@ApiModelProperty("检修措施字典编号")
private String code;
@ApiModelProperty("措施描述")
private String measures;
}

134
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketPreviewVo.java

@ -0,0 +1,134 @@
package com.hnac.hzims.ticket.accessTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class AccessTicketPreviewVo {
@ApiModelProperty("创建时间")
private String create;
@ApiModelProperty("检修创建时间: 年")
private Integer cy;
@ApiModelProperty("检修创建时间: 月")
private Integer cm;
@ApiModelProperty("检修创建时间: 日")
private Integer cday;
@ApiModelProperty("编号")
private String code;
@ApiModelProperty("设备名称")
private String deviceName;
@ApiModelProperty("检修内容")
private String content;
@ApiModelProperty("质量标准")
private String standard;
@ApiModelProperty("作业危险类别")
private String dangerous;
@ApiModelProperty("备注")
private String memo;
@ApiModelProperty("工作负责人签名")
private String studyHead;
@ApiModelProperty("工作班组成员")
private String studyMembers;
@ApiModelProperty("计划开始检修时间: 年")
private Integer psy;
@ApiModelProperty("计划开始检修时间: 月")
private Integer psm;
@ApiModelProperty("计划开始检修时间: 日")
private Integer psd;
@ApiModelProperty("计划开始检修时间: 时")
private Integer psh;
@ApiModelProperty("计划开始检修时间: 分")
private Integer psmi;
@ApiModelProperty("计划结束检修时间: 年")
private Integer pey;
@ApiModelProperty("计划结束检修时间: 月")
private Integer pem;
@ApiModelProperty("计划结束检修时间: 日")
private Integer ped;
@ApiModelProperty("计划结束检修时间: 时")
private Integer peh;
@ApiModelProperty("计划结束检修时间: 分")
private Integer pemi;
@ApiModelProperty("检修成员人数")
private Integer accessCount;
@ApiModelProperty("签发人员")
private String issuePersonnel;
@ApiModelProperty("签发时间: 年")
private Integer issy;
@ApiModelProperty("签发时间: 月")
private Integer issm;
@ApiModelProperty("签发时间: 日")
private Integer issd;
@ApiModelProperty("签发时间: 时")
private Integer issh;
@ApiModelProperty("签发时间: 分")
private Integer issmi;
@ApiModelProperty("延期审核人")
private String extensionPersonnel;
@ApiModelProperty("延期审核时间: 年")
private String ey;
@ApiModelProperty("延期审核时间: 月")
private String em;
@ApiModelProperty("延期审核时间: 日")
private String ed;
@ApiModelProperty("延期审核时间: 时")
private String eh;
@ApiModelProperty("延期审核时间: 分")
private String emi;
@ApiModelProperty("验收审核人")
private String checkPersonnel;
@ApiModelProperty("验收时间: 年")
private Integer chy;
@ApiModelProperty("验收时间: 月")
private Integer chm;
@ApiModelProperty("验收时间: 日")
private Integer chd;
@ApiModelProperty("验收时间: 时")
private Integer chh;
@ApiModelProperty("验收时间: 分")
private Integer chmi;
}

20
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/accessTicket/vo/AccessTicketRiskFactorsVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.ticket.accessTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class AccessTicketRiskFactorsVo {
@ApiModelProperty("危险因素字典编号")
private String code;
@ApiModelProperty("控制措施")
private String controlMeasures;
@ApiModelProperty("票据编号")
private String ticketCode;
}

2
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java

@ -1550,7 +1550,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
reactive.setKeepFigures(2); reactive.setKeepFigures(2);
reactive.setAccessRules(5); reactive.setAccessRules(5);
reactive.setSaveTimeType(2); reactive.setSaveTimeType(2);
reactive.setSignages("reactive_generation"); reactive.setSignages("reactive_generate");
reactive.setTimeInterval(1); reactive.setTimeInterval(1);
reactive.setBeginTime(start); reactive.setBeginTime(start);
reactive.setEndTime(end); reactive.setEndTime(end);

60
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/AccessTicketServiceImpl.java

@ -0,0 +1,60 @@
package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.accessTicket.feign.IAccessTicketClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.ACCESS_TICKET;
/**
* @author ysj
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class AccessTicketServiceImpl extends ProcessAbstractService {
private final ProcessDictService processDictService;
private final IAccessTicketClient accessTicketClient;
/**
* 比对流程key
* @param flowQueue
* @return
*/
@Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
String dictValue = processDictService.selectDictValueByKey(ACCESS_TICKET);
if (dictValue.equals(flowQueue.getProcessDefinitionKey())) {
log.info("确认检修工作票流程程环节操作");
return true;
}
return false;
}
/**
* 回调业务流程feign接口
* @param response
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("检修工作票流程消费参数 :" + response);
R result = accessTicketClient.listener(response);
if (!result.isSuccess()){
log.info("检修工作票流程处理失败");
throw new ServiceException("检修工作票流程消费失败");
}
log.info("检修工作票流程消费成功");
}
}

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

@ -67,7 +67,12 @@ public class AlarmServiceImpl implements AlarmService {
*/ */
@Override @Override
public void clearHistoryAlarm(String param) { public void clearHistoryAlarm(String param) {
this.queryService.clear(param); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-30);
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));
this.queryService.clear(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
} }
/** /**

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/StartStopDurationServiceImpl.java

@ -310,7 +310,7 @@ public class StartStopDurationServiceImpl extends ServiceImpl<StartStopDurationM
calendar.setTime(start); calendar.setTime(start);
while (start.compareTo(end) <= 0){ while (start.compareTo(end) <= 0){
calendar.add(Calendar.HOUR_OF_DAY,+1); calendar.add(Calendar.DAY_OF_MONTH,+1);
Date complete = calendar.getTime(); Date complete = calendar.getTime();
// 删除日期开关机记录 // 删除日期开关机记录
this.baseMapper.deleteThisDayStartStopRecord(DateUtil.format(start,DateUtil.PATTERN_DATETIME)); this.baseMapper.deleteThisDayStartStopRecord(DateUtil.format(start,DateUtil.PATTERN_DATETIME));

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

@ -347,17 +347,19 @@ public class MonitorServiceImpl implements MonitorService {
pool.execute(()->{ pool.execute(()->{
item.forEach((key,value)->{ item.forEach((key,value)->{
RealStationVo realStation = new RealStationVo(); RealStationVo realStation = new RealStationVo();
Optional<StationEntity> station = stations.stream().filter(o->key.equals(o.getCode())).findFirst();
station.ifPresent(stationEntity -> realStation.setStatus(stationEntity.getStatus()));
// 设备信息 // 设备信息
List<RealDeviceVo> devices = this.monitorRealDevice(value,realTimeData); List<RealDeviceVo> devices = this.monitorRealDevice(value,realTimeData);
// 设备状态、装机容量 // 设备状态、装机容量
this.deviceParam(devices,deviceClassifyMap,deviceParms); this.deviceParam(devices,deviceClassifyMap,deviceParms);
realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList()));
// 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序 // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序
this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); this.stationBaseInfo(stations.stream().filter(o->key.equals(o.getCode())).findFirst(),sorts,realStation);
// 站点总功率计算 // 站点总功率计算
this.stationActivePower(devices,realStation); this.stationActivePower(devices,realStation);
// 站点铃铛、数据中断状态 // 站点铃铛、数据中断状态
this.stationStatus(aborts,bells,realStation); this.stationStatus(bells,realStation,station);
realStations.add(realStation); realStations.add(realStation);
}); });
countDownLatch.countDown(); countDownLatch.countDown();
@ -463,11 +465,10 @@ public class MonitorServiceImpl implements MonitorService {
/** /**
* 站点铃铛数据中断状态 * 站点铃铛数据中断状态
* @param aborts
* @param bells * @param bells
* @param realStation * @param realStation
*/ */
private void stationStatus(List<String> aborts, List<String> bells, RealStationVo realStation) { private void stationStatus(List<String> bells, RealStationVo realStation,Optional<StationEntity> optional) {
realStation.setBell(0); realStation.setBell(0);
realStation.setStatus(0); realStation.setStatus(0);
// 铃铛 // 铃铛
@ -475,8 +476,8 @@ public class MonitorServiceImpl implements MonitorService {
realStation.setBell(1); realStation.setBell(1);
} }
// 数据中断 // 数据中断
if(realStation.getPowerSum() <= 0 && aborts.contains(realStation.getStationCode())){ if(realStation.getPowerSum() <= 0 && optional.isPresent()){
realStation.setStatus(1); realStation.setStatus(optional.get().getOnLine());
} }
} }

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectTemplateMapper.xml

@ -3,7 +3,7 @@
<mapper namespace="com.hnac.hzinfo.inspect.obj.mapper.ObjectTemplateMapper"> <mapper namespace="com.hnac.hzinfo.inspect.obj.mapper.ObjectTemplateMapper">
<select id="getListByObjectId" resultType="com.hnac.hzinfo.inspect.obj.entity.ObjectTemplateEntity"> <select id="getListByObjectId" resultType="com.hnac.hzinfo.inspect.obj.entity.ObjectTemplateEntity">
SELECT distinct t.id,o.code,o.name,o.SUPPORT_AUTO_VIDEO,t.template_id,t.object_id SELECT distinct t.id,o.code,o.name,o.SUPPORT_AUTO_VIDEO,t.template_id,t.object_id,t.UPDATE_TIME
from hz_st_re_object_template t from hz_st_re_object_template t
left JOIN hz_st_re_template o on (t.template_id=o.id) left JOIN hz_st_re_template o on (t.template_id=o.id)
left join hz_st_re_template_project p on o.id = p.template_id left join hz_st_re_template_project p on o.id = p.template_id

6
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java

@ -224,7 +224,7 @@ public class ObjectServiceImpl extends ServiceImpl<InspectObjectMapper, ObjectEn
if(object.getId()==null && Func.isBlank(object.getCode())){ if(object.getId()==null && Func.isBlank(object.getCode())){
object.setCode(CodeUtils.randomCode()); object.setCode(CodeUtils.randomCode());
} }
if(object.getSupportAutoVideo().equals(PlanContants.InspectTypeEnum.COMMON.getVal()) && (Func.isEmpty(object.getObjectDangers()) || object.getObjectDangers().size() == 0)){ if(object.getSupportAutoVideo().equals(PlanContants.InspectTypeEnum.COMMON.getVal()) && (Func.isEmpty(object.getObjectDangers()) || object.getObjectDangers().isEmpty())){
throw new ServiceException("对象告警list为空"); throw new ServiceException("对象告警list为空");
} }
Assert.isTrue(this.saveOrUpdate(object),() -> { Assert.isTrue(this.saveOrUpdate(object),() -> {
@ -233,7 +233,7 @@ public class ObjectServiceImpl extends ServiceImpl<InspectObjectMapper, ObjectEn
objectDangerService.remove(Wrappers.<ObjectDangerEntity>lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId())); objectDangerService.remove(Wrappers.<ObjectDangerEntity>lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId()));
List<ObjectDangerEntity> objectDangers = object.getObjectDangers(); List<ObjectDangerEntity> objectDangers = object.getObjectDangers();
if(CollectionUtil.isNotEmpty(objectDangers)){ if(CollectionUtil.isNotEmpty(objectDangers)){
objectDangers.stream().forEach(e -> { objectDangers.forEach(e -> {
e.setObjectId(object.getId()); e.setObjectId(object.getId());
}); });
objectDangerService.saveBatch(objectDangers); objectDangerService.saveBatch(objectDangers);
@ -367,7 +367,7 @@ public class ObjectServiceImpl extends ServiceImpl<InspectObjectMapper, ObjectEn
* @return * @return
*/ */
private List<InspectPdf> asPDFModuleList(List<ObjectEntity> list) { private List<InspectPdf> asPDFModuleList(List<ObjectEntity> list) {
List<InspectPdf> modules = new ArrayList<InspectPdf>(list.size()); List<InspectPdf> modules = new ArrayList<>(list.size());
for (ObjectEntity obj : list) { for (ObjectEntity obj : list) {
modules.add(asModule(obj)); modules.add(asModule(obj));
} }

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

@ -215,7 +215,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
*/ */
@Override @Override
public TextMessage getSendMessage(MessageParamVo message) { public TextMessage getSendMessage(MessageParamVo message) {
long beginTime = System.currentTimeMillis();
// 权限机构过滤 // 权限机构过滤
if(ObjectUtil.isEmpty(message) || CollectionUtil.isEmpty(message.getDeptIds())){ if(ObjectUtil.isEmpty(message) || CollectionUtil.isEmpty(message.getDeptIds())){
return null; return null;
@ -225,7 +224,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
if(CollectionUtil.isEmpty(realStationVoList)){ if(CollectionUtil.isEmpty(realStationVoList)){
return null; return null;
} }
beginTime = System.currentTimeMillis();
// 集中监控响应站点数据 // 集中监控响应站点数据
List<RealStationVo> validList = realStationVoList.stream().filter(o -> message.getDeptIds().contains(o.getStationDeptId())).collect(Collectors.toList()); List<RealStationVo> validList = realStationVoList.stream().filter(o -> message.getDeptIds().contains(o.getStationDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(validList)){ if(CollectionUtil.isEmpty(validList)){
@ -239,10 +237,8 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(codes); Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(codes);
// 七日内天气 // 七日内天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(codes); Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(codes);
beginTime = System.currentTimeMillis();
// 站点水位数据 // 站点水位数据
List<WaterLevelVo> levelList = (List<WaterLevelVo>) redisTemplate.opsForValue().get(loadwater_level_key); List<WaterLevelVo> levelList = (List<WaterLevelVo>) redisTemplate.opsForValue().get(loadwater_level_key);
beginTime = System.currentTimeMillis();
// 遍历站点 // 遍历站点
validList.forEach(item->{ validList.forEach(item->{
// 天气、降雨量 // 天气、降雨量

2
hzims-service/pom.xml

@ -24,7 +24,7 @@
<module>hzims-scheduled</module> <module>hzims-scheduled</module>
<module>hzims-alarm</module> <module>hzims-alarm</module>
<module>hzims-basic</module> <module>hzims-basic</module>
<module>gglm-big-model</module> <!--<module>gglm-big-model</module>-->
</modules> </modules>
<dependencies> <dependencies>

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/TicketApplication.java

@ -22,6 +22,6 @@ import javax.annotation.Resource;
public class TicketApplication { public class TicketApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(TicketConstants.APP_NAME, TicketApplication.class, args); BladeApplication.run("hzims-ticket", TicketApplication.class, args);
} }
} }

68
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/controller/AccessTicketController.java

@ -0,0 +1,68 @@
package com.hnac.hzims.ticket.accessTicket.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketDetailReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketPageReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketStartProcessReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketDetailRspDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketPageRspDTO;
import com.hnac.hzims.ticket.accessTicket.service.AccessTicketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
/**
* @author ysj
*/
@Api(value = "检修工作票",tags = "检修工作票管理")
@RestController
@RequestMapping("/access/ticket")
@AllArgsConstructor
@Slf4j
public class AccessTicketController extends BladeController {
private final AccessTicketService accessTicketService;
@PostMapping("/startProcess")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "检修工作票流程开启")
public R<Boolean> startProcess(@RequestBody AccessTicketStartProcessReqDTO param) {
return R.status(accessTicketService.startProcess(param));
}
@GetMapping("/page")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "检修工作票列表查询")
public R<IPage<AccessTicketPageRspDTO>> pageCondition(AccessTicketPageReqDTO param,Query query) {
return R.data(accessTicketService.pageCondition(param,query));
}
@PostMapping("/detail")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "检修工作票详情信息")
public R<AccessTicketDetailRspDTO> pageCondition(@RequestBody AccessTicketDetailReqDTO param) {
return R.data(accessTicketService.detail(param));
}
@GetMapping(value = "/preview")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "检修工作票预览")
public void preview(@RequestParam("id") Long id ) {
accessTicketService.preview(id);
}
@GetMapping("/revoke")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "撤销报修")
public R<Boolean> revoke(@RequestParam("ticketId") Long ticketId) {
return R.status(accessTicketService.revoke(ticketId));
}
}

27
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/feign/AccessTicketClient.java

@ -0,0 +1,27 @@
package com.hnac.hzims.ticket.accessTicket.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.accessTicket.service.AccessTicketService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@RestController
@Slf4j
@AllArgsConstructor
public class AccessTicketClient implements IAccessTicketClient {
private final AccessTicketService accessTicketService;
@Override
@PostMapping(ACCESS_TICKET_PROCESS_LISTENER)
public R<Boolean> listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse) {
return R.status(accessTicketService.listener(processWorkFlowResponse));
}
}

16
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/mapper/AccessTicketMapper.java

@ -0,0 +1,16 @@
package com.hnac.hzims.ticket.accessTicket.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketPageReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketPageRspDTO;
import com.hnac.hzims.ticket.accessTicket.entity.AccessTicketEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface AccessTicketMapper extends UserDataScopeBaseMapper<AccessTicketEntity> {
IPage<AccessTicketPageRspDTO> pageCondition(IPage page, @Param("param") AccessTicketPageReqDTO param);
}

18
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/mapper/AccessTicketMapper.xml

@ -0,0 +1,18 @@
<?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">
<mapper namespace="com.hnac.hzims.ticket.accessTicket.mapper.AccessTicketMapper">
<select id="pageCondition" resultType="com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketPageRspDTO">
SELECT * FROM ACCESS_WORK_TICKET
<where>
IS_DELETED = 0
<if test="param.startTime != null and para.startTime != ''">
AND CREATE_TIME >= #{param.startTime}
</if>
<if test="param.endTime != null and para.endTime != ''">
AND CREATE_TIME &lt;= #{param.endTime}
</if>
</where>
ORDER BY CREATE_TIME DESC
</select>
</mapper>

32
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/AccessTicketService.java

@ -0,0 +1,32 @@
package com.hnac.hzims.ticket.accessTicket.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketDetailReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketPageReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketStartProcessReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketDetailRspDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketPageRspDTO;
import com.hnac.hzims.ticket.accessTicket.entity.AccessTicketEntity;
import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse;
/**
* @author ysj
*/
public interface AccessTicketService extends IService<AccessTicketEntity> {
boolean startProcess(AccessTicketStartProcessReqDTO param);
boolean listener(ProcessWorkFlowResponse processWorkFlowResponse);
IPage<AccessTicketPageRspDTO> pageCondition(AccessTicketPageReqDTO param,Query query);
AccessTicketDetailRspDTO detail(AccessTicketDetailReqDTO param);
boolean revoke(Long ticketId);
void preview(Long id);
}

441
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/accessTicket/service/impl/AccessTicketServiceImpl.java

@ -0,0 +1,441 @@
package com.hnac.hzims.ticket.accessTicket.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.accessTicket.constants.AccessTicketConstants;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketDetailReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketPageReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.request.AccessTicketStartProcessReqDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketDetailRspDTO;
import com.hnac.hzims.ticket.accessTicket.dto.response.AccessTicketPageRspDTO;
import com.hnac.hzims.ticket.accessTicket.entity.AccessTicketEntity;
import com.hnac.hzims.ticket.accessTicket.mapper.AccessTicketMapper;
import com.hnac.hzims.ticket.accessTicket.service.AccessTicketService;
import com.hnac.hzims.ticket.accessTicket.vo.AccessTicketPreviewVo;
import com.hnac.hzims.ticket.utils.AsposeUtil;
import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.utils.WordUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dict;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
/**
* @author ysj
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class AccessTicketServiceImpl extends ServiceImpl<AccessTicketMapper, AccessTicketEntity> implements AccessTicketService {
private final IUserClient userClient;
private final IFlowClient flowClient;
private final IEmInfoClient deviceClient;
@Value("${hzims.ticket.accessTicket.save.pdf}")
private String savePdfPath;
@Value("${hzims.ticket.accessTicket.save.work}")
private String saveWorkPath;
/**
* 检修工作票开启流程
* @param param
* @return
*/
@Override
public boolean startProcess(AccessTicketStartProcessReqDTO param) {
// 保存检修工作票
AccessTicketEntity entity = this.saveAccessTicket(param);
// 开启流程
return this.start(entity);
}
/**
* 检修工作票流程回调监听
* @param processWorkFlowResponse
* @return
*/
@Override
public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) {
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
AccessTicketEntity entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<AccessTicketEntity>(){});
// 当前流程名称
entity.setTaskName(processWorkFlowResponse.getTaskName());
// 流程阶段执行人员名称
entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator());
// 流程步骤
if(variables.containsKey("processReversalStep")){
String reversal = variables.get("processReversalStep").toString();
// 受理 reversal = 1
// 检修安全措施 reversal = 2
if("2".equals(reversal)){
if(variables.containsKey("measures")){
entity.setMeasures(variables.get("measures").toString());
}
if(variables.containsKey("measuresConfirmPersonnel")){
entity.setMeasuresConfirmPersonnel(variables.get("measuresConfirmPersonnel").toString());
}
}
// 危害因素及措施 reversal = 3
if("3".equals(reversal) && variables.containsKey("riskFactors")){
entity.setRiskFactors(variables.get("riskFactors").toString());
}
// 学习确认危险点 reversal = 4
if("4".equals(reversal)){
if(variables.containsKey("studyHead")){
entity.setStudyHead(variables.get("studyHead").toString());
}
if(variables.containsKey("studyMembers")){
entity.setStudyMembers(variables.get("studyMembers").toString());
}
}
// 审批签发 reversal = 5
if("5".equals(reversal) && variables.containsKey("issuePersonnel")){
entity.setIssueTime(new Date());
entity.setIssuePersonnel(variables.get("issuePersonnel").toString());
}
// 实际检修 reversal = 6
if("6".equals(reversal)){
if(ObjectUtil.isNotEmpty(variables.get("access"))){
// 检修延期
if((Boolean) variables.get("access")){
if(variables.containsKey("actStartTime")){
entity.setActStartTime(DateUtil.parse(variables.get("actStartTime").toString(),DateUtil.PATTERN_DATETIME));
}
if(variables.containsKey("actEndTime")){
entity.setActEndTime(DateUtil.parse(variables.get("actEndTime").toString(),DateUtil.PATTERN_DATETIME));
}
}else{
if(variables.containsKey("extensionTime")){
entity.setExtensionTime(DateUtil.parse(variables.get("extensionTime").toString(),DateUtil.PATTERN_DATETIME));
}
}
}
}
// 检修延期 reversal = 7
if("7".equals(reversal) && variables.containsKey("extensionPersonnel")){
entity.setExtensionPersonnel(variables.get("extensionPersonnel").toString());
}
// 检修验收 reversal = 8
if("8".equals(reversal) && variables.containsKey("checkPersonnel")){
entity.setCheckTime(new Date());
entity.setCheckPersonnel(variables.get("checkPersonnel").toString());
entity.setTaskName("流程结束");
entity.setNextStepOperator("流程结束,无需人员处理");
}
}
return this.updateById(entity);
}
/**
* 保存检修工作票
* @param param
*/
private AccessTicketEntity saveAccessTicket(AccessTicketStartProcessReqDTO param) {
// 查询设备信息
R<EmInfoEntity> device = deviceClient.getEmInfoByEmCode(param.getDeviceCode());
if(!device.isSuccess() || ObjectUtil.isEmpty(device.getData())){
throw new ServiceException("设备信息不存在!");
}
AccessTicketEntity entity = new AccessTicketEntity();
entity.setCode(UUID.randomUUID().toString());
entity.setIsExternal(param.getIsExternal());
entity.setIsEmergency(param.getIsEmergency());
entity.setDeviceCode(param.getDeviceCode());
entity.setDeviceName(device.getData().getName());
entity.setDeviceAddress(device.getData().getInsLocation());
entity.setFaultDescribe(param.getFaultDescribe());
// 图片
if(CollectionUtil.isNotEmpty(param.getImgs())){
entity.setImgs(JSONObject.toJSONString(param.getImgs()));
}
// 视频
if(CollectionUtil.isNotEmpty(param.getVideos())){
entity.setVideos(JSONObject.toJSONString(param.getVideos()));
}
entity.setStatus(0);
this.save(entity);
return entity;
}
/**
* 开启流程
* @param entity
*/
private boolean start(AccessTicketEntity entity) {
/* 并行人员设置
// 项目负责人
User header = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "accessTicketHead");
variables.put("charge","taskUser_" + header.getId());
// 许可人
User licensor = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "accessTicketLicensor");
variables.put("licensor","taskUser_" + licensor.getId());
// 外部单位负责人
User external = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "external");
variables.put("external","taskUser_" + external.getId());
// 设备负责人
User manage = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "deviceManage");
variables.put("manage","taskUser_" + manage.getId());
variables.put("persons", Arrays.asList("taskUser_" + header.getId(),"taskUser_" + licensor.getId(),"taskUser_" + external.getId(),"taskUser_" + manage.getId()));
*/
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class);
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(AccessTicketConstants.ACCESS_TICKET_PROCESS_KEY,
StringUtil.format("{}:{}",AccessTicketConstants.ACCESS_TICKET_TABLE, entity.getId()), DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME) +"_" + entity.getDeviceName() + "_检修工作票", variables);
log.info("access_ticket : start_process_result _ {}",result);
// 更新任务流程Id
if (!result.isSuccess() || 200 != result.getCode()) {
throw new ServiceException("开启流程失败!");
}
entity.setProcessInstanceId(result.getData().getProcessInstanceId());
return this.updateById(entity);
}
/**
* 获取当前机构指定角色的用户
* @param tenantId
* @param deptId
* @param alias
* @return
*/
public User queryRoleUser(String tenantId, Long deptId, String alias){
if(Func.isEmpty(tenantId)){
tenantId = AuthUtil.getTenantId();
}
R<List<User>> result = userClient.relationUserListByRoleAlias(tenantId, deptId, alias);
if(!result.isSuccess()){
throw new ServiceException("查询角色用户信息失败!");
}
return result.getData().get(0);
}
/**
* 检修工作票列表分页查询
* @param param
* @return
*/
@Override
public IPage<AccessTicketPageRspDTO> pageCondition(AccessTicketPageReqDTO param, Query query) {
return super.baseMapper.pageCondition(Condition.getPage(query),param);
}
/**
* 检修工作票详情查询
* @param param
* @return
*/
@Override
public AccessTicketDetailRspDTO detail(AccessTicketDetailReqDTO param) {
if(StringUtil.isEmpty(param.getProcessInstanceId())){
throw new ServiceException("参数错误!");
}
AccessTicketEntity entity = this.getOne(Wrappers.<AccessTicketEntity>lambdaQuery()
.eq(AccessTicketEntity::getProcessInstanceId,param.getProcessInstanceId())
);
return BeanUtil.copyProperties(entity,AccessTicketDetailRspDTO.class);
}
/**
* 检修工作票预览
* @param id
*/
@Override
public void preview(Long id) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
// 查询检修工作票记录
AccessTicketPreviewVo preview = this.previewParams(id);
// 参数对象
Map<String,Object> params = new HashMap<>();
try {
params = PdfUtils.objectToMap(preview);
log.info("preview_to_map : {}",params);
}catch (Exception e) {
log.info("转换对象失败!");
}
String fileName = preview.getDeviceName() + "_检修工作票.docx";
// 上传word文件至服务器
String path = WordUtils.uploadWord("/template/accessTicket/",saveWorkPath,params,"access_ticket_template",fileName);
// pdf文件存放路径
String pdfPath = savePdfPath + preview.getDeviceName() + "_检修工作票.pdf";
// 转换pdf
AsposeUtil.wordToPdf(path,pdfPath);
// 将文件流存放至response
PdfUtils.readPdf(response,pdfPath);
}
/**
* 检修工作票预览参数
* @param id
* @return
*/
private AccessTicketPreviewVo previewParams(Long id) {
AccessTicketEntity access = this.getById(id);
if(ObjectUtil.isEmpty(access)){
throw new ServiceException("未查询到检修工作票预览信息!");
}
AccessTicketPreviewVo params = new AccessTicketPreviewVo();
// 基础内容
params.setCode(access.getCode());
params.setDeviceName(access.getDeviceName());
params.setContent(access.getAccessContent());
params.setStandard(access.getQualityStandard());
params.setMemo(access.getMemo());
params.setStudyHead(access.getStudyHead());
// 作业危险类别
List<Dict> dicts = DictCache.getList("jobHazardCategory");
if(CollectionUtil.isNotEmpty(dicts)){
StringBuilder dangerous = new StringBuilder();
for (Dict dict : dicts){
if(StringUtils.isNotEmpty(access.getDangerous())){
if(access.getDangerous().contains(dict.getDictKey())){
dangerous.append(" ☑").append(dict.getDictValue());
}else{
dangerous.append(" □").append(dict.getDictValue());
}
}else{
dangerous.append(" □").append(dict.getDictValue());
}
}
params.setDangerous(dangerous.toString());
}
// 检修成员人数
if(StringUtils.isNotEmpty(access.getStudyMembers())){
String[] members = access.getStudyMembers().split(",");
params.setAccessCount(members.length);
params.setStudyMembers(access.getStudyMembers());
}
// 检修工作票创建时间
Calendar create = Calendar.getInstance();
create.setTime(access.getCreateTime());
params.setCreate(DateUtil.format(access.getCreateTime(),DateUtil.PATTERN_DATETIME));
params.setCy(create.get(Calendar.YEAR));
params.setCm(create.get(Calendar.MONTH));
params.setCday(create.get(Calendar.DAY_OF_MONTH));
// 计划开始检修时间
Calendar start = Calendar.getInstance();
start.setTime(access.getPlanStartTime());
params.setPsy(start.get(Calendar.YEAR));
params.setPsm(start.get(Calendar.MONTH));
params.setPsd(start.get(Calendar.DAY_OF_MONTH));
params.setPsh(start.get(Calendar.HOUR_OF_DAY));
params.setPsmi(start.get(Calendar.MINUTE));
// 计划结束检修时间
Calendar end = Calendar.getInstance();
end.setTime(access.getPlanEndTime());
params.setPey(end.get(Calendar.YEAR));
params.setPem(end.get(Calendar.MONTH));
params.setPed(end.get(Calendar.DAY_OF_MONTH));
params.setPeh(end.get(Calendar.HOUR_OF_DAY));
params.setPemi(end.get(Calendar.MINUTE));
// 签发时间
params.setIssuePersonnel(access.getIssuePersonnel());
Calendar issue = Calendar.getInstance();
issue.setTime(access.getIssueTime());
params.setIssy(issue.get(Calendar.YEAR));
params.setIssm(issue.get(Calendar.MONTH));
params.setIssd(issue.get(Calendar.DAY_OF_MONTH));
params.setIssh(issue.get(Calendar.HOUR_OF_DAY));
params.setIssmi(issue.get(Calendar.MINUTE));
// 延期时间
if(StringUtils.isEmpty(access.getExtensionPersonnel())){
params.setExtensionPersonnel("/");
}else {
params.setExtensionPersonnel(access.getExtensionPersonnel());
}
if(ObjectUtil.isEmpty(access.getExtensionTime())){
params.setEy("/");
params.setEm("/");
params.setEd("/");
params.setEh("/");
params.setEmi("/");
}else {
Calendar extens = Calendar.getInstance();
params.setIssuePersonnel(access.getIssuePersonnel());
extens.setTime(access.getExtensionTime());
params.setEy(String.valueOf(extens.get(Calendar.YEAR)));
params.setEm(String.valueOf(extens.get(Calendar.MONTH)));
params.setEd(String.valueOf(extens.get(Calendar.DAY_OF_MONTH)));
params.setEh(String.valueOf(extens.get(Calendar.HOUR_OF_DAY)));
params.setEmi(String.valueOf(extens.get(Calendar.MINUTE)));
}
// 验收时间
params.setCheckPersonnel(access.getCheckPersonnel());
Calendar check = Calendar.getInstance();
check.setTime(access.getCheckTime());
params.setChy(check.get(Calendar.YEAR));
params.setChm(check.get(Calendar.MONTH));
params.setChd(check.get(Calendar.DAY_OF_MONTH));
params.setChh(check.get(Calendar.HOUR_OF_DAY));
params.setChmi(check.get(Calendar.MINUTE));
return params;
}
/**
* 撤销报修
* @param ticketId
* @return
*/
@Override
public boolean revoke(Long ticketId) {
AccessTicketEntity entity = this.getOne(Wrappers.<AccessTicketEntity>lambdaQuery()
.eq(AccessTicketEntity::getId,ticketId));
if(ObjectUtil.isEmpty(entity)){
throw new ServiceException("未查询到报修单信息!");
}
if(entity.getStatus() == 1){
throw new ServiceException("报修单已撤销,请勿重复撤销!");
}
if(!"受理 (工作负责人)".equals(entity.getTaskName())){
throw new ServiceException("报修单已受理,无法撤销!");
}
return this.update(Wrappers.<AccessTicketEntity>lambdaUpdate()
.set(AccessTicketEntity::getStatus,1)
.eq(AccessTicketEntity::getId,ticketId)
);
}
}

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java

@ -104,7 +104,7 @@ public class PdfUtils {
*/ */
public static Map<String, Object> objectToMap(Object obj) { public static Map<String, Object> objectToMap(Object obj) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (ObjectUtil.isNotEmpty(obj) && null != obj.getClass()) { if (ObjectUtil.isNotEmpty(obj)) {
Class clazz = obj.getClass(); Class clazz = obj.getClass();
List<Field> fieldList = new ArrayList<>(); List<Field> fieldList = new ArrayList<>();
while (clazz != null) { while (clazz != null) {

BIN
hzims-service/ticket/src/main/resources/template/accessTicket/access_ticket_template.docx

Binary file not shown.
Loading…
Cancel
Save