Browse Source

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

zhongwei
haungxing 11 months ago
parent
commit
6ccd1c95b3
  1. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/TicketChartCell.java
  2. 21
      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. 20
      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. 3
      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. 50
      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. 89
      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. 4
      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;
@ApiModelProperty(value = "本月数量")
private int ticketMon;
@ApiModelProperty(value = "本月合格数量")
private int ticketMonPassCount;
@ApiModelProperty(value = "本月合格率")
private double ticketMonPerc;
@ApiModelProperty(value = "本年数量")
private int ticketYear;
@ApiModelProperty(value = "本年合格数量")
private int ticketYearPassCount;
@ApiModelProperty(value = "本年合格率")
private double ticketYeaPercr;
}

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

@ -53,10 +53,8 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
regularWorkflowOperationLog.setIsOperationLog(true);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog);
workflowOperationLogService.save(regularWorkflowOperationLog);
}
try {
WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类
@ -71,22 +69,13 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
//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);
}
regularWorkflowOperationLog.setIsOperationLog(false);//调用消费方抛出异常
}
}
} 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
public void calculate(ProcessWorkFlowResponse response) {
log.info("交接班v4消费流程执行中,param"+response);
R dealtDutyRecFlow = iDutyRecClient.dealDutyRecFlow(response);
if (!dealtDutyRecFlow.isSuccess()){
log.error("消费交接班失败"+response);
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
public void calculate(ProcessWorkFlowResponse response) {
log.info("消缺工作流程消费开始---param",response);
R defect = defectClient.saveDefect(response);
if (!defect.isSuccess()) {
log.error("消缺工作流程消费调取对应业务报错---param",response);
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
public void calculate(ProcessWorkFlowResponse response) {
log.info("水力机械工作票消费流程开始---param",response);
Boolean pending = ticketProcessService.findPending(response);
if (!pending) {
log.error("水力机械工作票消费调用报错---param",response);
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
public void calculate(ProcessWorkFlowResponse response) {
log.info("日常维护消费开始---param",response);
Boolean pending = maintenanceFeignClient.findPending(response);
if (!pending) {
log.error("日常维护消费报错---param",response);
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
public void calculate(ProcessWorkFlowResponse response) {
log.info("工作票消费调用开始---param",response);
Boolean pending = ticketProcessService.findPending(response);
if (!pending) {
log.error("工作票消费调用异常---param",response);
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
public void calculate(ProcessWorkFlowResponse response) {
log.info("操作票流程消费调用fein接口开始---param",response);
Boolean pending = operationTicketFeignClient.findPending(response);
if (!pending) {
log.info("操作票流程调用fein接口异常---param",response);
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
public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein消费开始---param",response);
R defect = accessPlanV4Client.listener(response);
if (!defect.isSuccess()) {
log.error("检修计划调用fein异常---param",response);
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
public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein接口消费开始---param",response);
R defect = accessTaskV4Client.listener(response);
if (!defect.isSuccess()) {
log.error("检修计划调用fein接口消费异常---param",response);
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

@ -1515,28 +1515,28 @@ public class RealTargetServiceImpl implements RealTargetService {
return;
}
// 有功功率单位
String power = unitMap.get(device.getId()+HomePageConstant.CONCAT_P);
String power = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_P);
if(StringUtil.isNotBlank(power)){
realVo.setPowerUnit(power);
} else {
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)){
realVo.setReactivePowerUnit(reactivePowerUnit);
} else {
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)){
realVo.setVoltageUnit(voltage);
} else {
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)){
realVo.setCurrentUnit(current);
} 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.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -31,6 +30,8 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
if(CollectionUtil.isEmpty(list)){
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

@ -274,7 +274,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
taskId = operDefectEntity.getId();
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功");
operPhenomenonEntity.setCurrentOperator("流程结束");
operPhenomenonEntity.setCurrentLinkHandler(null);
operPhenomenonEntity.setCurrentLinkHandler("");
}
//更新数据库
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)
@ApiOperation(value = "处理工作流程", notes = "传入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:分析实例编码
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition);
if(!analyzeDataByAnalyzeCode.isSuccess()) {
// if(DataResultCode.ANALYZE_INSTANCE_UNDEFINE.getCode()==analyzeDataByAnalyzeCode.getCode()){
// throw new ServiceException("找不到对应的分析实例,请检查好配置后重试!");
// }
throw new ServiceException("设备数据查询异常,请检查好配置后重试!");
}
return analyzeDataByAnalyzeCode;

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

@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -125,7 +126,7 @@ public class AreaMonthReportController extends BladeController {
@ApiOperation("导出水电站月报")
@GetMapping("/exportHydropowerStationMonthReport")
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<>();
if (Func.isEmpty(year)||Func.isEmpty(deptId)||Func.isEmpty(month)||year==0||deptId==0||month==0){

3
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 javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
@ -18,5 +19,5 @@ public interface IAreaMonthReportService {
R export(HttpServletResponse response, String date);
R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month,Long deptId,String name);
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

@ -201,7 +201,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
return R.data("success");
}
@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();
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()==null){
return R.fail("用户权限查询失败");
@ -219,9 +219,9 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getRefDept, deptIds)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER));
stationEntityList=Optional.ofNullable(stationEntityList).orElse(new ArrayList<>()).stream().filter(s->Func.isNotEmpty(s.getCommissionTime())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(stationEntityList)) {
int commissionTime = stationEntityList.stream().map(s -> {
List<StationEntity> stationEntityListByCommissionTime=Optional.ofNullable(stationEntityList).orElse(new ArrayList<>()).stream().filter(s->Func.isNotEmpty(s.getCommissionTime())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(stationEntityListByCommissionTime)) {
int commissionTime = stationEntityListByCommissionTime.stream().map(s -> {
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now());
return (int) dur.toDays();
}).reduce(Integer::max).get();
@ -236,10 +236,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Integer yearBefore = year - 1;
map.put("yearBefore", yearBefore);
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("date", date);
map.put("stationName", deptName);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("writeTime", simpleDateFormat.format(new Date()));
@ -262,7 +263,6 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 今年当月
String monthStart = TimeUtils.getMonthStart(year, month);
String monthEndV2 = TimeUtils.getMonthEndV2(year, month);
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());
// 装机容量占比数据组装
@ -294,6 +294,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
//装机容量占比图
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400);
map.put("capacityProportionChart", capacityProportionChart);
map.put("factoryComparisonChart", "---暂无数据---");
//各发电站发电量环比图+表格数据组装
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);
@ -315,14 +316,21 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) {
HashMap<String, String> power = new HashMap<>();
power.put("name", monPowerPercentageVo.getDeptName());
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MW");
power.put("month",monPowerPercentageVo.getPowerMon()+"MW");
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MkWh");
power.put("month",monPowerPercentageVo.getPowerMon()+"MkWh");
powerMap.add(power);
}
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<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, Collections.singletonList(deptId.toString()), year + "-" + month);
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, dateFormat);
getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map);
//发电情况统计表数据
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size());
@ -335,7 +343,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
temp.put("year", String.valueOf(monPowerPercentageVo.getPowerYear()));
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage() * 100 + "%");
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage() * 100 + "%");
temp.put("plan", monPowerPercentageVo.getPlanPercentage() * 100 + "%");
temp.put("plan", monPowerPercentageVo.getPlanPercentage()+ "%");
list.add(temp);
}
map.put("powerGeneration", list);
@ -402,7 +410,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
//表格数据
HashMap<String, String> temp = new HashMap<>();
temp.put("deptName", "总计");
temp.put("checkLevel", "无等级");
temp.put("checkLevel", "");
temp.put("findShortagesMon", "0");
temp.put("shortagesMon", "0");
temp.put("findShortagesYear", "0");
@ -503,10 +511,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
int count = yearTicketCollect.size();
ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
ticketChartCell.setTicketYearPassCount(0);
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc);
ticketChartCell.setTicketYearPassCount(ticketPassCount.getData().intValue());
}
}
if (CollectionUtils.isNotEmpty(monthTicketCollect)) {
@ -514,10 +524,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
int count = monthTicketCollect.size();
ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
//合格数量
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
ticketChartCell.setTicketMonPassCount(0);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc);
ticketChartCell.setTicketMonPassCount(ticketMonthPassCount.getData().intValue());
}
}
}
@ -536,9 +549,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
ticketChartCell.setTicketYearPassCount(0);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc);
ticketChartCell.setTicketYearPassCount(ticketPassCount.getData().intValue());
}
}
if (CollectionUtils.isNotEmpty(monthOperateCollect)) {
@ -547,9 +562,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
ticketChartCell.setTicketMonPassCount(0);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc);
ticketChartCell.setTicketMonPassCount(ticketMonthPassCount.getData().intValue());
}
}
}
@ -569,10 +586,20 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
sumCell.setTicketType(mapTicketChart.getKey());
sumCell.setTicketName(TicketConstants.TicketTypeNameEnum.getTicketNameByType(mapTicketChart.getKey()));
List<TicketChartCell> ticketChartValue = mapTicketChart.getValue();
sumCell.setTicketMon(ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMon).sum());
sumCell.setTicketYear(ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYear).sum());
sumCell.setTicketMonPerc(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketMonPerc).sum());
sumCell.setTicketYeaPercr(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketYeaPercr).sum());
int sumTicketMon = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMon).sum();
sumCell.setTicketMon(sumTicketMon);
int sumTicketYear = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYear).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);
}
TicketChartVo ticketChartVo = new TicketChartVo();
@ -621,6 +648,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) {
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
//年计划发电量
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>();
//水电站,光伏站和带代运维数据近三年数据
@ -629,7 +657,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<String> listByYearBefore = TimeUtils.getListByYear(yearBefore);
String monStart = TimeUtils.getMon(year, 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()) {
String deptNameByKey;
@ -649,31 +678,33 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Double planGeneration = 0d;
List<PlanGenerationEntity> planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList());
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();
//今年发电量
powerYear=value.entrySet().stream().filter(s->listByYear.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
//转换单位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=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=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=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=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.setPowerYearBefore(powerYearBefore.doubleValue());
BigDecimal yearPercentage = new BigDecimal(0);
BigDecimal planPercentage = new BigDecimal(0);
if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) {
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP);
yearPercentage.setScale(2, BigDecimal.ROUND_UP);
}
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) {
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP);
planPercentage.setScale(2, BigDecimal.ROUND_UP);
}
powerVo.setPlanPercentage(planPercentage.doubleValue());
powerVo.setPowerYearPercentage(yearPercentage.doubleValue());
@ -683,6 +714,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
BigDecimal monPercentage = new BigDecimal(0);
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) {
monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP);
monPercentage.setScale(2, BigDecimal.ROUND_UP);
}
powerVo.setPowerMonPercentage(monPercentage.doubleValue());
powerPercentageVoList.add(powerVo);
@ -778,11 +810,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) {
Float planGeneration = 0f;
if (Func.isNotEmpty(planYearAll)) {
planGeneration = planYearAll.get(0).getPlanGeneration();
planGeneration =Double.valueOf(planYearAll.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()).floatValue() ;
}
Float planMonGeneration = 0f;
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();
powerVo.setDeptId(deptId);
@ -803,7 +836,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP);
}
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());
} else {
@ -820,7 +854,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 项目月计划完成量
BigDecimal planMonPercentage = new BigDecimal(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);
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();
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){
distributionNetworkVo.setOnlineRate("0.0");
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 sum = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).count();
if(Math.abs(sum) > 0){
scale.setDeviceUse(BigDecimal.valueOf(on / sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
scale.setDeviceUse(BigDecimal.valueOf(on / (double)sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
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());
// 年发电完成率
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());
@ -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());
// 月发电量完成率
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());
// 日发电量

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

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

50
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.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.entity.config.MessageTemplateEntity;
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.OperMaintenanceTaskEntity;
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.MaintenanceService;
import com.hnac.hzims.operational.maintenance.template.service.TemplateService;
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.handler.annotation.XxlJob;
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.data.redis.core.RedisTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
@ -70,6 +72,7 @@ public class MaintenanceTaskCreateTask {
private final MaintenanceService maintenanceService;
private final IOperMaintenancePlanService maintenancePlanService;
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";
@XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE)
@Transactional
// @Transactional
public ReturnT<String> execute(String param) throws Exception {
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);
@ -97,9 +100,19 @@ public class MaintenanceTaskCreateTask {
//生成日常巡检任务并插入数据库
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);
page++;
} while (page * size < planEntities.size());
@ -113,19 +126,42 @@ public class MaintenanceTaskCreateTask {
* @param planEntity
* @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);
//拆分设备 每个设备生成一条任务
List<Long> taskIds=new ArrayList<>();
if(StringUtil.isNotBlank(planEntity.getEmCode())){
List<String> emCodeList = Arrays.asList(planEntity.getEmCode().split(","));
for(String emCode : emCodeList){
//一旦有一条任务失败,则删除当前生成的任务,不更新当前的计划状态
try {
taskEntity.setEmCode(emCode);
maintenanceService.fillTask(taskEntity,planEntity,flag);
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 {
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 finalPlanEntity
*/
void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag);
Long fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag);
}

89
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.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.message.MessageConstants;
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.jdbc.datasource.DataSourceTransactionManager;
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.support.DefaultTransactionDefinition;
import java.time.Instant;
import java.time.LocalDate;
@ -49,7 +45,6 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -87,7 +82,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param ids
*/
@Override
@Transactional(rollbackFor = Exception.class)
// @Transactional(rollbackFor = Exception.class)
public void createTask(List<String> ids) {
try {
//获取日常维护计划
@ -95,13 +90,17 @@ public class MaintenanceServiceImpl implements MaintenanceService {
planEntityLambdaQueryWrapper.in(BaseEntity::getId, ids);
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)) {
throw new ServiceException("所选计划当天已生成任务");
}
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());
@ -112,6 +111,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
throw new ServiceException("更新任务派发失败");
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
@ -143,24 +143,26 @@ public class MaintenanceServiceImpl implements MaintenanceService {
// standardTicketInfoVo = (OperMaintenanceTaskEntityVo) jsonObject.get("operMaintenanceTaskEntityVo");
// standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class);
} catch (Exception e) {
log.error("获取表单出现异常了~~~~");
log.error("获取表单出现异常了~~~~"+response);
throw new IllegalArgumentException(e.getMessage());
}
OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity();
BeanUtils.copyProperties(standardTicketInfoVo, entity);
//1.查询日常维护信息
//有Id才进行生成操作
if (StringUtils.isNotBlank(response.getBusinessKey())) {
Long id = NumberUtils.toLong(response.getBusinessKey());
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在");
log.error("获取日常维护数据不存在" + response);
return;
}
OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity();
BeanUtils.copyProperties(standardTicketInfoVo, entity);
entity.setId(id);
//填充日常维护信息
saveOperMaintenanceTaskEntity(entity, response);
entity.setProcessInstanceId(response.getProcessInstanceId());
taskService.updateById(entity);
//推送消息
if (response.getTaskId() != null) {
// MessagePushRecordDto message = new MessagePushRecordDto();
@ -225,8 +227,10 @@ public class MaintenanceServiceImpl implements MaintenanceService {
}
log.info("推送成功~");
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("日常维护消费异常:param"+response+"报错信息"+e);
}
}
@ -266,20 +270,40 @@ public class MaintenanceServiceImpl implements MaintenanceService {
*
* @param finalPlanEntity
*/
private void createTaskByPlan(OperMaintenancePlanEntity finalPlanEntity) {
private Boolean createTaskByPlan(OperMaintenancePlanEntity finalPlanEntity) {
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(finalPlanEntity, OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务
List<Long> taskIds = new ArrayList<>();
if (StringUtil.isNotBlank(finalPlanEntity.getEmCode())) {
log.info("finalPlanEntity.getEmCode() : {}", finalPlanEntity.getEmCode());
String[] emCodeList = finalPlanEntity.getEmCode().split(",");
for (String emCode : emCodeList) {
try {
taskEntity.setEmCode(emCode);
this.fillTask(taskEntity, finalPlanEntity,false);
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 {
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
*/
@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.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
// TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition);
@ -320,29 +345,31 @@ public class MaintenanceServiceImpl implements MaintenanceService {
taskEntity.setDisposer(userId.replaceAll("\\^", ","));
} else {
log.info("计划ID为:{}未查询到排班记录", finalPlanEntity.getId());
LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
maintenancePlanService.update(planQueryWrapper);
return;
// LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
// .set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
// .eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
// maintenancePlanService.update(planQueryWrapper);
return null;
}
}
taskService.save(taskEntity);
// 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);
LambdaUpdateWrapper<OperMaintenanceTaskEntity> taskQueryWrapper = Wrappers.<OperMaintenanceTaskEntity>lambdaUpdate()
.set(OperMaintenanceTaskEntity::getProcessInstanceId, processInstanceId)
.eq(OperMaintenanceTaskEntity::getId, taskEntity.getId());
taskService.update(taskQueryWrapper);
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);
});
return taskEntity.getId();
}

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

@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.RandomUtils;
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.support.Condition;
import org.springblade.core.mp.support.Query;
@ -136,7 +137,9 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
if (!CollectionUtils.isEmpty(req.getDeptIds())) {
in(OperMaintenanceTaskEntity::getCreateDept, req.getDeptIds());
}
if (!ObjectUtil.isEmpty(req.getCreateDept())) {
in(OperMaintenanceTaskEntity::getCreateDept, req.getCreateDept());
}
if (StringUtil.isNoneBlank(req.getFlowTaskName())) {
eq(OperMaintenanceTaskEntity::getFlowTaskName, req.getFlowTaskName());
}
@ -448,10 +451,11 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
private VoteChartVo getVoteChartVo(List<OperMaintenanceTaskEntity> list) {
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> undoneIds = 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 -> StringUtil.isBlank(s.getFlowTaskName())||!"结束".equals(s.getFlowTaskName())).map(BaseEntity::getId).collect(Collectors.toList());
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.setFinishIds(finishIds);
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) {
List<String> monthList=new ArrayList<>();
for (int i = 1; i <13; i++) {
for (int i = 0; i <12; i++) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
@ -143,4 +143,24 @@ public class TimeUtils {
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ;
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());
workTicketInfoMap.put("measureMapList", collect);
Map<String, Object> resultMap = OperationWordHelper.resultMap(workTicketInfoMap);
String workTicketStatus = this.getWorkTicketStatus(status);
String workTicketStatus =getWorkTicketStatus(status);
String os = TicketConstant.OS_NAME;
//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.message.MessageConstants;
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.middle.process.feign.ProcessDictFeignService;
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.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -963,7 +961,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
for (WorkTicketSafetyMeasureEntity measureVO : workTicketSafetyMeasureEntities) {
String type = measureEnum.getType();
if (tempIndex != Integer.valueOf(type)) {
index = 1;
// index = 1;
tempIndex++;
}
log.info("获取安全措施的信息: {}", measureVO);
@ -984,7 +982,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//验证工作措施是有有数据
this.isMatterLibraryList(workTicketInfoMap1);
// 工作地点保留带电部位或注意事项
this.matterLibraryListWithMap(workTicketInfoMap1);
matterLibraryListWithMap(workTicketInfoMap1);
result.putAll(workTicketInfoMap1);
}
@ -1025,12 +1023,13 @@ public class TicketProcessServiceImpl implements TicketProcessService {
List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers();
if (CollectionUtils.isNotEmpty(ticketInfoDangers)) {
Map<String, List<Map<String, Object>>> map = new HashMap<>();
int index = 1;
int[] index = {1};
List<Map<String, Object>> collect = ticketInfoDangers.stream().map(item -> {
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("dangerousPoint", item.getDangerousPoint() == null ? "\u00A0" : item.getDangerousPoint());
index[0]++;
return newItem;
}).collect(Collectors.toList());
@ -1041,7 +1040,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
WordMapUtils.newMapWithList("ticketInfoDangers", result, true, 4, "maintenance", "dangerousPoint");
//7. 是否包含
this.isExists(result);
isExists(result);
//8. 存入新的数据
this.addMapPut(result);

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

@ -8,7 +8,6 @@ import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.constants.WorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketContentEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketFlowEntity;
@ -40,7 +39,6 @@ import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
@ -61,7 +59,7 @@ public class OfflineTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMapp
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IWorkTicketFlowService workTicketFlowService;
private Lock lock = new ReentrantLock();
private final Lock lock = new ReentrantLock();
/**
* 线下工作票开票

Loading…
Cancel
Save