|
@@ -393,29 +393,64 @@ public class WbsTreePrivateController extends BladeController {
|
|
|
@GetMapping("/get-group-node-tables")
|
|
|
@ApiOperationSupport(order = 3)
|
|
|
@ApiOperation(value = "查询当前节点下所有元素表并分类", notes = "传入父节点id、wbsId、projectId")
|
|
|
- public R<Map<String, List<WbsNodeTableVO>>> findAndGroupNodeTableByCondition(@RequestParam("parentId") String parentId,
|
|
|
+ public R<List<WbsTreePrivateTableVO>> findAndGroupNodeTableByCondition(@RequestParam("parentId") String parentId,
|
|
|
@RequestParam("wbsId") String wbsId,
|
|
|
@RequestParam("projectId") String projectId) {
|
|
|
R<List<WbsNodeTableVO>> r = findNodeTableByCondition(parentId, wbsId, projectId);
|
|
|
List<WbsNodeTableVO> data = r.getData();
|
|
|
+ List<WbsTreePrivateTableVO> list = new ArrayList<>();
|
|
|
if (data != null && !data.isEmpty()) {
|
|
|
- Map<String, List<WbsNodeTableVO>> groupMap = data.stream().collect(Collectors.groupingBy(vo -> {
|
|
|
- String tableOwner = vo.getTableOwner();
|
|
|
- if (StringUtil.isNumeric(tableOwner)) {
|
|
|
- int i = Integer.parseInt(tableOwner);
|
|
|
- if (i > 0 && i <= 3) {
|
|
|
- return "施工方";
|
|
|
- } else if (i > 3 && i <= 6) {
|
|
|
- return "监理方";
|
|
|
+ Integer wbsType = null;
|
|
|
+ if (StringUtil.isNumeric(wbsId)) {
|
|
|
+ List<WbsInfo> query = jdbcTemplate.query("select id, wbs_type from m_wbs_info where is_deleted = 0 and id = " + Long.parseLong(wbsId), new BeanPropertyRowMapper<>(WbsInfo.class));
|
|
|
+ if (!query.isEmpty()) {
|
|
|
+ wbsType = query.get(0).getWbsType();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<Integer, List<WbsNodeTableVO>> groupMap;
|
|
|
+ if (wbsType != null && wbsType == 1) {
|
|
|
+ groupMap = data.stream().collect(Collectors.groupingBy(vo -> {
|
|
|
+ String tableOwner = vo.getTableOwner();
|
|
|
+ if (StringUtil.isNumeric(tableOwner)) {
|
|
|
+ int i = Integer.parseInt(tableOwner);
|
|
|
+ if (i > 0 && i <= 3) {
|
|
|
+ return 1;
|
|
|
+ } else if (i > 3 && i <= 6) {
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 3;
|
|
|
+ }));
|
|
|
+ } else if (wbsType != null && wbsType == 2) {
|
|
|
+ groupMap = data.stream().collect(Collectors.groupingBy(vo -> {
|
|
|
+ String tableType = vo.getTableType();
|
|
|
+ if (StringUtil.isNumeric(tableType)) {
|
|
|
+ int i = Integer.parseInt(tableType);
|
|
|
+ if (i == 1 ) {
|
|
|
+ return 2;
|
|
|
+ } else if (i == 2 ) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
}
|
|
|
+ return 3;
|
|
|
+ }));
|
|
|
+ } else {
|
|
|
+ list.add(new WbsTreePrivateTableVO("", data));
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+ String[][] titles = {{"施工方", "监理方", "其他"}, {"报告表", "记录表", "其他"}};
|
|
|
+ for (int i = 1; i <= 3; i++) {
|
|
|
+ List<WbsNodeTableVO> wbsNodeTableVOS = groupMap.get(i);
|
|
|
+ if (wbsNodeTableVOS != null && !wbsNodeTableVOS.isEmpty()) {
|
|
|
+ list.add(new WbsTreePrivateTableVO(titles[wbsType - 1][i - 1], wbsNodeTableVOS));
|
|
|
}
|
|
|
- return "其他";
|
|
|
- }));
|
|
|
- return R.data(groupMap);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
}
|
|
|
return R.fail(200, "未查询到数据");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@GetMapping("/remove-table")
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "删除节点下的元素表", notes = "传入表单id、wbsId、projectId")
|