Commit 077e2451 by Ren Ping

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

2 parents 1e784b08 acca7d28
package com.dituhui.pea.order.constant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 改约原因常量
*/
public class OrderReschedulingReason {
public static Map<String, List<String>> ReschedulingReasonMap = new HashMap<>() {
{
put("服务设备/工具相关", new ArrayList<>() {
{
add("缺少常用必备工具");
add("交通工具不可用");
}
});
put("服务物料/配件相关", new ArrayList<>() {
{
add("配件准备错误");
add("配件未到货");
add("加单服务,没有所需配件");
add("缺少可用的安装类附件");
add("缺少可用的清洁类产品");
add("缺少可用的清洁类产品");
add("缺少可用的消耗品(生料带、鞋套等)");
add("缺少服务所需纸质工单");
}
});
put("服务政策/流程相关", new ArrayList<>() {
{
add("超派");
add("重复单(工程师发起申请按钮,由CC校验取消)");
add("服务指派不准确");
add("转入车间服务流程");
add("退换机方案沟通中");
add("不接受退换机政策");
add("用户考虑费用问题");
add("用户不认可收费标准");
add("用户考虑安装/维修方案");
add("用户不接受维修标准");
add("用户考虑软性故障相关解释");
add("没有相关安装/维修操作指导(不提供此服务)");
}
});
put("安装、维修环境(极端天气)", new ArrayList<>() {
{
add("安装、维修环境不符");
add("极端天气,无法正常上门");
}
});
put("服务关联人员相关", new ArrayList<>() {
{
add("预约排期问题");
add("用户希望更换其他工程师上门");
add("服务工程师技能不符");
add("突发的事件导致工程师无法上门(如请假、生病、事故)");
add("等待支持岗位(投诉组、分部、技术支持)提供方案");
add("拉修/退换机的物流服务不到位");
add("售前送货的物流服务不到位");
}
});
put("暂无法关单,初始服务已完成", new ArrayList<>() {
{
add("用户希望观察使用一段时间");
add("用户本人不在现场");
add("TSS软件系统故障");
add("配件代码未维护进系统");
}
});
put("用户相关", new ArrayList<>() {
{
add("用户不接电话且已短信通知用户(改约3次以内)");
add("3天6次未联系上用户");
add("无法满足消费者夜间上门需求(非加单)");
add("用户期望的服务时间与其他用户冲突");
add("上门前得知外部人员已服务");
add("用户要求自行来分部购买配/附件(仅仓管可选)");
add("机器已退/换,不再需要上门服务(仅行政/用户/CC可选)");
add("非BSH产品");
add("用户主动提出往后改约(必须短信通知用户)");
add("机器故障已消除(仅行政/用户/CC可选)");
add("消费者希望提前上门");
}
});
put("其它原因", new ArrayList<>() {
{
}
});
}
};
}
......@@ -4,7 +4,6 @@ import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.enums.StatusCodeEnum;
import com.dituhui.pea.order.common.jackson.DateUtil;
import com.dituhui.pea.order.common.jackson.JsonUtil;
import com.dituhui.pea.order.dao.TableCodeCheckDao;
import com.dituhui.pea.order.dto.param.BaseDistance;
import com.dituhui.pea.order.dto.param.BaseDistanceParam;
......@@ -37,13 +36,10 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -66,22 +62,6 @@ public class PeaApiController {
private final TableCodeCheckDao tableCodeCheckDao;
private static final String capacity = "{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\":\"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-21\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 1, \"remain\": 3500}, {\"maxDuration\": 45, \"name\": \"上午\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 11:59:59\", \"status\": 1, \"remain\": 2500}, {\"maxDuration\": 60, \"name\": \"下午\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 0, \"remain\": 1000}, {\"maxDuration\": 60, \"name\": \"时间段\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 15:00:00\", \"status\": 1, \"remain\": 480}]}]}";
private static final String day_capacity = "{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-21\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 1, \"remain\": 3500}]}]}";
private static final String half_capacity = "{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-22\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-22 08:00:00\", \"endTime\": \"2023-07-22 17:59:59\", \"status\": 1, \"remain\": 3500}, {\"maxDuration\": 45, \"name\": \"上午\", \"beginTime\": \"2023-07-22 08:00:00\", \"endTime\": \"2023-07-22 11:59:59\", \"status\": 1, \"remain\": 2500}, {\"maxDuration\": 60, \"name\": \"下午\", \"beginTime\": \"2023-07-22 13:00:00\", \"endTime\": \"2023-07-22 17:59:59\", \"status\": 0, \"remain\": 1000}]}]}";
private static final String half_capacity2 = "{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-21\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 1, \"remain\": 1000}, {\"maxDuration\": 60, \"name\": \"下午\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 0, \"remain\": 1000}]}]}";
private static final String date_capacity = "{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-23\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-23 08:00:00\", \"endTime\": \"2023-07-23 17:59:59\", \"status\": 1, \"remain\": 480}, {\"maxDuration\": 60, \"name\": \"时间段\", \"beginTime\": \"2023-07-23 13:00:00\", \"endTime\": \"2023-07-23 15:00:00\", \"status\": 1, \"remain\": 480}]}]}";
private static final String stage = "{\"orderId\": \"X10001\", \"engineerCode\": \"E12005\", \"engineerName\": \"祝枝山\", \"engineerCodeAssist\": \"E12446\", \"engineerNameAssist\": \"李晓阳\", \"planVisitTime\": \"2023-07-27 12:00:00\", \"realtimeInfo\": {\"engineerLocation\": {\"latitude\": 31.349701, \"longitude\": 120.675945, \"address\": \"江苏省苏州市苏州工业园区和顺路\", \"name\": \"和顺大酒店\"}, \"estimate\": {\"distance\": 2300, \"arriveTime\": \"2023-07-27 12:12:00\"}}}";
private static Map<String, String> makeMap = new HashMap<>() {
{
put("120.056196,28.910257", day_capacity);
put("120.675945,31.349701", half_capacity);
put("120.721813,31.303003", half_capacity2);
put("120.763953,31.318573", date_capacity);
}
};
/**
* 3.1GET 查询技术员日历
*
......@@ -215,13 +195,8 @@ public class PeaApiController {
* @apiNote 查询预约单状态,返回指定技术员(主,副)信息、推荐上门时间。如果查询为服务当日,增加对应技术员准实时位置,距离公里数,预计到达时间等
*/
@GetMapping("/order/stage/query")
public Result<OrderDTO.StageResult> orderStage(@NotBlank @RequestParam("orderId") String orderId) throws IOException {
OrderDTO.StageResult stageResult = JsonUtil.parse(stage, OrderDTO.StageResult.class).get();
stageResult.setOrderId(orderId);
return Result.success(stageResult);
public Result<OrderDTO.StageResult> orderStage(@NotBlank @RequestParam("orderId") String orderId) {
return Result.success(orderCreateService.orderStage(orderId));
}
/**
......
......@@ -40,4 +40,14 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List<OrderInfoEntity> findByMultipleOrdersAndOrderIdNot(String multipleOrders, String orderId);
List<OrderInfoEntity> findByMultipleOrders(String multipleOrders);
/**
* 获取工程师指定日期内的所有工单
*
* @param engineerCode 工程师编码
* @param targetDate 指定日期
* @return 指定工程师在指定日期内的所有工单
*/
@Query(value = "SELECT * FROM order_info oi WHERE (engineer_code = :engineerCode OR engineer_code_sub =:engineerCode) AND dt = :targetDate", nativeQuery = true)
List<OrderInfoEntity> getEngineerDateOrder(String engineerCode, String targetDate);
}
......@@ -3,6 +3,8 @@ package com.dituhui.pea.order.dto;
import com.dituhui.pea.order.dto.param.Location;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class OrderReschedule {
private String orderId;
......@@ -23,4 +25,27 @@ public class OrderReschedule {
* 备注
*/
private String description;
/**
* 设备品牌(博世/西门子)
*/
private String brand;
/**
* 产品类别
*/
private String productType;
/**
* 服务类型
*/
private String serviceType;
/**
* 改约原因
*/
private String reschedulingReason;
}
......@@ -199,6 +199,26 @@ public class OrderDTO {
*/
private Location happenLocation;
/**
* 设备品牌(博世/西门子)
*/
private String brand;
/**
* 产品类别
*/
private String productType;
/**
* 服务类型
*/
private String serviceType;
/**
* 改约原因
*/
private String reschedulingReason;
}
/**
......
......@@ -240,4 +240,10 @@ public class OrderInfoEntity {
*/
@Column(name = "is_cutoff")
private Integer isCutoff = 0;
/**
* 改约原因
*/
@Column(name = "rescheduling_reason")
private String reschedulingReason;
}
......@@ -98,7 +98,7 @@ public class BeanUserDetail {
/**
* 常用出发地址,常驻的工作地址
*/
private String address;
private Address address;
/**
* 等级=大修、零售、项目、鉴定、寄修
*/
......
......@@ -18,14 +18,21 @@ package com.dituhui.pea.order.service;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.dto.OrderCreateReqDTO;
import com.dituhui.pea.order.dto.param.OrderDTO;
public interface OrderCreateService {
Result<?> initParameter();
Result<?> initParameter();
Result<?> createOrder(OrderDTO.OrderCreateRequest orderCreateReqDTO)
throws BusinessException;
Result<?> createOrder(OrderDTO.OrderCreateRequest orderCreateReqDTO)
throws BusinessException;
/**
* 预约单服务进度查询
*
* @param orderId 工单号码
* @return 工单进度信息
* @apiNote 查询预约单状态,返回指定技术员(主,副)信息、推荐上门时间。如果查询为服务当日,增加对应技术员准实时位置,距离公里数,预计到达时间等
*/
OrderDTO.StageResult orderStage(String orderId);
}
......@@ -234,49 +234,50 @@ public class BeanRemoteServiceImpl {
}
Department data = departmentBeanR.getData();
//处理大区,分部数据
if (StringUtils.isNotBlank(data.getDeptLevel())) {
if (data.getDeptLevel().equals(BeanOrgLevelEnum.REGION.getCode())) {
OrgClusterEntity clusterEntity = orgClusterDao.getByClusterId(data.getId());
if (ObjUtil.isNull(clusterEntity)) {
clusterEntity = new OrgClusterEntity();
}
clusterEntity.setName(StringUtils.isNotBlank(data.getTagNameCn()) ? data.getTagNameCn() : data.getTagName());
clusterEntity.setClusterId(data.getId());
clusterEntity.setAbbreviation(data.getAbbreviation());
clusterEntity.setStatus(data.getEnable());
clusterEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "{}" : JSONObject.toJSONString(data.getManageCityList()));
clusterEntity.setMemo(data.getDesc());
clusterEntity.setCode(data.getCode());
clusterEntity.setPhone(data.getPhone());
clusterEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled());
clusterEntity.setReserveTimeMax(data.getPartReserveTimeMax());
clusterEntity.setBsDeptId(data.getBsDeptId());
orgClusterDao.save(clusterEntity);
} else if (data.getDeptLevel().equals(BeanOrgLevelEnum.BRANCH.getCode())) {
OrgBranchEntity branchEntity = orgBranchDao.getByBranchId(data.getId());
if (ObjUtil.isNull(branchEntity)) {
branchEntity = new OrgBranchEntity();
}
// branchEntity.setBranchName(data.getTagName());
branchEntity.setBranchName(StringUtils.isNotBlank(data.getTagNameCn()) ? data.getTagNameCn() : data.getTagName());
branchEntity.setBranchId(data.getId());
branchEntity.setAbbreviation(data.getAbbreviation());
branchEntity.setStatus(data.getEnable());
branchEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "{}" : JSONObject.toJSONString(data.getManageCityList()));
branchEntity.setMemo(data.getDesc());
branchEntity.setCode(data.getCode());
branchEntity.setPhone(data.getPhone());
branchEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled());
branchEntity.setReserveTimeMax(data.getPartReserveTimeMax());
branchEntity.setClusterId(data.getParentId());
branchEntity.setBsDeptId(data.getBsDeptId());
orgBranchDao.save(branchEntity);
branchMap.put(data.getBsDeptId(), branchEntity);
if (StringUtils.isBlank(data.getDeptLevel())) {
return Result.failed("组织级别不能为空");
}
if (data.getDeptLevel().equals(BeanOrgLevelEnum.REGION.getCode())) {
OrgClusterEntity clusterEntity = orgClusterDao.getByClusterId(data.getId());
if (ObjUtil.isNull(clusterEntity)) {
clusterEntity = new OrgClusterEntity();
}
clusterEntity.setName(StringUtils.isNotBlank(data.getTagNameCn()) ? data.getTagNameCn() : data.getTagName());
clusterEntity.setClusterId(data.getId());
clusterEntity.setAbbreviation(data.getAbbreviation());
clusterEntity.setStatus(data.getEnable());
clusterEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "{}" : JSONObject.toJSONString(data.getManageCityList()));
clusterEntity.setMemo(data.getDesc());
clusterEntity.setCode(data.getCode());
clusterEntity.setPhone(data.getPhone());
clusterEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled());
clusterEntity.setReserveTimeMax(data.getPartReserveTimeMax());
clusterEntity.setBsDeptId(data.getBsDeptId());
orgClusterDao.save(clusterEntity);
}
if (data.getDeptLevel().equals(BeanOrgLevelEnum.BRANCH.getCode())) {
OrgBranchEntity branchEntity = orgBranchDao.getByBranchId(data.getId());
if (ObjUtil.isNull(branchEntity)) {
branchEntity = new OrgBranchEntity();
}
// branchEntity.setBranchName(data.getTagName());
branchEntity.setBranchName(StringUtils.isNotBlank(data.getTagNameCn()) ? data.getTagNameCn() : data.getTagName());
branchEntity.setBranchId(data.getId());
branchEntity.setAbbreviation(data.getAbbreviation());
branchEntity.setStatus(data.getEnable());
branchEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "{}" : JSONObject.toJSONString(data.getManageCityList()));
branchEntity.setMemo(data.getDesc());
branchEntity.setCode(data.getCode());
branchEntity.setPhone(data.getPhone());
branchEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled());
branchEntity.setReserveTimeMax(data.getPartReserveTimeMax());
branchEntity.setClusterId(data.getParentId());
branchEntity.setBsDeptId(data.getBsDeptId());
orgBranchDao.save(branchEntity);
branchMap.put(data.getBsDeptId(), branchEntity);
}
//处理分站外围数据
if (StringUtils.isNotBlank(data.getDeptType()) && (data.getDeptType().equals(BeanOrgLevelEnum.STATION.getCode())
|| data.getDeptType().equals(BeanOrgLevelEnum.PERIPHERY.getCode()))) {
if ((data.getDeptLevel().equalsIgnoreCase(BeanOrgLevelEnum.STATION.getCode()))) {
//处理分站外围数据
OrgGroupEntity groupEntity = orgGroupDao.getByGroupId(data.getId());
if (ObjUtil.isNull(groupEntity)) {
groupEntity = new OrgGroupEntity();
......@@ -371,7 +372,7 @@ public class BeanRemoteServiceImpl {
//处理分站外围
groupEntity.setKind(CollectionUtils.isEmpty(data.getType()) ? 4 : BeanPointTypeEnum.getTypeByClazz(data.getType().get(0)));
groupEntity.setCategory(2);
groupEntity.setAddress(data.getBusinessAddress().getAddress());
groupEntity.setAddress(data.getBusinessAddress().getAll());
groupEntity.setX(data.getBusinessAddress().getLongitude());
groupEntity.setY(data.getBusinessAddress().getLatitude());
orgGroupDao.save(groupEntity);
......
......@@ -596,7 +596,7 @@ public class DispatchServiceImpl implements DispatchService {
//过滤
List<OrderInfoEntity> orders = records.stream()
.filter(r -> r.getOrderStatus().equals("NORMAL"))
.filter(r -> !r.getOrderStatus().equals(OrderStatusEnum.CANCELED))
.collect(Collectors.toList());
return orders.stream().collect(Collectors.groupingBy(OrderInfoEntity::getEngineerCode));
......
......@@ -85,6 +85,7 @@ public class CommonUtil {
/**
* 判断是否cutoff
* 今日单或今日cutoff之后的次日单
*
* @return
*/
......@@ -96,7 +97,7 @@ public class CommonUtil {
return 0;
}
LocalDateTime workOff = LocalDate.now().atTime(Integer.parseInt(strOff.split(":")[0]), Integer.parseInt(strOff.split(":")[1]), 0);
if (localTime.isAfter(workOff)) {
if (LocalDateTime.now().isAfter(workOff) && DateUtil.judgeTimeIsisTomorrow(localTime)) {
return 1;
}
return 0;
......@@ -111,4 +112,8 @@ public class CommonUtil {
}
}
public static void main(String[] args) {
isCutoff(LocalDateTime.now(), "18:00");
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!