From ebbd0efdfc7cad7043a0d4620d5f508fbea75683 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 05 七月 2023 09:59:55 +0800
Subject: [PATCH] 发布流程增加参数
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 146 ++++++++++++++++++++----------------------------
1 files changed, 61 insertions(+), 85 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 8cf14fa..6640c45 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
@@ -55,7 +56,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.cache.utils.CacheUtil;
-import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@@ -825,7 +825,7 @@
// cbo.setCodeclsfpath(fullPath);
cbo.setTs(new Date());
if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
- //鍏堝啓鍥哄畾锛屽悗闈㈢敓鍛藉懆鏈熷ソ浜嗗湪缂栧啓
+ //TODO 鍏堝啓鍥哄畾锛屽悗闈㈢敓鍛藉懆鏈熷ソ浜嗗湪缂栧啓
if (StringUtils.isNotBlank(cbo.getLctid())) {
// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid());
// if (lifeCycleVO != null) {
@@ -1579,7 +1579,7 @@
List<CodeClassifyTemplateAttrVO> referAttrVOs = templateVO.getAttributes().stream().filter(
s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig())
).collect(Collectors.toList());
- Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫瓧娈�**/> referFieldMap = new HashMap<>();
+ Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫瓧娈�**/> referFieldMap = new ConcurrentHashMap<>();
if (!CollectionUtils.isEmpty(referAttrVOs)) {
referAttrVOs.parallelStream().forEach(attrVO -> {
UIFormReferVO referVO = null;
@@ -1612,11 +1612,7 @@
});
}
R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getDefaultAttrByBtmId(btmType);
-// Optional.ofNullable(allAttributeByBtmId.getData()).orElseGet(allAttributeByBtmId.getData().getAttributes()).stream().forEach(attrId -> {
-// if (!selectFieldList.contains(attrId.getOid()) && !"secretgrade".equalsIgnoreCase(attrId.getOid())) {
-// selectFieldList.add(attrId.getOid());
-// }
-// });
+
if (allAttributeByBtmId.getData() != null) {
for (BtmTypeAttributeVO attribute : allAttributeByBtmId.getData().getAttributes()) {
if (!selectFieldList.contains(attribute.getId()) && !"secretgrade".equalsIgnoreCase(attribute.getId())) {
@@ -1863,13 +1859,13 @@
return (field.contains(".") ? "" : "t.") + field + SPACE + "= '" + getStringValueInWhere(field, value, attrVOMap) + "'" + SPACE;
}
} else {
- if (referFieldMap.containsKey(key)) {
- //璇存槑鏄弬鐓х殑锛屾垜浠弬鐓х殑鏌ヨ閮借涓烘槸瀛楃涓诧紝濡傛灉鏄椂闂存牸寮忕殑鏌ヨ鑲畾鏈夐棶棰橈紝
- String selectKey = referFieldMap.get(key);
- return getSqlByValue(selectKey, value, null, btmType);
- } else {
+// if (referFieldMap.containsKey(key)) {
+// //璇存槑鏄弬鐓х殑锛屾垜浠弬鐓х殑鏌ヨ閮借涓烘槸瀛楃涓诧紝濡傛灉鏄椂闂存牸寮忕殑鏌ヨ鑲畾鏈夐棶棰橈紝
+// String selectKey = referFieldMap.get(key);
+// return getSqlByValue(selectKey, value, null, btmType);
+// } else {
return getSqlByValue(key, value, attrVOMap, btmType);
- }
+// }
}
}
return "";
@@ -1923,7 +1919,7 @@
}
if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) {
//鏄弬鐓�
- return value;
+ return "'" + value + "'";
} else {
return value;
}
@@ -1947,13 +1943,13 @@
|| VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) {
return value;
} else {
- return value;
+ return "'" + value + "'";
}
} else {
if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
return value;
}
- return value;
+ return "'" + value + "'";
}
}
@@ -2438,28 +2434,27 @@
*/
@Override
public R markDataPassing(String oid, String btmName, Boolean pass) {
- VciBaseUtil.alertNotNull(oid, "涓氬姟鏁版嵁涓婚敭", btmName, "涓氬姟绫诲瀷", pass, "鏍囪绫诲瀷");
- boolean flag = false;
- 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 R.fail(DATA_OID_NOT_EXIST);
- }
- data.setPassing(String.valueOf(pass));
- flag = SqlHelper.retBool(baseMapper.updateById(data));
-// flag = operation.updateBuinessObject(data);
- } catch (Exception e) {
- e.printStackTrace();
- }
- if (flag) {
- return R.success("鏍囪鎴愬姛锛�");
- } else {
- return R.fail("鏍囪澶辫触锛�");
- }
+ VciBaseUtil.alertNotNull(oid, "涓氬姟鏁版嵁涓婚敭", btmName, "涓氬姟绫诲瀷", pass, "鏍囪绫诲瀷");
+ boolean flag = true;
+ try {
+ List<BaseModel> datas = selectByTypeAndOid(btmName, oid);
+ if (datas.size() == 0) {
+ return R.fail(DATA_OID_NOT_EXIST);
+ }
+ datas.stream().forEach(data->data.getData().put("PASSING",String.valueOf(pass)));
+ R r = updateBatchByBaseModel(btmName, datas);
+ if(!r.isSuccess()){
+ flag = false;
+ }
+ } catch (Exception e) {
+ flag = false;
+ e.printStackTrace();
+ }
+ if (flag) {
+ return R.success("鏍囪鎴愬姛锛�");
+ } else {
+ return R.fail("鏍囪澶辫触锛�");
+ }
}
/**
@@ -2737,7 +2732,7 @@
executionId = executionId.substring(0, executionId.lastIndexOf("."));
}
String sql = "select wm_concat(distinct (t.codetempattrOidArr)) codetempattroidarr\n" +
- "from pl_code_wupin t\n" +
+ "from pl_code_clsflowtemp t\n" +
"join PLFLOWINSTANCE plfi on t.ID = plfi.PLTEMPLATEPUID\n" +
"where plfi.PLEXECUTIONID = '" + executionId + "' and t.CLASSIFYTEMPLATEOID = '" + templateOid + "' and t.CODEPROCESSUSE = '" + processUse + "'";
// List<ClientBusinessObject> tempAttrOidArr = boService.queryByOnlySql(sql);
@@ -2745,7 +2740,7 @@
if (CollectionUtils.isEmpty(tempAttrOidArr) || StringUtils.isBlank((CharSequence) tempAttrOidArr.get(0).get("codetempattroidarr"))) {
return new ArrayList<>();
}
- return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("codetempattroidarr").toString());
+ return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("CODETEMPATTROIDARR").toString());
}
/**
@@ -2770,39 +2765,23 @@
throw new VciBaseException("涓氬姟鏁版嵁涓婚敭涓嶈兘涓虹┖");
}
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])) + ")");
- wrapper.in("oid", oidList);
- } else {
-// 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);
- List<CodeWupin> cbos = baseMapper.selectList(wrapper);
+
+ List<BaseModel> cbos = selectByTypeAndOid(btmType,conditionMap.get("oid"));
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);
+ BaseModel cbo = cbos.get(0);
+ String templateOid = cbo.getData().get("CODETEMPLATEOID");
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<>();
+ QueryWrapper<CodeClassifyTemplateAttr> codeClassifyTemplateAttrWrapper = new QueryWrapper<>();
codeClassifyTemplateAttrWrapper.eq("CLASSIFYTEMPLATEOID", templateOid);
-// templateOidMap.clear();
-// templateOidMap.put("CLASSIFYTEMPLATEOID",templateOid);
+
List<CodeClassifyTemplateAttr> attrDOList = codeClassifyTemplateAttrService.list(codeClassifyTemplateAttrWrapper);
-// boService.queryObject(CodeClassifyTemplateAttr.class, templateOidMap);
+
if (CollectionUtils.isEmpty(templateDOList)) {
logger.error("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘锛屾ā鏉夸富閿細" + templateOid);
throw new VciBaseException("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘");
@@ -3271,7 +3250,7 @@
*/
public BaseModel createBaseModel(String boName) {
R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(boName));
- String userName = AuthUtil.getUser().getUserName();
+ String userName = String.valueOf(AuthUtil.getUser().getUserId());
BaseModel bo = new BaseModel();
// bo.setOid(VciBaseUtil.getPk());
// bo.setRevisionid(VciBaseUtil.getPk());
@@ -3368,8 +3347,8 @@
* @return 鍒楄〃鏁版嵁
*/
@Override
- public DataGrid<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) {
-// checkReferConfig(referConfigVO);
+ public IPage<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException{
+ //checkReferConfig(referConfigVO);
//浣跨敤涓氬姟绫诲瀷鏌ヨ
R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
BtmTypeVO btmTypeVO = allAttributeByBtmId.getData();
@@ -3386,14 +3365,11 @@
BtmTypeLcStatusConstant.RELEASE_LIFE_CYCLE.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) {
baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, CodeDefaultLC.RELEASED.getValue());
}
-// baseQueryObject.getConditionMap().put("domain", AppConstant.APPLICATION_NAME_CODE);
-// R<Page<BtmTypeVO>> refPage = btmTypeClient.getRefPage(baseQueryObject);
-//
-// if (refPage.getCode() != 200) {
-// throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒");
-// }
R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referConfigVO.getReferType()));
+ if (listR.getCode() != 200) {
+ throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒");
+ }
if (listR.getData().size() == 0) {
throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
}
@@ -3413,15 +3389,15 @@
String lcstatusSql = "";
if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
- lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
+ lcstatusSql = "lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
}
String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + "";
- List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName()
- + " where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
- + "and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())
+ List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
+ + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
+ + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and":" where") + SPACE
+ lcstatusSql + namesql + codesql + ") t where rownum <=" + num1 + ") where rn >=" + num2
);
List<BaseModel> baseModels = new ArrayList<>();
@@ -3463,16 +3439,16 @@
} catch (Exception e) {
throw new VciBaseException("鏌ヨ澶辫触锛�" + e.getMessage());
}
- int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName()
- + " where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
- + "and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())
+ int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE
+ + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
+ + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and":" where") + SPACE
+ lcstatusSql + namesql + codesql
);
-
- DataGrid<BaseModel> objectDataGrid = new DataGrid<>();
- objectDataGrid.setPage(baseQueryObject.getPage());
- objectDataGrid.setData(baseModels);
- objectDataGrid.setLimit(baseQueryObject.getLimit());
+ IPage<BaseModel> objectDataGrid = new Page<>();
+ objectDataGrid.setPages(baseQueryObject.getPage());
+ objectDataGrid.setCurrent(baseQueryObject.getPage());
+ objectDataGrid.setRecords(baseModels);
+ objectDataGrid.setSize(baseQueryObject.getLimit());
objectDataGrid.setTotal(total);
return objectDataGrid;
}
--
Gitblit v1.9.3