for (int i = codeBegin; i <= codeEnd; i++) { ContractCodeUsage contractCodeUsage = new ContractCodeUsage(); BeanUtils.copyProperties(ruleUpdateDto, contractCodeUsage); contractCodeUsage.setContractCodeRuleId(ruleUpdateDto.getContractCodeRuleId()); contractCodeUsage.setCodeUsageNum(i); contractCodeUsage.setContractCodeUsageId(Snowflake.stringId()); contractCodeUsage.setContractCode( contractCodePrefix.getContractCodePrefixTitle() + "-" + ruleUpdateDto.getContractCodeYear() + "-" + i ); list.add(contractCodeUsage); contractCodeList.add(contractCodeUsage.getContractCode()); }