|
@@ -6,8 +6,11 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.start.tz.framework.common.exception.ErrorCode;
|
|
import cn.start.tz.framework.common.exception.ErrorCode;
|
|
|
import cn.start.tz.framework.common.exception.ServiceException;
|
|
import cn.start.tz.framework.common.exception.ServiceException;
|
|
|
import cn.start.tz.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
import cn.start.tz.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
|
|
+import cn.start.tz.module.infra.api.config.ConfigApi;
|
|
|
import cn.start.tz.module.infra.api.file.FileApi;
|
|
import cn.start.tz.module.infra.api.file.FileApi;
|
|
|
|
|
+import cn.start.tz.module.pressure2.controller.admin.acceptorder.vo.AcceptOrderRespVO;
|
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbins.vo.CreateInstantiateWithRuleVO;
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbins.vo.CreateInstantiateWithRuleVO;
|
|
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.acceptorder.AcceptOrderDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.boilerconnectrecordreport.BoilerConnectRecordReportDO;
|
|
import cn.start.tz.module.pressure2.dal.dataobject.boilerconnectrecordreport.BoilerConnectRecordReportDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.boilerconnecttbservice.BoilerConnectTbServiceDO;
|
|
import cn.start.tz.module.pressure2.dal.dataobject.boilerconnecttbservice.BoilerConnectTbServiceDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.boilertaskorder.BoilerTaskOrderDO;
|
|
import cn.start.tz.module.pressure2.dal.dataobject.boilertaskorder.BoilerTaskOrderDO;
|
|
@@ -23,6 +26,7 @@ import cn.start.tz.module.pressure2.dal.mysql.boilerconnecttbservice.BoilerConne
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.boilertaskorder.BoilerTaskOrderMapper;
|
|
import cn.start.tz.module.pressure2.dal.mysql.boilertaskorder.BoilerTaskOrderMapper;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.notificationformreport.NotificationformReportMapper;
|
|
import cn.start.tz.module.pressure2.dal.mysql.notificationformreport.NotificationformReportMapper;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.pipetaskorder.PipeTaskOrderMapper;
|
|
import cn.start.tz.module.pressure2.dal.mysql.pipetaskorder.PipeTaskOrderMapper;
|
|
|
|
|
+import cn.start.tz.module.pressure2.service.acceptorder.AcceptOrderService;
|
|
|
import cn.start.tz.module.pressure2.service.boilerconnectrecordreport.BoilerConnectRecordReportService;
|
|
import cn.start.tz.module.pressure2.service.boilerconnectrecordreport.BoilerConnectRecordReportService;
|
|
|
import cn.start.tz.module.pressure2.service.boilertaskorderitem.BoilerTaskOrderItemService;
|
|
import cn.start.tz.module.pressure2.service.boilertaskorderitem.BoilerTaskOrderItemService;
|
|
|
import cn.start.tz.module.pressure2.service.boilertaskorderitemreport.BoilerTaskOrderItemReportService;
|
|
import cn.start.tz.module.pressure2.service.boilertaskorderitemreport.BoilerTaskOrderItemReportService;
|
|
@@ -125,6 +129,10 @@ public class OrderReportServiceImpl extends ServiceImpl<OrderReportMapper, Order
|
|
|
@Resource
|
|
@Resource
|
|
|
private MailSendApi mailSendApi;
|
|
private MailSendApi mailSendApi;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ConfigApi configApi;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private final String ACCEPT = "1";
|
|
private final String ACCEPT = "1";
|
|
|
private final String TASK = "2";
|
|
private final String TASK = "2";
|
|
|
|
|
|
|
@@ -219,6 +227,45 @@ public class OrderReportServiceImpl extends ServiceImpl<OrderReportMapper, Order
|
|
|
orderReportDO.setInsId(instantiateWithRule.getId());
|
|
orderReportDO.setInsId(instantiateWithRule.getId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ orderReportMapper.insertOrUpdate(orderReportDO);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 锅炉设备检验,定检存在委托收费项目时,需要生成一张受理单一张服务单
|
|
|
|
|
+ String code = configApi.getConfigValueByKey("boiler_legal_service_code").getCheckedData();
|
|
|
|
|
+ if (code != null && !code.isEmpty()) {
|
|
|
|
|
+ // 判断是否存在服务收费项目
|
|
|
|
|
+ if (list.stream().noneMatch(item -> "2".equals(item.getType()))) return;
|
|
|
|
|
+ // 生成服务单
|
|
|
|
|
+ DynamicTbDO reportTemplateDO = dynamicTbService.list(new LambdaQueryWrapper<DynamicTbDO>().eq(DynamicTbDO::getTbCode, code)).get(0);
|
|
|
|
|
+ if (reportTemplateDO == null) return;
|
|
|
|
|
+
|
|
|
|
|
+ // 按 acceptOrderId + templateId 查重,避免重复生成
|
|
|
|
|
+ OrderReportDO exist = getOne(new LambdaQueryWrapperX<OrderReportDO>()
|
|
|
|
|
+ .eq(OrderReportDO::getAcceptOrderId, acceptOrderId)
|
|
|
|
|
+ .eq(OrderReportDO::getTemplateId, reportTemplateDO.getId())
|
|
|
|
|
+ );
|
|
|
|
|
+ OrderReportDO orderReportDO = exist == null ? new OrderReportDO() : exist;
|
|
|
|
|
+ orderReportDO.setAcceptOrderId(acceptOrderId);
|
|
|
|
|
+ orderReportDO.setOrderType(ACCEPT);
|
|
|
|
|
+ orderReportDO.setTemplateId(reportTemplateDO.getId());
|
|
|
|
|
+
|
|
|
|
|
+ // 生成报表数据
|
|
|
|
|
+ CreateInstantiateWithRuleVO ruleVO = new CreateInstantiateWithRuleVO();
|
|
|
|
|
+ ruleVO.setTemplateId(reportTemplateDO.getId());
|
|
|
|
|
+ ruleVO.setRefId(acceptOrderId);
|
|
|
|
|
+ ruleVO.setRefName(reportTemplateDO.getTbName());
|
|
|
|
|
+ ruleVO.setReportType(1);
|
|
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
|
|
+ params.put("equipMainType", "boiler");
|
|
|
|
|
+ params.put("orderReportDOId", orderReportDO.getId());
|
|
|
|
|
+ ruleVO.setParams(params);
|
|
|
|
|
+
|
|
|
|
|
+ BoilerConnectTbServiceDO tbServiceDO = boilerConnectTbServiceMapper.selectOne(BoilerConnectTbServiceDO::getTbId, reportTemplateDO.getId());
|
|
|
|
|
+ if (tbServiceDO != null) {
|
|
|
|
|
+ ruleVO.setServiceName(tbServiceDO.getInitServiceName());
|
|
|
|
|
+ DynamicTbInsDO instantiateWithRule = dynamicTbInsService.createInstantiateWithRule(ruleVO);
|
|
|
|
|
+ orderReportDO.setInsId(instantiateWithRule.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
orderReportMapper.insertOrUpdate(orderReportDO);
|
|
orderReportMapper.insertOrUpdate(orderReportDO);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -447,6 +494,41 @@ public class OrderReportServiceImpl extends ServiceImpl<OrderReportMapper, Order
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void refreshSingleOrderReport(String orderReportId, String equipMainType) {
|
|
|
|
|
+ OrderReportDO orderReportDO = orderReportMapper.selectById(orderReportId);
|
|
|
|
|
+ if (orderReportDO == null) {
|
|
|
|
|
+ throw new ServiceException(500, "报告不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ String templateId = orderReportDO.getTemplateId();
|
|
|
|
|
+ String refId = orderReportDO.getAcceptOrderId();
|
|
|
|
|
+
|
|
|
|
|
+ DynamicTbDO reportTemplateDO = dynamicTbService.getById(templateId);
|
|
|
|
|
+ if (reportTemplateDO == null) {
|
|
|
|
|
+ throw new ServiceException(500, "报告模板不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ CreateInstantiateWithRuleVO ruleVO = new CreateInstantiateWithRuleVO();
|
|
|
|
|
+ ruleVO.setTemplateId(templateId);
|
|
|
|
|
+ ruleVO.setRefId(refId);
|
|
|
|
|
+ ruleVO.setRefName(reportTemplateDO.getTbName());
|
|
|
|
|
+ ruleVO.setReportType(1);
|
|
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
|
|
+ params.put("equipMainType", equipMainType);
|
|
|
|
|
+ params.put("orderReportDOId", orderReportDO.getId());
|
|
|
|
|
+ ruleVO.setParams(params);
|
|
|
|
|
+
|
|
|
|
|
+ BoilerConnectTbServiceDO tbServiceDO = boilerConnectTbServiceMapper.selectOne(
|
|
|
|
|
+ BoilerConnectTbServiceDO::getTbId, templateId);
|
|
|
|
|
+ if (tbServiceDO != null) {
|
|
|
|
|
+ ruleVO.setServiceName(tbServiceDO.getInitServiceName());
|
|
|
|
|
+ DynamicTbInsDO instantiateWithRule = dynamicTbInsService.createInstantiateWithRule(ruleVO);
|
|
|
|
|
+ orderReportDO.setInsId(instantiateWithRule.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ orderReportMapper.updateById(orderReportDO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean serviceFromSendEmail(TaskOrderSignFilePageReqVO pageReqVO) {
|
|
public Boolean serviceFromSendEmail(TaskOrderSignFilePageReqVO pageReqVO) {
|
|
|
|
|
|