Commit ecbf6aa3 by huangjinxin

fix:调用bean改约原因树优化

1 parent 2b450cc7
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("其它原因")));
}
}
......@@ -498,9 +498,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,6 +511,7 @@ 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()))) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!