|
@@ -342,27 +342,6 @@ public class WbsParamController {
|
|
public R<Boolean> specified(@ApiParam(value = "关联id", required = true) Long paramId, Long elementId) {
|
|
public R<Boolean> specified(@ApiParam(value = "关联id", required = true) Long paramId, Long elementId) {
|
|
/*先删旧关联,检查是否存在公式,没有就新增 再增新关联*/
|
|
/*先删旧关联,检查是否存在公式,没有就新增 再增新关联*/
|
|
this.jdbcTemplate.execute("update m_element_formula_mapping set is_deleted=1 where element_id=" + elementId + " and param_id=" + paramId);
|
|
this.jdbcTemplate.execute("update m_element_formula_mapping set is_deleted=1 where element_id=" + elementId + " and param_id=" + paramId);
|
|
-// Formula formula = this.formulaService.getOne(Wrappers.<Formula>lambdaQuery().eq(Formula::getParamId, paramId));
|
|
|
|
-// if (formula == null) {
|
|
|
|
-// Map<String, Object> tmpMap = new HashMap<>();
|
|
|
|
-// formula = new Formula();
|
|
|
|
-// WbsParam param = this.service.getById(paramId);
|
|
|
|
-// formula.setOutm(Formula.FULL);
|
|
|
|
-// formula.setParamId(param.getId());
|
|
|
|
-// Map<String, String> keyMap = new HashMap<>();
|
|
|
|
-// keyMap.put("name", param.getName());
|
|
|
|
-// keyMap.put("id", param.getId().toString());
|
|
|
|
-// tmpMap.put(param.getK(), keyMap);
|
|
|
|
-// if (RegexUtil.match(ParamElements.LEVEL_REG, param.getV().trim())) {
|
|
|
|
-// /*取层级*/
|
|
|
|
-// formula.setFormula("FC.tree(trees,WP[" + param.getK() + "])");
|
|
|
|
-// } else {
|
|
|
|
-// /*直接取数*/
|
|
|
|
-// formula.setFormula("WP[" + param.getK() + "]");
|
|
|
|
-// }
|
|
|
|
-// formula.setMap(JSON.toJSONString(tmpMap));
|
|
|
|
-// this.formulaService.save(formula);
|
|
|
|
-// }
|
|
|
|
WbsParam wbsParam=this.service.getById(paramId);
|
|
WbsParam wbsParam=this.service.getById(paramId);
|
|
Long formulaId=this.service.formulaId(wbsParam.getK());
|
|
Long formulaId=this.service.formulaId(wbsParam.getK());
|
|
if(formulaId==null){
|
|
if(formulaId==null){
|
|
@@ -577,7 +556,36 @@ public class WbsParamController {
|
|
return R.fail("创建失败");
|
|
return R.fail("创建失败");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ /**按照项目id刷新无效文件题名*/
|
|
|
|
+ @GetMapping("/file-title")
|
|
|
|
+ public R<Object> ref(Long projectId) {
|
|
|
|
+ if (StringUtils.isNumber(projectId)) {
|
|
|
|
+ String sql ="select a.id, a.wbs_id pkeyId from u_information_query a join m_wbs_tree_contract b on a.wbs_id=b.p_Key_id where a.name='还未配置提名规则' and a.project_id=?";
|
|
|
|
+ List<Map<String,Object>> listMaps=this.jdbcTemplate.queryForList(sql,projectId);
|
|
|
|
+ if(listMaps.size()>0){
|
|
|
|
+ List<Long> pkeyIds= listMaps.stream().map(m->Long.parseLong(m.get("pkeyId").toString())).distinct().collect(Collectors.toList());
|
|
|
|
+ Map<Long,String> map = new HashMap<>(pkeyIds.size()*2);
|
|
|
|
+ pkeyIds.forEach(pk->{
|
|
|
|
+ try {
|
|
|
|
+ map.put(pk,this.service.createFileTitle(pk));
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ System.out.println("无法溯源节点"+pk);
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if(map.size()>0){
|
|
|
|
+ String sqlUpdate="UPDATE u_information_query SET name = ? WHERE wbs_id = ?";
|
|
|
|
+ List<Object[]> params = map.entrySet().stream()
|
|
|
|
+ .map(entry -> new Object[]{entry.getValue(), entry.getKey()})
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ this.jdbcTemplate.batchUpdate(sqlUpdate,params);
|
|
|
|
+ return R.success("刷新成功");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return R.fail("执行异常");
|
|
|
|
+ }
|
|
|
|
+ return R.fail("项目Id格式有问题");
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|