Browse Source

# 日常维护计划根据机构筛选

# 两票bug
# 设备生命周期bug
zhongwei
haungxing 1 year ago
parent
commit
61bf757c4e
  1. 21
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/WorkTicketConstants.java
  2. 6
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml
  3. 2
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java
  4. 1
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  5. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceMonitorReportMonthDTO.java
  6. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceMonitorServiceImpl.java
  7. 34
      hzims-service/operational/src/main/resources/files/日常维护流程.bpmn20.xml
  8. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
  9. 9
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/utils/OperationWordHelper.java
  10. 53
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/OfflineTicketController.java
  11. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml
  12. 15
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IOfflineTicketService.java
  13. 206
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java
  14. 1
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
  15. BIN
      hzims-service/ticket/src/main/resources/template/~$第一种工作票模版.docx
  16. BIN
      hzims-service/ticket/src/main/resources/template/停机操作票.docx
  17. BIN
      hzims-service/ticket/src/main/resources/template/开机操作票.docx
  18. BIN
      hzims-service/ticket/src/main/resources/template/电气操作票.docx

21
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/WorkTicketConstants.java

@ -83,4 +83,25 @@ public interface WorkTicketConstants {
return statusOptional.orElse(null); return statusOptional.orElse(null);
} }
} }
@AllArgsConstructor
enum TicketSignageEnum {
/**第一种工作票**/
FIRST("6","D1"),
/**第二种工作票**/
SECOND("7","D2"),
/**机械工作票**/
MACHINE("8","JX"),
;
@Getter
private String ticketType;
@Getter
private String signage;
public static String getTicketSignageByType(String ticketType) {
Optional<TicketSignageEnum> exist = Arrays.stream(TicketSignageEnum.class.getEnumConstants())
.filter(e -> ticketType.equals(e.getTicketType())).findFirst();
return exist.map(TicketSignageEnum::getSignage).orElse(null);
}
}
} }

6
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml

@ -126,9 +126,9 @@
from hzims_em_info info from hzims_em_info info
LEFT JOIN hzims_em_tree tree ON info.tree_id = tree.id LEFT JOIN hzims_em_tree tree ON info.tree_id = tree.id
LEFT JOIN hzims_em_tree_basic etb ON tree.id = etb.tree_id LEFT JOIN hzims_em_tree_basic etb ON tree.id = etb.tree_id
LEFT JOIN hzims_assets.wt_sp_basic basic ON etb.basic_id = basic.id LEFT JOIN `hzims-assets`.wt_sp_basic basic ON etb.basic_id = basic.id
LEFT JOIN hzims_assets.wt_sp_total total ON basic.id = total.SP_BASIC_ID LEFT JOIN `hzims-assets`.wt_sp_total total ON basic.id = total.SP_BASIC_ID
LEFT JOIN hzims_assets.wt_sp_warehouse house ON total.WAREHOUSE_ID = house.id LEFT JOIN `hzims-assets`.wt_sp_warehouse house ON total.WAREHOUSE_ID = house.id
LEFT JOIN hzims_operation.hzims_oper_access_material mat ON basic.id = mat.SP_BASIC_ID LEFT JOIN hzims_operation.hzims_oper_access_material mat ON basic.id = mat.SP_BASIC_ID
<where> <where>
<if test="path != null"> <if test="path != null">

2
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

@ -78,7 +78,7 @@ public class MessagePushRecordController extends BladeController {
public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") String id) { public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") String id) {
MessagePushRecordEntity record = messagePushRecordService.getById(id); MessagePushRecordEntity record = messagePushRecordService.getById(id);
if (!(Long.parseLong(record.getPusher()) == AuthUtil.getUserId())) { if (!(Long.parseLong(record.getPusher()) == AuthUtil.getUserId())) {
return R.fail("当前登录人不是消息推送人,修改状态失败"); return R.fail("当前登录人不是消息接收人,修改状态失败");
} }
LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate() LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate()
.set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM)

1
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -366,6 +366,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
QueryWrapper<MessagePushRecordEntity> query = Wrappers.query(); QueryWrapper<MessagePushRecordEntity> query = Wrappers.query();
query.select("business_classify businessClassify,count(0) todoNum"); query.select("business_classify businessClassify,count(0) todoNum");
query.eq("pusher", AuthUtil.getUserId()); query.eq("pusher", AuthUtil.getUserId());
query.eq("type", MessageConstants.WS_PUSH);
query.in("status", Lists.newArrayList(MessageConstants.PUSH_SUCCESS)); query.in("status", Lists.newArrayList(MessageConstants.PUSH_SUCCESS));
query.groupBy("business_classify"); query.groupBy("business_classify");
List<Map<String, Object>> list = noAurhScopeMapper.selectMaps(query); List<Map<String, Object>> list = noAurhScopeMapper.selectMaps(query);

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceMonitorReportMonthDTO.java

@ -24,9 +24,7 @@ public class OperMaintenanceMonitorReportMonthDTO implements Serializable {
@ApiModelProperty(value = "月", required = true) @ApiModelProperty(value = "月", required = true)
private Integer month; private Integer month;
@ApiModelProperty(value = "机构ID")
private Long deptId;
/**
* 站点code
*/
private String stationCode;
} }

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceMonitorServiceImpl.java

@ -46,11 +46,10 @@ public class OperMaintenanceMonitorServiceImpl implements IOperMaintenanceMonito
public R<Map<String, List<OperMaintenancePlanVO>>> reportMonth(OperMaintenanceMonitorReportMonthDTO req) { public R<Map<String, List<OperMaintenancePlanVO>>> reportMonth(OperMaintenanceMonitorReportMonthDTO req) {
List<OperMaintenancePlanEntity> planEntities = planMapper.selectList(new LambdaQueryWrapper<OperMaintenancePlanEntity>() {{ List<OperMaintenancePlanEntity> planEntities = planMapper.selectList(new LambdaQueryWrapper<OperMaintenancePlanEntity>() {{
LocalDate startDate = LocalDate.of(req.getYear(), req.getMonth(), 1); LocalDate startDate = LocalDate.of(req.getYear(), req.getMonth(), 1);
// Date startTime = DateUtil.parse(DateUtil.format(DateUtil.now(), "yyyy-MM") + "-01", DateUtil.PATTERN_DATE);
eq(OperMaintenancePlanEntity::getIsDeleted, 0L); eq(OperMaintenancePlanEntity::getIsDeleted, 0L);
ge(OperMaintenancePlanEntity::getDisposeTime, startDate); ge(OperMaintenancePlanEntity::getDisposeTime, startDate);
lt(OperMaintenancePlanEntity::getDisposeTime, startDate.with(TemporalAdjusters.lastDayOfMonth())) lt(OperMaintenancePlanEntity::getDisposeTime, startDate.with(TemporalAdjusters.lastDayOfMonth()));
.eq(StringUtils.isNoneBlank(req.getStationCode()), OperMaintenancePlanEntity::getStationCode, req.getStationCode()); eq(Func.isNotEmpty(req.getDeptId()), OperMaintenancePlanEntity::getCreateDept, req.getDeptId());
}}); }});
//获取列表班次ID集合 //获取列表班次ID集合

34
hzims-service/operational/src/main/resources/files/日常维护流程.bpmn20.xml

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler" exporterVersion="6.7.2"> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef">
<process id="maintenance_test" name="日常维护流程" isExecutable="true"> <process id="maintenance_test" name="日常维护流程" isExecutable="true">
<startEvent id="startEvent1" name="开始" flowable:formFieldValidation="true"></startEvent> <startEvent id="startEvent1" name="开始"></startEvent>
<userTask id="recipients" name="待领用" flowable:candidateUsers="${initUserIds}" flowable:formFieldValidation="true"> <userTask id="recipients" name="待领用" flowable:candidateUsers="${initUserIds},${initUserIds1},${initUserIds2},${initUserIds3},${initUserIds4}">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="1"></flowable:formProperty> <flowable:formProperty id="new_property_1" type="string" default="1"></flowable:formProperty>
</extensionElements> </extensionElements>
</userTask> </userTask>
<sequenceFlow id="sid-3FCA35BC-0503-4271-AA94-FE95E1FB8AE9" sourceRef="startEvent1" targetRef="recipients"></sequenceFlow> <sequenceFlow id="sid-3FCA35BC-0503-4271-AA94-FE95E1FB8AE9" sourceRef="startEvent1" targetRef="recipients"></sequenceFlow>
<userTask id="perform" name="待执行" flowable:candidateUsers="${recipientsUserId}" flowable:formFieldValidation="true"> <userTask id="perform" name="待执行" flowable:candidateUsers="${recipientsUserId}">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="2"></flowable:formProperty> <flowable:formProperty id="new_property_1" type="string" default="2"></flowable:formProperty>
</extensionElements> </extensionElements>
</userTask> </userTask>
<sequenceFlow id="sid-25CDE498-E307-4867-978A-C6B4072880C0" sourceRef="recipients" targetRef="perform"></sequenceFlow> <sequenceFlow id="sid-25CDE498-E307-4867-978A-C6B4072880C0" sourceRef="recipients" targetRef="perform"></sequenceFlow>
<userTask id="confirmed" name="待确认" flowable:candidateGroups="maintainArchiver" flowable:formFieldValidation="true"> <userTask id="confirmed" name="待确认" flowable:candidateGroups="maintainArchiver">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="3"></flowable:formProperty> <flowable:formProperty id="new_property_1" type="string" default="3"></flowable:formProperty>
<flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener> <flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener>
</extensionElements> </extensionElements>
</userTask> </userTask>
<sequenceFlow id="sid-EE867885-A4F9-4C9D-8C0D-48FA8CE07CB7" sourceRef="perform" targetRef="confirmed"></sequenceFlow> <sequenceFlow id="sid-EE867885-A4F9-4C9D-8C0D-48FA8CE07CB7" sourceRef="perform" targetRef="confirmed"></sequenceFlow>
<userTask id="archive" name="待归档" flowable:candidateGroups="maintainArchiver" flowable:formFieldValidation="true"> <userTask id="archive" name="待归档" flowable:candidateGroups="maintainArchiver">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="4"></flowable:formProperty> <flowable:formProperty id="new_property_1" type="string" default="4"></flowable:formProperty>
<flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener> <flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener>
@ -51,25 +51,25 @@
<bpmndi:BPMNShape bpmnElement="sid-F998D585-DC6D-477D-B421-97687857C17D" id="BPMNShape_sid-F998D585-DC6D-477D-B421-97687857C17D"> <bpmndi:BPMNShape bpmnElement="sid-F998D585-DC6D-477D-B421-97687857C17D" id="BPMNShape_sid-F998D585-DC6D-477D-B421-97687857C17D">
<omgdc:Bounds height="28.0" width="28.0" x="1064.9999682605276" y="164.99999508261695"></omgdc:Bounds> <omgdc:Bounds height="28.0" width="28.0" x="1064.9999682605276" y="164.99999508261695"></omgdc:Bounds>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-25CDE498-E307-4867-978A-C6B4072880C0" id="BPMNEdge_sid-25CDE498-E307-4867-978A-C6B4072880C0" flowable:sourceDockerX="50.00000000000006" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.00000000000006" flowable:targetDockerY="40.0"> <bpmndi:BPMNEdge bpmnElement="sid-25CDE498-E307-4867-978A-C6B4072880C0" id="BPMNEdge_sid-25CDE498-E307-4867-978A-C6B4072880C0">
<omgdi:waypoint x="324.9499618712084" y="174.99998535583651"></omgdi:waypoint> <omgdi:waypoint x="324.9499618712084" y="174.99998535583651"></omgdi:waypoint>
<omgdi:waypoint x="434.9999296843891" y="174.99998435913477"></omgdi:waypoint> <omgdi:waypoint x="434.9999296843891" y="174.99998435913477"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-3FCA35BC-0503-4271-AA94-FE95E1FB8AE9" id="BPMNEdge_sid-3FCA35BC-0503-4271-AA94-FE95E1FB8AE9" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.00000000000006" flowable:targetDockerY="40.0"> <bpmndi:BPMNEdge bpmnElement="sid-3FCA35BC-0503-4271-AA94-FE95E1FB8AE9" id="BPMNEdge_sid-3FCA35BC-0503-4271-AA94-FE95E1FB8AE9">
<omgdi:waypoint x="129.94999525015476" y="178.0"></omgdi:waypoint> <omgdi:waypoint x="129.9499953257868" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="177.0" y="178.0"></omgdi:waypoint> <omgdi:waypoint x="177.5" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="224.99996293675153" y="176.52907525285667"></omgdi:waypoint> <omgdi:waypoint x="224.999962936752" y="176.5369167401666"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-B5C6DD93-E792-4665-A26A-0AC9F0283507" id="BPMNEdge_sid-B5C6DD93-E792-4665-A26A-0AC9F0283507" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0"> <bpmndi:BPMNEdge bpmnElement="sid-B5C6DD93-E792-4665-A26A-0AC9F0283507" id="BPMNEdge_sid-B5C6DD93-E792-4665-A26A-0AC9F0283507">
<omgdi:waypoint x="954.9498980760601" y="174.5238036636941"></omgdi:waypoint> <omgdi:waypoint x="954.949898076065" y="174.99998793006014"></omgdi:waypoint>
<omgdi:waypoint x="1010.0" y="174.0"></omgdi:waypoint> <omgdi:waypoint x="1010.0" y="174.99998793006014"></omgdi:waypoint>
<omgdi:waypoint x="1065.033397606662" y="177.9881121222554"></omgdi:waypoint> <omgdi:waypoint x="1065.0002906665932" y="177.79137546531493"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-EE867885-A4F9-4C9D-8C0D-48FA8CE07CB7" id="BPMNEdge_sid-EE867885-A4F9-4C9D-8C0D-48FA8CE07CB7" flowable:sourceDockerX="50.00000000000006" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0"> <bpmndi:BPMNEdge bpmnElement="sid-EE867885-A4F9-4C9D-8C0D-48FA8CE07CB7" id="BPMNEdge_sid-EE867885-A4F9-4C9D-8C0D-48FA8CE07CB7">
<omgdi:waypoint x="534.949933503666" y="174.99998493733443"></omgdi:waypoint> <omgdi:waypoint x="534.949933503666" y="174.99998493733443"></omgdi:waypoint>
<omgdi:waypoint x="629.9998873472333" y="174.99998689844116"></omgdi:waypoint> <omgdi:waypoint x="629.9998873472333" y="174.99998689844116"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-603F6431-BFD2-4D82-92FB-D9847CEE7562" id="BPMNEdge_sid-603F6431-BFD2-4D82-92FB-D9847CEE7562" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0"> <bpmndi:BPMNEdge bpmnElement="sid-603F6431-BFD2-4D82-92FB-D9847CEE7562" id="BPMNEdge_sid-603F6431-BFD2-4D82-92FB-D9847CEE7562">
<omgdi:waypoint x="729.9498873472332" y="174.99998793006014"></omgdi:waypoint> <omgdi:waypoint x="729.9498873472332" y="174.99998793006014"></omgdi:waypoint>
<omgdi:waypoint x="854.999898076001" y="174.99998793006014"></omgdi:waypoint> <omgdi:waypoint x="854.999898076001" y="174.99998793006014"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java

@ -505,8 +505,8 @@ public class OperationTicketServiceImpl implements OperationTicketService {
map.put("index", index.get()); map.put("index", index.get());
map.put("status", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : ""); map.put("status", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : "");
// map.put("operationTime", measure.getOperationTime()); // map.put("operationTime", measure.getOperationTime());
map.put("hello", ""); map.put("hello", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : "");
map.put("hello1", ""); map.put("hello1", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : "");
index.getAndIncrement(); index.getAndIncrement();
measureMapLists.add(map); measureMapLists.add(map);
} }

9
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/utils/OperationWordHelper.java

@ -40,10 +40,13 @@ public class OperationWordHelper {
* @return * @return
*/ */
public static String getWorkTicketStatus(Integer status) { public static String getWorkTicketStatus(Integer status) {
String result = null; String result;
switch (status) { switch (status) {
case 1: case 4:
result = "电气操作票.docx"; result = "开机操作票.docx";
break;
case 5:
result = "停机操作票.docx";
break; break;
default: default:
result = "电气操作票.docx"; result = "电气操作票.docx";

53
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/OfflineTicketController.java

@ -0,0 +1,53 @@
package com.hnac.hzims.ticket.workTicket.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.service.IOfflineTicketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName OfflineTicketController
* @description: 线下工作票管理
* @author: hx
* @create: 2023-09-14 10:36
* @Version 4.0
**/
@RestController
@RequestMapping("/offline/ticket")
@AllArgsConstructor
@Api(value = "线下工作票管理")
public class OfflineTicketController extends BladeController {
private final IOfflineTicketService offlineTicketService;
@PostMapping("/invoicing")
@ApiOperation("线下工作票开票")
@ApiOperationSupport(order = 1)
public R invoicing(@RequestBody WorkTicketInfoDto dto) {
return R.status(offlineTicketService.invoicing(dto));
}
@PostMapping("/licenseOfflineTicket")
@ApiOperation("线下工作票线下处理")
@ApiOperationSupport(order = 2)
public R licenseOfflineTicket(@RequestBody WorkTicketInfoDto dto) {
return R.status(offlineTicketService.licenseOfflineTicket(dto));
}
@PostMapping("/finishOfflineTicket")
@ApiOperation("线下工作票终结")
@ApiOperationSupport(order = 3)
public R finishOfflineTicket(@RequestBody WorkTicketInfoDto dto) {
return R.status(offlineTicketService.finishOfflineTicket(dto));
}
}

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml

@ -92,7 +92,7 @@
(select count(*) from hzims_ticket_info_evaluate e where evaluate = '合格!' and e.id = eval.id) as qualified (select count(*) from hzims_ticket_info_evaluate e where evaluate = '合格!' and e.id = eval.id) as qualified
from hzims_work_ticket_info info from hzims_work_ticket_info info
LEFT JOIN hzims_ticket_info_evaluate eval ON info.id = eval.ticket_id LEFT JOIN hzims_ticket_info_evaluate eval ON info.id = eval.ticket_id
LEFT JOIN equipment.hzims_em_info em ON info.em_code = em.NUMBER LEFT JOIN `equipment`.hzims_em_info em ON info.em_code = em.NUMBER
<where> <where>
<if test="path != null"> <if test="path != null">
em.path like CONCAT(#{path},'%') em.path like CONCAT(#{path},'%')

15
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IOfflineTicketService.java

@ -0,0 +1,15 @@
package com.hnac.hzims.ticket.workTicket.service;
import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import org.springblade.core.mp.base.BaseService;
public interface IOfflineTicketService extends BaseService<WorkTicketInfoEntity> {
boolean invoicing(WorkTicketInfoDto dto);
boolean licenseOfflineTicket(WorkTicketInfoDto dto);
boolean finishOfflineTicket(WorkTicketInfoDto dto);
}

206
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java

@ -0,0 +1,206 @@
package com.hnac.hzims.ticket.workTicket.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.constants.WorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketContentEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketFlowEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketSafetyMeasureEntity;
import com.hnac.hzims.ticket.workTicket.mapper.WorkTicketInfoMapper;
import com.hnac.hzims.ticket.workTicket.service.IOfflineTicketService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketContentService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketFlowService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketSafetyMeasureService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
/**
* @ClassName OfflineTicketServiceImpl
* @description: 线下工作票service类
* @author: hx
* @create: 2023-09-13 14:00
* @Version 4.0
**/
@AllArgsConstructor
@Service
@Slf4j
public class OfflineTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMapper, WorkTicketInfoEntity> implements IOfflineTicketService {
private final IStationClient stationClient;
private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService;
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IWorkTicketFlowService workTicketFlowService;
/**
* 线下工作票开票
* @param dto 工作票开票内容
* @return 开票结果
*/
@Override
public boolean invoicing(WorkTicketInfoDto dto) {
WorkTicketInfoEntity ticketInfoEntity = BeanUtil.copy(dto,WorkTicketInfoEntity.class);
ticketInfoEntity.setCode(this.getTicketCode(ticketInfoEntity.getType(),ticketInfoEntity.getSignageCode()));
ticketInfoEntity.setStatus(WorkTicketConstants.FirstWorkTicketStatusEnum.OFFLINE_OPERATE.getStatus());
ticketInfoEntity.setFlowTaskName(WorkTicketConstants.FirstWorkTicketStatusEnum.OFFLINE_OPERATE.getDescription());
String userName = this.getLicensorNameByDept(Long.parseLong(AuthUtil.getDeptId()));
ticketInfoEntity.setStepOperator(userName);
ticketInfoEntity.setNextStepOperator(userName);
if(this.save(ticketInfoEntity)) {
Long ticketId = ticketInfoEntity.getId();
// 保存安全措施
if(CollectionUtil.isNotEmpty(dto.getWorkTicketSafetyMeasureDtoList())) {
List<WorkTicketSafetyMeasureEntity> measureList = JSONArray.parseArray(JSON.toJSONString(dto.getWorkTicketSafetyMeasureDtoList()), WorkTicketSafetyMeasureEntity.class);
measureList.forEach(m -> m.setTicketId(ticketId));
workTicketSafetyMeasureService.saveBatch(measureList);
}
// 保存工作任务
if(CollectionUtil.isNotEmpty(dto.getWorkTicketContentDtoList())) {
List<WorkTicketContentEntity> contentList = JSONArray.parseArray(JSON.toJSONString(dto.getWorkTicketContentDtoList()), WorkTicketContentEntity.class);
contentList.forEach(c -> c.setTicketId(ticketId));
contentService.saveBatch(contentList);
}
return true;
}
return false;
}
/**
* 线下执行任务
* @param dto 工作票传参
* @return 执行成功与否
*/
@Override
public boolean licenseOfflineTicket(WorkTicketInfoDto dto) {
String userName = this.getLicensorNameByDept(Long.parseLong(AuthUtil.getDeptId()));
LambdaUpdateWrapper<WorkTicketInfoEntity> updateWrapper = Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getStatus, WorkTicketConstants.FirstWorkTicketStatusEnum.OFFLINE_LICENSE.getStatus())
.set(WorkTicketInfoEntity::getLicensor, AuthUtil.getUserId())
.set(WorkTicketInfoEntity::getLicenseTime, LocalDateTime.now())
.set(WorkTicketInfoEntity::getLicenseEndTime, dto.getLicenseEndTime())
.set(WorkTicketInfoEntity::getStepOperator, userName)
.set(WorkTicketInfoEntity::getNextStepOperator, userName)
.eq(WorkTicketInfoEntity::getId, dto.getId());
if(this.update(updateWrapper)) {
// 添加流程消息
WorkTicketFlowEntity flowEntity = new WorkTicketFlowEntity();
flowEntity.setTicketId(dto.getId());
flowEntity.setFlowCode(WorkTicketConstants.FirstWorkTicketStatusEnum.OFFLINE_OPERATE.getStatus().toString());
flowEntity.setFirstValue(dto.getLicenseImgUrls());
flowEntity.setSecondValue(dto.getLicenseImgFilenames());
workTicketFlowService.save(flowEntity);
return true;
}
return false;
}
/**
* 线下许可人许可
* @param dto 工作票传参
* @return 执行成功与否
*/
@Override
public boolean finishOfflineTicket(WorkTicketInfoDto dto) {
String userName = this.getLicensorNameByDept(Long.parseLong(AuthUtil.getDeptId()));
LambdaUpdateWrapper<WorkTicketInfoEntity> updateWrapper = Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getStatus, WorkTicketConstants.FirstWorkTicketStatusEnum.OFFLINE_END.getStatus())
.set(WorkTicketInfoEntity::getStepOperator, userName)
.set(WorkTicketInfoEntity::getNextStepOperator, null)
.eq(WorkTicketInfoEntity::getId, dto.getId());
//添加流程信息
if(this.update(updateWrapper)) {
WorkTicketFlowEntity flowEntity = new WorkTicketFlowEntity();
flowEntity.setTicketId(dto.getId());
flowEntity.setFlowCode(WorkTicketConstants.FirstWorkTicketStatusEnum.OFFLINE_LICENSE.getStatus().toString());
flowEntity.setFirstValue(dto.getFinishImgUrls());
flowEntity.setSecondValue(dto.getFinishImgFilenames());
workTicketFlowService.save(flowEntity);
return true;
}
return false;
}
/**
* 获取工作票票据编号
* @param ticketType 票据类型
* @param stationCode 站点编号
* @return 工作票票据编号
*/
private String getTicketCode(String ticketType ,String stationCode) {
String result = "";
String signage = WorkTicketConstants.TicketSignageEnum.getTicketSignageByType(ticketType);
Assert.isTrue(Func.isNotBlank(signage),() -> {
throw new ServiceException("获取工作票编号失败!");
});
StationEntity station = new StationEntity();
station.setCode(stationCode);
R<StationEntity> stationR = stationClient.getOne(station);
Assert.isTrue(stationR.isSuccess() && ObjectUtil.isNotEmpty(stationR.getData()) && Func.isNotEmpty(stationR.getData().getSignage()),() -> {
throw new ServiceException("该工作票站点下未获取到两票抬头!");
});
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM");
String yearMonth = YearMonth.now().format(formatter);
Lock lock = new ReentrantLock();
lock.lock();
try {
LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59);
List<WorkTicketInfoEntity> ticketList = this.list(
Wrappers.<WorkTicketInfoEntity>lambdaQuery().eq(WorkTicketInfoEntity::getType, ticketType).eq(WorkTicketInfoEntity::getSignageCode, stationCode)
.ge(WorkTicketInfoEntity::getCreateTime,firstDay).le(WorkTicketInfoEntity::getCreateTime,lastDay)
);
String suffix = "-" + String.format(String.format("%03d",ticketList.size()+1));
result = stationR.getData().getSignage() + "-" + signage + "-" + yearMonth + "-" + suffix;
}
finally {
lock.unlock();
}
return result;
}
/**
* 获取机构下许可人名称
* @param deptId 机构ID
* @return 许可人名称按逗号分隔
*/
private String getLicensorNameByDept(Long deptId) {
R<List<User>> usersR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),deptId, TicketConstants.LICENSOR_ROLE);
if(usersR.isSuccess() && CollectionUtil.isNotEmpty(usersR.getData())) {
return usersR.getData().stream().map(User::getId).map(UserCache::getUser).map(User::getName).collect(Collectors.joining(","));
}
return "";
}
}

1
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -1120,6 +1120,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
throw new ServiceException("设备信息查询异常"); throw new ServiceException("设备信息查询异常");
} }
EmInfoEntity emInfo = emInfoEntityR.getData(); EmInfoEntity emInfo = emInfoEntityR.getData();
List<WorkTicketBillVO> workTicketBillList = baseMapper.getWorkTicketBill(emInfo.getPath(), startTime, endTime); List<WorkTicketBillVO> workTicketBillList = baseMapper.getWorkTicketBill(emInfo.getPath(), startTime, endTime);
return workTicketBillList; return workTicketBillList;
} }

BIN
hzims-service/ticket/src/main/resources/template/~$第一种工作票模版.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/停机操作票.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/开机操作票.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/电气操作票.docx

Binary file not shown.
Loading…
Cancel
Save