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

投保列表查询

parent 8175fc15
......@@ -27,6 +27,14 @@ public class InsurancesConstants {
* 被替换信息不存在
*/
public static final String REPLACE_IS_NOT_EXIST = "被替换信息不存在";
/**
* 项目编码不存在
*/
public static final String DEPT_NO_IS_NOT_EXIST = "项目编码不存在";
/**
* 未找到结算主体的结算方式
*/
public static final String PROJECT_NOT_FIND_SETTLE_TYPE = "未找到结算主体的结算方式";
/**
* 替换者信息已存在
*/
......
......@@ -199,9 +199,9 @@ public class TInsuranceDetail extends BaseEntity {
private String insuranceHandleCityName;
/**
* 结算类型 (1、单独结算 2、合并结算-和工资一起结算)
* 结算类型 (0、预估 1、实缴)
*/
@Schema(description = "结算类型 (1、单独结算 2、合并结算-和工资一起结算)")
@Schema(description = "结算类型 (0、预估 1、实缴)")
private Integer settleType;
/**
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description 投保列表请求参数
* @date 2022-07-20 16:14:19
*/
@Data
@Tag(name = "投保列表请求参数")
public class InsuranceListParam implements Serializable {
private static final long serialVersionUID = -4692341622141432288L;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 投保状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/
@Schema(description = "投保状态 1待投保 2投保中 3已投保 4投保退回 5 已减员")
private Integer buyHandleStatus;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author licancan
* @description 投保列表VO
* @date 2022-07-20 16:18:41
*/
@Data
@Tag(name = "投保列表VO")
public class InsuranceListVO implements Serializable {
private static final long serialVersionUID = -6673220061558171816L;
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 投保类型, 1新增、3批增、4替换
*/
@Schema(description = " 投保类型, 1新增、3批增、4替换")
private Integer buyType;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String projectName;
/**
* 项目编码
*/
@JsonIgnore
private String deptNo;
/**
* 投保岗位
*/
@Schema(description = "投保岗位")
private String post;
/**
* 保单开始时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "保单开始时间")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "保单结束时间")
private LocalDate policyEnd;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 创建人姓名
*/
@Schema(description = "创建人(派单人)")
private String createName;
/**
* 投保状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/
@Schema(description = "投保状态 1待投保 2投保中 3已投保 4投保退回 5 已减员")
private Integer buyHandleStatus;
/**
* 结算类型 (0、预估 1、实缴)
*/
@Schema(description = "结算类型 (0、预估 1、实缴)")
private Integer settleType;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
}
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.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.InsuranceRefundCheck;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceBatchParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceReplaceParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -37,6 +38,20 @@ public class TInsuranceDetailController {
private TInsuranceDetailService tInsuranceDetailService;
/***********************商险办理********************************/
/**
* 投保办理分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link R<IPage<InsuranceListVO>>}
*/
@Operation(summary = "投保办理分页查询", description = "投保办理分页查询")
@PostMapping("/getInsuranceListPage")
public R<IPage<InsuranceListVO>> getInsuranceListPage(Page<InsuranceListVO> page, @RequestBody InsuranceListParam param) {
return R.ok(tInsuranceDetailService.getInsuranceListPage(page, param));
}
/**
* 商险新增
*
......@@ -44,6 +59,7 @@ public class TInsuranceDetailController {
* @param paramList
* @return {@link R<List<InsuranceAddParam>>}
*/
@Operation(summary = "投保新增", description = "投保新增")
@PostMapping("/addInsurance")
public R<List<InsuranceAddParam>> addInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceAddParam> paramList){
return tInsuranceDetailService.addInsurance(paramList);
......@@ -56,6 +72,7 @@ public class TInsuranceDetailController {
* @param paramList
* @return {@link R<List<InsuranceBatchParam>>}
*/
@Operation(summary = "投保批增", description = "投保批增")
@PostMapping("/batchInsurance")
public R<List<InsuranceBatchParam>> batchInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceBatchParam> paramList){
return tInsuranceDetailService.batchInsurance(paramList);
......@@ -68,13 +85,13 @@ public class TInsuranceDetailController {
* @param paramList
* @return {@link R<List<InsuranceReplaceParam>>}
*/
@Operation(summary = "投保替换", description = "投保替换")
@PostMapping("/replaceInsurance")
public R<List<InsuranceReplaceParam>> replaceInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceReplaceParam> paramList){
return tInsuranceDetailService.replaceInsurance(paramList);
}
/***********************减员办理********************************/
/**
* 导入减员校验
* @param insuranceRefundCheckList 导入减员校验
......
package com.yifu.cloud.plus.v1.yifu.insurances.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author licancan
......@@ -11,5 +16,16 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
/***********************商险办理********************************/
/**
* 投保办理分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link IPage< InsuranceListVO>}
*/
IPage<InsuranceListVO> getInsuranceListPage(Page<InsuranceListVO> page, @Param("param") InsuranceListParam param);
/***********************减员办理********************************/
}
package com.yifu.cloud.plus.v1.yifu.insurances.service;
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.insurances.entity.InsuranceRefundCheck;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceBatchParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceReplaceParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import java.util.List;
......@@ -19,6 +19,16 @@ import java.util.List;
public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
/***********************商险办理********************************/
/**
* 投保办理分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link IPage<InsuranceListVO>}
*/
IPage<InsuranceListVO> getInsuranceListPage(Page<InsuranceListVO> page, InsuranceListParam param);
/**
* 商险新增
*
......@@ -54,5 +64,4 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @return {@link R}
*/
R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Sets;
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.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
......@@ -15,10 +19,9 @@ import com.yifu.cloud.plus.v1.yifu.insurances.service.*;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceBatchParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceReplaceParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
......@@ -30,6 +33,7 @@ import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author licancan
......@@ -49,8 +53,39 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private TInsuranceTypeStandardService tInsuranceTypeStandardService;
@Resource
private TInsuranceReplaceService tInsuranceReplaceService;
@Resource
private ArchivesDaprUtil archivesDaprUtil;
/***********************商险办理********************************/
/**
* 投保办理分页查询
*
* @param page
* @param param
* @return {@link IPage < InsuranceListVO >}
* @author licancan
*/
@Override
public IPage<InsuranceListVO> getInsuranceListPage(Page<InsuranceListVO> page, InsuranceListParam param) {
//todo 根据登录人获取数据权限
IPage<InsuranceListVO> insuranceList = baseMapper.getInsuranceListPage(page,param);
if (CollectionUtils.isNotEmpty(insuranceList.getRecords())){
//根据项目编码获取项目名称
List<String> collect = insuranceList.getRecords().stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<Map> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS && MapUtils.isNotEmpty(setInfoByCodes.getData())) {
Map data = setInfoByCodes.getData();
for (InsuranceListVO record : insuranceList.getRecords()) {
JSONObject jsonObject = (JSONObject) data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getString("departName")).orElse(""));
}
}
}
}
return insuranceList;
}
/**
* 商险新增
*
......@@ -178,6 +213,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//新数据置为待办理
newDetail.setId(null);
newDetail.setBuyHandleStatus(CommonConstants.ONE_INT);
newDetail.setBuyType(CommonConstants.FOUR_INT);
newDetail.setEmpName(success.getReplaceEmpName());
newDetail.setEmpIdcardNo(success.getReplaceEmpIdcardNo());
newDetail.setDeptNo(success.getReplaceDeptNo());
......@@ -305,10 +341,33 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
//todo 实名校验合法
//todo 根据项目编码和订单编号查询项目是否存在
//todo 结算类型,根据项目编码获取,并冗余到明细记录中
//param.setSettleType(CommonConstants.ONE_INT);
//根据项目编码查询项目是否存在
R<Map> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS) {
Map data = setInfoByCodes.getData();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
JSONObject jsonObject = (JSONObject) data.get(param.getDeptNo());
if (null == jsonObject){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = jsonObject.getString("insuranceSettleType");
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.PROJECT_NOT_FIND_SETTLE_TYPE);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
}
}
}
}
//todo 省市校验是否正确并设置对应code
//param.setInsuranceProvince();
//param.setInsuranceCity();
......@@ -496,10 +555,33 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
//todo 实名校验合法
//todo 根据项目编码和订单编号查询项目是否存在
//todo 结算类型,根据项目编码获取,并冗余到明细记录中
//param.setSettleType(CommonConstants.ONE_INT);
//根据项目编码查询项目是否存在
R<Map> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS) {
Map data = setInfoByCodes.getData();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
JSONObject jsonObject = (JSONObject) data.get(param.getDeptNo());
if (null == jsonObject){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = jsonObject.getString("insuranceSettleType");
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.PROJECT_NOT_FIND_SETTLE_TYPE);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
}
}
}
}
//todo 省市校验是否正确并设置对应code
//param.setInsuranceProvince();
//param.setInsuranceCity();
......
......@@ -67,4 +67,40 @@
CREATE_BY,CREATE_NAME,CREATE_TIME,
UPDATE_BY,UPDATE_TIME,DELETE_FLAG
</sql>
<select id="getInsuranceListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
select detail.id as id,
detail.ORDER_NO as orderNo,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.BUY_TYPE as buyType,
detail.POST as post,
detail.DEPT_NO as deptNo,
detail.POLICY_START as policyStart,
detail.POLICY_END as policyEnd,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard,
detail.CREATE_NAME as createName,
detail.BUY_HANDLE_STATUS as buyHandleStatus,
detail.SETTLE_TYPE as settleType,
detail.SETTLE_MONTH as settleMonth
from t_insurance_detail detail
where detail.DELETE_FLAG = 0
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and detail.DEPT_NO like concat('%',replace(replace(#{deptNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.buyHandleStatus != null">
and detail.BUY_HANDLE_STATUS = #{param.buyHandleStatus}
</if>
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
</if>
ORDER BY detail.CREATE_TIME DESC
</select>
</mapper>
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