|
@@ -161,11 +161,11 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
//产品添加产品号
|
|
|
assetsProductionMapper.updateProductionNo(dto.getBusinessId(), dto.getProductionType(), productionNo);
|
|
|
//如果还有未取号评估对象,再添加一份同类型产品
|
|
|
- if (!dto.getHasNotTakeNumTarget()){
|
|
|
+ if (dto.getHasNotTakeNumTargetSelect()) {
|
|
|
assetsProductionMapper.copyProductionInfo(dto.getBusinessId(), dto.getProductionType(), dto.getPrintCount());
|
|
|
}
|
|
|
//评估对象添加产品号
|
|
|
- for (Long id : dto.getTargetIdList()){
|
|
|
+ for (Long id : dto.getTargetIdList()) {
|
|
|
assetsEvaluationTargetMapper.updateTargetProductionNo(id, productionNo);
|
|
|
}
|
|
|
return null;
|
|
@@ -173,6 +173,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 生成资产产品号
|
|
|
+ *
|
|
|
* @param takeAssetsProductionNoDTO 取号dto
|
|
|
* @return String
|
|
|
*/
|
|
@@ -185,89 +186,103 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
//获取资产产品取号信息
|
|
|
BusinessNumber businessNumber = assetsMapper.getBusinessNum(takeAssetsProductionNoDTO.getProductionType() + "_NUMBER", ASSET_BUSINESS.getCode(), nowYear);
|
|
|
|
|
|
- //判断是否有取号信息
|
|
|
- if (ObjectUtil.isNotNull(businessNumber)) { //取号信息不为空组合产品号
|
|
|
- //判断两个进位是否都>9,具有两位数
|
|
|
- if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
|
|
|
- productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
|
|
|
- } else {
|
|
|
- //第一进位小于10,前面多加一个0组成两位
|
|
|
- if (businessNumber.getMonth() < 10) {
|
|
|
- productionNo = productionNo + "0" + businessNumber.getMonth() + businessNumber.getNextNo();
|
|
|
+ //获取当前资产业务评估对象已经生成的产品号集合
|
|
|
+ List<String> productionNoList = assetsEvaluationTargetMapper.getProductionNoList(takeAssetsProductionNoDTO.getBusinessId());
|
|
|
+ //判断该资产业务订单是否有取过号
|
|
|
+ if (ObjectUtil.isNull(productionNoList) || productionNoList.isEmpty()) {
|
|
|
+ //判断是否有取号信息
|
|
|
+ if (ObjectUtil.isNotNull(businessNumber)) { //取号信息不为空组合产品号
|
|
|
+ //判断两个进位是否都>9,具有两位数
|
|
|
+ if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
|
|
|
+ productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
|
|
|
+ } else {
|
|
|
+ //第一进位小于10,前面多加一个0组成两位
|
|
|
+ if (businessNumber.getMonth() < 10) {
|
|
|
+ productionNo = productionNo + "0" + businessNumber.getMonth();
|
|
|
+ } else {
|
|
|
+ productionNo = productionNo + businessNumber.getMonth();
|
|
|
+ }
|
|
|
+ //第二进位小于10,前面多加一个0组成两位
|
|
|
+ if (businessNumber.getNextNo() < 10) {
|
|
|
+ productionNo = productionNo + "0" + businessNumber.getNextNo();
|
|
|
+ } else {
|
|
|
+ productionNo = productionNo + businessNumber.getNextNo();
|
|
|
+ }
|
|
|
}
|
|
|
- //第二进位小于10,前面多加一个0组成两位
|
|
|
- if (businessNumber.getNextNo() < 10) {
|
|
|
- productionNo = productionNo + businessNumber.getMonth() + "0" + businessNumber.getNextNo();
|
|
|
+ //设置下一个产品号取号信息
|
|
|
+ if (businessNumber.getNextNo() < 99) {
|
|
|
+ businessNumber.setNextNo(businessNumber.getNextNo() + 1);
|
|
|
+ } else {
|
|
|
+ businessNumber.setMonth(businessNumber.getMonth() + 1);
|
|
|
+ businessNumber.setNextNo(1);
|
|
|
}
|
|
|
- }
|
|
|
- //设置下一个产品号取号信息
|
|
|
- if (businessNumber.getNextNo() < 99) {
|
|
|
- businessNumber.setNextNo(businessNumber.getNextNo() + 1);
|
|
|
- } else {
|
|
|
- businessNumber.setMonth(businessNumber.getMonth() + 1);
|
|
|
- businessNumber.setNextNo(1);
|
|
|
- }
|
|
|
- //更新取号信息
|
|
|
- assetsMapper.updateBusinessNum(businessNumber);
|
|
|
- } else { //为空插入取号规则信息,并重新获取
|
|
|
- businessNumber = addBusinessNumber(takeAssetsProductionNoDTO.getProductionType() + "_NUMBER", ASSET_BUSINESS.getCode(), nowYear);
|
|
|
- //判断两个进位是否都>9,具有两位数
|
|
|
- if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
|
|
|
- productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
|
|
|
- } else {
|
|
|
- //第一进位小于10,前面多加一个0组成两位
|
|
|
- if (businessNumber.getMonth() < 10) {
|
|
|
- productionNo = productionNo + "0" + businessNumber.getMonth() + businessNumber.getNextNo();
|
|
|
+ //更新取号信息
|
|
|
+ assetsMapper.updateBusinessNum(businessNumber);
|
|
|
+ } else { //为空插入取号规则信息,并重新获取
|
|
|
+ businessNumber = addBusinessNumber(takeAssetsProductionNoDTO.getProductionType() + "_NUMBER", ASSET_BUSINESS.getCode(), nowYear);
|
|
|
+ //判断两个进位是否都>9,具有两位数
|
|
|
+ if (businessNumber.getMonth() > 9 && businessNumber.getNextNo() > 9) {
|
|
|
+ productionNo = productionNo + businessNumber.getMonth() + businessNumber.getNextNo();
|
|
|
+ } else {
|
|
|
+ //第一进位小于10,前面多加一个0组成两位
|
|
|
+ if (businessNumber.getMonth() < 10) {
|
|
|
+ productionNo = productionNo + "0" + businessNumber.getMonth();
|
|
|
+ } else {
|
|
|
+ productionNo = productionNo + businessNumber.getMonth();
|
|
|
+ }
|
|
|
+ //第二进位小于10,前面多加一个0组成两位
|
|
|
+ if (businessNumber.getNextNo() < 10) {
|
|
|
+ productionNo = productionNo + "0" + businessNumber.getNextNo();
|
|
|
+ } else {
|
|
|
+ productionNo = productionNo + businessNumber.getNextNo();
|
|
|
+ }
|
|
|
}
|
|
|
- //第二进位小于10,前面多加一个0组成两位
|
|
|
- if (businessNumber.getNextNo() < 10) {
|
|
|
- productionNo = productionNo + businessNumber.getMonth() + "0" + businessNumber.getNextNo();
|
|
|
+ //设置下一个产品号取号信息
|
|
|
+ if (businessNumber.getNextNo() < 99) {
|
|
|
+ businessNumber.setNextNo(businessNumber.getNextNo() + 1);
|
|
|
+ } else {
|
|
|
+ businessNumber.setMonth(businessNumber.getMonth() + 1);
|
|
|
+ businessNumber.setNextNo(1);
|
|
|
}
|
|
|
+ //更新取号信息
|
|
|
+ assetsMapper.updateBusinessNum(businessNumber);
|
|
|
}
|
|
|
- //设置下一个产品号取号信息
|
|
|
- if (businessNumber.getNextNo() < 99) {
|
|
|
- businessNumber.setNextNo(businessNumber.getNextNo() + 1);
|
|
|
- } else {
|
|
|
- businessNumber.setMonth(businessNumber.getMonth() + 1);
|
|
|
- businessNumber.setNextNo(1);
|
|
|
+
|
|
|
+ //判断取号产品类型
|
|
|
+
|
|
|
+ if (takeAssetsProductionNoDTO.getProductionType().equals(STATEMENT.getCode())) { //取号产品为意见书
|
|
|
+ productionNo = "川友预报字" + productionNo;
|
|
|
+ } else if (takeAssetsProductionNoDTO.getProductionType().equals(REPORT.getCode())) { //取号产品为评估报告
|
|
|
+ productionNo = "川友评报字" + productionNo;
|
|
|
+ } else if (takeAssetsProductionNoDTO.getProductionType().equals(CONSULT.getCode())) { //取号产品为咨询报告
|
|
|
+ productionNo = "川友咨报字" + productionNo;
|
|
|
+ } else if (takeAssetsProductionNoDTO.getProductionType().equals(LETTER.getCode())) { //取号产品为意见函
|
|
|
+ productionNo = "川友字" + productionNo;
|
|
|
+ } else { //都不是返回null
|
|
|
+ return null;
|
|
|
}
|
|
|
- //更新取号信息
|
|
|
- assetsMapper.updateBusinessNum(businessNumber);
|
|
|
+ } else { //已经在该子号之前生成过子号则直接将上一个产品的主体拿过来赋值
|
|
|
+ int dashIndex = productionNoList.get(0).indexOf('-');
|
|
|
+ productionNo = productionNoList.get(0).substring(0, dashIndex);
|
|
|
}
|
|
|
|
|
|
- //判断取号产品类型
|
|
|
- if (takeAssetsProductionNoDTO.getProductionType().equals(STATEMENT.getCode())) { //取号产品为意见书
|
|
|
- productionNo = "川友预报字" + productionNo;
|
|
|
- } else if (takeAssetsProductionNoDTO.getProductionType().equals(REPORT.getCode())) { //取号产品为评估报告
|
|
|
- productionNo = "川友评报字" + productionNo;
|
|
|
- } else if (takeAssetsProductionNoDTO.getProductionType().equals(CONSULT.getCode())) { //取号产品为咨询报告
|
|
|
- productionNo = "川友咨报字" + productionNo;
|
|
|
- } else if (takeAssetsProductionNoDTO.getProductionType().equals(LETTER.getCode())) { //取号产品为意见函
|
|
|
- productionNo = "川友字" + productionNo;
|
|
|
- } else { //都不是返回null
|
|
|
- return null;
|
|
|
- }
|
|
|
|
|
|
// 判断有无子号
|
|
|
if (takeAssetsProductionNoDTO.getSelectAll()) { //true 则选择了全部评估对象,仅主号无子号
|
|
|
return productionNo + "号";
|
|
|
} else { //false 选择了部分评估对象,有子号
|
|
|
- return getProductionSecNum(productionNo, takeAssetsProductionNoDTO.getBusinessId(), takeAssetsProductionNoDTO.getProductionType());
|
|
|
+ return getProductionSecNum(productionNo, productionNoList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取资产产品子号
|
|
|
*
|
|
|
- * @param businessId 业务id
|
|
|
- * @param productionType 业务类型
|
|
|
* @return String
|
|
|
*/
|
|
|
- public String getProductionSecNum(String productionNo, Long businessId, String productionType) {
|
|
|
- // 根据资产业务id与产品类型获取产品号集合
|
|
|
- List<String> productionNoList = assetsProductionMapper.getgetProductionNo(businessId, productionType);
|
|
|
+ public String getProductionSecNum(String productionNo, List<String> productionNoList) {
|
|
|
// 判断同一资产业务的同一类型产品是否有生成过子号
|
|
|
- if (ObjectUtil.isNotNull(productionNoList)) { //为null还没有生成过子号,生成第一个
|
|
|
+ if (ObjectUtil.isNull(productionNoList) || productionNoList.isEmpty()) { //为null还没有生成过子号,生成第一个
|
|
|
return productionNo + "-1号";
|
|
|
} else { //不为null则说明已经生成过子号,找到目前最大的子号并生成下一个子号
|
|
|
// 初始化最大子号为Integer.MIN_VALUE
|