From 1a07db181c732729abc1d6ec71ae206ecffca86d Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期三, 24 五月 2023 18:33:45 +0800
Subject: [PATCH] 迁移链接类型后台接口,修正属性字段,增加元数据查找应用范围功能
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 132 +++++++++++++++++++++++++-------------------
1 files changed, 75 insertions(+), 57 deletions(-)
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
index b938916..08960e7 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO;
import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
@@ -12,7 +13,6 @@
import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
import com.vci.ubcs.code.entity.*;
import com.vci.ubcs.code.enumpack.*;
-import com.vci.ubcs.code.mapper.CodeAllCodeMapper;
import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper;
import com.vci.ubcs.code.mapper.CodeWupinMapper;
import com.vci.ubcs.code.mapper.CommonsMapper;
@@ -48,7 +48,6 @@
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
-import java.io.Serializable;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@@ -64,7 +63,7 @@
* @date 2022-2-22
*/
@Service
-public class MdmEngineServiceImpl extends ServiceImpl<CodeWupinMapper, CodeWupinEntity> implements MdmEngineService {
+public class MdmEngineServiceImpl extends ServiceImpl<CodeWupinMapper, CodeWupin> implements MdmEngineService {
/**
@@ -149,6 +148,9 @@
*/
@Autowired
private ICodeClassifyTemplateButtonService templateButtonService;
+
+ @Autowired
+ private ICodeClassifyTemplateAttrService codeClassifyTemplateAttrService;
// /**
// * 鐢ㄦ埛鏌ヨ鐨勬湇鍔�,闇�瑕侀棶涓�涓嬫槸鍚﹂渶瑕侀噸鍐欙紝浣跨敤鏌ヨ姝ゅ钩鍙扮殑鐢ㄦ埛琛�
// */
@@ -329,14 +331,14 @@
switchDateAttrOnOrder(templateVO, orderDTO);
//9.鐢熸垚缂栫爜鐨勪俊鎭�
// ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
- CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
+ CodeWupin cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
// //榛樿鐨勫睘鎬ч兘涓嶇敤浠庡墠绔嫹璐�
// //璁剧疆缂栫爜闇�瑕佺殑榛樿灞炴�х殑鍐呭
copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
// //TODO:鍥犱负榛樿鐨勫睘鎬ч兘涓嶆嫹璐濓紝鐩墠闆嗗洟鐮佸彨name锛屽苟娌℃湁浠嶥TO鎷疯礉鍒癱bo閲屻�傚鍔犱竴涓崟鐙鐞嗭紝浠ュ悗鍐嶇湅瑕佷笉瑕佽皟鏁�
cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
// //end -- modify by lihang @20220407
- List<CodeWupinEntity> cboList = new ArrayList<>();
+ List<CodeWupin> cboList = new ArrayList<>();
//澶囨敞
cbo.setDescription(orderDTO.getDescription());
@@ -347,7 +349,7 @@
List<String> charList = new ArrayList<>();
- for (CodeWupinEntity wupinEntity : cboList) {
+ for (CodeWupin wupinEntity : cboList) {
charList.add(wupinEntity.getId());
}
batchSaveSelectChar(templateVO, charList);
@@ -696,7 +698,7 @@
* @param templateVO 妯℃澘鐨勬樉绀哄璞�
* @param edit 鏄惁涓轰慨鏀�
*/
- private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupinEntity cbo,
+ private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupin cbo,
CodeOrderDTO orderDTO, CodeClassifyTemplateVO templateVO,
boolean edit) {
String fullPath = "";
@@ -768,7 +770,7 @@
* @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父
*/
@Override
- public CodeWupinEntity createCBOByBtmName(String btmName)
+ public CodeWupin createCBOByBtmName(String btmName)
throws VciBaseException {
if(btmName!=null){
btmName = btmName.trim().toLowerCase();
@@ -792,7 +794,7 @@
CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
// OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
String userName = AuthUtil.getUser().getUserName();
- CodeWupinEntity wupinEntity = new CodeWupinEntity();
+ CodeWupin wupinEntity = new CodeWupin();
wupinEntity.setOid(null);
// bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
// bo.setNameoid((new ObjectUtility()).getNewObjectID36());
@@ -1842,9 +1844,9 @@
//鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getOid()));
- QueryWrapper<CodeWupinEntity> btmWrapper = new QueryWrapper<>();
+ QueryWrapper<CodeWupin> btmWrapper = new QueryWrapper<>();
btmWrapper.eq("OID",orderDTO.getOid());
- CodeWupinEntity cbo = codeWupinMapper.selectOne(btmWrapper);
+ CodeWupin cbo = codeWupinMapper.selectOne(btmWrapper);
// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
// CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
@@ -1939,7 +1941,7 @@
oidCollection.addAll(strings);
}
- List<CodeWupinEntity> cboList = codeWupinMapper.selectBatchIds(oidCollection);
+ List<CodeWupin> cboList = codeWupinMapper.selectBatchIds(oidCollection);
// List<ClientBusinessObject> cboList = new ArrayList<>();
// oidCollection.stream().forEach(oids -> {
// Map<String, String> conditionMap = new HashMap<>();
@@ -1950,15 +1952,15 @@
if (CollectionUtils.isEmpty(cboList)) {
throw new VciBaseException("鏁版嵁鍏ㄩ儴鍦ㄧ郴缁熶腑涓嶅瓨鍦�");
}
- List<CodeWupinEntity> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList());
+ List<CodeWupin> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(editCBOs)) {
- CodeWupinEntity cbo = editCBOs.get(0);
+ CodeWupin cbo = editCBOs.get(0);
throw new VciBaseException("缂栫爜涓簕0}绛夊叡{1}鏉℃暟鎹殑鐘舵�佷笉鏄痆{2}]锛屼笉鍏佽鍒犻櫎", new String[]{cbo.getId(), String.valueOf(editCBOs.size()), CodeDefaultLC.EDITING.getText()});
}
//鍙兘鍒犻櫎鑷繁鍒涘缓鐨勬暟鎹�
String userId = AuthUtil.getUser().getUserName();
- for (CodeWupinEntity clientBusinessObject:cboList){
+ for (CodeWupin clientBusinessObject:cboList){
String creator = clientBusinessObject.getCreator();
if(!userId.equalsIgnoreCase(creator)){
throw new VciBaseException("缂栫爜涓�"+clientBusinessObject.getId()+"鐨勬暟鎹笉鏄綋鍓嶇敤鎴峰垱寤猴紝涓嶈兘鍒犻櫎锛�");
@@ -2160,17 +2162,21 @@
public R markDataPassing(String oid, String btmName, Boolean pass) {
VciBaseUtil.alertNotNull(oid, "涓氬姟鏁版嵁涓婚敭", btmName, "涓氬姟绫诲瀷", pass, "鏍囪绫诲瀷");
boolean flag = false;
-// try {
-// ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation();
+ try {
+// QueryWrapper<CodeWupinEntity> wrapper = new QueryWrapper<>();
+// wrapper.eq("oid",oid);
+ CodeWupin data = baseMapper.selectById(oid);
+ // ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation();
// ClientBusinessObject data = operation.readBusinessObjectById(oid, btmName);
-// if (data == null || StringUtils.isBlank(data.getOid())) {
-// return BaseResult.fail(DATA_OID_NOT_EXIST);
-// }
-// data.setAttributeValue("passing", String.valueOf(pass));
+ if (data == null || StringUtils.isBlank(data.getOid())) {
+ return R.fail(DATA_OID_NOT_EXIST);
+ }
+ data.setPassing(String.valueOf(pass));
+ flag = SqlHelper.retBool(baseMapper.updateById(data));
// flag = operation.updateBuinessObject(data);
-// } catch (VCIError e) {
-// e.printStackTrace();
-// }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
if (flag) {
return R.success("鏍囪鎴愬姛锛�");
} else {
@@ -2464,51 +2470,63 @@
}
List<String> oidList = VciBaseUtil.str2List(conditionMap.get("oid"));
Map<String, String> oidMap = new HashMap<>();
+ QueryWrapper<CodeWupin> wrapper = new QueryWrapper();
if (conditionMap.get("oid").contains(",")) {
- oidMap.put("oid", QueryOptionConstant.IN +"("+ VciBaseUtil.toInSql(oidList.toArray(new String[0])) + ")");
+// oidMap.put("oid", QueryOptionConstant.IN +"("+ VciBaseUtil.toInSql(oidList.toArray(new String[0])) + ")");
+ wrapper.in("oid",oidList);
} else {
- oidMap.put("oid", conditionMap.get("oid"));
+// oidMap.put("oid", conditionMap.get("oid"));
+ wrapper.in("oid",conditionMap.get("oid"));
}
if (CollectionUtils.isEmpty(oidMap)) {
throw new VciBaseException("涓氬姟鏁版嵁涓婚敭涓嶈兘涓虹┖");
}
// List<ClientBusinessObject> cbos = boService.queryCBO(btmType, oidMap);
-// if (CollectionUtils.isEmpty(cbos)) {
-// throw new VciBaseException("鏈壘鍒颁笟鍔℃暟鎹�");
-// }
-// ClientBusinessObject cbo = cbos.get(0);
-// String templateOid = cbo.getAttributeValue("CODETEMPLATEOID");
+ List<CodeWupin> cbos = baseMapper.selectList(wrapper);
+ if (CollectionUtils.isEmpty(cbos)) {
+ throw new VciBaseException("鏈壘鍒颁笟鍔℃暟鎹�");
+ }
+ CodeWupin cbo = cbos.get(0);
+ String templateOid = cbo.getCodetemplateoid();
// Map<String, String> templateOidMap = new HashMap<>();
// templateOidMap.put("oid", templateOid);
+
+ QueryWrapper<CodeClassifyTemplate> codeClassifyTemplateWrapper = new QueryWrapper<>();
+ codeClassifyTemplateWrapper.eq("oid", templateOid);
+ List<CodeClassifyTemplate> templateDOList = templateService.list(codeClassifyTemplateWrapper);
+
// List<CodeClassifyTemplate> templateDOList = boService.queryObject(CodeClassifyTemplate.class, templateOidMap);
+ QueryWrapper<CodeClassifyTemplateAttr> codeClassifyTemplateAttrWrapper = new QueryWrapper<>();
+ codeClassifyTemplateAttrWrapper.eq("CLASSIFYTEMPLATEOID", templateOid);
// templateOidMap.clear();
// templateOidMap.put("CLASSIFYTEMPLATEOID",templateOid);
-// List<CodeClassifyTemplateAttr> attrDOList = boService.queryObject(CodeClassifyTemplateAttr.class, templateOidMap);
-// if (CollectionUtils.isEmpty(templateDOList)) {
-// logger.error("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘锛屾ā鏉夸富閿細" + templateOid);
-// throw new VciBaseException("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘");
-// }
-// CodeClassifyTemplateVO templateVO = templateService.codeClassifyTemplateDO2VO(templateDOList.get(0));
-// templateVO.setAttributes(templateAttrService.codeClassifyTemplateAttrDO2VOs(attrDOList));
-// try {
-// if (oidList.size() > 1){
-// DataGrid<Map<String,String>> allDataGrid = new DataGrid<>();
-// List<Map<String,String>> allData = new ArrayList<>();
-// oidList.forEach(oid -> {
-// Map<String,String> condition = new HashMap<>();
-// condition.put("oid",oid);
-// DataGrid<Map<String, String>> dataGrid = queryGrid(btmType, templateVO, condition, pageHelper);
-// allData.addAll(dataGrid.getData());
-// });
-// allDataGrid.setData(allData);
-// return allDataGrid;
-// }else {
-// return queryGrid(btmType, templateVO, conditionMap, pageHelper);
-// }
-// } catch (Exception e) {
-// System.out.println(e.getMessage());
+ List<CodeClassifyTemplateAttr> attrDOList = codeClassifyTemplateAttrService.list(codeClassifyTemplateAttrWrapper);
+// boService.queryObject(CodeClassifyTemplateAttr.class, templateOidMap);
+ if (CollectionUtils.isEmpty(templateDOList)) {
+ logger.error("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘锛屾ā鏉夸富閿細" + templateOid);
+ throw new VciBaseException("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘");
+ }
+ CodeClassifyTemplateVO templateVO = templateService.codeClassifyTemplateDO2VO(templateDOList.get(0));
+ templateVO.setAttributes(codeClassifyTemplateAttrService.codeClassifyTemplateAttrDO2VOs(attrDOList));
+ try {
+ if (oidList.size() > 1){
+ DataGrid<Map<String,String>> allDataGrid = new DataGrid<>();
+ List<Map<String,String>> allData = new ArrayList<>();
+ oidList.forEach(oid -> {
+ Map<String,String> condition = new HashMap<>();
+ condition.put("oid",oid);
+ DataGrid<Map<String, String>> dataGrid = queryGrid(btmType, templateVO, condition, pageHelper);
+ allData.addAll(dataGrid.getData());
+ });
+ allDataGrid.setData(allData);
+ return allDataGrid;
+ }else {
+ return queryGrid(btmType, templateVO, conditionMap, pageHelper);
+ }
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
return null;
-// }
+ }
}
/**
* 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟
@@ -2752,7 +2770,7 @@
kv.setValue(buttonVO.getClassifyButtonOidName());
kv.setAttributes(VciBaseUtil.objectToMap(buttonVO));
buttons.add(kv);
- optionJsMap.put(buttonVO.getId(), buttonVO.getButtonVO().getExecutejs());
+ optionJsMap.put(buttonVO.getId(), buttonVO.getButtonVO().getExecuteJs());
});
optionFieldVO.setOptionJsMap(optionJsMap);
uiInfoVO.getTableDefineVO().getCols().get(0).add(optionFieldVO);
--
Gitblit v1.9.3