|
|
@@ -2,18 +2,23 @@ package cn.start.tz.module.pressure2.service.planscheduling;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.start.tz.framework.common.pojo.PageResult;
|
|
|
import cn.start.tz.framework.ip.core.Area;
|
|
|
import cn.start.tz.framework.ip.core.utils.AreaUtils;
|
|
|
-import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.PlanSchedulingPageVO;
|
|
|
-import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.PlanSchedulingRespVO;
|
|
|
-import cn.start.tz.module.pressure2.dal.dataobject.equipboiler.EquipBoilerDO;
|
|
|
-import cn.start.tz.module.pressure2.dal.dataobject.equippipe.EquipPipeDO;
|
|
|
+import cn.start.tz.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
+import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.*;
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.acceptorder.AcceptOrderDO;
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorder.AppointmentConfirmOrderDO;
|
|
|
+import cn.start.tz.module.pressure2.dal.mysql.acceptorder.AcceptOrderMapper;
|
|
|
+import cn.start.tz.module.pressure2.dal.mysql.appointmentconfirmorder.AppointmentConfirmOrderMapper;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.equipboiler.EquipBoilerMapper;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.equippipe.EquipPipeMapper;
|
|
|
import cn.start.tz.module.system.api.clientunit.ClientUnitApi;
|
|
|
import cn.start.tz.module.system.api.clientunit.dto.ClientUnitDTO;
|
|
|
import cn.start.tz.module.system.api.clientunit.dto.ClientUnitPageDTO;
|
|
|
+import cn.start.tz.module.system.api.dept.DeptApi;
|
|
|
+import cn.start.tz.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import cn.start.tz.module.system.api.dict.DictDataApi;
|
|
|
import cn.start.tz.module.system.api.dict.dto.DictDataRespDTO;
|
|
|
import jakarta.annotation.Resource;
|
|
|
@@ -21,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -37,6 +43,16 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
|
|
|
@Resource
|
|
|
private DictDataApi dictDataApi;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private DeptApi deptApi;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AppointmentConfirmOrderMapper appointmentConfirmOrderMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AcceptOrderMapper acceptOrderMapper;
|
|
|
//
|
|
|
// @Resource
|
|
|
// private EquipContainerSchedulingMapper equipContainerSchedulingMapper;
|
|
|
@@ -53,7 +69,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
// @Resource
|
|
|
// private AppointmentConfirmOrderMapper appointmentConfirmOrderMapper;
|
|
|
|
|
|
-// @Resource
|
|
|
+ // @Resource
|
|
|
// private AppointmentConfirmOrderItemMapper appointmentConfirmOrderItemMapper;
|
|
|
//
|
|
|
// @Resource
|
|
|
@@ -1131,17 +1147,18 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
|
|
|
/**
|
|
|
* 设备前台约检分页
|
|
|
+ *
|
|
|
* @param pageReqVO 参数
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public PageResult<PlanSchedulingRespVO> frontDesk(PlanSchedulingPageVO pageReqVO) {
|
|
|
+ public PageResult<PlanSchedulingRespVO> frontDesk(PlanSchedulingPageVO pageReqVO) {
|
|
|
//构建查询参数
|
|
|
PageResult<PlanSchedulingRespVO> buildQueryParam = frontDeskQueryParam(pageReqVO);
|
|
|
if (Objects.nonNull(buildQueryParam)) {
|
|
|
return buildQueryParam;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 获取字典数据
|
|
|
Map<String, String> boilerTypeMap = new HashMap<>();
|
|
|
Map<String, String> pipeCategoryMap = new HashMap<>();
|
|
|
@@ -1159,7 +1176,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
} catch (Exception e) {
|
|
|
// 忽略字典获取异常
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 根据不同的设备类型获取数据
|
|
|
PageResult<PlanSchedulingRespVO> planSchedulingRespVOPageResult = switch (pageReqVO.getEquipMainType()) {
|
|
|
// 锅炉设备
|
|
|
@@ -1179,23 +1196,23 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
clientUnitPageDTO.setIds(unitIds);
|
|
|
clientUnits = clientUnitApi.getUnit(clientUnitPageDTO).getData();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
|
for (PlanSchedulingRespVO planSchedulingRespVO : planSchedulingRespVOPageResult.getList()) {
|
|
|
Area area = AreaUtils.getArea(planSchedulingRespVO.getEquipStreet());
|
|
|
- if(area != null){
|
|
|
+ if (area != null) {
|
|
|
planSchedulingRespVO.setEquipStreetName(area.getName());
|
|
|
}
|
|
|
|
|
|
area = AreaUtils.getArea(planSchedulingRespVO.getEquipDistrict());
|
|
|
- if(area != null){
|
|
|
+ if (area != null) {
|
|
|
planSchedulingRespVO.setEquipDistrictName(area.getName());
|
|
|
}
|
|
|
|
|
|
//获取单位信息
|
|
|
if (CollUtil.isNotEmpty(clientUnits)) {
|
|
|
- List<ClientUnitDTO> finalList = clientUnits.stream().filter(x -> x.getId().equals(planSchedulingRespVO.getUnitId()) ).toList();
|
|
|
+ List<ClientUnitDTO> finalList = clientUnits.stream().filter(x -> x.getId().equals(planSchedulingRespVO.getUnitId())).toList();
|
|
|
if (CollUtil.isNotEmpty(finalList)) {
|
|
|
ClientUnitDTO clientUnitDTO = finalList.get(0);
|
|
|
planSchedulingRespVO.setIsExempt(clientUnitDTO.getIsExempt());
|
|
|
@@ -1209,7 +1226,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 处理锅炉特有字段
|
|
|
if (Objects.equals(pageReqVO.getEquipMainType(), 200)) {
|
|
|
// 转换设备分类为名称
|
|
|
@@ -1217,7 +1234,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
planSchedulingRespVO.setEquipTypeName(boilerTypeMap.getOrDefault(planSchedulingRespVO.getType(), planSchedulingRespVO.getType()));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 处理管道特有字段
|
|
|
if (Objects.equals(pageReqVO.getEquipMainType(), 300)) {
|
|
|
// 转换管道类别为名称
|
|
|
@@ -1229,6 +1246,306 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
return planSchedulingRespVOPageResult;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageResult<EquipBoilerPageRespVO> pendingInspectionPageBoiler(PendingInspectionEquipReqVO pageReqVO) {
|
|
|
+ // 查询总数
|
|
|
+ Long total = equipBoilerMapper.selectPendingInspectionBoilerCount(pageReqVO);
|
|
|
+
|
|
|
+ if (total == null || total == 0) {
|
|
|
+ return new PageResult<>(Collections.emptyList(), 0L);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询列表数据
|
|
|
+ List<EquipBoilerPageRespVO> list = equipBoilerMapper.selectPendingInspectionBoilerPage(pageReqVO);
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
+ return new PageResult<>(Collections.emptyList(), total);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询单位信息并填充
|
|
|
+ Set<String> unitIds = list.stream()
|
|
|
+ .map(EquipBoilerPageRespVO::getUnitId)
|
|
|
+ .filter(StrUtil::isNotEmpty)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Map<String, List<ClientUnitDTO>> unitMap = new HashMap<>();
|
|
|
+ if (CollUtil.isNotEmpty(unitIds)) {
|
|
|
+ // 分批查询,避免URL过长
|
|
|
+ List<ClientUnitDTO> unitDTOList = new ArrayList<>();
|
|
|
+ List<String> unitIdList = new ArrayList<>(unitIds);
|
|
|
+ int batchSize = 100; // 每批最多100个ID
|
|
|
+ for (int i = 0; i < unitIdList.size(); i += batchSize) {
|
|
|
+ int end = Math.min(i + batchSize, unitIdList.size());
|
|
|
+ List<String> batchIds = unitIdList.subList(i, end);
|
|
|
+ unitDTOList.addAll(clientUnitApi.getClientUnitList(batchIds).getCheckedData());
|
|
|
+ }
|
|
|
+ unitMap = unitDTOList.stream()
|
|
|
+ .collect(Collectors.groupingBy(ClientUnitDTO::getId));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询部门信息并填充
|
|
|
+ Set<String> deptIds = list.stream()
|
|
|
+ .map(EquipBoilerPageRespVO::getDeptId)
|
|
|
+ .filter(StrUtil::isNotEmpty)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Map<String, DeptRespDTO> deptMap = new HashMap<>();
|
|
|
+ if (CollUtil.isNotEmpty(deptIds)) {
|
|
|
+ deptMap = deptApi.getDeptMap(deptIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 填充附加信息
|
|
|
+ Map<String, List<ClientUnitDTO>> finalUnitMap = unitMap;
|
|
|
+ Map<String, DeptRespDTO> finalDeptMap = deptMap;
|
|
|
+ list.forEach(item -> {
|
|
|
+ // 设置区域名称
|
|
|
+ if (item.getEquipDistrict() != null) {
|
|
|
+ // 区域信息
|
|
|
+ if (Integer.valueOf(440116).equals(item.getEquipDistrict())) {
|
|
|
+ // 萝岗区改为黄埔区
|
|
|
+ item.setEquipDistrict(440112);
|
|
|
+ } else if (Integer.valueOf(440183).equals(item.getEquipDistrict())) {
|
|
|
+ // 增城市改为增城区
|
|
|
+ item.setEquipDistrict(440117);
|
|
|
+ } else if (Integer.valueOf(440184).equals(item.getEquipDistrict())) {
|
|
|
+ // 从化市改为从化区
|
|
|
+ item.setEquipDistrict(440118);
|
|
|
+ }
|
|
|
+ item.setEquipDistrictName(AreaUtils.getArea(item.getEquipDistrict()).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.getEquipStreet() != null) {
|
|
|
+ item.setEquipStreetName(AreaUtils.getArea(item.getEquipStreet()).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置单位信息
|
|
|
+ if (CollUtil.isNotEmpty(finalUnitMap.get(item.getUnitId()))) {
|
|
|
+ item.setSocialCreditCode(finalUnitMap.get(item.getUnitId()).get(0).getSocialCreditCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置检验部门名称
|
|
|
+ if (item.getDeptId() != null && finalDeptMap.containsKey(item.getDeptId())) {
|
|
|
+ item.setCheckDeptName(finalDeptMap.get(item.getDeptId()).getName());
|
|
|
+ // 同时设置部门名称
|
|
|
+ item.setDeptName(finalDeptMap.get(item.getDeptId()).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询约检确认单和受理单状态,并获取约检日期
|
|
|
+ checkPendingBoilerAppointment(item, item.getCheckType());
|
|
|
+ });
|
|
|
+
|
|
|
+ // 手动组装 PageResult
|
|
|
+ return new PageResult<>(list, total);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageResult<EquipPipePageRespVO> pendingInspectionPagePipe(PendingInspectionEquipReqVO pageReqVO) {
|
|
|
+ // 查询总数
|
|
|
+ Long total = equipPipeMapper.selectPendingInspectionPipeCount(pageReqVO);
|
|
|
+
|
|
|
+ if (total == null || total == 0) {
|
|
|
+ return new PageResult<>(Collections.emptyList(), 0L);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询列表数据
|
|
|
+ List<EquipPipePageRespVO> list = equipPipeMapper.selectPendingInspectionPipePage(pageReqVO);
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
+ return new PageResult<>(Collections.emptyList(), total);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询单位信息并填充
|
|
|
+ Set<String> unitIds = list.stream()
|
|
|
+ .map(EquipPipePageRespVO::getUnitId)
|
|
|
+ .filter(StrUtil::isNotEmpty)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Map<String, List<ClientUnitDTO>> unitMap = new HashMap<>();
|
|
|
+ if (CollUtil.isNotEmpty(unitIds)) {
|
|
|
+ // 分批查询,避免URL过长
|
|
|
+ List<ClientUnitDTO> unitDTOList = new ArrayList<>();
|
|
|
+ List<String> unitIdList = new ArrayList<>(unitIds);
|
|
|
+ int batchSize = 100; // 每批最多100个ID
|
|
|
+ for (int i = 0; i < unitIdList.size(); i += batchSize) {
|
|
|
+ int end = Math.min(i + batchSize, unitIdList.size());
|
|
|
+ List<String> batchIds = unitIdList.subList(i, end);
|
|
|
+ unitDTOList.addAll(clientUnitApi.getClientUnitList(batchIds).getCheckedData());
|
|
|
+ }
|
|
|
+ unitMap = unitDTOList.stream()
|
|
|
+ .collect(Collectors.groupingBy(ClientUnitDTO::getId));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询部门信息并填充
|
|
|
+ Set<String> deptIds = list.stream()
|
|
|
+ .map(EquipPipePageRespVO::getDeptId)
|
|
|
+ .filter(StrUtil::isNotEmpty)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Map<String, DeptRespDTO> deptMap = new HashMap<>();
|
|
|
+ if (CollUtil.isNotEmpty(deptIds)) {
|
|
|
+ deptMap = deptApi.getDeptMap(deptIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 填充附加信息(Pipe)
|
|
|
+ Map<String, List<ClientUnitDTO>> finalUnitMap = unitMap;
|
|
|
+ Map<String, DeptRespDTO> finalDeptMap = deptMap;
|
|
|
+ list.forEach(item -> {
|
|
|
+ // 设置区域名称
|
|
|
+ if (item.getEquipDistrict() != null) {
|
|
|
+ // 区域信息
|
|
|
+ if (Integer.valueOf(440116).equals(item.getEquipDistrict())) {
|
|
|
+ // 萝岗区改为黄埔区
|
|
|
+ item.setEquipDistrict(440112);
|
|
|
+ } else if (Integer.valueOf(440183).equals(item.getEquipDistrict())) {
|
|
|
+ // 增城市改为增城区
|
|
|
+ item.setEquipDistrict(440117);
|
|
|
+ } else if (Integer.valueOf(440184).equals(item.getEquipDistrict())) {
|
|
|
+ // 从化市改为从化区
|
|
|
+ item.setEquipDistrict(440118);
|
|
|
+ }
|
|
|
+ item.setEquipDistrictName(AreaUtils.getArea(item.getEquipDistrict()).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.getEquipStreet() != null) {
|
|
|
+ item.setEquipStreetName(AreaUtils.getArea(item.getEquipStreet()).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置单位信息
|
|
|
+ if (CollUtil.isNotEmpty(finalUnitMap.get(item.getUnitId()))) {
|
|
|
+ item.setSocialCreditCode(finalUnitMap.get(item.getUnitId()).get(0).getSocialCreditCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置检验部门名称
|
|
|
+ if (item.getDeptId() != null && finalDeptMap.containsKey(item.getDeptId())) {
|
|
|
+ item.setCheckDeptName(finalDeptMap.get(item.getDeptId()).getName());
|
|
|
+ // 同时设置部门名称
|
|
|
+ item.setDeptName(finalDeptMap.get(item.getDeptId()).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 查询约检确认单和受理单状态,并获取约检日期
|
|
|
+ checkPendingPipeAppointment(item, item.getCheckType());
|
|
|
+ });
|
|
|
+
|
|
|
+ // 手动组装 PageResult
|
|
|
+ return new PageResult<>(list, total);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查设备是否存在待处理的约检确认单,并设置约检日期
|
|
|
+ * 判断逻辑:
|
|
|
+ * 1. 查询设备是否存在约检确认单(通过设备ID和检验类型)
|
|
|
+ * 2. 如果存在约检确认单,先检查约检确认单本身的状态:
|
|
|
+ * - 500(已作废)→ 设置hasPendingAppointment=false,并设置约检日期
|
|
|
+ * 3. 如果约检确认单未作废,查看 createAcceptOrder 字段判断是否已创建受理单
|
|
|
+ * 4. 如果未创建受理单,设置hasPendingAppointment=true,并设置约检日期
|
|
|
+ * 5. 如果已创建受理单,查询该设备的受理单状态:
|
|
|
+ * - 100(待确认)→ 设置hasPendingAppointment=true,并设置约检日期
|
|
|
+ * - 200(已确认/审核通过)→ 设置hasPendingAppointment=false,并设置约检日期
|
|
|
+ * - 400(作废)→ 设置hasPendingAppointment=false,并设置约检日期
|
|
|
+ *
|
|
|
+ * @param item 设备分页VO对象
|
|
|
+ * @param checkType 检验类型
|
|
|
+ */
|
|
|
+ private void checkPendingPipeAppointment(EquipPipePageRespVO item, Integer checkType) {
|
|
|
+ // 查询设备的约检确认单(通过 LEFT JOIN 关联 item 表)
|
|
|
+ AppointmentConfirmOrderDO appointmentConfirmOrder = appointmentConfirmOrderMapper.selectByEquipIdAndCheckTypeBoiler(item.getId(), checkType);
|
|
|
+
|
|
|
+ // 不存在约检确认单
|
|
|
+ if (appointmentConfirmOrder == null) {
|
|
|
+ item.setHasPendingAppointment(false);
|
|
|
+ item.setAppointmentDate(null);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置约检日期
|
|
|
+ item.setAppointmentDate(appointmentConfirmOrder.getAppointmentDate());
|
|
|
+
|
|
|
+ // 检查约检确认单的状态,如果已作废(500),直接返回false
|
|
|
+ Integer appointmentStatus = appointmentConfirmOrder.getStatus();
|
|
|
+ if (Integer.valueOf(500).equals(appointmentStatus)) {
|
|
|
+ item.setHasPendingAppointment(false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否已创建受理单
|
|
|
+ Boolean createAcceptOrder = appointmentConfirmOrder.getCreateAcceptOrder();
|
|
|
+ if (createAcceptOrder == null || !createAcceptOrder) {
|
|
|
+ // 未创建受理单,设置hasPendingAppointment=true(待处理)
|
|
|
+ item.setHasPendingAppointment(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaQueryWrapperX<AcceptOrderDO> queryWrapperX = new LambdaQueryWrapperX<>();
|
|
|
+ queryWrapperX.eq(AcceptOrderDO::getAppointmentId, appointmentConfirmOrder.getId())
|
|
|
+ .orderByDesc(AcceptOrderDO::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+ AcceptOrderDO latestAcceptOrder = acceptOrderMapper.selectOne(queryWrapperX);
|
|
|
+
|
|
|
+ // 不存在受理单
|
|
|
+ if (latestAcceptOrder == null) {
|
|
|
+ item.setHasPendingAppointment(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ item.setAppointmentDate(latestAcceptOrder.getAppointmentDate());
|
|
|
+ // 判断受理单状态
|
|
|
+ Integer status = latestAcceptOrder.getStatus();
|
|
|
+ // 100(待确认)→ 设置hasPendingAppointment=true
|
|
|
+ // 200(已确认/审核通过)→ 设置hasPendingAppointment=false
|
|
|
+ // 400(作废)→ 设置hasPendingAppointment=false
|
|
|
+ item.setHasPendingAppointment(Integer.valueOf(100).equals(status));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkPendingBoilerAppointment(EquipBoilerPageRespVO item, Integer checkType) {
|
|
|
+ // 查询设备的约检确认单(通过 LEFT JOIN 关联 item 表)
|
|
|
+ AppointmentConfirmOrderDO appointmentConfirmOrder = appointmentConfirmOrderMapper.selectByEquipIdAndCheckTypePipe(item.getId(), checkType);
|
|
|
+
|
|
|
+ // 不存在约检确认单
|
|
|
+ if (appointmentConfirmOrder == null) {
|
|
|
+ item.setHasPendingAppointment(false);
|
|
|
+ item.setAppointmentDate(null);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置约检日期
|
|
|
+ item.setAppointmentDate(appointmentConfirmOrder.getAppointmentDate());
|
|
|
+
|
|
|
+ // 检查约检确认单的状态,如果已作废(500),直接返回false
|
|
|
+ Integer appointmentStatus = appointmentConfirmOrder.getStatus();
|
|
|
+ if (Integer.valueOf(500).equals(appointmentStatus)) {
|
|
|
+ item.setHasPendingAppointment(false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否已创建受理单
|
|
|
+ Boolean createAcceptOrder = appointmentConfirmOrder.getCreateAcceptOrder();
|
|
|
+ if (createAcceptOrder == null || !createAcceptOrder) {
|
|
|
+ // 未创建受理单,设置hasPendingAppointment=true(待处理)
|
|
|
+ item.setHasPendingAppointment(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaQueryWrapperX<AcceptOrderDO> queryWrapperX = new LambdaQueryWrapperX<>();
|
|
|
+ queryWrapperX.eq(AcceptOrderDO::getAppointmentId, appointmentConfirmOrder.getId())
|
|
|
+ .orderByDesc(AcceptOrderDO::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+ AcceptOrderDO latestAcceptOrder = acceptOrderMapper.selectOne(queryWrapperX);
|
|
|
+
|
|
|
+ // 不存在受理单
|
|
|
+ if (latestAcceptOrder == null) {
|
|
|
+ item.setHasPendingAppointment(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ item.setAppointmentDate(latestAcceptOrder.getAppointmentDate());
|
|
|
+ // 判断受理单状态
|
|
|
+ Integer status = latestAcceptOrder.getStatus();
|
|
|
+ // 100(待确认)→ 设置hasPendingAppointment=true
|
|
|
+ // 200(已确认/审核通过)→ 设置hasPendingAppointment=false
|
|
|
+ // 400(作废)→ 设置hasPendingAppointment=false
|
|
|
+ item.setHasPendingAppointment(Integer.valueOf(100).equals(status));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private PageResult<PlanSchedulingRespVO> frontDeskQueryParam(PlanSchedulingPageVO pageReqVO) {
|
|
|
//根据统一社会信用代码查询
|
|
|
if (StringUtils.isNotBlank(pageReqVO.getSocialCreditCode())) {
|