Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java
@@ -223,7 +223,7 @@ * @return 主题库分类显示树 */ @GetMapping("/referTree") public List<Tree> referTree(@RequestBody TreeQueryObject treeQueryObject) { public List<Tree> referTree(TreeQueryObject treeQueryObject) { return codeClassifyService.referTree(treeQueryObject); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
@@ -31,9 +31,7 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.*; @RestController //@AllArgsConstructor @@ -96,20 +94,20 @@ String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); File file1 = new File(excelFileName); try { // file.transferTo(new File(excelFileName)); // CodeImProtRusultVO codeImProtRusultVO = mdmIOService.batchImportCode(orderDTO,file1); // if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){ // //放到map里 // R result = R.fail("导入失败"); // if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) { // String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath()); // codeImProtRusultVO.setFileOid(filedUUid); // } // result.setData(codeImProtRusultVO); // return result; // }else { // return R.success("操作成功!"); // } file.transferTo(new File(excelFileName)); CodeImProtRusultVO codeImProtRusultVO = mdmIOService.batchImportCode(orderDTO,file1); if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){ //放到map里 R result = R.fail("导入失败"); if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) { String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath()); codeImProtRusultVO.setFileOid(filedUUid); } result.setData(codeImProtRusultVO); return result; }else { return R.success("操作成功!"); } }catch (Throwable e) { logger.error("导入错误",e); String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误.txt"; @@ -126,7 +124,7 @@ }finally { file1.delete(); } return null; // return null; } @@ -474,8 +472,63 @@ @GetMapping("/thisistest") @ResponseBody public List<BaseModel> thisistest(String codeClassifyOid, String functionId) throws Exception { return engineService.selectByTypeAndOid("wupin", "b1511bb3-a773-43e2-ac85-a7fde7314a0f,3e08970024835e69f6c2b2ecd90c48c3,582ff205-0dfb-43e0-8223-e772ff1851ab,db0400fe-cc90-4d9d-8da7-1edf06b1481b"); public Integer thisistest(String codeClassifyOid, String functionId) throws Exception { // return engineService.selectByTypeAndOid("wupin", "b1511bb3-a773-43e2-ac85-a7fde7314a0f,3e08970024835e69f6c2b2ecd90c48c3,582ff205-0dfb-43e0-8223-e772ff1851ab,db0400fe-cc90-4d9d-8da7-1edf06b1481b"); List<BaseModel> models = new ArrayList<>(); BaseModel baseModel = new BaseModel(); Map<String,String > map = new HashMap<>(); map.put("JZL","6789"); map.put("JZRXX","67891"); map.put("JZXZB","67892"); map.put("JSZGL","67893"); map.put("JSSXT","67894"); baseModel.setBtmname("djii"); baseModel.setCreator("fjivis"); baseModel.setId("vcia"); baseModel.setOid("0d86b1ba-9e9e-4d3d-9ae4-f862c3684e74"); baseModel.setCreateTime(new Date()); baseModel.setTs(new Date()); baseModel.setData(map); models.add(baseModel); BaseModel baseModel1 = new BaseModel(); Map<String,String > map1 = new HashMap<>(); map1.put("JZL","6789z"); map1.put("JZRXX","67891z"); map1.put("JZXZB","67892z"); map1.put("JSZGL","67893z"); map1.put("JSSXT","67894z"); baseModel1.setBtmname("djiiz"); baseModel1.setCreator("fjivisz"); baseModel1.setId("vciaz"); baseModel1.setTs(new Date()); baseModel1.setOid("4a00be07-f5a8-4a9b-88fb-d52a0d9cf546"); baseModel1.setCreateTime(new Date()); baseModel1.setData(map1); models.add(baseModel1); BaseModel baseModel2 = new BaseModel(); Map<String,String > map2 = new HashMap<>(); map2.put("JZL","67892"); map2.put("JZRXX","678912"); map2.put("JZXZB","678922"); map2.put("JSZGL","678932"); map2.put("JSSXT","678942"); baseModel2.setBtmname("djii2"); baseModel2.setCreator("fjivis2"); baseModel2.setTs(new Date()); baseModel2.setId("vcia2"); baseModel2.setOid("fa430ff9-f141-4dcf-8809-6f87905c1dea"); baseModel2.setCreateTime(new Date()); baseModel2.setData(map2); models.add(baseModel2); return 0; // return engineService.updateBatchByBaseModel("wupin", models); // return engineService.getUIInfoByClassifyOid(codeClassifyOid,functionId); } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java
@@ -75,6 +75,14 @@ * @param oid 分类的主键 * @return 数据集合 */ List<CodeClassify> selectCodeClassifyDOByTree(@Param("id") String id,@Param("lcstatus") String lcstatus,@Param("parentcodeclassifyoid") String parentcodeclassifyoid); /** * 查找树形结构 * * @param oid 分类的主键 * @return 数据集合 */ List<CodeClassify> selectAllLevelChildHasPath(@Param("oid") String oid); Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -50,6 +50,7 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringPool; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.Cache; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -780,6 +781,11 @@ data.put(CODE_TEMPLATE_OID_FIELD,templateVO.getOid()); data.put(CODE_FULL_PATH_FILED,fullPath); cbo.setData(data); cbo.setOid(VciBaseUtil.getPk()); cbo.setCreateTime(new Date()); cbo.setLastModifyTime(new Date()); cbo.setCreator(AuthUtil.getUser().getUserName()); cbo.setLastModifier(AuthUtil.getUser().getUserName()); // cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid()); // cbo.setTemplateOid(templateVO.getOid()); // cbo.setCodeclsfpath(fullPath); @@ -801,7 +807,7 @@ } int secret = VciBaseUtil.getInt(String.valueOf(cbo.getSecretGrade())); //插个点,后续看密级服务是否可用 //后续看密级服务是否可用 // if (secret == 0 || !secretService.checkDataSecret(secret)) { if (secret == 0 ) { Integer userSecret = VciBaseUtil.getCurrentUserSecret(); @@ -828,12 +834,14 @@ btmName = btmName.trim().toLowerCase(); } try { String keyPrefix = BTM_NAME.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); String finalBtmName = btmName; return CacheUtil.get(BTM_INIT_CACHE, keyPrefix, btmName, () -> { BaseModel baseModel = createBaseModel(finalBtmName); return baseModel; }); String keyPrefix = BTM_INIT_CACHE.concat(StringPool.COLON).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); // String finalBtmName = btmName; Cache.ValueWrapper valueWrapper = CacheUtil.getCache(keyPrefix).get(keyPrefix.concat(String.valueOf(btmName))); if(valueWrapper == null){ CacheUtil.getCache(keyPrefix).put(keyPrefix.concat(String.valueOf(btmName)), createBaseModel(btmName)); valueWrapper = CacheUtil.getCache(keyPrefix).get(keyPrefix.concat(String.valueOf(btmName))); } return (BaseModel) valueWrapper.get(); } catch (Exception e) { logger.error("创建业务类型对象",e); throw new VciBaseException("initBtmError",new String[]{btmName}); @@ -1561,8 +1569,11 @@ referVO.setTextField("name"); } //表需要改 //使用传入的业务类型查询表 R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referVO.getReferType())); // String referTable = VciBaseUtil.getTableName(referVO.getReferType()); String referTable = "pl_code_wupin"; String referTable = listR.getData().get(0).getTableName(); // String referTable = "pl_code_classify"; String referTableNick = attrVO.getId() + "0"; String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " = t." + attrVO.getId(); joinTableList.put(attrVO.getId(), left); @@ -1653,7 +1664,10 @@ } //要改,表明获取有问题 // String tableName = VciBaseUtil.getTableName(btmType); String tableName = "pl_code_wupin"; // String tableName = "pl_code_wupin"; R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); // String referTable = VciBaseUtil.getTableName(referVO.getReferType()); String tableName = listR.getData().get(0).getTableName(); String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(",")) + " from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) @@ -2861,11 +2875,11 @@ uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0); if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) { //功能按钮服务还未实现,等实现了,在进行调用 //List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId); // List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId); // if (operationVOS == null) { // operationVOS = new ArrayList<>(); // } //查询扩展按钮 // //查询扩展按钮 // List<CodeButtonVO> buttonVOS = listButtonInToolbarByClassifyOid(codeClassifyOid); // if (!CollectionUtils.isEmpty(buttonVOS)) { // for (int i = 0; i < buttonVOS.size(); i++) { @@ -2875,8 +2889,8 @@ // operationVO.setUniqueFlag(buttonVO.getId()); // operationVO.setName(buttonVO.getName()); // operationVO.setAlias(operationVO.getName()); // operationVO.setExecuteJs(buttonVO.getExecutejs()); // operationVO.setIconCls(buttonVO.getIconcls()); // operationVO.setExecuteJs(buttonVO.getExecuteJs()); // operationVO.setIconCls(buttonVO.getIconCls()); // operationVOS.add(operationVO); // } // } @@ -3013,7 +3027,7 @@ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(boName)); String userName = AuthUtil.getUser().getUserName(); BaseModel bo = new BaseModel(); bo.setOid(VciBaseUtil.getPk()); // bo.setOid(VciBaseUtil.getPk()); // bo.setRevisionid(VciBaseUtil.getPk()); // bo.setNameoid(VciBaseUtil.getPk()); bo.setBtmname(boName); Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -21,6 +21,7 @@ import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.starter.web.pagemodel.DataGrid; import com.vci.ubcs.starter.web.pagemodel.KeyValue; import com.vci.ubcs.starter.web.util.LangBaseUtil; import com.vci.ubcs.starter.web.util.VciBaseUtil; import com.vci.ubcs.starter.web.util.VciDateUtil; import lombok.AllArgsConstructor; @@ -37,6 +38,7 @@ import javax.annotation.Resource; import java.io.File; import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -255,15 +257,60 @@ String redisUUid=batchImportCodes(orderDTO,templateVO,dataSet,errorMap,true); CodeImProtRusultVO codeImProtRusultVO = new CodeImProtRusultVO(); List<String> needRowIndexList = new ArrayList<>(); // String filePath = returnErrorToExcel(dataSet.getRowData(), errorMap, needRowIndexList, dataSet.getColName()); // if(StringUtils.isNotBlank(filePath)) { // codeImProtRusultVO.setFilePath(filePath); // } // if(StringUtils.isNotBlank(redisUUid)){ // codeImProtRusultVO.setRedisUuid(redisUUid); // } return null; // return codeImProtRusultVO; String filePath = returnErrorToExcel(dataSet.getRowData(), errorMap, needRowIndexList, dataSet.getColName()); if(StringUtils.isNotBlank(filePath)) { codeImProtRusultVO.setFilePath(filePath); } if(StringUtils.isNotBlank(redisUUid)){ codeImProtRusultVO.setRedisUuid(redisUUid); } // return null; return codeImProtRusultVO; } /** * 错误信息返回excel * @param rowDataList 所有的导入数据 * @param errorMap 错误的信息 * @param needRowIndexList 需要写入的数据的行号 * @param titleRowData 标题行 * * @return 错误的excel文件,没有错误会返回空 */ private String returnErrorToExcel(Collection<SheetRowData> rowDataList, Map<String,String> errorMap, List<String> needRowIndexList,List<String> titleRowData){ if(CollectionUtils.isEmpty(errorMap)){ return ""; } Map<String, SheetRowData> rowIndexDataMap = rowDataList.stream().filter(s -> !needRowIndexList.contains(s.getRowIndex())).collect(Collectors.toMap(s -> s.getRowIndex(), t -> t)); List<WriteExcelData> errorDataList = new ArrayList<>(); errorDataList.add(new WriteExcelData(0,0,"错误信息")); for (int i = 0; i < titleRowData.size(); i++) { //错误信息在最后 errorDataList.add(new WriteExcelData(0,i+1,titleRowData.get(i))); } Integer[] newRowIndex = new Integer[]{1}; errorMap.forEach((index,error)->{ //错误信息全部组合到一起 SheetRowData rowData = rowIndexDataMap.getOrDefault(index, null); if(rowData!=null){ errorDataList.add(new WriteExcelData(newRowIndex[0],0,error)); rowData.getData().forEach((colIndex,value)->{ errorDataList.add(new WriteExcelData(newRowIndex[0],colIndex+1,value)); }); newRowIndex[0]++; } }); String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误信息.xls"; WriteExcelOption eo = new WriteExcelOption(errorDataList); try { new File(excelFileName).createNewFile(); } catch (IOException e) { throw new VciBaseException(LangBaseUtil.getErrorMsg(e)); } ExcelUtil.writeDataToFile(excelFileName,eo); return excelFileName; } /** Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
@@ -199,4 +199,47 @@ connect by prior PARENTCODECLASSIFYOID = oid </select> <select id="selectCodeClassifyDOByTree" resultMap="plCodeClassifyResultMap"> select codeclassify0.OWNER as owner, codeclassify0.BTMTYPEID as btmtypeid, codeclassify0.CREATOR as creator, codeclassify0.CREATETIME as createtime, codeclassify0.LASTMODIFIER as lastmodifier, codeclassify0.DESCRIPTION as description, codeclassify0.ORDERNUM as ordernum, codeclassify0.CODERULEOID as coderuleoid, codeclassify0.OID as oid, codeclassify0.BTMNAME as btmname, codeclassify0.BTMTYPENAME as btmtypename, codeclassify0.CODEKEYATTRREPEATOID as codekeyattrrepeatoid, codeclassify0.PARENTCODECLASSIFYOID as parentcodeclassifyoid, codeclassify0.NAME as name, codeclassify0.LASTMODIFYTIME as lastmodifytime, codeclassify0.ID as id, codeclassify0.CODERESEMBLERULEOID as coderesembleruleoid, codeclassify0.LCSTATUS as lcstatus, codeclassify0.TS as ts, coderuleoid.name as codeRuleOidName, codekeyattrrepeatoid.name as codeKeyAttrRepeatOidName, coderesembleruleoid.name as codeResembleRuleOidName from pl_code_classify codeclassify0 left join pl_code_rule coderuleoid on codeclassify0.codeRuleOid = coderuleoid.oid left join pl_code_keyattrrepeat codekeyattrrepeatoid on codeclassify0.codeKeyAttrRepeatOid = codekeyattrrepeatoid.oid left join pl_code_resemblerule coderesembleruleoid on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid where codeclassify0.lcstatus = #{lcstatus} -- and codeclassify0.parentcodeclassifyoid is null -- and codeclassify0.id = 'wupin' <if test="parentcodeclassifyoid != null and parentcodeclassifyoid != ''"> codeclassify0.parentcodeclassifyoid = '${parentcodeclassifyoid}' </if> <if test="parentcodeclassifyoid == null or parentcodeclassifyoid == ''"> and codeclassify0.parentcodeclassifyoid is null and codeclassify0.id = #{id} </if> order by id asc </select> </mapper>