From 029b101d319812460441d3d706c0654d8b0dcda6 Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期五, 19 五月 2023 18:43:05 +0800 Subject: [PATCH] 主数据定义接口移植 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java | 8 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateController.java | 19 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java | 76 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateButtonController.java | 7 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java | 67 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyTemplateButtonService.java | 11 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java | 2 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodePhaseAttrService.java | 9 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/lifecycle/CodeAllCodeLC.java | 141 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeOsattributeServiceImpl.java | 10 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java | 40 Source/UBCS-WEB/src/const/code/codebutton.js | 6 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java | 7 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeOsattributeService.java | 5 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 487 ++++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeResembleRuleServiceImpl.java | 18 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java | 26 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java | 20 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java | 437 +++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 4506 +++++++++++++++++++++++++--------------- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateButtonServiceImpl.java | 28 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeButtonWrapper.java | 10 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java | 528 +++- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java | 7 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeResembleRuleService.java | 7 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodePhaseAttrServiceImpl.java | 29 26 files changed, 4,473 insertions(+), 2,038 deletions(-) diff --git a/Source/UBCS-WEB/src/const/code/codebutton.js b/Source/UBCS-WEB/src/const/code/codebutton.js index 51eb3d1..b9ded2d 100644 --- a/Source/UBCS-WEB/src/const/code/codebutton.js +++ b/Source/UBCS-WEB/src/const/code/codebutton.js @@ -237,7 +237,7 @@ // }, { label: "鐘舵��", - prop: "lcstatusName", + prop: "lcStatusText", slot: true, display: false }, @@ -253,7 +253,7 @@ search: true, hide: true, display: true, - prop: "lcstatus", + prop: "lcStatus", rules: [{ required: true, message: "鐘舵��", @@ -289,7 +289,7 @@ // }, { label: "鎸夐挳鐨勪綅缃�", - prop: "usedpositiontypeName", + prop: "usedpositiontypeText", slot: true, display: false }, diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateButtonController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateButtonController.java index c4a9810..f095b7c 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateButtonController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateButtonController.java @@ -18,16 +18,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.vci.ubcs.code.dto.CodeClassifyTemplateButtonDTO; -import com.vci.ubcs.code.entity.CodeClassifyTemplateButton; -import com.vci.ubcs.code.service.ICodeTempbuttonService; +import com.vci.ubcs.code.service.ICodeClassifyTemplateButtonService; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateButtonVO; import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; -import com.vci.ubcs.starter.web.pagemodel.DataGrid; import com.vci.ubcs.starter.web.util.VciBaseUtil; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; @@ -49,7 +46,7 @@ /** * 涓婚搴撻噷妯℃澘鍖呭惈鐨勬寜閽� 鏈嶅姟 */ - private final ICodeTempbuttonService codeClassifyTemplateButtonService; + private final ICodeClassifyTemplateButtonService codeClassifyTemplateButtonService; /** * 涓婚搴撻噷妯℃澘鍖呭惈鐨勬寜閽垪琛� diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateController.java index 9cea828..c9f0077 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyTemplateController.java @@ -95,6 +95,16 @@ } /** + * 淇敼 鍒嗙被妯℃澘瀵硅薄 + * @param codeClassifyTemplateDTO 鍒嗙被妯℃澘瀵硅薄鏁版嵁浼犺緭瀵硅薄 + * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� + */ + @PutMapping("/editSave") + public R<CodeClassifyTemplateVO> editSave(@RequestBody CodeClassifyTemplateDTO codeClassifyTemplateDTO){ + return plCodeClstemplateService.editSave(codeClassifyTemplateDTO); + } + + /** * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鏂板 */ @PostMapping("/save") @@ -209,6 +219,15 @@ public List<Tree> referTree(TreeQueryObject treeQueryObject) { return plCodeClstemplateService.referTree(treeQueryObject); } + /** + * 澧炲姞 鍒嗙被妯℃澘瀵硅薄 + * @param codeClassifyTemplateDTO 鍒嗙被妯℃澘瀵硅薄鏁版嵁浼犺緭瀵硅薄 + * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� + */ + @PostMapping( "/addSave") + public R<CodeClassifyTemplateVO> addSave(@RequestBody CodeClassifyTemplateDTO codeClassifyTemplateDTO){ + return plCodeClstemplateService.addSave(codeClassifyTemplateDTO); + } /** * 鍚敤 diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java index acb40c9..fb97efc 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java @@ -3,26 +3,25 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.common.utils.StringUtils; +import com.vci.ubcs.code.dto.CodeDeleteBatchDTO; import com.vci.ubcs.code.dto.CodeOrderDTO; import com.vci.ubcs.code.dto.CodeOrderSecDTO; import com.vci.ubcs.code.dto.datapush.BaseModelDTO; -import com.vci.ubcs.code.service.ICodeRuleService; import com.vci.ubcs.code.service.MdmEngineService; import com.vci.ubcs.code.service.MdmIOService; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; -import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO; -import com.vci.ubcs.code.vo.pagemodel.MdmUIInfoVO; +import com.vci.ubcs.code.vo.pagemodel.*; import com.vci.ubcs.starter.annotation.VciBusinessLog; import com.vci.ubcs.starter.util.LocalFileUtil; +import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; import com.vci.ubcs.starter.web.pagemodel.DataGrid; +import com.vci.ubcs.starter.web.pagemodel.Tree; import com.vci.ubcs.starter.web.util.ControllerUtil; import com.vci.ubcs.starter.web.util.LangBaseUtil; +import com.vci.ubcs.starter.web.util.VciBaseUtil; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -36,36 +35,35 @@ import java.util.Map; @RestController -@AllArgsConstructor +//@AllArgsConstructor @RequestMapping("/mdmEngineController") @Api(value = "缂栫爜鏁版嵁绠$悊", tags = "缂栫爜鏁版嵁绠$悊") -public class MdmEngineController extends BladeController { +public class MdmEngineController { + +// /** +// * 鏃ュ織 +// */ + private Logger logger = LoggerFactory.getLogger(getClass()); /** * 涓绘暟鎹紩鎿庢湇鍔� */ - private final MdmEngineService engineService; + @Autowired + private MdmEngineService engineService; + /** + * 涓绘暟鎹鍏ュ鍑烘湇鍔� + */ + @Autowired + private MdmIOService mdmIOService; /** - * 鏍规嵁鍒嗙被id鑾峰彇妯℃澘淇℃伅 - * @param codeClassifyOid - * @return + * 涓嬭浇鎵归噺鐢宠鐨勫鍏ユā鏉� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param response 鍝嶅簲瀵硅薄 + * @throws IOException 鎶涘嚭寮傚父 */ - @GetMapping("/getUsedTemplateByClassifyOid") - public R<CodeClassifyTemplateVO> getUsedTemplateByClassifyOid(String codeClassifyOid){ - CodeClassifyTemplateVO codeClassifyTemplateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyOid); - return R.data(codeClassifyTemplateVO); - } - - -// /** -// * 涓嬭浇鎵归噺鐢宠鐨勫鍏ユā鏉� -// * @param codeClassifyOid 鍒嗙被鐨勪富閿� -// * @param response 鍝嶅簲瀵硅薄 -// * @throws IOException 鎶涘嚭寮傚父 -// */ -// @GetMapping("/downloadImportExcel") -// @VciBusinessLog(operateName = "涓嬭浇鎵归噺鐢宠缂栫爜鐨勫鍏ユā鏉�") -// public void downloadImportExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{ + @GetMapping("/downloadImportExcel") + @VciBusinessLog(operateName = "涓嬭浇鎵归噺鐢宠缂栫爜鐨勫鍏ユā鏉�") + public void downloadImportExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{ // String excelName = mdmIOService.createImportExcel(codeClassifyOid,false); // try { // ControllerUtil.writeFileToResponse(response,excelName); @@ -77,26 +75,26 @@ // } // ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); // } -// } -// -// -// /** -// * 鎵归噺鐢宠缂栫爜鐨勪俊鎭� -// * @param secDTOList 鐢宠缂栫爜鐨勪俊鎭紝蹇呴』鍖呭惈鐮佹鍜屽垎绫讳富閿殑淇℃伅 -// * @param file 鏂囦欢鐨勫唴瀹� -// */ -// @VciBusinessLog(operateName = "鎵归噺鐢宠缂栫爜鐨勪俊鎭�") -// @PostMapping("/batchImportCode") -// public R batchImportCode(String secDTOList, String codeClassifyOid, MultipartFile file, HttpServletResponse response) throws Throwable { -// CodeOrderDTO orderDTO = new CodeOrderDTO(); -// orderDTO.setCodeClassifyOid(codeClassifyOid); -// if(StringUtils.isNotBlank(secDTOList)){ -// List<CodeOrderSecDTO> secDTOS = JSONObject.parseArray(secDTOList, CodeOrderSecDTO.class); -// orderDTO.setSecDTOList(secDTOS); -// } -// String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); -// File file1 = new File(excelFileName); -// try { + } + + + /** + * 鎵归噺鐢宠缂栫爜鐨勪俊鎭� + * @param secDTOList 鐢宠缂栫爜鐨勪俊鎭紝蹇呴』鍖呭惈鐮佹鍜屽垎绫讳富閿殑淇℃伅 + * @param file 鏂囦欢鐨勫唴瀹� + */ + @VciBusinessLog(operateName = "鎵归噺鐢宠缂栫爜鐨勪俊鎭�") + @PostMapping("/batchImportCode") + public R batchImportCode(String secDTOList, String codeClassifyOid, MultipartFile file, HttpServletResponse response) throws Throwable { + CodeOrderDTO orderDTO = new CodeOrderDTO(); + orderDTO.setCodeClassifyOid(codeClassifyOid); + if(StringUtils.isNotBlank(secDTOList)){ + List<CodeOrderSecDTO> secDTOS = JSONObject.parseArray(secDTOList, CodeOrderSecDTO.class); + orderDTO.setSecDTOList(secDTOS); + } + 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())){ @@ -111,80 +109,364 @@ // }else { // return R.success("鎿嶄綔鎴愬姛锛�"); // } -// }catch (Throwable e) { -// logger.error("瀵煎叆閿欒",e); -// String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒.txt"; -// LocalFileUtil.writeContentToFile( LangBaseUtil.getErrorMsg(e),errorFile); -// String uuid=ControllerUtil.putErrorFile(errorFile); -// CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO(); -// codeImProtRusultVO.setRedisUuid(""); -// codeImProtRusultVO.setFileOid(uuid); -// codeImProtRusultVO.setFilePath(errorFile); -// R result = R.fail("瀵煎叆澶辫触"); -// result.setData(codeImProtRusultVO); -//// result.setObj(codeImProtRusultVO); -// return result; -// }finally { -// file1.delete(); -// } -// } -// -// -// /** -// * 淇敼鐘舵�� -// * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄 -// * @return 鎵ц缁撴灉 -// */ -// @PostMapping("changeStatus") -// public R changeStatus(BaseModelDTO baseModelDTO) { -// engineService.changeStatus(baseModelDTO); -// return R.success("鎿嶄綔鎴愬姛锛�"); -// } -// -// -// /** -// * 鐢宠缂栫爜淇濆瓨 -// * @param orderDTO 缂栫爜鐢宠鐩稿叧鐨勪俊鎭紝闇�瑕佹湁灞炴�у拰鐮佹鐩稿叧鐨勪俊鎭� -// * @return 鎵ц缁撴灉 -// */ -// @PostMapping("/addSaveCode") -// @VciBusinessLog(operateName = "鐢宠鍗曚釜缂栫爜") -// public R addSaveCode(@RequestBody CodeOrderDTO orderDTO){ -// return R.success(engineService.addSaveCode(orderDTO)); -// } -// -// -// /** -// * 浣跨敤妯℃澘鐨勪富閿幏鍙栬〃鍗曠殑瀹氫箟 -// * @param templateOid 妯℃澘鐨勪富閿� -// * @param codeClassifyOid 浣跨敤妯℃澘鐨勫垎绫讳富閿� -// * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗曪級 -// */ -// @GetMapping("/getFormDefineByTemplateOid") -// public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid){ -// return engineService.getFormDefineByTemplateOid(templateOid,codeClassifyOid); -// } -// -// /** -// * 鐩镐技椤规煡璇� -// * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭� -// * @return 鏁版嵁鍒楄〃 -// */ -// @PostMapping("/resembleQuery") -// public DataGrid<Map<String,String>> resembleQuery(@RequestBody CodeOrderDTO orderDTO){ -// return engineService.resembleQuery(orderDTO); -// } -// -// /** -// * 淇敼鍗曟潯涓婚搴撶殑鏁版嵁 -// * @param orderDTO 缂栫爜鐢宠鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅 -// * @return 鎵ц缁撴灉 -// */ -// @PutMapping("/editSaveCode") -// @VciBusinessLog(operateName = "淇敼缂栫爜鏁版嵁") -// public R editSaveCode(@RequestBody CodeOrderDTO orderDTO){ -// engineService.editSaveCode(orderDTO); -// return R.success("淇敼鎴愬姛锛�"); -// } + }catch (Throwable e) { + logger.error("瀵煎叆閿欒",e); + String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒.txt"; + LocalFileUtil.writeContentToFile( LangBaseUtil.getErrorMsg(e),errorFile); + String uuid=ControllerUtil.putErrorFile(errorFile); + CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO(); + codeImProtRusultVO.setRedisUuid(""); + codeImProtRusultVO.setFileOid(uuid); + codeImProtRusultVO.setFilePath(errorFile); + R result = R.fail("瀵煎叆澶辫触"); + result.setData(codeImProtRusultVO); +// result.setObj(codeImProtRusultVO); + return result; + }finally { + file1.delete(); + } + return null; + } + + /** + * 淇敼鐘舵�� + * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄 + * @return 鎵ц缁撴灉 + */ + @PostMapping("changeStatus") + public R changeStatus(BaseModelDTO baseModelDTO) { + engineService.changeStatus(baseModelDTO); + return R.success("鎿嶄綔鎴愬姛锛�"); + } + + + /** + * 鐢宠缂栫爜淇濆瓨 + * @param orderDTO 缂栫爜鐢宠鐩稿叧鐨勪俊鎭紝闇�瑕佹湁灞炴�у拰鐮佹鐩稿叧鐨勪俊鎭� + * @return 鎵ц缁撴灉 + */ + @PostMapping("/addSaveCode") + @VciBusinessLog(operateName = "鐢宠鍗曚釜缂栫爜") + public R addSaveCode(@RequestBody CodeOrderDTO orderDTO){ + return R.success(engineService.addSaveCode(orderDTO)); + } + + + /** + * 浣跨敤妯℃澘鐨勪富閿幏鍙栬〃鍗曠殑瀹氫箟 + * @param templateOid 妯℃澘鐨勪富閿� + * @param codeClassifyOid 浣跨敤妯℃澘鐨勫垎绫讳富閿� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗曪級 + */ + @GetMapping("/getFormDefineByTemplateOid") + public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid){ + return engineService.getFormDefineByTemplateOid(templateOid,codeClassifyOid); + } + + /** + * 鐩镐技椤规煡璇� + * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭� + * @return 鏁版嵁鍒楄〃 + */ + @PostMapping("/resembleQuery") + public DataGrid<Map<String,String>> resembleQuery(@RequestBody CodeOrderDTO orderDTO){ + return engineService.resembleQuery(orderDTO); + } + + /** + * 淇敼鍗曟潯涓婚搴撶殑鏁版嵁 + * @param orderDTO 缂栫爜鐢宠鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅 + * @return 鎵ц缁撴灉 + */ + @PutMapping("/editSaveCode") + @VciBusinessLog(operateName = "淇敼缂栫爜鏁版嵁") + public R editSaveCode(@RequestBody CodeOrderDTO orderDTO){ + engineService.editSaveCode(orderDTO); + return R.success("淇敼鎴愬姛锛�"); + } + + /** + * 鎵归噺鍒犻櫎涓婚搴撶殑鏁版嵁 + * @param deleteBatchDTO 鍒犻櫎鐨勪俊鎭紝蹇呴』瑕佹湁涓婚敭鍜屽垎绫荤殑涓婚敭 + * @return 鎵ц缁撴灉 + */ + @VciBusinessLog(operateName = "鎵归噺鍒犻櫎涓婚搴撶殑鏁版嵁") + @DeleteMapping("/deleteCode") + public R deleteCode(@RequestBody CodeDeleteBatchDTO deleteBatchDTO){ + engineService.deleteCode(deleteBatchDTO); + return R.success("鍒犻櫎鎴愬姛锛�"); + } + + /** + * 浣跨敤鍒嗙被鍜岄樁娈电殑缂栧彿锛岃幏鍙栧寘鍚殑灞炴�� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param phase 闃舵鐨勫悕绉� + * @return 鍖呭惈鐨勫睘鎬э紝璇疯幏鍙杘bj灞炴�� + */ + @VciBusinessLog(operateName = "鑾峰彇闃舵鐨勫睘鎬т俊鎭�") + @GetMapping("/listPhaseAttrByClassifyOid") + public R listPhaseAttrByClassifyOid(String codeClassifyOid,String phase){ + return R.data(engineService.listPhaseAttrByClassifyOid(codeClassifyOid,phase)); + } + + /** + * 鑾峰彇褰撳墠鍒嗙被鎵�鍦ㄨ矾寰勪笂鐨勫垎绫诲睘鎬� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 鍖呭惈浜嗗綋鍓嶅垎绫荤殑涓婄骇鍜屾墍鏈夊眰绾х殑涓嬬骇 + */ + @GetMapping("/hasSelfClassifyTree") + public List<Tree> hasSelfClassifyTree(String codeClassifyOid){ + return engineService.hasSelfClassifyTree(codeClassifyOid); + } + + /** + * 浣跨敤鍒嗙被鑾峰彇瀵瑰簲鐨勬暟鎹� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param templateOid 妯℃澘鐨勪富閿� + * @param queryObject 鍩虹鏌ヨ瀵硅薄 + * @return 鏁版嵁鐨勪俊鎭紙鍖呭惈涓嬬骇鍒嗙被锛� + */ + @GetMapping("/gridTableDataByClassifyOid") + @VciBusinessLog(operateName = "鏌ヨ涓婚搴撳垎绫荤殑鏁版嵁") + public DataGrid<Map<String,String>> gridTableDataByClassifyOid(String codeClassifyOid, String templateOid, BaseQueryObject queryObject){ + //TODO鍚庣画鍙互瀹氫箟鏌ヨ妯℃澘鏉ユ煡璇� + return engineService.gridTableDataByClassifyOid(codeClassifyOid,templateOid,queryObject.getConditionMap(),queryObject.getPageHelper()); + } + + + /*** + * 鑾峰彇鍒嗙被瀵硅薄 + * @param redisOid + * @return + */ + @GetMapping("/gridclassifys") + public R gridclassifys(String redisOid){ + List<CodeImportTemplateVO> codeImportTemplateVOs=mdmIOService.gridclassifys(redisOid); + return R.data(codeImportTemplateVOs); + } + + /*** + * 浠巖edis缂撳瓨閲岃幏鍙栧埌瀵煎叆姝g‘鐨勬暟鎹� + * @param codeClassifyOid + * @param redisOid + * @return + */ + @GetMapping("/gridValidata") + public DataGrid<Map<String,String>> gridValidata(String codeClassifyOid,String redisOid){ + return mdmIOService.gridDatas(codeClassifyOid,redisOid); + } + + /*** + * 浠巖edis缂撳瓨閲岃幏鍙栧埌瀵煎叆姝g‘鐨勬暟鎹� + * @param dataOid + * @param redisOid + * @return + */ + @GetMapping("/gridRowResemble") + public DataGrid<Map<String,String>> gridRowResemble(String dataOid,String redisOid){ + return mdmIOService.gridRowResemble(dataOid,redisOid); + } + + /*** + * 浠巖edis缂撳瓨閲岃幏鍙栧埌瀵煎叆鍏锋湁鐩镐技椤圭殑鏁版嵁 + * @param codeClassifyOid + * @param redisOid + * @return + */ + @GetMapping("/gridResemble") + public DataGrid<Map<String,String>> gridResemble(String codeClassifyOid,String redisOid){ + return mdmIOService.gridDatas(codeClassifyOid,redisOid); + } + + /** + * 鎵归噺淇濆瓨娴佺▼鎵ц椤甸潰淇敼鐨勫唴瀹� + * @param orderDTOList 缂栫爜鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅 + * @return 鎵ц缁撴灉 + */ + @PostMapping("/batchUpdateCode") + public R batchUpdateCode(@RequestBody List<CodeOrderDTO> orderDTOList){ + return engineService.batchUpdateCode(orderDTOList); + } + + /** + * 鏍囪娴佺▼涓笟鍔℃暟鎹槸鍚﹂�氳繃 + * @param oid 涓氬姟鏁版嵁涓婚敭 + * @param btmName 涓氬姟绫诲瀷 + * @param pass 鏄惁閫氳繃 true-閫氳繃;false-涓嶉�氳繃 + * @return 鎵ц缁撴灉 + */ + @PostMapping("/markPass") + public R markDataPassing(String oid,String btmName,Boolean pass){ + return engineService.markDataPassing(oid,btmName,pass); + } + + /** + * 缁勫悎瑙勫垯鐨勯瑙堢殑鍐呭 + * @param orderDTO 鐢宠缂栫爜淇℃伅 + * @return 鍏紡杞崲鍚庣殑鍊� + */ + @PostMapping("/previewCompRule") + public R previewCompRule(@RequestBody CodeOrderDTO orderDTO){ + return R.data(engineService.previewCompRule(orderDTO)); + } + + /** + * 鍒嗙被娉ㄥ叆鐨勫唴瀹� + * @param orderDTO 鐢宠缂栫爜鐨勪俊鎭紝鍖呭惈鍒嗙被鐨勪富閿拰妯℃澘鐨勪富閿� + * @return 鎵ц缁撴灉 + */ + @PostMapping("/previewClassify") + public R previewClassify(@RequestBody CodeOrderDTO orderDTO){ + VciBaseUtil.alertNotNull(orderDTO,"鐢宠鐨勪俊鎭�",orderDTO.getCodeClassifyOid(),"鍒嗙被涓婚敭",orderDTO.getTemplateOid(),"妯℃澘鐨勪富閿�"); + Map<String,String> classifyMap = engineService.previewClassify(orderDTO.getCodeClassifyOid(),orderDTO.getTemplateOid()); + return R.data(classifyMap); + } + + /** + * 涓嬭浇閿欒鐨勬枃浠朵俊鎭� + * @param uuid 鍞竴鏍囪瘑 + * @param response 鍝嶅簲瀵硅薄 + * @throws IOException 鎶涘嚭寮傚父 + */ + @GetMapping("/downloadErrorFile") + public void downloadErrorFile(String uuid,HttpServletResponse response) throws IOException { + ControllerUtil.downloadErrorFile(response,uuid); + } + + /** + * 鍗囩増缂栫爜鏁版嵁 + * @param orderDTO 缂栫爜鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅 + * @return 鎵ц缁撴灉 + */ + @VciBusinessLog(operateName = "鍗囩増缂栫爜鏁版嵁") + @PostMapping("/upSaveCode") + public R upSaveCode(@RequestBody CodeOrderDTO orderDTO){ + engineService.upSaveCode(orderDTO); + return R.success("鎿嶄綔鎴愬姛锛�"); + } + + /** + * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹� + * @param classifySecOid 鐮佹鐨勪富閿� + * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿� + * @return 鍒嗙被鐮佸�肩殑鍐呭 + */ + @GetMapping("/listCodeClassifyValueBySecOid") + public DataGrid<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid){ + List<CodeClassifyValueVO> valueVOS = engineService.listCodeClassifyValueBySecOid(classifySecOid, parentClassifyValueOid); + DataGrid<CodeClassifyValueVO> dataGrid = new DataGrid<>(); + dataGrid.setData(valueVOS); + dataGrid.setTotal(valueVOS==null?0:valueVOS.size()); + return dataGrid; + } + + /** + * 浣跨敤鍒嗙被鐨勪富閿潵鑾峰彇缂栫爜瑙勫垯 + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 缂栫爜瑙勫垯鐨勫唴瀹� + */ + @GetMapping("/getCodeRuleByClassifyOid") +// @VciUnCheckRight + public R<CodeRuleVO> getCodeRuleByClassifyOid(String codeClassifyOid){ + return R.data(engineService.getCodeRuleByClassifyOid(codeClassifyOid)); + } + + /** + * 浣跨敤涓婚敭鑾峰彇鏁版嵁 + * @param oid 鏁版嵁涓婚敭 + * @param templateOid 妯℃澘鐨勪富閿� + * @return 鏁版嵁鍐呭 + */ + @GetMapping("/getDataByOid") + public R<List<Map<String,String>>> getDataByOid(String oid,String templateOid){ + return engineService.getDataByOid(oid,templateOid); + } + + /** + * 浣跨敤鍒嗙被妯℃澘涓婚敭+妯℃澘娴佺▼鍚嶇О鑾峰彇鍦ㄥ鎵归〉闈笂宸︿晶鏄剧ず鐨勫睘鎬� + * @param templateOid 鍒嗙被妯℃澘鐨勪富閿� + * @param executionId 娴佺▼鎵цid + * @param processUse 娴佺▼鐨勭敤閫� + * @return 鏍戣妭鐐规樉绀虹殑鍚嶇О + */ + @GetMapping("/getFieldByProcessTemplate") + public List<String> getFieldByProcessTemplate(String templateOid,String executionId,String processUse){ + return engineService.getFieldByProcessTemplate(templateOid,executionId,processUse); + } + + /** + * 浣跨敤鍒嗙被鐨勪富閿幏鍙栦笟鍔℃暟鎹� + * @param btmType 涓氬姟绫诲瀷 + * @param queryObject 鏌ヨ瀵硅薄 + * @return 琛ㄦ牸鐨勬樉绀哄璞″�� + */ + @GetMapping("/getTableDataByOids") + public DataGrid<Map<String,String>> getTableDataByOids(String btmType,BaseQueryObject queryObject){ + return engineService.getTableDataByExecutionId(btmType,queryObject); + } + + /** + * 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟 + * @param codeClassifyOid 鍒嗙被涓婚敭 + * @param phase 闃舵鐨勫悕绉� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�) + */ + @GetMapping("/getTableDefineByClassifyOid") + public MdmUIInfoVO getTableDefineByClassifyOid(String codeClassifyOid,String phase){ + return engineService.getTableDefineByClassifyOid_v2(codeClassifyOid,phase); + } + + /** + * 浣跨敤鍒嗙被鐨勭殑缂栧彿璺緞锛岃幏鍙栬〃鍗曠殑瀹氫箟 + * @param idPath 缂栧彿鐨勮矾寰� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�) + */ +// @VciUnCheckRight + @GetMapping("/getFormDefineByClassifyIdPath") + public MdmUIInfoVO getFormDefineByClassifyIdPath(String idPath){ + return engineService.getFormDefineByClassifyIdPath(idPath); + } + + /** + * 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鍗曠殑瀹氫箟 + * @param codeClassifyOid 鍒嗙被涓婚敭 + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�) + */ + @GetMapping("/getFormDefineByClassifyOid") + public MdmUIInfoVO getFormDefineByClassifyOid(String codeClassifyOid){ + return engineService.getFormDefineByClassifyOid(codeClassifyOid); + } + + /** + * 鏍规嵁妯℃澘鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟 + * @param templateOid 妯℃澘鐨勪富閿� + * @return ui鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鏍硷級 + */ + @GetMapping("/getTableDefineByTemplateOid") + public MdmUIInfoVO getTableDefineByTemplateOid(String templateOid){ + return engineService.getTableDefineByTemplateOid(templateOid); + } + + /** + * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄦ牸鐨勭浉鍏冲畾涔� + * @param codeClassifyIdPath 鍒嗙被鐨勭紪鍙疯矾寰勶紝蹇呴』鏄粠椤跺眰鑺傜偣寮�濮嬶紝xxx/yy/zz杩欐牱鐨勬牸寮� + * @param functionId 鍔熻兘鐨勭紪鍙� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鏍�) + */ + @GetMapping("/getUIInfoByClassifyIdPath") + public MdmUIInfoVO getUIInfoByClassifyIdPath(String codeClassifyIdPath,String functionId){ + return engineService.getUIInfoByClassifyIdPath(codeClassifyIdPath,functionId); + } + + /** + * 浣跨敤鍒嗙被鑾峰彇琛ㄦ牸鐨勫畾涔� + * @param codeClassifyOid 鍒嗙被涓婚敭 + * @param functionId 鍔熻兘鐨勭紪鍙� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鏍硷級 + */ + @GetMapping("/getUIInfoByClassifyOid") + public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid,String functionId){ + return engineService.getUIInfoByClassifyOid(codeClassifyOid,functionId); + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/lifecycle/CodeAllCodeLC.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/lifecycle/CodeAllCodeLC.java new file mode 100644 index 0000000..8bfa33e --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/lifecycle/CodeAllCodeLC.java @@ -0,0 +1,141 @@ +package com.vci.ubcs.code.lifecycle; + +import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant; +import com.vci.ubcs.starter.web.enumpck.BaseEnum; + +public enum CodeAllCodeLC implements BaseEnum { + + /** + * 缂栬緫涓� + */ + EDITING(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_EDITING,"缂栬緫涓�"), + + /** + * 瀹℃壒涓� + */ + AUDITING(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_AUDITING,"瀹℃壒涓�"), + + /** + * 宸插彂甯� + */ + RELEASED(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_RELEASED,"宸插彂甯�"), + + /** + * 鐮佸�煎洖鏀� + */ + TASK_BACK(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK,"鐮佸�煎洖鏀�"), + + /** + * 鐮佸�兼暟鎹攢姣� + */ + OBSOLETED(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_OBSOLETED,"鐮佸�兼暟鎹攢姣�"), + + /** + * 鍋滅敤 + */ + DISABLE(FrameWorkDefaultValueConstant.FRAMEWORK_DATA_DISABLED,"鍋滅敤"); + + /** + * 鏋氫妇鐨勫�� + */ + private String value; + + /** + * 鏋氫妇鏄剧ず鏂囨湰 + */ + private String text; + + /** + * 鑾峰彇鏋氫妇鍊� + * + * @return 鏋氫妇鍊� + */ + @Override + public String getValue() { + return value; + } + + /** + * 璁剧疆鏋氫妇鍊� + * + * @param value 鏋氫妇鍊� + */ + public void setValue(String value) { + this.value = value; + } + + /** + * 鑾峰彇鏋氫妇鏄剧ず鏂囨湰 + * + * @return 鏄剧ず鏂囨湰 + */ + @Override + public String getText() { + return text; + } + + /** + * 璁剧疆鏄剧ず鏂囨湰 + * + * @param text 鏄剧ず鏂囨湰 + */ + public void setText(String text) { + this.text = text; + } + + /** + * 鏋勯�犲嚱鏁� + * + * @param value 鍊� + * @param text 鏄剧ず鏂囨湰 + */ + private CodeAllCodeLC(String value, String text) { + this.value = value; + this.text = text; + } + + /** + * 鏍规嵁鍚嶇О鑾峰彇瀵瑰簲鐨勬灇涓惧�� + * + * @param text 鍚嶇О + * @return 鏋氫妇鍊� + */ + public static String getValueByText(String text) { + for (CodeAllCodeLC wenum : CodeAllCodeLC.values()) { + if (wenum.getText().equalsIgnoreCase(text)) { + return wenum.getValue(); + } + } + return ""; + } + + /** + * 鏍规嵁鏋氫妇鍊艰幏鍙栧悕绉� + * + * @param value 鏋氫妇鍊� + * @return 鍚嶇О + */ + public static String getTextByValue(String value) { + for (CodeAllCodeLC wenum : CodeAllCodeLC.values()) { + if (wenum.getValue().equalsIgnoreCase(value)) { + return wenum.getText(); + } + } + return ""; + } + + /** + * 鏍规嵁鏋氫妇鍊艰幏鍙栨灇涓惧璞� + * + * @param value 鏋氫妇鍊� + * @return 鏋氫妇瀵硅薄锛屼笉瀛樺湪鏃跺�欒繑鍥瀗ull + */ + public static CodeAllCodeLC forValue(String value) { + for (CodeAllCodeLC wenum : CodeAllCodeLC.values()) { + if (wenum.getValue().equalsIgnoreCase(value)) { + return wenum; + } + } + return null; + } +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java index 50c64a0..905d0fc 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java @@ -252,4 +252,11 @@ */ List<CodeClassifyVO> selectCodeClassifyDOByTree(TreeQueryObject treeQueryObject); + /** + * 缁熻瀛愯妭鐐圭殑涓暟 + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 涓暟 + */ + int countChildrenByClassifyOid(String codeClassifyOid); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeTempbuttonService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyTemplateButtonService.java similarity index 93% rename from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeTempbuttonService.java rename to Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyTemplateButtonService.java index 4adbe0f..42187ae 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeTempbuttonService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyTemplateButtonService.java @@ -22,9 +22,7 @@ import com.vci.ubcs.code.entity.CodeClassifyTemplateButton; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateButtonVO; import com.vci.ubcs.starter.exception.VciBaseException; -import com.vci.ubcs.starter.web.pagemodel.DataGrid; import com.vci.ubcs.starter.web.pagemodel.PageHelper; -import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import java.util.Collection; @@ -37,7 +35,7 @@ * @author yuxc * @since 2023-04-20 */ -public interface ICodeTempbuttonService extends IService<CodeClassifyTemplateButton> { +public interface ICodeClassifyTemplateButtonService extends IService<CodeClassifyTemplateButton> { /** * 鏌ヨ鎵�鏈夌殑涓婚搴撻噷妯℃澘鍖呭惈鐨勬寜閽� @@ -138,4 +136,11 @@ */ int codeTemplateDeleteTrigger(String classifyTemplateOid); + /** + * 浣跨敤妯℃澘涓婚敭鑾峰彇鎵╁睍鐨勬寜閽� + * @param templateOid 妯℃澘鐨勪富閿� + * @param hasButtonVO 鏄惁鍖呭惈鎸夐挳鐨勬樉绀轰俊鎭� + * @return 鎸夐挳鐨勭浉鍏崇殑淇℃伅 + */ + List<CodeClassifyTemplateButtonVO> listButtonByTemplateOid(String templateOid,boolean hasButtonVO); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java index 6350c98..b3fb879 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java @@ -114,5 +114,29 @@ */ R batchSave4Order(List<CodeClassifyValueDTO> dtoList, String codeclassifysecoid); -} + /** + * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹� + * @param classifySecOid 鐮佹鐨勪富閿� + * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿� + * @return 鍒嗙被鐮佸�肩殑鍐呭 + */ + List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid); + + /** + * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyValueDO 鏁版嵁瀵硅薄 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 + */ + CodeClassifyValueVO codeClassifyValueDO2VO(CodeClassifyValue codeClassifyValueDO) throws VciBaseException; + + /** + * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyValueDOs 鏁版嵁瀵硅薄鍒楄〃 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父 + */ + List<CodeClassifyValueVO> codeClassifyValueDO2VOs(Collection<CodeClassifyValue> codeClassifyValueDOs) throws VciBaseException; + + } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeOsattributeService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeOsattributeService.java index 45e9723..dbf55a4 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeOsattributeService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeOsattributeService.java @@ -22,6 +22,8 @@ import org.springblade.core.mp.base.BaseService; import com.baomidou.mybatisplus.core.metadata.IPage; +import java.util.Map; + /** * 灞炴�ф樉绀哄璞� 鏈嶅姟绫� * @@ -40,4 +42,7 @@ IPage<CodeOsattributeVO> selectCodeOsattributePage(IPage<CodeOsattributeVO> page, CodeOsattributeVO CodeOsattribute); + boolean isDefaultAttr(String selectKey); + + Map<String, CodeOsattributeVO> getDefaultAttributeVOMap(); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodePhaseAttrService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodePhaseAttrService.java index 6c87bb1..55253e2 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodePhaseAttrService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodePhaseAttrService.java @@ -21,6 +21,8 @@ import com.vci.ubcs.code.entity.CodePhaseAttr; import com.vci.ubcs.code.vo.pagemodel.CodePhaseAttrVO; +import java.util.List; + /** * 缂栫爜搴撳畾涔�-妯℃澘闃舵-灞炴�� 鏈嶅姟绫� * @@ -39,4 +41,11 @@ IPage<CodePhaseAttrVO> selectCodePhaseattrPage(IPage<CodePhaseAttrVO> page, CodePhaseAttrVO CodePhaseattr); + /** + * 浣跨敤妯℃澘涓婚敭鍜岄樁娈电紪鍙疯幏鍙栧寘鍚殑灞炴�� + * @param templateOid 妯℃澘鐨勭紪鍙� + * @param phaseId 闃舵鐨勭紪鍙� + * @return 灞炴�х殑鑻辨枃鍚嶇О + */ + List<String> listAttrByTemplateOidAndPhaseId(String templateOid, String phaseId); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeResembleRuleService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeResembleRuleService.java new file mode 100644 index 0000000..dfe100c --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeResembleRuleService.java @@ -0,0 +1,7 @@ +package com.vci.ubcs.code.service; + +import com.vci.ubcs.code.vo.pagemodel.CodeResembleRuleVO; + +public interface ICodeResembleRuleService { + CodeResembleRuleVO getObjectByOid(String codeResembleRuleOid); +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java index 908dc2f..44f60a6 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java @@ -3,20 +3,29 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; +import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO; +import com.vci.ubcs.code.dto.CodeDeleteBatchDTO; +import com.vci.ubcs.code.dto.CodeOrderDTO; +import com.vci.ubcs.code.dto.datapush.BaseModelDTO; import com.vci.ubcs.code.entity.CodeAllCode; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO; -import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; +import com.vci.ubcs.code.entity.CodeKeyAttrRepeat; +import com.vci.ubcs.code.entity.CodeWupinEntity; +import com.vci.ubcs.code.vo.CodeKeyAttrRepeatVO; +import com.vci.ubcs.code.vo.pagemodel.*; +import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO; +import com.vci.ubcs.starter.web.pagemodel.*; +import org.springblade.core.tool.api.R; +import org.springframework.util.CollectionUtils; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * 涓绘暟鎹紩鎿庢湇鍔� * @author weidy * @date 2022-2-21 */ -public interface MdmEngineService extends IService<CodeAllCode> { - - +public interface MdmEngineService extends IService<CodeWupinEntity> { /** * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 * @param codeClassifyOid 鍒嗙被鐨勪富閿� @@ -32,112 +41,330 @@ */ CodeClassifyTemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr); + /** + * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」 + * @param attrVO 妯℃澘灞炴�х殑瀵硅薄 + * @return 涓嬫媺閫夐」 + */ + List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO); + + /** + * 淇敼鐘舵�� + * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄 + */ + void changeStatus(BaseModelDTO baseModelDTO); + + /** + * 鐢宠鍗曚竴缂栫爜 + * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭 + * @return 杩斿洖缂栫爜鐨勫唴瀹� + */ + String addSaveCode(CodeOrderDTO orderDTO); + + /** + * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊� + * @param ruleVO 瑙勫垯鐨勬樉绀哄璞� + * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹� + */ + void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO); + + /** + * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞 + * + * @param value 褰撳墠鐨勫�� + * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌� + * @param attrId 灞炴�х殑缂栧彿 + * @param trim 鏄惁鍘婚櫎绌烘牸 + * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓 + * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙� + * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸 + * @param conditionMap 鏌ヨ鏉′欢 + */ + void wrapperKeyAttrConditionMap(String value, CodeKeyAttrRepeatVO keyRuleVO, String attrId, + boolean trim, boolean ignoreCase, boolean ignoreWidth, + boolean trimAll, Map<String, String> conditionMap); + + /** + * 鍒濆鍖栦笟鍔$被鍨� + * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊 + * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐� + * @return CodeWupinEntity + */ + CodeWupinEntity createCBOByBtmName(String btmName); + + /** + * 淇濆瓨鍙緭鍙�夌殑淇℃伅 + * + * @param templateVO 妯℃澘鐨勫璞� + * @param cboList 鏁版嵁鐨勫唴瀹� + */ + void batchSaveSelectChar(CodeClassifyTemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ + List<String> cboList); + + /** + * 浣跨敤妯℃澘鐨勪富閿幏鍙栬〃鍗曠殑淇℃伅 + * @param templateOid 妯℃澘鐨勪富閿� + * @param codeClassifyOid 浣跨敤妯℃澘鐨勫垎绫荤殑涓婚敭 + * @return ui鐩稿叧鐨勫唴瀹� + */ + MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid); + + /** + * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟鐨勫瓧娈� + * + * @param attrVO 妯℃澘灞炴�� + * @param btmType 涓氬姟绫诲瀷 + * @return 琛ㄥ崟鐨勫瓧娈� + */ + UIFormItemVO templateAttr2FormField(CodeClassifyTemplateAttrVO attrVO, String btmType) ; + + /** + * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸鏄剧ず鐨勯厤缃� + * + * @param attrVO 妯℃澘灞炴�� + * @param forEdit 鏄惁鏄紪杈戞墍闇� + * @return 琛ㄦ牸鐨勫瓧娈� + */ + UITableFieldVO templateAttr2TableField(CodeClassifyTemplateAttrVO attrVO, boolean forEdit); + + /** + * 鐩镐技椤规煡璇� + * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭� + * @return 鏁版嵁鍒楄〃 + */ + DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO); + + /** + * 淇敼涓婚搴撴暟鎹� + * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶇敤鍖呭惈鐮佹鐨勫唴瀹逛簡 + */ + void editSaveCode(CodeOrderDTO orderDTO); + + /** + * 灏佽鐩镐技椤规煡璇㈢殑鏌ヨ鏉′欢鐨勬槧灏� + * + * @param value 鍊� + * @param resembleRuleVO 鐩镐技椤硅鍒� + * @param attrId 灞炴�х殑缂栧彿 + * @param conditionMap 鏌ヨ鏉′欢 + */ + void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap); + /** + * 鑾峰彇浣跨敤鐨勭浉浼兼煡璇㈣鍒� + * + * @param fullInfoBO 绫诲叏閮ㄤ俊鎭� + * @param currentClassifyVO 褰撳墠鐨勫垎绫� + * @return 瑙勫垯锛屽鏋滀笉瀛樺湪浼氳繑鍥濶ull + */ + CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO); /** + * 鏌ヨ缂栫爜鏁版嵁鐨勫垪琛� + * + * @param btmType 涓氬姟绫诲瀷 + * @param templateVO 妯℃澘鐨勫璞★紝闇�瑕佸寘鍚ā鏉跨殑灞炴�� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉瀵硅薄 + * @return 鏁版嵁鍒楄〃 + */ + DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper); + + /** + * 灏佽鏌ヨ鍑烘潵鐨勬暟鎹� + * + * @param dataMap 鏁版嵁鐨勬槧灏� + * @param templateVO 妯℃澘鐨勫睘鎬� + * @param onlySelectAttrIdList 浠呬粎鏌ヨ鐨勫睘鎬у瓧娈� + * @param form 琛ㄥ崟閲屼娇鐢� + */ + void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO, + Collection<String> onlySelectAttrIdList, boolean form); + + /** + * 鏍规嵁妯℃澘灞炴�х敓鎴愮浉搴旂殑sql淇℃伅 + * + * @param btmType 涓氬姟绫诲瀷 + * @param templateVO 妯℃澘鏄剧ず瀵硅薄锛屽繀椤诲寘鍚睘鎬� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉鍜屾帓搴忓璞� + * @return sql鐨勭浉鍏充俊鎭� + */ + CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper); + + void deleteCode(CodeDeleteBatchDTO deleteBatchDTO); + + /** + * 浣跨敤鍒嗙被鍜岄樁娈电殑缂栧彿锛岃幏鍙栧寘鍚殑灞炴�� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param phase 闃舵鐨勫悕绉� + * @return 灞炴�х殑鑻辨枃鍚嶇О + */ + List<String> listPhaseAttrByClassifyOid(String codeClassifyOid, String phase); + + /** + * 璺緞涓婂寘鍚綋鍓嶅垎绫荤殑鎵�鏈夊垎绫讳俊鎭� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 鍒嗙被鏍� + */ + List<Tree> hasSelfClassifyTree(String codeClassifyOid); + + /** + * 浣跨敤鍒嗙被鑾峰彇瀵瑰簲鐨勬暟鎹� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param templateOid 妯℃澘鐨勪富閿� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉鐨勫璞� + * @return 鏁版嵁锛堝寘鍚笅绾у垎绫伙級 + */ + DataGrid<Map<String, String>> gridTableDataByClassifyOid(String codeClassifyOid, String templateOid, Map<String, String> conditionMap, PageHelper pageHelper); + + /** + * 鎵归噺淇濆瓨娴佺▼鎵ц椤甸潰淇敼鐨勫唴瀹� + * @param orderDTOList 缂栫爜鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅 + * @return 鎵ц缁撴灉 + */ + R batchUpdateCode(List<CodeOrderDTO> orderDTOList); + + + /** + * 鏍囪娴佺▼涓笟鍔℃暟鎹槸鍚﹂�氳繃 + * @param oid 涓氬姟鏁版嵁涓婚敭 + * @param btmName 涓氬姟绫诲瀷 + * @param pass 鏄惁閫氳繃 + * @return 鎵ц缁撴灉 + */ + R markDataPassing(String oid, String btmName, Boolean pass); + + /** + * 棰勮缁勫悎瑙勫垯 + * @param orderDTO 鐢宠缂栫爜鐨勪俊鎭� + * @return key鏄粍鍚堣鍒欑殑灞炴�с�倂alue鏄粍鍚堝悗鐨勫�硷紝銆傚鏋滅己灏戞煇涓睘鎬х殑鍊硷紝浼氫綔涓簐alue杩斿洖 + */ + Map<String,String> previewCompRule(CodeOrderDTO orderDTO); + + /** + * 鍒嗙被娉ㄥ叆鐨勫唴瀹归瑙� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param templateOid 妯℃澘鐨勪富閿� + * @return key鏄垎绫绘敞鍏ョ殑灞炴�э紝value鏄敞鍏ュ悗鐨勫�� + */ + Map<String, String> previewClassify(String codeClassifyOid, String templateOid); + + /** + * 鍗囩増鐨勪富棰樺簱鏁版嵁 + * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶉渶瑕佸寘鍚爜娈电殑鍐呭 + */ + void upSaveCode(CodeOrderDTO orderDTO); + + /** + * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹� + * @param classifySecOid 鐮佹鐨勪富閿� + * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿� + * @return 鍒嗙被鐮佸�肩殑鍐呭 + */ + List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid); + + /** + * 浣跨敤涓婚搴撳垎绫昏幏鍙栫紪鐮佽鍒� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 缂栫爜瑙勫垯鐨勫唴瀹� + */ + CodeRuleVO getCodeRuleByClassifyOid(String codeClassifyOid); + + /** * 浣跨敤鍒嗙被鐨勫叏閮ㄤ俊鎭幏鍙栫紪鐮佽鍒� + * * @param fullInfoBO 鍒嗙被鐨勫叏閮ㄤ俊鎭� * @return 瑙勫垯鐨勫唴瀹� */ CodeRuleVO getCodeRuleByClassifyFullInfo(CodeClassifyFullInfoBO fullInfoBO); -//// -//// /** -//// * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」 -//// * @param attrVO 妯℃澘灞炴�х殑瀵硅薄 -//// * @return 涓嬫媺閫夐」 -//// */ -//// List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO); -//// -//// /** -//// * 淇敼鐘舵�� -//// * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄 -//// */ -//// void changeStatus(BaseModelDTO baseModelDTO); -//// -//// /** -//// * 鐢宠鍗曚竴缂栫爜 -//// * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭 -//// * @return 杩斿洖缂栫爜鐨勫唴瀹� -//// */ -//// String addSaveCode(CodeOrderDTO orderDTO); -//// -//// /** -//// * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊� -//// * @param ruleVO 瑙勫垯鐨勬樉绀哄璞� -//// * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹� -//// */ -//// void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO); -//// -//// /** -//// * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞 -//// * -//// * @param value 褰撳墠鐨勫�� -//// * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌� -//// * @param attrId 灞炴�х殑缂栧彿 -//// * @param trim 鏄惁鍘婚櫎绌烘牸 -//// * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓 -//// * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙� -//// * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸 -//// * @param conditionMap 鏌ヨ鏉′欢 -//// */ -//// void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId, -//// boolean trim, boolean ignoreCase, boolean ignoreWidth, -//// boolean trimAll, Map<String, String> conditionMap); -//// /** -//// * 鍒濆鍖栦笟鍔$被鍨� -//// * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊 -//// * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐� -//// * @return CodeWupinEntity -//// * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父 -//// */ -//// CodeWupinEntity createCBOByBtmName(String btmName); -//// -//// /** -//// * 淇濆瓨鍙緭鍙�夌殑淇℃伅 -//// * -//// * @param templateVO 妯℃澘鐨勫璞� -//// * @param cboList 鏁版嵁鐨勫唴瀹� -//// */ -//// void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ -//// List<String> cboList); -//// -//// /** -//// * 浣跨敤妯℃澘鐨勪富閿幏鍙栬〃鍗曠殑淇℃伅 -//// * @param templateOid 妯℃澘鐨勪富閿� -//// * @param codeClassifyOid 浣跨敤妯℃澘鐨勫垎绫荤殑涓婚敭 -//// * @return ui鐩稿叧鐨勫唴瀹� -//// */ -//// MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid); -//// -//// /** -//// * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟鐨勫瓧娈� -//// * -//// * @param attrVO 妯℃澘灞炴�� -//// * @param btmType 涓氬姟绫诲瀷 -//// * @return 琛ㄥ崟鐨勫瓧娈� -//// */ -//// UIFormItemVO templateAttr2FormField(CodeClstempattrVO attrVO, String btmType) ; -//// -//// /** -//// * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸鏄剧ず鐨勯厤缃� -//// * -//// * @param attrVO 妯℃澘灞炴�� -//// * @param forEdit 鏄惁鏄紪杈戞墍闇� -//// * @return 琛ㄦ牸鐨勫瓧娈� -//// */ -//// UITableFieldVO templateAttr2TableField(CodeClstempattrVO attrVO, boolean forEdit); -//// -//// /** -//// * 鐩镐技椤规煡璇� -//// * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭� -//// * @return 鏁版嵁鍒楄〃 -//// */ -//// DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO); -//// -//// /** -//// * 淇敼涓婚搴撴暟鎹� -//// * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶇敤鍖呭惈鐮佹鐨勫唴瀹逛簡 -//// */ -//// void editSaveCode(CodeOrderDTO orderDTO); + /** + * 浣跨敤鏁版嵁涓婚敭鑾峰彇鏁版嵁鐨勫叏閮ㄤ俊鎭� + * @param oid 涓婚敭 + * @param templateOid 妯℃澘鐨勪富閿� + * @return 鏁版嵁鐨勫唴瀹� + */ + R<List<Map<String, String>>> getDataByOid(String oid, String templateOid); + + /** + * 浣跨敤鍒嗙被妯℃澘涓婚敭+妯℃澘娴佺▼鍚嶇О鑾峰彇鍦ㄥ鎵归〉闈笂宸︿晶鏄剧ず鐨勫睘鎬� + * @param templateOid 鍒嗙被妯℃澘鐨勪富閿� + * @param executionId 娴佺▼鎵цid + * @param processUse 娴佺▼鐨勭敤閫� + * @return 鏍戣妭鐐规樉绀虹殑鍚嶇О + */ + List<String> getFieldByProcessTemplate(String templateOid, String executionId, String processUse); + + /** + * 浣跨敤鍒嗙被鐨勪富閿幏鍙栦笟鍔℃暟鎹� + * @param btmType 涓氬姟绫诲瀷 + * @param queryObject 鏌ヨ瀵硅薄 + * @return 琛ㄦ牸鐨勬樉绀哄璞″�� + */ + DataGrid<Map<String, String>> getTableDataByExecutionId(String btmType, BaseQueryObject queryObject); + + /** + * 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟 + * @param codeClassifyOid 鍒嗙被涓婚敭 + * @param phase 闃舵鐨勫悕绉� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�) + */ + MdmUIInfoVO getTableDefineByClassifyOid_v2(String codeClassifyOid, String phase); + + /** + * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄥ崟鐨勭浉鍏冲畾涔� + * @param idPath 缂栧彿鐨勮矾寰勶紝蹇呴』浠庨《灞傝妭鐐瑰紑濮嬶紝xx/yyy/zz + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�) + */ + MdmUIInfoVO getFormDefineByClassifyIdPath(String idPath); + + /** + * 浣跨敤涓婚搴撳垎绫荤殑涓婚敭鑾峰彇琛ㄥ崟鐨勪俊鎭� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return ui鐩稿叧鐨勫唴瀹� + */ + MdmUIInfoVO getFormDefineByClassifyOid(String codeClassifyOid); + + /** + * 浣跨敤妯℃澘涓婚敭鑾峰彇ui鐩稿叧鐨勫唴瀹� + * @param templateOid 妯℃澘鐨勪富閿� + * @return ui鐩稿叧鐨勫唴瀹� + */ + MdmUIInfoVO getTableDefineByTemplateOid(String templateOid); + + /** + * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄦ牸鐨勭浉鍏冲畾涔� + * @param codeClassifyIdPath 鍒嗙被鐨勭紪鍙疯矾寰勶紝蹇呴』鏄粠椤跺眰鑺傜偣寮�濮嬶紝xxx/yy/zz杩欐牱鐨勬牸寮� + * @param functionId 鍔熻兘鐨勭紪鍙� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鏍�) + */ + MdmUIInfoVO getUIInfoByClassifyIdPath(String codeClassifyIdPath, String functionId); + + /** + * 浣跨敤妯℃澘涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭� + * + * @param templateOid 妯℃澘鐨勪富閿� + * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭 + */ + List<CodeButtonVO> listButtonInToolbarByTemplateOid(String templateOid); + + /** + * 浣跨敤鍒嗙被涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭 + */ + List<CodeButtonVO> listButtonInToolbarByClassifyOid(String codeClassifyOid); + + /** + * 浣跨敤鍒嗙被涓婚敭鑾峰彇椤甸潰鐨勫唴瀹癸紝鍖呭惈鎸夐挳 + * + * @param codeClassifyOid 涓婚搴撳垎绫讳富閿� + * @param functionId 鍔熻兘鐨勭紪鍙� + * @return UI鐩稿叧鐨勫唴瀹� + */ + MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid, String functionId); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java index 848ee01..17a191f 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java @@ -3,16 +3,52 @@ import com.vci.ubcs.code.dto.CodeOrderDTO; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO; +import com.vci.ubcs.code.vo.pagemodel.CodeImportTemplateVO; import com.vci.ubcs.code.vo.webserviceModel.attrmap.DataObjectVO; import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultDataObjectDetailDO; +import com.vci.ubcs.starter.web.pagemodel.DataGrid; import java.io.File; import java.util.LinkedList; +import java.util.List; +import java.util.Map; public interface MdmIOService { + List<CodeImportTemplateVO> gridclassifys(String redisOid); + /** + * 鐢熸垚瀵煎叆鐨勬枃浠� + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param isHistory 鏄惁鍘嗗彶鏁版嵁瀵煎叆 + * @return excel鐨勬枃浠跺湴鍧� + */ + String createImportExcel(String codeClassifyOid,boolean isHistory); + /** + * 鎵归噺鐢宠缂栫爜鏁版嵁 + * @param orderDTO 缂栫爜鐢宠淇℃伅锛屽繀椤诲寘鍚垎绫讳富閿拰鐮佹鐨勪俊鎭� + * @param file excel鏂囦欢鐨勪俊鎭� + * @return 鏈夐敊璇俊鎭殑excel + */ + CodeImProtRusultVO batchImportCode(CodeOrderDTO orderDTO, File file); + /*** + * 浠巖edis缂撳瓨閲岃幏鍙栧埌瀵煎叆鐨勬暟鎹� + * @param codeClassifyOid + * @param redisOid + * @return + */ + DataGrid<Map<String, String>> gridDatas(String codeClassifyOid, String redisOid); + + /*** + * 浠巖edis缂撳瓨閲岃幏鍙栧埌瀵煎叆鐨勬暟鎹� + * @param dataOid + * @param redisOid + * @return + */ + DataGrid<Map<String, String>> gridRowResemble(String dataOid, String redisOid); + + void batchSyncEditDatas(CodeClassifyVO codeClassifyVO, DataObjectVO dataObjectVO, LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs); /** * 闆嗘垚鎵归噺鐢宠鏁版嵁 @@ -22,35 +58,4 @@ * @return 鏈夐敊璇俊鎭殑excel */ void batchSyncApplyCode(CodeOrderDTO orderDTO, DataObjectVO dataObjectVO, LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs); - /** - * 闆嗘垚鎵归噺鏇存敼鏁版嵁 - * @param codeClassifyVO; - * @param dataObjectVO 鏁版嵁淇℃伅 - * @param resultDataObjectDetailDOs 閿欒淇℃伅 - * @return 鏈夐敊璇俊鎭殑excel - */ - void batchSyncEditDatas(CodeClassifyVO codeClassifyVO, DataObjectVO dataObjectVO, LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs); - - - - - - - -// -// /** -// * 鐢熸垚瀵煎叆鐨勬枃浠� -// * @param codeClassifyOid 鍒嗙被鐨勪富閿� -// * @param isHistory 鏄惁鍘嗗彶鏁版嵁瀵煎叆 -// * @return excel鐨勬枃浠跺湴鍧� -// */ -// String createImportExcel(String codeClassifyOid,boolean isHistory); -// -// /** -// * 鎵归噺鐢宠缂栫爜鏁版嵁 -// * @param orderDTO 缂栫爜鐢宠淇℃伅锛屽繀椤诲寘鍚垎绫讳富閿拰鐮佹鐨勪俊鎭� -// * @param file excel鏂囦欢鐨勪俊鎭� -// * @return 鏈夐敊璇俊鎭殑excel -// */ -// CodeImProtRusultVO batchImportCode(CodeOrderDTO orderDTO, File file); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java index 7a4d160..ff57988 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java @@ -6,6 +6,7 @@ import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO; import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; +import java.util.Collection; import java.util.List; public interface MdmProductCodeService { @@ -20,4 +21,11 @@ List<String> productCodeAndSaveData(CodeClassifyFullInfoBO classifyFullInfoBO, CodeClassifyTemplateVO templateVO, CodeRuleVO ruleVO, List<CodeOrderSecDTO> secDTOList, List<CodeWupinEntity> dataCBOList); + /** + * 鍥炴敹鐮佸�� + * @param btmId 涓氬姟鏁版嵁鐨勪笟鍔$被鍨� + * @param businessOidCollection 涓氬姟鏁版嵁鐨勪富閿� + * @return 鏄惁鏇存柊鎴愬姛 + */ + Boolean recycleCode(String btmId, Collection<String> businessOidCollection); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java index dd2c40c..a494269 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java @@ -2,6 +2,7 @@ import com.alibaba.nacos.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; @@ -43,8 +44,7 @@ import org.apache.poi.hssf.util.HSSFColor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springblade.core.cache.utils.CacheUtil; -import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.cache.utils.CacheUtil;import com.vci.ubcs.core.log.exception.ServiceException; import org.springblade.core.mp.support.Condition; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; @@ -1102,4 +1102,20 @@ } return fullInfo; } + + + /** + * 缁熻瀛愯妭鐐圭殑涓暟 + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 涓暟 + */ + @Override + public int countChildrenByClassifyOid(String codeClassifyOid) { +// Map<String,String> conditionMap = new HashMap<>(); +// conditionMap.put("parentCodeClassifyOid",codeClassifyOid); + QueryWrapper<CodeClassify> wrapper = new QueryWrapper<>(); + wrapper.eq("parentCodeClassifyOid",codeClassifyOid); + return codeClassifyMapper.selectCount(wrapper).intValue(); + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java index 6410775..ec03bc6 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java @@ -22,6 +22,7 @@ import com.vci.ubcs.code.wrapper.CodeClassifyTemplateAttrWrapper; import com.vci.ubcs.starter.exception.VciBaseException; import com.vci.ubcs.starter.revision.service.RevisionModelUtil; +import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; import com.vci.ubcs.starter.util.PatternUtil; import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.starter.web.pagemodel.*; @@ -328,6 +329,7 @@ //灏咲TO杞崲涓篋O CodeClassifyTemplateAttr codeClassifyTemplateAttrDO = new CodeClassifyTemplateAttr(); BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); + DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeClassifyTemplateAttrDO,"codeclstempattr"); baseMapper.insert(codeClassifyTemplateAttrDO); return codeClassifyTemplateAttrDO2VO(codeClassifyTemplateAttrDO); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeTempbuttonServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateButtonServiceImpl.java similarity index 93% rename from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeTempbuttonServiceImpl.java rename to Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateButtonServiceImpl.java index 84a46e4..f9223cb 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeTempbuttonServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateButtonServiceImpl.java @@ -17,6 +17,7 @@ package com.vci.ubcs.code.service.impl; import com.alibaba.nacos.common.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -28,7 +29,7 @@ import com.vci.ubcs.code.enumpack.CodeButtonUseEnum; import com.vci.ubcs.code.mapper.CodeClassifyTemplateButtonMapper; import com.vci.ubcs.code.service.ICodeButtonService; -import com.vci.ubcs.code.service.ICodeTempbuttonService; +import com.vci.ubcs.code.service.ICodeClassifyTemplateButtonService; import com.vci.ubcs.code.vo.pagemodel.CodeButtonVO; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateButtonVO; import com.vci.ubcs.code.wrapper.CodeTempbuttonWrapper; @@ -61,7 +62,7 @@ * @since 2023-04-20 */ @Service -public class CodeTempbuttonServiceImpl extends ServiceImpl<CodeClassifyTemplateButtonMapper, CodeClassifyTemplateButton> implements ICodeTempbuttonService { +public class CodeClassifyTemplateButtonServiceImpl extends ServiceImpl<CodeClassifyTemplateButtonMapper, CodeClassifyTemplateButton> implements ICodeClassifyTemplateButtonService { /** * 鏁版嵁鎿嶄綔灞� @@ -400,4 +401,27 @@ return updateCount; } + /** + * 浣跨敤妯℃澘涓婚敭鑾峰彇鎵╁睍鐨勬寜閽� + * + * @param templateOid 妯℃澘鐨勪富閿� + * @param hasButtonVO 鏄惁鍖呭惈鎸夐挳鐨勬樉绀轰俊鎭� + * @return 鎸夐挳鐨勭浉鍏崇殑淇℃伅 + */ + @Override + public List<CodeClassifyTemplateButtonVO> listButtonByTemplateOid(String templateOid, boolean hasButtonVO) { + if(StringUtils.isBlank(templateOid)){ + return new ArrayList<>(); + } + Map<String,String> conditionMap = new HashMap<>(); + conditionMap.put("classifyTemplateOid",templateOid); + PageHelper pageHelper = new PageHelper(-1); + pageHelper.addDefaultAsc("orderNum"); + QueryWrapper<CodeClassifyTemplateButton> wrapper = new QueryWrapper<>(); + wrapper.eq("classifyTemplateOid",templateOid); + wrapper.orderByAsc("orderNum"); + List<CodeClassifyTemplateButton> templateButtonDOS = codeClassifyTemplateButtonMapper.selectList(wrapper); + return codeClassifyTemplateButtonDO2VOs(templateButtonDOS,hasButtonVO); + } + } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java index 08bbbf8..ddccbd3 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java @@ -1,6 +1,7 @@ package com.vci.ubcs.code.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -24,6 +25,7 @@ import com.vci.ubcs.starter.web.util.VciBaseUtil; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -349,4 +351,78 @@ return codeClassifyValueMapper.selectList(wrapper); } + /** + * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹� + * + * @param classifySecOid 鐮佹鐨勪富閿� + * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿� + * @return 鍒嗙被鐮佸�肩殑鍐呭 + */ + @Override + public List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid) { + if(StringUtils.isBlank(classifySecOid)){ + return new ArrayList<>(); + } + CodeBasicSec secDO = codeBasicSecService.getById(classifySecOid); + if(secDO == null || StringUtils.isBlank(secDO.getOid())){ + throw new VciBaseException("鐮佹鐨勫唴瀹瑰湪绯荤粺涓笉瀛樺湪"); + } + if(StringUtils.isNotBlank(secDO.getParentClassifySecOid()) && StringUtils.isBlank(parentClassifyValueOid)){ + return new ArrayList<>(); + //鍥犱负鏈変笂绾у垎绫荤殑鏃跺�欙紝蹇呴』鍏堥�夋嫨涓婄骇鍒嗙被鐨勫唴瀹� + } +// Map<String,String> conditionMap = new HashMap<>(); +// conditionMap.put("codeClassifySecOid",classifySecOid); +// if(StringUtils.isNotBlank(parentClassifyValueOid)){ +// conditionMap.put("parentClassifyValueOid",parentClassifyValueOid); +// } +// PageHelper pageHelper = new PageHelper(-1); +// pageHelper.addDefaultAsc("ordernum"); + QueryWrapper<CodeClassifyValue> wrapper = new QueryWrapper<>(); + wrapper.eq("codeClassifySecOid",classifySecOid); + if(StringUtils.isNotBlank(parentClassifyValueOid)){ + wrapper.eq("parentClassifyValueOid",parentClassifyValueOid); + } + wrapper.orderByAsc("ordernum"); + + List<CodeClassifyValue> valueDOList = codeClassifyValueMapper.selectList(wrapper); + return codeClassifyValueDO2VOs(valueDOList); + } + + /** + * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyValueDOs 鏁版嵁瀵硅薄鍒楄〃 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父 + */ + @Override + public List<CodeClassifyValueVO> codeClassifyValueDO2VOs(Collection<CodeClassifyValue> codeClassifyValueDOs) throws VciBaseException{ + List<CodeClassifyValueVO> voList = new ArrayList<CodeClassifyValueVO>(); + if(!CollectionUtils.isEmpty(codeClassifyValueDOs)){ + for(CodeClassifyValue s: codeClassifyValueDOs){ + CodeClassifyValueVO vo = codeClassifyValueDO2VO(s); + if(vo != null){ + voList.add(vo); + } + } + } + return voList; + } + + /** + * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyValueDO 鏁版嵁瀵硅薄 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 + */ + @Override + public CodeClassifyValueVO codeClassifyValueDO2VO(CodeClassifyValue codeClassifyValueDO) throws VciBaseException{ + CodeClassifyValueVO vo = new CodeClassifyValueVO(); + if(codeClassifyValueDO != null){ + BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyValueDO,vo); + //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽 + + } + return vo; + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java index ba39071..d8af1a4 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java @@ -45,7 +45,6 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cglib.beans.BeanMap; import org.springframework.context.annotation.Lazy; @@ -87,7 +86,7 @@ @Autowired(required = false) private CodeTempphaseServiceImpl codeTempphaseServiceImpl; @Autowired(required = false) - private CodeTempbuttonServiceImpl codeTempbuttonServiceImpl; + private CodeClassifyTemplateButtonServiceImpl codeTempbuttonServiceImpl; @Autowired(required = false) private ICodeClassifyProcessTempService codeClsflowtempServiceImpl; // @Autowired(required = false) @@ -875,9 +874,11 @@ CodeClassifyTemplate codeClstemplateQuery = new CodeClassifyTemplate(); // BeanUtil.toBean(map,codeClstempattrVO); // BeanUtil - BeanMap beanMap = BeanMap.create(codeClstemplateQuery); + CodeClassifyTemplateDTO codeClassifyTemplateDTO = new CodeClassifyTemplateDTO(); + BeanMap beanMap = BeanMap.create(codeClassifyTemplateDTO); beanMap.putAll(conditionMap); // BeanUtils.copyProperties(codeClstemplateVO,codeClstemplateQuery); + BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateDTO,codeClstemplateQuery); if (pageHelper == null) { pageHelper = new PageHelper(-1); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeOsattributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeOsattributeServiceImpl.java index 8e89190..b282fb9 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeOsattributeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeOsattributeServiceImpl.java @@ -20,6 +20,16 @@ } @Override + public boolean isDefaultAttr(String selectKey) { + return false; + } + + @Override + public Map<String, CodeOsattributeVO> getDefaultAttributeVOMap() { + return null; + } + + @Override public boolean saveBatch(Collection<CodeOsattributeEntity> entityList, int batchSize) { return false; } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodePhaseAttrServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodePhaseAttrServiceImpl.java index 5fc292e..32afb42 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodePhaseAttrServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodePhaseAttrServiceImpl.java @@ -16,13 +16,21 @@ */ package com.vci.ubcs.code.service.impl; +import com.alibaba.nacos.common.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vci.ubcs.code.constant.MdmBtmTypeConstant; import com.vci.ubcs.code.entity.CodePhaseAttr; import com.vci.ubcs.code.mapper.CodePhaseAttrMapper; import com.vci.ubcs.code.service.ICodePhaseAttrService; import com.vci.ubcs.code.vo.pagemodel.CodePhaseAttrVO; +import com.vci.ubcs.starter.web.util.VciBaseUtil; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; /** * 缂栫爜搴撳畾涔�-妯℃澘闃舵-灞炴�� 鏈嶅姟瀹炵幇绫� @@ -38,5 +46,26 @@ return page.setRecords(baseMapper.selectCodePhaseattrPage(page, codePhaseAttr)); } + /** + * 浣跨敤妯℃澘涓婚敭鍜岄樁娈电紪鍙疯幏鍙栧寘鍚殑灞炴�� + * + * @param templateOid 妯℃澘鐨勭紪鍙� + * @param phaseId 闃舵鐨勭紪鍙� + * @return 灞炴�х殑鑻辨枃鍚嶇О + */ + @Override + public List<String> listAttrByTemplateOidAndPhaseId(String templateOid, String phaseId) { + if(StringUtils.isBlank(templateOid)|| StringUtils.isBlank(phaseId)){ + return new ArrayList<>(); + } + QueryWrapper<CodePhaseAttr> wrapper = new QueryWrapper(); + wrapper.inSql("codephaseoid","select oid from pl_code_tempphase where codeClassifyTemplateOid ='" + templateOid + "' and lower(name) ='" + phaseId.trim().toLowerCase(Locale.ROOT) + "'"); +// Map<String,String> conditionMap = new HashMap<>(); +// conditionMap.put("codephaseoid", QueryOptionConstant.IN + "(select oid from pl_code_tempphase where codeClassifyTemplateOid ='" + templateOid + "' and lower(name) ='" + phaseId.trim().toLowerCase(Locale.ROOT) + "')"); +// PageHelper pageHelper = new PageHelper(-1); + List<CodePhaseAttr> attrDOS = baseMapper.selectList(wrapper); + return CollectionUtils.isEmpty(attrDOS)?new ArrayList<>():attrDOS.stream().map(CodePhaseAttr::getId).collect(Collectors.toList()); + } + } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeResembleRuleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeResembleRuleServiceImpl.java new file mode 100644 index 0000000..fb58ad2 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeResembleRuleServiceImpl.java @@ -0,0 +1,18 @@ +package com.vci.ubcs.code.service.impl; + +import com.vci.ubcs.code.service.ICodeResembleRuleService; +import com.vci.ubcs.code.vo.pagemodel.CodeResembleRuleVO; +import org.springframework.stereotype.Service; + +/** + * 鐩镐技鏌ヨ瑙勫垯鏈嶅姟 + * @author weidy + * @date 2022-04-10 + */ +@Service +public class CodeResembleRuleServiceImpl implements ICodeResembleRuleService { + @Override + public CodeResembleRuleVO getObjectByOid(String codeResembleRuleOid) { + return null; + } +} 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 7309f87..b938916 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 @@ -1,24 +1,61 @@ package com.vci.ubcs.code.service.impl; -import com.alibaba.cloud.commons.lang.StringUtils; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; -import com.vci.ubcs.code.entity.CodeAllCode; +import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO; +import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant; +import com.vci.ubcs.code.constant.MdmBtmTypeConstant; +import com.vci.ubcs.code.dto.CodeDeleteBatchDTO; +import com.vci.ubcs.code.dto.CodeOrderDTO; +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; import com.vci.ubcs.code.service.*; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; -import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; +import com.vci.ubcs.code.vo.CodeKeyAttrRepeatVO; +import com.vci.ubcs.code.vo.pagemodel.*; +import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO; +import com.vci.ubcs.code.vo.pagemodel.UITablePageVO; import com.vci.ubcs.starter.exception.VciBaseException; -import lombok.extern.slf4j.Slf4j; +import com.vci.ubcs.starter.revision.model.TreeWrapperOptions; +import com.vci.ubcs.starter.revision.service.RevisionModelUtil; +import com.vci.ubcs.starter.web.constant.QueryOptionConstant; +import com.vci.ubcs.starter.web.constant.RegExpConstant; +import com.vci.ubcs.starter.web.enumpck.BooleanEnum; +import com.vci.ubcs.starter.web.enumpck.UserSecretEnum; +import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; +import com.vci.ubcs.starter.web.pagemodel.*; +import com.vci.ubcs.starter.web.toolmodel.DateConverter; +import com.vci.ubcs.starter.web.util.VciBaseUtil; +import com.vci.ubcs.starter.web.util.VciDateUtil; +import com.vci.ubcs.starter.web.util.VciQueryWrapperForDO; +import com.vci.ubcs.starter.web.util.WebUtil; +import com.vci.ubcs.system.entity.DictBiz; +import com.vci.ubcs.system.feign.IDictBizClient; +import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.List; +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; -// +import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST; +import static com.vci.ubcs.code.constant.MdmEngineConstant.*; +import static com.vci.ubcs.starter.web.constant.EnumIdConstant.LC_STATUS_SUBFIX; /** * 涓绘暟鎹紩鎿庢湇鍔� @@ -26,46 +63,152 @@ * @author weidy * @date 2022-2-22 */ -@Slf4j @Service -public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService { -// -// -// /** -// * 鍒嗙被鐨勬湇鍔� -// */ -// @Resource -// private ICodeClassifyService classifyService; -// -// /** -// * 鍏抽敭灞炴�х殑閰嶇疆 -// */ -// @Autowired -// private ICodeKeyattrrepeatService keyRuleService; -// /** -// * 鏃ュ織 -// */ -// private Logger logger = LoggerFactory.getLogger(getClass()); -// -// // @Autowired -// // private CodeOsbtmtypeMapper codeOsbtmtypeMapper; -// +public class MdmEngineServiceImpl extends ServiceImpl<CodeWupinMapper, CodeWupinEntity> implements MdmEngineService { + + /** * 妯℃澘鐨勬湇鍔� */ - @Autowired(required = false) - private ICodeClassifyTemplateAttrService codeClassifyTemplateAttrService; + @Resource + private CodeClstemplateServiceImpl templateService; + /** + * 妯℃澘鐨勬湇鍔� + */ + @Resource + private CodeOsbtmtypeMapper codeOsbtmtypeMapper; + @Resource + private CodeOsattributeServiceImpl attributeService; + /** + * 鐢熸垚缂栫爜鐨勬湇鍔� + */ + @Resource + private MdmProductCodeService productCodeService; + /** + * 瀛楀吀鐨勬湇鍔� + */ + @Resource + IDictBizClient iDictBizClient; + /** + * 鍏紡鐨勬湇鍔� + */ + @Autowired + private FormulaServiceImpl formulaService; - /*** - * 缂栫爜瑙勫垯鏈嶅姟 + /** + * 鐩镐技椤规煡璇㈣鍒� */ - @Autowired(required = false) - private ICodeRuleService codeRuleService; - /*** - * 鍒嗙被妯℃澘鏈嶅姟 + @Autowired + private ICodeResembleRuleService resembleRuleService; + + /** + * 瀵硅薄鐨勬搷浣� */ - @Autowired(required = false) - private ICodeClstemplateService plCodeClstemplateService; + @Autowired + private RevisionModelUtil revisionModelUtil; + + /** + * 闃舵鐨勬湇鍔� + */ + @Autowired + private ICodePhaseAttrService phaseAttrService; +// + /** + * 閫氱敤鏌ヨ + */ + @Resource + CommonsMapper commonsMapper; + + @Resource + CodeWupinMapper codeWupinMapper; + /** + * 缂栫爜瑙勫垯鐨勬湇鍔� + */ + @Autowired + private ICodeRuleService ruleService; + /** + * 缂栫爜瑙勫垯鐨勬湇鍔� + */ + @Autowired + private ICodeAllCodeService codeAllCodeService; + + /** + * 鍒嗙被鐮佸�肩殑鏈嶅姟 + */ + @Autowired + private ICodeClassifyValueService classifyValueService; + + /** + * 鍒嗙被鐨勬湇鍔� + */ + @Resource + private ICodeClassifyService classifyService; + + /** + * 妯℃澘鎸夐挳鏈嶅姟 + */ + @Autowired + private ICodeClassifyTemplateButtonService templateButtonService; +// /** +// * 鐢ㄦ埛鏌ヨ鐨勬湇鍔�,闇�瑕侀棶涓�涓嬫槸鍚﹂渶瑕侀噸鍐欙紝浣跨敤鏌ヨ姝ゅ钩鍙扮殑鐢ㄦ埛琛� +// */ +// @Autowired +// private SmUserQueryServiceI userQueryService; + + /** + * 鍏抽敭灞炴�х殑閰嶇疆 + */ + @Autowired + private ICodeKeyAttrRepeatService keyRuleService; + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 绌烘牸 + */ + public static final String SPACE = " "; + + /** + * 瀵嗙骇鐨勫瓧娈� + */ + public static final String SECRET_FILED = "secretgrade"; + /** + * 鐢ㄦ埛鏂板鏁版嵁鐨勬椂鍊欏彲浠ユ煡鐪嬬殑瀵嗙骇 + */ + public static final String MY_DATA_SECRET = "myDataSecret"; + /** + * 鎷疯礉鐨勭増鏈� + */ + public static final String COPY_FROM_VERSION = "copyfromversion"; + /** + * 鍙槸sql + */ + public static final String ONLY = "${vcionly}"; + + /** + * 榛樿鐨勬椂闂存牸寮� + */ + private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss"; + + /** + * 鏃ユ湡鏍煎紡 + */ + private static final String DATE_FORMAT = "yyyy-mm-dd"; + + /** + * 蹇呰緭 + */ + public static final String REQUIRED_CHAR = "*"; + /** + * 鏇挎崲瀛楃 + */ + public static final String SPECIAL_CHAR = "VCI"; +// @Autowired +// private CodeOsbtmtypeMapper codeOsbtmtypeMapper;---- + + /** * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 @@ -77,7 +220,7 @@ public CodeClassifyTemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid) { return getUsedTemplateByClassifyOid(codeClassifyOid, true); } -// + /** * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 * @@ -87,14 +230,2090 @@ */ @Override public CodeClassifyTemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr) { - CodeClassifyTemplateVO templateVO=new CodeClassifyTemplateVO(); - List<CodeClassifyTemplateVO>templateVOs=plCodeClstemplateService.listReleaseTemplateByClassifyOid(codeClassifyOid,hasAttr); - if(templateVOs.size()>0){ - templateVO= templateVOs.get(templateVOs.size() - 1); - } - return templateVO; + List<CodeClassifyTemplateVO> templateVOs = templateService.listReleaseTemplateByClassifyOid(codeClassifyOid, hasAttr); + return templateVOs.get(templateVOs.size() - 1); } + /** + * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」 + * + * @param attrVO 妯℃澘灞炴�х殑瀵硅薄 + * @return 涓嬫媺閫夐」 + */ + @Override + public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) { + List<KeyValue> comboboxKVs = null; + if (StringUtils.isNotBlank(attrVO.getEnumString())) { + comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class); + } else { +// comboboxKVs = enumService.getEnum(attrVO.getEnumid()); +// Dict dict = new Dict(); +// dict.setParentId(Long.valueOf(attrVO.getEnumid())); + R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumId()); + if(list.isSuccess()){ + for (DictBiz datum : list.getData()) { + KeyValue keyValue = new KeyValue(); + keyValue.setKey(datum.getDictKey()); + keyValue.setValue(datum.getDictValue()); + comboboxKVs.add(keyValue); + } + } + } + return comboboxKVs; + } + /** + * 淇敼鐘舵�� + * + * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄 + */ + @Override + public void changeStatus(BaseModelDTO baseModelDTO) { + VciBaseUtil.alertNotNull(baseModelDTO, "鏁版嵁淇℃伅", baseModelDTO.getOid(), "涓婚敭", baseModelDTO.getBtmname(), "涓氬姟绫诲瀷", baseModelDTO.getLcStatus(), "鐩爣鐘舵��"); + List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid()); +// List<ClientBusinessObject> cboList = boService.selectCBOByOidCollection(oids, baseModelDTO.getBtmname()); + //鎻掍釜鐐� 涓氬姟绫诲瀷瀹屾垚鍚庨渶瑕佷慨鏀� + QueryWrapper<CodeOsbtmtypeEntity> wrapper = new QueryWrapper<>(); + wrapper.eq("BTMNAME",baseModelDTO.getBtmname()); + wrapper.in("OID",oids); + List<CodeOsbtmtypeEntity> cboList = codeOsbtmtypeMapper.selectList(wrapper); + //杩橀渶瑕佷慨鏀筧llCode鐨勭敓鍛藉懆鏈� +// Map<String, String> conditionMap = new HashMap<>(); + QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>(); + allCodeWrapper.eq("createcodebtm",baseModelDTO.getBtmname()); + allCodeWrapper.in("createcodeoid",oids); +// conditionMap.put("createcodeoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); +// conditionMap.put("createcodebtm", baseModelDTO.getBtmname()); + List<CodeAllCode> codeCbos = codeAllCodeService.selectByWrapper(allCodeWrapper); +// List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap); + // 鍥炴敹闇�瑕佷笟鍔℃暟鎹垹闄� + if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) { +// BatchCBO batchCBO = new BatchCBO(); +// batchCBO.getDeleteCbos().addAll(cboList); + codeOsbtmtypeMapper.deleteBatchIds(cboList); +// boService.persistenceBatch(batchCBO); + } else { +// lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus()); + } +// lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus()); + } + + + /** + * 鐢宠鍗曚竴缂栫爜 + * + * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭 + * @return 杩斿洖缂栫爜鐨勫唴瀹� + */ + @Override + public String addSaveCode(CodeOrderDTO orderDTO) { + VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭", + orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�"); + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); + CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); + //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈� + checkSecValueOnOrder(ruleVO, orderDTO); + //2.鍒ゆ柇蹇呰緭椤� + checkRequiredAttrOnOrder(templateVO, orderDTO); + //3.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� + switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); + //4.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 + switchComponentAttrOnOrder(templateVO, orderDTO); + //5.鏍¢獙瑙勫垯 + checkVerifyOnOrder(templateVO, orderDTO); + //6.鍏抽敭灞炴�� + checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); + //7.鏋氫妇杞崲 + checkEnumOnOrder(templateVO, orderDTO); + //8.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 + switchDateAttrOnOrder(templateVO, orderDTO); + //9.鐢熸垚缂栫爜鐨勪俊鎭� +// ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); + CodeWupinEntity 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<>(); + + //澶囨敞 + cbo.setDescription(orderDTO.getDescription()); + cboList.add(cbo); +// +// cboList.add(cbo); + List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); + + + List<String> charList = new ArrayList<>(); + for (CodeWupinEntity wupinEntity : cboList) { + charList.add(wupinEntity.getId()); + } + batchSaveSelectChar(templateVO, charList); + return codeList.size() > 0 ? codeList.get(0) : ""; +// return null; + } + + /** + * 澶勭悊鍒嗙被娉ㄥ叆鐨勪俊鎭� + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝蹇呴』瑕佸悗妯℃澘鐨勫睘鎬� + * @param classifyFullInfoBO 鍒嗙被鐨勫叏璺緞 + * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� + */ + private void switchClassifyLevelOnOrder(CodeClassifyTemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) { + Map<String,CodeClassifyTemplateAttrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter( + s -> StringUtils.isNotBlank(s.getClassifyInvokeAttr()) && StringUtils.isNotBlank(s.getClassifyInvokeLevel()) + ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + if (classifyFullInfoBO.getTopClassifyVO() == null) { + //闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨� + } + if (!CollectionUtils.isEmpty(classifyAttrVOMap)) { + classifyAttrVOMap.forEach((attrId, attrVO) -> { + //鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝 + //灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰 + CodeClassifyVO classifyVO = null; + if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyInvokeLevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyInvokeLevel())) { + //鎸囧畾浜嗗眰绾х殑 + //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊� + List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList()); + int level = VciBaseUtil.getInt(attrVO.getClassifyInvokeLevel()); + if (classifyVOS.size() >= level && level > 0) { + classifyVO = classifyVOS.get(level - 1); + } + } else { + //褰撳墠鐨勫垎绫� + classifyVO = classifyFullInfoBO.getCurrentClassifyVO(); + } + if (classifyVO == null) { + //璇存槑灞傜骇鏈夎 + orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyInvokeLevel() + "]"); + // classifyVO = classifyFullInfoBO.getCurrentClassifyVO(); + } else { + Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO); + String value = classifyDataMap.getOrDefault(attrVO.getClassifyInvokeAttr(), ""); + orderDTO.getData().put(attrId, value); + } + }); + } + } + + + /** + * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊� + * + * @param ruleVO 瑙勫垯鐨勬樉绀哄璞� + * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹� + */ + @Override + public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) { + List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter( + s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType()) + || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType()) + || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType()) + || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType()) + || VciBaseUtil.getBoolean(s.getNullableFlag())) + ).map(CodeBasicSecVO::getOid).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(unSerialSecOidList)) { + if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) { + throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��"); + } + if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid()) + && StringUtils.isBlank(s.getSecValue()))) { + throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��"); + } + } + } + + /** + * 鏍¢獙灞炴�ф槸鍚︿负蹇呰緭 + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬� + * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� + */ + private void checkRequiredAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) { + + Map<String, CodeClassifyTemplateAttrVO> requiredAttrMap = templateVO.getAttributes().stream().filter( + s -> VciBaseUtil.getBoolean(s.getRequireFlag()) && StringUtils.isBlank(s.getComponentRule()) + && StringUtils.isBlank(s.getClassifyInvokeAttr())) + .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + if (!CollectionUtils.isEmpty(requiredAttrMap)) { + requiredAttrMap.forEach((attrId, attrVO) -> { + //鍙湁浼佷笟缂栫爜锛岀姸鎬侊紝澶囨敞锛屾ā鏉夸富閿紝鍒嗙被涓婚敭杩欏嚑涓槸鍥哄畾鐨勶紝鍏朵綑閮芥槸鑷閰嶇疆鐨� + if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) { + throw new VciBaseException("灞炴�с�恵0}銆戝繀椤昏杈撳叆(閫夋嫨)鍐呭", new String[]{attrVO.getName()}); + } + }); + } + } + + /** + * 浠庣紪鐮佺敵璇蜂俊鎭璞′笂鑾峰彇鏌愪釜灞炴�х殑鍊� + * + * @param orderDTO 缂栫爜鐢宠瀵硅薄 + * @param attrId 灞炴�х殑缂栧彿 + * @return 鍊� + */ + private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) { + attrId = attrId.toLowerCase(Locale.ROOT); + String value = null; + if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) { + value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO)); + } else { + //璇存槑鏄嚜琛岄厤缃殑 + //鍓嶇蹇呴』瑕佷紶閫掑皬鍐欑殑灞炴�� + value = orderDTO.getData().getOrDefault(attrId, ""); + } + return value; + } + + /** + * 杞崲缁勫悎瑙勫垯鐨勫�� + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬� + * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� + */ + private void switchComponentAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) { + Map<String, CodeClassifyTemplateAttrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + if (!CollectionUtils.isEmpty(compAttrVOMap)) { + Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO); + + Map<String, String> dataLowMap = new HashMap<>(); + if (!CollectionUtils.isEmpty(dataMap)) { + dataMap.forEach((key, value) -> { + dataLowMap.put(key.toLowerCase(Locale.ROOT), value); + }); + } + dataLowMap.putAll(orderDTO.getData()); + compAttrVOMap.forEach((attrId, attrVO) -> { + dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentRule())); + }); + dataLowMap.forEach((key, value) -> { + setValueToOrderDTO(orderDTO, key, value); + }); + } + } + + + /** + * 璁剧疆鏂扮殑鍊煎埌鐢宠瀵硅薄涓� + * + * @param orderDTO 缂栫爜鐢宠瀵硅薄 + * @param attrId 灞炴�х殑缂栧彿 + * @param value 鍊� + */ + private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) { + attrId = attrId.toLowerCase(Locale.ROOT); + if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) { + WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value); + } else { + orderDTO.getData().put(attrId, value); + } + } + + /** + * 鏍¢獙姝e垯琛ㄨ揪寮忔槸鍚︽纭� + * + * @param templateVO 妯℃澘鐨勪俊鎭紝蹇呴』鍖呭惈灞炴�х殑鍐呭 + * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅 + */ + private void checkVerifyOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) { + Map<String, CodeClassifyTemplateAttrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + if (!CollectionUtils.isEmpty(verifyAttrVOMap)) { + verifyAttrVOMap.forEach((attrId, attrVO) -> { + String value = getValueFromOrderDTO(orderDTO, attrId); + if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyRule())) { + //鏍¢獙姝e垯琛ㄨ揪寮� + throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()}); + } + }); + } + } + + /** + * 鏍¢獙鍏抽敭灞炴�� + * + * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� + * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴�� + * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅 + */ + private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) { + //鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮� + CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); + //娉ㄦ剰鐨勬槸keyRuleVO鍙兘涓虹┖锛岃〃绀轰笉浣跨敤瑙勫垯鎺у埗 + //鑾峰彇鎵�鏈夌殑鍏抽敭灞炴�� + Map<String, CodeClassifyTemplateAttrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyAttrFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + Map<String, String> conditionMap = new HashMap<>(); + boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag()); + //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖ + boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag()); + boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag()); + boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag()); + ketAttrMap.forEach((attrId, attrVO) -> { + String value = getValueFromOrderDTO(orderDTO, attrId); + if (value == null) { + value = ""; + } + wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); + }); + + //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� + + if (!CollectionUtils.isEmpty(conditionMap)) { + final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; + conditionMap.forEach((key, value) -> { + sql[0] += " and " + key + " = " + value; + }); + if (StringUtils.isNotBlank(orderDTO.getOid())) { + //淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸� + sql[0] += " and oid != '" + orderDTO.getOid() + "'"; + } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) { + sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'"; + } + sql[0] += " and islastR = '1' and islastV = '1' "; +// if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) { + if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) { + String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}"; + String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"}; + throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs); + } + } + } + + /** + * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞 + * + * @param value 褰撳墠鐨勫�� + * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌� + * @param attrId 灞炴�х殑缂栧彿 + * @param trim 鏄惁鍘婚櫎绌烘牸 + * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓 + * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙� + * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸 + * @param conditionMap 鏌ヨ鏉′欢 + */ + @Override + public void wrapperKeyAttrConditionMap(String value, CodeKeyAttrRepeatVO keyRuleVO, String attrId, + boolean trim, boolean ignoreCase, boolean ignoreWidth, + boolean trimAll, Map<String, String> conditionMap) { + boolean ignoreSpace = trim || trimAll; + if (StringUtils.isBlank(value)) { + //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜� + conditionMap.put("t."+attrId, "null"); + } else { + if (keyRuleVO != null) { + String queryKey = ""; + String queryValue = ""; + + String temp = ""; + if (ignoreCase && ignoreSpace && ignoreWidth) { + //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙� + temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")"); + } else if (ignoreCase && ignoreSpace && !ignoreWidth) { + //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� + temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")"); + } else if (ignoreCase && !ignoreSpace && ignoreWidth) { + //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 + temp = "UPPER(to_single_byte(%s))"; + } else if (!ignoreCase && ignoreSpace && ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅 + temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")"); + } else if (ignoreCase && !ignoreSpace && !ignoreWidth) { + //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� + temp = "UPPER(%s)"; + } else if (!ignoreCase && !ignoreCase && ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 + temp = "to_single_byte(%s)"; + } else if (!ignoreCase && ignoreSpace && !ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� + temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")"); + } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� + temp = "%s"; + } + queryKey = String.format(temp, "t."+attrId); + queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'"); + conditionMap.put(queryKey, queryValue); + } else { + //涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅 + conditionMap.put("t."+attrId, value); + } + } + } + + /** + * 鏍¢獙鏋氫妇鐨勫唴瀹� + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬� + * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� + */ + private void checkEnumOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) { + //濡傛灉鏋氫妇鍙互淇敼锛屽垯涓嶉渶瑕佹牎楠屾槸鍚︾鍚堟灇涓剧殑閫夐」 + + Map<String, CodeClassifyTemplateAttrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumString()) || StringUtils.isNotBlank(s.getEnumId())) && !VciBaseUtil.getBoolean(s.getEnumEditFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + if (!CollectionUtils.isEmpty(enumAttrVOMap)) { + enumAttrVOMap.forEach((attrId, attrVO) -> { + String value = getValueFromOrderDTO(orderDTO, attrId); + if (StringUtils.isNotBlank(value)) { + //鏈夊�兼墠鑳芥牎楠� + List<KeyValue> comboboxKVs = listComboboxItems(attrVO); + if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) { + throw new VciBaseException("灞炴�с�恵0}銆戠殑鍊间笉绗﹀悎鏋氫妇鐨勮姹�", new String[]{attrVO.getName()}); + } + } + }); + } + } + + /** + * 杞崲鏃堕棿鐨勬牸寮� + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬� + * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� + */ + private void switchDateAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) { + Map<String, CodeClassifyTemplateAttrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodeDateFormat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + if (!CollectionUtils.isEmpty(dateAttrVOMap)) { + dateAttrVOMap.forEach((attrId, attrVO) -> { + String value = getValueFromOrderDTO(orderDTO, attrId); + if (StringUtils.isNotBlank(value)) { + DateConverter dateConverter = new DateConverter(); + dateConverter.setAsText(value); + value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat); + setValueToOrderDTO(orderDTO, attrId, value); + } + }); + } + } + + /** + * 鎷疯礉鏁版嵁鍒癱bo瀵硅薄涓� + * + * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� + * @param cbo 涓氬姟鏁版嵁 + * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� + * @param templateVO 妯℃澘鐨勬樉绀哄璞� + * @param edit 鏄惁涓轰慨鏀� + */ + private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupinEntity cbo, + CodeOrderDTO orderDTO, CodeClassifyTemplateVO templateVO, + boolean edit) { + String fullPath = ""; + if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) { + fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))) + .map(CodeClassifyVO::getOid).collect(Collectors.joining("##")); + } else { + fullPath = classifyFullInfo.getCurrentClassifyVO().getOid(); + } + +// BeanUtils. + BeanUtils.copyProperties(orderDTO.getData(),cbo); + cbo.setMaterialtype(Short.valueOf("1001")); +// orderDTO.getData().forEach((key, value) -> { +// if (!edit || (!checkUnAttrUnEdit(key) && +// !VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) { +// try { +// cbo.setAttributeValue(key, value); +// } catch (Exception e) { +// logger.error("璁剧疆灞炴�х殑鍊奸敊璇�", e); +// } +// } +// }); + try { + + cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid()); + cbo.setCodetemplateoid(templateVO.getOid()); + cbo.setCodeclsfpath(fullPath); +// cbo.setMaterialclassify("model_type"); +// cbo.setMaterialname(orderDTO.getData().get("materialname")); +// cbo.setShifoupihaoguanli("true"); +// cbo.setKucunwl("true"); +// cbo.setXiaoshouwl("false"); + if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) { + //鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐪嬬敓鍛藉懆鏈熸槸鍚﹂渶瑕佸垱寤� + if (StringUtils.isNotBlank(cbo.getLctid())) { +// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid()); +// if (lifeCycleVO != null) { +// cbo.setLcStatus("Editing"); +//// cbo.setLcStatus(lifeCycleVO.getStartStatus()); +// } else { + cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); +// } + } else { + cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); + } + + } + + int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString()); + //鎻掍釜鐐癸紝鍚庣画鐪嬪瘑绾ф湇鍔℃槸鍚﹀彲鐢� +// if (secret == 0 || !secretService.checkDataSecret(secret)) { + if (secret == 0 ) { + Integer userSecret = VciBaseUtil.getCurrentUserSecret(); +// cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret)); + cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret); + } + } catch (Throwable e) { + logger.error("璁剧疆榛樿鐨勫睘鎬х殑鍊奸敊璇�", e); + } + } + + + /** + * 鍒濆鍖栦笟鍔$被鍨� + * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊 + * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐� + * @return CodeWupinEntity + * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父 + */ + @Override + public CodeWupinEntity createCBOByBtmName(String btmName) + throws VciBaseException { + if(btmName!=null){ + btmName = btmName.trim().toLowerCase(); + } + String userid = AuthUtil.getUser().getUserName(); +// if(!hasCreatedCbos.containsKey(btmName)){ +// if(StringUtils.isEmpty(userid)){ +// throw new VciBaseException(msgCodePrefix +"noHasUserid"); +// } +// try { +// hasCreatedCbos.put(btmName, createBusinessObject(btmName)); +// } catch (Exception e) { +// logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄",e); +// throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); +// } +// } +// ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); + + QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>(); + btmWrapper.eq("ID",btmName); + CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper); +// OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); + String userName = AuthUtil.getUser().getUserName(); + CodeWupinEntity wupinEntity = new CodeWupinEntity(); + wupinEntity.setOid(null); +// bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); +// bo.setNameoid((new ObjectUtility()).getNewObjectID36()); + wupinEntity.setBtmname(btmName); + wupinEntity.setLastR(String.valueOf(1)); + wupinEntity.setFirstR(String.valueOf(1)); + wupinEntity.setFirstV(String.valueOf(1)); + wupinEntity.setLastV(String.valueOf(1)); + wupinEntity.setCreator(userName); + wupinEntity.setCreateTime(new Date()); + wupinEntity.setLastModifier(userName); + wupinEntity.setLastModifyTime(new Date()); + wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid()); + wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); + if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){ + //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1 +// OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid()); + wupinEntity.setRevisionValue("1"); + } + + wupinEntity.setRevisionSeq(1); + wupinEntity.setVersionSeq(1); + //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1 + wupinEntity.setVersionValue("1"); + wupinEntity.setLctid("wupinLC"); + wupinEntity.setLcStatus("Editing"); + wupinEntity.setId(""); + wupinEntity.setName(""); + wupinEntity.setDescription(""); + wupinEntity.setOwner(userName); + wupinEntity.setCheckinby(userName); + wupinEntity.setCopyFromVersion(""); + wupinEntity.setMaterialtype((short) 1001); + wupinEntity.setCaigouwl("true"); + wupinEntity.setShifoupihaoguanli("true"); + wupinEntity.setKucunwl("true"); + wupinEntity.setXiaoshouwl("false"); + wupinEntity.setPassing("true"); + +// this.initTypeAttributeValue(wupinEntity,btmTypeVO); + return wupinEntity; + + +// return cbo; + } + + /** + * 鏄惁涓轰慨鏀瑰拷鐣ョ殑灞炴�� + * @param attrName 灞炴�х殑鍚嶅瓧 + * @return true 琛ㄧず搴旇蹇界暐 + */ + boolean checkUnAttrUnEdit(String attrName){ + return (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName) + ||"ts".equalsIgnoreCase(attrName) + || "lastmodifier".equalsIgnoreCase(attrName) + || "lastmodifytime".equalsIgnoreCase(attrName) + || "createtime".equalsIgnoreCase(attrName) + || "checkintime".equalsIgnoreCase(attrName) + ||"checkouttime".equalsIgnoreCase(attrName)); + } + + /** + * 淇濆瓨鍙緭鍙�夌殑淇℃伅 + * + * @param templateVO 妯℃澘鐨勫璞� + * @param cboList 鏁版嵁鐨勫唴瀹� + */ + @Override + public void batchSaveSelectChar(CodeClassifyTemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ + List<String> cboList) { + if (templateVO != null && !CollectionUtils.isEmpty(cboList)) { + //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜� + List<CodeClassifyTemplateAttrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryIdentification())).collect(Collectors.toList()); + + if (!CollectionUtils.isEmpty(selectAttrVOs)) { +// SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); + selectAttrVOs.parallelStream().forEach(attrVO -> { + List<String> valuesList = cboList; +// cboList.parallelStream().forEach(cbo -> { +// String value = cbo.get.getAttributeValue(attrVO.getId()); +// if (StringUtils.isNotBlank(value)) { +// valuesList.add(value); +// } +// }); + if (!CollectionUtils.isEmpty(valuesList)) { + for (String s : valuesList) { + DictBiz dictBiz = new DictBiz(); + dictBiz.setCode(templateVO.getBtmTypeId()); + dictBiz.setDictKey(s); + dictBiz.setDictValue(s); + //浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜� + iDictBizClient.getCheck(dictBiz); + } +// charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo); + } + }); + } + } + } + + @Override + public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) { + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid); + MdmUIInfoVO uiInfoVO = new MdmUIInfoVO(); + uiInfoVO.setTemplateVO(templateVO); + uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid)); + wrapperResemble(templateVO, uiInfoVO); + return uiInfoVO; + } + + + /** + * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟瀹氫箟鐨勪俊鎭� + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞� + * @param codeClassifyOid 鍒嗙被鐨勪富閿紝涓虹┖鐨勬椂鍊欙紝鑾峰彇妯℃澘鎵�灞炵殑鍒嗙被涓婚敭.鐢ㄤ簬浜х敓鍒嗙被娉ㄥ叆 + * @return 琛ㄦ牸鐨勪俊鎭� + */ + private UIFormDefineVO wrapperFormDefineByTemplate(CodeClassifyTemplateVO templateVO, String codeClassifyOid) { + UIFormDefineVO formDefineVO = new UIFormDefineVO(); + formDefineVO.setOid(templateVO.getOid()); + formDefineVO.setBtmType(templateVO.getBtmTypeId()); + if (StringUtils.isBlank(codeClassifyOid)) { + codeClassifyOid = templateVO.getCodeclassifyoid(); + } + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); + + List<UIFormItemVO> itemVOS = new ArrayList<>(); + Map<String, List<CodeClassifyTemplateAttrVO>> attrGroupMap = templateVO.getAttributes().stream(). + filter(s -> StringUtils.isNotBlank(s.getAttributeGroup())).collect(Collectors.groupingBy(s -> s.getAttributeGroup())); + + templateVO.getAttributes().forEach(attrVO -> { + UIFormItemVO formItemVO = templateAttr2FormField(attrVO, templateVO.getBtmTypeId()); + itemVOS.add(formItemVO); + }); + //澶勭悊灞炴�у垎缁� + if (!CollectionUtils.isEmpty(attrGroupMap)) { + //鎸夌収鍒嗙粍鐨勫睘鎬ф帓鍒楋紝鎵惧埌姣忎竴涓垎缁勭殑绗竴涓睘鎬� + for (String key : attrGroupMap.keySet()) { + List<CodeClassifyTemplateAttrVO> value = attrGroupMap.get(key); + //鎵惧埌杩欎釜鍒嗙粍鐨勫睘鎬х殑绗竴涓� + CodeClassifyTemplateAttrVO attrVO = value.stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).findFirst().get(); + //鎴戜滑鎵惧埌杩欎釜灞炴�у湪鏈�缁堢殑itemVOs閲岀殑浣嶇疆 + UIFormItemVO lineVO = new UIFormItemVO(); + lineVO.setField(attrVO.getId() + "_line"); + lineVO.setType("line"); + lineVO.setText(key); + //鎵句綅缃� + for (int i = 0; i < itemVOS.size(); i++) { + UIFormItemVO record = itemVOS.get(i); + if (record.getField().equalsIgnoreCase(attrVO.getId())) { + itemVOS.add(i, lineVO); + break; + } + } + } + } + + CodeOrderDTO orderDTO = new CodeOrderDTO(); + switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); + if (!CollectionUtils.isEmpty(orderDTO.getData())) { + orderDTO.getData().forEach((key, value) -> { + for (int i = 0; i < itemVOS.size(); i++) { + UIFormItemVO itemVO = itemVOS.get(i); + if (itemVO.getField().equalsIgnoreCase(key)) { + itemVO.setDefaultValue(value); + break; + } + } + }); + } + formDefineVO.setItems(itemVOS); + //鏌ヨ鏄惁鏈夊垎绫绘敞鍏ョ殑 + return formDefineVO; + } + /** + * 灞炴�х被鍨嬩笌js涓殑瀛楁绫诲瀷鐨勬槧灏� + */ + private static Map<String, String> vciFieldTypeMap = new HashMap<String, String>() {{ + put(VciFieldTypeEnum.VTString.name(), "text"); + put(VciFieldTypeEnum.VTInteger.name(), "text"); + put(VciFieldTypeEnum.VTLong.name(), "text"); + put(VciFieldTypeEnum.VTDouble.name(), "text"); + put(VciFieldTypeEnum.VTClob.name(), "text"); + put(VciFieldTypeEnum.VTBoolean.name(), "truefalse"); + put(VciFieldTypeEnum.VTDateTime.name(), "datetime"); + put(VciFieldTypeEnum.VTDate.name(), "datetime"); + put(VciFieldTypeEnum.VTTime.name(), "datetime"); + put(VciFieldTypeEnum.VTFilePath.name(), "file"); + }}; + + /** + * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟鐨勫瓧娈� + * + * @param attrVO 妯℃澘灞炴�� + * @param btmType 涓氬姟绫诲瀷 + * @return 琛ㄥ崟鐨勫瓧娈� + */ + @Override + public UIFormItemVO templateAttr2FormField(CodeClassifyTemplateAttrVO attrVO, String btmType) { + + UIFormItemVO itemVO = new UIFormItemVO(); + if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) { +// attrVO.setEnumid(OsEnumServiceImpl.MY_DATA_SECRET); + attrVO.setEnumId(MY_DATA_SECRET); + } + itemVO.setField(attrVO.getId()); + itemVO.setText(attrVO.getName()); + itemVO.setType(vciFieldTypeMap.getOrDefault(attrVO.getAttributeDataType(), "text")); + if (VciBaseUtil.getBoolean(attrVO.getTextAreaFlag())) { + itemVO.setType("textarea"); + } + if (VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(attrVO.getAttributeDataType()) + || VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(attrVO.getAttributeDataType()) + || VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrVO.getAttributeDataType())) { + itemVO.setVerify("number"); + } + itemVO.setReadOnly(VciBaseUtil.getBoolean(attrVO.getReadOnlyFlag())); + itemVO.setKeyAttr(VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag())); + itemVO.setRequired(VciBaseUtil.getBoolean(attrVO.getRequireFlag())); + itemVO.setDefaultValue(attrVO.getDefaultValue()); + itemVO.setDateFormate(attrVO.getCodeDateFormat()); + itemVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormDisplayFlag())); + itemVO.setVerify(attrVO.getVerifyRule()); + itemVO.setPrefix(attrVO.getPrefixValue()); + itemVO.setSuffix(attrVO.getSuffixValue()); + itemVO.setTooltips(attrVO.getExplain()); + itemVO.setSelectLibFlag(attrVO.getLibraryIdentification()); + //鐪嬬湅鏄惁鏈夋灇涓� + if ((StringUtils.isNotBlank(attrVO.getEnumString()) + && !"[]".equalsIgnoreCase(attrVO.getEnumString())) || + StringUtils.isNotBlank(attrVO.getEnumId())) { + itemVO.setType("combox"); + itemVO.setComboxKey(attrVO.getEnumId()); + if (StringUtils.isNotBlank(attrVO.getEnumString())) { + //鎸囧畾鐨勪笅鎷夋鍐呭 + itemVO.setData(JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class)); + if (StringUtils.isBlank(attrVO.getEnumId())) { + itemVO.setComboxKey(itemVO.getField() + "_data"); + } + } + } + //鐪嬫槸鍚︽湁鍙傜収 + if (StringUtils.isNotBlank(attrVO.getReferBtmId()) || StringUtils.isNotBlank(attrVO.getReferConfig())) { + itemVO.setType("refer"); + itemVO.setShowField(itemVO.getField() + "name"); + if (StringUtils.isNotBlank(attrVO.getReferConfig())) { + //閰嶇疆鐨勫唴瀹� + itemVO.setReferConfig(JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class)); + } else { + UIFormReferVO formReferVO = new UIFormReferVO(); + formReferVO.setType("default"); + formReferVO.setReferType(attrVO.getReferBtmId()); + itemVO.setReferConfig(formReferVO); + } + } + + //濡傛灉鏄粍鍚堣鍒欙紝鍒嗙被娉ㄥ叆鐨勶紝鏄剧ず涓哄彧璇� + if (StringUtils.isNotBlank(attrVO.getComponentRule())) { + itemVO.setReadOnly(true); + itemVO.setTooltips("鏈睘鎬т负缁勫悎瑙勫垯"); + itemVO.setRequired(false); + } + if (StringUtils.isNotBlank(attrVO.getClassifyInvokeAttr())) { + itemVO.setReadOnly(!VciBaseUtil.getBoolean(attrVO.getClassifyInvokeEditFlag())); + itemVO.setTooltips("鏈睘鎬ф槸鍒嗙被娉ㄥ叆"); + itemVO.setRequired(false); + } + + if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(itemVO.getField())) { + //鏄敓鍛藉懆鏈熺姸鎬� + itemVO.setType("combox"); + itemVO.setComboxKey(btmType + LC_STATUS_SUBFIX); + } + return itemVO; + } + + + /** + * 灏佽鐩镐技椤规煡璇㈢殑鍒楄〃 + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞� + * @param uiInfoVO 椤甸潰鐨勪俊鎭� + */ + private void wrapperResemble(CodeClassifyTemplateVO templateVO, MdmUIInfoVO uiInfoVO) { + List<CodeClassifyTemplateAttrVO> resembleAttrList = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSameRepeatAttrFlag()) + || VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(resembleAttrList) && resembleAttrList.size() > 1) { + UITableDefineVO resembleTable = new UITableDefineVO(); + resembleTable.setOid(templateVO.getOid()); + resembleTable.setBtmType(templateVO.getBtmTypeId()); + resembleTable.setDisplayQueryArea(false); + resembleTable.setPageVO(new UITablePageVO()); + //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌 + List<UITableFieldVO> fieldVOList = new ArrayList<>(); + resembleAttrList.forEach(attrVO -> { + UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO,false); + tableFieldVO.setHidden(false); + fieldVOList.add(tableFieldVO); + }); + List<List<UITableFieldVO>> cols = new ArrayList<>(); + cols.add(fieldVOList); + resembleTable.setCols(cols); + uiInfoVO.setResembleTableVO(resembleTable); + } + } + + + /** + * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸鏄剧ず鐨勯厤缃� + * + * @param attrVO 妯℃澘灞炴�� + * @param forEdit 鏄惁鏄紪杈戞墍闇� + * @return 琛ㄦ牸鐨勫瓧娈� + */ + @Override + public UITableFieldVO templateAttr2TableField(CodeClassifyTemplateAttrVO attrVO,boolean forEdit) { + UITableFieldVO fieldVO = new UITableFieldVO(); + if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) { + attrVO.setEnumId(MY_DATA_SECRET); + } + fieldVO.setField(attrVO.getId()); + fieldVO.setTitle(attrVO.getName()); + fieldVO.setFieldType(vciFieldTypeMap.getOrDefault(attrVO.getAttributeDataType(), "text")); + fieldVO.setSort(true); + fieldVO.setSortField(fieldVO.getField()); + fieldVO.setQueryField(fieldVO.getField()); + if (forEdit){ + fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormDisplayFlag())); + }else { + fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getTableDisplayFlag())); + } + if (attrVO.getAttrTableWidth() != null && attrVO.getAttrTableWidth() > 0) { + fieldVO.setMinWidth(Integer.valueOf(attrVO.getAttrTableWidth())); + fieldVO.setWidth(Integer.valueOf(attrVO.getAttrTableWidth())); + } + //鐪嬬湅鏄惁鏈夋灇涓� + if ((StringUtils.isNotBlank(attrVO.getEnumString()) + && !"[]".equalsIgnoreCase(attrVO.getEnumString())) || + StringUtils.isNotBlank(attrVO.getEnumId())) { + fieldVO.setFieldType("combox"); + fieldVO.setField(fieldVO.getField() + "Text"); + fieldVO.setComboxKey(attrVO.getEnumId()); + if (StringUtils.isNotBlank(attrVO.getEnumString())) { + //鎸囧畾鐨勪笅鎷夋鍐呭 + fieldVO.setData(JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class)); + if (StringUtils.isBlank(attrVO.getEnumId())) { + fieldVO.setComboxKey(fieldVO.getField() + "_data"); + } + }else { +// List<KeyValue> osEnumItemVOList= enumService.getEnum(attrVO.getEnumId()); +// fieldVO.setData(osEnumItemVOList); + } + } + //鐪嬫槸鍚︽湁鍙傜収 + if (StringUtils.isNotBlank(attrVO.getReferBtmId()) || StringUtils.isNotBlank(attrVO.getReferConfig())) { + fieldVO.setFieldType("refer"); + fieldVO.setQueryField(fieldVO.getField()); + fieldVO.setField(fieldVO.getField() + "name"); + fieldVO.setShowField(fieldVO.getField()); + if (StringUtils.isNotBlank(attrVO.getReferConfig())) { + //閰嶇疆鐨勫唴瀹� + fieldVO.setReferConfig(JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class)); + } else { + UIFormReferVO formReferVO = new UIFormReferVO(); + formReferVO.setType("default"); + formReferVO.setReferType(attrVO.getReferBtmId()); + fieldVO.setReferConfig(formReferVO); + } + } + if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(fieldVO.getSortField())) { + fieldVO.setField("lcstatus_text"); + } + Map<String, String> eventJsMap = new HashMap<>(); + //瓒呴摼鎺ヤ笌妯℃澘鏄簰鏂� + if (StringUtils.isNotBlank(attrVO.getTableHref())) { + String event = fieldVO.getSortField() + "_href"; + eventJsMap.put(event, attrVO.getTableHref()); + fieldVO.setTemplet("function(d){ return '<a class=\"layui-btn layui-btn-intable \" lay-event=\"" + event + "\">d." + fieldVO.getField() + "</a>';}"); + } + if (StringUtils.isNotBlank(attrVO.getTableDisplayJs())) { + //鐩存帴鍐檉unction(d){ return xxxxx;} + fieldVO.setTemplet(attrVO.getTableDisplayJs()); + } + if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributeDataType())) { + fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}"); + } + fieldVO.setOptionJsMap(eventJsMap); + fieldVO.setStyle(attrVO.getTableDisplayStyle()); + //鍒楄〃閲屼笉鍏佽鐩存帴缂栬緫 + fieldVO.setDateFormate(attrVO.getCodeDateFormat()); + return fieldVO; + } + + + /** + * 鐩镐技椤规煡璇� + * + * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭� + * @return 鏁版嵁鍒楄〃 + */ + @Override + public DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO) { + VciBaseUtil.alertNotNull(orderDTO, "鐢宠鐨勪俊鎭�", orderDTO.getCodeClassifyOid(), "鍒嗙被涓婚敭", orderDTO.getTemplateOid(), "妯℃澘涓婚敭"); + CodeClassifyFullInfoBO fullInfoBO = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); + switchClassifyLevelOnOrder(templateVO, fullInfoBO, orderDTO); + switchDateAttrOnOrder(templateVO, orderDTO); + switchComponentAttrOnOrder(templateVO, orderDTO); + //闇�瑕佽幏鍙栨槸鍚︽湁鐩镐技鏌ヨ灞炴�� + Map<String, CodeClassifyTemplateAttrVO> attrVOs = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSameRepeatAttrFlag())).collect(Collectors.toMap(s -> s.getId(), t -> t)); + if (CollectionUtils.isEmpty(attrVOs)) { + //閮芥病鏈夊睘鎬э紝鑲畾涓嶈兘鏌ヨ浜� + return new DataGrid<>(); + } + Map<String, String> conditionMap = new HashMap<>(); + //鎴戜滑棣栧厛鑾峰彇鏈夋病鏈夋煡璇㈣鍒� + CodeResembleRuleVO resembleRuleVO = Optional.ofNullable(getUseResembleRule(fullInfoBO, fullInfoBO.getCurrentClassifyVO())).orElseGet(() -> new CodeResembleRuleVO()); + attrVOs.forEach((attrId, attrVO) -> { + String value = getValueFromOrderDTO(orderDTO, attrId); + if (value == null) { + value = ""; + } + wrapperResembleConditionMap(value, resembleRuleVO, attrId, conditionMap); + }); + + //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� + if (!CollectionUtils.isEmpty(conditionMap)) { + Map<String, String> andConditionMap = new HashMap<>(); + andConditionMap.put("islastr", "1"); + andConditionMap.put("islastv", "1"); + if (StringUtils.isNotBlank(orderDTO.getOid())) { + andConditionMap.put("oid", QueryOptionConstant.NOTEQUAL + orderDTO.getOid()); + } + conditionMap.putAll(andConditionMap); + PageHelper pageHelper = new PageHelper(-1); + pageHelper.addDefaultDesc("id"); + return queryGrid(fullInfoBO.getTopClassifyVO().getBtmtypeid(), templateVO, conditionMap, pageHelper); + } + return new DataGrid<>(); + } + + /** + * 鑾峰彇浣跨敤鐨勭浉浼兼煡璇㈣鍒� + * + * @param fullInfoBO 绫诲叏閮ㄤ俊鎭� + * @param currentClassifyVO 褰撳墠鐨勫垎绫� + * @return 瑙勫垯锛屽鏋滀笉瀛樺湪浼氳繑鍥濶ull + */ + @Override + public CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO) { + if (currentClassifyVO == null) { + return null; + } + if (currentClassifyVO != null && StringUtils.isNotBlank(currentClassifyVO.getCodeResembleRuleOid())) { + //璇存槑宸茬粡瀛樺湪 + return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid()); + } + if (StringUtils.isBlank(currentClassifyVO.getParentcodeclassifyoid())) { + return null; + } + Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); + return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentcodeclassifyoid(), null)); + } + + /** + * 灏佽鐩镐技椤规煡璇㈢殑鏌ヨ鏉′欢鐨勬槧灏� + * + * @param value 鍊� + * @param resembleRuleVO 鐩镐技椤硅鍒� + * @param attrId 灞炴�х殑缂栧彿 + * @param conditionMap 鏌ヨ鏉′欢 + */ + @Override + public void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap) { + boolean ignoreSpace = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorespaceflag()) || VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); + if (StringUtils.isBlank(value)) { + //涓虹┖鐨勬椂鍊欏氨涓嶆煡璇㈠畠灏辨槸 + } else { + String queryKey = ""; + String queryValue = ""; + boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag()); + boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag()); + boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); + boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); + String temp = ""; + if (ignoreCase && ignoreSpace && ignoreWidth) { + //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙� + temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte('%s')) " + (trimAll ? ",' ','')" : ")"); + } else if (ignoreCase && ignoreSpace && !ignoreWidth) { + //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� + temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")"); + } else if (ignoreCase && !ignoreSpace && ignoreWidth) { + //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 + temp = "UPPER(to_single_byte('%s'))"; + } else if (!ignoreCase && ignoreSpace && ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅 + temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte('%s') " + (trimAll ? ",' ','')" : ")"); + } else if (ignoreCase && !ignoreSpace && !ignoreWidth) { + //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� + temp = "UPPER(%s)"; + } else if (!ignoreCase && !ignoreCase && ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 + temp = "to_single_byte('%s')"; + } else if (!ignoreCase && ignoreSpace && !ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� + temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")"); + } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) { + //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� + temp = "%s"; + } + if (StringUtils.isNotBlank(resembleRuleVO.getLinkCharacter())) { + List<String> chars = VciBaseUtil.str2List(resembleRuleVO.getLinkCharacter()); + for (int i = 0; i < chars.size(); i++) { + String s = chars.get(i); + temp = "replace(" + temp + ",'" + s + "','')"; + } + } + queryValue = String.format(temp, (trim ? value.trim() : value)); + temp = temp.replace("to_single_byte('%s')","to_single_byte(%s)"); + queryKey = String.format(temp, "t."+attrId); + conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue); + } + } + + + /** + * 鏌ヨ缂栫爜鏁版嵁鐨勫垪琛� + * + * @param btmType 涓氬姟绫诲瀷 + * @param templateVO 妯℃澘鐨勫璞★紝闇�瑕佸寘鍚ā鏉跨殑灞炴�� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉瀵硅薄 + * @return 鏁版嵁鍒楄〃 + */ + @Override + public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) { + CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper); +// List<Map> maps = boService.queryByOnlySqlForMap(sqlBO.getSqlHasPage()); + List<Map> maps = commonsMapper.selectBySql(sqlBO.getSqlHasPage()); + DataGrid<Map<String, String>> dataGrid = new DataGrid<>(); + List<Map<String, String>> dataList = new ArrayList<>(); + if (!CollectionUtils.isEmpty(maps)) { + maps.stream().forEach(map -> { + Map<String, String> data = new HashMap<>(); + map.forEach((key, value) -> { + data.put(((String) key).toLowerCase(Locale.ROOT), (String) value); + }); + dataList.add(data); + }); + } + dataGrid.setData(dataList); + if (!CollectionUtils.isEmpty(dataList)) { + wrapperData(dataGrid.getData(), templateVO, sqlBO.getSelectFieldList(), false); + dataGrid.setTotal(Long.parseLong(commonsMapper.selectBySql(sqlBO.getSqlCount()).get(0).values().toArray()[0].toString())); + } + return dataGrid; + } + + + /** + * 灏佽鏌ヨ鍑烘潵鐨勬暟鎹� + * + * @param dataMap 鏁版嵁鐨勬槧灏� + * @param templateVO 妯℃澘鐨勫睘鎬� + * @param onlySelectAttrIdList 浠呬粎鏌ヨ鐨勫睘鎬у瓧娈� + * @param form 琛ㄥ崟閲屼娇鐢� + */ + @Override + public void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO, + Collection<String> onlySelectAttrIdList, boolean form) { + if (onlySelectAttrIdList == null) { + onlySelectAttrIdList = new ArrayList<>(); + } + //鍏堣浆鎹竴涓嬫椂闂存牸寮� + List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList()); + List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = templateVO.getAttributes().stream().filter( + s -> StringUtils.isNotBlank(s.getCodeDateFormat()) && + (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) + ).collect(Collectors.toList()); + //鏋氫妇鐨勫唴瀹� + List<CodeClassifyTemplateAttrVO> enumAttrVOs = templateVO.getAttributes().stream().filter( + s -> (StringUtils.isNotBlank(s.getEnumId()) || StringUtils.isNotBlank(s.getEnumString())) + && + (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) + ).collect(Collectors.toList()); + + List<String> userIds = new ArrayList<>(); + dataMap.stream().forEach(data -> { + //澶勭悊鏃堕棿 + if (!form) { + //琛ㄥ崟鐨勬椂鍊欏彧鑳界敤缁熶竴鐨勬椂闂存牸寮� + wrapperDateFormat(dateFormatAttrVOs, data); + } + //澶勭悊鏋氫妇 + wrapperEnum(enumAttrVOs, data); + String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD); + String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION,""); + if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus)) + && StringUtils.isBlank(copyFromVersion) + ) { + data.put(VciQueryWrapperForDO.ID_FIELD, "******"); + } + data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), CodeDefaultLC.getTextByValue(lcstatus)); + if(CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) + && StringUtils.isNotBlank(copyFromVersion)){ + data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), "淇敼涓�"); + } + if (data.containsKey("creator")) { + userIds.add(data.get("creator")); + } + if (data.containsKey("lastmodifier")) { + userIds.add(data.get("lastmodifier")); + } + }); + if (!CollectionUtils.isEmpty(userIds)) { +// Map<String, SmUserVO> userVOMap = Optional.ofNullable(userQueryService.listUserByUserIds(userIds)).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); +// dataMap.stream().forEach(data -> { +// String creator = data.getOrDefault("creator", null); +// if (StringUtils.isNotBlank(creator) && userVOMap.containsKey(creator.toLowerCase(Locale.ROOT))) { +// data.put("creator", creator + "(" + userVOMap.get(creator.toLowerCase(Locale.ROOT)).getName() + ")"); +// } +// String lastmodifier = data.getOrDefault("lastmodifier", null); +// if (StringUtils.isNotBlank(lastmodifier) && userVOMap.containsKey(lastmodifier.toLowerCase(Locale.ROOT))) { +// data.put("lastmodifier", lastmodifier + "(" + userVOMap.get(lastmodifier.toLowerCase(Locale.ROOT)).getName() + ")"); +// } +// }); + } + } + + + /** + * 澶勭悊鏃堕棿鏍煎紡 + * + * @param dateFormatAttrVOs 鏃堕棿鏍煎紡鐨勫睘鎬� + * @param data 褰撳墠琛屾暟鎹� + */ + private void wrapperDateFormat(Collection<CodeClassifyTemplateAttrVO> dateFormatAttrVOs, Map<String, String> data) { + if (!CollectionUtils.isEmpty(dateFormatAttrVOs)) { + dateFormatAttrVOs.stream().forEach(dateFormatAttrVO -> { + String attrId = dateFormatAttrVO.getId().toLowerCase(Locale.ROOT); + String oldValue = data.getOrDefault(attrId, null); + if (StringUtils.isNotBlank(oldValue)) { + DateConverter dateConverter = new DateConverter(); + try { + dateConverter.setAsText(oldValue); + Date value = dateConverter.getValue(); + if (value != null) { + data.put(attrId, VciDateUtil.date2Str(value, dateFormatAttrVO.getCodeDateFormat())); + } + } catch (Throwable e) { + //杞崲鍙兘鏈夐棶棰橈紝杩欏氨浣跨敤鍘熸湰瀛樺偍鐨勫�� + } + } + }); + } + } + + + /** + * 澶勭悊鏋氫妇鐨勫唴瀹癸紝濡傛灉涓嶅湪鏋氫妇涓紝浼氳繑鍥炲師鏈殑鍊� + * + * @param enumAttrVOs 鏋氫妇灞炴�� + * @param data 褰撳墠琛屾暟鎹� + */ + private void wrapperEnum(Collection<CodeClassifyTemplateAttrVO> enumAttrVOs, Map<String, String> data) { + //澶勭悊鏋氫妇鐨勫唴瀹癸紝涓轰簡鍏煎浠ュ墠鐨勬暟鎹�,濡傛灉鏁版嵁涓嶈兘浣跨敤鏋氫妇杞崲鐨勮瘽锛岄偅杩樻槸鏄剧ず浠ュ墠鐨勫�� + if (!CollectionUtils.isEmpty(enumAttrVOs)) { + enumAttrVOs.stream().forEach(enumAttrVO -> { + String attrId = enumAttrVO.getId().toLowerCase(Locale.ROOT); + String oldValue = data.getOrDefault(attrId, null); + if (StringUtils.isNotBlank(oldValue)) { + List<KeyValue> comboxKVs = listComboboxItems(enumAttrVO); + String newValue = oldValue; + KeyValue keyValue = Optional.ofNullable(comboxKVs).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getKey().equalsIgnoreCase(oldValue)).findFirst().orElseGet(() -> null); + if (keyValue != null) { + newValue = keyValue.getValue(); + } + data.put(attrId + "Text", newValue); + } + }); + } + } + + + /** + * 鏍规嵁妯℃澘灞炴�х敓鎴愮浉搴旂殑sql淇℃伅 + * + * @param btmType 涓氬姟绫诲瀷 + * @param templateVO 妯℃澘鏄剧ず瀵硅薄锛屽繀椤诲寘鍚睘鎬� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉鍜屾帓搴忓璞� + * @return sql鐨勭浉鍏充俊鎭� + */ + @Override + public CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) { + //鍥犱负鍙傜収涓嶄竴瀹氭槸鍦ㄥ钩鍙扮殑灞炴�ф睜閲岄潰璁剧疆锛屾墍浠ユ垜浠緱闇�瑕佽嚜琛屽鐞� + //鍙傝�僔ciQueryWrapper鏉ュ鐞� + //1. 鎵惧埌鎵�鏈夌殑瀛楁锛� + Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + List<String> selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList()); + + //鎵�鏈夌殑鍙傜収鐨勫瓧娈� + Map<String/**灞炴�у瓧娈�**/, String> joinTableList = new ConcurrentHashMap<>(); + 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<>(); + if (!CollectionUtils.isEmpty(referAttrVOs)) { + referAttrVOs.parallelStream().forEach(attrVO -> { + UIFormReferVO referVO = null; + if (StringUtils.isNotBlank(attrVO.getReferConfig())) { + referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class); + } else { + referVO = new UIFormReferVO(); + referVO.setReferType(attrVO.getReferBtmId()); + referVO.setValueField(VciQueryWrapperForDO.OID_FIELD); + referVO.setTextField("name"); + } + + String referTable = VciBaseUtil.getTableName(referVO.getReferType()); + String referTableNick = attrVO.getId() + "0"; + String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " = t." + attrVO.getId(); + joinTableList.put(attrVO.getId(), left); + String referShowField = attrVO.getId() + "Name"; + List<String> textFields = VciBaseUtil.str2List(referVO.getTextField()); + String showFieldInSource = ""; + if (textFields.contains("name")) { + showFieldInSource = "name"; + } else { + showFieldInSource = textFields.get(0); + } + referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource); + selectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField); + }); + } + Optional.ofNullable(attributeService.getDefaultAttributeVOMap()).orElseGet(() -> new HashMap<>()).keySet().stream().forEach(attrId -> { + if (!selectFieldList.contains(attrId) && !"secretgrade".equalsIgnoreCase(attrId)) { + selectFieldList.add(attrId); + } + }); + if (!selectFieldList.contains(CODE_FIELD)) { + selectFieldList.add(CODE_FIELD); + } + if (!selectFieldList.contains(CODE_CLASSIFY_OID_FIELD)) { + selectFieldList.add(CODE_CLASSIFY_OID_FIELD); + } + if (!selectFieldList.contains(CODE_TEMPLATE_OID_FIELD)) { + selectFieldList.add(CODE_TEMPLATE_OID_FIELD); + } + if (!selectFieldList.contains(CODE_FULL_PATH_FILED)) { + selectFieldList.add(CODE_FULL_PATH_FILED); + } + + //澶勭悊鏌ヨ鏉′欢 + //TODO 楠岃瘉sql娉ㄥ叆 + List<String> andSql = new ArrayList<>(); + List<String> orSql = new ArrayList<>(); + if (!CollectionUtils.isEmpty(conditionMap)) { + Map<String, String> orConditionMap = new HashMap<>(); + Map<String, String> andCondtionMap = new HashMap<>(); + //鍏堝垎绂籵r鐨勬煡璇㈡潯浠讹紝鍙﹀褰撴煡璇㈡潯浠舵槸绌虹殑鏃跺�欎篃涓嶆煡璇� + conditionMap.forEach((k, v) -> { + if (StringUtils.isNotBlank(v)) { + if (v.startsWith(QueryOptionConstant.OR)) { + orConditionMap.put(k, v.substring(QueryOptionConstant.OR.length())); + } else { + andCondtionMap.put(k, v); + } + } + }); + + andCondtionMap.forEach((k, v) -> { + andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap)); + }); + orConditionMap.forEach((k, v) -> { + orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap)); + }); + } + //缁勫悎璧锋潵 + StringBuilder andSb = new StringBuilder(); + andSql.stream().forEach(s -> { + andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE); + }); + + String andString = andSb.toString().trim(); + String endWithSql = QueryOptionConstant.AND; + if (andString.endsWith(endWithSql)) { + andString = andString.substring(0, andString.length() - endWithSql.length()); + } + + String orString = orSql.stream().collect(Collectors.joining(" or ")); + String whereSql = ""; + if (StringUtils.isNotBlank(orString)) { + if (StringUtils.isBlank(andString)) { + andString = " 1 = 1 "; + } + whereSql = SPACE + "(" + SPACE + andString + SPACE + ") and (" + SPACE + orString + SPACE + ")" + SPACE; + } else { + whereSql = andString + SPACE; + } + if (attrVOMap.keySet().contains("secretgrade")) { + Integer userSecret = VciBaseUtil.getCurrentUserSecret(); + if (userSecret == null || userSecret == 0) { +// userSecret = secretService.getMinUserSecret(); + } + whereSql += " and ( t.secretGrade <= " + userSecret + ") "; + } + String tableName = VciBaseUtil.getTableName(btmType); + 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)) + + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; + if (pageHelper == null) { + pageHelper = new PageHelper(-1); + } + //鐪嬬湅鎺掑簭 + String orderSql = pageHelper.getOrderSql("t"); + sql += (orderSql == null ? "" : orderSql); + String whereSubfixForPage = " ) A where rownum < " + (pageHelper.getLimit() * pageHelper.getPage() + 1) + ") where RN >= " + + (pageHelper.getLimit() * (pageHelper.getPage() - 1) + 1); + String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql; + String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) + + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; + CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO(); + sqlBO.setTableName(tableName); + sqlBO.setJoinTable(joinTableList); + sqlBO.setNickName("t"); +// sqlBO.setPageHelper(pageHelper); + sqlBO.setSqlHasPage(sqlHasPage); + sqlBO.setSqlCount(sqlCount); + sqlBO.setSqlUnPage(sql); + return sqlBO; + } + + + /** + * 缁勫悎鏌ヨ鏉′欢鐨剆ql + * + * @param key 瀛楁 + * @param value 鍚嶅瓧 + * @param referFieldMap 鍙傜収鐨勫瓧娈� + * @param attrVOMap 灞炴�х殑鏄犲皠 + * @return Sql璇彞 + */ + private String getConditionSql(String key, String value, Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫睘鎬�**/> referFieldMap, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { + if (key.endsWith("_begin")) { + //璇存槑鏄�>=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓� + String field = (key.substring(0, key.length() - 6).toLowerCase().trim()); + if (referFieldMap.containsKey(field)) { + //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚� + return referFieldMap.get(field) + SPACE + " >= '" + value + "'" + SPACE; + } else { + return (field.contains(".") ? "" : "t.") + field + SPACE + " >= " + getStringValueInWhere(value, field, attrVOMap); + } + } else if (key.endsWith("_end")) { + //璇存槑鏄�<=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓� + String field = (key.substring(0, key.length() - 6).toLowerCase().trim()); + if (referFieldMap.containsKey(field)) { + //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚� + return referFieldMap.get(field) + SPACE + " <= '" + value + "'" + SPACE; + } else { + return (field.contains(".") ? "" : "t.") + field + SPACE + " <= " + getStringValueInWhere(field, value, attrVOMap); + } + } else { + if (referFieldMap.containsKey(key)) { + //璇存槑鏄弬鐓х殑锛屾垜浠弬鐓х殑鏌ヨ閮借涓烘槸瀛楃涓诧紝濡傛灉鏄椂闂存牸寮忕殑鏌ヨ鑲畾鏈夐棶棰橈紝 + String selectKey = referFieldMap.get(key); + return getSqlByValue(selectKey, value, null); + } else { + return getSqlByValue(key, value, attrVOMap); + } + } + + } + + /** + * 鑾峰彇鏌ヨ鏉′欢涓殑鍊肩殑锛屽鐞嗕笉鍚岀殑绫诲瀷 + * + * @param value 鍊� + * @param field 瀛楁鍚嶇О + * @return 鏃ユ湡鎴栬�呮椂闂存牸寮忎細鍖呮嫭to_date锛屽瓧绗︿覆浼氬姞' + */ + private String getStringValueInWhere(String field, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { + if ((field.contains(".") && !field.toLowerCase(Locale.ROOT).startsWith("t.")) || attrVOMap == null + || !field.replace("t.", "").matches(RegExpConstant.LETTER) || value.startsWith(ONLY)) { + //璇存槑鍙兘鏄寚瀹氱殑鏌愪釜鏉′欢锛岀洿鎺ヨ繑鍥� + if (value.startsWith(ONLY)) { + value = value.replace(ONLY, ""); + } + if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) { + return value; + } + if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) { + //鏄弬鐓� + return "'" + value + "'"; + } else { + return value; + } + } else { + //鐪嬬湅鏄笉鏄繖涓璞¢噷鐨勫睘鎬� + if (attrVOMap.containsKey(field)) { + VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(attrVOMap.get(field).getAttributeDataType()); + if ("ts".equalsIgnoreCase(field)) { + return "to_timestamp('" + value + "', '" + DATETIME_FORMAT + ".ff')"; + } + DateConverter dateConverter = new DateConverter(); + if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) { + //瀹為檯涓婏紝鏁版嵁搴撻兘鏄痶imestamp鐨勭被鍨�. + dateConverter.setAsText(value); + return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')"; + } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) { + dateConverter.setAsText(value); + return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')"; + } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum) + || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum) + || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) { + return value; + } else { + return "'" + value + "'"; + } + } else { + if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) { + return value; + } + return "'" + value + "'"; + } + } + + } + + /** + * 灏佽鏈�缁堢殑sql璇彞涓殑鍊奸儴鍒� + * + * @param selectKey 鏌ヨ鐨勫瓧娈� + * @param value 鍊� + * @param attrVOMap 灞炴�х殑鏄剧ず瀵硅薄鏄犲皠 + * @return sql閲岀殑鍊� + */ + private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { + StringBuilder sql = new StringBuilder(); + if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || attributeService.isDefaultAttr(selectKey) || selectKey.matches(RegExpConstant.LETTER))) { + sql.append("t."); + } + if (value.startsWith(QueryOptionConstant.IN)) { + sql.append(selectKey) + .append(SPACE) + .append("in") + .append(SPACE) + .append("(") + .append(value.replace(QueryOptionConstant.IN, "")) + .append(")"); + } else if (value.startsWith(QueryOptionConstant.NOTIN)) { + sql.append(selectKey) + .append(SPACE) + .append("not in") + .append(SPACE) + .append("(") + .append(value.replace(QueryOptionConstant.NOTIN, "")) + .append(")"); + } else if (value.startsWith(QueryOptionConstant.NOTEQUAL)) { + value = value.replace(QueryOptionConstant.NOTEQUAL, ""); + value = getStringValueInWhere(selectKey, value, attrVOMap); + sql.append(selectKey) + .append(SPACE) + .append(QueryOptionConstant.NOTEQUAL) + .append(SPACE) + .append(value); + } else if (value.startsWith(QueryOptionConstant.MORETHAN)) { + value = value.replace(QueryOptionConstant.MORETHAN, ""); + value = getStringValueInWhere(selectKey, value, attrVOMap); + sql.append(selectKey) + .append(SPACE) + .append(QueryOptionConstant.MORETHAN) + .append(SPACE) + .append(value); + } else if (value.startsWith(QueryOptionConstant.MORE)) { + value = value.replace(QueryOptionConstant.MORE, ""); + value = getStringValueInWhere(selectKey, value, attrVOMap); + sql.append(selectKey) + .append(SPACE) + .append(QueryOptionConstant.MORE) + .append(SPACE) + .append(value); + } else if (value.startsWith(QueryOptionConstant.LESSTHAN)) { + value = value.replace(QueryOptionConstant.LESSTHAN, ""); + value = getStringValueInWhere(selectKey, value, attrVOMap); + + sql.append(selectKey) + .append(SPACE) + .append(QueryOptionConstant.LESSTHAN) + .append(SPACE) + .append(value); + } else if (value.startsWith(QueryOptionConstant.LESS)) { + value = value.replace(QueryOptionConstant.LESS, ""); + value = getStringValueInWhere(selectKey, value, attrVOMap); + + sql.append(selectKey) + .append(SPACE) + .append(QueryOptionConstant.LESS) + .append(SPACE) + .append(value); + } else if (value.startsWith(QueryOptionConstant.ISNOTNULL)) { + sql.append(selectKey) + .append(SPACE) + .append(" is not null"); + } else if (value.startsWith(QueryOptionConstant.ISNULL)) { + sql.append(selectKey) + .append(SPACE) + .append(" is null"); + } else if (value.contains("*")) { + //璇存槑鏄痩ike锛屾垨鑰卨efe like ,right like + value = getStringValueInWhere(selectKey, value, attrVOMap); + sql.append(selectKey) + .append(SPACE) + .append("like") + .append(SPACE) + // .append("'") + .append(value.replace("*", "%")) + // .append("'") + .append(SPACE); + } else { + value= value.replace(SPECIAL_CHAR,REQUIRED_CHAR); + value = getStringValueInWhere(selectKey, value, attrVOMap); + + sql.append(selectKey) + .append(SPACE) + .append(QueryOptionConstant.EQUAL) + .append(SPACE) + .append(value); + } + sql.append(SPACE); + return sql.toString(); + } + + /** + * 淇敼涓婚搴撴暟鎹� + * + * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶇敤鍖呭惈鐮佹鐨勫唴瀹逛簡 + */ + @Override + public void editSaveCode(CodeOrderDTO orderDTO) { + VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭", + orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); +// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 +// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getOid())); + + QueryWrapper<CodeWupinEntity> btmWrapper = new QueryWrapper<>(); + btmWrapper.eq("OID",orderDTO.getOid()); + CodeWupinEntity cbo = codeWupinMapper.selectOne(btmWrapper); + +// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); +// CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); + + if (cbo != null) { + throw new VciBaseException(DATA_OID_NOT_EXIST); + } +// ClientBusinessObject cbo = cbos.get(0); + if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) { + throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯"); + } + if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) { + throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()}); + } + + //娉ㄦ剰妯℃澘涓嶈兘浣跨敤鏁版嵁瀛樺偍鐨勬椂鍊欑殑妯℃澘锛屽洜涓哄彲鑳戒細鍙樺寲 + + //1. 鍒ゆ柇蹇呰緭椤� + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); + checkRequiredAttrOnOrder(templateVO, orderDTO); + //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� + switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); + //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 + switchComponentAttrOnOrder(templateVO, orderDTO); + //4.鏍¢獙瑙勫垯 + checkVerifyOnOrder(templateVO, orderDTO); + //5.鍒ゆ柇鍏抽敭灞炴�� + checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); + //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� + checkEnumOnOrder(templateVO, orderDTO); + //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 + switchDateAttrOnOrder(templateVO, orderDTO); + //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� + copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); + //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� + cbo.setDescription(orderDTO.getDescription()); + cbo.setName(orderDTO.getName()); + try { + cbo.setDescription(orderDTO.getDescription()); + cbo.setName(orderDTO.getName()); +//// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); +// cbo.setAttributeValue("name", orderDTO.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + cbo.setLastModifyTime(new Date()); + cbo.setLastModifier(AuthUtil.getUser().getUserName()); + codeWupinMapper.updateById(cbo); +// +// List<CodeWupinEntity> cboList = new ArrayList<>(); +// +// //澶囨敞 +// cbo.setDescription(orderDTO.getDescription()); +// cboList.add(cbo); +//// +//// cboList.add(cbo); +// List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); +// +// +// List<String> charList = new ArrayList<>(); +// for (CodeWupinEntity wupinEntity : cboList) { +// charList.add(wupinEntity.getId()); +// } +// batchSaveSelectChar(templateVO, charList); +// return codeList.size() > 0 ? codeList.get(0) : ""; + + + + + //淇敼鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑 +// BatchCBO batchCBO = new BatchCBO(); +// batchCBO.getUpdateCbos().add(cbo); +// List<ClientBusinessObject> cboList = new ArrayList<>(); +// cboList.add(cbo); +// boService.persistenceBatch(batchCBO); + batchSaveSelectChar(templateVO, Arrays.asList(cbo.getId())); + } + + /** + * 鍒犻櫎涓婚搴撴暟鎹� + * + * @param deleteBatchDTO 鏁版嵁鐨勫唴瀹癸紝蹇呴』瑕佹湁涓婚敭鍜屽垎绫讳富閿� + */ + @Override + public void deleteCode(CodeDeleteBatchDTO deleteBatchDTO) { + VciBaseUtil.alertNotNull(deleteBatchDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", deleteBatchDTO.getOidList(), "鏁版嵁涓婚敭", + deleteBatchDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(deleteBatchDTO.getCodeClassifyOid()); + //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 + Collection<String> oidCollection = null; + for (Collection<String> strings : VciBaseUtil.switchCollectionForOracleIn(deleteBatchDTO.getOidList())) { + oidCollection.addAll(strings); + } + + List<CodeWupinEntity> cboList = codeWupinMapper.selectBatchIds(oidCollection); + // List<ClientBusinessObject> cboList = new ArrayList<>(); +// oidCollection.stream().forEach(oids -> { +// Map<String, String> conditionMap = new HashMap<>(); +// conditionMap.put("oid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); +// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), conditionMap); +// cboList.addAll(cbos); +// }); + if (CollectionUtils.isEmpty(cboList)) { + throw new VciBaseException("鏁版嵁鍏ㄩ儴鍦ㄧ郴缁熶腑涓嶅瓨鍦�"); + } + List<CodeWupinEntity> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(editCBOs)) { + CodeWupinEntity 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){ + String creator = clientBusinessObject.getCreator(); + if(!userId.equalsIgnoreCase(creator)){ + throw new VciBaseException("缂栫爜涓�"+clientBusinessObject.getId()+"鐨勬暟鎹笉鏄綋鍓嶇敤鎴峰垱寤猴紝涓嶈兘鍒犻櫎锛�"); + } + + } +// BatchCBO batchCBO = new BatchCBO(); +// batchCBO.getDeleteCbos().addAll(cboList); +// WebUtil.setPersistence(false); +// batchCBO.copyFromOther( + productCodeService.recycleCode(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid(), deleteBatchDTO.getOidList()); + baseMapper.deleteBatchIds(cboList); + // ); +// WebUtil.setPersistence(true); +// boService.persistenceBatch(batchCBO); + } + + /** + * 浣跨敤鍒嗙被鍜岄樁娈电殑缂栧彿锛岃幏鍙栧寘鍚殑灞炴�� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param phase 闃舵鐨勫悕绉� + * @return 灞炴�х殑鑻辨枃鍚嶇О + */ + @Override + public List<String> listPhaseAttrByClassifyOid(String codeClassifyOid, String phase) { + CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid, false); + //鎵鹃樁娈� + return phaseAttrService.listAttrByTemplateOidAndPhaseId(templateVO.getOid(), phase); + } + + + /** + * 璺緞涓婂寘鍚綋鍓嶅垎绫荤殑鎵�鏈夊垎绫讳俊鎭� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 鍒嗙被鏍� + */ + @Override + public List<Tree> hasSelfClassifyTree(String codeClassifyOid) { + if (StringUtils.isBlank(codeClassifyOid)) { + return new ArrayList<>(); + } + CodeClassifyFullInfoBO fullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); + //鏌ヨ瀛� + List<CodeClassifyVO> childrenClassifys = classifyService.listChildrenClassify(codeClassifyOid, true, "id", true); + Map<String, CodeClassifyVO> classifyVOMap = new HashMap<>(); + classifyVOMap.putAll(Optional.ofNullable(fullInfo.getParentClassifyVOs()).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t))); + classifyVOMap.putAll(Optional.ofNullable(childrenClassifys).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t))); + TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(CodeClassifyServiceImpl.PARENT_FIELD_NAME.toLowerCase(Locale.ROOT)); + return revisionModelUtil.doList2Trees(classifyVOMap.values().stream().collect(Collectors.toList()), treeWrapperOptions, (CodeClassifyVO s) -> { + return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s + .getLcStatus()) ? (" 銆愬仠鐢ㄣ�� ") : ""); + }); + } + + /** + * 浣跨敤鍒嗙被鑾峰彇瀵瑰簲鐨勬暟鎹� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param templateOid 妯℃澘鐨勪富閿� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉鐨勫璞� + * @return 鏁版嵁锛堝寘鍚笅绾у垎绫伙級 + */ + @Override + public DataGrid<Map<String, String>> gridTableDataByClassifyOid(String codeClassifyOid, String templateOid, Map<String, String> conditionMap, PageHelper pageHelper) { + //1. 浣跨敤鍒嗙被鑾峰彇鎵�鏈夌殑涓嬬骇鍒嗙被锛岀劧鍚庢牴鎹垎绫绘煡璇㈠搴旂殑鏁版嵁 + //2. 鍏ㄩ儴浣跨敤褰撳墠鍒嗙被鐨勫綋鍓嶆ā鏉挎潵灞曠ず鍐呭 + //3. 濡傛灉妯℃澘涓婃湁鏋氫妇娉ㄥ叆锛岀粍鍚堣鍒欙紝鍜屽弬鐓х殑锛岄渶瑕佹墽琛岃浆鎹� + //4. 鏌ヨ鐨勬椂鍊欙紝鐩存帴浣跨敤codeclsfpath鏉ユ煡璇� + CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(codeClassifyOid); + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid); + if (topClassifyVO == null || StringUtils.isBlank(topClassifyVO.getBtmtypeid())) { + throw new VciBaseException("褰撳墠涓婚搴撳垎绫绘病鏈夐《灞傚垎绫伙紝鎴栬�呴《灞傚垎绫绘病鏈夎缃笟鍔$被鍨�"); + } + String btmTypeId = topClassifyVO.getBtmtypeid(); + if (StringUtils.isBlank(btmTypeId)) { + return new DataGrid<>("杩欎釜鍒嗙被鎵�灞為《灞傚垎绫绘病鏈夋坊鍔犱笟鍔$被鍨�"); + } + if (conditionMap == null) { + conditionMap = new HashMap<>(); + } + //pageHelper.addDefaultDesc("createTime"); + pageHelper.addDefaultDesc("id"); + if (!classifyService.checkHasChild(codeClassifyOid)) { + conditionMap.put(CODE_CLASSIFY_OID_FIELD, codeClassifyOid); + } else { + conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY) + + " where lcstatus='" + FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED + + "' start with parentCodeClassifyOid = '" + codeClassifyOid + "' CONNECT BY PRIOR OID = parentCodeClassifyOid )"); + } + conditionMap.put("islastr", "1"); + conditionMap.put("islastv", "1"); + return queryGrid(btmTypeId, templateVO, conditionMap, pageHelper); +// List<String> selectFieldList = templateVO.getAttributes().stream().map(CodeClassifyTemplateAttrVO::getId).collect(Collectors.toList()); +// //鍙傜収璁╁钩鍙扮洿鎺ユ煡璇㈠氨琛� +// List<String> finalSelectFieldList = selectFieldList; +// List<CodeClassifyTemplateAttrVO> referAttrVOs = templateVO.getAttributes().stream().filter( +// s -> StringUtils.isNotBlank(s.getReferbtmid()) +// && +// (finalSelectFieldList.size() ==0 || finalSelectFieldList.contains(s.getId().toLowerCase(Locale.ROOT))) +// ).collect(Collectors.toList()); +// if(!CollectionUtils.isEmpty(referAttrVOs)){ +// for (int i = 0; i < referAttrVOs.size(); i++) { +// selectFieldList.add(referAttrVOs.get(i).getId() + ".name"); +// } +// } +// //鎴戜滑浣跨敤鍜屼笟鍔$被鍨嬬殑鏉ユ煡璇� +// DataGrid<Map<String,String>> dataGrid = boService.queryGridByBo(btmTypeId, conditionMap, pageHelper, selectFieldList); +// //鎴戜滑闇�瑕佷娇鐢ㄦā鏉挎潵杞崲 +// if(!CollectionUtils.isEmpty(dataGrid.getData())){ +// wrapperData(dataGrid.getData(),templateVO,finalSelectFieldList,false); +// } +// return dataGrid; + } + + /** + * 鎵归噺淇濆瓨娴佺▼鎵ц椤甸潰淇敼鐨勫唴瀹� + * + * @param orderDTOList 缂栫爜鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅 + * @return 鎵ц缁撴灉 + */ + @Override + public R batchUpdateCode(List<CodeOrderDTO> orderDTOList) { +// VciBaseUtil.alertNotNull(orderDTOList,"缂栫爜鐢宠鐩稿叧鐨勫睘鎬у唴瀹�"); +// orderDTOList.forEach(orderDTO -> { +// VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭", +// orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); +// }); +// Map<String, CodeOrderDTO> orderDTOMap = orderDTOList.stream().filter(orderDTO -> orderDTO != null && StringUtils.isNotBlank(orderDTO.getOid())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); +// List<ClientBusinessObject> updateList = new ArrayList<>(); +// // 搴旇閮芥槸涓�涓垎绫讳笅鐨勪笟鍔℃暟鎹紝鎵剧涓�鏉$殑灏辫 +// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTOList.get(0).getCodeClassifyOid()); +// Map<String,String> cboOidMap = new HashMap<>(); +// if (CollectionUtils.isEmpty(orderDTOMap.keySet())){ +// throw new VciBaseException(DATA_OID_NOT_EXIST); +// } +// cboOidMap.put("oid",QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(orderDTOMap.keySet().toArray(new String[0])) + ")"); +// List<ClientBusinessObject> cboList = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), cboOidMap); +// if (CollectionUtils.isEmpty(cboList)){ +// throw new VciBaseException(DATA_OID_NOT_EXIST); +// } +// BatchCBO batchCBO = new BatchCBO(); +// CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid()); +// Map<String, ClientBusinessObject> cboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); +// orderDTOMap.keySet().stream().forEach(oid -> { +// CodeOrderDTO orderDTO = orderDTOMap.get(oid); +// ClientBusinessObject cbo = cboMap.get(oid); +// if (!cbo.getTs().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) { +// throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯"); +// } +// if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) { +// throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()}); +// } +// //1. 鍒ゆ柇蹇呰緭椤� +// CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); +// checkRequiredAttrOnOrder(templateVO, orderDTO); +// //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� +// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); +// //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 +// switchComponentAttrOnOrder(templateVO, orderDTO); +// //4.鏍¢獙瑙勫垯 +// checkVerifyOnOrder(templateVO, orderDTO); +// //5.鍒ゆ柇鍏抽敭灞炴�� +// checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); +// //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� +// checkEnumOnOrder(templateVO, orderDTO); +// //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 +// switchDateAttrOnOrder(templateVO, orderDTO); +// //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� +// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); +// //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� +// cbo.setDescription(orderDTO.getDescription()); +// cbo.setName(orderDTO.getName()); +// try { +// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); +// cbo.setAttributeValue("name", orderDTO.getName()); +// } catch (VCIError e) { +// e.printStackTrace(); +// } +// batchCBO.getUpdateCbos().add(cbo); +// updateList.add(cbo); +// }); +// boService.persistenceBatch(batchCBO); +// batchSaveSelectChar(firstTemplateVO, cboList); + return R.success("鎿嶄綔鎴愬姛锛�"); + } + + /** + * 鏍囪娴佺▼涓笟鍔℃暟鎹槸鍚﹂�氳繃 + * + * @param oid 涓氬姟鏁版嵁涓婚敭 + * @param btmName 涓氬姟绫诲瀷 + * @param pass 鏄惁閫氳繃 + * @return 鎵ц缁撴灉 + */ + @Override + public R markDataPassing(String oid, String btmName, Boolean pass) { + VciBaseUtil.alertNotNull(oid, "涓氬姟鏁版嵁涓婚敭", btmName, "涓氬姟绫诲瀷", pass, "鏍囪绫诲瀷"); + boolean flag = false; +// try { +// 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)); +// flag = operation.updateBuinessObject(data); +// } catch (VCIError e) { +// e.printStackTrace(); +// } + if (flag) { + return R.success("鏍囪鎴愬姛锛�"); + } else { + return R.fail("鏍囪澶辫触锛�"); + } + } + + /** + * 棰勮缁勫悎瑙勫垯 + * + * @param orderDTO 棰勮鐨勪俊鎭紝鍖呭惈妯℃澘鐨勪富閿� + * @return key鏄粍鍚堣鍒欑殑灞炴�с�倂alue鏄粍鍚堝悗鐨勫�硷紝銆傚鏋滅己灏戞煇涓睘鎬х殑鍊硷紝浼氫綔涓簐alue杩斿洖 + */ + @Override + public Map<String, String> previewCompRule(CodeOrderDTO orderDTO) { + VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧淇℃伅", orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�"); + //鏌ヨ鍒嗙被鐨勪俊鎭紝鏌ヨ妯℃澘鐨勪俊鎭� + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); + switchComponentAttrOnOrder(templateVO, orderDTO); + return orderDTO.getData(); + } + + /** + * 鍒嗙被娉ㄥ叆鐨勫唴瀹归瑙� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param codeTemplateOid 妯℃澘鐨勪富閿� + * @return key鏄垎绫绘敞鍏ョ殑灞炴�э紝value鏄敞鍏ュ悗鐨勫�� + */ + @Override + public Map<String, String> previewClassify(String codeClassifyOid, String codeTemplateOid) { + if (StringUtils.isBlank(codeClassifyOid) || StringUtils.isBlank(codeTemplateOid)) { + return new HashMap<>(); + } + //鏌ヨ鍒嗙被鐨勪俊鎭紝鏌ヨ妯℃澘鐨勪俊鎭� + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(codeTemplateOid); + // + + CodeOrderDTO orderDTO = new CodeOrderDTO(); + orderDTO.setData(new HashMap<>()); + switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); + return orderDTO.getData(); + } + + /** + * 鍗囩増鐨勪富棰樺簱鏁版嵁 + * + * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶉渶瑕佸寘鍚爜娈电殑鍐呭 + */ + @Override + public void upSaveCode(CodeOrderDTO orderDTO) { + VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭涓虹┖", orderDTO.getCopyFromVersion(), "鍘熷鏁版嵁鐨勪富閿�", + orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 +// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getCopyFromVersion())); +// if (CollectionUtils.isEmpty(cbos)) { +// throw new VciBaseException(DATA_OID_NOT_EXIST); +// } +// ClientBusinessObject oldCbo = cbos.get(0); +// if (!CodeDefaultLC.RELEASED.getValue().equalsIgnoreCase(oldCbo.getLcStatus())) { +// throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁告暟鎹洿鏀�", new String[]{CodeDefaultLC.RELEASED.getText()}); +// } +// //闇�瑕佸崌鐗� +// ClientBusinessObjectOperation cboOperation = new ClientBusinessObjectOperation(); +// ClientBusinessObject cbo = null; +// try { +// //cbo = cboOperation.createBusinessObjectVersion(oldCbo,VciBaseUtil.getCurrentUserId()); +// cbo = cboOperation.reviseBusinessObject(oldCbo, ""); +// } catch (VCIError e) { +// throw new VciBaseException("鍒濆鍖栫浉鍏崇殑鍐呭鍑虹幇浜嗛敊璇�", new String[0], e); +// } +// //1. 鍒ゆ柇蹇呰緭椤� +// CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); +// checkRequiredAttrOnOrder(templateVO, orderDTO); +// //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� +// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); +// //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 +// switchComponentAttrOnOrder(templateVO, orderDTO); +// //4.鏍¢獙瑙勫垯 +// checkVerifyOnOrder(templateVO, orderDTO); +// //5.鍒ゆ柇鍏抽敭灞炴�� +// checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); +// //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� +// checkEnumOnOrder(templateVO, orderDTO); +// //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 +// switchDateAttrOnOrder(templateVO, orderDTO); +// //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� +// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); +// //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� +// cbo.setDescription(orderDTO.getDescription()); +// cbo.setName(orderDTO.getName()); +// try { +// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); +// cbo.setAttributeValue("name", orderDTO.getName()); +// } catch (VCIError e) { +// e.printStackTrace(); +// } +// //鏁版嵁鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑 +// cbo.setCreateTime(DateUtils.convert2String(new Date(Long.parseLong(cbo.getCreateTime())), "yyyy-MM-dd HH:mm:ss")); +// cbo.setLastModifyTime(DateUtils.convert2String(new Date(Long.parseLong(cbo.getLastModifyTime())), "yyyy-MM-dd HH:mm:ss")); +// List<ClientBusinessObject> cboList = new ArrayList<>(); +// cboList.add(cbo); +// try { +// cboOperation.saveRevisionBuinessObject(cbo); +// } catch (VCIError vciError) { +// throw new VciBaseException("鏁版嵁鏇存敼淇濆瓨鍑洪敊浜�", new String[0], vciError); +// } +// batchSaveSelectChar(templateVO, cboList); + } + + /** + * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹� + * + * @param classifySecOid 鐮佹鐨勪富閿� + * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿� + * @return 鍒嗙被鐮佸�肩殑鍐呭 + */ + @Override + public List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid) { + return classifyValueService.listCodeClassifyValueBySecOid(classifySecOid, parentClassifyValueOid); + } + + /** + * 浣跨敤涓婚搴撳垎绫昏幏鍙栫紪鐮佽鍒� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 缂栫爜瑙勫垯鐨勫唴瀹� + */ + @Override + public CodeRuleVO getCodeRuleByClassifyOid(String codeClassifyOid) { + VciBaseUtil.alertNotNull(codeClassifyOid, "鍒嗙被鐨勪富閿�"); + CodeClassifyVO classifyVO = classifyService.getObjectByOid(codeClassifyOid); + String codeRuleOid = classifyVO.getCoderuleoid(); + if (StringUtils.isBlank(codeRuleOid)) { + //寰�涓婃壘 + CodeClassifyFullInfoBO fullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); + return getCodeRuleByClassifyFullInfo(fullInfo); + } + //鎴戜滑鏌ヨ缂栫爜瑙勫垯 + return ruleService.getObjectHasSecByOid(codeRuleOid); + } /** * 浣跨敤鍒嗙被鐨勫叏閮ㄤ俊鎭幏鍙栫紪鐮佽鍒� @@ -126,1695 +2345,508 @@ throw new VciBaseException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�"); } } - return codeRuleService.getObjectHasSecByOid(codeRuleOid); + return ruleService.getObjectHasSecByOid(codeRuleOid); } -// -// /** -// * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」 -// * -// * @param attrVO 妯℃澘灞炴�х殑瀵硅薄 -// * @return 涓嬫媺閫夐」 -// */ -// @Override -// public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) { -// List<KeyValue> comboboxKVs = null; -// if (StringUtils.isNotBlank(attrVO.getEnumString())) { -// comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class); -// } else { -//// comboboxKVs = enumService.getEnum(attrVO.getEnumid()); -//// Dict dict = new Dict(); -//// dict.setParentId(Long.valueOf(attrVO.getEnumid())); -// R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumId()); -// if(list.isSuccess()){ -// for (DictBiz datum : list.getData()) { -// KeyValue keyValue = new KeyValue(); -// keyValue.setKey(datum.getDictKey()); -// keyValue.setValue(datum.getDictValue()); -// comboboxKVs.add(keyValue); + + /** + * 浣跨敤鏁版嵁涓婚敭鑾峰彇鏁版嵁鐨勫叏閮ㄤ俊鎭� + * + * @param oid 涓婚敭 + * @param templateOid 妯℃澘鐨勪富閿� + * @return 鏁版嵁鐨勫唴瀹� + */ + @Override + public R<List<Map<String, String>>> getDataByOid(String oid, String templateOid) { + CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid); + //涓轰簡闃叉妯℃澘涓婄殑涓氬姟绫诲瀷涓庡垎绫讳笂涓嶅搴� + CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(templateVO.getCodeclassifyoid()); + String btmId = topClassifyVO.getBtmtypeid(); + //鏌ヨ鏁版嵁 + Map<String, String> conditionMap = WebUtil.getOidQuery(oid); + CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmId, templateVO, conditionMap, new PageHelper(-1)); + //鎴戜滑浣跨敤鍜屼笟鍔$被鍨嬬殑鏉ユ煡璇� + List<Map> cbos = commonsMapper.selectBySql(sqlBO.getSqlUnPage()); +// List<ClientBusinessObject> cbos = boService.queryByOnlySql(sqlBO.getSqlUnPage()); + if (CollectionUtils.isEmpty(cbos)) { + throw new VciBaseException("鏁版嵁鍦ㄧ郴缁熶腑涓嶅瓨鍦紝鏄惁鍥犱负淇敼杩囦笟鍔$被鍨嬶紵"); + } +// Map<String, String> data = new HashMap<>(); + Map<String,String> cbo = cbos.get(0); +// WebUtil.copyValueToMapFromCbos(cbo, data); + List<Map<String, String>> dataList = new ArrayList<>(); + dataList.add(cbo); + wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), true); + R<List<Map<String, String>>> result = R.data(Collections.singletonList(cbo)); + //鎴戜滑瑕佺湅鏄惁涓嶆槸鍗囩増鐨勶紝鍗囩増鐨勮瘽锛岄渶瑕佸姣斾笉鐩哥瓑鐨勫睘鎬� + String copy = String.valueOf(cbo.get("COPYFROMVERSION")); +// if (StringUtils.isBlank(copy)) { +// copy = cbo.getAttributeValue("copyfromversion"); +// } + if (StringUtils.isNotBlank(copy)) { + //璇存槑鏈夊彉鏇寸殑鍐呭 + + CodeTemplateAttrSqlBO oldSqlBO = getSqlByTemplateVO(btmId, templateVO, WebUtil.getOidQuery(copy), new PageHelper(-1)); + //鎴戜滑浣跨敤鍜屼笟鍔$被鍨嬬殑鏉ユ煡璇� +// List<Map> cbos = commonsMapper.selectBySql(sqlBO.getSqlUnPage()); + List<Map> oldCbos = commonsMapper.selectBySql(oldSqlBO.getSqlUnPage()); + if (!CollectionUtils.isEmpty(oldCbos)) { +// Map<String, String> newData = new HashMap<>(); +// WebUtil.copyValueToMapFromCbos(cbo, newData); + Map<String, String> oldData = new HashMap<>(); + oldData = oldCbos.get(0); + Map<String, String> difFieldMap = new HashMap<>(); + Map<String, String> finalOldData = oldData; + cbo.forEach((key, value) -> { + String oldValue = finalOldData.getOrDefault(key, ""); + if (value == null) { + value = ""; + } + if (oldValue == null) { + oldValue = ""; + } + if (!value.equalsIgnoreCase(oldValue)) { + difFieldMap.put(key, oldValue); + } + }); + List<Map<String, String>> difFieldList = new ArrayList<>(); + difFieldList.add(difFieldMap); + result.setData(difFieldList); + } + } + return result; + } + + /** + * 浣跨敤妯℃澘鐨勪富閿幏鍙栬〃鍗曠殑淇℃伅 + * + * @param templateOid 妯℃澘鐨勪富閿� + * @param executionId 娴佺▼鎵цid + * @param processUse 娴佺▼妯℃澘鐨勭敤閫� + * @return ui鐩稿叧鐨勫唴瀹� + */ + @Override + public List<String> getFieldByProcessTemplate(String templateOid, String executionId, String processUse) { + VciBaseUtil.alertNotNull(templateOid, "妯℃澘涓婚敭", executionId, "娴佺▼鐨勬墽琛孖d", processUse, "娴佺▼妯℃澘鐢ㄩ��"); + while (StringUtils.countMatches(executionId, ".") > 1) { + executionId = executionId.substring(0, executionId.lastIndexOf(".")); + } + String sql = "select wm_concat(distinct (t.codetempattrOidArr)) codetempattroidarr\n" + + "from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY_PROCESS_TEMPLATE) + " 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); + List<Map> tempAttrOidArr = commonsMapper.selectBySql(sql); + if (CollectionUtils.isEmpty(tempAttrOidArr) || StringUtils.isBlank((CharSequence) tempAttrOidArr.get(0).get("codetempattroidarr"))) { + return new ArrayList<>(); + } + return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("codetempattroidarr").toString()); + } + /** + * 浣跨敤鍒嗙被鐨勪富閿幏鍙栦笟鍔℃暟鎹� + * + * @param btmType 涓氬姟绫诲瀷 + * @param queryObject 鏌ヨ瀵硅薄 + * @return 琛ㄦ牸鐨勬樉绀哄璞″�� + */ + @Override + public DataGrid<Map<String, String>> getTableDataByExecutionId(String btmType, BaseQueryObject queryObject) { + VciBaseUtil.alertNotNull(btmType, "涓氬姟绫诲瀷"); + if (queryObject == null) { + queryObject = new BaseQueryObject(); + } + if (queryObject.getConditionMap() == null) { + queryObject.setConditionMap(new HashMap<>()); + } + Map<String, String> conditionMap = queryObject.getConditionMap(); + PageHelper pageHelper = queryObject.getPageHelper(); + if (!conditionMap.containsKey("oid")) { + throw new VciBaseException("涓氬姟鏁版嵁涓婚敭涓嶈兘涓虹┖"); + } + List<String> oidList = VciBaseUtil.str2List(conditionMap.get("oid")); + Map<String, String> oidMap = new HashMap<>(); + if (conditionMap.get("oid").contains(",")) { + oidMap.put("oid", QueryOptionConstant.IN +"("+ VciBaseUtil.toInSql(oidList.toArray(new String[0])) + ")"); + } else { + oidMap.put("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"); +// Map<String, String> templateOidMap = new HashMap<>(); +// templateOidMap.put("oid", templateOid); +// List<CodeClassifyTemplate> templateDOList = boService.queryObject(CodeClassifyTemplate.class, templateOidMap); +// 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()); + return null; +// } + } + /** + * 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟 + * + * @param codeClassifyOid 鍒嗙被涓婚敭 + * @param phase 闃舵鐨勫悕绉� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�) + */ + @Override + public MdmUIInfoVO getTableDefineByClassifyOid_v2(String codeClassifyOid, String phase) { + MdmUIInfoVO uiInfoVO = new MdmUIInfoVO(); + CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid); + uiInfoVO.setTemplateVO(templateVO); + UITableDefineVO uiTableDefineVO = wrapperTableDefineByTemplate(templateVO,true); + List<String> phaseAttrIdList = listPhaseAttrByClassifyOid(codeClassifyOid, phase); + uiTableDefineVO.getCols().stream().forEach(list -> { + List<UITableFieldVO> visiableTableField=new ArrayList<>(); + if(StringUtils.isNotBlank(phase)) { + visiableTableField = list.stream().filter(col -> + phaseAttrIdList.stream().anyMatch(s -> StringUtils.equalsIgnoreCase(col.getField(), s) || + (StringUtils.equalsIgnoreCase(col.getFieldType(), "combox") && StringUtils.equalsIgnoreCase(col.getSortField(), s)) + || (StringUtils.equalsIgnoreCase(col.getFieldType(), "refer") && StringUtils.equalsIgnoreCase(col.getQueryField(), s)) + )).collect(Collectors.toList()); + }else{ + visiableTableField= list.stream().filter(col -> + templateVO.getAttributes().stream().anyMatch(s -> + (!s.getReadOnlyFlag().equalsIgnoreCase("true")&& StringUtils.equalsIgnoreCase(col.getField(), s.getId())) || + (StringUtils.equalsIgnoreCase(col.getFieldType(), "combox") && StringUtils.equalsIgnoreCase(col.getSortField(), s.getId())) + || (StringUtils.equalsIgnoreCase(col.getFieldType(), "refer") && StringUtils.equalsIgnoreCase(col.getQueryField(), s.getId())) + )).collect(Collectors.toList()); + } + + visiableTableField.stream().forEach(vo -> { + uiTableDefineVO.setHasEditor(true); + if ("refer".equalsIgnoreCase(vo.getFieldType())) { + setReferConfig2EditConfig(vo); + } else if ("combox".equalsIgnoreCase(vo.getFieldType())) { + setComboxConfig2EditConfig(vo); + } else if (StringUtils.isNotBlank(vo.getDateFormate())){ + vo.setEdit("date"); + }else { + vo.setEdit(vo.getFieldType()); + } + }); + }); + uiInfoVO.setTableDefineVO(uiTableDefineVO); + wrapperResemble(templateVO, uiInfoVO); + return uiInfoVO; + } + + /** + * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸瀹氫箟鐨勪俊鎭� + * + * @param templateVO 妯℃澘鐨勬樉绀哄璞� + * @param forEdit 鏄惁鏄紪杈戞墍闇� + * @return 琛ㄦ牸鐨勪俊鎭� + */ + private UITableDefineVO wrapperTableDefineByTemplate(CodeClassifyTemplateVO templateVO,boolean forEdit) { + //灏佽淇℃伅 + UITableDefineVO tableDefineVO = new UITableDefineVO(); + tableDefineVO.setOid(templateVO.getOid()); + tableDefineVO.setBtmType(templateVO.getBtmTypeId()); + tableDefineVO.setDisplayQueryArea(true); + //鍓嶇浼氶粯璁ゅ垎椤电殑淇℃伅 + + //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌 + List<UITableFieldVO> fieldVOList = new ArrayList<>(); + Map<String, String> comboxOrReferFieldMap = new HashMap<>(); + + templateVO.getAttributes().forEach(attrVO -> { + UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO,forEdit); + if ("combox".equalsIgnoreCase(tableFieldVO.getFieldType())) { + comboxOrReferFieldMap.put(tableFieldVO.getSortField(), tableFieldVO.getField()); + } + if ("refer".equalsIgnoreCase(tableFieldVO.getFieldType())) { + comboxOrReferFieldMap.put(tableFieldVO.getSortField(), tableFieldVO.getField()); + } + if(StringUtils.isNotBlank(tableFieldVO.getEdit())){ + tableDefineVO.setHasEditor(true); + } + fieldVOList.add(tableFieldVO); + }); + List<List<UITableFieldVO>> cols = new ArrayList<>(); + cols.add(fieldVOList); + tableDefineVO.setCols(cols); + Map<String, UITableFieldVO> fieldVOMap = fieldVOList.stream().collect(Collectors.toMap(s -> s.getField().toLowerCase(Locale.ROOT), t -> t)); + //鏌ヨ灞炴�� + List<CodeClassifyTemplateAttrVO> queryAttrVOs = templateVO.getAttributes().stream().filter(s -> BooleanEnum.TRUE.getValue().equalsIgnoreCase(s.getQueryAttrFlag())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(queryAttrVOs)) { + List<UITableFieldVO> queryFieldVOs = new ArrayList<>(); + queryAttrVOs.stream().forEach(attrVO -> { + String attrId = attrVO.getId().toLowerCase(Locale.ROOT); + attrId = comboxOrReferFieldMap.getOrDefault(attrId, attrVO.getId()).toLowerCase(Locale.ROOT); + if (fieldVOMap.containsKey(attrId)) { + queryFieldVOs.add(fieldVOMap.get(attrId)); + } + }); + tableDefineVO.setQueryColumns(queryFieldVOs); + } + //楂樼骇灞炴�� + List<CodeClassifyTemplateAttrVO> seniorQueryAttrVOs = templateVO.getAttributes().stream().filter(s -> BooleanEnum.TRUE.getValue().equalsIgnoreCase(s.getSeniorQueryAttrFlag())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(seniorQueryAttrVOs)) { + List<UITableFieldVO> queryFieldVOs = new ArrayList<>(); + seniorQueryAttrVOs.stream().forEach(attrVO -> { + String attrId = attrVO.getId().toLowerCase(Locale.ROOT); + attrId = comboxOrReferFieldMap.getOrDefault(attrId, attrId).toLowerCase(Locale.ROOT); + if (fieldVOMap.containsKey(attrId)) { + queryFieldVOs.add(fieldVOMap.get(attrId)); + } + }); + tableDefineVO.setSeniorQueryColumns(queryFieldVOs); + } + return tableDefineVO; + } + + /** + * 鍔犺浇鎴愬弬鐓х殑淇敼閰嶇疆 + * @param vo 琛ㄦ牸瀛楁鏄剧ず瀵硅薄 + */ + private void setReferConfig2EditConfig(UITableFieldVO vo) { + if (!CollectionUtils.isEmpty(vo.getReferConfig().getWhere())){ + vo.getReferConfig().getWhere().keySet().forEach(key -> { + vo.getReferConfig().getWhere().put(key, "'" + vo.getReferConfig().getWhere().get(key) + "'"); + }); + } + if (StringUtils.isNotBlank(vo.getReferConfig().getParentValue())){ + String parentValue = vo.getReferConfig().getParentValue(); + parentValue ="\\" + parentValue.replaceAll("'","{vci-quote}").replaceAll("=","{vci-equals}"); + vo.getReferConfig().setParentValue(parentValue); + } + String referConfig = vo.getReferConfig().toString() + .replaceAll("=",":") + .replaceAll("UITableCustomDefineVO","") + .replaceAll("UIFieldSortVO","") + .replaceAll("UITablePageVO","") + .replaceAll("UITableFieldVO","") + .replaceAll("UIFormReferVO","") + .replaceAll("\\{vci-equals}","=") + .replaceAll("\\{vci-quote}","\\\\'") + .replaceAll("'null'","null"); + referConfig = referConfig + ",fieldMap:{" + vo.getQueryField() + ":'" + vo.getReferConfig().getValueField() + "'}"; + vo.setEditConfig("{referConfig:" + referConfig + "}"); + vo.setEdit(vo.getFieldType()); + } + + /** + * 鍔犺浇鎴愪笅鎷夋鐨勪慨鏀归厤缃� + * @param vo 琛ㄦ牸瀛楁鏄剧ず瀵硅薄 + */ + private void setComboxConfig2EditConfig(UITableFieldVO vo) { + vo.setEditConfig("{editable:true,comboxKey:'" + vo.getComboxKey() + "'"); + if (!CollectionUtils.isEmpty(vo.getData())){ + vo.setEditConfig(vo.getEditConfig()+", comboxConfig:"); + for (int i = 0; i < vo.getData().size(); i++) { + KeyValue data = vo.getData().get(i); + if (i == vo.getData().size() -1){ + vo.setEditConfig(vo.getEditConfig() + "{attributes:"+data.getAttributes()+",key:'"+data.getKey()+"',value:'"+data.getValue()+"'}]}"); + }else if (i == 0){ + vo.setEditConfig(vo.getEditConfig() + "{data:[{attributes:"+data.getAttributes()+",key:'"+data.getKey()+"',value:'"+data.getValue()+"'},"); + }else{ + vo.setEditConfig(vo.getEditConfig() + "{attributes:"+data.getAttributes()+",key:'"+data.getKey()+"',value:'"+data.getValue()+"'},"); + } + } + vo.setEditConfig(vo.getEditConfig() + ",valueField:'" + vo.getQueryField() + "'"); + } + vo.setEditConfig(vo.getEditConfig() + "}"); + vo.setEdit(vo.getFieldType()); + } + + /** + * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄥ崟鐨勭浉鍏冲畾涔� + * + * @param idPath 缂栧彿鐨勮矾寰勶紝蹇呴』浠庨《灞傝妭鐐瑰紑濮嬶紝xx/yyy/zz + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�) + */ + @Override + public MdmUIInfoVO getFormDefineByClassifyIdPath(String idPath) { + CodeClassifyVO classifyVO = classifyService.getObjectByIdPath(idPath); + if(classifyVO !=null){ + return getFormDefineByClassifyOid(classifyVO.getOid()); + } + return null; + } + + /** + * 浣跨敤涓婚搴撳垎绫荤殑涓婚敭鑾峰彇琛ㄥ崟鐨勪俊鎭� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return ui鐩稿叧鐨勫唴瀹� + */ + @Override + public MdmUIInfoVO getFormDefineByClassifyOid(String codeClassifyOid) { + MdmUIInfoVO uiInfoVO = new MdmUIInfoVO(); + CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid); + uiInfoVO.setTemplateVO(templateVO); + uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid)); + wrapperResemble(templateVO, uiInfoVO); + return uiInfoVO; + } + + /** + * 浣跨敤妯℃澘涓婚敭鑾峰彇ui鐩稿叧鐨勫唴瀹� + * + * @param templateOid 妯℃澘鐨勪富閿� + * @return ui鐩稿叧鐨勫唴瀹� + */ + @Override + public MdmUIInfoVO getTableDefineByTemplateOid(String templateOid) { + return getTableDefineByTemplateVO(templateService.getObjectHasAttrByOid(templateOid)); + } + + + /** + * 浣跨敤妯℃澘鏄剧ず瀵硅薄杞崲涓鸿〃鏍肩殑淇℃伅锛堝寘鍚墿灞曠殑鎸夐挳锛� + * + * @param templateVO 妯℃澘鐨勪俊鎭� + * @return UI鐩稿叧鐨勫唴瀹癸紙浠呭寘鍚〃鏍间俊鎭級 + */ + private MdmUIInfoVO getTableDefineByTemplateVO(CodeClassifyTemplateVO templateVO) { + //鍏堢湅杩欎釜鍒嗙被鏈韩鏄惁鏈夋ā鏉� + MdmUIInfoVO uiInfoVO = new MdmUIInfoVO(); + uiInfoVO.setTemplateVO(templateVO); + //鎴戜滑闇�瑕佸皢妯℃澘杞崲涓鸿〃鏍肩浉鍏崇殑鏄剧ず淇℃伅 + uiInfoVO.setTableDefineVO(wrapperTableDefineByTemplate(uiInfoVO.getTemplateVO(),false)); + //闇�瑕佸幓鐪嬫墿灞曠殑鎸夐挳,鍙湁鍒楄〃閲岄潰鏈韩鎵嶆坊鍔犺繘鍘伙紝宸ュ叿鏍忎笂鐨勫崟鐙幏鍙� + List<CodeClassifyTemplateButtonVO> buttonVOS = templateButtonService.listButtonByTemplateOid(templateVO.getOid(), true); + if (!CollectionUtils.isEmpty(buttonVOS)) { + //鎴戜滑瑕佸垎寮�涓烘寜閽紝杩樻槸鍦ㄦ搷浣滃垪閲岄潰 + List<CodeClassifyTemplateButtonVO> tableButtonVOs = buttonVOS.stream().filter(s -> CodeUseButtonPositionTypeEnum.TABLE.getValue().equalsIgnoreCase(s.getButtonUse())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(tableButtonVOs)) { + UITableFieldVO optionFieldVO = new UITableFieldVO(); + optionFieldVO.setField("options"); + optionFieldVO.setTitle("鎿嶄綔"); + optionFieldVO.setFieldType("text"); + optionFieldVO.setOptionField(true); + List<KeyValue> buttons = new ArrayList<>(); + Map<String, String> optionJsMap = new HashMap<>(); + tableButtonVOs.stream().forEach(buttonVO -> { + KeyValue kv = new KeyValue(); + kv.setKey(buttonVO.getId()); + kv.setValue(buttonVO.getClassifyButtonOidName()); + kv.setAttributes(VciBaseUtil.objectToMap(buttonVO)); + buttons.add(kv); + optionJsMap.put(buttonVO.getId(), buttonVO.getButtonVO().getExecutejs()); + }); + optionFieldVO.setOptionJsMap(optionJsMap); + uiInfoVO.getTableDefineVO().getCols().get(0).add(optionFieldVO); + } + } + return uiInfoVO; + } + + /** + * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄦ牸鐨勭浉鍏冲畾涔� + * + * @param codeClassifyIdPath 鍒嗙被鐨勭紪鍙疯矾寰勶紝蹇呴』鏄粠椤跺眰鑺傜偣寮�濮嬶紝xxx/yy/zz杩欐牱鐨勬牸寮� + * @param functionId 鍔熻兘鐨勭紪鍙� + * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鏍�) + */ + @Override + public MdmUIInfoVO getUIInfoByClassifyIdPath(String codeClassifyIdPath, String functionId) { + CodeClassifyVO classifyVO = classifyService.getObjectByIdPath(codeClassifyIdPath); + if(classifyVO !=null){ + return getUIInfoByClassifyOid(classifyVO.getOid(),functionId); + } + return null; + } + + /** + * 浣跨敤鍒嗙被涓婚敭鑾峰彇椤甸潰鐨勫唴瀹癸紝鍖呭惈鎸夐挳 + * + * @param codeClassifyOid 涓婚搴撳垎绫讳富閿� + * @param functionId 鍔熻兘鐨勭紪鍙� + * @return UI鐩稿叧鐨勫唴瀹� + */ + @Override + public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid, String functionId) { + VciBaseUtil.alertNotNull(codeClassifyOid, "涓婚搴撳垎绫讳富閿�"); + MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid)); + uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0); + if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(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++) { +// CodeButtonVO buttonVO = buttonVOS.get(i); +// SmOperationVO operationVO = new SmOperationVO(); +// operationVO.setModuleNo(functionId); +// operationVO.setUniqueFlag(buttonVO.getId()); +// operationVO.setName(buttonVO.getName()); +// operationVO.setAlias(operationVO.getName()); +// operationVO.setExecuteJs(buttonVO.getExecutejs()); +// operationVO.setIconCls(buttonVO.getIconcls()); +// operationVOS.add(operationVO); // } // } -// } -// return comboboxKVs; -// } -// /** -// * 淇敼鐘舵�� -// * -// * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄 -// */ -// @Override -// public void changeStatus(BaseModelDTO baseModelDTO) { -// VciBaseUtil.alertNotNull(baseModelDTO, "鏁版嵁淇℃伅", baseModelDTO.getOid(), "涓婚敭", baseModelDTO.getBtmname(), "涓氬姟绫诲瀷", baseModelDTO.getLcStatus(), "鐩爣鐘舵��"); -// List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid()); -//// List<ClientBusinessObject> cboList = boService.selectCBOByOidCollection(oids, baseModelDTO.getBtmname()); -// //鎻掍釜鐐� 涓氬姟绫诲瀷瀹屾垚鍚庨渶瑕佷慨鏀� -// QueryWrapper<CodeOsbtmtypeEntity> wrapper = new QueryWrapper<>(); -// wrapper.eq("BTMNAME",baseModelDTO.getBtmname()); -// wrapper.in("OID",oids); -// List<CodeOsbtmtypeEntity> cboList = codeOsbtmtypeMapper.selectList(wrapper); -// //杩橀渶瑕佷慨鏀筧llCode鐨勭敓鍛藉懆鏈� -//// Map<String, String> conditionMap = new HashMap<>(); -// QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>(); -// allCodeWrapper.eq("createcodebtm",baseModelDTO.getBtmname()); -// allCodeWrapper.in("createcodeoid",oids); -//// conditionMap.put("createcodeoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); -//// conditionMap.put("createcodebtm", baseModelDTO.getBtmname()); -// List<CodeAllCode> codeCbos = baseMapper.selectList(allCodeWrapper); -//// List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap); -// // 鍥炴敹闇�瑕佷笟鍔℃暟鎹垹闄� -//// if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) { -////// BatchCBO batchCBO = new BatchCBO(); -////// batchCBO.getDeleteCbos().addAll(cboList); -//// codeOsbtmtypeMapper.deleteBatchIds(cboList); -////// boService.persistenceBatch(batchCBO); -//// } else { -//// lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus()); -//// } -//// lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus()); -// } -// -// -// /** -// * 鐢宠鍗曚竴缂栫爜 -// * -// * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭 -// * @return 杩斿洖缂栫爜鐨勫唴瀹� -// */ -// @Override -// public String addSaveCode(CodeOrderDTO orderDTO) { -// VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭", -// orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�"); -// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); -// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); -// CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); -// //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈� -// checkSecValueOnOrder(ruleVO, orderDTO); -// //2.鍒ゆ柇蹇呰緭椤� -// checkRequiredAttrOnOrder(templateVO, orderDTO); -// //3.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� -// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); -// //4.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 -// switchComponentAttrOnOrder(templateVO, orderDTO); -// //5.鏍¢獙瑙勫垯 -// checkVerifyOnOrder(templateVO, orderDTO); -// //6.鍏抽敭灞炴�� -// checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); -// //7.鏋氫妇杞崲 -// checkEnumOnOrder(templateVO, orderDTO); -// //8.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 -// switchDateAttrOnOrder(templateVO, orderDTO); -// //9.鐢熸垚缂栫爜鐨勪俊鎭� -//// ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); -//// CodeWupinEntity 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<>(); -//// -//// //澶囨敞 -//// cbo.setDescription(orderDTO.getDescription()); -//// -//// cboList.add(cbo); -//// List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); -//// -//// -//// List<String> charList = new ArrayList<>(); -//// for (CodeWupinEntity wupinEntity : cboList) { -//// charList.add(wupinEntity.getId()); -//// } -//// batchSaveSelectChar(templateVO, charList); -//// return codeList.size() > 0 ? codeList.get(0) : ""; -////// return null; -//// } -//// -//// /** -//// * 澶勭悊鍒嗙被娉ㄥ叆鐨勪俊鎭� -//// * -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝蹇呴』瑕佸悗妯℃澘鐨勫睘鎬� -//// * @param classifyFullInfoBO 鍒嗙被鐨勫叏璺緞 -//// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� -//// */ -//// private void switchClassifyLevelOnOrder(CodeClstemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) { -//// Map<String,CodeClstempattrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter( -//// s -> StringUtils.isNotBlank(s.getClassifyinvokeattr()) && StringUtils.isNotBlank(s.getClassifyinvokelevel()) -//// ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// if (classifyFullInfoBO.getTopClassifyVO() == null) { -//// //闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨� -//// -//// } -//// if (!CollectionUtils.isEmpty(classifyAttrVOMap)) { -//// classifyAttrVOMap.forEach((attrId, attrVO) -> { -//// //鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝 -//// //灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰 -//// CodeClassifyVO classifyVO = null; -//// if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyinvokelevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyinvokelevel())) { -//// //鎸囧畾浜嗗眰绾х殑 -//// //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊� -//// List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList()); -//// int level = VciBaseUtil.getInt(attrVO.getClassifyinvokelevel()); -//// if (classifyVOS.size() >= level && level > 0) { -//// classifyVO = classifyVOS.get(level - 1); -//// } -//// } else { -//// //褰撳墠鐨勫垎绫� -//// classifyVO = classifyFullInfoBO.getCurrentClassifyVO(); -//// } -//// if (classifyVO == null) { -//// //璇存槑灞傜骇鏈夎 -//// orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyinvokelevel() + "]"); -//// // classifyVO = classifyFullInfoBO.getCurrentClassifyVO(); -//// } else { -//// Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO); -//// String value = classifyDataMap.getOrDefault(attrVO.getClassifyinvokeattr(), ""); -//// orderDTO.getData().put(attrId, value); -//// } -//// }); -//// } -//// } -//// -//// -//// /** -//// * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊� -//// * -//// * @param ruleVO 瑙勫垯鐨勬樉绀哄璞� -//// * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹� -//// */ -//// @Override -//// public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) { -//// List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter( -//// s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType()) -//// || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType()) -//// || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType()) -//// || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType()) -//// || VciBaseUtil.getBoolean(s.getNullableFlag())) -//// ).map(CodeBasicSecVO::getOid).collect(Collectors.toList()); -//// if (!CollectionUtils.isEmpty(unSerialSecOidList)) { -//// if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) { -//// throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��"); -//// } -//// if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid()) -//// && StringUtils.isBlank(s.getSecValue()))) { -//// throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��"); -//// } -//// } -//// } -//// -//// /** -//// * 鏍¢獙灞炴�ф槸鍚︿负蹇呰緭 -//// * -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬� -//// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� -//// */ -//// private void checkRequiredAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { -//// Map<String, CodeClstempattrVO> requiredAttrMap = templateVO.getAttributes().stream().filter( -//// s -> VciBaseUtil.getBoolean(s.getRequireflag()) && StringUtils.isBlank(s.getComponentrule()) -//// && StringUtils.isBlank(s.getClassifyinvokeattr())) -//// .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// if (!CollectionUtils.isEmpty(requiredAttrMap)) { -//// requiredAttrMap.forEach((attrId, attrVO) -> { -//// //鍙湁浼佷笟缂栫爜锛岀姸鎬侊紝澶囨敞锛屾ā鏉夸富閿紝鍒嗙被涓婚敭杩欏嚑涓槸鍥哄畾鐨勶紝鍏朵綑閮芥槸鑷閰嶇疆鐨� -//// if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) { -//// throw new VciBaseException("灞炴�с�恵0}銆戝繀椤昏杈撳叆(閫夋嫨)鍐呭", new String[]{attrVO.getName()}); -//// } -//// }); -//// } -//// } -//// -//// /** -//// * 浠庣紪鐮佺敵璇蜂俊鎭璞′笂鑾峰彇鏌愪釜灞炴�х殑鍊� -//// * -//// * @param orderDTO 缂栫爜鐢宠瀵硅薄 -//// * @param attrId 灞炴�х殑缂栧彿 -//// * @return 鍊� -//// */ -//// private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) { -//// attrId = attrId.toLowerCase(Locale.ROOT); -//// String value = null; -//// if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) { -//// value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO)); -//// } else { -//// //璇存槑鏄嚜琛岄厤缃殑 -//// //鍓嶇蹇呴』瑕佷紶閫掑皬鍐欑殑灞炴�� -//// value = orderDTO.getData().getOrDefault(attrId, ""); -//// } -//// return value; -//// } -//// -//// /** -//// * 杞崲缁勫悎瑙勫垯鐨勫�� -//// * -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬� -//// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� -//// */ -//// private void switchComponentAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { -//// Map<String, CodeClstempattrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// if (!CollectionUtils.isEmpty(compAttrVOMap)) { -//// Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO); -//// -//// Map<String, String> dataLowMap = new HashMap<>(); -//// if (!CollectionUtils.isEmpty(dataMap)) { -//// dataMap.forEach((key, value) -> { -//// dataLowMap.put(key.toLowerCase(Locale.ROOT), value); -//// }); -//// } -//// dataLowMap.putAll(orderDTO.getData()); -//// compAttrVOMap.forEach((attrId, attrVO) -> { -//// dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule())); -//// }); -//// dataLowMap.forEach((key, value) -> { -//// setValueToOrderDTO(orderDTO, key, value); -//// }); -//// } -//// } -//// -//// -//// /** -//// * 璁剧疆鏂扮殑鍊煎埌鐢宠瀵硅薄涓� -//// * -//// * @param orderDTO 缂栫爜鐢宠瀵硅薄 -//// * @param attrId 灞炴�х殑缂栧彿 -//// * @param value 鍊� -//// */ -//// private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) { -//// attrId = attrId.toLowerCase(Locale.ROOT); -//// if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) { -//// WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value); -//// } else { -//// orderDTO.getData().put(attrId, value); -//// } -//// } -//// -//// /** -//// * 鏍¢獙姝e垯琛ㄨ揪寮忔槸鍚︽纭� -//// * -//// * @param templateVO 妯℃澘鐨勪俊鎭紝蹇呴』鍖呭惈灞炴�х殑鍐呭 -//// * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅 -//// */ -//// private void checkVerifyOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { -//// Map<String, CodeClstempattrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// if (!CollectionUtils.isEmpty(verifyAttrVOMap)) { -//// verifyAttrVOMap.forEach((attrId, attrVO) -> { -//// String value = getValueFromOrderDTO(orderDTO, attrId); -//// if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyrule())) { -//// //鏍¢獙姝e垯琛ㄨ揪寮� -//// throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()}); -//// } -//// }); -//// } -//// } -//// -//// /** -//// * 鏍¢獙鍏抽敭灞炴�� -//// * -//// * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� -//// * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴�� -//// * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅 -//// */ -//// private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { -//// //鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮� -//// CodeKeyattrrepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); -//// //娉ㄦ剰鐨勬槸keyRuleVO鍙兘涓虹┖锛岃〃绀轰笉浣跨敤瑙勫垯鎺у埗 -//// //鑾峰彇鎵�鏈夌殑鍏抽敭灞炴�� -//// Map<String, CodeClstempattrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyattrflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// Map<String, String> conditionMap = new HashMap<>(); -//// boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag()); -//// //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖ -//// boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag()); -//// boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag()); -//// boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag()); -//// ketAttrMap.forEach((attrId, attrVO) -> { -//// String value = getValueFromOrderDTO(orderDTO, attrId); -//// if (value == null) { -//// value = ""; -//// } -//// wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); -//// }); -//// -//// //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� -//// -//// if (!CollectionUtils.isEmpty(conditionMap)) { -//// final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; -//// conditionMap.forEach((key, value) -> { -//// sql[0] += " and " + key + " = " + value; -//// }); -//// if (StringUtils.isNotBlank(orderDTO.getOid())) { -//// //淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸� -//// sql[0] += " and oid != '" + orderDTO.getOid() + "'"; -//// } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) { -//// sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'"; -//// } -//// sql[0] += " and islastR = '1' and islastV = '1' "; -////// if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) { -//// if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) { -//// String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}"; -//// String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"}; -//// throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs); -//// } -//// } -//// } -//// -//// /** -//// * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞 -//// * -//// * @param value 褰撳墠鐨勫�� -//// * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌� -//// * @param attrId 灞炴�х殑缂栧彿 -//// * @param trim 鏄惁鍘婚櫎绌烘牸 -//// * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓 -//// * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙� -//// * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸 -//// * @param conditionMap 鏌ヨ鏉′欢 -//// */ -//// @Override -//// public void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId, -//// boolean trim, boolean ignoreCase, boolean ignoreWidth, -//// boolean trimAll, Map<String, String> conditionMap) { -//// boolean ignoreSpace = trim || trimAll; -//// if (StringUtils.isBlank(value)) { -//// //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜� -//// conditionMap.put("t."+attrId, "null"); -//// } else { -//// if (keyRuleVO != null) { -//// String queryKey = ""; -//// String queryValue = ""; -//// -//// String temp = ""; -//// if (ignoreCase && ignoreSpace && ignoreWidth) { -//// //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙� -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")"); -//// } else if (ignoreCase && ignoreSpace && !ignoreWidth) { -//// //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")"); -//// } else if (ignoreCase && !ignoreSpace && ignoreWidth) { -//// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 -//// temp = "UPPER(to_single_byte(%s))"; -//// } else if (!ignoreCase && ignoreSpace && ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅 -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")"); -//// } else if (ignoreCase && !ignoreSpace && !ignoreWidth) { -//// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = "UPPER(%s)"; -//// } else if (!ignoreCase && !ignoreCase && ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 -//// temp = "to_single_byte(%s)"; -//// } else if (!ignoreCase && ignoreSpace && !ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")"); -//// } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = "%s"; -//// } -//// queryKey = String.format(temp, "t."+attrId); -//// queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'"); -//// conditionMap.put(queryKey, queryValue); -//// } else { -//// //涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅 -//// conditionMap.put("t."+attrId, value); -//// } -//// } -//// } -//// -//// /** -//// * 鏍¢獙鏋氫妇鐨勫唴瀹� -//// * -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬� -//// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� -//// */ -//// private void checkEnumOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { -//// //濡傛灉鏋氫妇鍙互淇敼锛屽垯涓嶉渶瑕佹牎楠屾槸鍚︾鍚堟灇涓剧殑閫夐」 -//// -//// Map<String, CodeClstempattrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumstring()) || StringUtils.isNotBlank(s.getEnumid())) && !VciBaseUtil.getBoolean(s.getEnumeditflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// if (!CollectionUtils.isEmpty(enumAttrVOMap)) { -//// enumAttrVOMap.forEach((attrId, attrVO) -> { -//// String value = getValueFromOrderDTO(orderDTO, attrId); -//// if (StringUtils.isNotBlank(value)) { -//// CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = new CodeClassifyTemplateAttrVO(); -//// BeanUtils.copyProperties(attrVO,codeClassifyTemplateAttrVO); -//// //鏈夊�兼墠鑳芥牎楠� -//// List<KeyValue> comboboxKVs = listComboboxItems(codeClassifyTemplateAttrVO); -//// if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) { -//// throw new VciBaseException("灞炴�с�恵0}銆戠殑鍊间笉绗﹀悎鏋氫妇鐨勮姹�", new String[]{attrVO.getName()}); -//// } -//// } -//// }); -//// } -//// } -//// -//// /** -//// * 杞崲鏃堕棿鐨勬牸寮� -//// * -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬� -//// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� -//// */ -//// private void switchDateAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { -//// Map<String, CodeClstempattrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodedateformat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// if (!CollectionUtils.isEmpty(dateAttrVOMap)) { -//// dateAttrVOMap.forEach((attrId, attrVO) -> { -//// String value = getValueFromOrderDTO(orderDTO, attrId); -//// if (StringUtils.isNotBlank(value)) { -//// DateConverter dateConverter = new DateConverter(); -//// dateConverter.setAsText(value); -//// value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat); -//// setValueToOrderDTO(orderDTO, attrId, value); -//// } -//// }); -//// } -//// } -//// -//// /** -//// * 鎷疯礉鏁版嵁鍒癱bo瀵硅薄涓� -//// * -//// * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� -//// * @param cbo 涓氬姟鏁版嵁 -//// * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞� -//// * @param edit 鏄惁涓轰慨鏀� -//// */ -//// private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupinEntity cbo, -//// CodeOrderDTO orderDTO, CodeClstemplateVO templateVO, -//// boolean edit) { -//// String fullPath = ""; -//// if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) { -//// fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))) -//// .map(CodeClassifyVO::getOid).collect(Collectors.joining("##")); -//// } else { -//// fullPath = classifyFullInfo.getCurrentClassifyVO().getOid(); -//// } -//// -////// BeanUtils. -//// BeanUtils.copyProperties(orderDTO.getData(),cbo); -//// cbo.setMaterialtype(Short.valueOf("1001")); -////// orderDTO.getData().forEach((key, value) -> { -////// if (!edit || (!checkUnAttrUnEdit(key) && -////// !VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) { -////// try { -////// cbo.setAttributeValue(key, value); -////// } catch (Exception e) { -////// logger.error("璁剧疆灞炴�х殑鍊奸敊璇�", e); -////// } -////// } -////// }); -//// try { -//// -//// cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid()); -//// cbo.setCodetemplateoid(templateVO.getOid()); -//// cbo.setCodeclsfpath(fullPath); -////// cbo.setMaterialclassify("model_type"); -////// cbo.setMaterialname(orderDTO.getData().get("materialname")); -////// cbo.setShifoupihaoguanli("true"); -////// cbo.setKucunwl("true"); -////// cbo.setXiaoshouwl("false"); -//// if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) { -//// //鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐪嬬敓鍛藉懆鏈熸槸鍚﹂渶瑕佸垱寤� -//// if (StringUtils.isNotBlank(cbo.getLctid())) { -////// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid()); -////// if (lifeCycleVO != null) { -////// cbo.setLcStatus("Editing"); -//////// cbo.setLcStatus(lifeCycleVO.getStartStatus()); -////// } else { -//// cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); -////// } -//// } else { -//// cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); -//// } -//// -//// } -//// -//// int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString()); -//// //鎻掍釜鐐癸紝鍚庣画鐪嬪瘑绾ф湇鍔℃槸鍚﹀彲鐢� -////// if (secret == 0 || !secretService.checkDataSecret(secret)) { -//// if (secret == 0 ) { -//// Integer userSecret = VciBaseUtil.getCurrentUserSecret(); -////// cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret)); -//// cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret); -//// } -//// } catch (Throwable e) { -//// logger.error("璁剧疆榛樿鐨勫睘鎬х殑鍊奸敊璇�", e); -//// } -//// } -//// -//// -//// /** -//// * 鍒濆鍖栦笟鍔$被鍨� -//// * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊 -//// * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐� -//// * @return CodeWupinEntity -//// * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父 -//// */ -//// @Override -//// public CodeWupinEntity createCBOByBtmName(String btmName) -//// throws VciBaseException { -//// if(btmName!=null){ -//// btmName = btmName.trim().toLowerCase(); -//// } -//// String userid = AuthUtil.getUser().getUserName(); -////// if(!hasCreatedCbos.containsKey(btmName)){ -////// if(StringUtils.isEmpty(userid)){ -////// throw new VciBaseException(msgCodePrefix +"noHasUserid"); -////// } -////// try { -////// hasCreatedCbos.put(btmName, createBusinessObject(btmName)); -////// } catch (Exception e) { -////// logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄",e); -////// throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); -////// } -////// } -////// ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); -//// -//// QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>(); -//// btmWrapper.eq("ID",btmName); -//// CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper); -////// OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); -//// String userName = AuthUtil.getUser().getUserName(); -//// CodeWupinEntity wupinEntity = new CodeWupinEntity(); -//// wupinEntity.setOid(null); -////// bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); -////// bo.setNameoid((new ObjectUtility()).getNewObjectID36()); -//// wupinEntity.setBtmname(btmName); -//// wupinEntity.setLastR(String.valueOf(1)); -//// wupinEntity.setFirstR(String.valueOf(1)); -//// wupinEntity.setFirstV(String.valueOf(1)); -//// wupinEntity.setLastV(String.valueOf(1)); -//// wupinEntity.setCreator(userName); -//// wupinEntity.setCreateTime(new Date()); -//// wupinEntity.setLastModifier(userName); -//// wupinEntity.setLastModifyTime(new Date()); -//// wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid()); -//// wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); -//// if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){ -//// //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1 -////// OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid()); -//// wupinEntity.setRevisionValue("1"); -//// } -//// -//// wupinEntity.setRevisionSeq(1); -//// wupinEntity.setVersionSeq(1); -//// //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1 -//// wupinEntity.setVersionValue("1"); -//// wupinEntity.setLctid("wupinLC"); -//// wupinEntity.setLcStatus("Editing"); -//// wupinEntity.setId(""); -//// wupinEntity.setName(""); -//// wupinEntity.setDescription(""); -//// wupinEntity.setOwner(userName); -//// wupinEntity.setCheckinby(userName); -//// wupinEntity.setCopyFromVersion(""); -//// wupinEntity.setMaterialtype((short) 1001); -//// wupinEntity.setCaigouwl("true"); -//// wupinEntity.setShifoupihaoguanli("true"); -//// wupinEntity.setKucunwl("true"); -//// wupinEntity.setXiaoshouwl("false"); -//// wupinEntity.setPassing("true"); -//// -////// this.initTypeAttributeValue(wupinEntity,btmTypeVO); -//// return wupinEntity; -//// -//// -////// return cbo; -//// } -//// -//// /** -//// * 鏄惁涓轰慨鏀瑰拷鐣ョ殑灞炴�� -//// * @param attrName 灞炴�х殑鍚嶅瓧 -//// * @return true 琛ㄧず搴旇蹇界暐 -//// */ -//// boolean checkUnAttrUnEdit(String attrName){ -//// return (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName) -//// ||"ts".equalsIgnoreCase(attrName) -//// || "lastmodifier".equalsIgnoreCase(attrName) -//// || "lastmodifytime".equalsIgnoreCase(attrName) -//// || "createtime".equalsIgnoreCase(attrName) -//// || "checkintime".equalsIgnoreCase(attrName) -//// ||"checkouttime".equalsIgnoreCase(attrName)); -//// } -//// -//// /** -//// * 淇濆瓨鍙緭鍙�夌殑淇℃伅 -//// * -//// * @param templateVO 妯℃澘鐨勫璞� -//// * @param cboList 鏁版嵁鐨勫唴瀹� -//// */ -//// @Override -//// public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ -//// List<String> cboList) { -//// if (templateVO != null && !CollectionUtils.isEmpty(cboList)) { -//// //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜� -//// List<CodeClstempattrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList()); -//// -//// if (!CollectionUtils.isEmpty(selectAttrVOs)) { -////// SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); -//// selectAttrVOs.parallelStream().forEach(attrVO -> { -//// List<String> valuesList = cboList; -////// cboList.parallelStream().forEach(cbo -> { -////// String value = cbo.get.getAttributeValue(attrVO.getId()); -////// if (StringUtils.isNotBlank(value)) { -////// valuesList.add(value); -////// } -////// }); -//// if (!CollectionUtils.isEmpty(valuesList)) { -//// for (String s : valuesList) { -//// DictBiz dictBiz = new DictBiz(); -//// dictBiz.setCode(templateVO.getBtmTypeId()); -//// dictBiz.setDictKey(s); -//// dictBiz.setDictValue(s); -//// //浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜� -//// iDictBizClient.getCheck(dictBiz); -//// } -////// charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo); -//// } -//// }); -//// } -//// } -//// } -//// -//// @Override -//// public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) { -//// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid); -//// MdmUIInfoVO uiInfoVO = new MdmUIInfoVO(); -//// uiInfoVO.setTemplateVO(templateVO); -//// uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid)); -//// wrapperResemble(templateVO, uiInfoVO); -//// return uiInfoVO; -//// } -//// -//// -//// /** -//// * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟瀹氫箟鐨勪俊鎭� -//// * -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞� -//// * @param codeClassifyOid 鍒嗙被鐨勪富閿紝涓虹┖鐨勬椂鍊欙紝鑾峰彇妯℃澘鎵�灞炵殑鍒嗙被涓婚敭.鐢ㄤ簬浜х敓鍒嗙被娉ㄥ叆 -//// * @return 琛ㄦ牸鐨勪俊鎭� -//// */ -//// private UIFormDefineVO wrapperFormDefineByTemplate(CodeClstemplateVO templateVO, String codeClassifyOid) { -//// UIFormDefineVO formDefineVO = new UIFormDefineVO(); -//// formDefineVO.setOid(templateVO.getOid()); -//// formDefineVO.setBtmType(templateVO.getBtmTypeId()); -//// if (StringUtils.isBlank(codeClassifyOid)) { -//// codeClassifyOid = templateVO.getCodeClassifyOid(); -//// } -//// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); -//// -//// List<UIFormItemVO> itemVOS = new ArrayList<>(); -//// Map<String, List<CodeClstempattrVO>> attrGroupMap = templateVO.getAttributes().stream(). -//// filter(s -> StringUtils.isNotBlank(s.getAttributegroup())).collect(Collectors.groupingBy(s -> s.getAttributegroup())); -//// -//// templateVO.getAttributes().forEach(attrVO -> { -//// UIFormItemVO formItemVO = templateAttr2FormField(attrVO, templateVO.getBtmTypeId()); -//// itemVOS.add(formItemVO); -//// }); -//// //澶勭悊灞炴�у垎缁� -//// if (!CollectionUtils.isEmpty(attrGroupMap)) { -//// //鎸夌収鍒嗙粍鐨勫睘鎬ф帓鍒楋紝鎵惧埌姣忎竴涓垎缁勭殑绗竴涓睘鎬� -//// for (String key : attrGroupMap.keySet()) { -//// List<CodeClstempattrVO> value = attrGroupMap.get(key); -//// //鎵惧埌杩欎釜鍒嗙粍鐨勫睘鎬х殑绗竴涓� -//// CodeClstempattrVO attrVO = value.stream().sorted(((o1, o2) -> o1.getOrdernum().compareTo(o2.getOrdernum()))).findFirst().get(); -//// //鎴戜滑鎵惧埌杩欎釜灞炴�у湪鏈�缁堢殑itemVOs閲岀殑浣嶇疆 -//// UIFormItemVO lineVO = new UIFormItemVO(); -//// lineVO.setField(attrVO.getId() + "_line"); -//// lineVO.setType("line"); -//// lineVO.setText(key); -//// //鎵句綅缃� -//// for (int i = 0; i < itemVOS.size(); i++) { -//// UIFormItemVO record = itemVOS.get(i); -//// if (record.getField().equalsIgnoreCase(attrVO.getId())) { -//// itemVOS.add(i, lineVO); -//// break; -//// } -//// } -//// } -//// } -//// -//// CodeOrderDTO orderDTO = new CodeOrderDTO(); -//// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); -//// if (!CollectionUtils.isEmpty(orderDTO.getData())) { -//// orderDTO.getData().forEach((key, value) -> { -//// for (int i = 0; i < itemVOS.size(); i++) { -//// UIFormItemVO itemVO = itemVOS.get(i); -//// if (itemVO.getField().equalsIgnoreCase(key)) { -//// itemVO.setDefaultValue(value); -//// break; -//// } -//// } -//// }); -//// } -//// formDefineVO.setItems(itemVOS); -//// //鏌ヨ鏄惁鏈夊垎绫绘敞鍏ョ殑 -//// return formDefineVO; -//// } -//// /** -//// * 灞炴�х被鍨嬩笌js涓殑瀛楁绫诲瀷鐨勬槧灏� -//// */ -//// private static Map<String, String> vciFieldTypeMap = new HashMap<String, String>() {{ -//// put(VciFieldTypeEnum.VTString.name(), "text"); -//// put(VciFieldTypeEnum.VTInteger.name(), "text"); -//// put(VciFieldTypeEnum.VTLong.name(), "text"); -//// put(VciFieldTypeEnum.VTDouble.name(), "text"); -//// put(VciFieldTypeEnum.VTClob.name(), "text"); -//// put(VciFieldTypeEnum.VTBoolean.name(), "truefalse"); -//// put(VciFieldTypeEnum.VTDateTime.name(), "datetime"); -//// put(VciFieldTypeEnum.VTDate.name(), "datetime"); -//// put(VciFieldTypeEnum.VTTime.name(), "datetime"); -//// put(VciFieldTypeEnum.VTFilePath.name(), "file"); -//// }}; -//// -//// /** -//// * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟鐨勫瓧娈� -//// * -//// * @param attrVO 妯℃澘灞炴�� -//// * @param btmType 涓氬姟绫诲瀷 -//// * @return 琛ㄥ崟鐨勫瓧娈� -//// */ -//// @Override -//// public UIFormItemVO templateAttr2FormField(CodeClstempattrVO attrVO, String btmType) { -//// -//// UIFormItemVO itemVO = new UIFormItemVO(); -//// if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) { -////// attrVO.setEnumid(OsEnumServiceImpl.MY_DATA_SECRET); -//// attrVO.setEnumid(MY_DATA_SECRET); -//// } -//// itemVO.setField(attrVO.getId()); -//// itemVO.setText(attrVO.getName()); -//// itemVO.setType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text")); -//// if (VciBaseUtil.getBoolean(attrVO.getTextareaflag())) { -//// itemVO.setType("textarea"); -//// } -//// if (VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(attrVO.getAttributedatatype()) -//// || VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(attrVO.getAttributedatatype()) -//// || VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrVO.getAttributedatatype())) { -//// itemVO.setVerify("number"); -//// } -//// itemVO.setReadOnly(VciBaseUtil.getBoolean(attrVO.getReadonlyflag())); -//// itemVO.setKeyAttr(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())); -//// itemVO.setRequired(VciBaseUtil.getBoolean(attrVO.getRequireflag())); -//// itemVO.setDefaultValue(attrVO.getDefaultvalue()); -//// itemVO.setDateFormate(attrVO.getCodedateformat()); -//// itemVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag())); -//// itemVO.setVerify(attrVO.getVerifyrule()); -//// itemVO.setPrefix(attrVO.getPrefixvalue()); -//// itemVO.setSuffix(attrVO.getSuffixvalue()); -//// itemVO.setTooltips(attrVO.getExplain()); -//// itemVO.setSelectLibFlag(attrVO.getLibraryidentification()); -//// //鐪嬬湅鏄惁鏈夋灇涓� -//// if ((StringUtils.isNotBlank(attrVO.getEnumstring()) -//// && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) || -//// StringUtils.isNotBlank(attrVO.getEnumid())) { -//// itemVO.setType("combox"); -//// itemVO.setComboxKey(attrVO.getEnumid()); -//// if (StringUtils.isNotBlank(attrVO.getEnumstring())) { -//// //鎸囧畾鐨勪笅鎷夋鍐呭 -//// itemVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class)); -//// if (StringUtils.isBlank(attrVO.getEnumid())) { -//// itemVO.setComboxKey(itemVO.getField() + "_data"); -//// } -//// } -//// } -//// //鐪嬫槸鍚︽湁鍙傜収 -//// if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) { -//// itemVO.setType("refer"); -//// itemVO.setShowField(itemVO.getField() + "name"); -//// if (StringUtils.isNotBlank(attrVO.getReferconfig())) { -//// //閰嶇疆鐨勫唴瀹� -//// itemVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class)); -//// } else { -//// UIFormReferVO formReferVO = new UIFormReferVO(); -//// formReferVO.setType("default"); -//// formReferVO.setReferType(attrVO.getReferbtmid()); -//// itemVO.setReferConfig(formReferVO); -//// } -//// } -//// -//// //濡傛灉鏄粍鍚堣鍒欙紝鍒嗙被娉ㄥ叆鐨勶紝鏄剧ず涓哄彧璇� -//// if (StringUtils.isNotBlank(attrVO.getComponentrule())) { -//// itemVO.setReadOnly(true); -//// itemVO.setTooltips("鏈睘鎬т负缁勫悎瑙勫垯"); -//// itemVO.setRequired(false); -//// } -//// if (StringUtils.isNotBlank(attrVO.getClassifyinvokeattr())) { -//// itemVO.setReadOnly(!VciBaseUtil.getBoolean(attrVO.getClassifyinvokeeditflag())); -//// itemVO.setTooltips("鏈睘鎬ф槸鍒嗙被娉ㄥ叆"); -//// itemVO.setRequired(false); -//// } -//// -//// if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(itemVO.getField())) { -//// //鏄敓鍛藉懆鏈熺姸鎬� -//// itemVO.setType("combox"); -//// itemVO.setComboxKey(btmType + LC_STATUS_SUBFIX); -//// } -//// return itemVO; -//// } -//// -//// -//// /** -//// * 灏佽鐩镐技椤规煡璇㈢殑鍒楄〃 -//// * -//// * @param templateVO 妯℃澘鐨勬樉绀哄璞� -//// * @param uiInfoVO 椤甸潰鐨勪俊鎭� -//// */ -//// private void wrapperResemble(CodeClstemplateVO templateVO, MdmUIInfoVO uiInfoVO) { -//// List<CodeClstempattrVO> resembleAttrList = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag()) -//// || VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).collect(Collectors.toList()); -//// if (!CollectionUtils.isEmpty(resembleAttrList) && resembleAttrList.size() > 1) { -//// UITableDefineVO resembleTable = new UITableDefineVO(); -//// resembleTable.setOid(templateVO.getOid()); -//// resembleTable.setBtmType(templateVO.getBtmTypeId()); -//// resembleTable.setDisplayQueryArea(false); -//// resembleTable.setPageVO(new UITablePageVO()); -//// //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌 -//// List<UITableFieldVO> fieldVOList = new ArrayList<>(); -//// resembleAttrList.forEach(attrVO -> { -//// UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO,false); -//// tableFieldVO.setHidden(false); -//// fieldVOList.add(tableFieldVO); -//// }); -//// List<List<UITableFieldVO>> cols = new ArrayList<>(); -//// cols.add(fieldVOList); -//// resembleTable.setCols(cols); -//// uiInfoVO.setResembleTableVO(resembleTable); -//// } -//// } -//// -//// -//// /** -//// * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸鏄剧ず鐨勯厤缃� -//// * -//// * @param attrVO 妯℃澘灞炴�� -//// * @param forEdit 鏄惁鏄紪杈戞墍闇� -//// * @return 琛ㄦ牸鐨勫瓧娈� -//// */ -//// @Override -//// public UITableFieldVO templateAttr2TableField(CodeClstempattrVO attrVO,boolean forEdit) { -//// UITableFieldVO fieldVO = new UITableFieldVO(); -//// if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) { -//// attrVO.setEnumid(MY_DATA_SECRET); -//// } -//// fieldVO.setField(attrVO.getId()); -//// fieldVO.setTitle(attrVO.getName()); -//// fieldVO.setFieldType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text")); -//// fieldVO.setSort(true); -//// fieldVO.setSortField(fieldVO.getField()); -//// fieldVO.setQueryField(fieldVO.getField()); -//// if (forEdit){ -//// fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag())); -//// }else { -//// fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getTabledisplayflag())); -//// } -//// if (attrVO.getAttrtablewidth() != null && attrVO.getAttrtablewidth() > 0) { -//// fieldVO.setMinWidth(Integer.valueOf(attrVO.getAttrtablewidth())); -//// fieldVO.setWidth(Integer.valueOf(attrVO.getAttrtablewidth())); -//// } -//// //鐪嬬湅鏄惁鏈夋灇涓� -//// if ((StringUtils.isNotBlank(attrVO.getEnumstring()) -//// && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) || -//// StringUtils.isNotBlank(attrVO.getEnumid())) { -//// fieldVO.setFieldType("combox"); -//// fieldVO.setField(fieldVO.getField() + "Text"); -//// fieldVO.setComboxKey(attrVO.getEnumid()); -//// if (StringUtils.isNotBlank(attrVO.getEnumstring())) { -//// //鎸囧畾鐨勪笅鎷夋鍐呭 -//// fieldVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class)); -//// if (StringUtils.isBlank(attrVO.getEnumid())) { -//// fieldVO.setComboxKey(fieldVO.getField() + "_data"); -//// } -//// }else { -//// List<KeyValue> osEnumItemVOList= enumService.getEnum(attrVO.getEnumid()); -//// fieldVO.setData(osEnumItemVOList); -//// } -//// } -//// //鐪嬫槸鍚︽湁鍙傜収 -//// if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) { -//// fieldVO.setFieldType("refer"); -//// fieldVO.setQueryField(fieldVO.getField()); -//// fieldVO.setField(fieldVO.getField() + "name"); -//// fieldVO.setShowField(fieldVO.getField()); -//// if (StringUtils.isNotBlank(attrVO.getReferconfig())) { -//// //閰嶇疆鐨勫唴瀹� -//// fieldVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class)); -//// } else { -//// UIFormReferVO formReferVO = new UIFormReferVO(); -//// formReferVO.setType("default"); -//// formReferVO.setReferType(attrVO.getReferbtmid()); -//// fieldVO.setReferConfig(formReferVO); -//// } -//// } -//// if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(fieldVO.getSortField())) { -//// fieldVO.setField("lcstatus_text"); -//// } -//// Map<String, String> eventJsMap = new HashMap<>(); -//// //瓒呴摼鎺ヤ笌妯℃澘鏄簰鏂� -//// if (StringUtils.isNotBlank(attrVO.getTablehref())) { -//// String event = fieldVO.getSortField() + "_href"; -//// eventJsMap.put(event, attrVO.getTablehref()); -//// fieldVO.setTemplet("function(d){ return '<a class=\"layui-btn layui-btn-intable \" lay-event=\"" + event + "\">d." + fieldVO.getField() + "</a>';}"); -//// } -//// if (StringUtils.isNotBlank(attrVO.getTabledisplayjs())) { -//// //鐩存帴鍐檉unction(d){ return xxxxx;} -//// fieldVO.setTemplet(attrVO.getTabledisplayjs()); -//// } -//// if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributedatatype())) { -//// fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}"); -//// } -//// fieldVO.setOptionJsMap(eventJsMap); -//// fieldVO.setStyle(attrVO.getTabledisplaystyle()); -//// //鍒楄〃閲屼笉鍏佽鐩存帴缂栬緫 -//// fieldVO.setDateFormate(attrVO.getCodedateformat()); -//// return fieldVO; -//// } -//// -//// -//// /** -//// * 鐩镐技椤规煡璇� -//// * -//// * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭� -//// * @return 鏁版嵁鍒楄〃 -//// */ -//// @Override -//// public DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO) { -//// VciBaseUtil.alertNotNull(orderDTO, "鐢宠鐨勪俊鎭�", orderDTO.getCodeClassifyOid(), "鍒嗙被涓婚敭", orderDTO.getTemplateOid(), "妯℃澘涓婚敭"); -//// CodeClassifyFullInfoBO fullInfoBO = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); -//// CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); -//// switchClassifyLevelOnOrder(templateVO, fullInfoBO, orderDTO); -//// switchDateAttrOnOrder(templateVO, orderDTO); -//// switchComponentAttrOnOrder(templateVO, orderDTO); -//// //闇�瑕佽幏鍙栨槸鍚︽湁鐩镐技鏌ヨ灞炴�� -//// Map<String, CodeClassifyTemplateAttrVO> attrVOs = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag())).collect(Collectors.toMap(s -> s.getId(), t -> t)); -//// if (CollectionUtils.isEmpty(attrVOs)) { -//// //閮芥病鏈夊睘鎬э紝鑲畾涓嶈兘鏌ヨ浜� -//// return new DataGrid<>(); -//// } -//// Map<String, String> conditionMap = new HashMap<>(); -//// //鎴戜滑棣栧厛鑾峰彇鏈夋病鏈夋煡璇㈣鍒� -//// CodeResembleRuleVO resembleRuleVO = Optional.ofNullable(getUseResembleRule(fullInfoBO, fullInfoBO.getCurrentClassifyVO())).orElseGet(() -> new CodeResembleRuleVO()); -//// attrVOs.forEach((attrId, attrVO) -> { -//// String value = getValueFromOrderDTO(orderDTO, attrId); -//// if (value == null) { -//// value = ""; -//// } -//// wrapperResembleConditionMap(value, resembleRuleVO, attrId, conditionMap); -//// }); -//// -//// //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� -//// if (!CollectionUtils.isEmpty(conditionMap)) { -//// Map<String, String> andConditionMap = new HashMap<>(); -//// andConditionMap.put("islastr", "1"); -//// andConditionMap.put("islastv", "1"); -//// if (StringUtils.isNotBlank(orderDTO.getOid())) { -//// andConditionMap.put("oid", QueryOptionConstant.NOTEQUAL + orderDTO.getOid()); -//// } -//// conditionMap.putAll(andConditionMap); -//// PageHelper pageHelper = new PageHelper(-1); -//// pageHelper.addDefaultDesc("id"); -//// return queryGrid(fullInfoBO.getTopClassifyVO().getBtmtypeid(), templateVO, conditionMap, pageHelper); -//// } -//// return new DataGrid<>(); -//// } -//// -//// /** -//// * 鑾峰彇浣跨敤鐨勭浉浼兼煡璇㈣鍒� -//// * -//// * @param fullInfoBO 绫诲叏閮ㄤ俊鎭� -//// * @param currentClassifyVO 褰撳墠鐨勫垎绫� -//// * @return 瑙勫垯锛屽鏋滀笉瀛樺湪浼氳繑鍥濶ull -//// */ -//// @Override -//// public CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO) { -//// if (currentClassifyVO == null) { -//// return null; -//// } -//// if (currentClassifyVO != null && StringUtils.isNotBlank(currentClassifyVO.getCodeResembleRuleOid())) { -//// //璇存槑宸茬粡瀛樺湪 -//// return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid()); -//// } -//// if (StringUtils.isBlank(currentClassifyVO.getParentcodeclassifyoid())) { -//// return null; -//// } -//// Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); -//// return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentcodeclassifyoid(), null)); -//// } -//// -//// /** -//// * 灏佽鐩镐技椤规煡璇㈢殑鏌ヨ鏉′欢鐨勬槧灏� -//// * -//// * @param value 鍊� -//// * @param resembleRuleVO 鐩镐技椤硅鍒� -//// * @param attrId 灞炴�х殑缂栧彿 -//// * @param conditionMap 鏌ヨ鏉′欢 -//// */ -//// @Override -//// public void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap) { -//// boolean ignoreSpace = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorespaceflag()) || VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); -//// if (StringUtils.isBlank(value)) { -//// //涓虹┖鐨勬椂鍊欏氨涓嶆煡璇㈠畠灏辨槸 -//// } else { -//// String queryKey = ""; -//// String queryValue = ""; -//// boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag()); -//// boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag()); -//// boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); -//// boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); -//// String temp = ""; -//// if (ignoreCase && ignoreSpace && ignoreWidth) { -//// //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙� -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte('%s')) " + (trimAll ? ",' ','')" : ")"); -//// } else if (ignoreCase && ignoreSpace && !ignoreWidth) { -//// //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")"); -//// } else if (ignoreCase && !ignoreSpace && ignoreWidth) { -//// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 -//// temp = "UPPER(to_single_byte('%s'))"; -//// } else if (!ignoreCase && ignoreSpace && ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅 -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte('%s') " + (trimAll ? ",' ','')" : ")"); -//// } else if (ignoreCase && !ignoreSpace && !ignoreWidth) { -//// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = "UPPER(%s)"; -//// } else if (!ignoreCase && !ignoreCase && ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅 -//// temp = "to_single_byte('%s')"; -//// } else if (!ignoreCase && ignoreSpace && !ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")"); -//// } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) { -//// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙� -//// temp = "%s"; -//// } -//// if (StringUtils.isNotBlank(resembleRuleVO.getLinkCharacter())) { -//// List<String> chars = VciBaseUtil.str2List(resembleRuleVO.getLinkCharacter()); -//// for (int i = 0; i < chars.size(); i++) { -//// String s = chars.get(i); -//// temp = "replace(" + temp + ",'" + s + "','')"; -//// } -//// } -//// queryValue = String.format(temp, (trim ? value.trim() : value)); -//// temp = temp.replace("to_single_byte('%s')","to_single_byte(%s)"); -//// queryKey = String.format(temp, "t."+attrId); -//// conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue); -//// } -//// } -//// -//// -//// /** -//// * 鏌ヨ缂栫爜鏁版嵁鐨勫垪琛� -//// * -//// * @param btmType 涓氬姟绫诲瀷 -//// * @param templateVO 妯℃澘鐨勫璞★紝闇�瑕佸寘鍚ā鏉跨殑灞炴�� -//// * @param conditionMap 鏌ヨ鏉′欢 -//// * @param pageHelper 鍒嗛〉瀵硅薄 -//// * @return 鏁版嵁鍒楄〃 -//// */ -//// @Override -//// public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) { -//// CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper); -////// List<Map> maps = boService.queryByOnlySqlForMap(sqlBO.getSqlHasPage()); -//// List<Map> maps = commonsMapper.selectBySql(sqlBO.getSqlHasPage()); -//// DataGrid<Map<String, String>> dataGrid = new DataGrid<>(); -//// List<Map<String, String>> dataList = new ArrayList<>(); -//// if (!CollectionUtils.isEmpty(maps)) { -//// maps.stream().forEach(map -> { -//// Map<String, String> data = new HashMap<>(); -//// map.forEach((key, value) -> { -//// data.put(((String) key).toLowerCase(Locale.ROOT), (String) value); -//// }); -//// dataList.add(data); -//// }); -//// } -//// dataGrid.setData(dataList); -//// if (!CollectionUtils.isEmpty(dataList)) { -//// wrapperData(dataGrid.getData(), templateVO, sqlBO.getSelectFieldList(), false); -//// dataGrid.setTotal(Long.parseLong(commonsMapper.selectBySql(sqlBO.getSqlCount()).get(0).values().toArray()[0].toString());); -//// } -//// return dataGrid; -//// } -//// -//// -//// /** -//// * 灏佽鏌ヨ鍑烘潵鐨勬暟鎹� -//// * -//// * @param dataMap 鏁版嵁鐨勬槧灏� -//// * @param templateVO 妯℃澘鐨勫睘鎬� -//// * @param onlySelectAttrIdList 浠呬粎鏌ヨ鐨勫睘鎬у瓧娈� -//// * @param form 琛ㄥ崟閲屼娇鐢� -//// */ -//// @Override -//// public void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO, -//// Collection<String> onlySelectAttrIdList, boolean form) { -//// if (onlySelectAttrIdList == null) { -//// onlySelectAttrIdList = new ArrayList<>(); -//// } -//// //鍏堣浆鎹竴涓嬫椂闂存牸寮� -//// List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList()); -//// List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = templateVO.getAttributes().stream().filter( -//// s -> StringUtils.isNotBlank(s.getCodeDateFormat()) && -//// (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) -//// ).collect(Collectors.toList()); -//// //鏋氫妇鐨勫唴瀹� -//// List<CodeClassifyTemplateAttrVO> enumAttrVOs = templateVO.getAttributes().stream().filter( -//// s -> (StringUtils.isNotBlank(s.getEnumId()) || StringUtils.isNotBlank(s.getEnumString())) -//// && -//// (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT))) -//// ).collect(Collectors.toList()); -//// -//// List<String> userIds = new ArrayList<>(); -//// dataMap.stream().forEach(data -> { -//// //澶勭悊鏃堕棿 -//// if (!form) { -//// //琛ㄥ崟鐨勬椂鍊欏彧鑳界敤缁熶竴鐨勬椂闂存牸寮� -//// wrapperDateFormat(dateFormatAttrVOs, data); -//// } -//// //澶勭悊鏋氫妇 -//// wrapperEnum(enumAttrVOs, data); -//// String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD); -//// String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION,""); -//// if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus)) -//// && StringUtils.isBlank(copyFromVersion) -//// ) { -//// data.put(VciQueryWrapperForDO.ID_FIELD, "******"); -//// } -//// data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), CodeDefaultLC.getTextByValue(lcstatus)); -//// if(CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) -//// && StringUtils.isNotBlank(copyFromVersion)){ -//// data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), "淇敼涓�"); -//// } -//// if (data.containsKey("creator")) { -//// userIds.add(data.get("creator")); -//// } -//// if (data.containsKey("lastmodifier")) { -//// userIds.add(data.get("lastmodifier")); -//// } -//// }); -//// if (!CollectionUtils.isEmpty(userIds)) { -//// Map<String, SmUserVO> userVOMap = Optional.ofNullable(userQueryService.listUserByUserIds(userIds)).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// dataMap.stream().forEach(data -> { -//// String creator = data.getOrDefault("creator", null); -//// if (StringUtils.isNotBlank(creator) && userVOMap.containsKey(creator.toLowerCase(Locale.ROOT))) { -//// data.put("creator", creator + "(" + userVOMap.get(creator.toLowerCase(Locale.ROOT)).getName() + ")"); -//// } -//// String lastmodifier = data.getOrDefault("lastmodifier", null); -//// if (StringUtils.isNotBlank(lastmodifier) && userVOMap.containsKey(lastmodifier.toLowerCase(Locale.ROOT))) { -//// data.put("lastmodifier", lastmodifier + "(" + userVOMap.get(lastmodifier.toLowerCase(Locale.ROOT)).getName() + ")"); -//// } -//// }); -//// } -//// } -//// -//// -//// /** -//// * 澶勭悊鏃堕棿鏍煎紡 -//// * -//// * @param dateFormatAttrVOs 鏃堕棿鏍煎紡鐨勫睘鎬� -//// * @param data 褰撳墠琛屾暟鎹� -//// */ -//// private void wrapperDateFormat(Collection<CodeClassifyTemplateAttrVO> dateFormatAttrVOs, Map<String, String> data) { -//// if (!CollectionUtils.isEmpty(dateFormatAttrVOs)) { -//// dateFormatAttrVOs.stream().forEach(dateFormatAttrVO -> { -//// String attrId = dateFormatAttrVO.getId().toLowerCase(Locale.ROOT); -//// String oldValue = data.getOrDefault(attrId, null); -//// if (StringUtils.isNotBlank(oldValue)) { -//// DateConverter dateConverter = new DateConverter(); -//// try { -//// dateConverter.setAsText(oldValue); -//// Date value = dateConverter.getValue(); -//// if (value != null) { -//// data.put(attrId, VciDateUtil.date2Str(value, dateFormatAttrVO.getCodeDateFormat())); -//// } -//// } catch (Throwable e) { -//// //杞崲鍙兘鏈夐棶棰橈紝杩欏氨浣跨敤鍘熸湰瀛樺偍鐨勫�� -//// } -//// } -//// }); -//// } -//// } -//// -//// -//// /** -//// * 澶勭悊鏋氫妇鐨勫唴瀹癸紝濡傛灉涓嶅湪鏋氫妇涓紝浼氳繑鍥炲師鏈殑鍊� -//// * -//// * @param enumAttrVOs 鏋氫妇灞炴�� -//// * @param data 褰撳墠琛屾暟鎹� -//// */ -//// private void wrapperEnum(Collection<CodeClassifyTemplateAttrVO> enumAttrVOs, Map<String, String> data) { -//// //澶勭悊鏋氫妇鐨勫唴瀹癸紝涓轰簡鍏煎浠ュ墠鐨勬暟鎹�,濡傛灉鏁版嵁涓嶈兘浣跨敤鏋氫妇杞崲鐨勮瘽锛岄偅杩樻槸鏄剧ず浠ュ墠鐨勫�� -//// if (!CollectionUtils.isEmpty(enumAttrVOs)) { -//// enumAttrVOs.stream().forEach(enumAttrVO -> { -//// String attrId = enumAttrVO.getId().toLowerCase(Locale.ROOT); -//// String oldValue = data.getOrDefault(attrId, null); -//// if (StringUtils.isNotBlank(oldValue)) { -//// List<KeyValue> comboxKVs = listComboboxItems(enumAttrVO); -//// String newValue = oldValue; -//// KeyValue keyValue = Optional.ofNullable(comboxKVs).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getKey().equalsIgnoreCase(oldValue)).findFirst().orElseGet(() -> null); -//// if (keyValue != null) { -//// newValue = keyValue.getValue(); -//// } -//// data.put(attrId + "Text", newValue); -//// } -//// }); -//// } -//// } -//// -//// -//// /** -//// * 鏍规嵁妯℃澘灞炴�х敓鎴愮浉搴旂殑sql淇℃伅 -//// * -//// * @param btmType 涓氬姟绫诲瀷 -//// * @param templateVO 妯℃澘鏄剧ず瀵硅薄锛屽繀椤诲寘鍚睘鎬� -//// * @param conditionMap 鏌ヨ鏉′欢 -//// * @param pageHelper 鍒嗛〉鍜屾帓搴忓璞� -//// * @return sql鐨勭浉鍏充俊鎭� -//// */ -//// @Override -//// public CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) { -//// //鍥犱负鍙傜収涓嶄竴瀹氭槸鍦ㄥ钩鍙扮殑灞炴�ф睜閲岄潰璁剧疆锛屾墍浠ユ垜浠緱闇�瑕佽嚜琛屽鐞� -//// //鍙傝�僔ciQueryWrapper鏉ュ鐞� -//// //1. 鎵惧埌鎵�鏈夌殑瀛楁锛� -//// Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); -//// List<String> selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList()); -//// -//// //鎵�鏈夌殑鍙傜収鐨勫瓧娈� -//// Map<String/**灞炴�у瓧娈�**/, String> joinTableList = new ConcurrentHashMap<>(); -//// 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<>(); -//// if (!CollectionUtils.isEmpty(referAttrVOs)) { -//// referAttrVOs.parallelStream().forEach(attrVO -> { -//// UIFormReferVO referVO = null; -//// if (StringUtils.isNotBlank(attrVO.getReferConfig())) { -//// referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class); -//// } else { -//// referVO = new UIFormReferVO(); -//// referVO.setReferType(attrVO.getReferBtmId()); -//// referVO.setValueField(VciQueryWrapperForDO.OID_FIELD); -//// referVO.setTextField("name"); -//// } -//// -//// String referTable = VciBaseUtil.getTableName(referVO.getReferType()); -//// String referTableNick = attrVO.getId() + "0"; -//// String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " = t." + attrVO.getId(); -//// joinTableList.put(attrVO.getId(), left); -//// String referShowField = attrVO.getId() + "Name"; -//// List<String> textFields = VciBaseUtil.str2List(referVO.getTextField()); -//// String showFieldInSource = ""; -//// if (textFields.contains("name")) { -//// showFieldInSource = "name"; -//// } else { -//// showFieldInSource = textFields.get(0); -//// } -//// referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource); -//// selectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField); -//// }); -//// } -//// Optional.ofNullable(attributeService.getDefaultAttributeVOMap()).orElseGet(() -> new HashMap<>()).keySet().stream().forEach(attrId -> { -//// if (!selectFieldList.contains(attrId) && !"secretgrade".equalsIgnoreCase(attrId)) { -//// selectFieldList.add(attrId); -//// } -//// }); -//// if (!selectFieldList.contains(CODE_FIELD)) { -//// selectFieldList.add(CODE_FIELD); -//// } -//// if (!selectFieldList.contains(CODE_CLASSIFY_OID_FIELD)) { -//// selectFieldList.add(CODE_CLASSIFY_OID_FIELD); -//// } -//// if (!selectFieldList.contains(CODE_TEMPLATE_OID_FIELD)) { -//// selectFieldList.add(CODE_TEMPLATE_OID_FIELD); -//// } -//// if (!selectFieldList.contains(CODE_FULL_PATH_FILED)) { -//// selectFieldList.add(CODE_FULL_PATH_FILED); -//// } -//// -//// //澶勭悊鏌ヨ鏉′欢 -//// //TODO 楠岃瘉sql娉ㄥ叆 -//// List<String> andSql = new ArrayList<>(); -//// List<String> orSql = new ArrayList<>(); -//// if (!CollectionUtils.isEmpty(conditionMap)) { -//// Map<String, String> orConditionMap = new HashMap<>(); -//// Map<String, String> andCondtionMap = new HashMap<>(); -//// //鍏堝垎绂籵r鐨勬煡璇㈡潯浠讹紝鍙﹀褰撴煡璇㈡潯浠舵槸绌虹殑鏃跺�欎篃涓嶆煡璇� -//// conditionMap.forEach((k, v) -> { -//// if (StringUtils.isNotBlank(v)) { -//// if (v.startsWith(QueryOptionConstant.OR)) { -//// orConditionMap.put(k, v.substring(QueryOptionConstant.OR.length())); -//// } else { -//// andCondtionMap.put(k, v); -//// } -//// } -//// }); -//// -//// andCondtionMap.forEach((k, v) -> { -//// andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap)); -//// }); -//// orConditionMap.forEach((k, v) -> { -//// orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap)); -//// }); -//// } -//// //缁勫悎璧锋潵 -//// StringBuilder andSb = new StringBuilder(); -//// andSql.stream().forEach(s -> { -//// andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE); -//// }); -//// -//// String andString = andSb.toString().trim(); -//// String endWithSql = QueryOptionConstant.AND; -//// if (andString.endsWith(endWithSql)) { -//// andString = andString.substring(0, andString.length() - endWithSql.length()); -//// } -//// -//// String orString = orSql.stream().collect(Collectors.joining(" or ")); -//// String whereSql = ""; -//// if (StringUtils.isNotBlank(orString)) { -//// if (StringUtils.isBlank(andString)) { -//// andString = " 1 = 1 "; -//// } -//// whereSql = SPACE + "(" + SPACE + andString + SPACE + ") and (" + SPACE + orString + SPACE + ")" + SPACE; -//// } else { -//// whereSql = andString + SPACE; -//// } -//// if (attrVOMap.keySet().contains("secretgrade")) { -//// Integer userSecret = VciBaseUtil.getCurrentUserSecret(); -//// if (userSecret == null || userSecret == 0) { -//// userSecret = secretService.getMinUserSecret(); -//// } -//// whereSql += " and ( t.secretGrade <= " + userSecret + ") "; -//// } -//// String tableName = VciBaseUtil.getTableName(btmType); -//// 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)) -//// + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; -//// if (pageHelper == null) { -//// pageHelper = new PageHelper(-1); -//// } -//// //鐪嬬湅鎺掑簭 -//// String orderSql = pageHelper.getOrderSql("t"); -//// sql += (orderSql == null ? "" : orderSql); -//// String whereSubfixForPage = " ) A where rownum < " + (pageHelper.getLimit() * pageHelper.getPage() + 1) + ") where RN >= " -//// + (pageHelper.getLimit() * (pageHelper.getPage() - 1) + 1); -//// String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql; -//// String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) -//// + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; -//// CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO(); -//// sqlBO.setTableName(tableName); -//// sqlBO.setJoinTable(joinTableList); -//// sqlBO.setNickName("t"); -////// sqlBO.setPageHelper(pageHelper); -//// sqlBO.setSqlHasPage(sqlHasPage); -//// sqlBO.setSqlCount(sqlCount); -//// sqlBO.setSqlUnPage(sql); -//// return sqlBO; -//// } -//// -//// -//// /** -//// * 缁勫悎鏌ヨ鏉′欢鐨剆ql -//// * -//// * @param key 瀛楁 -//// * @param value 鍚嶅瓧 -//// * @param referFieldMap 鍙傜収鐨勫瓧娈� -//// * @param attrVOMap 灞炴�х殑鏄犲皠 -//// * @return Sql璇彞 -//// */ -//// private String getConditionSql(String key, String value, Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫睘鎬�**/> referFieldMap, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { -//// if (key.endsWith("_begin")) { -//// //璇存槑鏄�>=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓� -//// String field = (key.substring(0, key.length() - 6).toLowerCase().trim()); -//// if (referFieldMap.containsKey(field)) { -//// //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚� -//// return referFieldMap.get(field) + SPACE + " >= '" + value + "'" + SPACE; -//// } else { -//// return (field.contains(".") ? "" : "t.") + field + SPACE + " >= " + getStringValueInWhere(value, field, attrVOMap); -//// } -//// } else if (key.endsWith("_end")) { -//// //璇存槑鏄�<=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓� -//// String field = (key.substring(0, key.length() - 6).toLowerCase().trim()); -//// if (referFieldMap.containsKey(field)) { -//// //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚� -//// return referFieldMap.get(field) + SPACE + " <= '" + value + "'" + SPACE; -//// } else { -//// return (field.contains(".") ? "" : "t.") + field + SPACE + " <= " + getStringValueInWhere(field, value, attrVOMap); -//// } -//// } else { -//// if (referFieldMap.containsKey(key)) { -//// //璇存槑鏄弬鐓х殑锛屾垜浠弬鐓х殑鏌ヨ閮借涓烘槸瀛楃涓诧紝濡傛灉鏄椂闂存牸寮忕殑鏌ヨ鑲畾鏈夐棶棰橈紝 -//// String selectKey = referFieldMap.get(key); -//// return getSqlByValue(selectKey, value, null); -//// } else { -//// return getSqlByValue(key, value, attrVOMap); -//// } -//// } -//// -//// } -//// -//// /** -//// * 鑾峰彇鏌ヨ鏉′欢涓殑鍊肩殑锛屽鐞嗕笉鍚岀殑绫诲瀷 -//// * -//// * @param value 鍊� -//// * @param field 瀛楁鍚嶇О -//// * @return 鏃ユ湡鎴栬�呮椂闂存牸寮忎細鍖呮嫭to_date锛屽瓧绗︿覆浼氬姞' -//// */ -//// private String getStringValueInWhere(String field, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { -//// if ((field.contains(".") && !field.toLowerCase(Locale.ROOT).startsWith("t.")) || attrVOMap == null -//// || !field.replace("t.", "").matches(RegExpConstant.LETTER) || value.startsWith(ONLY)) { -//// //璇存槑鍙兘鏄寚瀹氱殑鏌愪釜鏉′欢锛岀洿鎺ヨ繑鍥� -//// if (value.startsWith(ONLY)) { -//// value = value.replace(ONLY, ""); -//// } -//// if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) { -//// return value; -//// } -//// if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) { -//// //鏄弬鐓� -//// return "'" + value + "'"; -//// } else { -//// return value; -//// } -//// } else { -//// //鐪嬬湅鏄笉鏄繖涓璞¢噷鐨勫睘鎬� -//// if (attrVOMap.containsKey(field)) { -//// VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(attrVOMap.get(field).getAttributeDataType()); -//// if ("ts".equalsIgnoreCase(field)) { -//// return "to_timestamp('" + value + "', '" + DATETIME_FORMAT + ".ff')"; -//// } -//// DateConverter dateConverter = new DateConverter(); -//// if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) { -//// //瀹為檯涓婏紝鏁版嵁搴撻兘鏄痶imestamp鐨勭被鍨�. -//// dateConverter.setAsText(value); -//// return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')"; -//// } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) { -//// dateConverter.setAsText(value); -//// return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')"; -//// } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum) -//// || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum) -//// || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) { -//// return value; -//// } else { -//// return "'" + value + "'"; -//// } -//// } else { -//// if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) { -//// return value; -//// } -//// return "'" + value + "'"; -//// } -//// } -//// -//// } -//// -//// /** -//// * 灏佽鏈�缁堢殑sql璇彞涓殑鍊奸儴鍒� -//// * -//// * @param selectKey 鏌ヨ鐨勫瓧娈� -//// * @param value 鍊� -//// * @param attrVOMap 灞炴�х殑鏄剧ず瀵硅薄鏄犲皠 -//// * @return sql閲岀殑鍊� -//// */ -//// private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { -//// StringBuilder sql = new StringBuilder(); -//// if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || attributeService.isDefaultAttr(selectKey) || selectKey.matches(RegExpConstant.LETTER))) { -//// sql.append("t."); -//// } -//// if (value.startsWith(QueryOptionConstant.IN)) { -//// sql.append(selectKey) -//// .append(SPACE) -//// .append("in") -//// .append(SPACE) -//// .append("(") -//// .append(value.replace(QueryOptionConstant.IN, "")) -//// .append(")"); -//// } else if (value.startsWith(QueryOptionConstant.NOTIN)) { -//// sql.append(selectKey) -//// .append(SPACE) -//// .append("not in") -//// .append(SPACE) -//// .append("(") -//// .append(value.replace(QueryOptionConstant.NOTIN, "")) -//// .append(")"); -//// } else if (value.startsWith(QueryOptionConstant.NOTEQUAL)) { -//// value = value.replace(QueryOptionConstant.NOTEQUAL, ""); -//// value = getStringValueInWhere(selectKey, value, attrVOMap); -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(QueryOptionConstant.NOTEQUAL) -//// .append(SPACE) -//// .append(value); -//// } else if (value.startsWith(QueryOptionConstant.MORETHAN)) { -//// value = value.replace(QueryOptionConstant.MORETHAN, ""); -//// value = getStringValueInWhere(selectKey, value, attrVOMap); -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(QueryOptionConstant.MORETHAN) -//// .append(SPACE) -//// .append(value); -//// } else if (value.startsWith(QueryOptionConstant.MORE)) { -//// value = value.replace(QueryOptionConstant.MORE, ""); -//// value = getStringValueInWhere(selectKey, value, attrVOMap); -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(QueryOptionConstant.MORE) -//// .append(SPACE) -//// .append(value); -//// } else if (value.startsWith(QueryOptionConstant.LESSTHAN)) { -//// value = value.replace(QueryOptionConstant.LESSTHAN, ""); -//// value = getStringValueInWhere(selectKey, value, attrVOMap); -//// -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(QueryOptionConstant.LESSTHAN) -//// .append(SPACE) -//// .append(value); -//// } else if (value.startsWith(QueryOptionConstant.LESS)) { -//// value = value.replace(QueryOptionConstant.LESS, ""); -//// value = getStringValueInWhere(selectKey, value, attrVOMap); -//// -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(QueryOptionConstant.LESS) -//// .append(SPACE) -//// .append(value); -//// } else if (value.startsWith(QueryOptionConstant.ISNOTNULL)) { -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(" is not null"); -//// } else if (value.startsWith(QueryOptionConstant.ISNULL)) { -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(" is null"); -//// } else if (value.contains("*")) { -//// //璇存槑鏄痩ike锛屾垨鑰卨efe like ,right like -//// value = getStringValueInWhere(selectKey, value, attrVOMap); -//// sql.append(selectKey) -//// .append(SPACE) -//// .append("like") -//// .append(SPACE) -//// // .append("'") -//// .append(value.replace("*", "%")) -//// // .append("'") -//// .append(SPACE); -//// } else { -//// value= value.replace(SPECIAL_CHAR,REQUIRED_CHAR); -//// value = getStringValueInWhere(selectKey, value, attrVOMap); -//// -//// sql.append(selectKey) -//// .append(SPACE) -//// .append(QueryOptionConstant.EQUAL) -//// .append(SPACE) -//// .append(value); -//// } -//// sql.append(SPACE); -//// return sql.toString(); -//// } -//// -//// /** -//// * 淇敼涓婚搴撴暟鎹� -//// * -//// * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶇敤鍖呭惈鐮佹鐨勫唴瀹逛簡 -//// */ -//// @Override -//// public void editSaveCode(CodeOrderDTO orderDTO) { -//// VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭", -//// orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭"); -////// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); -//// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); -//// //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁 -////// List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getOid())); -//// -//// QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>(); -//// btmWrapper.eq("OID",orderDTO.getOid()); -//// CodeWupinEntity cbo = codeOsbtmtypeMapper.selectOne(btmWrapper); -//// -////// CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); -////// CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); -//// -//// if (cbo != null) { -//// throw new VciBaseException(DATA_OID_NOT_EXIST); -//// } -////// ClientBusinessObject cbo = cbos.get(0); -//// if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) { -//// throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯"); -//// } -//// if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) { -//// throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()}); -//// } -//// -//// //娉ㄦ剰妯℃澘涓嶈兘浣跨敤鏁版嵁瀛樺偍鐨勬椂鍊欑殑妯℃澘锛屽洜涓哄彲鑳戒細鍙樺寲 -//// -//// //1. 鍒ゆ柇蹇呰緭椤� -//// CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); -//// checkRequiredAttrOnOrder(templateVO, orderDTO); -//// //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠� -//// switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); -//// //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑 -//// switchComponentAttrOnOrder(templateVO, orderDTO); -//// //4.鏍¢獙瑙勫垯 -//// checkVerifyOnOrder(templateVO, orderDTO); -//// //5.鍒ゆ柇鍏抽敭灞炴�� -//// checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO); -//// //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭� -//// checkEnumOnOrder(templateVO, orderDTO); -//// //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍 -//// switchDateAttrOnOrder(templateVO, orderDTO); -//// //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙� -//// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); -//// //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀� -//// cbo.setDescription(orderDTO.getDescription()); -//// cbo.setName(orderDTO.getName()); -//// try { -//// cbo.setDescription(orderDTO.getDescription()); -//// cbo.setName(orderDTO.getName()); -//////// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); -////// cbo.setAttributeValue("name", orderDTO.getName()); -//// } catch (Exception e) { -//// e.printStackTrace(); -//// } -//// -//// -//// List<CodeWupinEntity> cboList = new ArrayList<>(); -//// -//// //澶囨敞 -//// cbo.setDescription(orderDTO.getDescription()); -//// cboList.add(cbo); -////// -////// cboList.add(cbo); -//// List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); -//// -//// -//// List<String> charList = new ArrayList<>(); -//// for (CodeWupinEntity wupinEntity : cboList) { -//// charList.add(wupinEntity.getId()); -//// } -//// batchSaveSelectChar(templateVO, charList); -//// return codeList.size() > 0 ? codeList.get(0) : ""; -//// -//// -//// -//// -//// //淇敼鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑 -////// BatchCBO batchCBO = new BatchCBO(); -////// batchCBO.getUpdateCbos().add(cbo); -////// List<ClientBusinessObject> cboList = new ArrayList<>(); -////// cboList.add(cbo); -////// boService.persistenceBatch(batchCBO); -//// batchSaveSelectChar(templateVO, cboList); -//// } -// +// uiInfoVO.setButtons(operationVOS); + } + return uiInfoVO; + } + + /** + * 浣跨敤鍒嗙被涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭 + */ + @Override + public List<CodeButtonVO> listButtonInToolbarByClassifyOid(String codeClassifyOid) { + CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid); + return listButtonInToolbarByTemplateOid(templateVO.getOid()); + } + + /** + * 浣跨敤妯℃澘涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭� + * + * @param templateOid 妯℃澘鐨勪富閿� + * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭 + */ + @Override + public List<CodeButtonVO> listButtonInToolbarByTemplateOid(String templateOid) { + List<CodeClassifyTemplateButtonVO> buttonVOS = templateButtonService.listButtonByTemplateOid(templateOid, true); + if (CollectionUtils.isEmpty(buttonVOS)) { + return new ArrayList<>(); + } + List<CodeClassifyTemplateButtonVO> toolbarButtons = buttonVOS.stream().filter(s -> CodeUseButtonPositionTypeEnum.TOOLBAR.getValue().equalsIgnoreCase(s.getButtonUse())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(toolbarButtons)) { + return new ArrayList<>(); + } + List<CodeButtonVO> buttonVOList = new ArrayList<>(); + for (int i = 0; i < toolbarButtons.size(); i++) { + buttonVOList.add(toolbarButtons.get(i).getButtonVO()); + } + return buttonVOList; + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java index 92eca05..689147f 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java @@ -1,49 +1,502 @@ package com.vci.ubcs.code.service.impl; -import com.alibaba.cloud.commons.lang.StringUtils; +import com.alibaba.nacos.common.utils.StringUtils; import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; import com.vci.ubcs.code.dto.CodeOrderDTO; import com.vci.ubcs.code.service.ICodeClassifyService; import com.vci.ubcs.code.service.MdmEngineService; import com.vci.ubcs.code.service.MdmIOService; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; -import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; +import com.vci.ubcs.code.vo.pagemodel.*; import com.vci.ubcs.code.vo.webserviceModel.attrmap.DataObjectVO; import com.vci.ubcs.code.vo.webserviceModel.attrmap.RowDatas; import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultDataObjectDetailDO; +import com.vci.ubcs.starter.bo.WriteExcelData; import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.poi.bo.ReadExcelOption; +import com.vci.ubcs.starter.poi.bo.SheetDataSet; +import com.vci.ubcs.starter.poi.bo.SheetRowData; +import com.vci.ubcs.starter.poi.bo.WriteExcelOption; +import com.vci.ubcs.starter.poi.util.ExcelUtil; +import com.vci.ubcs.starter.util.LocalFileUtil; +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.VciBaseUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Lazy; +import com.vci.ubcs.starter.web.util.VciDateUtil; +import lombok.AllArgsConstructor; +import org.apache.poi.hssf.usermodel.HSSFRichTextString; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.RichTextString; +import org.apache.poi.ss.usermodel.Workbook; +import org.springblade.core.redis.cache.BladeRedis; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import java.io.File; import java.util.*; import java.util.stream.Collectors; +import static com.alibaba.druid.util.FnvHash.Constants.LIMIT; import static com.vci.ubcs.code.constant.MdmEngineConstant.*; import static com.vci.ubcs.starter.poi.util.ExcelUtil.KEY_ATTR_CHAR; import static com.vci.ubcs.starter.poi.util.ExcelUtil.REQUIRED_CHAR; +@AllArgsConstructor @Service -@Slf4j public class MdmIOServiceImpl implements MdmIOService { + + /** - * 鍒嗙被鏈嶅姟灞� + * 涓婚搴撳垎绫荤殑鏈嶅姟 */ @Resource - @Lazy private ICodeClassifyService classifyService; /** - * 鍒嗙被鏈嶅姟灞� + * 妯℃澘鐨勬湇鍔� */ @Resource - @Lazy + private CodeClstemplateServiceImpl templateService; + + /** + * 涓绘暟鎹紩鎿庣殑鏈嶅姟 + */ + @Resource private MdmEngineService engineService; + + private final BladeRedis bladeRedis; + + /** + * 鐢熸垚瀵煎叆鐨勬枃浠� + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param isHistory 鏄惁鍘嗗彶鏁版嵁瀵煎叆 + * @return excel鐨勬枃浠跺湴鍧� + */ + @Override + public String createImportExcel(String codeClassifyOid, boolean isHistory) { + List<CodeClassifyTemplateVO> templateVOList=new ArrayList<>(); + + VciBaseUtil.alertNotNull("瀵煎嚭妯℃澘","瀵煎嚭鐨勯厤缃�",codeClassifyOid,"涓婚搴撳垎绫荤殑涓婚敭"); + + CodeClassifyVO codeClassifyVO = classifyService.getObjectByOid(codeClassifyOid); + + if(isHistory){ + templateVOList= templateService.childTemplates(codeClassifyOid); + }else{ + //鎵炬ā鏉� + CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyOid); + templateVOList.add(templateVO); + } + + WriteExcelOption eo = new WriteExcelOption(); + eo.setAppend(true); + //澧炲姞妯℃澘鐨勪俊鎭鍏� + LinkedList<WriteExcelData> tempEDList = new LinkedList<>(); + tempEDList.add(new WriteExcelData(0,0,"妯℃澘涓婚敭")); + tempEDList.add(new WriteExcelData(0,1,"妯℃澘浠e彿")); + tempEDList.add(new WriteExcelData(0,2,"妯℃澘鍚嶇О")); + for(int j=0;j<templateVOList.size();j++){ + CodeClassifyTemplateVO templateVO=templateVOList.get(j); + CodeClassifyTemplateVO codeClassifyTemplateVO = new CodeClassifyTemplateVO(); + BeanUtils.copyProperties(templateVO,codeClassifyTemplateVO); + //缁勫悎鏍煎紡鐨勪笉瀵煎叆锛� + // 鏋氫妇鐨勬彁渚涘簭鍒楃殑閫夋嫨 + //鏃堕棿鍏ㄩ儴缁熶竴涓簓yyy-MM-dd HH:mm:ss + //鍙傜収鐨勮嚜琛岃緭鍏ュ悕绉� + //鍒嗙被娉ㄥ叆鐨勪笉鐢紝閮芥槸瀵煎叆鍚庤嚜鍔ㄥ鐞嗙殑 + //缂栫爜锛岀姸鎬佺瓑瀛楁涓嶅鍏� + List<CodeClassifyTemplateAttrVO> templateAttrVOS = codeClassifyTemplateVO.getAttributes().stream().filter(s -> + !DEFAULT_ATTR_LIST.contains(s.getId()) + && StringUtils.isBlank(s.getComponentRule()) + && StringUtils.isBlank(s.getClassifyInvokeAttr()) + && (isHistory || VciBaseUtil.getBoolean(s.getFormDisplayFlag())) + ).collect(Collectors.toList()); + + if(CollectionUtils.isEmpty(templateAttrVOS)){ + throw new VciBaseException("妯℃澘娌℃湁閰嶇疆浠讳綍銆愯〃鍗曟樉绀恒�戜负銆愭槸銆戠殑灞炴��"); + } + List<CodeClassifyTemplateAttrVO> idAttrVOList = codeClassifyTemplateVO.getAttributes().stream().filter(s -> s.getId().equalsIgnoreCase(CODE_FIELD)).collect(Collectors.toList()); + LinkedList<WriteExcelData> excelDataList = new LinkedList<>(); + Workbook workbook = new HSSFWorkbook(); + if(isHistory){ + excelDataList.add(new WriteExcelData(0,0,"鍒嗙被璺緞")); + excelDataList.add(new WriteExcelData(0,1,"鐮佹瀹藉害")); + excelDataList.add(new WriteExcelData(0,2,!CollectionUtils.isEmpty(idAttrVOList)?idAttrVOList.get(0).getName():"浼佷笟缂栫爜")); + } + for (int i = 0; i < templateAttrVOS.size(); i++) { + CodeClassifyTemplateAttrVO attrVO = templateAttrVOS.get(i); + + Object text = attrVO.getName(); + text = exportKeyAndRequired(workbook,attrVO,text); + int colIndex = (isHistory?3:0) + i; + WriteExcelData excelData = new WriteExcelData(0, colIndex, text); + if(StringUtils.isNotBlank(attrVO.getCodeDateFormat()) + || VciFieldTypeEnum.VTDateTime.name().equalsIgnoreCase(attrVO.getAttributeDataType()) + || VciFieldTypeEnum.VTDate.name().equalsIgnoreCase(attrVO.getAttributeDataType()) + ||VciFieldTypeEnum.VTTime.name().equalsIgnoreCase(attrVO.getAttributeDataType())){ + excelData.setDateFormat(VciDateUtil.DateTimeFormat); + } + if(text instanceof RichTextString){ + excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); + } + excelDataList.add(excelData); + if(StringUtils.isNotBlank(attrVO.getEnumString()) || StringUtils.isNotBlank(attrVO.getEnumId())){ + //娣诲姞鏁版嵁鏈夋晥鎬� + List<String> enumValueList = new ArrayList<>(); + enumValueList.add(""); + List<KeyValue> valueList = engineService.listComboboxItems(attrVO); + if(!CollectionUtils.isEmpty(valueList)){ + valueList.stream().forEach(kv->{ + enumValueList.add(kv.getValue()); + }); + } + //榛樿鍔�1涓囨潯 + WriteExcelData ed = new WriteExcelData(1,colIndex,""); + ed.setRowTo(100); + ed.setColTo(colIndex); + ed.setValidation(true); + ed.setValidationDataList(enumValueList); + ed.setValidationErrorMsg("璇峰湪搴忓垪涓�夋嫨姝g‘鐨勫��"); + excelDataList.add(ed); + } + if(VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributeDataType())){ + List<String> booleanList = new ArrayList<>(); + + booleanList.add("鏄�"); + booleanList.add("鍚�"); + //榛樿鍔�1涓囨潯 + WriteExcelData ed = new WriteExcelData(1,colIndex,""); + ed.setRowTo(100); + ed.setColTo(colIndex); + ed.setValidation(true); + ed.setValidationDataList(booleanList); + ed.setValidationErrorMsg("璇峰湪搴忓垪涓�夋嫨姝g‘鐨勫��"); + excelDataList.add(ed); + } + } + eo.addSheetDataList(j+templateVO.getName(),excelDataList); + tempEDList.add(new WriteExcelData(j+1,0,templateVO.getOid())); + tempEDList.add(new WriteExcelData(j+1,1,templateVO.getId())); + tempEDList.add(new WriteExcelData(j+1,2,templateVO.getName())); + } + String excelName = LocalFileUtil.getDefaultTempFolder() + File.separator + codeClassifyVO.getName() + (isHistory?"_鍘嗗彶鏁版嵁瀵煎叆妯℃澘.xls": "_瀵煎叆妯℃澘.xls"); + eo.addSheetDataList(templateVOList.size()+"妯℃澘淇℃伅銆愯鍕垮垹闄ゆ垨绉诲姩銆�",tempEDList); + ExcelUtil.writeDataToFile(excelName,eo); + return excelName; + } + + /** + * 瀵煎嚭鐨勬椂鍊欏皝瑁呭繀杈撳拰鍏抽敭灞炴�� + * @param attrVO 灞炴�х殑鏄剧ず瀵硅薄 + * @param text 鍗曞厓鏍肩殑鍊� + */ + private Object exportKeyAndRequired(Workbook workbook,CodeClassifyTemplateAttrVO attrVO,Object text){ + //蹇呰緭鍔�*锛屽叧閿睘鎬т负钃濊壊 + if (VciBaseUtil.getBoolean(attrVO.getRequireFlag()) || VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag())) { + String value = text.toString(); + if(VciBaseUtil.getBoolean(attrVO.getRequireFlag())) { + value += REQUIRED_CHAR; + } + if(VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag())){ + value += KEY_ATTR_CHAR; + } + RichTextString ts = new HSSFRichTextString(value); + if(VciBaseUtil.getBoolean(attrVO.getRequireFlag())){ + Font font = workbook.createFont(); + font.setColor(HSSFColor.HSSFColorPredefined.RED.getIndex()); + ts.applyFont(font); + } + + if(VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag())){ + Font font = workbook.createFont(); + font.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex()); + ts.applyFont(font); + } + return ts; + } + return text; + } + + + /** + * 鎵归噺鐢宠缂栫爜鏁版嵁 + * + * @param orderDTO 缂栫爜鐢宠淇℃伅锛屽繀椤诲寘鍚垎绫讳富閿拰鐮佹鐨勪俊鎭� + * @param file excel鏂囦欢鐨勪俊鎭� + * @return 鏈夐敊璇俊鎭殑excel鐨勬枃浠� + */ + @Override + public CodeImProtRusultVO batchImportCode(CodeOrderDTO orderDTO, File file) { + VciBaseUtil.alertNotNull(orderDTO,"缂栫爜鐢宠鐩稿叧鐨勬暟鎹�",orderDTO.getCodeClassifyOid(),"涓婚搴撳垎绫讳富閿�"); + ReadExcelOption reo = new ReadExcelOption(); + reo.setReadAllSheet(true); + List<SheetDataSet> sheetDataSetList = ExcelUtil.readDataObjectFromExcel(file,null,reo); + if(CollectionUtils.isEmpty(sheetDataSetList) || CollectionUtils.isEmpty(sheetDataSetList.get(0).getRowData()) + ||sheetDataSetList.get(0).getRowData().size()<1){ + throw new VciBaseException("娌℃湁璇诲彇鍒颁换浣曠殑鏁版嵁"); + } + if(sheetDataSetList.size()>LIMIT+1){ + throw new VciBaseException("涓轰簡淇濊瘉绯荤粺鐨勭ǔ瀹氭�э紝璇蜂竴娆′笉瑕佸鍏ヨ秴杩�1涓囨潯鐨勬暟鎹�"); + } + //鍏堟壘鍒版瘡涓�琛岀殑鏍囬锛岀劧鍚庢牴鎹爣棰樻潵鑾峰彇瀵瑰簲鐨勫睘鎬� + SheetDataSet dataSet = sheetDataSetList.get(0); + //鎵剧涓�琛岋紝涓轰簡鎵炬爣棰� + CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid()); + + //鏍¢獙妯℃澘鏄笉鏄渶鏂扮殑 + checkTemplateSync(sheetDataSetList,templateVO,0); + //鍏堜笉鐢ㄧ灞炴�ф槸鍚﹂兘瀛樺湪锛屽厛杞崲涓�涓嬫暟鎹� + Map<String,String> errorMap = new HashMap<>(); + 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; + } + + /** + * 鏍¢獙妯℃澘鏄惁涓哄悓姝ョ殑 + * @param sheetDataSetList excel閲岀殑鍐呭 + * @param templateVO 妯℃澘鐨勪俊鎭� + */ + private void checkTemplateSync(List<SheetDataSet> sheetDataSetList,CodeClassifyTemplateVO templateVO,int i){ + String templateOidInExcel = ""; + String templateName=""; + if(!CollectionUtils.isEmpty(sheetDataSetList) + && sheetDataSetList.size()>1 && !CollectionUtils.isEmpty(sheetDataSetList.get(sheetDataSetList.size()-1).getColName())){ + List<SheetRowData> rowData= sheetDataSetList.get(sheetDataSetList.size()-1).getRowData(); + templateName=rowData.get(i).getData().get(2); + templateOidInExcel=rowData.get(i).getData().get(0); + //templateOidInExcel = sheetDataSetList.get(sheetDataSetList.size()-1).getColName().get(sheetDataSetList.size()-i); + } + /* if(!CollectionUtils.isEmpty(sheetDataSetList) + && sheetDataSetList.size()>1 && !CollectionUtils.isEmpty(sheetDataSetList.get(sheetDataSetList.size()-1).getColName())){ + List<SheetRowData> rowData= sheetDataSetList.get(sheetDataSetList.size()-1).getRowData(); + templateOidInExcel=rowData.get(i).getData().get(0); + //templateOidInExcel = sheetDataSetList.get(sheetDataSetList.size()-1).getColName().get(sheetDataSetList.size()-i); + }*/ + if(StringUtils.isBlank(templateOidInExcel) || !templateOidInExcel.equalsIgnoreCase(templateVO.getOid())){ + throw new VciBaseException("妯℃澘銆�"+templateName+"銆戜腑鐨勬暟鎹幏鍙栫殑妯$増淇℃伅涓庡綋鍓嶆ā鏉夸笉鍖归厤锛岃纭繚excel鏂囦欢閲屾湁銆愭ā鏉夸俊鎭�-璇峰嬁绉诲姩鎴栧垹闄ゃ�戠殑宸ヤ綔琛紝涓旂‘淇濇瘡娆″鍏ラ兘鏄厛涓嬭浇鐨勫鍏ユā鏉垮悗娣诲姞鐨勬暟鎹�"); + } + + } + + + /*** + * 鎵归噺澶勭悊鐢宠鏁版嵁 + * @param orderDTO + * @param templateVO + * @param dataSet + * @return + */ + private String batchImportCodes(CodeOrderDTO orderDTO,CodeClassifyTemplateVO templateVO,SheetDataSet dataSet,Map<String,String> errorMap,boolean isEnumType){ + List<String> codeList=new ArrayList<>(); +// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); + //瑙勫垯鐨勪富閿渶瑕佸幓鑾峰彇 +// CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo); +// //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈� +// engineService.checkSecValueOnOrder(ruleVO,orderDTO); +// List<SheetRowData> rowDataList = dataSet.getRowData(); +// +// //闄ゅ幓榛樿鐨勫睘鎬�.杩樻湁鍙湁琛ㄥ崟鏄剧ず鐨勫瓧娈垫墠瀵煎叆 +// List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s -> +// !DEFAULT_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormdisplayflag()) +// ).collect(Collectors.toList()); +// Map<Integer/**鍒楀彿**/,String/**瀛楁鐨勫悕绉�**/> fieldIndexMap = new HashMap<>(); +// List<String> titleRowData = dataSet.getColName(); +// Map<String/**涓枃鍚嶇О**/, String/**鑻辨枃鍚嶇О**/> attrNameIdMap = attrVOS.stream().collect(Collectors.toMap(s -> s.getName(), t -> t.getId().toLowerCase(Locale.ROOT),(o1, o2)->o2)); +// getFieldIndexMap(titleRowData,attrNameIdMap,fieldIndexMap); +// +// //闇�瑕佸垽鏂槸鍚︽墍鏈夌殑灞炴�ч兘鍦ㄦā鏉夸笂浜� +// List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT)) +// && StringUtils.isBlank(s.getComponentrule()) && StringUtils.isBlank(s.getClassifyinvokeattr())//缁勫悎瑙勫垯鍜屽垎绫绘敞鍏ョ‘瀹炴病缁欑敤鎴峰鍑哄幓 +// ).collect(Collectors.toList()); +// if(!CollectionUtils.isEmpty(unExistAttrVOs)){ +// throw new VciBaseException("銆�" + unExistAttrVOs.stream().map(CodeClassifyTemplateAttrVO::getName) + "銆戣繖浜涘睘鎬у湪鍒楄〃涓病鏈夋壘鍒�"); +// } +// List<ClientBusinessObject> cboList = new ArrayList<>(); +// String fullPath = getFullPath(classifyFullInfo); +// excelToCbo(classifyFullInfo,fieldIndexMap,rowDataList,templateVO,cboList,fullPath,true); +// +// //閮借浆鎹㈠畬浜嗐�傞渶瑕佹壒閲忔鏌� +// //濡傛灉鍑洪敊浜嗭紝鎴戜滑渚濈劧鎵ц鏈夋晥鐨勬暟鎹紝鏃犳晥鐨勬暟鎹啓鍥炲埌excel涓� +// //2.鍒ゆ柇蹇呰緭椤广�傘�傞渶瑕佸叏閮ㄧ殑灞炴�э紝濡傛灉鏄繀杈擄紝浣嗘槸琛ㄥ崟閲岄潰涓嶆樉绀虹殑锛屽彧鑳芥槸鍒嗙被娉ㄥ叆鎴栬�呯粍鍚堣鍒� +// batchCheckRequiredAttrOnOrder(templateVO,cboList,errorMap); +// //3.鍒ゆ柇鍏抽敭灞炴�� +// CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList); +// Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); +// Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); +// if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){ +// selfRepeatRowIndexList.stream().forEach(rowIndex->{ +// errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";鍦ㄥ綋鍓嶅鐞嗙殑鏁版嵁鏂囦欢涓叧閿睘鎬ч噸澶�" ); +// }); +// } +// if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){ +// keyAttrRepeatRowIndexList.stream().forEach(rowIndex->{ +// errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";鍏抽敭灞炴�т笌绯荤粺涓殑閲嶅" ); +// }); +// } +// //鍒嗙被娉ㄥ叆 +// batchSwitchClassifyAttrOnOrder(attrVOS,cboList,classifyFullInfo,false); +// //boolean +// reSwitchBooleanAttrOnOrder(attrVOS,cboList); +// //4.鏍¢獙瑙勫垯 +// batchCheckVerifyOnOrder(attrVOS, cboList,errorMap); +// if(isEnumType) {//鏄惁闇�瑕佹牎楠屾灇涓�/鍙傜収 +// //5.鏍¢獙鏋氫妇鏄惁姝g‘ +// batchSwitchEnumAttrOnOrder(attrVOS, cboList, errorMap); +// //7.澶勭悊鍙傜収鐨勬儏鍐� +// batchSwitchReferAttrOnOrder(attrVOS,cboList,errorMap); +// } +// //6.鏃堕棿鏍煎紡鐨勯獙璇� +// //6.鏃堕棿鐨勶紝蹇呴』缁熶竴涓簓yyy-MM-dd HH:mm:ss +// batchSwitchDateAttrOnOrder(attrVOS,cboList,errorMap); +// //鏈�鍚庡紕缁勫悎瑙勫垯 +// batchSwitchComponentAttrOnOrder(attrVOS,cboList); +// String uuid=redisService.getUUIDEveryDay(); +// Map<String, ClientBusinessObject> rowIndexCboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getAttributeValue((IMPORT_ROW_INDEX)), t -> t)); +// +// if(errorMap.size()>0) { +// createRedisDatas(uuid + "-error",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, errorMap,false); +// } +// boolean isCreateUUid=false; +// List<ClientBusinessObject> needSaveCboList = cboList.stream().filter(cbo -> { +// String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); +// return !errorMap.containsKey(rowIndex); +// }).collect(Collectors.toList()); +// //鐩镐技鏍¢獙 +// Map<String,String>resembleMap=new HashMap<>(); +// List<DataResembleVO> dataResembleVOS=new ArrayList<>(); +// String btmtypeid= classifyFullInfo.getTopClassifyVO().getBtmtypeid(); +// bathcResembleQuery(orderDTO.getCodeClassifyOid(),templateVO,needSaveCboList,resembleMap,btmtypeid,dataResembleVOS); +// if(resembleMap.size()>0) { +// isCreateUUid=true; +// if(!CollectionUtils.isEmpty(dataResembleVOS)) { +// redisService.setCacheList(uuid + "-resemble-data", dataResembleVOS); +// createRedisDatas(uuid + "-resemble",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, resembleMap, false); +// } +// } +// //鎺掗櫎閿欒鐨勶紝鍓╀笅姝g‘鐨� +// Map<String,String> newErrorMap=new HashMap<>(); +// newErrorMap.putAll(resembleMap); +// newErrorMap.putAll(errorMap); +// needSaveCboList = cboList.stream().filter(cbo -> { +// String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); +// return !newErrorMap.containsKey(rowIndex); +// }).collect(Collectors.toList()); +// if((errorMap.size()>0&&needSaveCboList.size()>0)||resembleMap.size()>0){ +// isCreateUUid=true; +// } +// createRedisByCodeClassify(uuid + "-class",templateVO,dataSet,fieldIndexMap,false); +// if(newErrorMap.size()>0) { +// createRedisDatas(uuid + "-ok",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, newErrorMap,true); +// }else { +// uuid=""; +// //瑕佹妸浠ヤ笂鐨勯敊璇殑閮芥姏鍑哄悗锛屽啀缁х画澶勭悊鏃堕棿鍜岀粍鍚堣鍒� +// needSaveCboList = cboList.stream().filter(cbo -> { +// String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); +// return !newErrorMap.containsKey(rowIndex); +// }).collect(Collectors.toList()); +// if (!CollectionUtils.isEmpty(needSaveCboList)) { +// //9.鎴戜滑澶勭悊涓氬姟鏁版嵁 +// //鐢熸垚缂栫爜鐨勫唴瀹� +// codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), needSaveCboList); +// //濡傛灉鏄紪鐮佺敓鎴愬け璐ワ紝鍒欑洿鎺ュ氨澶辫触浜嗭紝鍏朵粬鐨勫垽鏂嚭鏉ユ湁閿欒鐨勬垜浠兘缁熶竴杩斿洖鍒癳xcel閲岄潰 +// engineService.batchSaveSelectChar(templateVO, needSaveCboList); +// } +// } +// if(!isCreateUUid){ +// return uuid=""; +// } +// return uuid; + return null; + } + + @Override + public List<CodeImportTemplateVO> gridclassifys(String redisOid) { + List<CodeImportTemplateVO> codeImportTemplateVOs=new ArrayList<>(); + VciBaseUtil.alertNotNull(redisOid,"鍒嗙被",redisOid,"鍒嗙被缂撳瓨涓婚敭"); + + List<CodeImportTemplateVO> redisServiceCacheObjects=bladeRedis.lRange(redisOid,0,-1); + if(redisServiceCacheObjects!=null){ + codeImportTemplateVOs= redisServiceCacheObjects; + } + return codeImportTemplateVOs; + } + + /*** + * 浠庣紦瀛橀噷鑾峰彇鍒伴渶瑕佸鍏ョ殑鐩稿叧鏁版嵁 + * @param codeClssifyOid + * @param redisOid + * @return + */ + @Override + public DataGrid<Map<String, String>> gridDatas(String codeClssifyOid, String redisOid) { + VciBaseUtil.alertNotNull(redisOid,"瀵煎叆鐩镐技鏁版嵁",redisOid,"鏁版嵁缂撳瓨涓婚敭"); + List<CodeImprotDataVO> codeImprotDataVOs = bladeRedis.lRange(redisOid+"-"+codeClssifyOid,0,-1); +// redisService.getCacheList(redisOid+"-"+codeClssifyOid); + CodeImprotDataVO codeImprotDataVO=new CodeImprotDataVO(); + if(!CollectionUtils.isEmpty(codeImprotDataVOs)){ + if(StringUtils.isNotBlank(codeClssifyOid)){ + Map<String/**鍒嗙被鍚嶇О**/, CodeImprotDataVO/**鑻辨枃鍚嶇О**/> codeClassifyDatasMap = codeImprotDataVOs.stream().collect(Collectors.toMap(s -> s.getCodeClassifyOid(), t -> t,(o1, o2)->o2)); + if(codeClassifyDatasMap.containsKey(codeClssifyOid)){ + codeImprotDataVO= codeClassifyDatasMap.get(codeClssifyOid); + }else{ + codeImprotDataVO= codeImprotDataVOs.get(0); + } + } + } + DataGrid<Map<String, String>> dataGrid = new DataGrid<>(); + List<Map<String, String>> dataList = new ArrayList<>(); + if(codeImprotDataVO!=null){ + dataList= codeImprotDataVO.getDatas(); + } + dataGrid.setData(dataList); + if (!CollectionUtils.isEmpty(dataList)) { + dataGrid.setTotal(dataList.size()); + } + return dataGrid; + } + + /** + * + * @param oid + * @param redisOid + * @return + */ + @Override + public DataGrid<Map<String,String>> gridRowResemble(String oid,String redisOid){ + VciBaseUtil.alertNotNull(redisOid,"瀵煎叆鐩镐技鏁版嵁",redisOid,"鏁版嵁缂撳瓨涓婚敭"); + List<DataResembleVO> codeImprotDataVOs = bladeRedis.lRange(redisOid,0,-1);; + DataGrid<Map<String, String>> dataGrid = new DataGrid<>(); + List<Map<String, String>> dataList = new ArrayList<>(); + + if(!CollectionUtils.isEmpty(codeImprotDataVOs)){ + Map<String/**鍒嗙被鍚嶇О**/, DataResembleVO/**鏁版嵁瀵硅薄**/> rowResembleDataMap = codeImprotDataVOs.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t,(o1, o2)->o2)); + if(rowResembleDataMap.containsKey(oid)){ + DataResembleVO dataResembleVO= rowResembleDataMap.get(oid); + dataList= dataResembleVO.getDataList(); + } + } + + dataGrid.setData(dataList); + if (!CollectionUtils.isEmpty(dataList)) { + dataGrid.setTotal(dataList.size()); + } + return dataGrid; + } /** * 闆嗘垚鎵归噺鐢宠鏁版嵁 @@ -83,7 +536,7 @@ //闇�瑕佸垽鏂槸鍚︽墍鏈夌殑灞炴�ч兘鍦ㄦā鏉夸笂浜� List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT)) - && StringUtils.isBlank(s.getComponentRule()) && StringUtils.isBlank(s.getClassifyInvokeAttr())//缁勫悎瑙勫垯鍜屽垎绫绘敞鍏ョ‘瀹炴病缁欑敤鎴峰鍑哄幓 + && com.alibaba.cloud.commons.lang.StringUtils.isBlank(s.getComponentRule()) && com.alibaba.cloud.commons.lang.StringUtils.isBlank(s.getClassifyInvokeAttr())//缁勫悎瑙勫垯鍜屽垎绫绘敞鍏ョ‘瀹炴病缁欑敤鎴峰鍑哄幓 ).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(unExistAttrVOs)){ throw new VciBaseException("銆�" + unExistAttrVOs.stream().map(CodeClassifyTemplateAttrVO::getName) + "銆戣繖浜涘睘鎬у湪excel涓病鏈夋壘鍒�"); @@ -139,16 +592,16 @@ String title = titleRowData.get(i); String id = attrNameIdMap.getOrDefault(title.replace(KEY_ATTR_CHAR,"").replace(REQUIRED_CHAR ,""),""); - if(StringUtils.isBlank(id) && "鍒嗙被璺緞".equalsIgnoreCase(title)){ + if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "鍒嗙被璺緞".equalsIgnoreCase(title)){ id = CODE_CLASSIFY_OID_FIELD; } - if(StringUtils.isBlank(id) && "鐮佹瀹藉害".equalsIgnoreCase(title)){ + if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "鐮佹瀹藉害".equalsIgnoreCase(title)){ id = CODE_SEC_LENGTH_FIELD; } - if(StringUtils.isBlank(id) && "浼佷笟缂栫爜".equalsIgnoreCase(title)){ + if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "浼佷笟缂栫爜".equalsIgnoreCase(title)){ id = CODE_FIELD; } - if(StringUtils.isNotBlank(id)){ + if(com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(id)){ fieldIndexMap.put(i,id); } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java index 9c28997..2ebd73a 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java @@ -11,6 +11,7 @@ import com.vci.ubcs.code.enumpack.CodeGetValueTypeEnum; import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum; import com.vci.ubcs.code.enumpack.CodeSecTypeEnum; +import com.vci.ubcs.code.lifecycle.CodeAllCodeLC; import com.vci.ubcs.code.mapper.CodeSerialValueMapper; import com.vci.ubcs.code.service.ICodeWupinService; import com.vci.ubcs.code.service.MdmProductCodeService; @@ -29,6 +30,7 @@ import javax.annotation.Resource; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import static com.vci.ubcs.code.constant.MdmEngineConstant.*; @@ -702,4 +704,42 @@ return value; } + + /** + * 鍥炴敹鐮佸�� + * + * @param btmId 涓氬姟鏁版嵁鐨勪笟鍔$被鍨� + * @param businessOidCollection 涓氬姟鏁版嵁鐨勪富閿� + * @return 鏄惁鏇存柊鎴愬姛 + */ + @Override + public Boolean recycleCode(String btmId, Collection<String> businessOidCollection) { +// boolean oldPersistence = WebUtil.isPersistence(); +// WebUtil.setPersistence(false); +// BatchCBO batchCBO = new BatchCBO(); + AtomicReference<Boolean> updateFlag = new AtomicReference<>(false); + VciBaseUtil.switchCollectionForOracleIn(businessOidCollection).stream().forEach(oids-> { +// Map<String, String> conditionMap = new HashMap<>(); +// //缂栫爜瑕佽褰曚负鍥炴敹鐨勭姸鎬� +// conditionMap.put("createcodeoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); +// conditionMap.put("createcodebtm", btmId); + + QueryWrapper<CodeAllCode> wrapper = new QueryWrapper<>(); + wrapper.in("createcodeoid",QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); + wrapper.eq("createcodebtm", btmId); + + + List<CodeAllCode> allCodeDOS = codeAllCodeService.selectByWrapper(wrapper); +// allCodeMapper.selectByCondition(conditionMap, new PageHelper(-1)); + if (!CollectionUtils.isEmpty(allCodeDOS)) { + allCodeDOS.stream().forEach(codeDO->{ + codeDO.setLcStatus(CodeAllCodeLC.TASK_BACK.getValue()); + }); + updateFlag.set(codeAllCodeService.updateBatchById(allCodeDOS)); +// batchCBO.copyFromOther(allCodeMapper.batchUpdate(allCodeDOS)); + } + }); +// WebUtil.setPersistence(oldPersistence); + return updateFlag.get(); + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeButtonWrapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeButtonWrapper.java index 43e0fb2..c178bcd 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeButtonWrapper.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeButtonWrapper.java @@ -16,16 +16,12 @@ */ package com.vci.ubcs.code.wrapper; +import com.vci.ubcs.starter.web.util.BeanUtilForVCI; import com.vci.ubcs.system.cache.DictCache; import com.vci.ubcs.code.entity.CodeButton; import com.vci.ubcs.code.vo.pagemodel.CodeButtonVO; import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.redis.cache.BladeRedis; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.Func; -import org.springframework.boot.autoconfigure.security.SecurityProperties; -import java.util.List; import java.util.Objects; /** @@ -42,7 +38,9 @@ @Override public CodeButtonVO entityVO(CodeButton codebutton) { - CodeButtonVO codebuttonVO = Objects.requireNonNull(BeanUtil.copy(codebutton, CodeButtonVO.class)); + CodeButtonVO codebuttonVO = new CodeButtonVO();; + BeanUtilForVCI.copyPropertiesIgnoreCase(codebutton,codebuttonVO); + Objects.requireNonNull(codebuttonVO); codebuttonVO.setUsedpositiontypeText(DictCache.getValue("codeButtonPosition", codebutton.getUsedPositionType())); codebuttonVO.setLcStatusText(DictCache.getValue("codeLcstatus", codebutton.getLcStatus())); return codebuttonVO; -- Gitblit v1.9.3