Browse Source

Merge remote-tracking branch 'origin/prod'

# Conflicts:
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
#	hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java
zhongwei
ty 11 months ago
parent
commit
3733e27475
  1. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/TicketChartCell.java
  2. 49
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
  3. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DealDutyRecFlowServiceImpl.java
  4. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java
  5. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
  6. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java
  7. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
  8. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java
  9. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java
  10. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java
  11. 8
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  12. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationAttributeServiceImpl.java
  13. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  14. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  15. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java
  16. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  17. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java
  18. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java
  19. 91
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  20. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  21. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  22. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  23. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java
  24. 52
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java
  25. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java
  26. 119
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
  27. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  28. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java
  29. 127
      hzims-service/operational/src/main/resources/log/logback-dev.xml
  30. 127
      hzims-service/operational/src/main/resources/log/logback-prod.xml
  31. 127
      hzims-service/operational/src/main/resources/log/logback-test.xml
  32. BIN
      hzims-service/operational/src/main/resources/template/waterMonReport.docx
  33. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java
  34. 13
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  35. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/TicketChartCell.java

@ -17,10 +17,14 @@ public class TicketChartCell {
private String ticketName; private String ticketName;
@ApiModelProperty(value = "本月数量") @ApiModelProperty(value = "本月数量")
private int ticketMon; private int ticketMon;
@ApiModelProperty(value = "本月合格数量")
private int ticketMonPassCount;
@ApiModelProperty(value = "本月合格率") @ApiModelProperty(value = "本月合格率")
private double ticketMonPerc; private double ticketMonPerc;
@ApiModelProperty(value = "本年数量") @ApiModelProperty(value = "本年数量")
private int ticketYear; private int ticketYear;
@ApiModelProperty(value = "本年合格数量")
private int ticketYearPassCount;
@ApiModelProperty(value = "本年合格率") @ApiModelProperty(value = "本年合格率")
private double ticketYeaPercr; private double ticketYeaPercr;
} }

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

@ -45,7 +45,7 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
//记录操作日志 //记录操作日志
WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog(); WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response,regularWorkflowOperationLog); BeanUtils.copyProperties(response, regularWorkflowOperationLog);
if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) { if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) {
regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
regularWorkflowOperationLog.setTakeId(response.getTaskId()); regularWorkflowOperationLog.setTakeId(response.getTaskId());
@ -53,40 +53,29 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
regularWorkflowOperationLog.setIsOperationLog(true); regularWorkflowOperationLog.setIsOperationLog(true);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId()); regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog); log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog);
workflowOperationLogService.save(regularWorkflowOperationLog);
} }
try {
WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类
ProcessService processService =
ticketServiceList.stream().filter(item -> item.isWorkflowProcess(ticker)).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(processService)) {
//执行业务方法
try {
processService.calculate(response);
} catch (Exception e) {
e.printStackTrace();
//todo 业务出错误 做补偿
log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage());
log.error("业务出错,StandardWorkTicketConsumer: {} ", response);
regularWorkflowOperationLog.setIsOperationLog(false);//调用消费方抛出异常
WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类
ProcessService processService =
ticketServiceList.stream().filter(item -> item.isWorkflowProcess(ticker)).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(processService)) {
//执行业务方法
try {
processService.calculate(response);
} catch (Exception e) {
e.printStackTrace();
//todo 业务出错误 做补偿
log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage());
log.error("业务出错,StandardWorkTicketConsumer: {} ", response);
WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response,workflowOperationLog);
if (ObjectUtils.isNotEmpty(workflowOperationLog)) {
regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
regularWorkflowOperationLog.setTakeId(response.getTaskId());
regularWorkflowOperationLog.setTakeName(response.getTaskName());
regularWorkflowOperationLog.setIsOperationLog(false);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog);
workflowOperationLogService.save(workflowOperationLog);
} }
} }
} finally {
workflowOperationLogService.save(regularWorkflowOperationLog);
} }
} }
} }

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DealDutyRecFlowServiceImpl.java

@ -57,9 +57,12 @@ public class DealDutyRecFlowServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("交接班v4消费流程执行中,param"+response);
R dealtDutyRecFlow = iDutyRecClient.dealDutyRecFlow(response); R dealtDutyRecFlow = iDutyRecClient.dealDutyRecFlow(response);
if (!dealtDutyRecFlow.isSuccess()){ if (!dealtDutyRecFlow.isSuccess()){
log.error("消费交接班失败"+response);
throw new ServiceException("执行交接班v4失败"); throw new ServiceException("执行交接班v4失败");
} }
log.info("交接班v4消费流程结束,param"+response);
} }
} }

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

@ -58,10 +58,12 @@ public class DefectProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("消缺工作流程消费开始---param",response);
R defect = defectClient.saveDefect(response); R defect = defectClient.saveDefect(response);
if (!defect.isSuccess()) { if (!defect.isSuccess()) {
log.error("消缺工作流程消费调取对应业务报错---param",response);
throw new ServiceException("消缺工作流程出现异常呢"); throw new ServiceException("消缺工作流程出现异常呢");
} }
log.info("消缺工作消费流程结束---param",response);
} }
} }

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

@ -61,10 +61,12 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("水力机械工作票消费流程开始---param",response);
Boolean pending = ticketProcessService.findPending(response); Boolean pending = ticketProcessService.findPending(response);
if (!pending) { if (!pending) {
log.error("水力机械工作票消费调用报错---param",response);
throw new ServiceException("水力机械工作票流程出现异常呢"); throw new ServiceException("水力机械工作票流程出现异常呢");
} }
log.info("水力机械工作票消费流程结束---param",response);
} }
} }

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java

@ -58,9 +58,12 @@ public class MaintenanceProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("日常维护消费开始---param",response);
Boolean pending = maintenanceFeignClient.findPending(response); Boolean pending = maintenanceFeignClient.findPending(response);
if (!pending) { if (!pending) {
log.error("日常维护消费报错---param",response);
throw new ServiceException("日常维护业务流程出错呢"); throw new ServiceException("日常维护业务流程出错呢");
} }
log.info("日常维护消费结束---param",response);
} }
} }

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

@ -66,10 +66,12 @@ public class OneTicketProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("工作票消费调用开始---param",response);
Boolean pending = ticketProcessService.findPending(response); Boolean pending = ticketProcessService.findPending(response);
if (!pending) { if (!pending) {
log.error("工作票消费调用异常---param",response);
throw new ServiceException("工作票流程出现异常呢"); throw new ServiceException("工作票流程出现异常呢");
} }
log.info("工作票消费调用结束---param",response);
} }
} }

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java

@ -62,9 +62,12 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("操作票流程消费调用fein接口开始---param",response);
Boolean pending = operationTicketFeignClient.findPending(response); Boolean pending = operationTicketFeignClient.findPending(response);
if (!pending) { if (!pending) {
log.info("操作票流程调用fein接口异常---param",response);
throw new ServiceException("操作票流程出现异常呢"); throw new ServiceException("操作票流程出现异常呢");
} }
log.info("操作票流程消费调用fein接口结束---param",response);
} }
} }

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java

@ -46,9 +46,12 @@ public class OverhaulPlanServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein消费开始---param",response);
R defect = accessPlanV4Client.listener(response); R defect = accessPlanV4Client.listener(response);
if (!defect.isSuccess()) { if (!defect.isSuccess()) {
log.error("检修计划调用fein异常---param",response);
throw new ServiceException("检修计划业务执行异常!"); throw new ServiceException("检修计划业务执行异常!");
} }
log.info("检修计划调用fein结束---param",response);
} }
} }

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

@ -47,10 +47,12 @@ public class OverhaulTaskServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein接口消费开始---param",response);
R defect = accessTaskV4Client.listener(response); R defect = accessTaskV4Client.listener(response);
if (!defect.isSuccess()) { if (!defect.isSuccess()) {
log.error("检修计划调用fein接口消费异常---param",response);
throw new ServiceException("检修任务业务执行异常!"); throw new ServiceException("检修任务业务执行异常!");
} }
log.info("检修计划调用fein接口消费结束---param",response);
} }
} }

