Commit 3d20e8d67ca7f548d21952911ab50c8986aa1906
1 parent
639ba4ae
update
Showing
2 changed files
with
34 additions
and
6 deletions
src/main/java/com/bsth/controller/schedule/ScheduleRule1FlatController.java
| @@ -55,11 +55,14 @@ public class ScheduleRule1FlatController extends BaseController<ScheduleRule1Fla | @@ -55,11 +55,14 @@ public class ScheduleRule1FlatController extends BaseController<ScheduleRule1Fla | ||
| 55 | for (int i = 0; i < lpNames.length; i++) { | 55 | for (int i = 0; i < lpNames.length; i++) { |
| 56 | param1.put("lpName_eq", lpNames[i]); | 56 | param1.put("lpName_eq", lpNames[i]); |
| 57 | Iterable<GuideboardInfo> guideboardInfos = guideboardInfoService.list(param1); | 57 | Iterable<GuideboardInfo> guideboardInfos = guideboardInfoService.list(param1); |
| 58 | + if (!guideboardInfos.iterator().hasNext()) { | ||
| 59 | + throw new RuntimeException("路牌:" + lpNames[i] + "没有找到!"); | ||
| 60 | + } | ||
| 58 | lpIds[i] = guideboardInfos.iterator().next().getId().toString(); | 61 | lpIds[i] = guideboardInfos.iterator().next().getId().toString(); |
| 59 | } | 62 | } |
| 60 | t.setLpIds(StringUtils.join(lpIds, ",")); | 63 | t.setLpIds(StringUtils.join(lpIds, ",")); |
| 61 | 64 | ||
| 62 | - // 2、查找人员配置id | 65 | + // 2、查找人员配置id(这里要考虑分班的情况,先用-隔开,在用,隔开) |
| 63 | Map<String, Object> param2 = new HashMap<>(); | 66 | Map<String, Object> param2 = new HashMap<>(); |
| 64 | param2.put("xl.id_eq", t.getXl().getId()); | 67 | param2.put("xl.id_eq", t.getXl().getId()); |
| 65 | param2.put("dbbm_eq", null); | 68 | param2.put("dbbm_eq", null); |
| @@ -67,9 +70,34 @@ public class ScheduleRule1FlatController extends BaseController<ScheduleRule1Fla | @@ -67,9 +70,34 @@ public class ScheduleRule1FlatController extends BaseController<ScheduleRule1Fla | ||
| 67 | String[] ryDbbms = t.getRyDbbms().split(","); | 70 | String[] ryDbbms = t.getRyDbbms().split(","); |
| 68 | String[] ryIds = new String[ryDbbms.length]; | 71 | String[] ryIds = new String[ryDbbms.length]; |
| 69 | for (int j = 0; j < ryDbbms.length; j++) { | 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 | t.setRyConfigIds(StringUtils.join(ryIds, ",")); | 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,10 +61,10 @@ public class ScheduleRule1Flat { | ||
| 61 | /** 起始路牌(从0开始) */ | 61 | /** 起始路牌(从0开始) */ |
| 62 | @NotNull | 62 | @NotNull |
| 63 | private Integer lpStart; | 63 | private Integer lpStart; |
| 64 | - /** 人员搭班编码s(用逗号隔开) */ | 64 | + /** 人员搭班编码s(用逗号隔开,如果分班,就先-隔开再逗号隔开) */ |
| 65 | @NotNull | 65 | @NotNull |
| 66 | private String ryDbbms; | 66 | private String ryDbbms; |
| 67 | - /** 对应的人员配置ids(用逗号隔开) */ | 67 | + /** 对应的人员配置ids(用逗号隔开,如果分班,就先-隔开再逗号隔开) */ |
| 68 | @NotNull | 68 | @NotNull |
| 69 | private String ryConfigIds; | 69 | private String ryConfigIds; |
| 70 | /** 起始人员(从0开始) */ | 70 | /** 起始人员(从0开始) */ |