|
@@ -413,29 +413,45 @@ public class FormulaController {
|
|
|
@ApiOperation(value = "公式交互面板", notes = "公式交互面板")
|
|
|
public R<Object> panel(FormulaOptionVo fo) {
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
|
- String key = fo.getKey().replaceAll("__[\\d_]+", "");
|
|
|
- ContractInfo contract = this.contractInfoService.getById(fo.getContractId());
|
|
|
- WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getId,fo.getParentId()).eq(WbsTreeContract::getContractId,fo.getContractId()).last("limit 1"));
|
|
|
-
|
|
|
- List<KeyMapper> kms = this.service.getKeyMapperList(Collections.singletonList(fo.getPkeyId()), contract.getPId(), parent.getPKeyId().toString(), ExecuteType.INSPECTION);
|
|
|
- KeyMapper keyMapper = null;
|
|
|
- if (Func.isNotEmpty(kms)) {
|
|
|
- Optional<KeyMapper> optionalKeyMapper = kms.stream().filter(e -> StringUtils.isEquals(e.getField(), key)).findFirst();
|
|
|
- if (optionalKeyMapper.isPresent()) {
|
|
|
- keyMapper = optionalKeyMapper.get();
|
|
|
+ String key1 = fo.getKey();
|
|
|
+ String[] split = key1.split(",");
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ int type = 0;
|
|
|
+
|
|
|
+ for (String key2 : split) {
|
|
|
+ String key = key2.replaceAll("__[\\d_]+", "");
|
|
|
+ ContractInfo contract = this.contractInfoService.getById(fo.getContractId());
|
|
|
+ WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getId,fo.getParentId()).eq(WbsTreeContract::getContractId,fo.getContractId()).last("limit 1"));
|
|
|
+
|
|
|
+ List<KeyMapper> kms = this.service.getKeyMapperList(Collections.singletonList(fo.getPkeyId()), contract.getPId(), parent.getPKeyId().toString(), ExecuteType.INSPECTION);
|
|
|
+ KeyMapper keyMapper = null;
|
|
|
+ if (Func.isNotEmpty(kms)) {
|
|
|
+ Optional<KeyMapper> optionalKeyMapper = kms.stream().filter(e -> StringUtils.isEquals(e.getField(), key)).findFirst();
|
|
|
+ if (optionalKeyMapper.isPresent()) {
|
|
|
+ keyMapper = optionalKeyMapper.get();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (keyMapper != null && Func.isNotEmpty(keyMapper.getFormulaId())) {
|
|
|
- Formula formula = this.service.getById(keyMapper.getFormulaId());
|
|
|
- /*临时处理,等确定数据结构在优化*/
|
|
|
- if (formula.getFormula().contains(".option")) {
|
|
|
- return R.data(createRadioPanel(0, "是否引用公式数据", this.formulaOptionService.queryOption(fo.getContractId(), fo.getParentId(), fo.getPkeyId(), key)));
|
|
|
- } else if (StringUtils.isEquals("MILE", formula.getNumber()) || StringUtils.isEquals("TURN_POINT", formula.getNumber())) {
|
|
|
- if (StringUtils.isEquals(key, formula.getRelyList().get(0).split(StringPool.COLON)[1])) {
|
|
|
- return R.data(createRadioPanel(1, "竖直方向", this.formulaOptionService.queryOption(fo.getContractId(), fo.getParentId(), fo.getPkeyId(), fo.getKey())));
|
|
|
+ if (keyMapper != null && Func.isNotEmpty(keyMapper.getFormulaId())) {
|
|
|
+ Formula formula = this.service.getById(keyMapper.getFormulaId());
|
|
|
+ /*临时处理,等确定数据结构在优化*/
|
|
|
+ if (formula.getFormula().contains(".option")) {
|
|
|
+ i++;
|
|
|
+ } else if (StringUtils.isEquals("MILE", formula.getNumber()) || StringUtils.isEquals("TURN_POINT", formula.getNumber())) {
|
|
|
+ if (StringUtils.isEquals(key, formula.getRelyList().get(0).split(StringPool.COLON)[1])) {
|
|
|
+ type = 1;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
}
|
|
|
+ R.success("暂无公式控件");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(split.length == i){
|
|
|
+ if(type == 0){
|
|
|
+ return R.data(createRadioPanel(0, "是否引用公式数据", this.formulaOptionService.queryOption(fo.getContractId(), fo.getParentId(), fo.getPkeyId(), split[0])));
|
|
|
+ }else{
|
|
|
+ return R.data(createRadioPanel(1, "竖直方向", this.formulaOptionService.queryOption(fo.getContractId(), fo.getParentId(), fo.getPkeyId(), split[0])));
|
|
|
}
|
|
|
- R.success("暂无公式控件");
|
|
|
}
|
|
|
return R.data(result);
|
|
|
}
|
|
@@ -456,15 +472,13 @@ public class FormulaController {
|
|
|
@ApiOperationSupport(order = 10)
|
|
|
@ApiOperation(value = "公式交互面板参数保存", notes = "公式交互面板参数保存")
|
|
|
public R<Object> panelSave(@RequestBody FormulaOptionVo fo) {
|
|
|
- List<FormulaOptionVo> formulaOptionVos = new ArrayList<>();
|
|
|
- formulaOptionVos.add(fo);
|
|
|
- return R.data(this.formulaOptionService.saveOrUpdateOption(formulaOptionVos));
|
|
|
+ return R.data(this.formulaOptionService.saveOrUpdateOption(fo));
|
|
|
}
|
|
|
|
|
|
@PostMapping("/panel-save-list")
|
|
|
@ApiOperationSupport(order = 10)
|
|
|
@ApiOperation(value = "公式交互面板参数保存(批量)", notes = "公式交互面板参数保存(批量)")
|
|
|
- public R<Object> panelSaveList(@RequestBody List<FormulaOptionVo> fos) {
|
|
|
+ public R<Object> panelSaveList(@RequestBody FormulaOptionVo fos) {
|
|
|
return R.data(this.formulaOptionService.saveOrUpdateOption(fos));
|
|
|
}
|
|
|
|