8
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -1577,28 +1577,28 @@ public class RealTargetServiceImpl implements RealTargetService {
return; return;
} }
// 有功功率单位 // 有功功率单位
String power = unitMap.get(device.getId()+HomePageConstant.CONCAT_P); String power = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_P);
if(StringUtil.isNotBlank(power)){ if(StringUtil.isNotBlank(power)){
realVo.setPowerUnit(power); realVo.setPowerUnit(power);
} else { } else {
realVo.setPowerUnit("kW"); realVo.setPowerUnit("kW");
} }
// 无功功率 // 无功功率
String reactivePowerUnit = unitMap.get(device.getId()+HomePageConstant.CONCAT_Q); String reactivePowerUnit = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_Q);
if(StringUtil.isNotBlank(reactivePowerUnit)){ if(StringUtil.isNotBlank(reactivePowerUnit)){
realVo.setReactivePowerUnit(reactivePowerUnit); realVo.setReactivePowerUnit(reactivePowerUnit);
} else { } else {
realVo.setReactivePowerUnit("kVa r"); realVo.setReactivePowerUnit("kVa r");
} }
// 定子电压单位 // 定子电压单位
String voltage = unitMap.get(device.getId()+HomePageConstant.CONCAT_UAB); String voltage = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_UAB);
if(StringUtil.isNotBlank(voltage)){ if(StringUtil.isNotBlank(voltage)){
realVo.setVoltageUnit(voltage); realVo.setVoltageUnit(voltage);
} else { } else {
realVo.setVoltageUnit("V"); realVo.setVoltageUnit("V");
} }
// 定子电流单位 // 定子电流单位
String current = unitMap.get(device.getId()+HomePageConstant.CONCAT_IA); String current = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_IA);
if(StringUtil.isNotBlank(current)){ if(StringUtil.isNotBlank(current)){
realVo.setCurrentUnit(current); realVo.setCurrentUnit(current);
} else { } else {

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationAttributeServiceImpl.java

@ -9,8 +9,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -31,6 +30,8 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(list)){
return null; return null;
} }
return list.stream().collect(Collectors.toMap(StationAttributeEntity::getAttributes, StationAttributeEntity::getUnit)); // 属性去重
return list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StationAttributeEntity::getAttributes))), ArrayList::new))
.stream().collect(Collectors.toMap(StationAttributeEntity::getAttributes, StationAttributeEntity::getUnit));
} }
} }

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

@ -325,7 +325,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
taskId = operDefectEntity.getId(); taskId = operDefectEntity.getId();
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功"); log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功");
operPhenomenonEntity.setCurrentOperator("流程结束"); operPhenomenonEntity.setCurrentOperator("流程结束");
operPhenomenonEntity.setCurrentLinkHandler(null); operPhenomenonEntity.setCurrentLinkHandler("");
} }
//更新数据库 //更新数据库
Long statisticsEntityId = statisticsEntity.getId(); Long statisticsEntityId = statisticsEntity.getId();

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

@ -132,7 +132,8 @@ public class ImsDutyRecController extends BladeController {
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)
@ApiOperation(value = "处理工作流程", notes = "传入flow") @ApiOperation(value = "处理工作流程", notes = "传入flow")
public R submit(@Valid @RequestBody BladeFlow flow) { public R submit(@Valid @RequestBody BladeFlow flow) {
return R.status(imsDutyRecService.completeTask(flow)); return R.success("接口已弃用");
// return R.status(imsDutyRecService.completeTask(flow));
} }

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

@ -66,6 +66,9 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExam
//设备ID:分析实例编码 //设备ID:分析实例编码
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition);
if(!analyzeDataByAnalyzeCode.isSuccess()) { if(!analyzeDataByAnalyzeCode.isSuccess()) {
// if(DataResultCode.ANALYZE_INSTANCE_UNDEFINE.getCode()==analyzeDataByAnalyzeCode.getCode()){
// throw new ServiceException("找不到对应的分析实例,请检查好配置后重试!");
// }
throw new ServiceException("设备数据查询异常,请检查好配置后重试!"); throw new ServiceException("设备数据查询异常,请检查好配置后重试!");
} }
return analyzeDataByAnalyzeCode; return analyzeDataByAnalyzeCode;

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

