From b5d91d60a294e1c12a44c79490b761821b3d9f44 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期五, 30 六月 2023 18:05:57 +0800
Subject: [PATCH] 顶层批量申请接口导入完善

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |  105 +++++++++++++++++++---------------------------------
 1 files changed, 39 insertions(+), 66 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..55fac7f 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
@@ -55,8 +55,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;
 import org.springblade.core.tool.utils.DateUtil;
@@ -825,7 +823,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) {
@@ -2077,7 +2075,9 @@
                     .append(SPACE)
                     .append(QueryOptionConstant.EQUAL)
                     .append(SPACE)
+					//.append("'")
                     .append(value);
+				//	.append("'");
         }
         sql.append(SPACE);
         return sql.toString();
@@ -2438,28 +2438,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 +2736,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 +2744,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 +2769,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 +3254,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,7 +3351,7 @@
      * @return 鍒楄〃鏁版嵁
      */
     @Override
-    public DataGrid<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) {
+    public Page<BaseModel>referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) {
 //		checkReferConfig(referConfigVO);
         //浣跨敤涓氬姟绫诲瀷鏌ヨ
         R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
@@ -3386,13 +3369,6 @@
                 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.getData().size() == 0) {
             throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
@@ -3468,13 +3444,10 @@
                 + "and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())
                 + lcstatusSql + namesql + codesql
         );
-
-        DataGrid<BaseModel> objectDataGrid = new DataGrid<>();
-        objectDataGrid.setPage(baseQueryObject.getPage());
-        objectDataGrid.setData(baseModels);
-        objectDataGrid.setLimit(baseQueryObject.getLimit());
-        objectDataGrid.setTotal(total);
-        return objectDataGrid;
+        Page<BaseModel>page=new Page<>();
+        page.setRecords(baseModels);
+        page.setTotal(total);
+        return page;
     }
 
     /**

--
Gitblit v1.9.3