| | |
| | | |
| | | import com.alibaba.cloud.commons.lang.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.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.entity.*; |
| | | import com.vci.ubcs.code.enumpack.*; |
| | | import com.vci.ubcs.code.lifecycle.CodeRuleLC; |
| | | import com.vci.ubcs.code.mapper.CodeBasicSecMapper; |
| | |
| | | import com.vci.ubcs.code.mapper.CodeFixedValueMapper; |
| | | 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.vo.pagemodel.*; |
| | | 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.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.starter.util.UBCSCondition; |
| | | import com.vci.ubcs.starter.util.UBCSSqlKeyword; |
| | | import com.vci.ubcs.starter.web.enumpck.NewAppConstantEnum; |
| | | 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.pagemodel.*; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.WebUtil; |
| | |
| | | import com.vci.ubcs.system.feign.IDictBizClient; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | 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.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | Set<String> fixedSecOidSet = fixedSecList.stream().map(CodeBasicSec::getOid).collect(Collectors.toSet()); |
| | | // 通过外键进行查询 |
| | | List<CodeFixedValue> fixedValueS = fixedValueMapper.selectList(Wrappers.<CodeFixedValue>query().lambda().in(CodeFixedValue::getCodeFixedSecOid,fixedSecOidSet)); |
| | | // 根据查询出来的id执行固定码段执行删除 |
| | | deletFlag = fixedValueMapper.deleteBatchIds(fixedValueS.stream().map(CodeFixedValue::getOid).collect(Collectors.toSet()))>0; |
| | | if(!fixedValueS.isEmpty()){ |
| | | // 根据查询出来的id执行固定码段执行删除 |
| | | deletFlag = fixedValueMapper.deleteBatchIds(fixedValueS.stream().map(CodeFixedValue::getOid).collect(Collectors.toSet()))>0; |
| | | } |
| | | } |
| | | // 4、再删除分类码段 |
| | | List<CodeBasicSec> classifySecList = deleteList.stream().filter(sec -> { |
| | |
| | | Set<String> classifySecOidSet = classifySecList.stream().map(CodeBasicSec::getOid).collect(Collectors.toSet()); |
| | | // 通过外键进行查询 |
| | | List<CodeClassifyValue> fixedValueS = codeClassifyValueMapper.selectList(Wrappers.<CodeClassifyValue>query().lambda().in(CodeClassifyValue::getCodeClassifySecOid,classifySecOidSet)); |
| | | // 根据查询出来的主键id执行固定码段执行删除 |
| | | deletFlag = fixedValueMapper.deleteBatchIds(fixedValueS.stream().map(CodeClassifyValue::getOid).collect(Collectors.toSet()))>0; |
| | | if(!fixedValueS.isEmpty()){ |
| | | // 根据查询出来的主键id执行固定码段执行删除 |
| | | deletFlag = fixedValueMapper.deleteBatchIds(fixedValueS.stream().map(CodeClassifyValue::getOid).collect(Collectors.toSet()))>0; |
| | | } |
| | | } |
| | | return deletFlag; |
| | | } |
| | |
| | | codeBasicSecDO.setValueCutTypeText(EnumCache.getValue(EnumEnum.CODE_CUT_TYPE,codeBasicSecDTO.getValueCutType())); |
| | | codeBasicSecDO.setCodeGetValueTypeText(EnumCache.getValue(EnumEnum.CODE_GET_VALUE_TYPE,codeBasicSecDTO.getCodeGetValueType())); |
| | | //填充一些默认值 |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeBasicSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeBasicSecDO, MdmBtmTypeConstant.CODE_BASIC_SEC); |
| | | //排序号,默认等于当前已有的数量加1 |
| | | Long total = codeBasicSecMapper.selectCount(Wrappers.<CodeBasicSec>query() |
| | | .lambda() |
| | |
| | | //引用码段的时候,需要判断参照的信息是否正确 |
| | | if(CodeSecTypeEnum.CODE_REFER_SEC.getValue().equalsIgnoreCase(codeBasicSecDO.getSecType())){ |
| | | if(StringUtils.isBlank(codeBasicSecDO.getReferConfig())){ |
| | | throw new VciBaseException("引用码段的时候,需要填写 参照配置 的内容"); |
| | | throw new VciBaseException("引用码段的时候,需要填写 参照配置的内容"); |
| | | } |
| | | try{ |
| | | //JSONObject.parseObject(codeBasicSecDO.getReferConfig(), UIFormReferVO.class); |
| | | codeReferConfigVO = JSONObject.parseObject(codeBasicSecDO.getReferConfig(), CodeReferConfigVO.class); |
| | | // 将参照配置进行持久化,给用户提供可可选择参照配置的方式 |
| | | |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException("引用码段的时候,参照配置的内容的格式不正确,",new String[0],e); |
| | | } |
| | | // 判断是否为引用码段,如果是应用码段的话,为了适配前端组件,这里要对表进行处理一下,按照以前的参照格式进行转换 |
| | | codeBasicSecDO.setReferValueInfo(referConfigToUIUiTable(codeReferConfigVO)); |
| | | if(codeReferConfigVO.getIsPersistence()=="true"){ |
| | | codeReferConfigService.insert(codeReferConfigVO); |
| | | } |
| | |
| | | //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){ |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_BASIC_SEC); |
| | | dictBiz.setDictKey("codefileseparator"); |
| | | dictBiz.setCode("codeFillSeparator"); |
| | | dictBiz.setDictKey(codeBasicSecDO.getCodeFillSeparator()); |
| | | dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator()); |
| | | //从原来的charService(可输可选)更改为调用omd中的接口来实现 |
| | | iDictBizClient.getCheck(dictBiz); |
| | | //charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo); |
| | | } |
| | | return resBoolean; |
| | | } |
| | | |
| | | /** |
| | | * 将referconfig转换为JSON格式的UIFormReferVO |
| | | * @param codeReferConfig |
| | | * @return |
| | | */ |
| | | private String referConfigToUIUiTable(CodeReferConfigVO codeReferConfig){ |
| | | // 拷贝为以前的老对象 |
| | | UIReferConfigFormVO uiFormReferVO = new UIReferConfigFormVO(); |
| | | BeanUtil.copy(codeReferConfig,uiFormReferVO); |
| | | |
| | | // 表格的自定义定义 |
| | | UITableConfigVO uiTableConfigVO = new UITableConfigVO(); |
| | | uiTableConfigVO.setPage(new UITablePageVO(codeReferConfig.getLimit(),1)); |
| | | // 列表的列的信息转换 |
| | | List<TableColVO> uiTableFieldVOs = new ArrayList<>(); |
| | | // 快速查询列 |
| | | List<TableColVO> queryColumns = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(codeReferConfig.getCodeShowFieldConfigVOS())){ |
| | | codeReferConfig.getCodeShowFieldConfigVOS().stream().forEach(showField ->{ |
| | | TableColVO tableColVO = new TableColVO(); |
| | | BeanUtil.copy(showField,tableColVO); |
| | | tableColVO.setSortField(showField.getAttrSortField()); |
| | | uiTableFieldVOs.add(tableColVO); |
| | | if(showField.getIsQuery().equals("true")){ |
| | | queryColumns.add(tableColVO); |
| | | } |
| | | }); |
| | | } |
| | | // 显示的列 |
| | | uiTableConfigVO.setCols(uiTableFieldVOs); |
| | | // 快速查询列 |
| | | uiTableConfigVO.setQueryColumns(queryColumns); |
| | | //set给表格配置属性 |
| | | uiFormReferVO.setTableConfig(uiTableConfigVO); |
| | | // 筛选条件 |
| | | HashMap<String, String> whereMap = new HashMap<>(); |
| | | if(!codeReferConfig.getCodeSrchCondConfigVOS().isEmpty()){ |
| | | codeReferConfig.getCodeSrchCondConfigVOS().stream().forEach(srch->{ |
| | | whereMap.put(srch.getFilterField()+srch.getFilterType(),srch.getFilterValue()); |
| | | }); |
| | | } |
| | | uiFormReferVO.setWhere(whereMap); |
| | | return JSONObject.toJSONString(uiFormReferVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | && 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("引用码段的时候,需要填写 参照配置 的内容"); |
| | | 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); |
| | | } |
| | | // 判断是否为引用码段,如果是应用码段的话,为了适配前端组件,这里要对表进行处理一下,按照以前的参照格式进行转换 |
| | | codeBasicSecDO.setReferValueInfo(referConfigToUIUiTable(codeReferConfigVO)); |
| | | if(codeReferConfigVO.getIsPersistence()=="true"){ |
| | | codeReferConfigService.insert(codeReferConfigVO); |
| | | } |
| | | } |
| | | revisionModelUtil.copyFromDTOIgnore(codeBasicSecDTO, codeBasicSecDO); |
| | | resBoolean = codeBasicSecMapper.updateById(codeBasicSecDO)>0; |
| | | //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){ |
| | | //这儿目前需要改 2023/4/24 |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_BASIC_SEC); |
| | | dictBiz.setDictKey("codefileseparator"); |
| | | dictBiz.setCode("codeFillSeparator"); |
| | | dictBiz.setDictKey(codeBasicSecDO.getCodeFillSeparator()); |
| | | dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator()); |
| | | //从原来的charService(可输可选)更改为调用omd中的接口来实现 |
| | | iDictBizClient.getCheck(dictBiz); |
| | |
| | | return null; |
| | | } |
| | | conditionMap.put("secType",(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue())); |
| | | return refDataGridCodeBasicSec(query.setAscs("ordernum"),conditionMap); |
| | | return refDataGridCodeBasicSec(query.setAscs("orderNum"),conditionMap); |
| | | } |
| | | |
| | | /** |
| | |
| | | return codeBasicSecDO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用规则的主键获取对应的码段内容 |
| | | * |
| | |
| | | if(StringUtils.isBlank(ruleOid)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | // 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 = baseMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper); |
| | | LambdaQueryWrapper<CodeBasicSec> wrapper = Wrappers.<CodeBasicSec>query().lambda() |
| | | .eq(CodeBasicSec::getPkCodeRule, ruleOid) |
| | | .orderByAsc(CodeBasicSec::getOrderNum); |
| | | List<CodeBasicSec> secDOList = baseMapper.selectList(wrapper);// |
| | | return codeBasicSecDO2VOs(secDOList,true); |
| | | } |
| | | |
| | |
| | | CodeBasicSec codeBasicSec = codeBasicSecMapper.selectOne(Wrappers.<CodeBasicSec>query().lambda() |
| | | .eq(CodeBasicSec::getOid, codeBasicSecDO.getParentClassifySecOid()) |
| | | .eq(CodeBasicSec::getSecType, codeBasicSecDO.getSecType())); |
| | | codeBasicSecVO.setParentClassifySecText(codeBasicSec.getName()); |
| | | if(Func.isNotEmpty(codeBasicSec)){ |
| | | codeBasicSecVO.setParentClassifySecOid(codeBasicSec.getOid()); |
| | | codeBasicSecVO.setParentClassifySecText(codeBasicSec.getName()); |
| | | } |
| | | } |
| | | //如果有lcstatus的类的话 |
| | | if (true) { |
| | |
| | | } |
| | | return codeBasicSecVO; |
| | | } |
| | | |
| | | } |