|
@@ -15,19 +15,25 @@ import org.springblade.manager.dto.FormElementDTO2;
|
|
|
import org.springblade.manager.dto.WbsFormElementDTO;
|
|
|
import org.springblade.manager.dto.WbsFormElementDTO2;
|
|
|
import org.springblade.manager.entity.WbsFormElement;
|
|
|
+import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
import org.springblade.manager.excel.*;
|
|
|
import org.springblade.manager.vo.WbsFormElementVO;
|
|
|
import org.springblade.manager.vo.WbsFormElementVO2;
|
|
|
import org.springblade.manager.vo.WbsNodeTableVO;
|
|
|
+import org.springblade.manager.vo.WbsTreePrivateTableVO;
|
|
|
import org.springblade.manager.wrapper.WbsFormElementWrapper;
|
|
|
+import org.springblade.system.entity.Dict;
|
|
|
+import org.springblade.system.feign.IDictClient;
|
|
|
+import org.springblade.system.feign.ISysClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springblade.manager.service.IWbsFormElementService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
@@ -36,6 +42,7 @@ import java.util.List;
|
|
|
public class WbsFormElementController extends BladeController {
|
|
|
|
|
|
private final IWbsFormElementService wbsFormElementService;
|
|
|
+ private final IDictClient dictClient;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
@@ -251,4 +258,67 @@ public class WbsFormElementController extends BladeController {
|
|
|
return R.fail(200, "");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 元素识别关联公共WBS模板-查询节点下已关联的所有表单并按照所属方分组
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 15)
|
|
|
+ @ApiOperation(value = "元素识别关联公共WBS模板-查询节点下已关联的所有表单并按照所属方分组", notes = "传入节点id、清表id")
|
|
|
+ @RequestMapping(value = "/get-group-node-tables", method = RequestMethod.GET)
|
|
|
+ public R<List<WbsTreePrivateTableVO>> searchNodeTablesGroup(String nodeId, String excelTabId) {
|
|
|
+ List<WbsNodeTableVO> list = wbsFormElementService.searchNodeTables(nodeId, excelTabId);
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ return R.fail(200, "操作失败");
|
|
|
+ }
|
|
|
+ R<List<Dict>> dictResult = dictClient.getList("owner_type");
|
|
|
+ if (!dictResult.isSuccess() || dictResult.getData() == null) {
|
|
|
+ return R.fail(200, "网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ Map<String, Dict> map = dictResult.getData().stream().collect(Collectors.toMap(Dict::getDictKey, Function.identity()));
|
|
|
+ Map<String, List<WbsNodeTableVO>> groupMap = list.stream().peek(item -> {
|
|
|
+ if (item.getInitTableName() != null && !item.getInitTableName().contains("m_")) {
|
|
|
+ item.setIsLinkTable(2);
|
|
|
+ }
|
|
|
+ }).collect(Collectors.groupingBy(item -> {
|
|
|
+ Dict dict = map.get(item.getTableOwner());
|
|
|
+ if (dict == null || dict.getDictValue() == null || !dict.getDictValue().contains("|")) {
|
|
|
+ return "其他";
|
|
|
+ }
|
|
|
+ return dict.getDictValue().split("\\|")[0].trim() + "___" + (dict.getSort() == null ? 999 : dict.getSort());
|
|
|
+ }));
|
|
|
+ Map<String, WbsTreePrivateTableVO> resultMap = new HashMap<>();
|
|
|
+ groupMap.forEach((key, value) -> {
|
|
|
+ String[] split = key.split("___");
|
|
|
+ WbsTreePrivateTableVO vo = resultMap.get(split[0]);
|
|
|
+ if (vo == null) {
|
|
|
+ vo = new WbsTreePrivateTableVO();
|
|
|
+ vo.setTitle(split[0]);
|
|
|
+ vo.setList(value);
|
|
|
+ if (key.contains("___")) {
|
|
|
+ vo.setSort(Integer.parseInt(split[1]));
|
|
|
+ } else {
|
|
|
+ vo.setSort(9999);
|
|
|
+ }
|
|
|
+ resultMap.put(split[0], vo);
|
|
|
+ } else {
|
|
|
+ List<WbsNodeTableVO> list1 = vo.getList();
|
|
|
+ if (list1 == null) {
|
|
|
+ vo.setList(value);
|
|
|
+ } else {
|
|
|
+ list1.addAll(value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return R.data(resultMap.values().stream().sorted(Comparator.comparingInt(WbsTreePrivateTableVO::getSort)).collect(Collectors.toList()), "查询成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元素识别关联公共WBS模板-查询节点下是否存在当前元素表
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 16)
|
|
|
+ @ApiOperation(value = "元素识别关联公共WBS模板-查询节点下是否存在当前元素表", notes = "传入节点id、表单名称")
|
|
|
+ @RequestMapping(value = "/checkTableExist", method = RequestMethod.GET)
|
|
|
+ public R<Object> checkTableExist(String nodeId, String tableName) {
|
|
|
+ return R.data(wbsFormElementService.checkTableExist(nodeId, tableName), "查询成功");
|
|
|
+ }
|
|
|
+
|
|
|
}
|