@ -106,6 +106,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
@Override @Override
@Deprecated//2023.12.18
public R submit(ImsDutyRecEntity recEntity, PlanVO vo) { public R submit(ImsDutyRecEntity recEntity, PlanVO vo) {
//获取交班人值班信息 //获取交班人值班信息
ImsDutyMainEntity handDutyMainEntity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ ImsDutyMainEntity handDutyMainEntity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
@ -200,7 +201,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
* @return 交接班成功标识 * @return 交接班成功标识
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public Boolean changeShift(ImsDutyRecDTO recDTO) { public Boolean changeShift(ImsDutyRecDTO recDTO) {
// 获取班组组长 // 获取班组组长
Long managerId = this.getHandleGroupManagerByDuty(recDTO.getDutyId()); Long managerId = this.getHandleGroupManagerByDuty(recDTO.getDutyId());
@ -338,6 +339,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Deprecated//2023.12.18已启弃用
public boolean completeTask(BladeFlow flow) { public boolean completeTask(BladeFlow flow) {
log.info("-----------------打印参数-----------------------" + flow); log.info("-----------------打印参数-----------------------" + flow);
// 创建变量 // 创建变量
@ -1387,16 +1389,26 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
} }
ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class); ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class);
// 更新交班值班 // 更新交班值班
Assert.isTrue(imsDutyMainService.updateById(headDutyMain),() -> { if (ObjectUtil.isNotEmpty(headDutyMain)&&ObjectUtil.isNotEmpty(headDutyMain.getId())) {
throw new RuntimeException("更新交班状态失败,交班执行对象为:"+ JSON.toJSONString(recDTO.getHeadDutyMainVo())); Assert.isTrue(imsDutyMainService.updateById(headDutyMain), () -> {
}); throw new RuntimeException("更新交班状态失败,交班执行对象为:" + JSON.toJSONString(recDTO.getHeadDutyMainVo()));
});
log.info("更新交班状态:"+carryDutyMain);
}
// 更新接班值班 // 更新接班值班
Assert.isTrue(imsDutyMainService.updateById(carryDutyMain),() -> { if (ObjectUtil.isNotEmpty(carryDutyMain)&&ObjectUtil.isNotEmpty(carryDutyMain.getId())) {
throw new RuntimeException("更新接班状态失败,交班执行对象为:"+ JSON.toJSONString(recDTO.getHeadDutyMainVo())); Assert.isTrue(imsDutyMainService.updateById(carryDutyMain), () -> {
}); throw new RuntimeException("更新接班状态失败,交班执行对象为:" + JSON.toJSONString(recDTO.getHeadDutyMainVo()));
});
log.info("更新接班状态:"+carryDutyMain);
}
// 更新交接班 // 更新交接班
this.updateById(dutyRec); if (ObjectUtil.isNotEmpty(dutyRec)&&ObjectUtil.isNotEmpty(dutyRec.getId())) {
return true; return this.updateById(dutyRec);
}else {
log.error("更新交接班记录失败"+dutyRec.toString());
return false;
}
} }
/** /**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java

@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -156,7 +157,7 @@ public class AreaMonthReportController extends BladeController {
@ApiOperation("导出水电站月报") @ApiOperation("导出水电站月报")
@GetMapping("/exportHydropowerStationMonthReport") @GetMapping("/exportHydropowerStationMonthReport")
public R exportHydropowerStationMonthReport(HttpServletResponse response, @ApiParam(value = "日期-年", required = true) Integer year,@ApiParam(value = "日期-月", required = true) Integer month, public R exportHydropowerStationMonthReport(HttpServletResponse response, @ApiParam(value = "日期-年", required = true) Integer year,@ApiParam(value = "日期-月", required = true) Integer month,
@ApiParam(value = "站点Id", required = true) Long deptId,@ApiParam(value = "月报类型", required = true) Long type) { @ApiParam(value = "站点Id", required = true) Long deptId,@ApiParam(value = "月报类型", required = true) Long type) throws ParseException {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
if (Func.isEmpty(year)||Func.isEmpty(deptId)||Func.isEmpty(month)||year==0||deptId==0||month==0){ if (Func.isEmpty(year)||Func.isEmpty(deptId)||Func.isEmpty(month)||year==0||deptId==0||month==0){

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

@ -4,6 +4,7 @@ import com.hnac.hzims.operational.main.vo.AreaMonthReportVo;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -19,9 +20,8 @@ public interface IAreaMonthReportService {
R export(HttpServletResponse response, String date); R export(HttpServletResponse response, String date);
R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month,Long deptId,String name);
R<List<AreaMonthReportVo>> getReportByType(String date, Integer type); R<List<AreaMonthReportVo>> getReportByType(String date, Integer type);
R exportByType(HttpServletResponse response, String date, Integer type); R exportByType(HttpServletResponse response, String date, Integer type);
R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month,Long deptId,String name) throws ParseException;
} }

91
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -258,7 +258,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
return R.data("success"); return R.data("success");
} }
@Override @Override
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String deptName) { public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String deptName) throws ParseException {
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser(); R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()==null){ if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()==null){
return R.fail("用户权限查询失败"); return R.fail("用户权限查询失败");
@ -276,9 +276,9 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery() List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getRefDept, deptIds) .in(StationEntity::getRefDept, deptIds)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)); .eq(StationEntity::getType, HomePageConstant.HYDROPOWER));
stationEntityList=Optional.ofNullable(stationEntityList).orElse(new ArrayList<>()).stream().filter(s->Func.isNotEmpty(s.getCommissionTime())).collect(Collectors.toList()); List<StationEntity> stationEntityListByCommissionTime=Optional.ofNullable(stationEntityList).orElse(new ArrayList<>()).stream().filter(s->Func.isNotEmpty(s.getCommissionTime())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(stationEntityList)) { if (CollectionUtil.isNotEmpty(stationEntityListByCommissionTime)) {
int commissionTime = stationEntityList.stream().map(s -> { int commissionTime = stationEntityListByCommissionTime.stream().map(s -> {
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now()); Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now());
return (int) dur.toDays(); return (int) dur.toDays();
}).reduce(Integer::max).get(); }).reduce(Integer::max).get();
@ -293,10 +293,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Integer yearBefore = year - 1; Integer yearBefore = year - 1;
map.put("yearBefore", yearBefore); map.put("yearBefore", yearBefore);
map.put("month", month); map.put("month", month);
Integer monthBefore = month - 1; String monStartMonBefore = TimeUtils.getEarlyTime(yearBefore, month);
String[] split = monStartMonBefore.split("-");
Integer monthBefore = Integer.valueOf(split[1]);
map.put("monthBefore", monthBefore); map.put("monthBefore", monthBefore);
// map.put("date", date); // map.put("date", date);
map.put("stationName", deptName); map.put("stationName", deptName);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("writeTime", simpleDateFormat.format(new Date())); map.put("writeTime", simpleDateFormat.format(new Date()));
@ -319,7 +320,6 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 今年当月 // 今年当月
String monthStart = TimeUtils.getMonthStart(year, month); String monthStart = TimeUtils.getMonthStart(year, month);
String monthEndV2 = TimeUtils.getMonthEndV2(year, month); String monthEndV2 = TimeUtils.getMonthEndV2(year, month);
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
List<HydropowerUnitRealVo> realsByDept = reals.stream().filter(s -> deptIds.contains(s.getDeptId())).collect(Collectors.toList()); List<HydropowerUnitRealVo> realsByDept = reals.stream().filter(s -> deptIds.contains(s.getDeptId())).collect(Collectors.toList());
// 装机容量占比数据组装 // 装机容量占比数据组装
@ -351,6 +351,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
//装机容量占比图 //装机容量占比图
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400); ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400);
map.put("capacityProportionChart", capacityProportionChart); map.put("capacityProportionChart", capacityProportionChart);
map.put("factoryComparisonChart", "---暂无数据---");
//各发电站发电量环比图+表格数据组装 //各发电站发电量环比图+表格数据组装
List<MonPowerPercentageVo> powerPercentageVoList = getMonPowerPercentageVos(year, month, deptList, deptIds, stationEntityList, stationIds, yearBefore, monthBefore); List<MonPowerPercentageVo> powerPercentageVoList = getMonPowerPercentageVos(year, month, deptList, deptIds, stationEntityList, stationIds, yearBefore, monthBefore);
// getPowerData(deptList, yearStart, yearEnd, yearBeforeStart, yearBeforeEnd, monthStart, monthEnd, beforeMonthStart, beforeMonthEnd, monthStartBeforeYear, monthEndBeforeYear, devices, planYearData, powerPercentageVoList); // getPowerData(deptList, yearStart, yearEnd, yearBeforeStart, yearBeforeEnd, monthStart, monthEnd, beforeMonthStart, beforeMonthEnd, monthStartBeforeYear, monthEndBeforeYear, devices, planYearData, powerPercentageVoList);
@ -372,14 +373,21 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) { for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) {
HashMap<String, String> power = new HashMap<>(); HashMap<String, String> power = new HashMap<>();
power.put("name", monPowerPercentageVo.getDeptName()); power.put("name", monPowerPercentageVo.getDeptName());
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MW"); power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MkWh");
power.put("month",monPowerPercentageVo.getPowerMon()+"MW"); power.put("month",monPowerPercentageVo.getPowerMon()+"MkWh");
powerMap.add(power); powerMap.add(power);
} }
map.put("power", powerMap); map.put("power", powerMap);
String dateFormat="";
if (month<10){
dateFormat=year+"-"+"0"+month;
}else {
dateFormat=year+"-"+month;
}
//表格总计 //表格总计
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, Collections.singletonList(deptId.toString()), year.toString()); List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, Collections.singletonList(deptId.toString()), year + "-" + month); List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, dateFormat);
getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map); getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map);
//发电情况统计表数据 //发电情况统计表数据
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size()); ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size());
@ -392,7 +400,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
temp.put("year", String.valueOf(monPowerPercentageVo.getPowerYear())); temp.put("year", String.valueOf(monPowerPercentageVo.getPowerYear()));
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage() * 100 + "%"); temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage() * 100 + "%");
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage() * 100 + "%"); temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage() * 100 + "%");
temp.put("plan", monPowerPercentageVo.getPlanPercentage() * 100 + "%"); temp.put("plan", monPowerPercentageVo.getPlanPercentage()+ "%");
list.add(temp); list.add(temp);
} }
map.put("powerGeneration", list); map.put("powerGeneration", list);
@ -459,7 +467,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
//表格数据 //表格数据
HashMap<String, String> temp = new HashMap<>(); HashMap<String, String> temp = new HashMap<>();
temp.put("deptName", "总计"); temp.put("deptName", "总计");
temp.put("checkLevel", "无等级"); temp.put("checkLevel", "");
temp.put("findShortagesMon", "0"); temp.put("findShortagesMon", "0");
temp.put("shortagesMon", "0"); temp.put("shortagesMon", "0");
temp.put("findShortagesYear", "0"); temp.put("findShortagesYear", "0");
@ -560,10 +568,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
int count = yearTicketCollect.size(); int count = yearTicketCollect.size();
ticketChartCell.setTicketYear(count); ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList()); List<Long> ticketIds = yearTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
ticketChartCell.setTicketYearPassCount(0);
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds); R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) { if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc); ticketChartCell.setTicketYeaPercr(ticketYearPerc);
ticketChartCell.setTicketYearPassCount(ticketPassCount.getData().intValue());
} }
} }
if (CollectionUtils.isNotEmpty(monthTicketCollect)) { if (CollectionUtils.isNotEmpty(monthTicketCollect)) {
@ -571,10 +581,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
int count = monthTicketCollect.size(); int count = monthTicketCollect.size();
ticketChartCell.setTicketMon(count); ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList()); List<Long> monthTicketIds = monthTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
//合格数量
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds); R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
ticketChartCell.setTicketMonPassCount(0);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) { if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc); ticketChartCell.setTicketMonPerc(ticketMonthPerc);
ticketChartCell.setTicketMonPassCount(ticketMonthPassCount.getData().intValue());
} }
} }
} }
@ -593,9 +606,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketChartCell.setTicketYear(count); ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList()); List<Long> ticketIds = yearOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds); R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
ticketChartCell.setTicketYearPassCount(0);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) { if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc); ticketChartCell.setTicketYeaPercr(ticketYearPerc);
ticketChartCell.setTicketYearPassCount(ticketPassCount.getData().intValue());
} }
} }
if (CollectionUtils.isNotEmpty(monthOperateCollect)) { if (CollectionUtils.isNotEmpty(monthOperateCollect)) {
@ -604,9 +619,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketChartCell.setTicketMon(count); ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList()); List<Long> monthTicketIds = monthOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds); R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
ticketChartCell.setTicketMonPassCount(0);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) { if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc); ticketChartCell.setTicketMonPerc(ticketMonthPerc);
ticketChartCell.setTicketMonPassCount(ticketMonthPassCount.getData().intValue());
} }
} }
} }
@ -626,10 +643,20 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
sumCell.setTicketType(mapTicketChart.getKey()); sumCell.setTicketType(mapTicketChart.getKey());
sumCell.setTicketName(TicketConstants.TicketTypeNameEnum.getTicketNameByType(mapTicketChart.getKey())); sumCell.setTicketName(TicketConstants.TicketTypeNameEnum.getTicketNameByType(mapTicketChart.getKey()));
List<TicketChartCell> ticketChartValue = mapTicketChart.getValue(); List<TicketChartCell> ticketChartValue = mapTicketChart.getValue();
sumCell.setTicketMon(ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMon).sum()); int sumTicketMon = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMon).sum();
sumCell.setTicketYear(ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYear).sum()); sumCell.setTicketMon(sumTicketMon);
sumCell.setTicketMonPerc(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketMonPerc).sum()); int sumTicketYear = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYear).sum();
sumCell.setTicketYeaPercr(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketYeaPercr).sum()); sumCell.setTicketYear(sumTicketYear);
int sumTicketMonPass = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMonPassCount).sum();
int sumTicketYearPass = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYearPassCount).sum();
if (sumTicketMonPass>0&&sumTicketMon>0){
BigDecimal monPassPerc = new BigDecimal(sumTicketMonPass).divide(new BigDecimal(sumTicketMon), 2, BigDecimal.ROUND_UP);
sumCell.setTicketMonPerc(monPassPerc.doubleValue());
}
if (sumTicketYear>0&&sumTicketYearPass>0){
BigDecimal yearPassPerc = new BigDecimal(sumTicketYearPass).divide(new BigDecimal(sumTicketYear), 2, BigDecimal.ROUND_UP);
sumCell.setTicketYeaPercr(yearPassPerc.doubleValue());
}
sumCollect.add(sumCell); sumCollect.add(sumCell);
} }
TicketChartVo ticketChartVo = new TicketChartVo(); TicketChartVo ticketChartVo = new TicketChartVo();
@ -678,6 +705,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
private List<MonPowerPercentageVo> getMonPowerPercentageVos(Integer year, Integer month, List<Dept> deptList, List<Long> deptIds, List<StationEntity> stationEntityList, List<Long> stationIds, Integer yearBefore, Integer monthBefore) { private List<MonPowerPercentageVo> getMonPowerPercentageVos(Integer year, Integer month, List<Dept> deptList, List<Long> deptIds, List<StationEntity> stationEntityList, List<Long> stationIds, Integer yearBefore, Integer monthBefore) {
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList()); List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
//年计划发电量
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>(); List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>();
//水电站,光伏站和带代运维数据近三年数据 //水电站,光伏站和带代运维数据近三年数据
@ -686,7 +714,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<String> listByYearBefore = TimeUtils.getListByYear(yearBefore); List<String> listByYearBefore = TimeUtils.getListByYear(yearBefore);
String monStart = TimeUtils.getMon(year, month); String monStart = TimeUtils.getMon(year, month);
String monStartYearBefore = TimeUtils.getMon(yearBefore, month); String monStartYearBefore = TimeUtils.getMon(yearBefore, month);
String monStartMonBefore = TimeUtils.getMon(year, monthBefore); String monStartMonBefore = TimeUtils.getEarlyTime(yearBefore, month);
// String monStartMonBefore = TimeUtils.getMon(year, monthBefore);
// 格式:站点-日期-发电量 // 格式:站点-日期-发电量
for (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) { for (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) {
String deptNameByKey; String deptNameByKey;
@ -706,31 +735,33 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Double planGeneration = 0d; Double planGeneration = 0d;
List<PlanGenerationEntity> planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList()); List<PlanGenerationEntity> planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(planGenerationById)) { if (CollectionUtils.isNotEmpty(planGenerationById)) {
planGeneration = Double.valueOf(planGenerationById.get(0).getPlanGeneration()); planGeneration = Double.valueOf(planGenerationById.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
} }
//当前机构近三年的数据 //当前机构近三年的数据
Map<String, Float> value = deviceMap.getValue(); Map<String, Float> value = deviceMap.getValue();
//今年发电量 //今年发电量
powerYear=value.entrySet().stream().filter(s->listByYear.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); powerYear=value.entrySet().stream().filter(s->listByYear.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
//转换单位kwh-》万Kwh //转换单位kwh-》万Kwh
powerYear=powerYear.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); powerYear=powerYear.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerYearBefore=value.entrySet().stream().filter(s->listByYearBefore.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); powerYearBefore=value.entrySet().stream().filter(s->listByYearBefore.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerYearBefore=powerYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); powerYearBefore=powerYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerMonth=value.entrySet().stream().filter(s->monStart.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); powerMonth=value.entrySet().stream().filter(s->monStart.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonth=powerMonth.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); powerMonth=powerMonth.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerMonthBefore=value.entrySet().stream().filter(s->monStartMonBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); powerMonthBefore=value.entrySet().stream().filter(s->monStartMonBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonthBefore=powerMonthBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); powerMonthBefore=powerMonthBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerMonthYearBefore=value.entrySet().stream().filter(s->monStartYearBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); powerMonthYearBefore=value.entrySet().stream().filter(s->monStartYearBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonthYearBefore=powerMonthYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); powerMonthYearBefore=powerMonthYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerVo.setPowerYear(powerYear.doubleValue()); powerVo.setPowerYear(powerYear.doubleValue());
powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); powerVo.setPowerYearBefore(powerYearBefore.doubleValue());
BigDecimal yearPercentage = new BigDecimal(0); BigDecimal yearPercentage = new BigDecimal(0);
BigDecimal planPercentage = new BigDecimal(0); BigDecimal planPercentage = new BigDecimal(0);
if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) { if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) {
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP);
yearPercentage.setScale(2, BigDecimal.ROUND_UP);
} }
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) { if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) {
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP);
planPercentage.setScale(2, BigDecimal.ROUND_UP);
} }
powerVo.setPlanPercentage(planPercentage.doubleValue()); powerVo.setPlanPercentage(planPercentage.doubleValue());
powerVo.setPowerYearPercentage(yearPercentage.doubleValue()); powerVo.setPowerYearPercentage(yearPercentage.doubleValue());
@ -740,6 +771,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
BigDecimal monPercentage = new BigDecimal(0); BigDecimal monPercentage = new BigDecimal(0);
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) { if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) {
monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP);
monPercentage.setScale(2, BigDecimal.ROUND_UP);
} }
powerVo.setPowerMonPercentage(monPercentage.doubleValue()); powerVo.setPowerMonPercentage(monPercentage.doubleValue());
powerPercentageVoList.add(powerVo); powerPercentageVoList.add(powerVo);
@ -835,11 +867,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
private static void getTabelSum(Long deptId, List<MonPowerPercentageVo> powerPercentageVoList, List<PlanGenerationEntity> planYearAll, List<PlanGenerationEntity> planMonAll, HashMap<String, Object> map) { private static void getTabelSum(Long deptId, List<MonPowerPercentageVo> powerPercentageVoList, List<PlanGenerationEntity> planYearAll, List<PlanGenerationEntity> planMonAll, HashMap<String, Object> map) {
Float planGeneration = 0f; Float planGeneration = 0f;
if (Func.isNotEmpty(planYearAll)) { if (Func.isNotEmpty(planYearAll)) {
planGeneration = planYearAll.get(0).getPlanGeneration(); planGeneration =Double.valueOf(planYearAll.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()).floatValue() ;
} }
Float planMonGeneration = 0f; Float planMonGeneration = 0f;
if (Func.isNotEmpty(planMonAll)) { if (Func.isNotEmpty(planMonAll)) {
planMonGeneration = planMonAll.get(0).getPlanGeneration(); planMonGeneration =Double.valueOf(planMonAll.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()).floatValue() ;
// planMonGeneration = planMonAll.get(0).getPlanGeneration();
} }
MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); MonPowerPercentageVo powerVo = new MonPowerPercentageVo();
powerVo.setDeptId(deptId); powerVo.setDeptId(deptId);
@ -860,7 +893,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP);
} }
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) { if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) {
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); //因为计划发电量的单位是kwh,发电量已经转换为万kwh,再加上百分比转换所以需要乘以10000*100
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration).divide(new BigDecimal(1000000)), 2, BigDecimal.ROUND_UP);
// 年计划完成率 // 年计划完成率
map.put("yearCompletionRate", planPercentage.toString()); map.put("yearCompletionRate", planPercentage.toString());
} else { } else {
@ -877,7 +911,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 项目月计划完成量 // 项目月计划完成量
BigDecimal planMonPercentage = new BigDecimal(0); BigDecimal planMonPercentage = new BigDecimal(0);
if (powerMonth.compareTo(BigDecimal.ZERO) != 0 && BigDecimal.valueOf(planMonGeneration).compareTo(BigDecimal.ZERO) != 0) { if (powerMonth.compareTo(BigDecimal.ZERO) != 0 && BigDecimal.valueOf(planMonGeneration).compareTo(BigDecimal.ZERO) != 0) {
planMonPercentage = powerMonth.divide(BigDecimal.valueOf(planMonGeneration), 2, BigDecimal.ROUND_UP); //因为计划发电量的单位是kwh,发电量已经转换为万kwh,再加上百分比转换所以需要乘以10000*100
planMonPercentage = powerMonth.divide(BigDecimal.valueOf(planMonGeneration).divide(new BigDecimal(1000000)), 2, BigDecimal.ROUND_UP);
} }
map.put("monCompletionRate", planMonPercentage); map.put("monCompletionRate", planMonPercentage);
BigDecimal powerMonthBefore = powerPercentageVoList.stream() BigDecimal powerMonthBefore = powerPercentageVoList.stream()

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

@ -972,7 +972,7 @@ public class HomePageServiceImpl implements IHomePageService {
} }
int faInvestment = otherList.stream().mapToInt(OtherEntity::getFaQuantity).sum(); int faInvestment = otherList.stream().mapToInt(OtherEntity::getFaQuantity).sum();
distributionNetworkVo.setFaInvestment(faInvestment); distributionNetworkVo.setFaInvestment(faInvestment);
double onlineRate = otherList.stream().mapToDouble(o-> Double.valueOf(o.getOnlineRate())).average().getAsDouble();; double onlineRate = otherList.stream().mapToDouble(o-> Double.parseDouble(o.getOnlineRate())).average().getAsDouble();
if(Math.abs(onlineRate) <= 0){ if(Math.abs(onlineRate) <= 0){
distributionNetworkVo.setOnlineRate("0.0"); distributionNetworkVo.setOnlineRate("0.0");
countDownLatch.countDown(); countDownLatch.countDown();

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

@ -1149,7 +1149,7 @@ public class HydropowerServiceImpl implements HydropowerService {
long on = reals.stream().filter(real -> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId()) && real.getState()).count(); long on = reals.stream().filter(real -> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId()) && real.getState()).count();
long sum = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).count(); long sum = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).count();
if(Math.abs(sum) > 0){ if(Math.abs(sum) > 0){
scale.setDeviceUse(BigDecimal.valueOf(on / (double)sum * 100).setScale(1, RoundingMode.HALF_UP).doubleValue()); scale.setDeviceUse(BigDecimal.valueOf(on / (double)sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
} }
} }
return scale; return scale;

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

@ -137,7 +137,7 @@ public class WindHomeServiceImpl implements WindHomeService {
score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 年发电完成率 // 年发电完成率
if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){ if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){
score.setCompleteRate(BigDecimal.valueOf(score.getGenerateYear() / score.getPlanYear() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); score.setCompleteRate(BigDecimal.valueOf(score.getGenerateYear() / score.getPlanYear() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
} }
// 月发电量 // 月发电量
score.setGenerateMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getPower).sum()); score.setGenerateMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getPower).sum());
@ -145,10 +145,13 @@ public class WindHomeServiceImpl implements WindHomeService {
score.setPlanMon(yearPlans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); score.setPlanMon(yearPlans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 月发电量完成率 // 月发电量完成率
if(Math.abs(score.getGenerateMon()) > 0 && Math.abs(score.getPlanMon()) > 0){ if(Math.abs(score.getGenerateMon()) > 0 && Math.abs(score.getPlanMon()) > 0){
score.setCompleteMonRate(BigDecimal.valueOf(score.getGenerateMon() / score.getPlanMon() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); score.setCompleteMonRate(BigDecimal.valueOf(score.getGenerateMon() / score.getPlanMon() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
} }
// 月平均风速 // 月平均风速
score.setSpeedRate(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getSpeed).average().getAsDouble()); OptionalDouble speed = winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getSpeed).average();;
if(speed.isPresent()){
score.setSpeedRate(speed.getAsDouble());
}
// 月利用小时 // 月利用小时
score.setAvailableMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getAvailable).sum()); score.setAvailableMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getAvailable).sum());
// 日发电量 // 日发电量

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java

@ -55,11 +55,13 @@ public class MaintenanceController {
@PostMapping("/findPending") @PostMapping("/findPending")
@ApiOperation(value = "日常维护待处理") @ApiOperation(value = "日常维护待处理")
public Boolean findPending(@RequestBody ProcessWorkFlowResponse response){ public Boolean findPending(@RequestBody ProcessWorkFlowResponse response){
log.info("日常维护消费处理开始:findPending");
try { try {
maintenanceService.findPending(response); maintenanceService.findPending(response);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("param"+response+"报错信息"+e.toString());
throw new ServiceException("日常维护待处理:" + e.getMessage()); throw new ServiceException("日常维护待处理:" + e.getMessage());
} }
} }

52
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.maintenance.scheduled;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.hnac.hzims.message.dto.PlanMsgRecordDto; import com.hnac.hzims.message.dto.PlanMsgRecordDto;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity; import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.message.fegin.IMessageClient;
@ -10,11 +11,11 @@ import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.mapper.OperMaintenancePlanMapper; import com.hnac.hzims.operational.maintenance.mapper.OperMaintenancePlanMapper;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenancePlanService;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.service.MaintenanceService; import com.hnac.hzims.operational.maintenance.service.MaintenanceService;
import com.hnac.hzims.operational.maintenance.template.service.TemplateService; import com.hnac.hzims.operational.maintenance.template.service.TemplateService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskEntityVo; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskEntityVo;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
@ -29,6 +30,7 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.TransactionStatus;
@ -70,6 +72,7 @@ public class MaintenanceTaskCreateTask {
private final MaintenanceService maintenanceService; private final MaintenanceService maintenanceService;
private final IOperMaintenancePlanService maintenancePlanService;
private final List<TemplateService> templateService; private final List<TemplateService> templateService;
@ -79,7 +82,7 @@ public class MaintenanceTaskCreateTask {
final static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:remind:end:tasks"; final static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:remind:end:tasks";
@XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE) @XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE)
@Transactional // @Transactional
public ReturnT<String> execute(String param) throws Exception { public ReturnT<String> execute(String param) throws Exception {
log.info(TASK_VALUE_MAINTENANCE_TASK_CREATE + " start...................................................................................."); log.info(TASK_VALUE_MAINTENANCE_TASK_CREATE + " start....................................................................................");
Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE);
@ -97,9 +100,19 @@ public class MaintenanceTaskCreateTask {
//生成日常巡检任务并插入数据库 //生成日常巡检任务并插入数据库
for (int i = startIndex; i < endIndex; i++) { for (int i = startIndex; i < endIndex; i++) {
this.generateTaskByPlan(planEntities.get(i),true); Boolean aBoolean = this.generateTaskByPlan(planEntities.get(i), true);
//更新任务派发时间
if (aBoolean) {
//当所有的任务生成后,才会更新计划的时间状态
LambdaUpdateWrapper<OperMaintenancePlanEntity> planEntityLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date());
planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, planEntities.get(i).getId());
maintenancePlanService.update(planEntityLambdaUpdateWrapper);
log.info("更新任务派发"+planEntities.get(i));
}else {
log.error("更新任务派发失败"+planEntities.get(i));
}
} }
Thread.sleep(1000); Thread.sleep(1000);
page++; page++;
} while (page * size < planEntities.size()); } while (page * size < planEntities.size());
@ -113,19 +126,42 @@ public class MaintenanceTaskCreateTask {
* @param planEntity * @param planEntity
* @return * @return
*/ */
public void generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) { public Boolean generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) {
log.info("日常维护计划生成任务开始:param"+planEntity);
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class); OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务 //拆分设备 每个设备生成一条任务
List<Long> taskIds=new ArrayList<>();
if(StringUtil.isNotBlank(planEntity.getEmCode())){ if(StringUtil.isNotBlank(planEntity.getEmCode())){
List<String> emCodeList = Arrays.asList(planEntity.getEmCode().split(",")); List<String> emCodeList = Arrays.asList(planEntity.getEmCode().split(","));
for(String emCode : emCodeList){ for(String emCode : emCodeList){
taskEntity.setEmCode(emCode); //一旦有一条任务失败,则删除当前生成的任务,不更新当前的计划状态
maintenanceService.fillTask(taskEntity,planEntity,flag); try {
taskEntity.setEmCode(emCode);
Long task = maintenanceService.fillTask(taskEntity, planEntity, flag);
if (ObjectUtil.isNotEmpty(task)){
taskIds.add(task);
}
}catch (Exception e){
log.error("日常维护任务生成失败:" + "emCode:" + emCode + "错误原因:" + e);
log.error("日常维护任务生成失败:" + "param:" + planEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
} }
} }
else { else {
maintenanceService.fillTask(taskEntity,planEntity,flag); try {
Long task = maintenanceService.fillTask(taskEntity, planEntity, flag);
if (ObjectUtil.isNotEmpty(task)) {
taskIds.add(task);
}
} catch (Exception e) {
log.error("日常维护任务生成失败:" + "param:" + planEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
} }
return true;
} }
/** /**

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java

@ -38,5 +38,5 @@ public interface MaintenanceService {
* @param taskEntity * @param taskEntity
* @param finalPlanEntity * @param finalPlanEntity
*/ */
void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag); Long fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag);
} }

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

