| | |
| | | |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.BeanUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; |
| | | import com.vci.ubcs.code.dto.CodeOrderSecDTO; |
| | | import com.vci.ubcs.code.entity.CodeAllCode; |
| | |
| | | import com.vci.ubcs.code.lifecycle.CodeAllCodeLC; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyValueMapper; |
| | | import com.vci.ubcs.code.mapper.CodeSerialValueMapper; |
| | | import com.vci.ubcs.code.service.ICodeWupinService; |
| | | import com.vci.ubcs.code.service.MdmEngineService; |
| | | import com.vci.ubcs.code.service.MdmProductCodeService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO; |
| | |
| | | * 所有的编码的内容 |
| | | */ |
| | | @Resource |
| | | private ICodeWupinService iCodeWupinService; |
| | | /** |
| | | * 所有的编码的内容 |
| | | */ |
| | | @Resource |
| | | @Lazy |
| | | private MdmEngineService mdmEngineService; |
| | | |
| | |
| | | // SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | List<CodeAllCode> allCodeDOList = new ArrayList<>(); |
| | | Map<String/**流水依据**/, Map<String/**码段的主键**/,Double/**最大流水号**/>> maxSerialMap = new HashMap<>(); |
| | | dataCBOList.parallelStream().forEach(cbo->{ |
| | | dataCBOList.stream().forEach(cbo->{ |
| | | // VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); |
| | | String code = cbo.getId(); |
| | | List<String> serialUnitList = new ArrayList<>(); |
| | |
| | | CodeSerialValue serialValueDO = serialValueDOS.get(0); |
| | | if(VciBaseUtil.getDouble(serialValueDO.getMaxSerial())<maxSerial){ |
| | | serialValueDO.setMaxSerial(String.valueOf(maxSerial)); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(serialValueDO); |
| | | editSerialValueList.add(serialValueDO); |
| | | } |
| | | }else{ |
| | | //没有 |
| | | CodeSerialValue serialValueDO = new CodeSerialValue(); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(serialValueDO, MdmBtmTypeConstant.CODE_SERIAL_VALUE); |
| | | serialValueDO.setCodeRuleOid(ruleVO.getOid()); |
| | | serialValueDO.setSerialUnit(serialUnit); |
| | | serialValueDO.setCodeSecOid(secOid); |
| | |
| | | secValue = classifyFullInfoBO.getCurrentClassifyVO().getId(); |
| | | } else { |
| | | //我们需要从顶层开始找到当前分类为止 |
| | | secValue = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining()) + classifyFullInfoBO.getCurrentClassifyVO().getId(); |
| | | secValue = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> -o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining()) + classifyFullInfoBO.getCurrentClassifyVO().getId(); |
| | | } |
| | | } else { |
| | | //指定层,我们需要通过上级的来获取 |
| | |
| | | secValue = classifyFullInfoBO.getCurrentClassifyVO().getId(); |
| | | } else { |
| | | //这个我们需要看看,层级是不是大于了最大层级的数 |
| | | List<CodeClassifyVO> parentClassifyVOList = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).collect(Collectors.toList()); |
| | | List<CodeClassifyVO> parentClassifyVOList = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> -o1.getDataLevel().compareTo(o2.getDataLevel()))).collect(Collectors.toList()); |
| | | if (secVO.getCodeLevelValue() > (parentClassifyVOList.size() + 1)) { |
| | | //指定的层级比当前的层级还大了,所以只能获取当前层级了 |
| | | if (CodeGetValueTypeEnum.CURRENT.getValue().equalsIgnoreCase(secVO.getCodeGetValueType())) { |
| | |
| | | } |
| | | } else { |
| | | //小于等于的全部拿出来 |
| | | secValue = parentClassifyVOList.stream().filter(s -> s.getDataLevel().intValue() <= secVO.getCodeLevelValue().intValue()).sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining()); |
| | | secValue = parentClassifyVOList.stream().filter(s -> s.getDataLevel().intValue() <= secVO.getCodeLevelValue().intValue()).sorted(((o1, o2) -> -o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining()); |
| | | } |
| | | } |
| | | } |
| | |
| | | BaseModel cbo, CodeClassifyTemplateVO templateVO, |
| | | List<CodeAllCode> allCodeDOList, String serialUnitString, String serialValueString){ |
| | | CodeAllCode allCodeDO = new CodeAllCode(); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(allCodeDO, MdmBtmTypeConstant.CODE_ALL_CODE); |
| | | allCodeDO.setCodeClassifyOid(classifyFullInfoBO.getCurrentClassifyVO().getOid()); |
| | | allCodeDO.setCodeRuleOid(ruleVO.getOid()); |
| | | allCodeDO.setId(cbo.getId()); |
| | |
| | | //说明有 |
| | | serialValueDO = maxSerialValueMap.get(secOid).get(unit); |
| | | serialValueDO.setMaxSerial(maxSerial.toString()); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(serialValueDO); |
| | | editSerialValueDOList.add(serialValueDO); |
| | | }else{ |
| | | serialValueDO = new CodeSerialValue(); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(serialValueDO, MdmBtmTypeConstant.CODE_SERIAL_VALUE); |
| | | serialValueDO.setCodeRuleOid(ruleVO.getOid()); |
| | | serialValueDO.setSerialUnit(unit); |
| | | serialValueDO.setCodeSecOid(secOid); |