Commit 7a80999c by 刘鑫

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop

2 parents 26c2f36a f40775de
...@@ -27,7 +27,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -27,7 +27,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
*/ */
@SpringBootApplication @SpringBootApplication
@EnableScheduling @EnableScheduling
@EnableFeignClients(basePackages = {"com.dituhui.pea.user", "com.dituhui.pea.msg"}) @EnableFeignClients(basePackages = {"com.dituhui.pea.user", "com.dituhui.pea.msg", "com.dituhui.pea.bean"})
@Import(cn.hutool.extra.spring.SpringUtil.class) @Import(cn.hutool.extra.spring.SpringUtil.class)
public class DispatchServiceApplication { public class DispatchServiceApplication {
......
...@@ -3,8 +3,12 @@ package com.dituhui.pea.dispatch.service.impl; ...@@ -3,8 +3,12 @@ package com.dituhui.pea.dispatch.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.CollectionUtils;
import com.dituhui.pea.bean.AllotResultParam;
import com.dituhui.pea.bean.RemoteBeanApi;
import com.dituhui.pea.dispatch.dao.*; import com.dituhui.pea.dispatch.dao.*;
import com.dituhui.pea.dispatch.entity.*; import com.dituhui.pea.dispatch.entity.*;
import com.dituhui.pea.dispatch.pojo.Customer; import com.dituhui.pea.dispatch.pojo.Customer;
...@@ -25,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -68,6 +73,9 @@ public class ExtractServiceImpl implements ExtractService { ...@@ -68,6 +73,9 @@ public class ExtractServiceImpl implements ExtractService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private RemoteBeanApi remoteBeanApi;
/** /**
* 将dispath_order 中的计算结果,回写到 order_info * 将dispath_order 中的计算结果,回写到 order_info
...@@ -276,6 +284,18 @@ public class ExtractServiceImpl implements ExtractService { ...@@ -276,6 +284,18 @@ public class ExtractServiceImpl implements ExtractService {
orderInfoRepo.save(orderInfo); orderInfoRepo.save(orderInfo);
if (cutOff) { if (cutOff) {
AllotResultParam allotResultParam = new AllotResultParam();
allotResultParam.setRisId(orderInfo.getOrderId());
allotResultParam.setExecutorWorkNo(orderInfo.getEngineerCode());
allotResultParam.setAssistantWorkNo(null);
allotResultParam.setReason("自动派单");
String format = "yyyy-MM-dd HH:mm:ss";
allotResultParam.setAppointmentStartTime(orderInfo.getPlanStartTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
allotResultParam.setAppointmentEndTime(orderInfo.getPlanEndTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
boolean result = remoteBeanApi.allotResultUpdate(allotResultParam);
log.info(">>> 【服务工单派单结果更新】请求参数:{}, 响应结果:{}", JSONObject.toJSON(allotResultParam), result);
OrderEvent orderEvent = new OrderEvent().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setHappen(LocalDateTime.now()) OrderEvent orderEvent = new OrderEvent().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setHappen(LocalDateTime.now())
.setEvent("批量自动指派").setOperator("DISPATCH").setOperatorName("算法批量指派").setSource("PEA-DISPATCH") .setEvent("批量自动指派").setOperator("DISPATCH").setOperatorName("算法批量指派").setSource("PEA-DISPATCH")
.setDescription(String.format("批量自动指派:<%s,%s>", engCode, engName)).setMemo("") .setDescription(String.format("批量自动指派:<%s,%s>", engCode, engName)).setMemo("")
...@@ -309,6 +329,7 @@ public class ExtractServiceImpl implements ExtractService { ...@@ -309,6 +329,7 @@ public class ExtractServiceImpl implements ExtractService {
orderInfo.setUpdateTime(LocalDateTime.now()); orderInfo.setUpdateTime(LocalDateTime.now());
orderInfoRepo.save(orderInfo); orderInfoRepo.save(orderInfo);
OrderLog orderLog = new OrderLog().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setSource("PEA-DISPATCH").setOperator("DISPATCH") OrderLog orderLog = new OrderLog().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setSource("PEA-DISPATCH").setOperator("DISPATCH")
.setContent(String.format("批量自动指派:<%s,%s>", "", "抹掉技术员")).setContentOld("") .setContent(String.format("批量自动指派:<%s,%s>", "", "抹掉技术员")).setContentOld("")
.setMemo("批量自动指派").setCreateTime(LocalDateTime.now()).setUpdateTime(LocalDateTime.now()); .setMemo("批量自动指派").setCreateTime(LocalDateTime.now()).setUpdateTime(LocalDateTime.now());
......
...@@ -3,7 +3,7 @@ server: ...@@ -3,7 +3,7 @@ server:
dispatch: dispatch:
cron: cron:
expr: 0 3 8-23 * * ? expr: 0 57 8-23 * * ?
next-day-limit: 2 next-day-limit: 2
scheduler: scheduler:
......
...@@ -23,6 +23,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS ...@@ -23,6 +23,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List<OrderInfoEntity> findByDtAndServiceStatusNotAndEngineerCodeIn(LocalDate date, String serviceSatus, List<String> engineerCodes); List<OrderInfoEntity> findByDtAndServiceStatusNotAndEngineerCodeIn(LocalDate date, String serviceSatus, List<String> engineerCodes);
List<OrderInfoEntity> findByDtAndServiceStatusNotAndEngineerCodeSubIn(LocalDate date, String serviceSatus, List<String> engineerCodes);
List<OrderInfoEntity> findByDtAndEngineerCode(LocalDate date, String engineerCode); List<OrderInfoEntity> findByDtAndEngineerCode(LocalDate date, String engineerCode);
List<OrderInfoEntity> findByDtAndEngineerCodeSub(LocalDate date, String engineerCode); List<OrderInfoEntity> findByDtAndEngineerCodeSub(LocalDate date, String engineerCode);
......
...@@ -90,5 +90,10 @@ public class EngineersGanttDTO { ...@@ -90,5 +90,10 @@ public class EngineersGanttDTO {
* 服务状态:INIT-初始化/PENDING待服务/CONTACTED已排期/STARTED-已开始/FINISHED已完成/UNFINISHED-已上门未完成 * 服务状态:INIT-初始化/PENDING待服务/CONTACTED已排期/STARTED-已开始/FINISHED已完成/UNFINISHED-已上门未完成
*/ */
private String serviceStatus; private String serviceStatus;
/**
* 是否是辅助单
*/
private Boolean isSub = false;
} }
} }
...@@ -12,4 +12,9 @@ public class TimeLineDTO { ...@@ -12,4 +12,9 @@ public class TimeLineDTO {
private String startTime; private String startTime;
private String endTime; private String endTime;
private List<LabelValueDTO> tips; private List<LabelValueDTO> tips;
/**
* 是否是辅助单
*/
private Boolean isSub = false;
} }
\ No newline at end of file
...@@ -266,7 +266,7 @@ public class OrderInfoEntity { ...@@ -266,7 +266,7 @@ public class OrderInfoEntity {
private LocalDateTime subPlanEndTime; private LocalDateTime subPlanEndTime;
/** /**
* 辅助工程师在途时长 * 辅助工程师在途里面(米)
*/ */
@Column(name = "sub_distance", nullable = true, columnDefinition = "int(11) default '0'") @Column(name = "sub_distance", nullable = true, columnDefinition = "int(11) default '0'")
private Integer subDistance = 0; private Integer subDistance = 0;
......
...@@ -148,13 +148,14 @@ public class CalcOrgCapacityScheduler { ...@@ -148,13 +148,14 @@ public class CalcOrgCapacityScheduler {
entity.setUpdateTime(LocalDateTime.now()); entity.setUpdateTime(LocalDateTime.now());
// todo entity.setOrderCount(); // todo entity.setOrderCount();
capacityOrgStatDao.save(entity); capacityOrgStatDao.save(entity);
double usedPercentage = (double) dto.getCapUsed() / dto.getCapTotal(); if (dto.getCapTotal() > 0) {
log.info("[calcOneBranch] {}小组容量已使用占比{}", groupId, usedPercentage); double usedPercentage = (double) dto.getCapUsed() / dto.getCapTotal();
if (BigDecimal.valueOf(usedPercentage).compareTo(new BigDecimal("0.8")) >= 0) { log.info("[calcOneBranch] {}小组容量已使用占比{}", groupId, usedPercentage);
addCapacityMsg("", "", groupId, LocalDate.parse(date, DateUtil.DATE_FORMATTER), if (BigDecimal.valueOf(usedPercentage).compareTo(new BigDecimal("0.8")) >= 0) {
dto.getLayer(), dto.getLayerId()); addCapacityMsg("", "", groupId, LocalDate.parse(date, DateUtil.DATE_FORMATTER),
dto.getLayer(), dto.getLayerId());
}
} }
} }
} }
...@@ -193,12 +194,13 @@ public class CalcOrgCapacityScheduler { ...@@ -193,12 +194,13 @@ public class CalcOrgCapacityScheduler {
entity.setUpdateTime(LocalDateTime.now()); entity.setUpdateTime(LocalDateTime.now());
// todo entity.setOrderCount(); // todo entity.setOrderCount();
capacityOrgStatDao.save(entity); capacityOrgStatDao.save(entity);
if (dto.getCapTotal() > 0) {
double usedPercentage = (double) dto.getCapUsed() / dto.getCapTotal(); double usedPercentage = (double) dto.getCapUsed() / dto.getCapTotal();
log.info("[calcOneBranch] {}分部容量已使用占比{}", branchId, usedPercentage); log.info("[calcOneBranch] {}分部容量已使用占比{}", branchId, usedPercentage);
if (BigDecimal.valueOf(usedPercentage).compareTo(new BigDecimal("0.8")) >= 0) { if (BigDecimal.valueOf(usedPercentage).compareTo(new BigDecimal("0.8")) >= 0) {
addCapacityMsg("", branchId, "", LocalDate.parse(date, DateUtil.DATE_FORMATTER), addCapacityMsg("", branchId, "", LocalDate.parse(date, DateUtil.DATE_FORMATTER),
dto.getLayer(), dto.getLayerId()); dto.getLayer(), dto.getLayerId());
}
} }
} }
} }
......
...@@ -53,6 +53,7 @@ public class BeanRemoteServiceImpl { ...@@ -53,6 +53,7 @@ public class BeanRemoteServiceImpl {
add("1575934912659275778"); add("1575934912659275778");
} }
}; };
private static List<String> qaaa = new ArrayList<>();
@Value("${bean.app-key}") @Value("${bean.app-key}")
private String appKey; private String appKey;
...@@ -211,6 +212,7 @@ public class BeanRemoteServiceImpl { ...@@ -211,6 +212,7 @@ public class BeanRemoteServiceImpl {
log.info("开始同步人员信息{}", JsonUtil.toJson(account)); log.info("开始同步人员信息{}", JsonUtil.toJson(account));
saveEngineerInfoByHrId(departId, account.getHrId(), account.getUserName()); saveEngineerInfoByHrId(departId, account.getHrId(), account.getUserName());
} }
System.out.println(qaaa);
} }
/** /**
...@@ -231,11 +233,10 @@ public class BeanRemoteServiceImpl { ...@@ -231,11 +233,10 @@ public class BeanRemoteServiceImpl {
String engineerCode = userDetailInfo.getWorkNo(); String engineerCode = userDetailInfo.getWorkNo();
if (StringUtils.isBlank(engineerCode)) { if (StringUtils.isBlank(engineerCode)) {
log.warn("分站:{}工程师{}没有工号", departId, userDetailInfo.getUsername()); log.warn("分站:{}工程师{}没有工号", departId, userDetailInfo.getUsername());
qaaa.add(userDetailInfo.getUsername());
return; return;
} }
final Address address = userDetailInfo.getAddress(); final Address address = userDetailInfo.getAddress();
//fixme 正式同步需移除当前逻辑
engineerCode = "BEAN" + engineerCode;
EngineerInfoEntity engineerInfo = getEngineerInfoEntity(departId, engineerCode, userDetailInfo, address); EngineerInfoEntity engineerInfo = getEngineerInfoEntity(departId, engineerCode, userDetailInfo, address);
engineerInfoDao.save(engineerInfo); engineerInfoDao.save(engineerInfo);
engineerInfoDao.flush(); engineerInfoDao.flush();
...@@ -272,12 +273,13 @@ public class BeanRemoteServiceImpl { ...@@ -272,12 +273,13 @@ public class BeanRemoteServiceImpl {
//fixme 工作地址存贮 //fixme 工作地址存贮
if (Objects.nonNull(address)) { if (Objects.nonNull(address)) {
engineerInfo.setAddress(address.getAddress()); engineerInfo.setAddress(StringUtils.isNotBlank(address.getAddress()) ? address.getAddress() : "");
engineerInfo.setWorkAddress(address.getAddress()); engineerInfo.setWorkAddress(address.getAddress());
engineerInfo.setWorkX(Objects.isNull(address.getLongitude()) ? "" : String.valueOf(address.getLongitude())); engineerInfo.setWorkX(Objects.isNull(address.getLongitude()) ? "" : String.valueOf(address.getLongitude()));
engineerInfo.setWorkY(Objects.isNull(address.getLatitude()) ? "" : String.valueOf(address.getLatitude())); engineerInfo.setWorkY(Objects.isNull(address.getLatitude()) ? "" : String.valueOf(address.getLatitude()));
} else { } else {
engineerInfo.setWorkAddress(""); engineerInfo.setAddress("无");
engineerInfo.setWorkAddress("无");
} }
engineerInfo.setCreateTime(LocalDateTime.now()); engineerInfo.setCreateTime(LocalDateTime.now());
......
package com.dituhui.pea.order.service.impl; package com.dituhui.pea.order.service.impl;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.dituhui.pea.common.BusinessException; import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.DateUtils; import com.dituhui.pea.order.common.DateUtils;
...@@ -17,10 +18,7 @@ import com.dituhui.pea.order.dto.BusinessTeamDetailDTO; ...@@ -17,10 +18,7 @@ import com.dituhui.pea.order.dto.BusinessTeamDetailDTO;
import com.dituhui.pea.order.dto.BusinessTeamUpdateDTO; import com.dituhui.pea.order.dto.BusinessTeamUpdateDTO;
import com.dituhui.pea.order.dto.BusinessTeamWarehousesDTO; import com.dituhui.pea.order.dto.BusinessTeamWarehousesDTO;
import com.dituhui.pea.order.dto.BusinessTeamsDTO; import com.dituhui.pea.order.dto.BusinessTeamsDTO;
import com.dituhui.pea.order.entity.OrgGroupEntity; import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.entity.OrgTeamEngineerEntity;
import com.dituhui.pea.order.entity.OrgTeamEntity;
import com.dituhui.pea.order.entity.OrgWarehouseInfoEntity;
import com.dituhui.pea.order.service.BusinessTeamService; import com.dituhui.pea.order.service.BusinessTeamService;
import com.dituhui.pea.order.service.CommonService; import com.dituhui.pea.order.service.CommonService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -81,9 +79,14 @@ public class BusinessTeamServiceImpl implements BusinessTeamService { ...@@ -81,9 +79,14 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
page = orgTeamDao.findAllByGroupId(req.getLevelValue(), pageable); page = orgTeamDao.findAllByGroupId(req.getLevelValue(), pageable);
} }
for (OrgTeamEntity e : page.getContent()) { for (OrgTeamEntity e : page.getContent()) {
List<String> engineers = orgTeamEngineerDao.findAllByTeamId(e.getTeamId()).stream().map(e2 -> { List<String> engineers = new ArrayList<>();
return engineerInfoDao.getByEngineerCode(e2.getEngineerCode()).getName(); for (OrgTeamEngineerEntity e2 : orgTeamEngineerDao.findAllByTeamId(e.getTeamId())) {
}).collect(Collectors.toList()); EngineerInfoEntity infoEntity = engineerInfoDao.getByEngineerCode(e2.getEngineerCode());
if (ObjectUtil.isNull(infoEntity)) {
continue;
}
engineers.add(infoEntity.getName());
}
BusinessTeamsDTO.Content content = new BusinessTeamsDTO.Content(); BusinessTeamsDTO.Content content = new BusinessTeamsDTO.Content();
content.setTeamId(e.getTeamId()).setTeamName(e.getTeamName()); content.setTeamId(e.getTeamId()).setTeamName(e.getTeamName());
content.setWorkdays(String.join("、", getWorkdaysChinese(e.getWorkdays()))); content.setWorkdays(String.join("、", getWorkdaysChinese(e.getWorkdays())));
......
...@@ -124,7 +124,53 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -124,7 +124,53 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
slots.sort(Comparator.comparing(EngineersGanttDTO.Slot::getBtime)); slots.sort(Comparator.comparing(EngineersGanttDTO.Slot::getBtime));
mapEngineers.put(order.getEngineerCode(), slots); mapEngineers.put(order.getEngineerCode(), slots);
} }
log.info("mapEngineers ===> {}", mapEngineers); // 查询辅助工单
List<OrderInfoEntity> subOrders = orderInfoDao.findByDtAndServiceStatusNotAndEngineerCodeSubIn(localDate, ServiceStatusEnum.CANCELED.getCode(), engineerCodes);
HashMap<String, List<EngineersGanttDTO.Slot>> mapSubEngineers = new HashMap<>();
for (OrderInfoEntity order : subOrders) {
// 服务工单本体
EngineersGanttDTO.Slot slot = new EngineersGanttDTO.Slot();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
slot.setOrderId(order.getOrderId());
slot.setServiceStatus(OrderUtil.handleServiceStatus(order));
String startServiceStr = null;
slot.setBtime(getHourMinute(order.getSubPlanStartTime()));
slot.setEtime(getHourMinute(order.getSubPlanEndTime()));
slot.setTooltip(getOrderTips(order, startServiceStr));
OrderSkillProjection orderSkill = orderInfoDao.getOrderSkillCaptionByOrderIdAndDt(order.getOrderId(), localDate);
if (orderSkill != null) {
slot.setText(orderSkill.getSkillCaption());
}
slot.setBgColor(order.getAppointmentStatus());
List<EngineersGanttDTO.Slot> slots = null;
if (mapSubEngineers.containsKey(order.getEngineerCodeSub())) {
slots = mapSubEngineers.get(order.getEngineerCodeSub());
} else {
slots = new ArrayList<>();
}
slot.setBgColor(getColor(order.getServiceStatus()));
slot.setIsSub(true);
if (!order.getAppointmentStatus().equals(OrderFlowEnum.CONFIRM.name())) {
slot.setBorderStyle("dashed"); // 未确认的指派,统一加上虚框
}
// 有在途时长先计算在途时间
if (order.getSubElapsed() > 0 && order.getSubDistance() > 0) {
// 有在途,起止时间,分别是订单的开始时间减去在途时间、订单的开始时间
EngineersGanttDTO.Slot slot2 = new EngineersGanttDTO.Slot();
slot2.setBtime(getHourMinute(order.getSubPlanStartTime(), -order.getSubElapsed()));
slot2.setEtime(getHourMinute(order.getSubPlanStartTime()));
slot2.setShapeSize("mini");
slot2.setBgColor(getColor("ONWAY"));
slot2.setTooltip(getOnwayTips(order));
slot2.setIsSub(true);
slots.add(slot2);
}
slots.add(slot);
slots.sort(Comparator.comparing(EngineersGanttDTO.Slot::getBtime));
mapSubEngineers.put(order.getEngineerCodeSub(), slots);
}
List<EngineersGanttDTO.GanttChart> engineers = new ArrayList<>(); List<EngineersGanttDTO.GanttChart> engineers = new ArrayList<>();
for (String engineerCode : engineerCodes) { for (String engineerCode : engineerCodes) {
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(engineerCode); EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(engineerCode);
...@@ -148,9 +194,14 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -148,9 +194,14 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
engineer.setCapTotal(capacityEngineerStat.getCapTotal().toString()).setCapUsed(capacityEngineerStat.getCapUsed().toString()); engineer.setCapTotal(capacityEngineerStat.getCapTotal().toString()).setCapUsed(capacityEngineerStat.getCapUsed().toString());
} }
if (mapEngineers.containsKey(engineerCode)) { if (mapEngineers.containsKey(engineerCode)) {
engineer.setSlots(mapEngineers.get(engineerCode)); List<EngineersGanttDTO.Slot> slots = mapEngineers.get(engineerCode);
List<EngineersGanttDTO.Slot> slotsSub = mapSubEngineers.get(engineerCode);
if (CollectionUtils.isNotEmpty(slotsSub)) {
slots.addAll(slotsSub);
slots.sort(Comparator.comparing(EngineersGanttDTO.Slot::getBtime));
}
engineer.setSlots(slots);
} }
// engineer.setErrorTip(); todo
engineers.add(engineer); engineers.add(engineer);
} }
// 按技术员名称进行排序 // 按技术员名称进行排序
......
...@@ -555,7 +555,7 @@ public class OrderInfoServiceImpl implements OrderInfoService { ...@@ -555,7 +555,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
seg.setDistance(orderInfo.getArriveDistance()); seg.setDistance(orderInfo.getArriveDistance());
seg.setStart(orderInfo.getPlanStartTime()); seg.setStart(orderInfo.getPlanStartTime());
seg.setEnd(orderInfo.getPlanEndTime()); seg.setEnd(orderInfo.getPlanEndTime());
if (StringUtils.isNotBlank(orderInfo.getEngineerCodeSub()) && orderInfo.getIsMultiple() == 1 && orderInfo.getEngineerCodeSub().equals(engineer.getEngineerCode())) { if (OrderUtil.isSub(orderInfo, engineer.getEngineerCode())) {
seg.setIsSub(true); seg.setIsSub(true);
seg.setElapsed(orderInfo.getSubElapsed()); seg.setElapsed(orderInfo.getSubElapsed());
seg.setDistance(orderInfo.getSubDistance()); seg.setDistance(orderInfo.getSubDistance());
......
...@@ -231,9 +231,11 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -231,9 +231,11 @@ public class ScheduleServiceImpl implements ScheduleService {
Sort sort = Sort.by(Sort.Direction.valueOf(sortType.toUpperCase()), sortColumn); Sort sort = Sort.by(Sort.Direction.valueOf(sortType.toUpperCase()), sortColumn);
//查询包含已取消在内所以工单,后续数据筛选只用预指派和确认指派数据 //查询包含已取消在内所以工单,后续数据筛选只用预指派和确认指派数据
List<OrderInfoEntity> orderAppointmentsAll = orderInfoDao.findByDtAndEngineerCode(date, engineerCode, sort); List<OrderInfoEntity> orderAppointmentsAll = orderInfoDao.findByDtAndEngineerCode(date, engineerCode, sort);
List<OrderInfoEntity> subOrders = orderInfoDao.findByDtAndEngineerCodeSub(date, engineerCode);
List<OrderInfoEntity> orderAppointments = orderAppointmentsAll.stream().filter(e -> (e.getAppointmentStatus() List<OrderInfoEntity> orderAppointments = orderAppointmentsAll.stream().filter(e -> (e.getAppointmentStatus()
.equals(OrderFlowEnum.PRE.name())) || e.getAppointmentStatus().equals(OrderFlowEnum.CONFIRM.name())) .equals(OrderFlowEnum.PRE.name())) || e.getAppointmentStatus().equals(OrderFlowEnum.CONFIRM.name()))
.collect(Collectors.toList()); .collect(Collectors.toList());
orderAppointments.addAll(subOrders);
List<TimeLineDTO> timelines = new ArrayList<>(); List<TimeLineDTO> timelines = new ArrayList<>();
int sumDistance = 0; int sumDistance = 0;
int sumElapsed = 0; int sumElapsed = 0;
...@@ -241,12 +243,20 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -241,12 +243,20 @@ public class ScheduleServiceImpl implements ScheduleService {
TimeLineDTO item = new TimeLineDTO(); TimeLineDTO item = new TimeLineDTO();
item.setOrderId(o.getOrderId()); item.setOrderId(o.getOrderId());
item.setAppointmentStatus(o.getAppointmentStatus()); item.setAppointmentStatus(o.getAppointmentStatus());
item.setStartTime(TimeUtils.IsoLocalDateTime2String(o.getPlanStartTime())); if (OrderUtil.isSub(o, engineerCode)) {
item.setEndTime(TimeUtils.IsoLocalDateTime2String(o.getPlanEndTime())); item.setIsSub(true);
item.setStartTime(TimeUtils.IsoLocalDateTime2String(o.getSubPlanStartTime()));
item.setEndTime(TimeUtils.IsoLocalDateTime2String(o.getSubPlanEndTime()));
sumDistance += Objects.isNull(o.getSubDistance()) ? 0 : o.getSubDistance();
sumElapsed += Objects.isNull(o.getSubElapsed()) ? 0 : o.getSubElapsed();
} else {
item.setStartTime(TimeUtils.IsoLocalDateTime2String(o.getPlanStartTime()));
item.setEndTime(TimeUtils.IsoLocalDateTime2String(o.getPlanEndTime()));
sumDistance += Objects.isNull(o.getArriveDistance()) ? 0 : o.getArriveDistance();
sumElapsed += Objects.isNull(o.getArriveElapsed()) ? 0 : o.getArriveElapsed();
}
item.setTips(emptyTips); item.setTips(emptyTips);
timelines.add(item); timelines.add(item);
sumDistance += Objects.isNull(o.getArriveDistance()) ? 0 : o.getArriveDistance();
sumElapsed += Objects.isNull(o.getArriveElapsed()) ? 0 : o.getArriveElapsed();
} }
String groupName = ""; String groupName = "";
......
...@@ -29,6 +29,7 @@ public class OrderUtil { ...@@ -29,6 +29,7 @@ public class OrderUtil {
order.setEngineerCode(null); order.setEngineerCode(null);
return order; return order;
} }
/** /**
* 分处理辅助工程师数据 * 分处理辅助工程师数据
* *
...@@ -217,4 +218,17 @@ public class OrderUtil { ...@@ -217,4 +218,17 @@ public class OrderUtil {
return tagList; return tagList;
} }
/**
* 分单,超派,特殊时间等处理工单指派工程师,网点等数据
*
* @return
*/
public static Boolean isSub(OrderInfoEntity orderInfo, String enginnerCode) {
if (StringUtils.isNotBlank(orderInfo.getEngineerCodeSub()) && orderInfo.getIsMultiple() == 1 && orderInfo.getEngineerCodeSub().equals(enginnerCode)) {
return true;
}
return false;
}
} }
package com.dituhui.pea.order.common; package com.dituhui.pea.order.common;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import com.dituhui.pea.bean.AllotResultParam;
import com.dituhui.pea.common.BusinessException; import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.order.OrderServiceApplication; import com.dituhui.pea.order.OrderServiceApplication;
import com.dituhui.pea.order.common.jackson.JsonUtil; import com.dituhui.pea.order.common.jackson.JsonUtil;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!