@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO; import com.hnac.hzims.message.dto.BusinessMessageDTO;
@ -38,10 +37,7 @@ import org.springblade.system.feign.ISysClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
@ -49,7 +45,6 @@ import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -87,7 +82,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param ids * @param ids
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public void createTask(List<String> ids) { public void createTask(List<String> ids) {
try { try {
//获取日常维护计划 //获取日常维护计划
@ -95,21 +90,26 @@ public class MaintenanceServiceImpl implements MaintenanceService {
planEntityLambdaQueryWrapper.in(BaseEntity::getId, ids); planEntityLambdaQueryWrapper.in(BaseEntity::getId, ids);
List<OperMaintenancePlanEntity> planEntities = maintenancePlanService.list(planEntityLambdaQueryWrapper); List<OperMaintenancePlanEntity> planEntities = maintenancePlanService.list(planEntityLambdaQueryWrapper);
//筛选当月没生成任务的计划 //筛选当月没生成任务的计划
List<OperMaintenancePlanEntity> finalPlanEntities = planEntities.stream().filter(planEntity -> ObjectUtil.isEmpty(planEntity.getCreateTaskTime()) || !DateUtil.judgeSameDay(DateUtil.DateToLocalDateTime(planEntity.getCreateTaskTime()), LocalDate.now())).collect(Collectors.toList()); List<OperMaintenancePlanEntity> finalPlanEntities = planEntities.stream().
filter(planEntity -> ObjectUtil.isEmpty(planEntity.getCreateTaskTime()) ||
!DateUtil.judgeSameDay(DateUtil.DateToLocalDateTime(planEntity.getCreateTaskTime()), LocalDate.now()))
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(finalPlanEntities)) { if (CollectionUtil.isEmpty(finalPlanEntities)) {
throw new ServiceException("所选计划当天已生成任务"); throw new ServiceException("所选计划当天已生成任务");
} }
for (OperMaintenancePlanEntity finalPlanEntity : finalPlanEntities) { for (OperMaintenancePlanEntity finalPlanEntity : finalPlanEntities) {
// 通过计划生成任务 // 通过计划生成任务
this.createTaskByPlan(finalPlanEntity); Boolean taskByPlan = this.createTaskByPlan(finalPlanEntity);
//更新任务派发时间 if (taskByPlan) {
LambdaUpdateWrapper<OperMaintenancePlanEntity> planEntityLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); //更新任务派发时间
planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date()); LambdaUpdateWrapper<OperMaintenancePlanEntity> planEntityLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId()); planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date());
boolean update = maintenancePlanService.update(planEntityLambdaUpdateWrapper); planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
if (!update) { boolean update = maintenancePlanService.update(planEntityLambdaUpdateWrapper);
log.error("maintenance:generateTask 更新任务派发失败"); if (!update) {
throw new ServiceException("更新任务派发失败"); log.error("maintenance:generateTask 更新任务派发失败");
throw new ServiceException("更新任务派发失败");
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -143,24 +143,26 @@ public class MaintenanceServiceImpl implements MaintenanceService {
// standardTicketInfoVo = (OperMaintenanceTaskEntityVo) jsonObject.get("operMaintenanceTaskEntityVo"); // standardTicketInfoVo = (OperMaintenanceTaskEntityVo) jsonObject.get("operMaintenanceTaskEntityVo");
// standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class); // standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class);
} catch (Exception e) { } catch (Exception e) {
log.error("获取表单出现异常了~~~~"); log.error("获取表单出现异常了~~~~"+response);
throw new IllegalArgumentException(e.getMessage()); throw new IllegalArgumentException(e.getMessage());
} }
//1.查询日常维护信息
Long id = NumberUtils.toLong(response.getBusinessKey());
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在");
return;
}
OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity(); OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity();
BeanUtils.copyProperties(standardTicketInfoVo, entity); BeanUtils.copyProperties(standardTicketInfoVo, entity);
entity.setId(id); //1.查询日常维护信息
//有Id才进行生成操作
if (StringUtils.isNotBlank(response.getBusinessKey())) {
Long id = NumberUtils.toLong(response.getBusinessKey());
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在" + response);
return;
}
entity.setId(id);
//填充日常维护信息 //填充日常维护信息
saveOperMaintenanceTaskEntity(entity, response); saveOperMaintenanceTaskEntity(entity, response);
entity.setProcessInstanceId(response.getProcessInstanceId()); entity.setProcessInstanceId(response.getProcessInstanceId());
taskService.updateById(entity); taskService.updateById(entity);
//推送消息 //推送消息
if (response.getTaskId() != null) { if (response.getTaskId() != null) {
// MessagePushRecordDto message = new MessagePushRecordDto(); // MessagePushRecordDto message = new MessagePushRecordDto();
@ -225,8 +227,10 @@ public class MaintenanceServiceImpl implements MaintenanceService {
} }
log.info("推送成功~"); log.info("推送成功~");
} }
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("日常维护消费异常:param"+response+"报错信息"+e);
} }
} }
@ -266,20 +270,40 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* *
* @param finalPlanEntity * @param finalPlanEntity
*/ */
private void createTaskByPlan(OperMaintenancePlanEntity finalPlanEntity) { private Boolean createTaskByPlan(OperMaintenancePlanEntity finalPlanEntity) {
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(finalPlanEntity, OperMaintenanceTaskEntity.class); OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(finalPlanEntity, OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务 //拆分设备 每个设备生成一条任务
List<Long> taskIds = new ArrayList<>();
if (StringUtil.isNotBlank(finalPlanEntity.getEmCode())) { if (StringUtil.isNotBlank(finalPlanEntity.getEmCode())) {
log.info("finalPlanEntity.getEmCode() : {}", finalPlanEntity.getEmCode()); log.info("finalPlanEntity.getEmCode() : {}", finalPlanEntity.getEmCode());
String[] emCodeList = finalPlanEntity.getEmCode().split(","); String[] emCodeList = finalPlanEntity.getEmCode().split(",");
for (String emCode : emCodeList) { for (String emCode : emCodeList) {
taskEntity.setEmCode(emCode); try {
this.fillTask(taskEntity, finalPlanEntity,false); taskEntity.setEmCode(emCode);
Long task = this.fillTask(taskEntity, finalPlanEntity, false);
if (ObjectUtil.isNotEmpty(task)) {
taskIds.add(task);
}
} catch (Exception e) {
log.error("日常维护任务生成失败:" + "emCode:" + emCode + "错误原因:" + e);
log.error("日常维护任务生成失败:" + "param:" + finalPlanEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
} }
} else { } else {
this.fillTask(taskEntity, finalPlanEntity,false); try {
Long task = this.fillTask(taskEntity, finalPlanEntity, false);
if (ObjectUtil.isNotEmpty(task)) {
taskIds.add(task);
}
} catch (Exception e) {
log.error("日常维护任务生成失败:" + "param:" + finalPlanEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
} }
return true;
} }
@ -290,7 +314,8 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param finalPlanEntity * @param finalPlanEntity
*/ */
@Override @Override
public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag) { // @Transactional(rollbackFor = Exception.class)
public Long fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity, Boolean flag) {
// DefaultTransactionDefinition = new DefaultTransactionDefinition(); // DefaultTransactionDefinition = new DefaultTransactionDefinition();
// defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
// TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition); // TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition);
@ -320,29 +345,31 @@ public class MaintenanceServiceImpl implements MaintenanceService {
taskEntity.setDisposer(userId.replaceAll("\\^", ",")); taskEntity.setDisposer(userId.replaceAll("\\^", ","));
} else { } else {
log.info("计划ID为:{}未查询到排班记录", finalPlanEntity.getId()); log.info("计划ID为:{}未查询到排班记录", finalPlanEntity.getId());
LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate() // LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date()) // .set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId()); // .eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
maintenancePlanService.update(planQueryWrapper); // maintenancePlanService.update(planQueryWrapper);
return; return null;
} }
} }
taskService.save(taskEntity); taskService.save(taskEntity);
// dataSourceTransactionManager.commit(transaction); // dataSourceTransactionManager.commit(transaction);
//等当前计划的所有任务生成后更新当前计划时间
// LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
// .set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
// .eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
// maintenancePlanService.update(planQueryWrapper);
executor.execute(() -> {
OperMaintenanceTaskEntity maintenanceTask = taskService.getById(taskEntity.getId());
this.pushTaskMessage(maintenanceTask);
});
//启动流程 //启动流程
String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity,flag); String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity, flag);
LambdaUpdateWrapper<OperMaintenanceTaskEntity> taskQueryWrapper = Wrappers.<OperMaintenanceTaskEntity>lambdaUpdate() LambdaUpdateWrapper<OperMaintenanceTaskEntity> taskQueryWrapper = Wrappers.<OperMaintenanceTaskEntity>lambdaUpdate()
.set(OperMaintenanceTaskEntity::getProcessInstanceId, processInstanceId) .set(OperMaintenanceTaskEntity::getProcessInstanceId, processInstanceId)
.eq(OperMaintenanceTaskEntity::getId, taskEntity.getId()); .eq(OperMaintenanceTaskEntity::getId, taskEntity.getId());
taskService.update(taskQueryWrapper); taskService.update(taskQueryWrapper);
LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate() return taskEntity.getId();
.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
maintenancePlanService.update(planQueryWrapper);
executor.execute(() -> {
OperMaintenanceTaskEntity maintenanceTask = taskService.getById(taskEntity.getId());
this.pushTaskMessage(maintenanceTask);
});
} }

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

