Commit aae7ca0e by 刘鑫

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

2 parents 8ddbdcbe a83361a3
......@@ -138,7 +138,9 @@ public enum StatusCodeEnum {
ORDER_EXISTS("026", "订单已存在", false),
ORDER_SKILL_NOT_EXISTS("027", "订单所需技能不存在,请核对!", false);
ORDER_SKILL_NOT_EXISTS("027", "订单所需技能不存在,请核对!", false),
ORDER_RESCHEDULE_BEFORE_TIME("028", "订单不能改约到当前时间以前!", false);
/**
* 状态码
......
......@@ -4,94 +4,101 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class OrderServiceDetailResp {
private String orderId;
private String appointmentStatus;
private String status;
private String statusDesc;
private String risk;
private String riskDesc;
private String location;
private String orderStatus;
private String serviceStatus;
private OrderDetail reschedulingParams;
private List<KV> items;
private String orderId;
private String appointmentStatus;
private String status;
private String statusDesc;
private String risk;
private String riskDesc;
private String location;
private String orderStatus;
private String serviceStatus;
private OrderDetail reschedulingParams;
private List<KV> items;
/**
* 是否重物搬运(双人上门) 0:否 1:是 默认0
*/
private Integer isMultiple;
/**
* 是否重物搬运(双人上门) 0:否 1:是 默认0
*/
private Integer isMultiple;
/**
* 是否指定某个工程师/是否排除某个工程师 0:否 1:指定 2:排除 默认0
*/
private Integer isAppointEngineer;
/**
* 是否指定某个工程师/是否排除某个工程师 0:否 1:指定 2:排除 默认0
*/
private Integer isAppointEngineer;
/**
* 指定某个工程师/排除某个工程师 codes 多个,分割
*/
private String appointEngineerCodes;
/**
* 指定某个工程师/排除某个工程师 codes 多个,分割
*/
// private String appointEngineerCodes;
/**
* bean优先级,例如:紧急、正常
*/
private String beanPriority;
/**
* 指定某个工程师/排除某个工程师 codes 多个,分割 key code,value 名称
*/
private Map<String, String> appointEngineerCodes;
private String name;
private String phone;
/**
* bean优先级,例如:紧急、正常
*/
private String beanPriority;
private String beanBrand;
private String name;
private String brand;
private String phone;
private String type;
private String beanBrand;
private String skill;
private String brand;
private String faultDescribe;
private String type;
private String expectTimeBegin;
private String skill;
private String expectTimeDesc;
private String faultDescribe;
private String source;
private String expectTimeBegin;
private String tags;
private String expectTimeDesc;
private String createTime;
private String source;
private String applyNote;
private String tags;
/**
* 是否是特殊时间段,0否 1是 默认0
*/
private Integer isSpecialTime;
private String createTime;
private String applyNote;
/**
* 是否是cutoff,0否 1是 默认0
*/
private Integer isCutoff ;
/**
* 是否是特殊时间段,0否 1是 默认0
*/
private Integer isSpecialTime;
/**
* 一家多单id,有则多条订单关联,没有则不是一家多单
*/
private String multipleOrders;
/**
* 是否是cutoff,0否 1是 默认0
*/
private Integer isCutoff;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class OrderDetail{
private String location;
private String address;
private String brand;
private String date;
private String type;
private String skill;
}
/**
* 一家多单id,有则多条订单关联,没有则不是一家多单
*/
private String multipleOrders;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class OrderDetail {
private String location;
private String address;
private String brand;
private String date;
private String type;
private String skill;
}
}
......@@ -136,7 +136,7 @@ public class OrderDTO {
/**
* 是否指定某个工程师/是否排除某个工程师 0:否 1:指定 2:排除 默认0
*/
private Integer isAppointEngineer;
private Integer isAppointEngineer = 0;
/**
* 指定某个工程师/排除某个工程师 codes
......
......@@ -391,7 +391,7 @@ public class DispatchServiceImpl implements DispatchService {
item.setBeanTags(o.getBeanTags());
item.setIsCutoff(o.getIsCutoff());
item.setOrgGroupName(groupMap.get(o.getOrgGroupId()));
if (isContinue && StringUtils.isNotEmpty(o.getMultipleOrders())) {
if (isContinue && StringUtils.isNotEmpty(o.getMultipleOrders()) && !groupTagId.equals(OrderGroupEnum.five.getCode())) {
List<OrderInfoEntity> byMultipleOrders = orderInfoDao.findByMultipleOrdersAndOrderIdNot(o.getMultipleOrders(), o.getOrderId());
List<DispatchOrderListResp.Order> multipleItems = new ArrayList<>();
for (OrderInfoEntity info : byMultipleOrders) {
......@@ -402,8 +402,13 @@ public class DispatchServiceImpl implements DispatchService {
Object groupkey = null;
// 0:工单优先级,1:耗时,2:意向时间,3:分站/网点,4:技能,5:一家多单
if (groupTagId.equals(OrderGroupEnum.zero.getCode()) && StringUtils.isNotEmpty(item.getBeanPriority())) {
// 分组字段:紧急、正常
makeOrderMap(groupByMap, item, item.getBeanPriority());
// 分组字段:紧急、正常 数据库:1:紧急、0:正常
if (item.getBeanPriority().equals(OrderGroupEnum.zero.getCode())) {
groupkey = "正常";
} else {
groupkey = "紧急";
}
makeOrderMap(groupByMap, item, groupkey);
} else if (groupTagId.equals(OrderGroupEnum.one.getCode()) && null != item.getDuration()) {
// - 耗时长短-分组字段:长(60分钟及以上)、中(30-60分钟)、短(30分钟及以内);
if (item.getDuration() >= 60) {
......
......@@ -163,7 +163,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 处理指派工程师
entity.setIsAppointEngineer(req.getIsAppointEngineer());
String appointEngineerCodes = CollectionUtils.isEmpty(req.getAppointEngineerCodes()) ? "" : String.join(",", req.getAppointEngineerCodes());
String appointEngineerCodes = CollectionUtils.isEmpty(req.getAppointEngineerCodes()) ? null : String.join(",", req.getAppointEngineerCodes());
entity.setAppointEngineerCodes(appointEngineerCodes);
if (req.getIsAppointEngineer() == 1) {
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(req.getAppointEngineerCodes().get(0));
......
......@@ -188,71 +188,6 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
return this.orderReschedule(reschedule);
// orderInfo.setServiceStatus(ServiceStatusEnum.INIT.getCode());
// orderInfo.setOrderStatus(OrderStatusEnum.RESCHEDULED.getCode());
// if (StringUtils.isBlank(request.getDescription())) {
// orderInfo.setDescription(request.getDescription());
// }
// Location location = request.getHappenLocation();
// if (ObjectUtil.isNull(location)) {
// location = new Location();
// location.setLongitude(Double.valueOf(orderInfo.getX()));
// location.setLatitude(Double.valueOf(orderInfo.getY()));
// location.setAddress(orderInfo.getAddress());
// location.setAddressId(orderInfo.getAddressId());
// } else {
// orderInfo.setX(location.getLongitude().toString());
// orderInfo.setY(location.getLongitude().toString());
// orderInfo.setAddress(location.getAddress());
// orderInfo.setAddressId(location.getAddressId());
// }
// //获取省市区
// AdministrativeDistrictReq administrativeDistrictReq = new AdministrativeDistrictReq();
// administrativeDistrictReq.setPoints(location.getLongitude() + "," + location.getLatitude());
// Result<AdministrativeDistrictResp> adminDistrict = fendanService.getAdminDistrict(administrativeDistrictReq);
// if (ObjectUtil.isNotEmpty(adminDistrict) && ObjectUtil.isNotEmpty(adminDistrict.getResult())) {
// orderInfo.setProvince(adminDistrict.getResult().getSubNames().getProvince());
// orderInfo.setCity(adminDistrict.getResult().getSubNames().getCity());
// orderInfo.setCounty(adminDistrict.getResult().getSubNames().getCounty());
// }
// // 分单处理
// String peaBrand = CommonUtil.fixBrand(orderInfo.getBrand());
// OrderDTO.OrderCreateRequest req = new OrderDTO.OrderCreateRequest();
// req.setBrand(peaBrand);
// req.setProductType(orderInfo.getType());
// req.setServiceType(orderInfo.getSkill());
// req.setLocation(location);
// Result<OrgTeamInfo> fendanResult = fendanService.fendanToGroupCapacity(req, 1, DateUtil.getLocalDateByDate(request.getNewReservationTime()), null, null);
// String branchId = "";
// String clusterId = "";
// if (!fendanResult.getCode().equals(ResultEnum.SUCCESS.getCode()) || ObjectUtil.isNull(fendanResult.getResult())) {
// OrgBranchEntity branchEntity = orgBranchDao.findByCitycodeListLike("%" + adminDistrict.getResult().getSubNames().getCounty() + "%");
// clusterId = branchEntity.getClusterId();
// branchId = branchEntity.getBranchId();
// sendMsg(branchEntity, orderInfo.getOrderId(), request.getNewReservationTime());
// } else {
// OrgTeamInfo teamInfo = fendanResult.getResult();
// clusterId = teamInfo.getClusterId();
// branchId = teamInfo.getBranchId();
// orderInfo.setOrgGroupId(teamInfo.getGroupId());
// orderInfo.setOrgTeamId(teamInfo.getTeamId());
// }
// orderInfo.setOrgClusterId(clusterId);
// orderInfo.setOrgBranchId(branchId);
// orderInfo.setDt(DateUtil.getLocalDateByDate(request.getNewReservationTime()));
// //一家多单
// Result<String> deleteMultipleOrders = this.deleteMultipleOrders(orderInfo.getMultipleOrders(), orderInfo.getAddressId());
// if (!deleteMultipleOrders.getCode().equals(ResultEnum.SUCCESS.getCode())) {
// return Result.failed("改约日期失败");
// }
// Result<String> addMultipleOrders = this.addMultipleOrders(orderInfo.getDt(), location.getAddressId(), orderInfo.getOrderId());
// if (!addMultipleOrders.getCode().equals(ResultEnum.SUCCESS.getCode())) {
// return Result.failed("改约日期失败");
// }
// orderInfo.setMultipleOrders(addMultipleOrders.getResult());
// orderInfoDao.save(orderInfo);
// //记录流程
// commonService.addOrderEvent(request.getOrderId(), "", "BEAN", "BEAN", OrderStatusEnum.CANCELED.getDescription(), request.getStage(), "", LocalDateTimeUtil.of(request.getHappen()));
}
return Result.success(null);
}
......@@ -269,6 +204,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
public Result<?> orderReschedule(OrderReschedule req) throws BusinessException {
// 判断是否分配到人和是否是今天
LocalDateTime expectBegin = TimeUtils.IsoDateTime2LocalDateTime(req.getExpectBegin());
if (expectBegin.isBefore(LocalDateTime.now())) {
return Result.failed(StatusCodeEnum.ORDER_RESCHEDULE_BEFORE_TIME);
}
LocalDateTime expectEnd = TimeUtils.IsoDateTime2LocalDateTime(req.getExpectEnd());
OrderInfoEntity order = orderInfoDao.getByOrderId(req.getOrderId());
order.setDt(expectBegin.toLocalDate());
......
......@@ -8,6 +8,8 @@ import com.dituhui.pea.order.dto.*;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.OrderServiceDetail;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -70,7 +72,11 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
res.setIsMultiple(order.getIsMultiple());
res.setIsAppointEngineer(order.getIsAppointEngineer());
res.setAppointEngineerCodes(order.getAppointEngineerCodes());
if (StringUtils.isNotBlank(order.getAppointEngineerCodes())) {
String[] strings = order.getAppointEngineerCodes().split(",");
List<EngineerInfoEntity> engineerCodeIn = engineerInfoDao.findByEngineerCodeIn(Arrays.asList(strings));
res.setAppointEngineerCodes(CollectionUtils.isEmpty(engineerCodeIn) ? null : engineerCodeIn.stream().collect(Collectors.toMap(EngineerInfoEntity::getEngineerCode, EngineerInfoEntity::getName)));
}
res.setBeanPriority(order.getBeanPriority());
res.setName(order.getName());
res.setPhone(order.getPhone());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!