|
@@ -402,39 +402,17 @@ public class WbsParamController {
|
|
|
/*project*/
|
|
|
elementMap = this.jdbcTemplate.queryForList(
|
|
|
"select c.e_name as name ,c.id from m_wbs_tree_private a " +
|
|
|
- "inner join m_wbs_tree_private b on (a.id=b.parent_id and a.wbs_id=b.wbs_id) " +
|
|
|
+ "inner join m_wbs_tree_private b on (a.id=b.parent_id and a.project_id=b.project_id) " +
|
|
|
"inner join m_wbs_form_element c on b.init_table_id=c.f_id " +
|
|
|
"where b.project_id=" + projectId + " and a.p_key_id=" + nodeId + " and b.is_deleted=0 and c.is_deleted=0 ");
|
|
|
}
|
|
|
|
|
|
List<Long> longList = this.jdbcTemplate.queryForList("select element_id from m_element_formula_mapping where is_deleted=0 and scope=35 and param_id in(" + paramList.stream().map(WbsParam::getId).map(String::valueOf).collect(Collectors.joining(",")) + ")", Long.class);
|
|
|
if (Func.isNotEmpty(elementMap)) {
|
|
|
-// Map<String, Object> tmpMap = new HashMap<>();
|
|
|
List<Map<String, Object>> finalElementMap = elementMap;
|
|
|
Map<String,Long> fkMap = this.service.formulaIdKeyMap(paramList.stream().map(WbsParam::getK).collect(Collectors.toList()));
|
|
|
paramList.forEach(e -> {
|
|
|
/*复用节点参数公式,只要公式脚本一样就直接引用*/
|
|
|
-// Formula formula = this.formulaService.getOne(Wrappers.<Formula>lambdaQuery().eq(Formula::getParamId, e.getId()));
|
|
|
-// if (formula == null) {
|
|
|
-// formula = new Formula();
|
|
|
-// formula.setOutm(Formula.FULL);
|
|
|
-// formula.setParamId(e.getId());
|
|
|
-// Map<String, String> keyMap = new HashMap<>();
|
|
|
-// keyMap.put("name", e.getName());
|
|
|
-// keyMap.put("id", e.getId().toString());
|
|
|
-// tmpMap.put(e.getK(), keyMap);
|
|
|
-// if (RegexUtil.match(ParamElements.LEVEL_REG, e.getV().trim())) {
|
|
|
-// /*取层级*/
|
|
|
-// formula.setFormula("FC.tree(trees,WP[" + e.getK() + "])");
|
|
|
-// } else {
|
|
|
-// /*直接取数*/
|
|
|
-// formula.setFormula("WP[" + e.getK() + "]");
|
|
|
-// }
|
|
|
-// formula.setMap(JSON.toJSONString(tmpMap));
|
|
|
-// this.formulaService.save(formula);
|
|
|
-// tmpMap.clear();
|
|
|
-// }
|
|
|
-// Formula finalFormula = formula;
|
|
|
String name = e.getName().replace("【水】", "").trim();
|
|
|
finalElementMap.forEach(m -> {
|
|
|
if (StringUtils.handleNull(m.get("name")).contains(name)) {
|
|
@@ -535,8 +513,8 @@ public class WbsParamController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/test")
|
|
|
- public R<Object> test() {
|
|
|
+ @GetMapping("/createFormulaForWp")
|
|
|
+ public R<Object> createFormulaForWp() {
|
|
|
/*刷模版公式*/
|
|
|
List<WbsParam> list =service.list(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getType,0));
|
|
|
Map<String, Object> tmpMap = new HashMap<>();
|
|
@@ -556,6 +534,29 @@ public class WbsParamController {
|
|
|
return R.success("完成");
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/reMappingProjectAll")
|
|
|
+ public R<Object> reMappingProjectAll(Long projectId){
|
|
|
+ if(projectId==null){
|
|
|
+ return R.fail("请输入项目id");
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> listMaps= this.jdbcTemplate.queryForList(" select p_key_id pkeyId,full_name name from m_wbs_tree_private where is_deleted = 0 and project_id="+projectId+" and node_type=6");
|
|
|
+ if(listMaps.size()>1){
|
|
|
+ int total = listMaps.size();
|
|
|
+ int count=0;
|
|
|
+ for(Map<String,Object> map:listMaps){
|
|
|
+ try {
|
|
|
+ Long nodeId= Long.parseLong(map.get("pkeyId").toString());
|
|
|
+ refresh(nodeId,1,projectId);
|
|
|
+ count++;
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(map.get("name")+"节点参数刷新失败");
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.success("刷新"+total+"节点,成功"+count+"节点");
|
|
|
+ }
|
|
|
+ return R.fail("刷新失败");
|
|
|
+ }
|
|
|
|
|
|
@GetMapping("/lack")
|
|
|
public R<Object> lack(String name) {
|