Commit fc7d6668 authored by 李灿灿's avatar 李灿灿

商险投保成功,投保退回接口调整

parent 5df2d239
......@@ -3,9 +3,8 @@ package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @author licancan
......@@ -18,11 +17,11 @@ public class InsuranceHandleParam implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 集合不能为空
* 商险明细id
*/
@Size(min = 1,message = "集合不能为空")
@Schema(description = "主键集合")
private List<String> idList;
@Schema(description = "商险明细id")
@NotBlank(message = "商险明细id不能为空")
private String id;
/**
* 审批意见
......
......@@ -2,9 +2,13 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
......@@ -227,26 +231,34 @@ public class TInsuranceDetailController {
* 投保退回
*
* @author licancan
* @param param
* @param paramList
* @return {@link R<List<InsuranceListVO>>}
*/
@Operation(summary = "投保退回", description = "投保退回")
@PostMapping("/rollBackInsurance")
public R<List<InsuranceListVO>> rollBackInsurance(@RequestBody @Valid InsuranceHandleParam param){
return tInsuranceDetailService.rollBackInsurance(param.getIdList(),param.getRemark());
public R<List<InsuranceListVO>> rollBackInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceHandleParam> paramList){
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
return tInsuranceDetailService.rollBackInsurance(user,paramList);
}
/**
* 办理成功
*
* @author licancan
* @param param
* @param paramList
* @return {@link R<List<InsuranceListVO>>}
*/
@Operation(summary = "办理成功", description = "办理成功")
@PostMapping("/successfulInsurance")
public R<List<InsuranceListVO>> successfulInsurance(@RequestBody @Valid InsuranceHandleParam param){
return tInsuranceDetailService.successfulInsurance(param.getIdList(),param.getRemark());
public R<List<InsuranceListVO>> successfulInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceHandleParam> paramList){
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
return tInsuranceDetailService.successfulInsurance(user,paramList);
}
/**
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
......@@ -152,21 +153,21 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* 投保退回
*
* @author licancan
* @param idList
* @param remark
* @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>}
*/
R<List<InsuranceListVO>> rollBackInsurance(List<String> idList,String remark);
R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList);
/**
* 办理成功
*
* @author licancan
* @param idList
* @param remark
* @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>}
*/
R<List<InsuranceListVO>> successfulInsurance(List<String> idList,String remark);
R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList);
/**
* 登记保单保费
......
......@@ -956,20 +956,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
/**
* 投保退回
*
* @param idList
* @param remark
* @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>}
* @author licancan
*/
@Override
public R<List<InsuranceListVO>> rollBackInsurance(List<String> idList,String remark) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if (CollectionUtils.isEmpty(idList)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
public R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
//解析参数里的商险id
List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
//操作日志对象
List<InsuranceHandleParam> operateList = new ArrayList<>();
List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList);
//返回给前端的数据
List<InsuranceListVO> errorList = new ArrayList<>();
......@@ -1057,6 +1055,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//获取成功数据的remark
paramList.stream().forEach(e ->{
if (detail.getId().equals(e.getId())){
operateList.add(e);
}
});
}
//更新状态
this.saveOrUpdateBatch(successList);
......@@ -1064,28 +1069,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
setProjectNameByDeptNo(errorList);
//操作记录
addOperate(successList,user,InsurancesConstants.ROLLBACK,remark);
addOperate(operateList,user,InsurancesConstants.ROLLBACK);
return R.ok(errorList,InsurancesConstants.OPERATE_SUCCESS);
}
/**
* 办理成功
*
* @param idList
* @param remark
* @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>}
* @author licancan
*/
@Override
public R<List<InsuranceListVO>> successfulInsurance(List<String> idList,String remark) {
public R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if (CollectionUtils.isEmpty(idList)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
//解析参数里的商险id
List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
//操作日志对象
List<InsuranceHandleParam> operateList = new ArrayList<>();
List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList);
//返回给前端的数据
List<InsuranceListVO> errorList = new ArrayList<>();
......@@ -1225,7 +1229,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
setProjectNameByDeptNo(errorList);
//操作记录
addOperate(successList,user,InsurancesConstants.SUCCESSFUL,remark);
if (CollectionUtils.isNotEmpty(successList)){
for (TInsuranceDetail detail : successList) {
//获取成功数据的remark
paramList.stream().forEach(e ->{
if (detail.getId().equals(e.getId())){
operateList.add(e);
}
});
}
}
addOperate(operateList,user,InsurancesConstants.SUCCESSFUL);
return R.ok(errorList, InsurancesConstants.OPERATE_SUCCESS);
}
......@@ -2679,7 +2693,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
/**
* 操作记录
* 操作记录(无审批remark)
*
* @author licancan
* @param detailList 商险明细集合
......@@ -2708,6 +2722,36 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
/**
* 操作记录(有审批remark)
*
* @author licancan
* @param paramList 操作集合
* @param user 登录用户
* @param operateDesc 操作描述
* @return void
*/
private void addOperate(List<InsuranceHandleParam> paramList,YifuUser user,String operateDesc){
if (CollectionUtils.isNotEmpty(paramList)){
try {
List<TInsuranceOperate> operateList = new ArrayList<>();
for (InsuranceHandleParam param : paramList) {
TInsuranceOperate operate = new TInsuranceOperate();
operate.setRemark(param.getRemark());
operate.setInsuranceDetailId(param.getId());
operate.setOperateDesc(operateDesc);
operate.setCreateBy(user.getId());
operate.setCreateName(user.getNickname());
operate.setCreateTime(LocalDateTime.now());
operateList.add(operate);
}
tInsuranceOperateService.saveBatch(operateList);
}catch (Exception e){
e.getStackTrace();
}
}
}
/**
* 将集合交叉合并,list1 是第一个顺序 list2 是第二个顺序
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment