Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 3 months ago
parent
commit
8b514da185
  1. 2
      hzims-service/assets/src/main/resources/template/template.yml
  2. 21
      hzims-service/equipment/src/main/resources/template/template.yml
  3. 27
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java
  4. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java
  5. 9
      hzims-service/hzims-alarm/src/main/resources/template/template.yml
  6. 2
      hzims-service/hzims-basic/src/main/resources/template/template.yml
  7. 14
      hzims-service/hzims-big-model/src/main/resources/template/template.yml
  8. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
  9. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/feign/CompensateProcessClient.java
  10. 49
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java
  11. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java
  12. 2
      hzims-service/hzims-middle/src/main/resources/template/template.yml
  13. 14
      hzims-service/hzims-scheduled/src/main/resources/template/template.yml
  14. 2
      hzims-service/inspect/src/main/resources/template/template.yml
  15. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  16. 29
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  17. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java
  18. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java
  19. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
  20. 41
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  21. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/feign/DutyRecClient.java
  22. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyRecQRRecordMapper.java
  23. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  24. 49
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  25. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java
  26. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
  27. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java
  28. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java
  29. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java
  30. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/workOrder/controller/DistributeWorkOrderController.java
  31. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/workOrder/service/IDistributeWorkOrderService.java
  32. 151
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/workOrder/service/impl/DistributeWorkOrderServiceImpl.java
  33. 2
      hzims-service/operational/src/main/resources/db/3.0.1.sql
  34. 14
      hzims-service/operational/src/main/resources/template/template.yml
  35. 61
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java
  36. 32
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java
  37. 4
      hzims-service/safeproduct/src/main/resources/template/template.yml
  38. 56
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java
  39. 71
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
  40. 79
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  41. 4
      hzims-service/ticket/src/main/resources/db/3.0.0.sql
  42. 2
      hzims-service/ticket/src/main/resources/template/template.yml
  43. 2
      hzims-service/weather/src/main/resources/template/template.yml

2
hzims-service/assets/src/main/resources/template/template.yml

@ -13,7 +13,7 @@ spring:
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_assets?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-assets?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
#swagger扫描路径配置

21
hzims-service/equipment/src/main/resources/template/template.yml

@ -12,23 +12,23 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
slave:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
inspect:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
hzims:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
bladex:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
@ -89,9 +89,14 @@ blade:
data:
sdk:
enabled: true
url: http://${hzims.sdk.ip}/api/hzinfo-data-config
appId: ${hzims.sdk.appId}
appSecret: ${hzims.sdk.appSecret}
url: "http://${hzims.sdk.ip}/api/hzinfo-data-config"
ctrlUrl: "http://${hzims.sdk.ip}/api/hzinfo-data-handler"
appId: "${hzims.sdk.appId}"
appSecret: "${hzims.sdk.appSecret}"
redisIp: "${hzinfo.redis.ip}"
redisPort: ${hzinfo.redis.port}
password: "${hzinfo.redis.password}"
maxKeys: 1000
data-scope:
enabled: false

27
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java

@ -2,6 +2,8 @@ package com.hnac.hzims.alarm.show.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant;
@ -13,6 +15,7 @@ import com.hnac.hzims.alarm.show.service.AlarmHandleFlowService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@ -63,6 +66,9 @@ public class AlarmHandleFlowServiceImpl extends ServiceImpl<AlarmHandleFlowMappe
log.info("告警消息转换失败:" + e.getMessage());
return R.fail("告警消息转换失败");
}
if (ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
return handException(processWorkFlowResponse);
}
taskId = alarmHandleFlowEntity.getId();
alarmHandleFlowEntity.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
@ -122,14 +128,29 @@ public class AlarmHandleFlowServiceImpl extends ServiceImpl<AlarmHandleFlowMappe
}
this.updateById(alarmHandleFlowEntity);
//推送消息中心相关消息
if(ObjectUtils.isEmpty(processWorkFlowResponse.getCode())||700!=processWorkFlowResponse.getCode()) {
sendMessage(processWorkFlowResponse, alarmHandleFlowEntity, taskId);
}
log.info("告警消息转换结束" + processWorkFlowResponse);
return R.success("消息保存成功");
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("补偿流程处理失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("补偿流程处理失败");
}
AlarmHandleFlowEntity alarmHandleFlowEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<AlarmHandleFlowEntity>() {{
eq(AlarmHandleFlowEntity::getId, split[1]);
}});
alarmHandleFlowEntity.setIsNormal(false);
alarmHandleFlowEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
alarmHandleFlowEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
alarmHandleFlowEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
alarmHandleFlowEntity.setCurrentLinkHandler("");
this.baseMapper.updateById(alarmHandleFlowEntity);
log.info("补偿流程消息转换结束"+ processWorkFlowResponse);
return R.success("补偿流程消息保存成功");
}
private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, AlarmHandleFlowEntity alarmHandleFlowEntity, Long taskId) {
//推送消息
if (processWorkFlowResponse.getTaskId() != null) {

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java

@ -159,9 +159,9 @@ public class AlarmHandleServiceImpl extends ServiceImpl<AlarmHandleMapper, Alarm
}
R result = compensateProcessClient.startFlow(AuthUtil.getUserId().toString(),AlarmHandleConstant.dealAlarm, businessKey, processName, variables);
// 流程开启失败
if (200!=result.getCode()) {
if (ObjectUtils.isNotEmpty(result.getCode())&&200!=result.getCode()) {
param.setIsNormal(false);
param.setRemark(JSONObject.toJSONString(variable));
param.setRemark(variable);
alarmHandleFlowMapper.updateById(param);
R r=new R();
r.setCode(result.getCode());

9
hzims-service/hzims-alarm/src/main/resources/template/template.yml

@ -9,7 +9,7 @@ spring:
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_alarm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_alarm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
@ -36,11 +36,12 @@ hzims:
password: ${hzinfo.mq.password}
msg:
template: aliyun-alarm-sms
enabled: false
enabled: true
wxPush:
template: hIgINCsjpG-gyCKh8wzwBeRL9tanTLqRDgv-X8B9vyc
enabled: false
enabled: true
url:
getFaultGraphInfo: http://${hzims.fdp.url.ip}:${hzims.fdp.url.port}/diagnose/getFaultGraphInfo
logging:
level:

2
hzims-service/hzims-basic/src/main/resources/template/template.yml

@ -8,7 +8,7 @@ spring:
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_basic?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-basic?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}

14
hzims-service/hzims-big-model/src/main/resources/template/template.yml

@ -11,31 +11,31 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/test_hzims_big_model?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_big_model?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
operation:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.60.34:3576/hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
equipment:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.60.34:3576/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
ticket:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.60.34:3576/hzims-ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
safeproduct:
url: jdbc:mysql://192.168.60.34:3576/test_hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.60.34:3576/hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
inspect:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.60.34:3576/hzims-inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
alarm:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_alarm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.60.34:3576/hzims_alarm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
information:

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java

@ -49,8 +49,8 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
throw new ServiceException("消息转换失败,消息内容为:" + message);
});
if (ObjectUtils.isNotEmpty(response.getCode())&&700==response.getCode()){
ticketServiceList.get(0).pushFailMessage(Long.valueOf(response.getTaskId()),response.getBusinessKey(),
response.getUserId(), response.getTaskName(),response.getResult(),response.getDeptId());
ticketServiceList.get(0).pushFailMessage(response.getBusinessKey(),response.getProcessDefinitionKey(),
response.getTaskName(),response.getResult(),response.getDeptId());
}
// 保存日志
WorkflowOperationLog log = BeanUtil.copy(response, WorkflowOperationLog.class);

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/feign/CompensateProcessClient.java

@ -33,9 +33,9 @@ public class CompensateProcessClient implements ICompensateProcessClient {
@PostMapping("/startFlow")
public R startFlow(@RequestParam("userId") String userId,
@RequestParam("dictValue")String dictValue,
@RequestParam("taskId")String taskId,
@RequestParam("businessKey")String businessKey,
@RequestParam("processName")String processName,
@RequestBody Map<String, Object> variables) {
return processService.startFlow(userId,dictValue,taskId,processName,variables);
return processService.startFlow(userId,dictValue,businessKey,processName,variables);
}
}

49
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java

@ -4,13 +4,14 @@ import com.hnac.hzims.middle.processflow.entity.ProcessDict;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.service.ProcessService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.message.MessageConstants;
import org.springblade.message.dto.BusinessMessageDTO;
import org.springblade.message.dto.BusinessMessageFlowDTO;
import org.springblade.message.fegin.IMessageClient;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
@ -43,11 +44,11 @@ public abstract class ProcessAbstractService implements ProcessService {
private ProcessDictService processDictService;
@Override
public R startFlow(String userId, String dictValue, String taskId, String processName, Map<String, Object> variables) {
public R startFlow(String userId, String dictValue, String businessKey, String processName, Map<String, Object> variables) {
log.info("开启流程.....");
R r = new R();
try {
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, taskId, processName, variables);
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, businessKey, processName, variables);
r.setSuccess(result.isSuccess());
r.setCode(result.getCode());
r.setMsg(result.getMsg());
@ -60,7 +61,7 @@ public abstract class ProcessAbstractService implements ProcessService {
log.error("开启流程失败:{}",result);
log.error("流程信息为{}",variables);
r.setData(variables);
pushStartFailMessage(dictValue,Long.valueOf(taskId),userId,processName,result.getMsg());
pushStartFailMessage(dictValue,businessKey,userId,processName,result.getMsg());
}
return r;
}catch (Exception e){
@ -85,11 +86,11 @@ public abstract class ProcessAbstractService implements ProcessService {
// return r;
// }
public void pushStartFailMessage(String dictValue,Long taskId, String userId, String content,String reason) {
public void pushStartFailMessage(String dictValue,String businessKey, String userId, String content,String reason) {
ProcessDict processDict = processDictService.selectDictLabelByKey(dictValue);
BusinessMessageDTO message = new BusinessMessageDTO();
BusinessMessageFlowDTO message = new BusinessMessageFlowDTO();
// 计划Id
message.setTaskId(taskId);
message.setTaskId(businessKey);
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
// 主题
@ -108,36 +109,46 @@ public abstract class ProcessAbstractService implements ProcessService {
}
message.setCreateUser(admin.getId());
message.setUserIds(userId);
messageClient.sendAppAndWsMsgByUsers(message);
messageClient.sendAppAndWsMsgByUsersFlow(message);
}
@Override
public void pushFailMessage(Long taskId, String proessKey, String userId, String content,String reason,String deptId) {
public void pushFailMessage(String businessKey, String proessKey, String content,String reason,String deptId) {
ProcessDict processDict = processDictService.selectDictLabelByKey(proessKey);
BusinessMessageDTO message = new BusinessMessageDTO();
BusinessMessageFlowDTO message = new BusinessMessageFlowDTO();
// BusinessMessageDTO message = new BusinessMessageDTO();
// 计划Id
message.setTaskId(taskId);
message.setTaskId(businessKey);
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
// 主题
message.setSubject(MessageConstants.BusinessClassifyEnum.BUSINESS.getDescription());
// 内容
String res= StringUtil.format("你有一个{}的{}流程流转失败,失败原因为:{}",content,
String res= StringUtil.format("你有一个流程环节为{}的{}流转失败,失败原因为:{}",content,
processDict.getDictLabel(), reason);
message.setContent(res);
message.setTenantId("200000");
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), Long.valueOf(deptId), PROJECT_MANAGER);
R<List<User>> userListR = userClient.queryUserByRoleAlias("200000", Long.valueOf(deptId), PROJECT_MANAGER);
User admin = userClient.userByAccount("200000", "admin").getData();
User createUser = userClient.userInfoById(Long.valueOf(userId)).getData();
message.setDeptId(createUser.getCreateDept());
R<String> result = sysClient.getDeptName(createUser.getCreateDept());
message.setDeptId(Long.valueOf(deptId));
R<String> result = sysClient.getDeptName(Long.valueOf(deptId));
if (result.isSuccess()) {
message.setDeptName(result.getData());
}
if (CollectionUtil.isNotEmpty(userListR.getData())){
List<User> data = userListR.getData();
String userIds = data.stream().map(user -> user.getId().toString()).collect(Collectors.joining(","));
message.setCreateUser(admin.getId());
message.setUserIds(userIds);
messageClient.sendAppAndWsMsgByUsers(message);
}else {
R<List<User>> listR = userClient.queryUserByRoleAlias("200000", Long.valueOf(20000001), PROJECT_MANAGER);
if (ObjectUtil.isEmpty(listR)||CollectionUtil.isEmpty(listR.getData())){
return;
}
List<User> data =listR.getData();
String userIds = data.stream().map(user -> user.getId().toString()).collect(Collectors.joining(","));
message.setUserIds(userIds);
}
message.setCreateUser(admin.getId());
messageClient.sendAppAndWsMsgByUsersFlow(message);
}
}

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java

@ -14,9 +14,9 @@ import java.util.Map;
*/
public interface ProcessService {
R startFlow(String userId, String dictValue, String taskId, String processName, Map<String, Object> variables) ;
R startFlow(String userId, String dictValue, String businessKey, String processName, Map<String, Object> variables) ;
void pushFailMessage(Long taskId, String proessKey, String userId, String content,String reason,String deptId);
void pushFailMessage(String taskId, String proessKey, String content,String reason,String deptId);
/**
* 设置执行那种实现类
* @param flowQueue

2
hzims-service/hzims-middle/src/main/resources/template/template.yml

@ -8,7 +8,7 @@ spring:
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_middle?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-middle?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}

14
hzims-service/hzims-scheduled/src/main/resources/template/template.yml

@ -14,31 +14,31 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
equipment:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
ticket:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
safeproduct:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
inspect:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
basic:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_basic?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-basic?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
alarm:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_alarm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_alarm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}

2
hzims-service/inspect/src/main/resources/template/template.yml

@ -18,7 +18,7 @@ spring:
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}

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

@ -121,7 +121,6 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service, StartProces
private final TransactionTemplate transactionTemplate;
@Override
public String saveEntity(String entity) {
transactionTemplate.setTransactionManager(transactionManager);
String res = transactionTemplate.execute(status -> {
AccessPlanV4DTO accessPlanV4DTO = JSONObject.parseObject(entity, AccessPlanV4DTO.class);
@ -289,8 +288,8 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service, StartProces
entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator());
entity.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
entity.setIsNormal(false);
entity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
handException(processWorkFlowResponse);
return false;
}
if(ObjectUtil.isNotEmpty(variables.get("examine")) && (Boolean) variables.get("examine")){
entity.setTaskName("流程结束");
@ -322,7 +321,27 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service, StartProces
}
return true;
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
OperAccessPlanEntity operAccessPlanEntity = planService.getOne(new LambdaQueryWrapper<OperAccessPlanEntity>() {{
eq(OperAccessPlanEntity::getId, split[1]);
}});
operAccessPlanEntity.setIsNormal(false);
operAccessPlanEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
operAccessPlanEntity.setTaskName(processWorkFlowResponse.getTaskName());
operAccessPlanEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
operAccessPlanEntity.setNextStepOperator("");
boolean flag = planService.updateById(operAccessPlanEntity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/**
* 开启检修任务

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

@ -131,7 +131,7 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service, StartProces
String.valueOf(accessTaskV4DTO.getId())), accessTaskV4DTO.getName(),variables);
log.error("开启检修任务流程失败{}" + result);
// 更新任务流程Id
if (200==result.getCode()) {
if (200==result.getCode()&&ObjectUtil.isNotEmpty(result.getData())) {
accessTaskV4DTO.setProcessInstanceId(result.getData().toString());
accessTaskV4DTO.setIsNormal(true);
taskService.updateById(accessTaskV4DTO);
@ -237,8 +237,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service, StartProces
AccessTaskV4DTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<AccessTaskV4DTO>(){});
entity.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
entity.setIsNormal(false);
entity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
handException(processWorkFlowResponse);
return false;
}
// 当前流程名称
entity.setTaskName(processWorkFlowResponse.getTaskName());
@ -266,12 +266,31 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service, StartProces
String content = "您有一条检修任务待处理/审核,检修任务名称:".concat(entity.getName())
.concat(",当前环节:")
.concat(processWorkFlowResponse.getTaskName());
if(ObjectUtils.isEmpty(processWorkFlowResponse.getCode())||700!=processWorkFlowResponse.getCode()){
this.sendMessage(entity,processWorkFlowResponse.getUserId(),content);
}
return true;
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
OperAccessTaskEntity operAccessTaskEntity = taskService.getOne(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
eq(OperAccessTaskEntity::getId, split[1]);
}});
operAccessTaskEntity.setIsNormal(false);
operAccessTaskEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
operAccessTaskEntity.setTaskName(processWorkFlowResponse.getTaskName());
operAccessTaskEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
operAccessTaskEntity.setNextStepOperator("");
boolean flag = taskService.updateById(operAccessTaskEntity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/**
* 推送业务流程消息

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java

@ -27,12 +27,6 @@ public class HzimsDataController {
private final HzimsDataService service;
@GetMapping("/saveArea")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "获取区域列表数据", notes = "无需传入参数")
public R saveArea() {
return R.data(service.saveArea());
}
@GetMapping("/stationNumber")

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java

@ -15,11 +15,6 @@ import java.util.List;
*/
public interface HzimsDataService {
/**
* 获取区域列表数据
* @return
*/
boolean saveArea();
List<StationNumberVo> stationNumber();

39
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

@ -85,10 +85,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
private final RedisTemplate redisTemplate;
@Value("${hzims.operation.save.area.url}")
public String AREA_URL;
@Value("${hzims.operation.save.station.url}")
public String STATION_URL;
private final static String charge = "hzims:operation:key:charge";
@ -105,41 +102,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key";
@Override
public boolean saveArea() {
R<List<Dept>> result = sysClient.getDeptList();
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
throw new ServiceException("暂无区域数据!");
}
List<Integer> types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE);
Map<Dept, List<StationEntity>> map = areaService.getAuthArea(result.getData(), null, types, HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (MapUtils.isEmpty(map)) {
throw new ServiceException("暂无区域数据!");
}
List<EminfoAndEmParamVo> deviceList = emService.getEmInfoList();
// 获取区域列表数据
List<AreaVo> list = map.entrySet().stream().map(entry->{
AreaVo vo = new AreaVo();
vo.setDeptId(entry.getKey().getId());
vo.setDeptName(entry.getKey().getDeptName());
int hydropowerCount = (int) entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).count();
vo.setHydropowerStationCount(hydropowerCount);
int waterCount = entry.getValue().size() - hydropowerCount;
vo.setWaterStationCount(waterCount);
List<Long> value = entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(value)){
vo.setInstalledCapacity(0.0);
}else{
double installedCapacity = deviceList.stream().filter(o-> null != o.getInstalledCapacity() && value.contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum();
vo.setInstalledCapacity(installedCapacity);
}
return vo;
}).collect(Collectors.toList());
// 调用Http请求
return this.sendMessage(JSONObject.toJSONBytes(list),AREA_URL);
}
/**

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

@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -335,6 +337,10 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
long taskId;
OperPhenomenonEntity operPhenomenonEntity;
log.info("消缺消息开始转换"+processWorkFlowResponse);
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
return handException(processWorkFlowResponse);
}
try {
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
//现象缺陷全表更新
@ -368,7 +374,6 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
Long differTime = TimeUtils.getDifferTime(operPhenomenonEntity.getPlanStartTime(), operPhenomenonEntity.getPlanEndTime());
operPhenomenonEntity.setPlanHours(differTime.intValue());
}
taskId = operPhenomenonEntity.getId();
//缺陷库记录
if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && 1==(operPhenomenonEntity.getIsWarehousing())) {
OperDefectEntity operDefectEntity = new OperDefectEntity();
@ -384,14 +389,7 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功");
}
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
operPhenomenonEntity.setIsNormal(false);
operPhenomenonEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
}else {
//推送消息中心相关消息
sendMessage(processWorkFlowResponse, operPhenomenonEntity,taskId);
}
//更新数据库
Long statisticsEntityId = statisticsEntity.getId();
Long appearanceEntityId = appearanceEntity.getId();
@ -405,6 +403,31 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
statisticsService.updateById(statisticsEntity);
operAppearanceService.updateById(appearanceEntity);
log.info("消缺消息转换结束"+processWorkFlowResponse);
log.info("推送给用户消息"+processWorkFlowResponse);
//推送消息中心相关消息
sendMessage(processWorkFlowResponse, operPhenomenonEntity,operPhenomenonEntity.getId());
log.info("推送给消息结束");
return R.success("消息保存成功");
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("消缺异常处理失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("消缺异常处理失败");
}
OperPhenomenonEntity operPhenomenonEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getId, split[1]);
}});
operPhenomenonEntity.setIsNormal(false);
operPhenomenonEntity.setCheckProcessInstanceId(processWorkFlowResponse.getTaskId());
operPhenomenonEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
operPhenomenonEntity.setCurrentLinkHandler("");
this.baseMapper.update(operPhenomenonEntity, new LambdaUpdateWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getDefectCode, operPhenomenonEntity.getDefectCode());
}});
log.info("消缺消息转换结束"+ processWorkFlowResponse);
return R.success("消息保存成功");
}

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/feign/DutyRecClient.java

@ -32,18 +32,6 @@ public class DutyRecClient implements IDutyRecClient {
@Override
public R dealDutyRecFlow(ProcessWorkFlowResponse processWorkFlowResponse) {
log.info("operational:duty:rec:dealDutyRecFlow","接受到消息:消息内容为:"+ JSON.toJSONString(processWorkFlowResponse));
//ImsDutyRecDTO recDTO = BeanUtil.copy(processWorkFlowResponse.getVariables(),ImsDutyRecDTO.class);
ImsDutyRecDTO recDTO = JSONObject.parseObject(JSON.toJSONString(processWorkFlowResponse.getVariables()),ImsDutyRecDTO.class);
Assert.isTrue(ObjectUtil.isNotEmpty(recDTO),() -> {
throw new RuntimeException("未接收到交接班信息!");
});
recDTO.setDealChain(processWorkFlowResponse.getTaskName());
recDTO.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
recDTO.setIsNormal(false);
recDTO.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
}
return R.status(service.dealDutyRecFlow(recDTO));
return service.dealDutyRecFlow(processWorkFlowResponse);
}
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyRecQRRecordMapper.java

@ -25,7 +25,6 @@ public interface ImsDutyRecQRRecordMapper extends UserDataScopeBaseMapper<ImsDut
* @return
*/
@UserDataAuth
List<ImsDutyRecQRRecordVo> selectPageList(IPage page,@Param(value = "vo") ImsDutyRecQRRecordVo vo);
List<ImsDutyRecQRRecordVo> selectPageList(@Param(value = "page")IPage page,@Param(value = "vo") ImsDutyRecQRRecordVo vo);
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.duty.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.operational.duty.dto.ChangeShiftsReqDTO;
import com.hnac.hzims.operational.duty.dto.ChangeShiftsRspDTO;
import com.hnac.hzims.operational.duty.dto.ImsDutyRecDTO;
@ -130,7 +131,7 @@ public interface IImsDutyRecService extends IService<ImsDutyRecEntity> {
* @param recDTO 交接班信息
* @return
*/
Boolean dealDutyRecFlow(ImsDutyRecDTO recDTO);
R dealDutyRecFlow(ProcessWorkFlowResponse processWorkFlowResponse);
R<ImsDutyLogEntity> getDutyLog(ImsDutyLogEntity imsDutyLogEntity);

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

@ -10,10 +10,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.flow.StartProcessService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.middle.process.feign.ICompensateProcessClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.defect.constants.TreatMethodConstant;
import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity;
@ -1321,8 +1324,19 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
}
@Override
//@Transactional
public Boolean dealDutyRecFlow(ImsDutyRecDTO recDTO) {
public R dealDutyRecFlow(ProcessWorkFlowResponse processWorkFlowResponse) {
log.info("operational:duty:rec:dealDutyRecFlow","接受到消息:消息内容为:"+ JSON.toJSONString(processWorkFlowResponse));
//ImsDutyRecDTO recDTO = BeanUtil.copy(processWorkFlowResponse.getVariables(),ImsDutyRecDTO.class);
ImsDutyRecDTO recDTO = JSONObject.parseObject(JSON.toJSONString(processWorkFlowResponse.getVariables()),ImsDutyRecDTO.class);
Assert.isTrue(ObjectUtil.isNotEmpty(recDTO),() -> {
throw new RuntimeException("未接收到交接班信息!");
});
recDTO.setDealChain(processWorkFlowResponse.getTaskName());
recDTO.setIsNormal(true);
if(ObjectUtil.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
handException(processWorkFlowResponse);
}
ImsDutyMainEntity headDutyMain = BeanUtil.copy(recDTO.getHeadDutyMainVo(), ImsDutyMainEntity.class);
ImsDutyMainEntity carryDutyMain = BeanUtil.copy(recDTO.getCarryDutyMainVo(), ImsDutyMainEntity.class);
if(StringUtil.isBlank(recDTO.getDealChain())) {
@ -1366,13 +1380,36 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
}
// 更新交接班
if (ObjectUtil.isNotEmpty(dutyRec)&&ObjectUtil.isNotEmpty(dutyRec.getId())) {
return this.updateById(dutyRec);
}else {
log.error("更新交接班记录失败"+dutyRec.toString());
return false;
boolean b = this.updateById(dutyRec);
if (b){
return R.success("更新交接班记录成功");
}
}
log.error("更新交接班记录失败"+dutyRec.toString());
return R.fail("更新交接班记录失败");
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
ImsDutyRecEntity imsDutyRecEntity = this.getOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
eq(ImsDutyRecEntity::getId, split[1]);
}});
imsDutyRecEntity.setIsNormal(false);
imsDutyRecEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
imsDutyRecEntity.setDealChain(processWorkFlowResponse.getTaskName());
imsDutyRecEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
boolean flag = this.updateById(imsDutyRecEntity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/**
* 计算交接班状态
* @param duty 值班信息

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

@ -1,12 +1,17 @@
package com.hnac.hzims.operational.maintenance.scheduled;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant;
import com.hnac.hzims.alarm.config.entity.AlarmHandleFlowEntity;
import com.hnac.hzims.common.flow.StartProcessService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.middle.process.feign.ICompensateProcessClient;
import com.hnac.hzims.operational.constants.FlowKeyConstants;
import com.hnac.hzims.operational.constants.RedisKeyConstants;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
@ -28,6 +33,7 @@ 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.flow.core.utils.FlowUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.data.redis.core.RedisTemplate;
@ -41,6 +47,7 @@ import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.hnac.hzims.operational.constants.FlowKeyConstants.MAINTENANCE_TASK_FLOW_KEY;
import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.GENERATE_MAINTENANCE_TASK_SCHEDULE;
/**
@ -57,6 +64,7 @@ public class MaintenanceTaskSchedule implements StartProcessService {
private final IImsDutyMainService dutyMainService;
private final RedisTemplate redisTemplate;
private final IEmInfoClient emInfoClient;
private final ICompensateProcessClient compensateProcessClient;
@XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE)
public ReturnT<String> execute(String param) throws Exception {
@ -173,10 +181,11 @@ public class MaintenanceTaskSchedule implements StartProcessService {
*/
private void startProcessInstance(OperMaintenanceTaskEntity task) {
String s = saveEntity(JSONObject.toJSONString(task));
startProcess(s,FlowKeyConstants.MAINTENANCE_TASK_FLOW_KEY,null);
startProcess(s, MAINTENANCE_TASK_FLOW_KEY,null);
}
@Override
//没有保存多张表,不单独开启事务
public String saveEntity(String entity) {
return entity;
}
@ -202,8 +211,13 @@ public class MaintenanceTaskSchedule implements StartProcessService {
});
put("operMaintenanceTaskEntityVo",vo);
}};
R<BladeFlow> flowResult = flowClient.startProcessInstanceContainNameByKey(dictValue, String.valueOf(task.getId()), task.getTitle(), params);
if (!flowResult.isSuccess()){
if (StringUtils.isNotBlank(param)){
params=JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(param,DateUtil.PATTERN_DATETIME), Map.class);
}
String businessKey = FlowUtil.getBusinessKey("hzims_oper_maintenance_task", "" +task.getId());
R flowResult = compensateProcessClient.startFlow(AuthUtil.getUserId().toString(), dictValue, businessKey, task.getTitle(), params);
// R<BladeFlow> flowResult = flowClient.startProcessInstanceContainNameByKey(dictValue, String.valueOf(task.getId()), task.getTitle(), params);
if (200!=flowResult.getCode()){
task.setIsNormal(false);
task.setRemark(JSONObject.toJSONString(params));
taskService.updateById(task);
@ -213,14 +227,22 @@ public class MaintenanceTaskSchedule implements StartProcessService {
r.setData(params);
log.error(task.getId()+"日常维护任务启动流程失败{}", task);
return r;
}else {
task.setIsNormal(true);
task.setProcessInstanceId(flowResult.getData().toString());
taskService.updateById(task);
}
String s = Optional.ofNullable(flowResult).filter(r -> r.isSuccess()).map(R::getData).map(BladeFlow::getProcessInstanceId).orElse(null);
String s = flowResult.getData().toString();
log.info(task.getId()+"日常维护任务启动成功{}", s);
return R.success("启动流程成功");
}
@Override
public R compensationProcess(String id) {
return null;
OperMaintenanceTaskEntity operMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isNotEmpty(operMaintenanceTaskEntity)){
return this.startProcess(JSON.toJSONString(operMaintenanceTaskEntity), MAINTENANCE_TASK_FLOW_KEY,operMaintenanceTaskEntity.getRemark());
}
return R.fail("找不到对应流程数据,请稍后重试!");
}
}

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

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity;
@ -125,12 +126,17 @@ public class MaintenanceServiceImpl implements MaintenanceService {
log.error("获取表单出现异常了~~~~"+response);
throw new IllegalArgumentException(e.getMessage());
}
if(ObjectUtils.isNotEmpty(response.getCode())&&700==response.getCode()){
handException(response);
return;
}
OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity();
BeanUtils.copyProperties(standardTicketInfoVo, entity);
//1.查询日常维护信息
//有Id才进行生成操作
if (StringUtils.isNotBlank(response.getBusinessKey())) {
Long id = NumberUtils.toLong(response.getBusinessKey());
String str = response.getBusinessKey().split(":")[1];
Long id = NumberUtils.toLong(str);
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在" + response);
@ -178,6 +184,28 @@ public class MaintenanceServiceImpl implements MaintenanceService {
}
}
private R handException(ProcessWorkFlowResponse response) {
String[] split = response.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ response);
return R.fail("异常消息处理失败");
}
OperMaintenanceTaskEntity entity = taskService.getOne(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
eq(OperMaintenanceTaskEntity::getId, split[1]);
}});
entity.setIsNormal(false);
entity.setRemark(JSONObject.toJSONString(response.getVariables()));
entity.setFlowTaskName(response.getTaskName());
entity.setProcessInstanceId(response.getTaskId());
entity.setNextStepOperator("");
boolean flag = taskService.updateById(entity);
if (!flag){
log.info("异常状态消息保存失败"+ response);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/**
* 填充日常维护信息

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java

@ -225,10 +225,7 @@ public class StationVideoTypeController extends BladeController {
}
@RequestMapping(value = "/getVideoReviewerToken", method = {RequestMethod.GET, RequestMethod.POST})
public R<String> getVideoReviewerToken() {
return R.data(stationVideoTypeService.getVideoReviewerToken());
}
@GetMapping("/getVideoMonitorByAgency")

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

@ -48,11 +48,7 @@ public interface IStationVideoTypeService extends IService<StationVideoTypeEntit
*/
List<StationVideoTypeEntity> getVideoByIds(String ids,String randomCode);
/**
* 获取视频查看人员Token
* @return 视频查看人员Token
*/
String getVideoReviewerToken();
/**
* 获取海康威视各站点列表

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java

@ -58,8 +58,6 @@ public class StationVideoTypeServiceImpl extends ServiceImpl<StationVideoTypeMap
private final IHikVideoService hikVideoService;
@Value("${url.video.login}")
private String videoLoginUrl;
@Value("${hzims.video.random-code}")
private String definitionCode;
/** 秘钥appKey **/
@ -157,15 +155,7 @@ public class StationVideoTypeServiceImpl extends ServiceImpl<StationVideoTypeMap
return result;
}
@Override
public String getVideoReviewerToken() {
String result = HttpUtil.post(videoLoginUrl, "");
JSONObject resultObject = JSONObject.parseObject(result);
String data = resultObject.getString("data");
String access_token = JSONObject.parseObject(data).getString("access_token");
log.info("视频查看人员登陆token为:{}",access_token);
return access_token;
}
@Override
public List<JSONObject> getHikVisionStations() {

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/workOrder/controller/DistributeWorkOrderController.java

@ -32,21 +32,8 @@ public class DistributeWorkOrderController {
private final IOperAccessTaskService operAccessTaskService;
private final IOperDefectService operDefectService;
@GetMapping("/testDistributeWorkOrder")
@ApiOperation(value = "检修工单派发",notes = "检修工单派发")
@ApiImplicitParam(name = "operAccessTaskEntity", value = "检修任务", paramType = "body", dataType = "OperAccessTaskEntity")
@ApiOperationSupport(order = 1)
public R distributeWorkOrder(@RequestBody OperAccessTaskEntity operAccessTaskEntity){
return distributeWorkOrderService.distributeAccessTask(operAccessTaskEntity);
}
@GetMapping("/testDistributeDefect")
@ApiOperation(value = "消缺工单派发",notes = "消缺工单派发")
@ApiImplicitParam(name = "operAccessTaskEntity", value = "消缺对象", paramType = "query", dataType = "operDefectEntity")
@ApiOperationSupport(order = 2)
public R testDistributeDefect(@RequestBody OperDefectEntity operDefectEntity){
return distributeWorkOrderService.distributeDefectTask(operDefectEntity);
}
@GetMapping("/getAccessWorkOrderList")
@ApiOperation(value = "获取检修工单列表",notes = "获取检修工单列表")

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/workOrder/service/IDistributeWorkOrderService.java

@ -5,19 +5,8 @@ import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import org.springblade.core.tool.api.R;
@Deprecated
public interface IDistributeWorkOrderService {
/**
* 派发检修任务
* @param operAccessTaskEntity
* @return
*/
R distributeAccessTask(OperAccessTaskEntity operAccessTaskEntity);
/**
* 派发消缺任务
* @param operDefectEntity
* @return
*/
R distributeDefectTask(OperDefectEntity operDefectEntity);
/**
* 获取检修工单列表

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

@ -51,11 +51,6 @@ public class DistributeWorkOrderServiceImpl implements IDistributeWorkOrderServi
private final IOperPhenomenonService operPhenomenonService;
private final RedisTemplate redisTemplate;
@Value("${url.water-out.orderCrtPackage}")
private String orderCrtPackageUrl;
@Value("${url.water-out.orderCrtGrabPackage}")
private String orderCrtGrabPackageUrl;
@Value("${hzims.operation.workOrder.access}")
private String accessWorkOrderKey;
@ -63,152 +58,6 @@ public class DistributeWorkOrderServiceImpl implements IDistributeWorkOrderServi
@Value("${hzims.operation.workOrder.defect}")
private String defectWorkOrderKey;
@Override
public R distributeAccessTask(OperAccessTaskEntity operAccessTaskEntity){
if(ObjectUtil.isEmpty(operAccessTaskEntity)){
return R.fail("暂无检修记录!");
}
OrderPackageDto orderPackageDto = new OrderPackageDto();
orderPackageDto.setCreater(AuthUtil.getUser().getUserName());
orderPackageDto.setFloatRange("1");
orderPackageDto.setProjectCost(0);
/*结束时间需大于当前时间*/
orderPackageDto.setFinishTime(DateUtil.format(LocalDateTime.now().plusHours(5),DateUtil.PATTERN_DATETIME));
orderPackageDto.setProjectCode(operAccessTaskEntity.getId().toString());
orderPackageDto.setProjectName(operAccessTaskEntity.getName());
Publisher publisher = new Publisher();
publisher.setId(operAccessTaskEntity.getCreateUser().toString());
User user = UserCache.getUser(operAccessTaskEntity.getCreateUser());
publisher.setContactAddress("123123");
publisher.setContactName("123123");
publisher.setContactPhone(user.getPhone());
publisher.setPublisher(user.getRealName());
publisher.setPublisherScale("123123");
orderPackageDto.setPublisher(publisher);
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
orderPackageDto.setStartTime(fmt.format(operAccessTaskEntity.getPlanStartTime()));
orderPackageDto.setWaterId(operAccessTaskEntity.getCreateDept().toString());
//完善招标信息
List<TenderDto> tenderList = new ArrayList<>();
TenderDto tenderDto = new TenderDto();
//采用大修工单
tenderDto.setOrderType("6");
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime planStartTime = LocalDateTime.ofInstant(operAccessTaskEntity.getPlanStartTime().toInstant(),zoneId);
LocalDateTime planEndTime = LocalDateTime.ofInstant(operAccessTaskEntity.getPlanEndTime().toInstant(),zoneId);
Long workHours = Duration.between(planStartTime,planEndTime).toHours();
tenderDto.setWorkHours(workHours.intValue());
tenderDto.setWorkPrice("0");
//大修工单内容
List<OtherOrderDTO> overhaulOrderList = new ArrayList<>();
OtherOrderDTO overHaulOrder = new OtherOrderDTO();
overHaulOrder.setOrderType("6");
overHaulOrder.setWorkCode(operAccessTaskEntity.getCode());
overHaulOrder.setTenantId(operAccessTaskEntity.getTenantId());
overHaulOrder.setWorkHour(workHours.intValue());
overHaulOrder.setWorkName(operAccessTaskEntity.getName());
EmInfoEntity emInfoEntity = emInfoClient.getByCode(operAccessTaskEntity.getEmCode());
overHaulOrder.setWorkPos(Optional.ofNullable(emInfoEntity).map(EmInfoEntity::getName).orElse(null));
overHaulOrder.setWorkTime(DateUtil.format(operAccessTaskEntity.getPlanStartTime(),DateUtil.PATTERN_DATETIME));
overhaulOrderList.add(overHaulOrder);
tenderDto.setOverhaulOrderList(overhaulOrderList);
tenderList.add(tenderDto);
orderPackageDto.setTenderList(tenderList);
log.info("-------------------------------------派发工单对象为-------------------------------------");
log.info(JSON.toJSONString(orderPackageDto));
HttpResponse httpResponse = HttpClientUtils.post(orderCrtPackageUrl, JSONObject.toJSONString(orderPackageDto));
if(httpResponse.getCode() == 200){
JSONObject jsonObject = JSONObject.parseObject(httpResponse.getData());
try{
String id = JSONObject.parseObject(jsonObject.getString("data")).getString("id");
//将工单处理结果暂存入redis中
// long maxSize = redisTemplate.opsForZSet().zCard(accessWorkOrderKey);
// redisTemplate.opsForZSet().add(accessWorkOrderKey,id, maxSize > 0 ? (maxSize - 1) : 0L);
}
catch (Exception e){
e.printStackTrace();
}
}
return R.data("调用成功!");
}
@Override
public R distributeDefectTask(OperDefectEntity operDefectEntity){
if(ObjectUtil.isEmpty(operDefectEntity)){
return R.fail("暂无消缺单记录!");
}
GrabPackageDTO grabPackageDTO = new GrabPackageDTO();
grabPackageDTO.setCreateUser(AuthUtil.getUser().getUserName());
grabPackageDTO.setFinishTime(DateUtil.format(LocalDateTime.now().plusHours(8),DateUtil.PATTERN_DATETIME));
List<RepairOrderAcptDto> repairOrderAcptDtos = new ArrayList<>();
RepairOrderAcptDto repairOrderAcptDto = new RepairOrderAcptDto();
//完善工单内容
if(StringUtil.isNotBlank(operDefectEntity.getDefectCode())){
//根据现象、缺陷编码获取现象
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonService.getOne(new LambdaQueryWrapper<OperPhenomenonEntity>(){{
eq(OperPhenomenonEntity::getDefectCode,operDefectEntity.getDefectCode());
}}.last("limit 1"));
if(ObjectUtil.isNotEmpty(operPhenomenonEntity)){
if(StringUtil.isNotBlank(operPhenomenonEntity.getEmCode())){
repairOrderAcptDto.setEquCode(operPhenomenonEntity.getEmCode());
EmInfoEntity emInfoEntity = emInfoClient.getByCode(operPhenomenonEntity.getEmCode());
repairOrderAcptDto.setEquName(Optional.ofNullable(emInfoEntity).map(EmInfoEntity::getName).orElse(null));
}
if(StringUtil.isNotBlank(operPhenomenonEntity.getFaultCode())){
List<RepairOrderContentDTO> contentDTOList = new ArrayList<>();
RepairOrderContentDTO repairOrderContentDTO = new RepairOrderContentDTO();
repairOrderContentDTO.setFaultCode(operPhenomenonEntity.getFaultCode());
repairOrderContentDTO.setFaultName(operPhenomenonEntity.getFaultName());
contentDTOList.add(repairOrderContentDTO);
repairOrderAcptDto.setContentList(contentDTOList);
}
}
}
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = Optional.ofNullable(operDefectEntity.getActStartTime()).map(time->fmt.format(time)).orElse(null);
repairOrderAcptDto.setStartTime(startTime);
R<Dept> deptR = sysClient.getDept(operDefectEntity.getCreateDept());
repairOrderAcptDto.setEquType("010101");
repairOrderAcptDto.setOrgName("长沙敢胜院");
repairOrderAcptDto.setCreateUser(operDefectEntity.getCreateUser().toString());
repairOrderAcptDto.setTenantId(operDefectEntity.getTenantId());
repairOrderAcptDto.setWorkTime(DateUtil.format(operDefectEntity.getActStartTime(),DateUtil.PATTERN_DATETIME));
repairOrderAcptDto.setFaultDisp("捞渣、清渣装置故障");
repairOrderAcptDto.setInstallPos("粗格栅间");
repairOrderAcptDto.setIsBallot(0);
repairOrderAcptDto.setUserName(UserCache.getUser(operDefectEntity.getCreateUser()).getName());
repairOrderAcptDto.setIsMajorRepairs("一般维修");
repairOrderAcptDto.setRepairType("general_repair");
repairOrderAcptDto.setSeverity("严重");
repairOrderAcptDto.setSpecModel("GL1400");
repairOrderAcptDto.setTimeLimit("6.00");
repairOrderAcptDto.setWorkCode(operDefectEntity.getId().toString());
repairOrderAcptDto.setWorkPrice(0);
repairOrderAcptDto.setWorkRatio(1);
repairOrderAcptDto.setWorkHour(4);
List<RepairOrderPrognosisDTO> repairOrderPrognosisDTOS = new ArrayList<>();
RepairOrderPrognosisDTO repairOrderPrognosisDTO = new RepairOrderPrognosisDTO();
repairOrderPrognosisDTO.setCause("测试...");
repairOrderPrognosisDTO.setDescribeContent("测试...");
repairOrderPrognosisDTO.setProjectCode("test0000001");
repairOrderPrognosisDTO.setProjectContent("测试....");
repairOrderPrognosisDTO.setProjectName("测试...");
repairOrderPrognosisDTO.setWorkHour("4.00");
repairOrderPrognosisDTOS.add(repairOrderPrognosisDTO);
repairOrderAcptDto.setPrognosisList(repairOrderPrognosisDTOS);
repairOrderAcptDtos.add(repairOrderAcptDto);
grabPackageDTO.setRepairOrderAcptDtos(repairOrderAcptDtos);
log.info("-------------------------------------派发消缺单对象为-------------------------------------");
log.info(JSON.toJSONString(grabPackageDTO));
HttpResponse httpResponse = HttpClientUtils.post(orderCrtGrabPackageUrl, JSONObject.toJSONString(grabPackageDTO));
//将工单处理结果暂存入redis中
long maxSize = redisTemplate.opsForZSet().zCard(defectWorkOrderKey);
//redisTemplate.opsForZSet().add(defectWorkOrderKey,"", maxSize > 0 ? (maxSize - 1) : 0L);
return R.data("调用成功!");
}
@Override
public R getAccessWorkOrderList(){

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

@ -1,5 +1,7 @@
ALTER TABLE `hzims_oper_phenomenon`
MODIFY COLUMN `REMARK` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '冗余字段' ;
ALTER TABLE `hzims_oper_phenomenon`
ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ;
ALTER TABLE `hz_ims_duty_rec`
ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ;
ALTER TABLE `hzims_oper_access_task`

14
hzims-service/operational/src/main/resources/template/template.yml

@ -8,7 +8,7 @@ spring:
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
@ -162,20 +162,10 @@ blade:
lock:
enabled: true
address: redis://${hzinfo.redis.ip}:${hzinfo.redis.hzinfo.redis.port}
password:
password: ${hzims.sdk.password}
database: 0
ssl: false
logging:
level:
com.hnac.hzinfo.inspect.task.feign.IInspectTaskClient: NONE
url:
video:
stationsPath: http://localhost:10001/stations
monitorsPath: http://localhost:10001/monitor
login: https://175.6.40.67:9300/hzApi/auth/mix/login?tenantId=200000&account=videoViewers&pwd=e10adc3949ba59abbe56e057f20f883e&grant_type=password&scope=all&type=account
water-out:
#工单受理
orderCrtPackage: http://175.6.40.67:9021/api/water-out/orderCrt/package
orderCrtGrabPackage: http://175.6.40.67:9021/api/water-out/orderCrt/grabPackage

61
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java

@ -13,7 +13,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.flow.StartProcessService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.middle.process.feign.ICompensateProcessClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.safeproduct.dto.InnerDangerDTO;
import com.hnac.hzims.safeproduct.entity.InnerDangerEntity;
import com.hnac.hzims.safeproduct.flow.mapper.InnerDangerMapper;
@ -31,6 +33,7 @@ import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.message.dto.BusinessMessageDTO;
import org.springblade.message.fegin.IMessageClient;
import org.springblade.system.feign.ISysClient;
@ -61,6 +64,8 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
@Autowired
private IMessageClient messageClient;
@Autowired
private ICompensateProcessClient compensateProcessClient;
@ -73,7 +78,7 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
@Override
public R startHiddenDanger(InnerDangerVo hiddenDangerVo) {
String saved = saveEntity(JSONObject.toJSONString(hiddenDangerVo));
R r = this.startProcess(saved, HIDDEN_DANGER_CHECK);
R r = this.startProcess(saved, HIDDEN_DANGER_CHECK,null);
return r;
}
@Override
@ -104,6 +109,7 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
innerDangerEntity.setHiddenDangerDeptName(deptNameR.getData());
}
}
//只有一张表,不使用事务
boolean save = this.save(innerDangerEntity);
if (!save) {
throw new ServiceException("隐患保存失败,请稍后重试!");
@ -114,15 +120,6 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
@Override
public R startProcess(String entity, String dictValue, String param) {
return null;
}
@Override
public R compensationProcess(String id) {
return null;
}
public R startProcess(String entity, String dictValue) {
InnerDangerVo innerDangerVo= JSONObject.parseObject(entity, InnerDangerVo.class);
InnerDangerEntity innerDangerEntity = new InnerDangerEntity();
BeanUtil.copy(innerDangerVo, innerDangerEntity);
@ -132,12 +129,14 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
String processName = "[" + userName + "] 发起 " + "【风险点:" + innerDangerVo.getRiskPointName() + "】隐患处理流程" + "——>" + innerDangerEntity.getHiddenDangerName();
// 开启新的隐患处理流程
Map<String, Object> variable = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(innerDangerVo, DateUtil.PATTERN_DATETIME), Map.class);
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(dictValue, innerDangerVo.getId().toString(), processName, variable);
R result = compensateProcessClient.startFlow(AuthUtil.getUserId().toString(),
dictValue, FlowUtil.getBusinessKey("hzims_inner_danger_info", String.valueOf(innerDangerVo.getId())),
processName, variable);
// 流程开启失败
if (!result.isSuccess()) {
if (200!=result.getCode()) {
innerDangerEntity.setIsNormal(false);
innerDangerEntity.setRemark(JSONObject.toJSONString(variable));
this.baseMapper.updateById(innerDangerVo);
this.baseMapper.updateById(innerDangerEntity);
log.error("隐患处理流程开启失败,错误描述 : {}", result);
R r=new R();
r.setCode(result.getCode());
@ -146,19 +145,28 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
return r;
} else {
// 关联流程唯一键
innerDangerEntity.setProcessInstanceId(result.getData().getProcessInstanceId());
innerDangerEntity.setTaskId(result.getData().getTaskId());
innerDangerEntity.setProcessInstanceId(result.getData().toString());
innerDangerEntity.setIsNormal(true);
this.baseMapper.updateById(innerDangerEntity);
}
return R.success("启动流程成功");
}
}
@Override
public R compensationProcess(String id) {
InnerDangerEntity entity = this.baseMapper.selectById(id);
if (ObjectUtils.isNotEmpty(entity)){
return this.startProcess(JSON.toJSONString(entity), HIDDEN_DANGER_CHECK,entity.getRemark());
}
return R.fail("找不到对应流程数据,请稍后重试!");
}
/**
* @param processWorkFlowResponse
*/
@Override
public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) {
InnerDangerVo hiddenDangerVo;
log.warn("隐患处理流程消息开始转换");
try {
@ -170,6 +178,9 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
log.error("隐患处理流程消息转换失败:" + e.getMessage());
return R.fail("隐患处理流程消息转换失败");
}
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
return handException(processWorkFlowResponse);
}
InnerDangerEntity saveEntity = this.getOne(new LambdaQueryWrapper<InnerDangerEntity>() {{
eq(InnerDangerEntity::getCode, hiddenDangerVo.getCode());
last("limit 1");
@ -193,6 +204,21 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
return R.success("消息保存成功");
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
InnerDangerEntity innerDangerEntity = this.baseMapper.selectById(split[1]);
innerDangerEntity.setIsNormal(false);
innerDangerEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
innerDangerEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
innerDangerEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
innerDangerEntity.setCurrentLinkHandler("");
this.baseMapper.updateById(innerDangerEntity);
return R.fail("消息保存成功");
}
@Override
public IPage<HiddenDangerBaseVo> getHiddenDangerBase(HiddenDangerBaseVo hiddenDangerBaseVo, Query query) {
InnerDangerEntity innerDangerEntity = new InnerDangerEntity();
@ -292,6 +318,7 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
}else {
iPage.setRecords(new ArrayList<>());
}
return iPage;
}

32
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java

@ -3,6 +3,7 @@ package com.hnac.hzims.safeproduct.risk.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -216,6 +217,12 @@ public class HazardTaskServiceImpl extends ServiceImpl<HazardTaskMapper, HazardT
public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) {
// 流程参数获取
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
handException(processWorkFlowResponse);
log.info("风险排查流程补偿流程处理完毕");
return false;
}
// 对象转换
HazardRiskProcessDTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<HazardRiskProcessDTO>(){});
try{
@ -238,11 +245,7 @@ public class HazardTaskServiceImpl extends ServiceImpl<HazardTaskMapper, HazardT
entity.setNextStepOperator("流程结束,无需人员处理");
}
entity.setIsNormal(true);
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
entity.setIsNormal(false);
entity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
}
// 更新风险排查任务信息
this.updateById(entity);
if(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY_1.equals(variables.get(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY)) ||
@ -259,7 +262,24 @@ public class HazardTaskServiceImpl extends ServiceImpl<HazardTaskMapper, HazardT
}
return true;
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("补偿流程处理失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("补偿流程处理失败");
}
HazardTask hazardTask = this.baseMapper.selectOne(new LambdaQueryWrapper<HazardTask>() {{
eq(HazardTask::getId, split[1]);
}});
hazardTask.setIsNormal(false);
hazardTask.setProcessInstanceId(processWorkFlowResponse.getTaskId());
hazardTask.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
hazardTask.setProcessSteps(processWorkFlowResponse.getTaskName());
hazardTask.setNextStepOperator("");
this.baseMapper.updateById(hazardTask);
log.info("补偿流程消息转换结束"+ processWorkFlowResponse);
return R.success("补偿流程消息保存成功");
}
/**
* 风险评估变量值流程穿插
* @param processWorkFlowResponse

4
hzims-service/safeproduct/src/main/resources/template/template.yml

@ -14,11 +14,11 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
slave:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}

56
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java

@ -2,13 +2,18 @@ package com.hnac.hzims.ticket.repair.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.constant.CommonConstant;
import com.hnac.hzims.common.flow.StartProcessService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.middle.process.feign.ICompensateProcessClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.ticket.repair.constants.WorkTaskConstants;
import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity;
import com.hnac.hzims.ticket.repair.mapper.WorkTaskMapper;
@ -42,6 +47,8 @@ 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.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -58,6 +65,8 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
private final IWorkTicketInfoService workTicketInfoService;
private final ICompensateProcessClient compensateProcessClient;
private final IFlowClient flowClient;
private final ISysClient sysClient;
@ -86,7 +95,6 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
R r = this.startProcess(saved, "work_task","");
return r;
}
@Override
public String saveEntity(String entity) {
WorkTaskVO workTask= JSONObject.parseObject(entity, WorkTaskVO.class);
@ -116,19 +124,29 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
if(result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())){
workTask.setDeptName(result.getData().getDeptName());
}
//保存步骤只涉及到一张表,不加事务
this.save(workTask);
return JSON.toJSONString(workTask);
}
@Override
public R compensationProcess(String id) {
return null;
WorkTaskEntity entity = this.baseMapper.selectById(id);
if (ObjectUtils.isNotEmpty(entity)){
return this.startProcess(JSON.toJSONString(entity), "work_task",entity.getRemark());
}
return R.fail("找不到对应流程数据,请稍后重试!");
}
@Override
public R startProcess(String entity, String dictValue,String param) {
WorkTaskVO workTask= JSONObject.parseObject(entity, WorkTaskVO.class);
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(workTask, DateUtil.PATTERN_DATETIME), Map.class);
Map<String, Object> variables;
if (StringUtil.isNotBlank(param)) {
variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(param, DateUtil.PATTERN_DATETIME), Map.class);
}else {
variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(workTask, DateUtil.PATTERN_DATETIME), Map.class);
}
variables.put("head", TaskUtil.getTaskUser(String.valueOf(workTask.getHead())));
// 班组成员
String[] member = workTask.getMember().split(",");
@ -139,13 +157,16 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
variables.put("duty" + i, TaskUtil.getTaskUser(member[i-1]));
}
}
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, FlowUtil.getBusinessKey("work_task_v4",String.valueOf(workTask.getId())), workTask.getCode(), variables);
R result = compensateProcessClient.startFlow(AuthUtil.getUserId().toString(),
dictValue,FlowUtil.getBusinessKey("work_task_v4",String.valueOf(workTask.getId()))
, workTask.getCode(), variables);
log.error("work_task_start_process_result :{}",result);
// 更新任务流程Id
if (result.isSuccess()) {
BladeFlow flow = result.getData();
workTask.setProcessInstanceId(flow.getProcessInstanceId());
if (200==result.getCode()) {
workTask.setIsNormal(true);
workTask.setProcessInstanceId(result.getData().toString());
this.updateById(workTask);
return R.success("启动流程成功");
} else {
workTask.setIsNormal(false);
workTask.setRemark(JSONObject.toJSONString(variables));
@ -156,7 +177,6 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
r.setData(variables);
return r;
}
return R.success("启动流程成功");
}
@ -168,6 +188,10 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
@Override
public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) {
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
handException(processWorkFlowResponse);
return false;
}
log.error("work_task_listener_variables : {}",variables);
Object head = variables.get("head");
if(ObjectUtil.isNotEmpty(head)){
@ -176,6 +200,7 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
WorkTaskVO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<WorkTaskVO>(){});
// 当前流程名称
entity.setTaskName(processWorkFlowResponse.getTaskName());
entity.setIsNormal(true);
// 流程阶段执行人员名称
entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator());
entity.setHeadHandleTime(new Date());
@ -198,6 +223,21 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
return true;
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
WorkTaskEntity workTaskEntity = this.baseMapper.selectById(split[1]);
workTaskEntity.setIsNormal(false);
workTaskEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
workTaskEntity.setTaskName(processWorkFlowResponse.getTaskName());
workTaskEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
workTaskEntity.setNextStepOperator("");
this.baseMapper.updateById(workTaskEntity);
return R.success("消息保存成功");
}
/**
* 工作任务单-分页查询
* @param page

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

@ -4,12 +4,15 @@ import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.common.flow.StartProcessService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.middle.process.feign.ICompensateProcessClient;
import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.constants.TicketConstants;
@ -36,9 +39,11 @@ 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.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.message.MessageConstants;
import org.springblade.message.dto.BusinessMessageDTO;
import org.springblade.message.fegin.IMessageClient;
@ -47,7 +52,9 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@ -86,7 +93,7 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
private final ProcessDictFeignService processDictFeignService;
private final IFlowClient flowClient;
private final ICompensateProcessClient compensateProcessClient;
private final IMessageClient messageClient;
@ -117,6 +124,8 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
//启动流程
return this.startProcess(standardTicketInfoVoBySave, dictValue,"");
}
private final PlatformTransactionManager transactionManager;
private final TransactionTemplate transactionTemplate;
@Override
public String saveEntity(String entity) {
StandardTicketInfoVo standardTicketInfoVo= JSONObject.parseObject(entity, StandardTicketInfoVo.class);
@ -153,7 +162,10 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
if (StringUtils.isBlank(code)) {
throw new ServiceException("服务器异常,请联系管理员");
}
//多张表开启事务
standardTicketInfoVo.setCode(code);
transactionTemplate.setTransactionManager(transactionManager);
String res = transactionTemplate.execute(status -> {
//3. 保存操作对象
StandardTicketInfoEntity standardTicketInfo = getStandardTicketInfoEntity(standardTicketInfoVo);
standardTicketInfo.setStatus(1);
@ -167,6 +179,8 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
standardTicketInfoVo.setStandardTicketMeasureVos(standardTicketInfoVos);
log.info("保存操作对象 :{}", standardTicketInfoVo);
return JSON.toJSONString(standardTicketInfoVo);
});
return res;
}
@ -175,20 +189,23 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
public R startProcess(String entity, String dictValue,String param) {
StandardTicketInfoVo standardTicketInfoVo= JSONObject.parseObject(entity, StandardTicketInfoVo.class);
StandardTicketInfoEntity standardTicketInfoEntity = getStandardTicketInfoEntity(standardTicketInfoVo);
Instant start = Instant.now();
Map<String, Object> params = new HashMap<>(4);
params.put("standardTicketInfoVo", standardTicketInfoVo);
params.put("taskId", standardTicketInfoVo.getId());
if (ObjectUtils.isNotEmpty(standardTicketInfoVo.getGuardian())) {
params.put("guardianUserIds", "taskUser_".concat(standardTicketInfoVo.getGuardian().toString()));
}
if (StringUtils.isNotBlank(param)){
params=JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(param, DateUtil.PATTERN_DATETIME), Map.class);
}
//已开启流程
R<BladeFlow> processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(dictValue, String.valueOf(standardTicketInfoVo.getId()),
standardTicketInfoVo.getTitle(), params);
if (!processInstanceContainNameByKey.isSuccess()) {
R processInstanceContainNameByKey = compensateProcessClient.startFlow(AuthUtil.getUserId().toString(),
dictValue, FlowUtil.getBusinessKey("hzims_standard_ticket_info",
String.valueOf(standardTicketInfoVo.getId())),standardTicketInfoVo.getTitle(), params);
if (200!=processInstanceContainNameByKey.getCode()) {
standardTicketInfoEntity.setIsNormal(false);
standardTicketInfoEntity.setRemarkFlow(JSONObject.toJSONString(params));
standardTicketInfoService.save(standardTicketInfoEntity);
standardTicketInfoService.updateById(standardTicketInfoEntity);
R r=new R();
r.setCode(processInstanceContainNameByKey.getCode());
r.setMsg(processInstanceContainNameByKey.getMsg());
@ -196,17 +213,21 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
log.error("开启流程失败 {}", processInstanceContainNameByKey.getMsg());
return r;
}
Duration between = Duration.between(start, Instant.now());
log.info("================================================================");
log.info("耗时: " + (between.getSeconds()) + "秒");
log.info("耗时: " + (between.toMillis()) + "毫秒");
log.info("================================================================");
standardTicketInfoEntity.setProcessInstanceId(processInstanceContainNameByKey.getData().toString());
standardTicketInfoEntity.setIsNormal(true);
standardTicketInfoService.updateById(standardTicketInfoEntity);
return R.success("启动流程成功");
}
@Override
public R compensationProcess(String id) {
return null;
//查询流程对应value
String dictValue = processDictFeignService.selectDictValueByKey(OPERATION_TICKET_KEY);
StandardTicketInfoEntity entity = standardTicketInfoService.getById(id);
if (ObjectUtils.isNotEmpty(entity)){
return this.startProcess(JSON.toJSONString(entity), dictValue,entity.getRemark());
}
return R.fail("找不到对应流程数据,请稍后重试!");
}
/**
@ -227,6 +248,10 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
String formData = JSON.toJSONString(response.getVariables());
log.info("获取表单的数据:{}", formData);
StandardTicketInfoVo standardTicketInfoVo = null;
if(ObjectUtils.isNotEmpty(response.getCode())&&700==response.getCode()){
handException(response);
return ;
}
try {
JSONObject jsonObject = JSONObject.parseObject(formData);
// standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, StandardTicketInfoVo.class);
@ -238,6 +263,7 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
e.printStackTrace();
throw new IllegalArgumentException(e.getMessage());
}
//1.查询操作票信息
Long id = NumberUtils.toLong(response.getBusinessKey());
StandardTicketInfoEntity standardTicketInfoEntity = standardTicketInfoService.getById(id);
@ -310,6 +336,27 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
}
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
StandardTicketInfoEntity entity = standardTicketInfoService.getOne(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
eq(StandardTicketInfoEntity::getId, split[1]);
}});
entity.setIsNormal(false);
entity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
entity.setTaskName(processWorkFlowResponse.getTaskName());
entity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
entity.setNextStepOperator("");
boolean flag = standardTicketInfoService.updateById(entity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/**
* 填充数据

79
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -3,13 +3,16 @@ package com.hnac.hzims.ticket.twoTicket.service.impl;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.common.flow.StartProcessService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.middle.process.feign.ICompensateProcessClient;
import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
@ -51,6 +54,7 @@ import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.message.MessageConstants;
import org.springblade.message.dto.BusinessMessageDTO;
import org.springblade.message.fegin.IMessageClient;
@ -60,7 +64,9 @@ 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.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.Assert;
import javax.servlet.ServletOutputStream;
@ -140,6 +146,7 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
@Value("${hzims.ticket.path.word.templatePath}")
private String templatePath;
private final ICompensateProcessClient compensateProcessClient;
private final TicketInfoDangerService ticketInfoDangerService;
@ -162,7 +169,7 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
*/
// @SneakyThrows
@Override
@Transactional
// @Transactional
public R startUp(WorkTicketVo workTicketVo) {
log.info("ticket:start:request",JSON.toJSONString(workTicketVo));
log.info("执行 com.hnac.hzims.ticket.twoTicket.service.impl【startUp】 。。。方法");
@ -179,7 +186,8 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
R r = this.startProcess(saveEntity, dictValue,"");
return r;
}
private final PlatformTransactionManager transactionManager;
private final TransactionTemplate transactionTemplate;
@Override
public String saveEntity(String entity) {
WorkTicketVo workTicketVo= JSONObject.parseObject(entity, WorkTicketVo.class);
@ -208,7 +216,6 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
throw new ServiceException("票据抬头未配置,请您到站点管理配置");
}
//signage = signage.length() == 2 ? station.getSignage() : station.getSignage().substring(0, 2);
workTicketVo.getWorkTicket().setSignage(station.getSignage());
workTicketVo.getWorkTicket().setSignageCode(station.getCode());
//2. 获取编码
@ -217,6 +224,8 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
if (StringUtils.isBlank(code)) {
throw new ServiceException("服务器异常,请联系管理员");
}
transactionTemplate.setTransactionManager(transactionManager);
String res = transactionTemplate.execute(status -> {
workTicketVo.getWorkTicket().setCode(code);
//保存工作对象
log.info("ticket:start:vo",JSON.toJSONString(workTicketVo.getWorkTicket()));
@ -231,6 +240,8 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
//保存工作任务
this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket());
return JSONObject.toJSONString(workTicketVo);
});
return res;
}
@ -245,7 +256,7 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
if (status.intValue() != workTicketVo.getWorkTicket().getFlowStatus().intValue()) {
return R.success("线下流程,开票成功");
}
Map<String, Object> params = new HashMap<>(4);
Map<String, Object> params = new HashMap<>();
params.put("workTicketVo", workTicketVo);
//获取当前登录人
Long userId = AuthUtil.getUserId();
@ -255,7 +266,10 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
params.put("principal", "taskUser_" + workTicketVo.getWorkTicket().getPrincipal());
}
//已开启流程
R<BladeFlow> processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(dictValue, String.valueOf(workTicketVo.getWorkTicket().getId()), workTicketVo.getWorkTicket().getWorkContent(), params);
R processInstanceContainNameByKey = compensateProcessClient.startFlow(
AuthUtil.getUserId().toString(),dictValue,
FlowUtil.getBusinessKey("hzims_work_ticket_info",String.valueOf(workTicketVo.getWorkTicket().getId())),
workTicketVo.getWorkTicket().getWorkContent(),params);
log.info("processInstanceContainNameByKey.isSuccess() : {}", processInstanceContainNameByKey.isSuccess());
if (!processInstanceContainNameByKey.isSuccess()) {
//保存流程开始失败情况
@ -272,20 +286,24 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
r.setMsg("流程开启失败,请检查流程和用户权限后重试!");
r.setData(params);
return r;
}
log.info("获取启动流程数据 : {}", processInstanceContainNameByKey);
Duration between = Duration.between(start, Instant.now());
log.info("================================================================");
log.info("耗时: " + (between.getSeconds()) + "秒");
log.info("耗时: " + (between.toMillis()) + "毫秒");
log.info("================================================================");
}else {
workTicket.setProcessInstanceId(processInstanceContainNameByKey.getData().toString());
workTicket.setIsNormal(true);
firstWorkTicketService.updateById(workTicket);
return R.success("启动流程成功");
}
}
@Override
public R compensationProcess(String id) {
return null;
WorkTicketInfoEntity entity = firstWorkTicketService.getById(id);
if (ObjectUtils.isNotEmpty(entity)){
WorkTicketVo workTicketVo = new WorkTicketVo();
workTicketVo.setWorkTicket(entity);
String dictValue = getDictValue(workTicketVo);
return this.startProcess(JSON.toJSONString(entity), dictValue,entity.getRemark());
}
return R.fail("找不到对应流程数据,请稍后重试!");
}
/**
@ -321,7 +339,6 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
@Override
@Transactional(rollbackFor = Exception.class)
public void findPending(ProcessWorkFlowResponse response) {
try {
log.info("获取待处理的数据 {}", response);
log.info("获取businessKey: {}", response.getBusinessKey());
@ -332,6 +349,10 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
log.info("获取根据handleType区分是用户还是候选组角色: {}", response.getHandleType());
//json转换表单
String formData = JSON.toJSONString(response.getVariables());
if(ObjectUtils.isNotEmpty(response.getCode())&&700==response.getCode()){
handException(response);
return ;
}
log.info("获取表单的数据:{}", formData);
FristWorkTicketVo fristWorkFlowResponse = null;
try {
@ -343,6 +364,7 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
//获取表单数据
WorkTicketVo workTicketVo = fristWorkFlowResponse.getWorkTicketVo();
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
workTicket.setIsNormal(true);
//2.流程处理
String businessKey = response.getBusinessKey();
WorkTicketInfoEntity workTicketInfo = ticketInfoService.getById(businessKey);
@ -503,10 +525,33 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
}
} catch (Exception e) {
e.printStackTrace();
log.error("工作票流转失败,失败原因:{}",e);
}
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
WorkTicketInfoEntity workTicketInfoEntity = ticketInfoService.getOne(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
eq(WorkTicketInfoEntity::getId, split[1]);
}});
workTicketInfoEntity.setIsNormal(false);
workTicketInfoEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
workTicketInfoEntity.setTaskName(processWorkFlowResponse.getTaskName());
workTicketInfoEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
workTicketInfoEntity.setNextStepOperator("");
boolean flag = ticketInfoService.updateById(workTicketInfoEntity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
@Override
public Boolean offlineTicketFindPending(ProcessWorkFlowResponse response) {
log.info("线下工作票接收到的工作票数据为:{}",JSON.toJSONString(response));
@ -515,6 +560,10 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
log.error("接收到的数据为:{}",JSON.toJSONString(response.getVariables()));
throw new ServiceException("线下工作票处理流程环节接收数据失败,请联系管理员");
});
if(ObjectUtils.isNotEmpty(response.getCode())&&700==response.getCode()){
handException(response);
return false;
}
WorkTicketVo workTicketVo = ticketResponse.getWorkTicketVo();
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
WorkTicketInfoEntity info = firstWorkTicketService.getById(workTicket.getId());

4
hzims-service/ticket/src/main/resources/db/3.0.0.sql

@ -2,11 +2,15 @@ ALTER TABLE `hzims_standard_ticket_info`
ADD COLUMN `remark_flow` text NULL ;
ALTER TABLE `hzims_work_ticket_info`
ADD COLUMN `remark` text NULL ;
ALTER TABLE `hzims_work_task`
ADD COLUMN `remark` text NULL ;
ALTER TABLE `hzims_standard_ticket_info`
ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ;
ALTER TABLE `hzims_work_ticket_info`
ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ;
ALTER TABLE `hzims_work_task`
ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ;
ALTER TABLE `hzims_standard_ticket_info`
ADD COLUMN `em_code` varchar(255) NULL COMMENT '设备编号' ,

2
hzims-service/ticket/src/main/resources/template/template.yml

@ -8,7 +8,7 @@ spring:
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims-ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}

2
hzims-service/weather/src/main/resources/template/template.yml

@ -8,7 +8,7 @@ spring:
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/test_hzims_weather?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims_weather?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}

Loading…
Cancel
Save