|
|
@@ -30,6 +30,8 @@ import com.gubersail.admin.zcrm.customer.service.IViewCustomerSelService;
|
|
|
import com.gubersail.dealer.admin.api.claim.entity.BladeClaim;
|
|
|
import com.gubersail.dealer.admin.api.claim.entity.BladeClaimAttachment;
|
|
|
import com.gubersail.dealer.admin.api.claim.entity.BladeClaimAudit;
|
|
|
+import com.gubersail.dealer.admin.api.claim.vo.BladeClaimAttachmentVO;
|
|
|
+import com.gubersail.dealer.admin.api.claim.vo.BladeClaimAuditVO;
|
|
|
import com.gubersail.dealer.admin.api.claim.vo.BladeClaimVO;
|
|
|
import com.gubersail.dealer.admin.api.zcrm.customer.entity.ViewCustomerSel;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -69,7 +71,7 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
|
|
|
private final IViewCustomerSelService viewCustomerSelService;
|
|
|
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
public IPage<BladeClaimVO> selectBladeClaimPage(IPage<BladeClaimVO> page, BladeClaimVO bladeClaim) {
|
|
|
return page.setRecords(baseMapper.selectBladeClaimPage(page, bladeClaim));
|
|
|
}
|
|
|
@@ -114,15 +116,7 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
claim.setSourceName(customerSel.getCustomerName());
|
|
|
}
|
|
|
} else {
|
|
|
- BladeClaim dataSourceClaim = baseMapper.selectOne(new LambdaQueryWrapper<BladeClaim>().select(BladeClaim::getId, BladeClaim::getVersion)
|
|
|
- .eq(BladeClaim::getId, claim.getId()));
|
|
|
- if (!Objects.equals(dataSourceClaim.getVersion(), claim.getVersion())) {
|
|
|
- return R.fail(601, "数据已被其他用户更新,请等待刷新后重试");
|
|
|
- }
|
|
|
- // 每更新一次往上累加一次版本
|
|
|
- // 旧数据处理
|
|
|
- int version = dataSourceClaim.getVersion() == null ? 1 : dataSourceClaim.getVersion();
|
|
|
- claim.setVersion(version + 1);
|
|
|
+ claim.setVersion(claim.getVersion() == null ? 1 : claim.getVersion() + 1);
|
|
|
claim.setUpdateUser(AuthUtil.getUserId());
|
|
|
claim.setUpdateTime(new Date());
|
|
|
}
|
|
|
@@ -130,7 +124,8 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
this.saveOrUpdate(claim);
|
|
|
//判断是否存在理赔审核结果及客户反馈数据
|
|
|
if (ObjectUtils.isNotNull(bladeClaim.getBladeClaimAuditList()) && !bladeClaim.getBladeClaimAuditList().isEmpty()) {
|
|
|
- for (BladeClaimAudit item : bladeClaim.getBladeClaimAuditList()) {
|
|
|
+ List<BladeClaimAudit> bladeClaimAuditList = BeanUtil.copy(bladeClaim.getBladeClaimAuditList(), BladeClaimAudit.class);
|
|
|
+ for (BladeClaimAudit item : bladeClaimAuditList) {
|
|
|
//添加理赔主表关联数据
|
|
|
item.setClaimId(claim.getId());
|
|
|
item.setClaimNo(claim.getClaimNo());
|
|
|
@@ -145,11 +140,12 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
}
|
|
|
}
|
|
|
//批量保存理赔审核结果及客户反馈数据
|
|
|
- bladeClaimAuditService.saveOrUpdateBatch(bladeClaim.getBladeClaimAuditList());
|
|
|
+ bladeClaimAuditService.saveOrUpdateBatch(bladeClaimAuditList);
|
|
|
}
|
|
|
//判断是否存在理赔附件数据
|
|
|
if (ObjectUtils.isNotNull(bladeClaim.getClaimAttachmentList()) && !bladeClaim.getClaimAttachmentList().isEmpty()) {
|
|
|
- for (BladeClaimAttachment item : bladeClaim.getClaimAttachmentList()) {
|
|
|
+ List<BladeClaimAttachment> claimAttachmentList = BeanUtil.copy(bladeClaim.getClaimAttachmentList(), BladeClaimAttachment.class);
|
|
|
+ for (BladeClaimAttachment item : claimAttachmentList) {
|
|
|
//添加理赔主表关联数据
|
|
|
item.setClaimId(claim.getId());
|
|
|
//判断是否是第一次保存
|
|
|
@@ -163,7 +159,7 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
}
|
|
|
}
|
|
|
//批量保存理赔附件数据数据
|
|
|
- bladeClaimAttachmentService.saveOrUpdateBatch(bladeClaim.getClaimAttachmentList());
|
|
|
+ bladeClaimAttachmentService.saveOrUpdateBatch(claimAttachmentList);
|
|
|
}
|
|
|
return R.data(claim);
|
|
|
}
|
|
|
@@ -175,23 +171,64 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
//数据实体类转换
|
|
|
BladeClaimVO bladeClaimVO = ClaimWrapper.build().entityVO(claim);
|
|
|
R<User> createUserR = userClient.userInfoById(claim.getCreateUser());
|
|
|
- if (createUserR.isSuccess() && ObjectUtils.isNotNull(createUserR.getData())){
|
|
|
+ if (createUserR.isSuccess() && ObjectUtils.isNotNull(createUserR.getData())) {
|
|
|
bladeClaimVO.setCreateUserName(createUserR.getData().getRealName());
|
|
|
}
|
|
|
R<User> updateUserR = userClient.userInfoById(claim.getUpdateUser());
|
|
|
- if (updateUserR.isSuccess() && ObjectUtils.isNotNull(updateUserR.getData())){
|
|
|
+ if (updateUserR.isSuccess() && ObjectUtils.isNotNull(updateUserR.getData())) {
|
|
|
bladeClaimVO.setUpdateUserName(updateUserR.getData().getRealName());
|
|
|
}
|
|
|
//查询理赔附件数据
|
|
|
List<BladeClaimAttachment> claimAttachmentList = bladeClaimAttachmentService.list(new LambdaQueryWrapper<BladeClaimAttachment>()
|
|
|
.eq(BladeClaimAttachment::getClaimId, claim.getId())
|
|
|
.eq(BladeClaimAttachment::getIsDeleted, 0));
|
|
|
- bladeClaimVO.setClaimAttachmentList(claimAttachmentList.isEmpty() ? new ArrayList<>() : claimAttachmentList);
|
|
|
+ List<BladeClaimAttachmentVO> claimAttachmentListVO = BeanUtil.copy(claimAttachmentList, BladeClaimAttachmentVO.class);
|
|
|
+ List<Long> userList = new ArrayList<>();
|
|
|
+ if (!claimAttachmentListVO.isEmpty()) {
|
|
|
+ userList.addAll(claimAttachmentListVO.stream().map(BladeClaimAttachmentVO::getUpdateUser)
|
|
|
+ .filter(Objects::nonNull).distinct().collect(Collectors.toList()));
|
|
|
+ userList.addAll(claimAttachmentListVO.stream().map(BladeClaimAttachmentVO::getCreateUser)
|
|
|
+ .filter(Objects::nonNull).distinct().collect(Collectors.toList()));
|
|
|
+ }
|
|
|
//查询理赔审核结果及客户反馈数据
|
|
|
List<BladeClaimAudit> claimAuditList = bladeClaimAuditService.list(new LambdaQueryWrapper<BladeClaimAudit>()
|
|
|
.eq(BladeClaimAudit::getClaimId, claim.getId())
|
|
|
.eq(BladeClaimAudit::getIsDeleted, 0));
|
|
|
- bladeClaimVO.setBladeClaimAuditList(claimAuditList.isEmpty() ? new ArrayList<>() : claimAuditList);
|
|
|
+ List<BladeClaimAuditVO> bladeClaimAuditListVO = BeanUtil.copy(claimAuditList, BladeClaimAuditVO.class);
|
|
|
+ if (!bladeClaimAuditListVO.isEmpty()) {
|
|
|
+ userList.addAll(bladeClaimAuditListVO.stream().map(BladeClaimAuditVO::getUpdateUser)
|
|
|
+ .filter(Objects::nonNull).distinct().collect(Collectors.toList()));
|
|
|
+ userList.addAll(bladeClaimAuditListVO.stream().map(BladeClaimAuditVO::getCreateUser)
|
|
|
+ .filter(Objects::nonNull).distinct().collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
+ if (!userList.isEmpty()) {
|
|
|
+ users = userClient.userListGetByIds(userList.stream().distinct().collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ if (!users.isEmpty()) {
|
|
|
+ for (BladeClaimAttachmentVO item : claimAttachmentListVO) {
|
|
|
+ //赋值创建人名称
|
|
|
+ if (ObjectUtils.isNotNull(item.getCreateUser())) {
|
|
|
+ users.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().ifPresent(user -> item.setCreateUserName(user.getRealName()));
|
|
|
+ }
|
|
|
+ //赋值修改人名称
|
|
|
+ if (ObjectUtils.isNotNull(item.getUpdateUser())) {
|
|
|
+ users.stream().filter(e -> e.getId().equals(item.getUpdateUser())).findFirst().ifPresent(user -> item.setUpdateUserName(user.getRealName()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (BladeClaimAuditVO item : bladeClaimAuditListVO) {
|
|
|
+ //赋值创建人名称
|
|
|
+ if (ObjectUtils.isNotNull(item.getCreateUser())) {
|
|
|
+ users.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().ifPresent(user -> item.setCreateUserName(user.getRealName()));
|
|
|
+ }
|
|
|
+ //赋值修改人名称
|
|
|
+ if (ObjectUtils.isNotNull(item.getUpdateUser())) {
|
|
|
+ users.stream().filter(e -> e.getId().equals(item.getUpdateUser())).findFirst().ifPresent(user -> item.setUpdateUserName(user.getRealName()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bladeClaimVO.setClaimAttachmentList(claimAttachmentListVO.isEmpty() ? new ArrayList<>() : claimAttachmentListVO);
|
|
|
+ bladeClaimVO.setBladeClaimAuditList(bladeClaimAuditListVO.isEmpty() ? new ArrayList<>() : bladeClaimAuditListVO);
|
|
|
return bladeClaimVO;
|
|
|
}
|
|
|
|
|
|
@@ -207,8 +244,7 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
claim.setAuditStatus(1);
|
|
|
claim.setUpdateTime(new Date());
|
|
|
claim.setUpdateUser(AuthUtil.getUserId());
|
|
|
- int version = claim.getVersion() == null ? 1 : claim.getVersion();
|
|
|
- claim.setVersion(version + 1);
|
|
|
+ claim.setVersion(claim.getVersion() == null ? 1 : claim.getVersion() + 1);
|
|
|
this.updateById(claim);
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
@@ -225,8 +261,7 @@ public class BladeClaimServiceImpl extends ServiceImpl<BladeClaimMapper, BladeCl
|
|
|
claim.setAuditStatus(0);
|
|
|
claim.setUpdateTime(new Date());
|
|
|
claim.setUpdateUser(AuthUtil.getUserId());
|
|
|
- int version = claim.getVersion() == null ? 1 : claim.getVersion();
|
|
|
- claim.setVersion(version + 1);
|
|
|
+ claim.setVersion(claim.getVersion() == null ? 1 : claim.getVersion() + 1);
|
|
|
this.updateById(claim);
|
|
|
return R.success("操作成功");
|
|
|
}
|