Commit bb1a8006 by chamberone

feat: 算法支持已排除工程师

1 parent ab627f1b
...@@ -26,7 +26,7 @@ public enum ConstraintNameEnum { ...@@ -26,7 +26,7 @@ public enum ConstraintNameEnum {
*/ */
technicianCapacityMatch, technicianCapacityMatch,
/** /**
* 已分配匹配 * 已分配和已排除技术员匹配
*/ */
dispatchedMatch, dispatchedMatch,
......
...@@ -93,10 +93,14 @@ public class DispatchConstraintProvider implements ConstraintProvider { ...@@ -93,10 +93,14 @@ public class DispatchConstraintProvider implements ConstraintProvider {
} }
protected Constraint dispatchedMatch(ConstraintFactory factory) { protected Constraint dispatchedMatch(ConstraintFactory factory) {
return factory.forEach(Customer.class) return factory.forEach(Customer.class).filter(customer ->
.filter(customer -> customer.getDispatchedTechnicianCode() != null // 已分配
&& ((customer.getTechnician() == null) || (!StringUtils (customer.getDispatchedTechnicianCode() != null && ((customer.getTechnician() == null)
.equals(customer.getDispatchedTechnicianCode(), customer.getTechnician().getCode())))) || (!StringUtils.equals(customer.getDispatchedTechnicianCode(), customer.getTechnician().getCode()))))
||
// 已排除
(customer.getExclusiveTechnicianCode() != null && ((customer.getTechnician() == null) || (StringUtils
.equals(customer.getExclusiveTechnicianCode(), customer.getTechnician().getCode())))))
.penalizeLong(HardSoftLongScore.ONE_HARD, customer -> 50) .penalizeLong(HardSoftLongScore.ONE_HARD, customer -> 50)
.asConstraint(ConstraintNameEnum.dispatchedMatch.name()); .asConstraint(ConstraintNameEnum.dispatchedMatch.name());
} }
......
...@@ -21,8 +21,12 @@ public class Customer { ...@@ -21,8 +21,12 @@ public class Customer {
private long id; private long id;
private String code; private String code;
// 已分配 // 已分配
private String dispatchedTechnicianCode; private String dispatchedTechnicianCode;
// 已排除
private String exclusiveTechnicianCode;
// orderid(code)+dt 确定唯一一条工单 // orderid(code)+dt 确定唯一一条工单
private String dt; private String dt;
@JsonIgnore @JsonIgnore
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!