@ -36,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -147,8 +148,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
if (!CollectionUtils.isEmpty(req.getDeptIds())) { if (!CollectionUtils.isEmpty(req.getDeptIds())) {
in(OperMaintenanceTaskEntity::getCreateDept, req.getDeptIds()); in(OperMaintenanceTaskEntity::getCreateDept, req.getDeptIds());
} }
if (req.getCreateDept() != null) { if (!ObjectUtil.isEmpty(req.getCreateDept())) {
eq(OperMaintenanceTaskEntity::getCreateDept, req.getCreateDept()); in(OperMaintenanceTaskEntity::getCreateDept, req.getCreateDept());
} }
if (StringUtil.isNoneBlank(req.getFlowTaskName())) { if (StringUtil.isNoneBlank(req.getFlowTaskName())) {
eq(OperMaintenanceTaskEntity::getFlowTaskName, req.getFlowTaskName()); eq(OperMaintenanceTaskEntity::getFlowTaskName, req.getFlowTaskName());
@ -516,10 +517,11 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
private VoteChartVo getVoteChartVo(List<OperMaintenanceTaskEntity> list) { private VoteChartVo getVoteChartVo(List<OperMaintenanceTaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo(); VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList()); List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> StringUtil.isNotBlank(s.getFlowTaskName())&&"结束".equals(s.getFlowTaskName())).map(BaseEntity::getId).collect(Collectors.toList());
List<Long> undoneIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 3).map(s -> s.getId()).collect(Collectors.toList()); //没有流程名称或者流程名称不等于结束,都算未完成
List<Long> undoneIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> StringUtil.isBlank(s.getFlowTaskName())||!"结束".equals(s.getFlowTaskName())).map(BaseEntity::getId).collect(Collectors.toList());
voteChartVo.setSumNum(list.size()); voteChartVo.setSumNum(list.size());
voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList())); voteChartVo.setSumIds(list.stream().map(BaseEntity::getId).collect(Collectors.toList()));
voteChartVo.setFinishNum(finishIds.size()); voteChartVo.setFinishNum(finishIds.size());
voteChartVo.setFinishIds(finishIds); voteChartVo.setFinishIds(finishIds);
voteChartVo.setUndoneNum(undoneIds.size()); voteChartVo.setUndoneNum(undoneIds.size());

