| | |
| | | * @return 执行结果 |
| | | * @throws VciBaseException 参数为空,唯一项,必输项不通过时会抛出异常 |
| | | */ |
| | | @Override |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean addSave(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(codeBasicSecDTO, "需要添加的数据对象",codeBasicSecDTO.getPkCodeRule(),"编码规则的主键"); |
| | |
| | | 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,null); |
| | | 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); |
| | |
| | | } |
| | | //将DTO转换为DO |
| | | CodeBasicSec codeBasicSecDO = selectByOid(codeBasicSecDTO.getOid()); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeBasicSecDO,null); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeBasicSecDO); |
| | | boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeBasicSecDO.getPkCodeRule()).getLcStatus()); |
| | | boolean resBoolean; |
| | | CodeReferConfigVO codeReferConfigVO = null; |
| | |
| | | continue; |
| | | } |
| | | // 更改创建时间,修改时间等默认值 |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(newSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC,null); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(newSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC); |
| | | //固定码段 |
| | | if(newSecDO.getSecType().equals(CodeSecTypeEnum.CODE_FIXED_SEC.getValue())){ |
| | | // 固定码段存储好oid和码值的关联关系 |
| | |
| | | value.stream().forEach(item -> { |
| | | item.setOid(""); |
| | | item.setCodeFixedSecOid(key); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item,null); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item); |
| | | codeFixedDOValues.add(item); |
| | | }); |
| | | }); |
| | |
| | | } |
| | | codeClassValues.forEach((key, value) -> { |
| | | value.stream().forEach(item -> { |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item,null); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item); |
| | | item.setCodeClassifySecOid(key); |
| | | codeClassifyDOValues.add(item); |
| | | }); |
| | |
| | | .eq(CodeBasicSec::getPkCodeRule,codeRuleOid) |
| | | .in(CodeBasicSec::getOid,codeBasicSecOidList) |
| | | .eq(CodeBasicSec::getSerialDependFlag,"true") |
| | | .orderByAsc(CodeBasicSec::getSerialDependOrder); |
| | | //TODO: SerialDependOrder本来是用来流水排序的,但是现在的逻辑是按照orderuNum排序的 |
| | | .orderByAsc(CodeBasicSec::getOrderNum); //.orderByAsc(CodeBasicSec::getSerialDependOrder); |
| | | List<CodeBasicSec> codeBasicSecList = this.list(wrapper); |
| | | |
| | | //按流水依赖顺序,处理流水依赖码段的值 |
| | |
| | | }else{ |
| | | //如果最大流水号不为空,说明无最好流水号,新增最大流水号 |
| | | CodeSerialValue codeSerialValue = new CodeSerialValue(); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeSerialValue, MdmBtmTypeConstant.CODE_SERIAL_VALUE,null); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeSerialValue, MdmBtmTypeConstant.CODE_SERIAL_VALUE); |
| | | codeSerialValue.setCodeRuleOid(codeRuleOid); |
| | | codeSerialValue.setSerialUnit(serialUnitString); |
| | | codeSerialValue.setCodeSecOid(codeBasicSec.getOid()); |
| | |
| | | .eq(CodeBasicSec::getPkCodeRule,codeRuleOid) |
| | | .in(CodeBasicSec::getOid,codeBasicSecOidList) |
| | | .eq(CodeBasicSec::getSerialDependFlag,"true") |
| | | .orderByAsc(CodeBasicSec::getSerialDependOrder); |
| | | .orderByAsc(CodeBasicSec::getOrderNum); //.orderByAsc(CodeBasicSec::getSerialDependOrder); |
| | | |
| | | List<CodeBasicSec> codeBasicSecList = this.list(wrapper); |
| | | //按流水依赖顺序,处理流水依赖码段的值 |
| | | List<String> serialDependValueList = new ArrayList<>(); |