From d1e3a87aad6f737394b33852d9496d673472ddbe Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期二, 16 五月 2023 18:19:17 +0800 Subject: [PATCH] 主要完成修改Class统一命名,与老平台命名一致,删除多余VOClass等。 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyProcessTempServiceImpl.java | 660 +++++++++++++++++++++++++++++++----------------------------- 1 files changed, 341 insertions(+), 319 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyProcessTempServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyProcessTempServiceImpl.java index 67632a2..26b1d8d 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyProcessTempServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyProcessTempServiceImpl.java @@ -1,359 +1,381 @@ package com.vci.ubcs.code.service.impl; - -import com.vci.ubcs.code.mapper.CodeClassifyProcessTempMapper; -import com.vci.ubcs.code.entity.CodeClassifyProcessTempDO; -import com.vci.ubcs.code.service.CodeClassifyProcessTempServiceI; -import com.vci.starter.revision.service.RevisionModelUtil; -import com.vci.starter.web.exception.VciBaseException; -import com.vci.starter.web.pagemodel.BaseResult; -import com.vci.starter.web.pagemodel.DataGrid; -import com.vci.starter.web.pagemodel.PageHelper; -import com.vci.starter.web.util.BeanUtil; -import com.vci.starter.web.util.BeanUtilForVCI; -import com.vci.starter.web.util.VciBaseUtil; -import com.vci.starter.web.wrapper.VciQueryWrapperForDO; -import com.vci.web.pageModel.BatchCBO; -import com.vci.web.service.WebBoServiceI; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.alibaba.cloud.commons.lang.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vci.ubcs.code.constant.MdmBtmTypeConstant; import com.vci.ubcs.code.dto.CodeClassifyProcessTempDTO; +import com.vci.ubcs.code.entity.CodeClassifyProcessTemp; +import com.vci.ubcs.code.mapper.CodeClassifyProcessTempMapper; +import com.vci.ubcs.code.service.ICodeClassifyProcessTempService; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyProcessTempVO; +import com.vci.ubcs.code.wrapper.CodeClassifyProcessTempWrapper; +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.web.pagemodel.PageHelper; +import com.vci.ubcs.starter.web.util.BeanUtil; +import com.vci.ubcs.starter.web.util.BeanUtilForVCI; +import com.vci.ubcs.starter.web.util.VciBaseUtil; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; +import org.springframework.cglib.beans.BeanMap; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; -import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.*; +import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.*; /** - * 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎湇鍔� - * @author weidy - * @date 2022-01-24 + * 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎湇鍔℃帴鍙� + * + * @author ludc + * @date 2023/5/5 */ @Service -public class CodeClassifyProcessTempServiceImpl implements CodeClassifyProcessTempServiceI { +public class CodeClassifyProcessTempServiceImpl extends ServiceImpl<CodeClassifyProcessTempMapper, CodeClassifyProcessTemp> implements ICodeClassifyProcessTempService { - /** - * 鏃ュ織 - */ - private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * 鏁版嵁鎿嶄綔灞� + */ + @Resource + private CodeClassifyProcessTempMapper codeClassifyProcessTempMapper; - /** - * 鏁版嵁鎿嶄綔灞� - */ - @Resource - private CodeClassifyProcessTempMapper codeClassifyProcessTempMapper; + /** + * 瀵硅薄鐨勬搷浣� + */ + @Autowired + private RevisionModelUtil revisionModelUtil; + /** + * 鏌ヨ鎵�鏈夌殑鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉鍜屾帓搴� + * @return 鎵ц缁撴灉 + * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 + */ + @Override + public IPage<CodeClassifyProcessTempVO> gridCodeClassifyProcessTemp(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException { + Query query = new Query(); + if (pageHelper == null) { + //pageHelper = new PageHelper(-1); + query.setSize(-1); + }else { + query.setSize(pageHelper.getLimit()); + query.setCurrent(pageHelper.getPage()); + } + query.setDescs("createTime"); + CodeClassifyProcessTemp codeClassifyProcessTemp = new CodeClassifyProcessTemp(); + BeanMap beanMap = BeanMap.create(codeClassifyProcessTemp); + beanMap.putAll(conditionMap); + IPage<CodeClassifyProcessTemp> doList = codeClassifyProcessTempMapper.selectPage(Condition.getPage(query), Condition.getQueryWrapper(codeClassifyProcessTemp)); + IPage<CodeClassifyProcessTempVO> voList = new Page<>(); + //DataGrid<CodeClassifyProcessTempVO> dataGrid=new DataGrid<>(); + if (!CollectionUtils.isEmpty(doList.getRecords())) { + voList = CodeClassifyProcessTempWrapper.build().pageVO(doList); + } + return voList; + } - /** - * 涓氬姟绫诲瀷鎿嶄綔鐨勬湇鍔� - */ - @Autowired - @Lazy - private WebBoServiceI boService; + /** + * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyProcessTempDOs 鏁版嵁瀵硅薄鍒楄〃 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父 + */ + @Override + public List<CodeClassifyProcessTempVO> codeClassifyProcessTempDO2VOs(Collection<CodeClassifyProcessTemp> codeClassifyProcessTempDOs) throws VciBaseException{ + List<CodeClassifyProcessTempVO> voList = new ArrayList<CodeClassifyProcessTempVO>(); + if(!CollectionUtils.isEmpty(codeClassifyProcessTempDOs)){ + codeClassifyProcessTempDOs.forEach(temp -> { + CodeClassifyProcessTempVO tempVO = codeClassifyProcessTempDO2VO(temp); + BeanUtilForVCI.copyPropertiesIgnoreCase(temp,tempVO); + voList.add(tempVO); + }); + } + return voList; + } - /** - * 瀵硅薄鐨勬搷浣� - */ - @Autowired - private RevisionModelUtil revisionModelUtil; + /** + * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyProcessTempDO 鏁版嵁瀵硅薄 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 + */ + @Override + public CodeClassifyProcessTempVO codeClassifyProcessTempDO2VO(CodeClassifyProcessTemp codeClassifyProcessTempDO) throws VciBaseException{ + CodeClassifyProcessTempVO vo = new CodeClassifyProcessTempVO(); + if(codeClassifyProcessTempDO != null){ + BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyProcessTempDO,vo); + //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽 + //澶勭悊鍏宠仈鐨勬ā鏉垮睘鎬� + } + return vo; + } - /** - * 鏌ヨ鎵�鏈夌殑鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� - * @param conditionMap 鏌ヨ鏉′欢 - * @param pageHelper 鍒嗛〉鍜屾帓搴� - * @return 鎵ц缁撴灉 - * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 - */ - @Override - public DataGrid<CodeClassifyProcessTempVO> gridCodeClassifyProcessTemp(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException { - if (pageHelper == null) { - pageHelper = new PageHelper(-1); - } - pageHelper.addDefaultDesc("createTime"); - List<CodeClassifyProcessTempDO> doList = codeClassifyProcessTempMapper.selectByCondition(conditionMap,pageHelper); - DataGrid<CodeClassifyProcessTempVO> dataGrid=new DataGrid<CodeClassifyProcessTempVO>(); - if (!CollectionUtils.isEmpty(doList)) { - dataGrid.setData(codeClassifyProcessTempDO2VOs(doList)); - dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(codeClassifyProcessTempMapper.countByCondition(conditionMap)))); - } - return dataGrid; - } + /** + * 澧炲姞鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� + * @param codeClassifyProcessTempDTO 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹紶杈撳璞� + * @return 鎵ц缁撴灉 + * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public CodeClassifyProcessTempVO addSave(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) throws VciBaseException{ + VciBaseUtil.alertNotNull(codeClassifyProcessTempDTO,"闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄",codeClassifyProcessTempDTO.getProcessVersion(),"娴佺▼妯℃澘鐨勭増鏈彿",codeClassifyProcessTempDTO.getCodeProcessUse(),"妯℃澘娴佺▼鐨勭敤閫�"); + if (StringUtils.isBlank(codeClassifyProcessTempDTO.getCodeProcessUse())){ + throw new VciBaseException("妯℃澘娴佺▼鐢ㄩ�斾笉鑳戒负绌�"); + } + Long count = countProcessTemplate(codeClassifyProcessTempDTO); + if(count > 0){ + throw new VciBaseException("宸插瓨鍦ㄧ浉鍚岀殑娴佺▼妯℃澘"); + } + //灏咲TO杞崲涓篋O + CodeClassifyProcessTemp codeClassifyProcessTempDO = new CodeClassifyProcessTemp(); + BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyProcessTempDTO,codeClassifyProcessTempDO); + DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeClassifyProcessTempDO, MdmBtmTypeConstant.CODE_CLASSIFY_PROCESS_TEMPLATE); + codeClassifyProcessTempMapper.insert(codeClassifyProcessTempDO); + //鍥犱负涓氬姟绫诲瀷鏈韩娌℃湁鎺у埗鐗堟湰锛屾墍鏈夊己鍒剁粰鐗堟湰revisionValue璁剧疆鍊硷紝骞冲彴涔熶細鍙樻垚绌恒�傘�傘�傘�� + //鐗堟湰鍙蜂笉鑳戒娇鐢ㄩ粯璁ょ殑灞炴�� + return CodeClassifyProcessTempWrapper.build().entityVO(codeClassifyProcessTempDO); + } - /** - * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� - * @param codeClassifyProcessTempDOs 鏁版嵁瀵硅薄鍒楄〃 - * @return 鏄剧ず瀵硅薄 - * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父 - */ - @Override - public List<CodeClassifyProcessTempVO> codeClassifyProcessTempDO2VOs(Collection<CodeClassifyProcessTempDO> codeClassifyProcessTempDOs) throws VciBaseException{ - List<CodeClassifyProcessTempVO> voList = new ArrayList<CodeClassifyProcessTempVO>(); - if(!CollectionUtils.isEmpty(codeClassifyProcessTempDOs)){ - codeClassifyProcessTempDOs.forEach(temp -> { - CodeClassifyProcessTempVO tempVO = codeClassifyProcessTempDO2VO(temp); - BeanUtilForVCI.copyPropertiesIgnoreCase(temp,tempVO); - voList.add(tempVO); - }); - } - return voList; - } + /** + * 淇敼鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� + * @param codeClassifyProcessTempDTO 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹紶杈撳璞� + * @return 鎵ц缁撴灉 + * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public CodeClassifyProcessTempVO editSave(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) throws VciBaseException{ + VciBaseUtil.alertNotNull(codeClassifyProcessTempDTO,"鏁版嵁瀵硅薄",codeClassifyProcessTempDTO.getOid(),"鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉夸富閿�",codeClassifyProcessTempDTO.getProcessVersion(),"娴佺▼妯℃澘鐨勭増鏈彿",codeClassifyProcessTempDTO.getName(),"娴佺▼妯℃澘鐨勫悕绉�"); + //灏咲TO杞崲涓篋O + CodeClassifyProcessTemp codeClassifyProcessTempDO = selectByOid(codeClassifyProcessTempDTO.getOid()); + revisionModelUtil.copyFromDTOIgnore(codeClassifyProcessTempDTO,codeClassifyProcessTempDO); + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeClassifyProcessTempDO); + codeClassifyProcessTempMapper.updateById(codeClassifyProcessTempDO); + return CodeClassifyProcessTempWrapper.build().entityVO(codeClassifyProcessTempDO); + } - /** - * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� - * @param codeClassifyProcessTempDO 鏁版嵁瀵硅薄 - * @return 鏄剧ず瀵硅薄 - * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 - */ - @Override - public CodeClassifyProcessTempVO codeClassifyProcessTempDO2VO(CodeClassifyProcessTempDO codeClassifyProcessTempDO) throws VciBaseException{ - CodeClassifyProcessTempVO vo = new CodeClassifyProcessTempVO(); - if(codeClassifyProcessTempDO != null){ - BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyProcessTempDO,vo); - //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽 - //澶勭悊鍏宠仈鐨勬ā鏉垮睘鎬� + /** + * 鍒犻櫎鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� + * @param codeClassifyProcessTempDTO 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈� + * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐� + * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯� + */ + @Override + @Transactional(rollbackFor = Exception.class) + public R deleteCodeClassifyProcessTemp(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) throws VciBaseException{ + VciBaseUtil.alertNotNull(codeClassifyProcessTempDTO,"鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹璞�",codeClassifyProcessTempDTO.getOid(),"鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉跨殑涓婚敭"); + CodeClassifyProcessTemp codeClassifyProcessTempDO = selectByOid(codeClassifyProcessTempDTO.getOid()); + R baseResult = checkIsCanDeleteForDO(codeClassifyProcessTempDTO,codeClassifyProcessTempDO); + if(baseResult.isSuccess()) { + }else{ + return baseResult; + } + //鎵ц鍒犻櫎鎿嶄綔 + boolean batchCBO = codeClassifyProcessTempMapper.deleteById(codeClassifyProcessTempDO.getOid()) > 0; + return batchCBO?R.success(DELETE_SUCCESS):R.fail(DELETE_FAIL); + } - } - return vo; - } + /** + * 涓婚敭鑾峰彇鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� + * @param oid 涓婚敭 + * @return 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎樉绀哄璞� + * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父 + */ + @Override + public CodeClassifyProcessTempVO getObjectByOid(String oid) throws VciBaseException{ + return CodeClassifyProcessTempWrapper.build().entityVO((selectByOid(oid))); + } - /** - * 澧炲姞鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� - * @param codeClassifyProcessTempDTO 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹紶杈撳璞� - * @return 鎵ц缁撴灉 - * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父 - */ - @Override - public CodeClassifyProcessTempVO addSave(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) throws VciBaseException{ - VciBaseUtil.alertNotNull(codeClassifyProcessTempDTO,"闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄",codeClassifyProcessTempDTO.getProcessVersion(),"娴佺▼妯℃澘鐨勭増鏈彿",codeClassifyProcessTempDTO.getCodeprocessuse(),"妯℃澘娴佺▼鐨勭敤閫�"); - if (StringUtils.isBlank(codeClassifyProcessTempDTO.getCodeprocessuse())){ - throw new VciBaseException("妯℃澘娴佺▼鐢ㄩ�斾笉鑳戒负绌�"); - } - Long count = countProcessTemplate(codeClassifyProcessTempDTO); - if(count > 0){ - throw new VciBaseException("宸插瓨鍦ㄧ浉鍚岀殑娴佺▼妯℃澘"); - } - //灏咲TO杞崲涓篋O - CodeClassifyProcessTempDO codeClassifyProcessTempDO = new CodeClassifyProcessTempDO(); - BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyProcessTempDTO,codeClassifyProcessTempDO); - codeClassifyProcessTempMapper.insert(codeClassifyProcessTempDO); - //鍥犱负涓氬姟绫诲瀷鏈韩娌℃湁鎺у埗鐗堟湰锛屾墍鏈夊己鍒剁粰鐗堟湰revisionValue璁剧疆鍊硷紝骞冲彴涔熶細鍙樻垚绌恒�傘�傘�傘�� - //鐗堟湰鍙蜂笉鑳戒娇鐢ㄩ粯璁ょ殑灞炴�� - return codeClassifyProcessTempDO2VO(codeClassifyProcessTempDO); - } + /** + * 涓婚敭鎵归噺鑾峰彇鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� + * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� + * @return 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎樉绀哄璞� + * @throws VciBaseException 鏌ヨ鍑虹幇寮傚父鏃朵細鎶涘嚭 + */ + @Override + public Collection<CodeClassifyProcessTempVO> listCodeClassifyProcessTempByOids(Collection<String> oidCollections) throws VciBaseException{ + VciBaseUtil.alertNotNull(oidCollections,"鏁版嵁瀵硅薄涓婚敭闆嗗悎"); + List<CodeClassifyProcessTemp> codeClassifyProcessTempDOList = listCodeClassifyProcessTempDOByOidCollections(oidCollections); + return CodeClassifyProcessTempWrapper.build().listVO(codeClassifyProcessTempDOList); + } - /** - * 鑾峰彇娴佺▼妯℃澘鏄惁宸茬粡瀛樺湪浜� - * @param codeClassifyProcessTempDTO 鏁版嵁浼犺緭瀵硅薄 - * @return 涓暟 - */ - private Long countProcessTemplate(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) { - String templateName = codeClassifyProcessTempDTO.getName(); - if (StringUtils.isBlank(templateName)){ - throw new VciBaseException("妯℃澘娴佺▼鍚嶇О涓嶈兘涓虹┖"); - } - Map<String,String> conditionMap = new HashMap<>(); - conditionMap.put("codeProcessUse",codeClassifyProcessTempDTO.getCodeprocessuse()); - conditionMap.put("id",codeClassifyProcessTempDTO.getId()); - conditionMap.put("classifyTemplateOid", codeClassifyProcessTempDTO.getClassifyTemplateOid()); - VciQueryWrapperForDO wrapper = new VciQueryWrapperForDO(conditionMap,CodeClassifyProcessTempDO.class); - Long count = codeClassifyProcessTempMapper.countByWrapper(wrapper); - return count; - } + /** + * 鍙傜収鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉垮垪琛� + * @param conditionMap 鏌ヨ鏉′欢 + * @param pageHelper 鍒嗛〉鍜屾帓搴� + * @return 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹� + * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 + */ + @Override + public IPage<CodeClassifyProcessTempVO> refDataGridCodeClassifyProcessTemp(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException{ + if(conditionMap == null){ + conditionMap = new HashMap<String, String>(); + } + return gridCodeClassifyProcessTemp(conditionMap,pageHelper); - /** - * 淇敼鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� - * @param codeClassifyProcessTempDTO 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹紶杈撳璞� - * @return 鎵ц缁撴灉 - * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父 - */ - @Override - public CodeClassifyProcessTempVO editSave(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) throws VciBaseException{ - VciBaseUtil.alertNotNull(codeClassifyProcessTempDTO,"鏁版嵁瀵硅薄",codeClassifyProcessTempDTO.getOid(),"鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉夸富閿�",codeClassifyProcessTempDTO.getProcessVersion(),"娴佺▼妯℃澘鐨勭増鏈彿",codeClassifyProcessTempDTO.getName(),"娴佺▼妯℃澘鐨勫悕绉�"); - //灏咲TO杞崲涓篋O - CodeClassifyProcessTempDO codeClassifyProcessTempDO = selectByOid(codeClassifyProcessTempDTO.getOid()); - revisionModelUtil.copyFromDTOIgnore(codeClassifyProcessTempDTO,codeClassifyProcessTempDO); - codeClassifyProcessTempMapper.updateByPrimaryKey(codeClassifyProcessTempDO); - return codeClassifyProcessTempDO2VO(codeClassifyProcessTempDO); - } + } + /** + * 鑾峰彇娴佺▼鐨勬ā鏉跨殑淇℃伅 + * + * @param codeTemplateOid 妯℃澘鐨勪富閿� + * @param processUse 鐢ㄩ�� + * @return 妯℃澘鐨勪俊鎭� + */ + @Override + public List<CodeClassifyProcessTempVO> listProcessTemplate(String codeTemplateOid, String processUse) { + if(StringUtils.isBlank(codeTemplateOid) || StringUtils.isBlank(processUse)){ + return new ArrayList<>(); + } + Map<String,String> conditionMap =new HashMap<>(); + conditionMap.put("classifyTemplateOid",codeTemplateOid); + conditionMap.put("codeprocessuse",processUse); + LambdaQueryWrapper<CodeClassifyProcessTemp> wrapper = Wrappers.<CodeClassifyProcessTemp>query() + .lambda().eq(CodeClassifyProcessTemp::getClassifyTemplateOid, codeTemplateOid) + .eq(CodeClassifyProcessTemp::getCodeProcessUse, processUse); + return CodeClassifyProcessTempWrapper.build().listVO(codeClassifyProcessTempMapper.selectList(wrapper)); + } - /** - * 鏍¢獙鏄惁鍙互鍒犻櫎锛屽鏋滃瓨鍦ㄤ笅绾э紝骞朵笖涓嬬骇鏈夋暟鎹紩鐢ㄥ垯涓嶈兘鍒犻櫎 - * @param codeClassifyProcessTempDTO 鏁版嵁浼犺緭瀵硅薄 - * @param codeClassifyProcessTempDO 鏁版嵁搴撲腑鐨勬暟鎹璞� - * @return success涓簍rue涓哄彲浠ュ垹闄わ紝false琛ㄧず鏈夋暟鎹紩鐢紝obj涓簍rue琛ㄧず鏈変笅绾� - */ - private BaseResult checkIsCanDeleteForDO(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO, CodeClassifyProcessTempDO codeClassifyProcessTempDO) { - CodeClassifyProcessTempDO tempDO = new CodeClassifyProcessTempDO(); - BeanUtil.convert(codeClassifyProcessTempDTO,tempDO); - boService.checkTs(tempDO); - if(!checkIsLinked(codeClassifyProcessTempDO.getOid())) { - return BaseResult.success(); - }else{ - return BaseResult.fail(DATA_LINKED_NOT_DELETE,new String[]{""}); - } - } + /** + * 浣跨敤鏌ヨ灏佽鍣ㄦ潵鏌ヨ + * @param queryWrapper 鏌ヨ灏佽鍣� + * @return 鏁版嵁瀵硅薄 + */ + @Override + public List<CodeClassifyProcessTempVO> selectByWrapper(LambdaQueryWrapper<CodeClassifyProcessTemp> queryWrapper) { + List<CodeClassifyProcessTemp> codeClassifyProcessTempDOList= codeClassifyProcessTempMapper.selectList(queryWrapper); + return CodeClassifyProcessTempWrapper.build().listVO(codeClassifyProcessTempDOList); + } - /** - * 鏍¢獙鏄惁琚紩鐢� - * @param oid 涓婚敭 - * @throws VciBaseException 琚紩鐢ㄧ殑鏃跺�欎細鎶涘嚭寮傚父 - */ - private boolean checkIsLinked(String oid) throws VciBaseException{ - //TODO 娣诲姞闇�瑕佹牎楠屽紩鐢ㄧ殑鍦版柟 - return false; - } + /** + * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄 + * @param oidCollections 涓婚敭鐨勯泦鍚� + * @return 鏁版嵁瀵硅薄鍒楄〃 + */ + private List<CodeClassifyProcessTemp> listCodeClassifyProcessTempDOByOidCollections(Collection<String> oidCollections){ + List<CodeClassifyProcessTemp> codeClassifyProcessTempDOList = new ArrayList<CodeClassifyProcessTemp>(); + if(!CollectionUtils.isEmpty(oidCollections)){ + Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); + for(Collection<String> oids: oidCollectionsList){ + //List<CodeClassifyProcessTemp> tempDOList = codeClassifyProcessTempMapper.selectByPrimaryKeyCollection(oids); + List<CodeClassifyProcessTemp> tempDOList = codeClassifyProcessTempMapper.selectBatchIds(oids); + if(!CollectionUtils.isEmpty(tempDOList)){ + codeClassifyProcessTempDOList.addAll(tempDOList); + } + } + } + return codeClassifyProcessTempDOList; + } - /** - * 鍒犻櫎鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� - * @param codeClassifyProcessTempDTO 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈� - * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐� - * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯� - */ - @Override - public BaseResult deleteCodeClassifyProcessTemp(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) throws VciBaseException{ - VciBaseUtil.alertNotNull(codeClassifyProcessTempDTO,"鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎暟鎹璞�",codeClassifyProcessTempDTO.getOid(),"鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉跨殑涓婚敭"); - CodeClassifyProcessTempDO codeClassifyProcessTempDO = selectByOid(codeClassifyProcessTempDTO.getOid()); - BaseResult baseResult = checkIsCanDeleteForDO(codeClassifyProcessTempDTO,codeClassifyProcessTempDO); - if(baseResult.isSuccess()) { - }else{ - return baseResult; - } - //鎵ц鍒犻櫎鎿嶄綔 - BatchCBO batchCBO = codeClassifyProcessTempMapper.deleteByPrimaryKey(codeClassifyProcessTempDO.getOid()); - return (batchCBO!=null && batchCBO.getDeleteCbos() !=null &&batchCBO.getDeleteCbos().size() > 0)?BaseResult.successMsg(DELETE_SUCCESS):BaseResult.fail(DELETE_FAIL); - } + /** + * 鏍¢獙鏄惁鍙互鍒犻櫎锛屽鏋滃瓨鍦ㄤ笅绾э紝骞朵笖涓嬬骇鏈夋暟鎹紩鐢ㄥ垯涓嶈兘鍒犻櫎 + * @param codeClassifyProcessTempDTO 鏁版嵁浼犺緭瀵硅薄 + * @param codeClassifyProcessTempDO 鏁版嵁搴撲腑鐨勬暟鎹璞� + * @return success涓簍rue涓哄彲浠ュ垹闄わ紝false琛ㄧず鏈夋暟鎹紩鐢紝obj涓簍rue琛ㄧず鏈変笅绾� + */ + private R checkIsCanDeleteForDO(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO, CodeClassifyProcessTemp codeClassifyProcessTempDO) { + CodeClassifyProcessTemp tempDO = new CodeClassifyProcessTemp(); + BeanUtil.convert(codeClassifyProcessTempDTO,tempDO); + if (!checkTs(tempDO,codeClassifyProcessTempDO)) { + return R.fail(TS_NOT_PROCESS); + } + if(!checkIsLinked(codeClassifyProcessTempDO.getOid())) { + return R.success("success"); + }else{ + return R.fail(DATA_LINKED_NOT_DELETE); + } + } - /** - * 涓婚敭鑾峰彇鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� - * @param oid 涓婚敭 - * @return 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎樉绀哄璞� - * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父 - */ - @Override - public CodeClassifyProcessTempVO getObjectByOid(String oid) throws VciBaseException{ - return codeClassifyProcessTempDO2VO(selectByOid(oid)); - } + /** + * 妫�鏌s + * @param tempDO + * @return + */ + private boolean checkTs(CodeClassifyProcessTemp tempDO, CodeClassifyProcessTemp codeClassifyProcessTempDO){ + Date dbTs = codeClassifyProcessTempDO.getTs(); + Date currentTs = tempDO.getTs(); + if(currentTs == null ? dbTs == null:currentTs.compareTo(dbTs)==0){ + return true; + } + return false; + } - /** - * 涓婚敭鏌ヨ鏁版嵁瀵硅薄 - * @param oid 涓婚敭 - * @return 鏁版嵁瀵硅薄 - * @throws VciBaseException 鍙傛暟涓虹┖锛屽苟涓旀暟鎹笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父 - */ - private CodeClassifyProcessTempDO selectByOid(String oid) throws VciBaseException{ - VciBaseUtil.alertNotNull(oid,"涓婚敭"); - CodeClassifyProcessTempDO codeClassifyProcessTempDO = codeClassifyProcessTempMapper.selectByPrimaryKey(oid.trim()); - if(codeClassifyProcessTempDO == null || StringUtils.isBlank(codeClassifyProcessTempDO.getOid())){ - throw new VciBaseException(DATA_OID_NOT_EXIST); - } - return codeClassifyProcessTempDO; - } + /** + * 鏍¢獙鏄惁琚紩鐢� + * @param oid 涓婚敭 + * @throws VciBaseException 琚紩鐢ㄧ殑鏃跺�欎細鎶涘嚭寮傚父 + */ + private boolean checkIsLinked(String oid) throws VciBaseException{ + //TODO 娣诲姞闇�瑕佹牎楠屽紩鐢ㄧ殑鍦版柟 + return false; + } - /** - * 涓婚敭鎵归噺鑾峰彇鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉� - * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� - * @return 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎樉绀哄璞� - * @throws VciBaseException 鏌ヨ鍑虹幇寮傚父鏃朵細鎶涘嚭 - */ - @Override - public Collection<CodeClassifyProcessTempVO> listCodeClassifyProcessTempByOids(Collection<String> oidCollections) throws VciBaseException{ - VciBaseUtil.alertNotNull(oidCollections,"鏁版嵁瀵硅薄涓婚敭闆嗗悎"); - List<CodeClassifyProcessTempDO> codeClassifyProcessTempDOList = listCodeClassifyProcessTempDOByOidCollections(oidCollections); - return codeClassifyProcessTempDO2VOs(codeClassifyProcessTempDOList); - } + /** + * 涓婚敭鏌ヨ鏁版嵁瀵硅薄 + * @param oid 涓婚敭 + * @return 鏁版嵁瀵硅薄 + * @throws VciBaseException 鍙傛暟涓虹┖锛屽苟涓旀暟鎹笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父 + */ + private CodeClassifyProcessTemp selectByOid(String oid) throws VciBaseException{ + VciBaseUtil.alertNotNull(oid,"涓婚敭"); + CodeClassifyProcessTemp codeClassifyProcessTempDO = codeClassifyProcessTempMapper.selectById(oid.trim()); + if(codeClassifyProcessTempDO == null || StringUtils.isBlank(codeClassifyProcessTempDO.getOid())){ + throw new VciBaseException(DATA_OID_NOT_EXIST); + } + return codeClassifyProcessTempDO; + } - /** - * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄 - * @param oidCollections 涓婚敭鐨勯泦鍚� - * @return 鏁版嵁瀵硅薄鍒楄〃 - */ - private List<CodeClassifyProcessTempDO> listCodeClassifyProcessTempDOByOidCollections(Collection<String> oidCollections){ - List<CodeClassifyProcessTempDO> codeClassifyProcessTempDOList = new ArrayList<CodeClassifyProcessTempDO>(); - if(!CollectionUtils.isEmpty(oidCollections)){ - Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); - for(Collection<String> oids: oidCollectionsList){ - List<CodeClassifyProcessTempDO> tempDOList = codeClassifyProcessTempMapper.selectByPrimaryKeyCollection(oids); - if(!CollectionUtils.isEmpty(tempDOList)){ - codeClassifyProcessTempDOList.addAll(tempDOList); - } - } - } - return codeClassifyProcessTempDOList; - } + /** + * 鑾峰彇娴佺▼妯℃澘鏄惁宸茬粡瀛樺湪浜� + * @param codeClassifyProcessTempDTO 鏁版嵁浼犺緭瀵硅薄 + * @return 涓暟 + */ + private Long countProcessTemplate(CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) { + String templateName = codeClassifyProcessTempDTO.getName(); + if (StringUtils.isBlank(templateName)){ + throw new VciBaseException("妯℃澘娴佺▼鍚嶇О涓嶈兘涓虹┖"); + } + LambdaQueryWrapper<CodeClassifyProcessTemp> wrapper = Wrappers.<CodeClassifyProcessTemp>query() + .lambda().eq(CodeClassifyProcessTemp::getCodeProcessUse, codeClassifyProcessTempDTO.getCodeProcessUse()) + .eq(CodeClassifyProcessTemp::getClassifyTemplateOid, codeClassifyProcessTempDTO.getClassifyTemplateOid()) + .eq(CodeClassifyProcessTemp::getId, codeClassifyProcessTempDTO.getId()); + Long count = codeClassifyProcessTempMapper.selectCount(wrapper); + return count; + } + /** + * 妯℃澘鍒犻櫎鐨勬椂鍊欒Е鍙� + * + * @param classifyTemplateOid 妯℃澘鐨勪富閿� + * @return 鍙楀奖鍝嶇殑鍐呭 + */ + @Override + public int codeTemplateDeleteTrigger(String classifyTemplateOid) { + int updateCount = 0; + if(com.alibaba.nacos.api.utils.StringUtils.isBlank(classifyTemplateOid)){ + Map<String,Object> conditionMap = new HashMap<>(); + conditionMap.put("classifyTemplateOid",classifyTemplateOid); + List<CodeClassifyProcessTemp> codeClsflowtempEntities = baseMapper.selectByMap(conditionMap); + if(!CollectionUtils.isEmpty(codeClsflowtempEntities)){ + updateCount += baseMapper.deleteBatchIds(codeClsflowtempEntities.stream() + .map(CodeClassifyProcessTemp::getOid).collect(Collectors.toList())); + } + } + return updateCount; + } - - /** - * 鍙傜収鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉垮垪琛� - * @param conditionMap 鏌ヨ鏉′欢 - * @param pageHelper 鍒嗛〉鍜屾帓搴� - * @return 鍒嗙被浣跨敤鐨勬祦绋嬫ā鏉挎樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹� - * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 - */ - @Override - public DataGrid<CodeClassifyProcessTempVO> refDataGridCodeClassifyProcessTemp(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException{ - if(conditionMap == null){ - conditionMap = new HashMap<String, String>(); - } - return gridCodeClassifyProcessTemp(conditionMap,pageHelper); - } - - /** - * 妯℃澘鍒犻櫎鐨勬椂鍊欒Е鍙� - * - * @param classifyTemplateOid 妯℃澘鐨勪富閿� - * @return 鍙楀奖鍝嶇殑鍐呭 - */ - @Override - public BatchCBO codeTemplateDeleteTrigger(String classifyTemplateOid) { - BatchCBO batchCBO = new BatchCBO(); - if(StringUtils.isBlank(classifyTemplateOid)){ - Map<String,String> conditionMap = new HashMap<>(); - conditionMap.put("classifyTemplateOid",classifyTemplateOid); - List<CodeClassifyProcessTempDO> processTempDOS = codeClassifyProcessTempMapper.selectByCondition(conditionMap, new PageHelper(-1)); - if(!CollectionUtils.isEmpty(processTempDOS)){ - batchCBO.copyFromOther(codeClassifyProcessTempMapper.batchDeleteByOids(processTempDOS.stream().map(CodeClassifyProcessTempDO::getOid).collect(Collectors.toList()))); - } - } - return batchCBO; - } - - /** - * 鑾峰彇娴佺▼鐨勬ā鏉跨殑淇℃伅 - * - * @param codeTemplateOid 妯℃澘鐨勪富閿� - * @param processUse 鐢ㄩ�� - * @return 妯℃澘鐨勪俊鎭� - */ - @Override - public List<CodeClassifyProcessTempVO> listProcessTemplate(String codeTemplateOid, String processUse) { - if(StringUtils.isBlank(codeTemplateOid) || StringUtils.isBlank(processUse)){ - return new ArrayList<>(); - } - Map<String,String> conditionMap =new HashMap<>(); - conditionMap.put("classifyTemplateOid",codeTemplateOid); - conditionMap.put("codeprocessuse",processUse); - return codeClassifyProcessTempDO2VOs(codeClassifyProcessTempMapper.selectByCondition(conditionMap,null)); - } - - @Override - public CodeClassifyProcessTempVO getProcessTempVOByName(String codeTemplateOid,String processName) { - if (StringUtils.isBlank(processName)){ - return new CodeClassifyProcessTempVO(); - } - Map<String,String> conditionMap = new HashMap<>(); - conditionMap.put("classifyTemplateOid",codeTemplateOid); - conditionMap.put("name",processName); - return codeClassifyProcessTempDO2VO(codeClassifyProcessTempMapper.selectByCondition(conditionMap,null).get(0)); - } } - -- Gitblit v1.9.3