22
hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java

@ -112,7 +112,7 @@ public class TimeUtils {
} }
public static List<String> getListByYear(Integer year) { public static List<String> getListByYear(Integer year) {
List<String> monthList=new ArrayList<>(); List<String> monthList=new ArrayList<>();
for (int i = 1; i <13; i++) { for (int i = 0; i <12; i++) {
// 创建一个Calendar对象 // 创建一个Calendar对象
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
// 设置年份 // 设置年份
@ -143,4 +143,24 @@ public class TimeUtils {
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ; String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ;
return start; return start;
} }
public static String getEarlyTime(Integer year, Integer month) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, month-1);
// 设置日期为1
calendar.set(Calendar.DATE, 1);
// 设置时间为0点0分0秒
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.add(Calendar.MONTH, -1);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ;
return start;
}
} }

127
hzims-service/operational/src/main/resources/log/logback-dev.xml

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
<!-- 自定义参数监听 -->
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<property name="log.pattern"
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/>
<!-- 生成日志文件 -->
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存10天 一天24个文件,一小时生成一个-->
<MaxHistory>240</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 生成日志文件 -->
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存15天 一天24个文件,一小时生成一个-->
<MaxHistory>360</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="STDOUT"/>
<!--<appender-ref ref="INFO"/>-->
<appender-ref ref="ERROR"/>
</root>
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="druid.sql" level="ERROR"/>
<!-- MyBatis log configure -->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<!-- 减少部分debug日志 -->
<logger name="druid.sql" level="ERROR"/>
<logger name="org.apache.shiro" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="org.springframework" level="ERROR"/>
<logger name="org.springframework.context" level="ERROR"/>
<logger name="org.springframework.beans" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.apache.ibatis.io" level="ERROR"/>
<logger name="org.apache.velocity" level="ERROR"/>
<logger name="org.eclipse.jetty" level="ERROR"/>
<logger name="io.undertow" level="ERROR"/>
<logger name="org.xnio.nio" level="ERROR"/>
<logger name="org.thymeleaf" level="ERROR"/>
<logger name="springfox.documentation" level="ERROR"/>
<logger name="org.hibernate.validator" level="ERROR"/>
<logger name="com.netflix.loadbalancer" level="ERROR"/>
<logger name="com.netflix.hystrix" level="ERROR"/>
<logger name="com.netflix.zuul" level="ERROR"/>
<logger name="de.codecentric" level="ERROR"/>
<!-- cache ERROR -->
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="org.springframework.cache" level="ERROR"/>
<!-- cloud -->
<logger name="org.apache.http" level="ERROR"/>
<logger name="com.netflix.discovery" level="ERROR"/>
<logger name="com.netflix.eureka" level="ERROR"/>
<!-- 业务日志 -->
<Logger name="org.springblade" level="ERROR"/>
<Logger name="org.springblade.core.version" level="ERROR"/>
<!-- 减少nacos日志 -->
<logger name="com.alibaba.nacos" level="ERROR"/>
</configuration>

