Commit 2731b1e9 by Ren Ping

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

2 parents a10c0a6a 2e8adccc
package com.dituhui.pea.order.constant;
import com.alibaba.fastjson.JSONObject;
import com.dituhui.pea.order.feign.bean.Reason;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -10,6 +14,9 @@ import java.util.Map;
*/
public class OrderReschedulingReason {
/**
* 改约原因树
*/
public final static Map<String, List<String>> ReschedulingReasonMap = new HashMap<>() {
{
put("服务设备/工具相关", new ArrayList<>() {
......@@ -91,4 +98,33 @@ public class OrderReschedulingReason {
});
}
};
/**
* 获取bean改约原因树
*
* @param reason
* @return
*/
public static Reason getReason(String reason) {
Reason reasonRes = new Reason();
if (StringUtils.isBlank(reason)) {
return reasonRes;
}
for (String reasonKey : ReschedulingReasonMap.keySet()) {
if (reasonKey.equals(reason)) {
reasonRes.setOneLevel(reasonKey);
}
for (String reasonValue : ReschedulingReasonMap.get(reasonKey)) {
if (reasonValue.equals(reason)) {
reasonRes.setOneLevel(reasonKey);
reasonRes.setTwoLevel(reasonValue);
}
}
}
return reasonRes;
}
public static void main(String[] args) {
System.out.println(JSONObject.toJSONString(getReason("其它原因")));
}
}
......@@ -22,6 +22,8 @@ public enum BeanOrgLevelEnum implements IResult {
STATION("STATION", "分站"),
GROUP("GROUP", "小组"),
PERIPHERY("PERIPHERY", "外围"),
REPAIR_CENTER("REPAIR_CENTER", "寄修中心"),
......
......@@ -152,9 +152,10 @@ public class BeanRemoteServiceImpl {
* @return 是否回调成功
*/
public boolean orderCancel(OrderCancel orderCancelParam) {
log.info("-----请求参数:{}", JsonUtil.toJson(orderCancelParam));
log.info("[服务工单取消]-----请求参数:{}", JsonUtil.toJson(orderCancelParam));
long timeMillis = System.currentTimeMillis();
BeanR<?> beanR = beanRemoteService.orderTaskCancel(getAccessToken(), orderCancelParam);
log.info("[服务工单取消]【/api/openapi/task/cancel】返回值-------------------->{}", JsonUtil.toJson(beanR));
log.info("[服务工单取消]【/api/openapi/task/cancel】耗时:{},返回值-------------------->{}", System.currentTimeMillis() - timeMillis, JsonUtil.toJson(beanR));
return beanR.getSuccess();
}
......@@ -167,9 +168,10 @@ public class BeanRemoteServiceImpl {
*/
public boolean orderRescheduled(Rescheduled rescheduled) {
log.info("-----请求参数:{}", JsonUtil.toJson(rescheduled));
log.info("[服务工单改约]-----请求参数:{}", JsonUtil.toJson(rescheduled));
long timeMillis = System.currentTimeMillis();
BeanR<?> beanRq = beanRemoteService.orderRescheduled(getAccessToken(), rescheduled);
log.info("[服务工单改约]【/api/openapi/task/rescheduled 】返回值-------------------->{}", JsonUtil.toJson(beanRq));
log.info("[服务工单改约]【/api/openapi/task/rescheduled 】耗时:{}返回值-------------------->{}", System.currentTimeMillis() - timeMillis, JsonUtil.toJson(beanRq));
return beanRq.getSuccess();
}
......@@ -493,6 +495,9 @@ public class BeanRemoteServiceImpl {
if (data.getDeptType().equals(BeanOrgLevelEnum.STATION.getCode())) {
groupEntity.setKind(1);
}
if (data.getDeptType().equals(BeanOrgLevelEnum.GROUP.getCode())) {
groupEntity.setKind(3);
}
groupEntity.setCategory(1);
groupEntity.setBsDeptId(data.getBsDeptId());
orgGroupDao.save(groupEntity);
......
......@@ -340,6 +340,9 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
if (entity == null) {
return Result.failed("工作队信息不存在!");
}
if(StringUtils.isNotBlank(req.getCutoffTime())) {
entity.setCuteOff(req.getCutoffTime());
}
if (req.getWorkOff() != null) {
entity.setCuteOff(req.getWorkOff());
}
......
......@@ -273,6 +273,9 @@ public class FendanServiceImpl implements FendanService {
List<OrgTeamEntity> teamList = orgTeamDao.findByTeamIdIn(teamIdList);
Map<String, OrgTeamEntity> teamMap = teamList.stream().collect(Collectors.toMap(OrgTeamEntity::getTeamId, e -> e));
List<OrgGroupEntity> orgGroupList = orgGroupDao.findByTeamIdIn(teamIdList);
if (CollectionUtils.isEmpty(orgGroupList)) {
return Result.failed(StatusCodeEnum.FENDAN_TEAM_UNMATCHED);
}
for (OrgGroupEntity orgGroupEntity : orgGroupList) {
OrgGroupInfo orgGroup = BeanUtil.copyProperties(orgGroupEntity, OrgGroupInfo.class);
MapBlockInfoEntity allLayer = null;
......
......@@ -274,6 +274,8 @@ public class OrderAssignImpl implements OrderAssign {
if (order.getOrderStatus().equals(OrderStatusEnum.CANCELED.getCode()) || order.getServiceStatus().equals(ServiceStatusEnum.FINISHED.getCode())) {
return Result.failed(StatusCodeEnum.ORDER_FINISHED);
}
final OrderInfoEntity sourceOrder = new OrderInfoEntity();
BeanUtils.copyProperties(sourceOrder, sourceOrder);
OrgTeamEntity orgTeam = orgTeamDao.getByTeamId(order.getOrgTeamId());
// 判断cutoff
Integer cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), orgTeam.getWorkOff());
......@@ -296,7 +298,12 @@ public class OrderAssignImpl implements OrderAssign {
order.setAppointEngineerCodes(null);
}
orderInfoDao.save(order);
//回调改约
Boolean boo = orderInfoService.rescheduled(sourceOrder, order, new Date(), "", "PEA");
log.info("[orderReschedule] orderId:{}, 通知bean结果: {}", sourceOrder.getOrderId(), boo);
if (!boo) {
throw new BusinessException("服务工单变更结果通知BEAN失败");
}
commonService.addOrderEvent(orderId, "", "PEA", "PEA", OrderEventEnum.backOrderPool.getEvent(), OrderEventEnum.backOrderPool.getMsg(), "");
return Result.success(null);
}
......
......@@ -170,6 +170,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
@Override
@Transactional
public Result<?> orderStageChanged(OrderDTO.StageChangeRequest request) {
log.info("[orderStageChanged] orderId:{}, req: {}", request.getOrderId(), JSONObject.toJSONString(request));
final String orderId = request.getOrderId();
OrderInfoEntity orderInfo = orderInfoDao.getByOrderId(orderId);
//判断是否是正常流程,正常流程只需要更新状态
......@@ -219,13 +220,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
String engineerName = orderInfo.getEngineerName();
orderInfoDao.save(orderInfo);
//回调bean
OrderCancel orderCancelParam = new OrderCancel();
orderCancelParam.setRisId(orderId);
orderCancelParam.setCancelStartTime(happenDate.getTime());
Reason reason = new Reason();
reason.setOneLevel(request.getReschedulingReason());
orderCancelParam.setCancellationReason(reason);
beanRemoteService.orderCancel(orderCancelParam);
// OrderCancel orderCancelParam = new OrderCancel();
// orderCancelParam.setRisId(orderId);
// orderCancelParam.setCancelStartTime(happenDate.getTime());
// Reason reason = new Reason();
// reason.setOneLevel(request.getReschedulingReason());
// orderCancelParam.setCancellationReason(reason);
// beanRemoteService.orderCancel(orderCancelParam);
//记录流程
commonService.addOrderEvent(orderId, "", "BEAN", "BEAN", OrderEventEnum.cancel.getEvent(), String.format(OrderEventEnum.cancel.getMsg(), engineerName + "-" + (ObjectUtil.isNotNull(orgTeamEntity) ? orgTeamEntity.getTeamName() : "")), "", actualStartTime);
} else if (request.getOrderStatus().equalsIgnoreCase(OrderStatusEnum.RESCHEDULED.getCode())) {
......@@ -249,6 +250,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return this.orderReschedule(reschedule);
}
log.info("[orderStageChanged] orderId:{}, 操作成功", request.getOrderId());
return Result.success(null);
}
......@@ -485,6 +487,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 登记事件
commonService.addOrderEvent(req.getOrderId(), "", req.getOperator(), req.getOperator(), OrderEventEnum.recontracting.getEvent(), String.format(OrderEventEnum.recontracting.getMsg(), engineerName + "-" + (ObjectUtil.isNotNull(orgTeamEntity) ? orgTeamEntity.getTeamName() : ""), ObjectUtil.isNotNull(orgGroupEntity) ? orgGroupEntity.getGroupName() : "", req.getExpectBegin(), req.getReschedulingReason()), StringUtils.isNotBlank(req.getReschedulingReason()) ? "改约原因:" + req.getReschedulingReason() : "");
log.info("[orderReschedule] orderId:{}, 操作成功", req.getOrderId());
return Result.success(null);
}
......@@ -498,9 +501,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
rescheduled.setRisId(source.getOrderId());
rescheduled.setInitiatorOfRescheduling(operator);
Reason reasons = new Reason();
reasons.setOneLevel(reason);
rescheduled.setReasonForRescheduling(reasons);
rescheduled.setReasonForRescheduling(OrderReschedulingReason.getReason(reason));
rescheduled.setRescheduledDate(happened.getTime());
rescheduled.setRequireApprove(Boolean.FALSE);
......@@ -513,13 +514,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
rescheduled.setAssistantWorkNo(code.getCosmosId());
rescheduled.setAssOrgUnitId(code.getGroupId());
}
//判断是否是改派
if ((StringUtils.isNotBlank(target.getEngineerCode()) && !Objects.equals(engineerCode, source.getEngineerCode())) ||
(StringUtils.isNotBlank(target.getEngineerCodeSub()) && !Objects.equals(target.getEngineerCodeSub(), source.getEngineerCodeSub()))) {
rescheduled.setReassignment(Boolean.TRUE);
} else {
rescheduled.setReassignment(Boolean.FALSE);
}
return beanRemoteService.orderRescheduled(rescheduled);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!