|
@@ -109,7 +109,8 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 条件查询资产已归档列表
|
|
|
- * @param page 分页条件
|
|
|
+ *
|
|
|
+ * @param page 分页条件
|
|
|
* @param assetsSelectDTO 查询条件
|
|
|
* @return Page<AssetsVO>
|
|
|
*/
|
|
@@ -120,7 +121,8 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 条件查询资产已终止列表
|
|
|
- * @param page 分页条件
|
|
|
+ *
|
|
|
+ * @param page 分页条件
|
|
|
* @param assetsSelectDTO 查询条件
|
|
|
* @return Page<AssetsVO>
|
|
|
*/
|
|
@@ -133,7 +135,8 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 条件查询资产已终止列表
|
|
|
- * @param page 分页条件
|
|
|
+ *
|
|
|
+ * @param page 分页条件
|
|
|
* @param assetsSelectDTO 查询条件
|
|
|
* @return Page<AssetsVO>
|
|
|
*/
|
|
@@ -144,6 +147,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 条件查询资产入库统计集合(用于导出)
|
|
|
+ *
|
|
|
* @param assetsSelectDTO 查询条件
|
|
|
* @return Page<AssetsVO>
|
|
|
*/
|
|
@@ -177,7 +181,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
//获取项目编号
|
|
|
assets.setOrderId(businessNumberService.takeOrderNumber());
|
|
|
// 判断分单类型
|
|
|
- if (BY_TURNS.equals(assets.getAllotType())){
|
|
|
+ if (BY_TURNS.equals(assets.getAllotType())) {
|
|
|
//获取轮单部门
|
|
|
assets.setDepartmentId(getAllotDepartmentId());
|
|
|
}
|
|
@@ -226,13 +230,13 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
@Override
|
|
|
public Boolean update(Assets assets) {
|
|
|
- if (assets.getClienteleType().equals("个人")){
|
|
|
+ if (assets.getClienteleType().equals("个人")) {
|
|
|
assets.setClienteleId(null);
|
|
|
assets.setClienteleSubId(null);
|
|
|
}
|
|
|
- if (assets.getTerminalClienteleType().equals("个人")){
|
|
|
+ if (assets.getTerminalClienteleType().equals("个人")) {
|
|
|
assets.setTerminalClienteleId(null);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
assets.setTerminalClienteleContactId(null);
|
|
|
}
|
|
|
return this.updateById(assets);
|
|
@@ -258,7 +262,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
// 取号时更新产品选择记录状态
|
|
|
List<BusinessProductionChoiceLog> choiceLogList = new ArrayList<>();
|
|
|
// 循环取号的评估对象id集合
|
|
|
- for (Long targetId : dto.getTargetIdList()){
|
|
|
+ for (Long targetId : dto.getTargetIdList()) {
|
|
|
// 获取每一个取号评估对象的产品选择记录(同一个评估对象不可能同时存在两条状态为未取号的产品选择记录)
|
|
|
BusinessProductionChoiceLog choiceLog = choiceLogService.getOne(new LambdaQueryWrapper<BusinessProductionChoiceLog>()
|
|
|
.eq(BusinessProductionChoiceLog::getTargetId, targetId)
|
|
@@ -291,8 +295,8 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
List<Long> unTakeNoTargetIdList = targetIdListDifference(dto.getAllTargetIdList(), dto.getTargetIdList());
|
|
|
|
|
|
// 将未取号对象的产品选择记录对应的产品id更新
|
|
|
- if (ObjectUtil.isNotNull(unTakeNoTargetIdList) && ObjectUtil.isNotEmpty(unTakeNoTargetIdList)){
|
|
|
- for (Long targetId : unTakeNoTargetIdList){
|
|
|
+ if (ObjectUtil.isNotNull(unTakeNoTargetIdList) && ObjectUtil.isNotEmpty(unTakeNoTargetIdList)) {
|
|
|
+ for (Long targetId : unTakeNoTargetIdList) {
|
|
|
// 获取每一个未评估对象的产品选择记录(同一个评估对象不可能同时存在两条状态为未取号的产品选择记录)
|
|
|
BusinessProductionChoiceLog choiceLog = choiceLogService.getOne(new LambdaQueryWrapper<BusinessProductionChoiceLog>()
|
|
|
.eq(BusinessProductionChoiceLog::getTargetId, targetId)
|
|
@@ -313,16 +317,16 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
//评估对象信息更新添加产品号
|
|
|
for (Long id : dto.getTargetIdList()) {
|
|
|
//判断取号的产品类型
|
|
|
- if (dto.getProductionType().equals(STATEMENT.getCode())){ //意见书
|
|
|
+ if (dto.getProductionType().equals(STATEMENT.getCode())) { //意见书
|
|
|
assetsEvaluationTargetMapper.updateTargetStatementNo(id, productionNo);
|
|
|
- }else { //报告
|
|
|
+ } else { //报告
|
|
|
assetsEvaluationTargetMapper.updateTargetReportNo(id, productionNo);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if (ObjectUtil.isNotNull(productionNo) && ObjectUtil.isNotEmpty(productionNo)){
|
|
|
+ if (ObjectUtil.isNotNull(productionNo) && ObjectUtil.isNotEmpty(productionNo)) {
|
|
|
return Boolean.TRUE;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
@@ -346,9 +350,9 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
//获取当前资产业务流程的评估对象已经生成的产品号集合
|
|
|
List<String> productionNoList = null;
|
|
|
//判断取号的产品类型
|
|
|
- if (takeAssetsProductionNoDTO.getProductionType().equals(STATEMENT.getCode())){ //意见书
|
|
|
+ if (takeAssetsProductionNoDTO.getProductionType().equals(STATEMENT.getCode())) { //意见书
|
|
|
productionNoList = assetsEvaluationTargetMapper.getStatementNoList(takeAssetsProductionNoDTO.getBusinessId());
|
|
|
- }else { //报告
|
|
|
+ } else { //报告
|
|
|
productionNoList = assetsEvaluationTargetMapper.getReportNoList(takeAssetsProductionNoDTO.getBusinessId(), takeAssetsProductionNoDTO.getAllTargetIdList());
|
|
|
}
|
|
|
//判断该资产业务订单是否有取过号
|
|
@@ -496,11 +500,12 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 获取未取号的资产评估对象id
|
|
|
- * @param allTargetIdList 本次资产流程的所有评估对象
|
|
|
+ *
|
|
|
+ * @param allTargetIdList 本次资产流程的所有评估对象
|
|
|
* @param takeNoTargetIdList 本次资产流程的取号评估对象
|
|
|
* @return List<Long>
|
|
|
*/
|
|
|
- public List<Long> targetIdListDifference(List<Long> allTargetIdList, List<Long> takeNoTargetIdList){
|
|
|
+ public List<Long> targetIdListDifference(List<Long> allTargetIdList, List<Long> takeNoTargetIdList) {
|
|
|
// 将取号评估对象集合转换为Set,以便快速查找
|
|
|
Set<Long> takeNoTargetIdSet = new HashSet<>(takeNoTargetIdList);
|
|
|
|
|
@@ -512,6 +517,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 获取资产项目所有参与人
|
|
|
+ *
|
|
|
* @param assetsBusinessMembersDTO 查询dto
|
|
|
* @return List<AssetsBusinessMembers>
|
|
|
*/
|
|
@@ -530,11 +536,12 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
assetsBusinessMemberList.add(assetsBusinessMember);
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- List<Long> memberIds = objectMapper.readValue(businessMember.getMembers(), new TypeReference<List<Long>>() {});
|
|
|
+ List<Long> memberIds = objectMapper.readValue(businessMember.getMembers(), new TypeReference<List<Long>>() {
|
|
|
+ });
|
|
|
|
|
|
|
|
|
// 获取参与人信息
|
|
|
- for (Long userId : memberIds){
|
|
|
+ for (Long userId : memberIds) {
|
|
|
assetsBusinessMember = assetsMapper.getAssetsBusinessMember(userId);
|
|
|
assetsBusinessMember.setBusinessId(assetsBusinessMembersDTO.getBusinessId());
|
|
|
assetsBusinessMember.setMemberType("项目参与人");
|
|
@@ -542,12 +549,13 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
}
|
|
|
|
|
|
// 判断报告号是否为空(为空说明没出报告,就没签字师)
|
|
|
- if (ObjectUtil.isNotNull(assetsBusinessMembersDTO.getReportNo()) && ObjectUtil.isNotEmpty(assetsBusinessMembersDTO.getReportNo())){
|
|
|
+ if (ObjectUtil.isNotNull(assetsBusinessMembersDTO.getReportNo()) && ObjectUtil.isNotEmpty(assetsBusinessMembersDTO.getReportNo())) {
|
|
|
// 获取签字师id
|
|
|
String signatorys = assetsMapper.getSignatorys(assetsBusinessMembersDTO);
|
|
|
- List<Long> signatoryIds = objectMapper.readValue(signatorys, new TypeReference<List<Long>>() {});
|
|
|
+ List<Long> signatoryIds = objectMapper.readValue(signatorys, new TypeReference<List<Long>>() {
|
|
|
+ });
|
|
|
// 获取签字师信息
|
|
|
- for (Long userId : signatoryIds){
|
|
|
+ for (Long userId : signatoryIds) {
|
|
|
assetsBusinessMember = assetsMapper.getAssetsBusinessMember(userId);
|
|
|
assetsBusinessMember.setBusinessId(assetsBusinessMembersDTO.getBusinessId());
|
|
|
assetsBusinessMember.setMemberType("签字师");
|
|
@@ -561,25 +569,26 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 认领实收款到 订单
|
|
|
+ *
|
|
|
* @param claimOrders 认领信息
|
|
|
* @return Boolean
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean doAllotRealAmountToOrder(List<OrderReportDTO> claimOrders) {
|
|
|
- if (CollectionUtil.isNotEmpty(claimOrders)){
|
|
|
+ if (CollectionUtil.isNotEmpty(claimOrders)) {
|
|
|
//先校验各订单此次认领金额之和是否大于这笔实收款的剩余金额
|
|
|
Long financeFundId = claimOrders.get(0).getFinanceFundId();
|
|
|
BigDecimal residueAmount = financeClaimService.checkFinanceFound(financeFundId);
|
|
|
BigDecimal thisTimeTotalAmount = claimOrders.stream().map(OrderReportDTO::getThisTimeAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- if (thisTimeTotalAmount.compareTo(residueAmount)>0){
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"本次订单认领之和大于实收款剩余金额,请检查后再认领。");
|
|
|
+ if (thisTimeTotalAmount.compareTo(residueAmount) > 0) {
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "本次订单认领之和大于实收款剩余金额,请检查后再认领。");
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
- for (OrderReportDTO orderReportDTO : claimOrders){
|
|
|
+ for (OrderReportDTO orderReportDTO : claimOrders) {
|
|
|
BigDecimal thisTimeAmount = orderReportDTO.getThisTimeAmount();
|
|
|
- if (thisTimeAmount==null || thisTimeAmount.compareTo(BigDecimal.ZERO)==0){
|
|
|
+ if (thisTimeAmount == null || thisTimeAmount.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
//更新订单实收款
|
|
@@ -603,6 +612,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 获取订单详情
|
|
|
+ *
|
|
|
* @param id 订单id
|
|
|
* @return Assets
|
|
|
*/
|
|
@@ -613,6 +623,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
|
|
|
/**
|
|
|
* 更新资产订单基本信息
|
|
|
+ *
|
|
|
* @param assets 更新信息
|
|
|
* @return Boolean
|
|
|
*/
|
|
@@ -626,22 +637,22 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
|
|
|
*
|
|
|
* @return Long
|
|
|
*/
|
|
|
- private synchronized Long getAllotDepartmentId(){
|
|
|
+ private synchronized Long getAllotDepartmentId() {
|
|
|
|
|
|
List<SortedDepartment> departments = sortedDepartmentService.list(new LambdaQueryWrapper<SortedDepartment>().eq(SortedDepartment::getBusinessType, MainBusinessEnum.ASSET_BUSINESS.getCode()));
|
|
|
|
|
|
- if (CollectionUtil.isEmpty(departments)){
|
|
|
+ if (CollectionUtil.isEmpty(departments)) {
|
|
|
ErrorCode.throwBusinessException(ErrorCode.SORTED_DEPARTMENT_NOT_EXISTS, MainBusinessEnum.ASSET_BUSINESS.getMsg());
|
|
|
}
|
|
|
|
|
|
|
|
|
GlobalConfig currentSorted = globalConfigService.getGlobalConfig(GlobalConfigEnum.DEPARTMENT_TURNS.name(), GlobalConfigEnum.DepartmentTurns.ASSET_BUSINESS.name());
|
|
|
|
|
|
- Integer currentSortedIndex = Integer.valueOf(StrUtil.isBlank(currentSorted.getValue())?"0":currentSorted.getValue());
|
|
|
+ Integer currentSortedIndex = Integer.valueOf(StrUtil.isBlank(currentSorted.getValue()) ? "0" : currentSorted.getValue());
|
|
|
|
|
|
List<Integer> indexes = departments.stream().map(SortedDepartment::getSortedIndex).sorted(Integer::compareTo).collect(Collectors.toList());
|
|
|
- for (int i=0;i<indexes.size();i++){
|
|
|
- if (currentSortedIndex.equals(indexes.get(i))){
|
|
|
+ for (int i = 0; i < indexes.size(); i++) {
|
|
|
+ if (currentSortedIndex.equals(indexes.get(i))) {
|
|
|
Integer waitingIndex = indexes.get((i + 1) % indexes.size());
|
|
|
currentSorted.setValue(String.valueOf(waitingIndex));
|
|
|
globalConfigService.update(currentSorted);
|