Commit 9db8615e by 王力

Merge branch 'dev_engineer_recommand0714' into 'develop'

Dev engineer recommand0714

See merge request !240
2 parents e862680b 1cfbc28d
...@@ -47,14 +47,16 @@ public class OrderAssignCheck { ...@@ -47,14 +47,16 @@ public class OrderAssignCheck {
private int distanceAddition; private int distanceAddition;
private LocalDateTime start; private LocalDateTime start;
private LocalDateTime end; private LocalDateTime end;
private int index;
public Result(boolean canAssign, String message, int minuteAddition, int distanceAddition, LocalDateTime start, LocalDateTime end){ public Result(boolean canAssign, String message, int minuteAddition, int distanceAddition, LocalDateTime start, LocalDateTime end, int index){
this.canAssign = canAssign; this.canAssign = canAssign;
this.message = message; this.message = message;
this.minuteAddition = minuteAddition; this.minuteAddition = minuteAddition;
this.distanceAddition = distanceAddition; this.distanceAddition = distanceAddition;
this.start = start; this.start = start;
this.end = end; this.end = end;
this.index = index;
} }
} }
...@@ -83,7 +85,7 @@ public class OrderAssignCheck { ...@@ -83,7 +85,7 @@ public class OrderAssignCheck {
int index = SegmentInsertion.insertSegment(takeTime, start, end, segments); int index = SegmentInsertion.insertSegment(takeTime, start, end, segments);
if (index == -1) { if (index == -1) {
log.info("没有可连续插入的空间"); log.info("没有可连续插入的空间");
return new Result(false, "没有连续可插入空间(没计算时间)", 0, 0, null, null); return new Result(false, "没有连续可插入空间(没计算时间)", 0, 0, null, null, index);
} }
log.info("插入位置为第{}单, 已分配单数(不包含本单):{}", index, orderSegments.size()); log.info("插入位置为第{}单, 已分配单数(不包含本单):{}", index, orderSegments.size());
...@@ -105,7 +107,7 @@ public class OrderAssignCheck { ...@@ -105,7 +107,7 @@ public class OrderAssignCheck {
LocalDateTime startDateTime = this.point2LocalDateTime(startInsert, order.getDt()); LocalDateTime startDateTime = this.point2LocalDateTime(startInsert, order.getDt());
LocalDateTime endDateTime = this.point2LocalDateTime(endInsert, order.getDt()); LocalDateTime endDateTime = this.point2LocalDateTime(endInsert, order.getDt());
return new Result(true, "success", 0, 0, startDateTime, endDateTime); return new Result(true, "success", 0, 0, startDateTime, endDateTime, index);
} }
else if(index == 0 && !orderSegments.isEmpty()) { else if(index == 0 && !orderSegments.isEmpty()) {
// 第一订单为出发地, 且有其他订单 // 第一订单为出发地, 且有其他订单
...@@ -115,7 +117,7 @@ public class OrderAssignCheck { ...@@ -115,7 +117,7 @@ public class OrderAssignCheck {
OrderSegment post = orderSegments.get(0); OrderSegment post = orderSegments.get(0);
OrderSegment pre = new OrderSegment(480, 480, preX, preY); OrderSegment pre = new OrderSegment(480, 480, preX, preY);
return this.getResult(curX, curY, pre, post, takeTime, order.getDt()); return this.getResult(curX, curY, pre, post, takeTime, order.getDt(), index);
} }
else if(index == orderSegments.size()) { else if(index == orderSegments.size()) {
// 最后一个订单出发 // 最后一个订单出发
...@@ -128,12 +130,12 @@ public class OrderAssignCheck { ...@@ -128,12 +130,12 @@ public class OrderAssignCheck {
LocalDateTime startDateTime = this.point2LocalDateTime(startInsert, order.getDt()); LocalDateTime startDateTime = this.point2LocalDateTime(startInsert, order.getDt());
LocalDateTime endDateTime = this.point2LocalDateTime(endInsert, order.getDt()); LocalDateTime endDateTime = this.point2LocalDateTime(endInsert, order.getDt());
return new Result(true, "success", 0, 0, startDateTime, endDateTime); return new Result(true, "success", 0, 0, startDateTime, endDateTime, index);
} else { } else {
OrderSegment pre = orderSegments.get(index-1); OrderSegment pre = orderSegments.get(index-1);
OrderSegment post = orderSegments.get(index); OrderSegment post = orderSegments.get(index);
return this.getResult(curX, curY, pre, post, takeTime, order.getDt()); return this.getResult(curX, curY, pre, post, takeTime, order.getDt(), index);
} }
} }
...@@ -181,7 +183,7 @@ public class OrderAssignCheck { ...@@ -181,7 +183,7 @@ public class OrderAssignCheck {
return segments; return segments;
} }
private Result getResult(double curX, double curY, OrderSegment pre, OrderSegment post, int takeTime, LocalDate dt) { private Result getResult(double curX, double curY, OrderSegment pre, OrderSegment post, int takeTime, LocalDate dt, int index) {
Pair preCurPair = this.getDistanceAndDuration(pre.getX(), pre.getY(), curX, curY); Pair preCurPair = this.getDistanceAndDuration(pre.getX(), pre.getY(), curX, curY);
Pair postCurPair = this.getDistanceAndDuration(post.getX(), post.getY(), curX, curY); Pair postCurPair = this.getDistanceAndDuration(post.getX(), post.getY(), curX, curY);
Pair prePostPair = this.getDistanceAndDuration(post.getX(), post.getY(), pre.getX(), pre.getY()); Pair prePostPair = this.getDistanceAndDuration(post.getX(), post.getY(), pre.getX(), pre.getY());
...@@ -190,7 +192,7 @@ public class OrderAssignCheck { ...@@ -190,7 +192,7 @@ public class OrderAssignCheck {
int distance = post.getStart() - postCurPair.getDuration() - (pre.getEnd() + preCurPair.getDuration()); int distance = post.getStart() - postCurPair.getDuration() - (pre.getEnd() + preCurPair.getDuration());
if(distance < takeTime) { if(distance < takeTime) {
// 不支持插入 // 不支持插入
return new Result(false, "增加时间路程后,不支持插入", 0, 0, null, null); return new Result(false, "增加时间路程后,不支持插入", 0, 0, null, null, index);
} }
// 插入点(时间点) // 插入点(时间点)
int startInsert = pre.getEnd() + preCurPair.getDuration(); int startInsert = pre.getEnd() + preCurPair.getDuration();
...@@ -200,7 +202,7 @@ public class OrderAssignCheck { ...@@ -200,7 +202,7 @@ public class OrderAssignCheck {
int minuteAddition = preCurPair.getDuration() + postCurPair.getDuration() - prePostPair.getDuration(); int minuteAddition = preCurPair.getDuration() + postCurPair.getDuration() - prePostPair.getDuration();
int distanceAddition = preCurPair.getDistance() + postCurPair.getDistance() - prePostPair.getDistance(); int distanceAddition = preCurPair.getDistance() + postCurPair.getDistance() - prePostPair.getDistance();
return new Result(true, "success", minuteAddition, distanceAddition, startDateTime, endDateTime); return new Result(true, "success", minuteAddition, distanceAddition, startDateTime, endDateTime, index);
} }
private double[] getEngineerDepartureLocation(String engineerCode){ private double[] getEngineerDepartureLocation(String engineerCode){
......
...@@ -23,4 +23,8 @@ public interface EngineerInfoMPDao extends BaseMapper<EngineerInfo> { ...@@ -23,4 +23,8 @@ public interface EngineerInfoMPDao extends BaseMapper<EngineerInfo> {
@Select("select * from engineer_info where group_id = #{groupId}") @Select("select * from engineer_info where group_id = #{groupId}")
List<EngineerInfo> selectByGroupId(String groupId); List<EngineerInfo> selectByGroupId(String groupId);
@Select("<script> select * from engineer_info where groupId in " +
"<foreach item='groupId' collection='groupIds' open='(' separator=',' close=')'>#{groupId}</foreach></script>")
List<EngineerInfo> selectByGroupIds(@Param("groupIds") List<String> groupIds);
} }
\ No newline at end of file
...@@ -12,4 +12,7 @@ import java.util.List; ...@@ -12,4 +12,7 @@ import java.util.List;
public interface EngineerSkillGroupMPDao extends BaseMapper<EngineerSkillGroup> { public interface EngineerSkillGroupMPDao extends BaseMapper<EngineerSkillGroup> {
@Select("select * from engineer_skill_group where engineer_code = #{engineerCode}") @Select("select * from engineer_skill_group where engineer_code = #{engineerCode}")
List<EngineerSkillGroup> selectByEngineerCode(String engineerCode); List<EngineerSkillGroup> selectByEngineerCode(String engineerCode);
@Select("select * from engineer_skill_group where skill_group_code = #{skillGroupCode}")
List<EngineerSkillGroup> selectBySkillGroupCode(String skillGroupCode);
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!