| | |
| | | |
| | | 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.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | 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.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.starter.exception.VciBaseException; |
| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private IDictBizClient iDictBizClient; |
| | | |
| | | /** |
| | | * 固定码段的码值的服务 |
| | | */ |
| | | @Resource |
| | | private ICodeFixedValueService fixedValueService; |
| | | |
| | | /** |
| | | * 上层分类码段的属性名称 |
| | |
| | | return codeBasicSecDO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用规则的主键获取对应的码段内容 |
| | | * |
| | | * @param ruleOid 规则的内容 |
| | | * @return 码段的内容 |
| | | */ |
| | | @Override |
| | | public List<CodeBasicSecVO> listCodeBasicSecByRuleOid(String ruleOid) { |
| | | 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.orderByAsc("ordernum"); |
| | | List<CodeBasicSec> secDOList = codeBasicSecMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper); |
| | | return codeBasicSecDO2VOs(secDOList,true); |
| | | } |
| | | |
| | | /** |
| | | * 批量数据对象转换为显示对象 |
| | | * |
| | | * @param codeBasicSecDOs 数据对象列表 |
| | | * @param hasFixedValue 是否有固定值 |
| | | * @return 显示对象 |
| | | * @throws VciBaseException 参数为空或者不存在的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs, boolean hasFixedValue) 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); |
| | | } |
| | | } |
| | | } |
| | | if(hasFixedValue && !CollectionUtils.isEmpty(voList)){ |
| | | List<CodeBasicSecVO> fixedSecVOList = voList.stream().filter(s -> CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equalsIgnoreCase(s.getSecType())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(fixedSecVOList)){ |
| | | //查询固定码的码值 |
| | | Map<String, List<CodeFixedValueVO>> secValueMap = fixedValueService.listCodeFixedValueBySecOids(fixedSecVOList.stream().map(CodeBasicSecVO::getOid).collect(Collectors.toList())); |
| | | voList.stream().forEach(vo->{ |
| | | vo.setFixedValueVOList(secValueMap.getOrDefault(vo.getOid(),null)); |
| | | }); |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * 数据对象转换为显示对象 |
| | | * |
| | | * @param codeBasicSecDO 数据对象 |
| | | * @return 显示对象 |
| | | * @throws VciBaseException 拷贝属性出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException { |
| | | CodeBasicSecVO vo = new CodeBasicSecVO(); |
| | | if (codeBasicSecDO != null) { |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, vo); |
| | | //如果有lcstatus的类的话 |
| | | if (true) { |
| | | //vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus())); |
| | | } |
| | | } |
| | | return vo; |
| | | } |
| | | } |