Commit f8d4ef2f by chamberone

Merge branch 'develop' of https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…

…oject.git into develop
2 parents 28d0f9a4 6047e378
Showing with 264 additions and 44 deletions
......@@ -3,7 +3,7 @@ server:
dispatch:
cron:
expr: 0 32 8-23 * * ?
expr: 0 25 8-23 * * ?
next-day-limit: 20
# expr: 0 */10 8-18 * * ?
......@@ -49,13 +49,13 @@ spring:
enabled: false
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://127.0.0.1:3306/saas_aftersale_test?serverTimezone=Asia/Shanghai
# username: root
# password: 123456
url: jdbc:mysql://localhost:32306/saas_aftersale_test?serverTimezone=Asia/Shanghai
username: boxi
password: boxi_dev_0725
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://127.0.0.1:3306/saas_aftersale_test?serverTimezone=Asia/Shanghai
username: root
password: 123456
# url: jdbc:mysql://localhost:32306/saas_aftersale_test?serverTimezone=Asia/Shanghai
# username: boxi
# password: boxi_dev_0725
# type: com.alibaba.druid.pool.DruidDataSource
jpa:
show-sql: true
......
......@@ -145,6 +145,8 @@ public enum StatusCodeEnum {
TEAM_UNMATCHED("029", "工程师没有匹配到工作队", false),
ORDER_FINISHED("030", "订单已结束,请勿操作", false),
FENDAN_IS_TRANSCEND_AND_SPECIAL("031", "分单超派和特殊时间", false),
;
/**
......
......@@ -40,17 +40,6 @@ public class MsgController {
MsgQuery request) {
CommonUtil.setNullValue(request);
request.setUserId(userId);
if ("isRead".equalsIgnoreCase(request.getSort())) {
request.setSort("is_read");
}
if ("type".equalsIgnoreCase(request.getSort())) {
request.setSort("type");
} else {
request.setSort("create_time");
}
if (!"asc".equalsIgnoreCase(request.getSortType())) {
request.setSortType("desc");
}
if (Objects.nonNull(request.getEndDate())) {
request.setEndDate(CommonUtil.addDays(request.getEndDate(), 1));
......
......@@ -90,7 +90,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
" WHERE esg.status = 1 AND esg.skill_group_code IN( :skillGroupCodes) group by esg.engineer_code having count(esg.skill_group_code) = :skillGroupNumber " +
" ) AS tabA ON tabA.engineer_code = ote.engineer_code " +
" LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code " +
" WHERE ote.team_id = :teamId AND ei.id is not null" +
" WHERE ote.team_id = :teamId AND ote.status = 1 AND ei.id is not null" +
" order by ei.engineer_code desc", nativeQuery = true)
Set<EngineerInfoEntity> listBySkillGroupCode(@Param("skillGroupCodes") Collection<String> skillGroupCodes, @Param("skillGroupNumber") int skillGroupNumber, @Param("teamId") String teamId);
......@@ -129,6 +129,6 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
"WHERE ote.team_id = :teamId AND ote.engineer_code = :engineerCode AND ote.`status` = 1", nativeQuery = true)
EngineerInfoEntity selectEngineerByEngineerCodeAndTeamId(@Param("engineerCode") String engineerCode, @Param("teamId") String teamId);
@Query(value = "SELECT DISTINCT esg.engineer_code FROM engineer_skill_group esg WHERE engineer_code in (:engineerCodes) and skill_group_code in (:skillGroupCodes)", nativeQuery = true)
@Query(value = "SELECT DISTINCT esg.engineer_code FROM engineer_skill_group esg WHERE engineer_code in (:engineerCodes) and skill_group_code in (:skillGroupCodes) and status = 1", nativeQuery = true)
List<String> findByEngineerCodesBySkillCodes(@Param("engineerCodes") List<String> engineerCodes, @Param("skillGroupCodes") Set<String> skillGroupCodes);
}
......@@ -19,6 +19,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List<OrderInfoEntity> findByDtAndEngineerCodeIn(LocalDate date, List<String> engineerCodes);
List<OrderInfoEntity> findByDtAndServiceStatusNotAndEngineerCodeIn(LocalDate date, String serviceSatus, List<String> engineerCodes);
List<OrderInfoEntity> findByDtAndEngineerCode(LocalDate date, String engineerCode);
@Query("SELECT o.orderId, s.skillCategory as skillCaption FROM OrderInfoEntity o JOIN SkillInfoEntity s on o.brand=s.brand and o.type=s.type and o.skill=s.skill WHERE o.orderId = :orderId and o.dt = :dt")
......@@ -102,4 +104,11 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
@Query(value = "SELECT count(*) from order_info WHERE dt =:dt and service_status ='STARTED' and actual_end_time is null " +
"and DATE_ADD(NOW(), INTERVAL 10 MINUTE) > plan_end_time and org_branch_id = :orgBranchId", nativeQuery = true)
long countOvertimeByDtAndOrgBranchId(LocalDate dt, String orgBranchId);
@Query(value = "from OrderInfoEntity where orderStatus <> 'CANCELED'"
+ " and engineerCode is not null and engineerCode<>''"
+ " and expectTimeBegin is not null and expectTimeEnd is not null and expectTimeBegin>?1"
+ " and ((actualStartTime is null and expectTimeBegin<= ?2) "
+ " or (actualStartTime is not null and actualEndTime is null and expectTimeEnd<= ?2))")
List<OrderInfoEntity> getDelayOrTimeoutOrder(LocalDateTime today, LocalDateTime now);
}
......@@ -29,10 +29,10 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer>, JpaSp
@Query("select t from OrgTeamEntity t where t.teamId = :teamId and t.status=1")
List<OrgTeamEntity> findAllByTeamId(String teamId);
@Query("select t from OrgTeamEntity t where t.groupId = :groupId and t.status=1")
@Query("select t from OrgTeamEntity t where t.groupId = :groupId and t.status=1 ORDER BY t.groupId,t.teamName DESC")
Page<OrgTeamEntity> findAllByGroupId(String groupId, Pageable pageable);
@Query("select t from OrgTeamEntity t where t.branchId = :branchId and t.status=1")
@Query("select t from OrgTeamEntity t where t.branchId = :branchId and t.status=1 ORDER BY t.groupId,t.teamName DESC")
Page<OrgTeamEntity> findAllByBranchId(String branchId, Pageable pageable);
OrgTeamEntity getByTeamId(String teamId);
......@@ -43,6 +43,7 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer>, JpaSp
@Query("UPDATE OrgTeamEntity tt SET tt.status = :status WHERE tt.teamId = :teamId")
void updateStatusByTeamId(String teamId, int status);
@Query("select t from OrgTeamEntity t where t.teamId in :ids and t.status=1")
public List<OrgTeamEntity> findByTeamIdIn(List<String> ids);
public List<OrgTeamEntity> findByClusterIdIn(List<String> ids);
......
......@@ -25,4 +25,9 @@ public class RecommendEngineersReq {
* 待补充doc
*/
private String userId;
/**
* 是否属于搜索查询, 用于满足PRD标签判定
*/
private boolean search;
}
......@@ -18,5 +18,9 @@ public enum TestimonialsEngineerTag {
/**
* 搜索, 通过搜索出来的人
*/
SEARCH;
SEARCH,
/**
* 不显示标签
*/
NONE;
}
package com.dituhui.pea.order.scheduler;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dto.MsgDTO;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.enums.MsgTagEnum;
import com.dituhui.pea.order.enums.MsgTypeEnum;
import com.dituhui.pea.order.service.MsgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
@Slf4j
@Component
public class ServiceMsgScheduler {
@Resource
private OrderInfoDao orderInfoDao;
@Resource
private MsgService msgService;
@Resource
private OrgGroupDao orgGroupDao;
@Resource
private OrgBranchDao orgBranchDao;
@Resource
private OrgClusterDao orgClusterDao;
@Resource
private EngineerInfoDao engineerInfoDao;
@Scheduled(cron = "${scheduler.service-msg}")
public void run() {
log.info(">>> 服务类消息预警开始");
LocalDateTime today = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
LocalDateTime now = LocalDateTime.now().plusMinutes(10);
List<OrderInfoEntity> orderList = orderInfoDao.getDelayOrTimeoutOrder(today, now);
String delayContent = "%s机构%s员工(工号%s)的%s工单未按预约开始时间%s上门";
String timeoutContent = "%s机构%s员工(工号%s)的%s工单未按预约结束时间%s结束服务";
for (OrderInfoEntity orderInfoEntity : orderList) {
try {
MsgDTO dto = new MsgDTO();
dto.setClusterId(orderInfoEntity.getOrgClusterId());
dto.setBranchId(orderInfoEntity.getOrgBranchId());
dto.setGroupId(orderInfoEntity.getOrgGroupId());
dto.setType(MsgTypeEnum.SERVICE.getCode());
dto.setTag(MsgTagEnum.URGENT.getCode());
dto.setOrderIds(orderInfoEntity.getOrderId());
String orgName = null;
try {
if (StrUtil.isNotEmpty(dto.getGroupId())) {
orgName = orgGroupDao.getByGroupId(dto.getGroupId()).getGroupName();
} else if (StrUtil.isNotEmpty(dto.getBranchId())) {
orgName = orgBranchDao.getByBranchId(dto.getBranchId()).getBranchName();
} else if (StrUtil.isNotEmpty(dto.getClusterId())) {
orgName = orgClusterDao.getByClusterId(dto.getClusterId()).getName();
}
} catch (Exception e) {
log.error("工单({}) 组织机构未找到", orderInfoEntity.getOrderId());
}
String engineerName = null;
try {
engineerName = engineerInfoDao.getByEngineerCode(orderInfoEntity.getEngineerCode()).getName();
} catch (Exception e) {
log.error("工程师({}) 未找到", orderInfoEntity.getEngineerCode());
}
if (Objects.isNull(orderInfoEntity.getActualStartTime())) {//delay
dto.setContent(String.format(delayContent,
orgName,
engineerName,
orderInfoEntity.getEngineerCode(),
orderInfoEntity.getOrderId(),
DateUtil.format(orderInfoEntity.getExpectTimeBegin(), "yyyy-MM-dd HH:mm")
));
} else {//超时
dto.setContent(String.format(timeoutContent,
orgName,
engineerName,
orderInfoEntity.getEngineerCode(),
orderInfoEntity.getOrderId(),
DateUtil.format(orderInfoEntity.getExpectTimeEnd(), "yyyy-MM-dd HH:mm")
));
}
msgService.add(dto);
} catch (Exception e) {
log.error("工单(" + orderInfoEntity.getOrderId() + ") 预警消息保存失败:" + e.getMessage(), e);
}
}
log.info(">>> 服务类消息预警结束");
}
}
......@@ -209,6 +209,11 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
// 技术员列表
List<String> engineerCodes = req.getEngineerCodes();
if (engineerCodes.isEmpty()) {
//移除原有关系映射
final String targetTeamId = String.valueOf(entity.getTeamId());
orgTeamEngineerDao.deleteByTeamId(targetTeamId);
}
if (engineerCodes != null && !engineerCodes.isEmpty()) {
final String targetTeamId = String.valueOf(entity.getTeamId());
List<String> targetTeamWorkDayOfWeek = List.of(entity.getWorkdays().split(","));
......
......@@ -59,6 +59,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -97,7 +98,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
@Override
public Result<?> getEngineersCalendar(EngineerCalendarDTO.Request req) {
// 技术员日历,查询 capacity_engineer_calendar表,如果当日有各种事项,进行显示;否则显示正常上班;
List<EngineerCalendarDTO.Engineer> engineers = new ArrayList<>();
List<String> allCodes = engineerUtil.getEngineersByLevel(req.getLevelType(), req.getLevelValue()).stream()
.map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList());
......@@ -105,6 +105,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
Page<EngineerInfoEntity> page = engineerUtil.filterEngineersByKeyAndPage(allCodes, req.getKey(), req.getPage(), req.getSize());
String edate = DateUtils.localDateFromStr(req.getDate()).plusDays(14).toString();
List<EngineerCalendarDTO.Engineer> engineers = new ArrayList<>();
for (EngineerInfoEntity e : page.getContent()) {
EngineerCalendarDTO.Engineer engineer = new EngineerCalendarDTO.Engineer();
engineer.setEngineerCode(e.getEngineerCode());
......@@ -117,6 +118,8 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
rs.setPages(page.getTotalPages());
rs.setPageSize(page.getSize());
rs.setPageCurrent(page.getNumber() + 1);
engineers = engineers.stream().sorted(Comparator.comparing(EngineerCalendarDTO.Engineer::getName).reversed()).collect(Collectors.toList());
rs.setEngineers(engineers);
return Result.success(rs);
}
......
......@@ -10,6 +10,7 @@ import com.dituhui.pea.order.dto.EngineersGanttDTO;
import com.dituhui.pea.order.dto.LabelValueDTO;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.enums.OrderFlowEnum;
import com.dituhui.pea.order.enums.ServiceStatusEnum;
import com.dituhui.pea.order.service.EngineerGanttService;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
......@@ -61,7 +62,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
}
LocalDate localDate = LocalDate.parse(reqDTO.getDate());
List<OrderInfoEntity> orders = orderInfoDao.findByDtAndEngineerCodeIn(localDate, engineerCodes);
List<OrderInfoEntity> orders = orderInfoDao.findByDtAndServiceStatusNotAndEngineerCodeIn(localDate, ServiceStatusEnum.CANCELED.getCode(), engineerCodes);
HashMap<String, List<EngineersGanttDTO.Slot>> mapEngineers = new HashMap<>();
for (OrderInfoEntity order : orders) {
// 服务工单本体
......
......@@ -390,7 +390,8 @@ public class EngineerServiceImpl implements EngineerService {
items.add(item);
}
return items;
return items.stream().sorted(Comparator.comparing(EngineerInfoListResp.EngineerInfo::getGroupName, Comparator.reverseOrder())
.thenComparing(EngineerInfoListResp.EngineerInfo::getName, Comparator.reverseOrder())).collect(Collectors.toList());
}
private List<EngineerSkillListResp.EngineerSkill> packEngineerSkills(List<EngineerInfoEntity> engineers) {
......
......@@ -13,6 +13,7 @@ import com.dituhui.pea.order.dto.param.OrgTeamInfo;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.CapacityQueryService;
import com.dituhui.pea.order.service.FendanService;
import com.dituhui.pea.order.utils.CommonUtil;
import com.dituhui.pea.pojo.fendan.FendanDTO;
import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq;
import com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp;
......@@ -311,6 +312,13 @@ public class FendanServiceImpl implements FendanService {
return Result.success(orgGroupInfo.getTeamInfos().get(0));
}
}
// 超派情况判断特殊时间
//特殊时间段
Integer special = CommonUtil.isSpecial(startTime, endTime, orgGroupTeamInfos.get(0).getTeamInfos().get(0).getWorkOn(),
orgGroupTeamInfos.get(0).getTeamInfos().get(0).getWorkOff());
if (special == 1) {
return Result.failed(StatusCodeEnum.FENDAN_IS_TRANSCEND_AND_SPECIAL);
}
return Result.failed(StatusCodeEnum.FENDAN_IS_TRANSCEND);
}
......
......@@ -22,10 +22,7 @@ import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Service
......@@ -49,7 +46,24 @@ public class MsgServiceImpl implements MsgService {
@Override
public PageResult<MsgGroupResp> list(MsgQuery request) {
Sort sort = Sort.by("asc".equalsIgnoreCase(request.getSortType()) ? Sort.Direction.ASC : Sort.Direction.DESC, request.getSort());
List<Sort.Order> orders = new ArrayList<>();
Sort.Direction direction = Sort.Direction.ASC;
if (!"asc".equalsIgnoreCase(request.getSortType())) {
direction = Sort.Direction.DESC;
}
if ("isRead".equalsIgnoreCase(request.getSort())) {
request.setSort("is_read");
} else if ("type".equalsIgnoreCase(request.getSort())) {
request.setSort("type");
} else if ("createTime".equalsIgnoreCase(request.getSort())) {
request.setSort("create_time");
} else {
request.setSort("create_time");
orders.add(new Sort.Order(Sort.Direction.ASC,
"is_read"));
}
orders.add(new Sort.Order(direction, request.getSort()));
Sort sort = Sort.by(orders);
Pageable pageable = PageRequest.of(request.getPage() - 1, request.getSize(), sort);
Page<Map<String, Objects>> page = msgDao.getGroupList(request, pageable);
List<MsgGroupResp> list = page.getContent().stream().map(msg -> {
......
......@@ -191,8 +191,10 @@ public class OrderAssignImpl implements OrderAssign {
engineerTag = TestimonialsEngineerTag.TEAM;
} else if (tempEngineer.getDistance().compareTo(judgeDistance) <= 0) {
engineerTag = TestimonialsEngineerTag.PERIPHERAL;
} else {
} else if (req.isSearch()){
engineerTag = TestimonialsEngineerTag.SEARCH;
} else {
engineerTag = TestimonialsEngineerTag.NONE;
}
item.setEngineerCode(engineerCode);
......
......@@ -355,6 +355,11 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 处理超派
entity.setTranscend(1);
}
if (fendanResult.getCode().equals(StatusCodeEnum.FENDAN_IS_TRANSCEND_AND_SPECIAL.getCode())) {
// 处理超派和特殊时间
entity.setTranscend(1);
entity.setIsSpecialTime(1);
}
OrgBranchEntity branchEntity = orgBranchDao.findByCitycodeListLike("%" + adminDistrict.getResult().getSubNames().getCity() + "%");
entity.setOrgClusterId(branchEntity.getClusterId());
entity.setOrgBranchId(branchEntity.getBranchId());
......
......@@ -418,6 +418,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
} else {
cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), null);
}
// 当日单指派策略为人工指派,次日单动态排班自动批量
if (isToday || cutoff == 1) {
order.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name());
order.setAppointmentStatus(OrderFlowEnum.INIT.name());
}
order.setIsCutoff(cutoff);
order.setIsSpecialTime(special);
order.setOrgClusterId(clusterId);
......@@ -684,6 +689,26 @@ public class OrderInfoServiceImpl implements OrderInfoService {
//处理超派,特殊时间段
// order.setIsSpecialTime(CommonUtil.isSpecial(order.getExpectTimeBegin().toLocalTime(),
// order.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff()));
//特殊时间段
Integer special = CommonUtil.isSpecial(order.getExpectTimeBegin().toLocalTime(),
order.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff());
Integer cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), teamInfo.getWorkOff());
// 处理cutoff 动态排班结束后创建的当日单和次日单
boolean isTomorrow = DateUtil.judgeTimeIsisTomorrow(order.getExpectTimeBegin());
//次日单自动批量
if (isTomorrow) {
order.setAppointmentMethod(AppointmentMethodEnum.AUTO_BATCH.name());
}
// 特殊时间段,当天单,cutoff需要人工处理
if (cutoff == 1 || special == 1) {
//判断是否在今天cutoff之后
order.setIsCutoff(cutoff);
order.setIsSpecialTime(special);
order.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name());
order.setAppointmentStatus(OrderFlowEnum.INIT.name());
//发送通知分部消息
sendMsg(order.getOrgBranchId(), order.getOrderId(), req.getExpectBegin());
}
}
return order;
}
......
......@@ -3,9 +3,23 @@ package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.TimeUtils;
import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dto.*;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.dao.EngineerInfoDao;
import com.dituhui.pea.order.dao.EngineerSkillGroupDao;
import com.dituhui.pea.order.dao.OrderEventDao;
import com.dituhui.pea.order.dao.OrderInfoDao;
import com.dituhui.pea.order.dao.OrgGroupDao;
import com.dituhui.pea.order.dao.SkillInfoDao;
import com.dituhui.pea.order.dto.KV;
import com.dituhui.pea.order.dto.OrderAppointmentListResp;
import com.dituhui.pea.order.dto.OrderServiceDetailResp;
import com.dituhui.pea.order.dto.OrderServiceDynamicsResp;
import com.dituhui.pea.order.dto.OrderTeamBlockResp;
import com.dituhui.pea.order.entity.EngineerInfoEntity;
import com.dituhui.pea.order.entity.EngineerSkillGroupEntity;
import com.dituhui.pea.order.entity.OrderEventEntity;
import com.dituhui.pea.order.entity.OrderInfoEntity;
import com.dituhui.pea.order.entity.OrgGroupEntity;
import com.dituhui.pea.order.entity.SkillInfoEntity;
import com.dituhui.pea.order.service.OrderServiceDetail;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
......@@ -15,7 +29,15 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@Slf4j
......@@ -45,6 +67,9 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
public Result<?> getOrderServiceDetail(String orderId) {
OrderInfoEntity order = orderInfoDao.getByOrderId(orderId);
if (Objects.isNull(order)) {
throw new BusinessException("未查询到:" + orderId + "对应工单");
}
List<KV> items = this.packOrderDetail(order);
......
......@@ -37,9 +37,11 @@ import org.locationtech.spatial4j.shape.Rectangle;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
......@@ -186,6 +188,14 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
orderInfo.setPlanStartTime(planStartTime);
orderInfo.setPlanEndTime(planEndTime);
LocalDate date = planStartTime.toLocalDate();
orderInfo.setDt(date);
LocalTime exceptStartHour = LocalTime.of(planStartTime.getHour(), 0);
orderInfo.setExpectTimeBegin(LocalDateTime.of(date, exceptStartHour));
LocalTime exceptEndHour = exceptStartHour.plusHours(2);
orderInfo.setExpectTimeEnd(LocalDateTime.of(date, exceptEndHour));
orderInfo.setExpectTimeDesc(MessageFormat.format("{0}月{1}日{2}-{3}点", date.getMonthValue(), date.getDayOfMonth(), exceptStartHour.getHour(), exceptEndHour.getHour()));
orderInfo.setApplyNote(MessageFormat.format("{0}-{1}", DateTimeUtil.formatTime(exceptStartHour), DateTimeUtil.formatTime(exceptEndHour)));
}
orderInfo.setReasonForFailure(request.getReasonForFailure());
......
......@@ -128,10 +128,10 @@ public class ScheduleServiceImpl implements ScheduleService {
List<ScheduleOverviewResp.Item> children = new ArrayList<>();
Integer teamDistance = 0;
Integer minOrderSum=null;
Integer maxOrderSum=null;
Integer minDistance=null;
Integer maxDistance=null;
Integer minOrderSum=0;
Integer maxOrderSum=0;
Integer minDistance=0;
Integer maxDistance=0;
for (Map.Entry<String, List<EngineerInfoEntity>> entry : engineers.entrySet()) {
ScheduleOverviewResp.Item child = new ScheduleOverviewResp.Item();
......
......@@ -356,7 +356,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
Long started = summary.getOrDefault("STARTED", 0L);
Long finished = summary.getOrDefault("FINISHED", 0L) + summary.getOrDefault("UNFINISHED", 0L);
Long cancel = summary.getOrDefault("1", 0L);
Long cancel = summary.getOrDefault("CANCELED", 0L);
// 服务状态:INIT-初始化/PENDING待服务/CONTACTED已排期/STARTED-已开始/FINISHED已完成/UNFINISHED-已上门未完成
// - 待上门:服务状态为“待服务、已排期”的工单.
HashMap<String, List<String>> p1 = this.packParams("appointmentStatus", "CONTACTED", "PENDING");
......
......@@ -90,4 +90,6 @@ scheduler:
# 8-20点,每小时1次
cron-expr: 0 0 1-23 * * ?
day-offset-begin: 0
day-offset-end: 14
\ No newline at end of file
day-offset-end: 14
service-msg: 0 35 11,17,15 * * ?
\ No newline at end of file
......@@ -90,6 +90,9 @@ scheduler:
cron-expr: 0 0 1-23 * * ?
day-offset-begin: 0
day-offset-end: 20
service-msg: 0 0 11,17 * * ?
logging:
level:
root: info
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!