| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.vci.ubcs.code.constant.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.code.dto.CodeBasicSecDTO; |
| | | import com.vci.ubcs.code.entity.CodeBasicSec; |
| | | import com.vci.ubcs.code.entity.CodeClassify; |
| | | import com.vci.ubcs.code.entity.CodeClassifyValue; |
| | | import com.vci.ubcs.code.entity.CodeFixedValue; |
| | | import com.vci.ubcs.code.enumpack.*; |
| | |
| | | import com.vci.ubcs.code.mapper.CodeBasicSecMapper; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyValueMapper; |
| | | import com.vci.ubcs.code.mapper.CodeFixedValueMapper; |
| | | import com.vci.ubcs.code.service.ICodeBasicSecService; |
| | | import com.vci.ubcs.code.service.ICodeClassifyValueService; |
| | | import com.vci.ubcs.code.service.ICodeFixedValueService; |
| | | import com.vci.ubcs.code.service.ICodeRuleService; |
| | | import com.vci.ubcs.code.service.*; |
| | | import com.vci.ubcs.code.vo.CodeReferConfigVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeFixedValueVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; |
| | | import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper; |
| | | import com.vci.ubcs.omd.cache.EnumCache; |
| | | import com.vci.ubcs.omd.enums.EnumEnum; |
| | | 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.UBCSCondition; |
| | | import com.vci.ubcs.starter.util.UBCSSqlKeyword; |
| | | import com.vci.ubcs.starter.web.enumpck.OsCodeFillTypeEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.KeyValue; |
| | | import com.vci.ubcs.starter.web.pagemodel.UIFormReferVO; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | |
| | | import com.vci.ubcs.starter.web.util.WebUtil; |
| | | import com.vci.ubcs.system.entity.DictBiz; |
| | | import com.vci.ubcs.system.feign.IDictBizClient; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | |
| | | private ICodeClassifyValueService codeClassifyValueService; |
| | | |
| | | @Resource |
| | | private ICodeReferConfigService codeReferConfigService; |
| | | |
| | | @Resource |
| | | private IDictBizClient iDictBizClient; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 查询所有的码段基础信息 |
| | | * |
| | | * @param page 查询条件 |
| | | * @param codeBasicSecVO 分页和排序 |
| | | * @param conditionMap 查询条件 |
| | | * @param query 分页对象 |
| | | * @return 执行结果 |
| | | * @throws VciBaseException 查询条件和分页出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public IPage<CodeBasicSecVO> gridCodeBasicSec(IPage<CodeBasicSecVO> page, CodeBasicSecVO codeBasicSecVO) throws VciBaseException { |
| | | if(Func.isEmpty(codeBasicSecVO.getPkCodeRule()) || Func.isBlank(codeBasicSecVO.getPkCodeRule())){ |
| | | public IPage<CodeBasicSecVO> gridCodeBasicSec(Query query, Map<String,Object> conditionMap) throws VciBaseException { |
| | | if(Func.isEmpty(conditionMap.get("pkCodeRule")) && Func.isEmpty(conditionMap.get("t.pkCodeRule_equal")) ){ |
| | | return null; |
| | | } |
| | | List<CodeBasicSec> codeBasicSecs = codeBasicSecMapper.selectCodeBasicSecPage(page, codeBasicSecVO); |
| | | return page.setRecords(CodeBasicSecWrapper.build().listVO(codeBasicSecs)); |
| | | // 联表查询 |
| | | MPJLambdaWrapper<CodeBasicSec> mpjLambdaWrapper = UBCSCondition.getMPJLambdaWrapper(conditionMap, CodeBasicSec.class) |
| | | .selectAll(CodeBasicSec.class) |
| | | .selectAs(CodeClassify::getName, CodeBasicSec::getReferCodeClassifyOidName) |
| | | .leftJoin(CodeClassify.class, CodeClassify::getOid, CodeBasicSec::getReferCodeClassifyOid); |
| | | IPage<CodeBasicSec> codeBasicSecIPage = codeBasicSecMapper.selectPage(UBCSCondition.getPage(query), mpjLambdaWrapper); |
| | | return CodeBasicSecWrapper.build().pageVO(codeBasicSecIPage); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (! "success".equals(attrKv.getKey())){ |
| | | throw new VciBaseException(attrKv.getValue() + "不能为空"); |
| | | } |
| | | |
| | | //将DTO转换为DO |
| | | CodeBasicSec codeBasicSecDO = new CodeBasicSec(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDTO, codeBasicSecDO); |
| | | //text转换 |
| | | codeBasicSecDO.setSecTypeText(CodeSecTypeEnum.getTextByValue(codeBasicSecDTO.getSecType())); |
| | | codeBasicSecDO.setCodeLevelTypeText(CodeLevelTypeEnum.getTextByValue(codeBasicSecDTO.getCodeLevelType())); |
| | | codeBasicSecDO.setCodeSecLengthTypeText(CodeSecLengthTypeEnum.getTextByValue(codeBasicSecDTO.getCodeSecLengthType())); |
| | | codeBasicSecDO.setValueCutTypeText(CodeCutTypeEnum.getValueByText(codeBasicSecDTO.getValueCutType())); |
| | | codeBasicSecDO.setCodeGetValueTypeText(CodeGetValueTypeEnum.getValueByText(codeBasicSecDTO.getCodeGetValueType())); |
| | | codeBasicSecDO.setSecTypeText(EnumCache.getValue(EnumEnum.CODE_SEC_TYPE,codeBasicSecDTO.getSecType())); |
| | | codeBasicSecDO.setCodeLevelTypeText(EnumCache.getValue(EnumEnum.CODE_LEVEL_TYPE,codeBasicSecDTO.getCodeLevelType())); |
| | | codeBasicSecDO.setCodeSecLengthTypeText(EnumCache.getValue(EnumEnum.CODE_SEC_LENGTH,codeBasicSecDTO.getCodeSecLengthType())); |
| | | codeBasicSecDO.setValueCutTypeText(EnumCache.getValue(EnumEnum.CODE_CUT_TYPE,codeBasicSecDTO.getValueCutType())); |
| | | codeBasicSecDO.setCodeGetValueTypeText(EnumCache.getValue(EnumEnum.CODE_GET_VALUE_TYPE,codeBasicSecDTO.getCodeGetValueType())); |
| | | //填充一些默认值 |
| | | codeBasicSecDO.setOid(VciBaseUtil.getPk()); |
| | | codeBasicSecDO.setRevisionOid(VciBaseUtil.getPk()); |
| | | codeBasicSecDO.setNameOid(VciBaseUtil.getPk()); |
| | | codeBasicSecDO.setBtmname(MdmBtmTypeConstant.CODE_BASIC_SEC); |
| | | codeBasicSecDO.setTs(new Date()); |
| | | codeBasicSecDO.setCreateTime(new Date()); |
| | | codeBasicSecDO.setCreator(AuthUtil.getUserId().toString()); |
| | | codeBasicSecDO.setLastModifier(AuthUtil.getUserId().toString()); |
| | | codeBasicSecDO.setLastModifyTime(new Date()); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeBasicSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC); |
| | | //排序号,默认等于当前已有的数量加1 |
| | | Long total = codeBasicSecMapper.selectCount(Wrappers.<CodeBasicSec>query() |
| | | .lambda() |
| | |
| | | && StringUtils.isBlank(codeBasicSecDO.getCodeFillSeparator())){ |
| | | throw new VciBaseException("当补位方式为左补位或者右补位的时候,补位字符不能为空"); |
| | | } |
| | | CodeReferConfigVO codeReferConfigVO = null; |
| | | //引用码段的时候,需要判断参照的信息是否正确 |
| | | if(CodeSecTypeEnum.CODE_REFER_SEC.getValue().equalsIgnoreCase(codeBasicSecDO.getSecType())){ |
| | | if(StringUtils.isBlank(codeBasicSecDO.getReferConfig())){ |
| | | throw new VciBaseException("引用码段的时候,需要填写 参照配置 的内容"); |
| | | } |
| | | try{ |
| | | JSONObject.parseObject(codeBasicSecDO.getReferConfig(), UIFormReferVO.class); |
| | | //JSONObject.parseObject(codeBasicSecDO.getReferConfig(), UIFormReferVO.class); |
| | | codeReferConfigVO = JSONObject.parseObject(codeBasicSecDO.getReferConfig(), CodeReferConfigVO.class); |
| | | // 将参照配置进行持久化,给用户提供可可选择参照配置的方式 |
| | | |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException("引用码段的时候,参照配置的内容的格式不正确,",new String[0],e); |
| | | } |
| | | if(codeReferConfigVO.getIsPersistence()=="true"){ |
| | | codeReferConfigService.insert(codeReferConfigVO); |
| | | } |
| | | } |
| | | boolean resBoolean = codeBasicSecMapper.insert(codeBasicSecDO) > 0; |
| | |
| | | } |
| | | //将DTO转换为DO |
| | | CodeBasicSec codeBasicSecDO = selectByOid(codeBasicSecDTO.getOid()); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeBasicSecDO); |
| | | boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeBasicSecDO.getPkCodeRule()).getLcStatus()); |
| | | boolean resBoolean; |
| | | if (!status){ |
| | |
| | | /** |
| | | * 参照码段基础信息列表 |
| | | * |
| | | * @param codeBasicSecVO 查询条件 |
| | | * @param page 分页和排序 |
| | | * @param conditionMap 查询条件 |
| | | * @param query 分页和排序 |
| | | * @return 码段基础信息显示对象列表,生效的内容 |
| | | * @throws VciBaseException 查询条件和分页出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public IPage<CodeBasicSecVO> refDataGridCodeBasicSec(IPage<CodeBasicSecVO> page, CodeBasicSecVO codeBasicSecVO) throws VciBaseException { |
| | | return gridCodeBasicSec(page,codeBasicSecVO); |
| | | public IPage<CodeBasicSecVO> refDataGridCodeBasicSec(Query query ,Map<String,Object> conditionMap) throws VciBaseException { |
| | | return gridCodeBasicSec(query,conditionMap); |
| | | } |
| | | |
| | | /** |
| | | * 参照分类的码段 |
| | | * @param codeBasicSecVO 查询条件 |
| | | * @param page 分页的对象 |
| | | * @param conditionMap 查询条件 |
| | | * @param query 分页和排序 |
| | | * @return 码段的内容 |
| | | */ |
| | | @Override |
| | | public IPage<CodeBasicSecVO> refDataGridClassifySec(IPage<CodeBasicSecVO> page, CodeBasicSecVO codeBasicSecVO) throws VciBaseException { |
| | | if(Func.isEmpty(codeBasicSecVO.getPkCodeRule()) || Func.isBlank(codeBasicSecVO.getPkCodeRule())){ |
| | | public IPage<CodeBasicSecVO> refDataGridClassifySec(Query query ,Map<String,Object> conditionMap) throws VciBaseException { |
| | | if(Func.isEmpty(conditionMap.get("pkCodeRule"))){ |
| | | return null; |
| | | } |
| | | codeBasicSecVO.setSecType(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue()); |
| | | return refDataGridCodeBasicSec(page,codeBasicSecVO); |
| | | conditionMap.put("secType",(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue())); |
| | | return refDataGridCodeBasicSec(query.setAscs("ordernum"),conditionMap); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(StringUtils.isBlank(ruleOid)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("pkCodeRule",ruleOid); |
| | | // Map<String,String> conditionMap = new HashMap<>(); |
| | | // conditionMap.put("pkCodeRule",ruleOid); |
| | | // PageHelper pageHelper = new PageHelper(-1); |
| | | // pageHelper.addDefaultAsc("ordernum"); |
| | | QueryWrapper<CodeBasicSec> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("pkCodeRule",ruleOid); |
| | | wrapper.orderByAsc("ordernum"); |
| | | List<CodeBasicSec> secDOList = codeBasicSecMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper); |
| | | List<CodeBasicSec> secDOList = baseMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper); |
| | | return codeBasicSecDO2VOs(secDOList,true); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 批量数据对象转换为显示对象 |
| | | * |
| | | * @param codeBasicSecDOs 数据对象列表 |
| | | * @return 显示对象 |
| | | * @throws VciBaseException 参数为空或者不存在的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs) throws VciBaseException { |
| | | List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>(); |
| | | if (!CollectionUtils.isEmpty(codeBasicSecDOs)) { |
| | | for (CodeBasicSec s : codeBasicSecDOs) { |
| | | CodeBasicSecVO vo = codeBasicSecDO2VO(s); |
| | | if (vo != null) { |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * 数据对象转换为显示对象 |
| | | * |
| | | * @param codeBasicSecDO 数据对象 |
| | |
| | | */ |
| | | @Override |
| | | public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException { |
| | | CodeBasicSecVO vo = new CodeBasicSecVO(); |
| | | CodeBasicSecVO codeBasicSecVO = new CodeBasicSecVO(); |
| | | if (codeBasicSecDO != null) { |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, vo); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecVO, codeBasicSecVO); |
| | | codeBasicSecVO.setSecTypeText(CodeSecTypeEnum.getTextByValue(codeBasicSecVO.getSecType())); |
| | | codeBasicSecVO.setCodeLevelTypeText(CodeLevelTypeEnum.getTextByValue(codeBasicSecVO.getCodeLevelType())); |
| | | codeBasicSecVO.setCodeSecLengthTypeText(CodeSecLengthTypeEnum.getTextByValue(codeBasicSecVO.getCodeSecLengthType())); |
| | | codeBasicSecVO.setValueCutTypeText(CodeCutTypeEnum.getValueByText(codeBasicSecVO.getValueCutType())); |
| | | codeBasicSecVO.setCodeGetValueTypeText(CodeGetValueTypeEnum.getValueByText(codeBasicSecVO.getCodeGetValueType())); |
| | | // 如果是分类码段需要查询所属分类的中文名称 |
| | | if(codeBasicSecDO.getSecType().equals("codeclassifysec") && Func.isNotEmpty(codeBasicSecDO.getParentClassifySecOid())){ |
| | | CodeBasicSec codeBasicSec = codeBasicSecMapper.selectOne(Wrappers.<CodeBasicSec>query().lambda() |
| | | .eq(CodeBasicSec::getOid, codeBasicSecDO.getParentClassifySecOid()) |
| | | .eq(CodeBasicSec::getSecType, codeBasicSecDO.getSecType())); |
| | | codeBasicSecVO.setParentClassifySecText(codeBasicSec.getName()); |
| | | } |
| | | //如果有lcstatus的类的话 |
| | | if (true) { |
| | | //vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus())); |
| | | } |
| | | } |
| | | return vo; |
| | | return codeBasicSecVO; |
| | | } |
| | | } |