127
hzims-service/operational/src/main/resources/log/logback-prod.xml

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
<!-- 自定义参数监听 -->
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<property name="log.pattern"
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/>
<!-- 生成日志文件 -->
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存10天 一天24个文件,一小时生成一个-->
<MaxHistory>240</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 生成日志文件 -->
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存15天 一天24个文件,一小时生成一个-->
<MaxHistory>360</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="STDOUT"/>
<!--<appender-ref ref="INFO"/>-->
<appender-ref ref="ERROR"/>
</root>
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="druid.sql" level="ERROR"/>
<!-- MyBatis log configure -->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<!-- 减少部分debug日志 -->
<logger name="druid.sql" level="ERROR"/>
<logger name="org.apache.shiro" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="org.springframework" level="ERROR"/>
<logger name="org.springframework.context" level="ERROR"/>
<logger name="org.springframework.beans" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.apache.ibatis.io" level="ERROR"/>
<logger name="org.apache.velocity" level="ERROR"/>
<logger name="org.eclipse.jetty" level="ERROR"/>
<logger name="io.undertow" level="ERROR"/>
<logger name="org.xnio.nio" level="ERROR"/>
<logger name="org.thymeleaf" level="ERROR"/>
<logger name="springfox.documentation" level="ERROR"/>
<logger name="org.hibernate.validator" level="ERROR"/>
<logger name="com.netflix.loadbalancer" level="ERROR"/>
<logger name="com.netflix.hystrix" level="ERROR"/>
<logger name="com.netflix.zuul" level="ERROR"/>
<logger name="de.codecentric" level="ERROR"/>
<!-- cache INFO -->
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="org.springframework.cache" level="ERROR"/>
<!-- cloud -->
<logger name="org.apache.http" level="ERROR"/>
<logger name="com.netflix.discovery" level="ERROR"/>
<logger name="com.netflix.eureka" level="ERROR"/>
<!-- 业务日志 -->
<Logger name="org.springblade" level="ERROR"/>
<Logger name="org.springblade.core.version" level="ERROR"/>
<!-- 减少nacos日志 -->
<logger name="com.alibaba.nacos" level="ERROR"/>
</configuration>

