|
@@ -22,6 +22,7 @@ import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
|
|
|
+import org.springblade.manager.dto.NameRuleDto;
|
|
|
import org.springblade.manager.dto.WbsTreePrivateDTO2;
|
|
|
import org.springblade.manager.dto.WbsTreePrivateDTO3;
|
|
|
import org.springblade.manager.entity.*;
|
|
@@ -829,172 +830,172 @@ public class WbsTreePrivateController extends BladeController {
|
|
|
return wbsTreePrivateService.getExcelHtmlEntrust(nodeId,contractId);
|
|
|
}
|
|
|
|
|
|
-// @GetMapping("/getNameRule")
|
|
|
-// @ApiOperationSupport(order = 33)
|
|
|
-// @ApiOperation(value = "获取题名规则",notes = "获取题名规则")
|
|
|
-// public R<List<NameRuleVo>> getNameRule(@RequestParam Long projectId){
|
|
|
-// List<WbsParamVo2> list = iWbsParamService.selectNameRule(projectId);
|
|
|
-// if(list.size()>0){
|
|
|
-// Map<Long, List<WbsParamVo2>> map = list.stream()
|
|
|
-// .collect(Collectors.groupingBy(WbsParamVo2::getNameId));
|
|
|
-// List<NameRuleVo> vos=new ArrayList<>();
|
|
|
-// for (Map.Entry<Long, List<WbsParamVo2>> entry : map.entrySet()) {
|
|
|
-// NameRuleVo vo = new NameRuleVo();
|
|
|
-// vo.setNameId(entry.getKey());
|
|
|
-// vo.setNameVaule(entry.getValue().get(0).getV());
|
|
|
-// vo.setNameRule(getNameRuleV1(entry.getValue().get(0).getV()));
|
|
|
-// vo.setType(entry.getValue().get(0).getNameType());
|
|
|
-// List<NameRuleVo1>vo1s=new ArrayList<>();
|
|
|
-// for (WbsParamVo2 param : entry.getValue()) {
|
|
|
-// vo1s.add(new NameRuleVo1(param.getNodeId(),param.getNodeName()));
|
|
|
-// }
|
|
|
-// vo.setList(vo1s);
|
|
|
-// vos.add(vo);
|
|
|
-// }
|
|
|
-// return R.data(vos);
|
|
|
-// }
|
|
|
-// return R.success("暂无题名规则");
|
|
|
-// }
|
|
|
-//
|
|
|
-// @GetMapping("/getTitleRange")
|
|
|
-// @ApiOperationSupport(order = 33)
|
|
|
-// @ApiOperation(value = "获取题名范围",notes = "获取题名范围")
|
|
|
-// public R<List<TitleRangeVo>> getTitleRange(@RequestParam String projectId){
|
|
|
-// List<WbsTreePrivate>list=wbsTreeService.getTitleRange(projectId);
|
|
|
-// List<WbsParam> list1 = iWbsParamService.getBaseMapper().selectList(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getK, "FILE_TITLE").eq(WbsParam::getProjectId, projectId));
|
|
|
-// if(list1.size()>0){
|
|
|
-// List<Long> longs = list1.stream().map(l -> l.getNodeId()).collect(Collectors.toList());
|
|
|
-// //判断是否已经被选中
|
|
|
-// for (WbsTreePrivate wbsTreePrivate : list) {
|
|
|
-// if(longs.contains(wbsTreePrivate.getId())){
|
|
|
-// wbsTreePrivate.setStatus(11);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return R.data(list.stream()
|
|
|
-// .map(wbsTreePrivate -> {
|
|
|
-// TitleRangeVo titleRangeVo = new TitleRangeVo();
|
|
|
-// titleRangeVo.setId(wbsTreePrivate.getId());
|
|
|
-// titleRangeVo.setNodeName(wbsTreePrivate.getNodeName());
|
|
|
-// titleRangeVo.setStatus(wbsTreePrivate.getStatus());
|
|
|
-// return titleRangeVo;
|
|
|
-// })
|
|
|
-// .collect(Collectors.toList()));
|
|
|
-// }
|
|
|
-//
|
|
|
-// @PostMapping("/saveOrUpdateNameRule")
|
|
|
-// @ApiOperationSupport(order = 34)
|
|
|
-// @ApiOperation(value = "新增或修改文件题名规则",notes = "新增或修改题名规则")
|
|
|
-// public R saveOrUpdateNameRule(@RequestBody List<NameRuleDto> nameRuleDtos){
|
|
|
-// if(nameRuleDtos!=null){
|
|
|
-// for (NameRuleDto dto : nameRuleDtos) {
|
|
|
-// WbsParam param = new WbsParam();
|
|
|
-// param.setName("文件题名");
|
|
|
-// param.setK("FILE_TITLE");
|
|
|
-// param.setV(sortNameRule(dto.getNameRule()));
|
|
|
-// param.setType(11);
|
|
|
-// param.setProjectId(dto.getProjectId());
|
|
|
-// param.setNameId(SnowFlakeUtil.getId());
|
|
|
-// param.setNameType(dto.getType());
|
|
|
-// //如果nameID不为空,先删除在保存
|
|
|
-// if(dto.getNameId()!=null){
|
|
|
-// iWbsParamService.getBaseMapper().delete(new QueryWrapper<WbsParam>().eq("name_id",dto.getNameId()));
|
|
|
-// }
|
|
|
-// if(dto.getType()==1){
|
|
|
-// List<WbsTreePrivate>list=wbsTreeService.getTitleRange(dto.getProjectId()+"");
|
|
|
-// if(list.size()>0){
|
|
|
-// dto.setNodeId(list.stream()
|
|
|
-// .map(item -> String.valueOf(item.getId()))
|
|
|
-// .collect(Collectors.joining(",")));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// String[] nodeIds = dto.getNodeId().split(",");
|
|
|
-// if(nodeIds.length>0){
|
|
|
-// for (String nodeId : nodeIds) {
|
|
|
-// WbsParam p=new WbsParam();
|
|
|
-// BeanUtils.copyProperties(param,p);
|
|
|
-// p.setNodeId(Long.parseLong(nodeId));
|
|
|
-// iWbsParamService.getBaseMapper().insert(p);
|
|
|
-// }
|
|
|
-// }else {
|
|
|
-// return R.fail("操作失败");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return R.success("操作成功");
|
|
|
-// }
|
|
|
-// return R.fail("操作失败");
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 删除文件题名规则
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @GetMapping("/deletedNameRule")
|
|
|
-// @ApiOperationSupport(order = 35)
|
|
|
-// @ApiOperation(value = "删除文件题名规则",notes = "删除文件题名规则")
|
|
|
-// public R deletedNameRule(@RequestParam Long nameId){
|
|
|
-// if(nameId!=null){
|
|
|
-// int result = iWbsParamService.getBaseMapper().delete(new QueryWrapper<WbsParam>().eq("name_id", nameId));
|
|
|
-// if(result>=1){
|
|
|
-// return R.success("操作成功");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return R.fail("操作失败");
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 对文件题名规则排序
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public String sortNameRule(String rule){
|
|
|
-// String[] codes = rule.split("-");
|
|
|
-// Arrays.sort(codes, Comparator.comparingInt(s -> Integer.parseInt(s.substring(1))));
|
|
|
-// return String.join("-", codes);
|
|
|
-// }
|
|
|
-// /**
|
|
|
-// * 根据文件题名规则转换成C0-C6形式
|
|
|
-// * @param string
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public String getNameRuleV(String string){
|
|
|
-// // 定义工程名称到C格式的映射
|
|
|
-// Map<String, String> mapping = new HashMap<>();
|
|
|
-// mapping.put("单位工程", "C0");
|
|
|
-// mapping.put("子单位工程", "C1");
|
|
|
-// mapping.put("分部工程", "C2");
|
|
|
-// mapping.put("子分部工程", "C3");
|
|
|
-// mapping.put("分项工程", "C4");
|
|
|
-// mapping.put("子分项工程", "C5");
|
|
|
-// mapping.put("工序", "C6");
|
|
|
-// // 将输入字符串分割成列表
|
|
|
-// List<String> list = Arrays.asList(string.split(","));
|
|
|
-// return list.stream()
|
|
|
-// .map(mapping::get)
|
|
|
-// .collect(Collectors.joining("-"));
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 根据C0-C6转换成文件题名
|
|
|
-// * @param string
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public String getNameRuleV1(String string){
|
|
|
-// // 定义工程名称到C格式的映射
|
|
|
-// Map<String, String> mapping = new HashMap<>();
|
|
|
-// mapping.put("C0", "单位工程");
|
|
|
-// mapping.put("C1", "子单位工程");
|
|
|
-// mapping.put("C2", "分部工程");
|
|
|
-// mapping.put("C3", "子分部工程");
|
|
|
-// mapping.put("C4", "分项工程");
|
|
|
-// mapping.put("C5", "子分项工程");
|
|
|
-// mapping.put("C6", "工序");
|
|
|
-// // 将输入字符串分割成列表
|
|
|
-// List<String> list = Arrays.asList(string.split("-"));
|
|
|
-// return list.stream()
|
|
|
-// .map(mapping::get)
|
|
|
-// .collect(Collectors.joining(","));
|
|
|
-// }
|
|
|
+ @GetMapping("/getNameRule")
|
|
|
+ @ApiOperationSupport(order = 33)
|
|
|
+ @ApiOperation(value = "获取题名规则",notes = "获取题名规则")
|
|
|
+ public R<List<NameRuleVo>> getNameRule(@RequestParam Long projectId){
|
|
|
+ List<WbsParamVo2> list = iWbsParamService.selectNameRule(projectId);
|
|
|
+ if(list.size()>0){
|
|
|
+ Map<Long, List<WbsParamVo2>> map = list.stream()
|
|
|
+ .collect(Collectors.groupingBy(WbsParamVo2::getNameId));
|
|
|
+ List<NameRuleVo> vos=new ArrayList<>();
|
|
|
+ for (Map.Entry<Long, List<WbsParamVo2>> entry : map.entrySet()) {
|
|
|
+ NameRuleVo vo = new NameRuleVo();
|
|
|
+ vo.setNameId(entry.getKey());
|
|
|
+ vo.setNameVaule(entry.getValue().get(0).getV());
|
|
|
+ vo.setNameRule(getNameRuleV1(entry.getValue().get(0).getV()));
|
|
|
+ vo.setType(entry.getValue().get(0).getNameType());
|
|
|
+ List<NameRuleVo1>vo1s=new ArrayList<>();
|
|
|
+ for (WbsParamVo2 param : entry.getValue()) {
|
|
|
+ vo1s.add(new NameRuleVo1(param.getNodeId(),param.getNodeName()));
|
|
|
+ }
|
|
|
+ vo.setList(vo1s);
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ return R.data(vos);
|
|
|
+ }
|
|
|
+ return R.success("暂无题名规则");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getTitleRange")
|
|
|
+ @ApiOperationSupport(order = 33)
|
|
|
+ @ApiOperation(value = "获取题名范围",notes = "获取题名范围")
|
|
|
+ public R<List<TitleRangeVo>> getTitleRange(@RequestParam String projectId){
|
|
|
+ List<WbsTreePrivate>list=wbsTreeService.getTitleRange(projectId);
|
|
|
+ List<WbsParam> list1 = iWbsParamService.getBaseMapper().selectList(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getK, "FILE_TITLE").eq(WbsParam::getProjectId, projectId));
|
|
|
+ if(list1.size()>0){
|
|
|
+ List<Long> longs = list1.stream().map(l -> l.getNodeId()).collect(Collectors.toList());
|
|
|
+ //判断是否已经被选中
|
|
|
+ for (WbsTreePrivate wbsTreePrivate : list) {
|
|
|
+ if(longs.contains(wbsTreePrivate.getId())){
|
|
|
+ wbsTreePrivate.setStatus(11);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(list.stream()
|
|
|
+ .map(wbsTreePrivate -> {
|
|
|
+ TitleRangeVo titleRangeVo = new TitleRangeVo();
|
|
|
+ titleRangeVo.setId(wbsTreePrivate.getId());
|
|
|
+ titleRangeVo.setNodeName(wbsTreePrivate.getNodeName());
|
|
|
+ titleRangeVo.setStatus(wbsTreePrivate.getStatus());
|
|
|
+ return titleRangeVo;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/saveOrUpdateNameRule")
|
|
|
+ @ApiOperationSupport(order = 34)
|
|
|
+ @ApiOperation(value = "新增或修改文件题名规则",notes = "新增或修改题名规则")
|
|
|
+ public R saveOrUpdateNameRule(@RequestBody List<NameRuleDto> nameRuleDtos){
|
|
|
+ if(nameRuleDtos!=null){
|
|
|
+ for (NameRuleDto dto : nameRuleDtos) {
|
|
|
+ WbsParam param = new WbsParam();
|
|
|
+ param.setName("文件题名");
|
|
|
+ param.setK("FILE_TITLE");
|
|
|
+ param.setV(sortNameRule(dto.getNameRule()));
|
|
|
+ param.setType(11);
|
|
|
+ param.setProjectId(dto.getProjectId());
|
|
|
+ param.setNameId(SnowFlakeUtil.getId());
|
|
|
+ param.setNameType(dto.getType());
|
|
|
+ //如果nameID不为空,先删除在保存
|
|
|
+ if(dto.getNameId()!=null){
|
|
|
+ iWbsParamService.getBaseMapper().delete(new QueryWrapper<WbsParam>().eq("name_id",dto.getNameId()));
|
|
|
+ }
|
|
|
+ if(dto.getType()==1){
|
|
|
+ List<WbsTreePrivate>list=wbsTreeService.getTitleRange(dto.getProjectId()+"");
|
|
|
+ if(list.size()>0){
|
|
|
+ dto.setNodeId(list.stream()
|
|
|
+ .map(item -> String.valueOf(item.getId()))
|
|
|
+ .collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] nodeIds = dto.getNodeId().split(",");
|
|
|
+ if(nodeIds.length>0){
|
|
|
+ for (String nodeId : nodeIds) {
|
|
|
+ WbsParam p=new WbsParam();
|
|
|
+ BeanUtils.copyProperties(param,p);
|
|
|
+ p.setNodeId(Long.parseLong(nodeId));
|
|
|
+ iWbsParamService.getBaseMapper().insert(p);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ return R.fail("操作失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+ return R.fail("操作失败");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除文件题名规则
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/deletedNameRule")
|
|
|
+ @ApiOperationSupport(order = 35)
|
|
|
+ @ApiOperation(value = "删除文件题名规则",notes = "删除文件题名规则")
|
|
|
+ public R deletedNameRule(@RequestParam Long nameId){
|
|
|
+ if(nameId!=null){
|
|
|
+ int result = iWbsParamService.getBaseMapper().delete(new QueryWrapper<WbsParam>().eq("name_id", nameId));
|
|
|
+ if(result>=1){
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.fail("操作失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 对文件题名规则排序
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String sortNameRule(String rule){
|
|
|
+ String[] codes = rule.split("-");
|
|
|
+ Arrays.sort(codes, Comparator.comparingInt(s -> Integer.parseInt(s.substring(1))));
|
|
|
+ return String.join("-", codes);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 根据文件题名规则转换成C0-C6形式
|
|
|
+ * @param string
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getNameRuleV(String string){
|
|
|
+ // 定义工程名称到C格式的映射
|
|
|
+ Map<String, String> mapping = new HashMap<>();
|
|
|
+ mapping.put("单位工程", "C0");
|
|
|
+ mapping.put("子单位工程", "C1");
|
|
|
+ mapping.put("分部工程", "C2");
|
|
|
+ mapping.put("子分部工程", "C3");
|
|
|
+ mapping.put("分项工程", "C4");
|
|
|
+ mapping.put("子分项工程", "C5");
|
|
|
+ mapping.put("工序", "C6");
|
|
|
+ // 将输入字符串分割成列表
|
|
|
+ List<String> list = Arrays.asList(string.split(","));
|
|
|
+ return list.stream()
|
|
|
+ .map(mapping::get)
|
|
|
+ .collect(Collectors.joining("-"));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据C0-C6转换成文件题名
|
|
|
+ * @param string
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getNameRuleV1(String string){
|
|
|
+ // 定义工程名称到C格式的映射
|
|
|
+ Map<String, String> mapping = new HashMap<>();
|
|
|
+ mapping.put("C0", "单位工程");
|
|
|
+ mapping.put("C1", "子单位工程");
|
|
|
+ mapping.put("C2", "分部工程");
|
|
|
+ mapping.put("C3", "子分部工程");
|
|
|
+ mapping.put("C4", "分项工程");
|
|
|
+ mapping.put("C5", "子分项工程");
|
|
|
+ mapping.put("C6", "工序");
|
|
|
+ // 将输入字符串分割成列表
|
|
|
+ List<String> list = Arrays.asList(string.split("-"));
|
|
|
+ return list.stream()
|
|
|
+ .map(mapping::get)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
|
|
|
}
|