Commit 3d20e8d67ca7f548d21952911ab50c8986aa1906

Authored by 徐烜
1 parent 639ba4ae

update

src/main/java/com/bsth/controller/schedule/ScheduleRule1FlatController.java
... ... @@ -55,11 +55,14 @@ public class ScheduleRule1FlatController extends BaseController<ScheduleRule1Fla
55 55 for (int i = 0; i < lpNames.length; i++) {
56 56 param1.put("lpName_eq", lpNames[i]);
57 57 Iterable<GuideboardInfo> guideboardInfos = guideboardInfoService.list(param1);
  58 + if (!guideboardInfos.iterator().hasNext()) {
  59 + throw new RuntimeException("路牌:" + lpNames[i] + "没有找到!");
  60 + }
58 61 lpIds[i] = guideboardInfos.iterator().next().getId().toString();
59 62 }
60 63 t.setLpIds(StringUtils.join(lpIds, ","));
61 64  
62   - // 2、查找人员配置id
  65 + // 2、查找人员配置id(这里要考虑分班的情况,先用-隔开,在用,隔开)
63 66 Map<String, Object> param2 = new HashMap<>();
64 67 param2.put("xl.id_eq", t.getXl().getId());
65 68 param2.put("dbbm_eq", null);
... ... @@ -67,9 +70,34 @@ public class ScheduleRule1FlatController extends BaseController&lt;ScheduleRule1Fla
67 70 String[] ryDbbms = t.getRyDbbms().split(",");
68 71 String[] ryIds = new String[ryDbbms.length];
69 72 for (int j = 0; j < ryDbbms.length; j++) {
70   - param2.put("dbbm_eq", ryDbbms[j]);
71   - Iterable<EmployeeConfigInfo> employeeConfigInfos = employeeConfigInfoService.list(param2);
72   - ryIds[j] = employeeConfigInfos.iterator().next().getId().toString();
  73 + if (ryDbbms[j].indexOf("-") == -1) {
  74 + param2.put("dbbm_eq", ryDbbms[j]);
  75 + Iterable<EmployeeConfigInfo> employeeConfigInfos = employeeConfigInfoService.list(param2);
  76 + if (!employeeConfigInfos.iterator().hasNext()) {
  77 + throw new RuntimeException("搭班编码::" + ryDbbms[j] + "没有找到!");
  78 + }
  79 + ryIds[j] = employeeConfigInfos.iterator().next().getId().toString();
  80 + } else {
  81 + String[] fbRyDbbms = ryDbbms[j].split("-");
  82 + if (fbRyDbbms.length != 2) {
  83 + throw new RuntimeException("搭班编码:" + ryDbbms[j] + "错误!");
  84 + }
  85 + String[] fbRyIds = new String[2];
  86 + param2.put("dbbm_eq", fbRyDbbms[0]);
  87 + Iterable<EmployeeConfigInfo> employeeConfigInfos = employeeConfigInfoService.list(param2);
  88 + if (!employeeConfigInfos.iterator().hasNext()) {
  89 + throw new RuntimeException("搭班编码::" + fbRyDbbms[0] + "没有找到!");
  90 + }
  91 + fbRyIds[0] = employeeConfigInfos.iterator().next().getId().toString();
  92 + param2.put("dbbm_eq", fbRyDbbms[1]);
  93 + employeeConfigInfos = employeeConfigInfoService.list(param2);
  94 + if (!employeeConfigInfos.iterator().hasNext()) {
  95 + throw new RuntimeException("搭班编码::" + fbRyDbbms[1] + "没有找到!");
  96 + }
  97 + fbRyIds[1] = employeeConfigInfos.iterator().next().getId().toString();
  98 + ryIds[j] = StringUtils.join(fbRyIds, "-");
  99 + }
  100 +
73 101 }
74 102 t.setRyConfigIds(StringUtils.join(ryIds, ","));
75 103  
... ...
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java
... ... @@ -61,10 +61,10 @@ public class ScheduleRule1Flat {
61 61 /** 起始路牌(从0开始) */
62 62 @NotNull
63 63 private Integer lpStart;
64   - /** 人员搭班编码s(用逗号隔开) */
  64 + /** 人员搭班编码s(用逗号隔开,如果分班,就先-隔开再逗号隔开) */
65 65 @NotNull
66 66 private String ryDbbms;
67   - /** 对应的人员配置ids(用逗号隔开) */
  67 + /** 对应的人员配置ids(用逗号隔开,如果分班,就先-隔开再逗号隔开) */
68 68 @NotNull
69 69 private String ryConfigIds;
70 70 /** 起始人员(从0开始) */
... ...