127
hzims-service/operational/src/main/resources/log/logback-test.xml

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
<!-- 自定义参数监听 -->
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<property name="log.pattern"
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/>
<!-- 生成日志文件
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
&lt;!&ndash; 日志文件输出的文件名 &ndash;&gt;
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
&lt;!&ndash;设置保存10天 一天24个文件,一小时生成一个&ndash;&gt;
<MaxHistory>240</MaxHistory>
&lt;!&ndash;给定日志文件大小,超过指定的大小就新建一个日志文件&ndash;&gt;
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> &lt;!&ndash; 总日志大小 &ndash;&gt;
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
&lt;!&ndash; 打印日志级别 &ndash;&gt;
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>-->
<!-- 生成日志文件 -->
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存15天 一天24个文件,一小时生成一个-->
<MaxHistory>360</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="STDOUT"/>
<!--<appender-ref ref="INFO"/>-->
<appender-ref ref="ERROR"/>
</root>
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="druid.sql" level="ERROR"/>
<!-- MyBatis log configure -->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<!-- 减少部分debug日志 -->
<logger name="druid.sql" level="ERROR"/>
<logger name="org.apache.shiro" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="org.springframework" level="ERROR"/>
<logger name="org.springframework.context" level="ERROR"/>
<logger name="org.springframework.beans" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.apache.ibatis.io" level="ERROR"/>
<logger name="org.apache.velocity" level="ERROR"/>
<logger name="org.eclipse.jetty" level="ERROR"/>
<logger name="io.undertow" level="ERROR"/>
<logger name="org.xnio.nio" level="ERROR"/>
<logger name="org.thymeleaf" level="ERROR"/>
<logger name="springfox.documentation" level="ERROR"/>
<logger name="org.hibernate.validator" level="ERROR"/>
<logger name="com.netflix.loadbalancer" level="ERROR"/>
<logger name="com.netflix.hystrix" level="ERROR"/>
<logger name="com.netflix.zuul" level="ERROR"/>
<logger name="de.codecentric" level="ERROR"/>
<!-- cache INFO -->
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="org.springframework.cache" level="ERROR"/>
<!-- cloud -->
<logger name="org.apache.http" level="ERROR"/>
<logger name="com.netflix.discovery" level="ERROR"/>
<logger name="com.netflix.eureka" level="ERROR"/>
<!-- 业务日志 -->
<Logger name="org.springblade" level="ERROR"/>
<Logger name="org.springblade.core.version" level="ERROR"/>
<!-- 减少nacos日志 -->
<logger name="com.alibaba.nacos" level="ERROR"/>
</configuration>

BIN
hzims-service/operational/src/main/resources/template/waterMonReport.docx

Binary file not shown.

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java

@ -626,7 +626,7 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
}).collect(Collectors.toList()); }).collect(Collectors.toList());
workTicketInfoMap.put("measureMapList", collect); workTicketInfoMap.put("measureMapList", collect);
Map<String, Object> resultMap = OperationWordHelper.resultMap(workTicketInfoMap); Map<String, Object> resultMap = OperationWordHelper.resultMap(workTicketInfoMap);
String workTicketStatus = this.getWorkTicketStatus(status); String workTicketStatus =getWorkTicketStatus(status);
String os = TicketConstant.OS_NAME; String os = TicketConstant.OS_NAME;
//Windows操作系统 //Windows操作系统
if (os != null && os.toLowerCase().startsWith("windows")) { if (os != null && os.toLowerCase().startsWith("windows")) {

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

@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO; import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.middle.process.feign.ProcessDictFeignService; import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
@ -59,7 +58,6 @@ import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -963,7 +961,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
for (WorkTicketSafetyMeasureEntity measureVO : workTicketSafetyMeasureEntities) { for (WorkTicketSafetyMeasureEntity measureVO : workTicketSafetyMeasureEntities) {
String type = measureEnum.getType(); String type = measureEnum.getType();
if (tempIndex != Integer.valueOf(type)) { if (tempIndex != Integer.valueOf(type)) {
index = 1; // index = 1;
tempIndex++; tempIndex++;
} }
log.info("获取安全措施的信息: {}", measureVO); log.info("获取安全措施的信息: {}", measureVO);
@ -984,7 +982,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//验证工作措施是有有数据 //验证工作措施是有有数据
this.isMatterLibraryList(workTicketInfoMap1); this.isMatterLibraryList(workTicketInfoMap1);
// 工作地点保留带电部位或注意事项 // 工作地点保留带电部位或注意事项
this.matterLibraryListWithMap(workTicketInfoMap1); matterLibraryListWithMap(workTicketInfoMap1);
result.putAll(workTicketInfoMap1); result.putAll(workTicketInfoMap1);
} }
@ -1025,12 +1023,13 @@ public class TicketProcessServiceImpl implements TicketProcessService {
List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers(); List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers();
if (CollectionUtils.isNotEmpty(ticketInfoDangers)) { if (CollectionUtils.isNotEmpty(ticketInfoDangers)) {
Map<String, List<Map<String, Object>>> map = new HashMap<>(); Map<String, List<Map<String, Object>>> map = new HashMap<>();
int index = 1; int[] index = {1};
List<Map<String, Object>> collect = ticketInfoDangers.stream().map(item -> { List<Map<String, Object>> collect = ticketInfoDangers.stream().map(item -> {
Map<String, Object> newItem = new HashMap<>(); Map<String, Object> newItem = new HashMap<>();
newItem.put("index", index); newItem.put("index", index[0]);
newItem.put("maintenance", item.getMaintenance() == null ? "\u00A0" : item.getMaintenance()); newItem.put("maintenance", item.getMaintenance() == null ? "\u00A0" : item.getMaintenance());
newItem.put("dangerousPoint", item.getDangerousPoint() == null ? "\u00A0" : item.getDangerousPoint()); newItem.put("dangerousPoint", item.getDangerousPoint() == null ? "\u00A0" : item.getDangerousPoint());
index[0]++;
return newItem; return newItem;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -1041,7 +1040,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
WordMapUtils.newMapWithList("ticketInfoDangers", result, true, 4, "maintenance", "dangerousPoint"); WordMapUtils.newMapWithList("ticketInfoDangers", result, true, 4, "maintenance", "dangerousPoint");
//7. 是否包含 //7. 是否包含
this.isExists(result); isExists(result);
//8. 存入新的数据 //8. 存入新的数据
this.addMapPut(result); this.addMapPut(result);

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

@ -59,7 +59,7 @@ public class OfflineTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMapp
private final IWorkTicketContentService contentService; private final IWorkTicketContentService contentService;
private final IUserClient userClient; private final IUserClient userClient;
private final IWorkTicketFlowService workTicketFlowService; private final IWorkTicketFlowService workTicketFlowService;
private static Lock lock = new ReentrantLock(); private final Lock lock = new ReentrantLock();
/** /**
* 线下工作票开票 * 线下工作票开票

Loading…
Cancel
Save