Commit 9182aaf7 authored by 李灿灿's avatar 李灿灿

商险导出办理接口

parent 20d26fdb
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author licancan
* @description 导出办理请求参数
* @date 2022-07-21 14:21:06
*/
@Data
@Schema(description = "导出办理请求参数")
public class InsuranceExportListParam implements Serializable {
private static final long serialVersionUID = 3623027153213352936L;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 商险id集合
*/
@Schema(description = "商险id集合")
private List<String> idList;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author licancan
* @description 导出办理VO
* @date 2022-07-21 14:21:39
*/
@Data
@Schema(description = "导出办理VO")
public class InsuranceExportListVO implements Serializable {
private static final long serialVersionUID = -8159190612104775933L;
/**
* 主键
*/
private String id;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String projectName;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 员工姓名
*/
@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 post;
/**
* 商险购买地省
*/
@Schema(description = "商险购买地省")
private String insuranceProvinceName;
/**
* 商险购买地市
*/
@Schema(description = "商险购买地市")
private String insuranceCityName;
/**
* 商险办理省
*/
@Schema(description = "商险办理省")
private String insuranceHandleProvinceName;
/**
* 商险办理城市
*/
@Schema(description = "商险办理城市")
private String insuranceHandleCityName;
/**
* 保单开始时间
*/
@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 medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
/**
* 结算类型 (0、预估 1、实缴)
*/
@Schema(description = "结算类型 (0、预估 1、实缴)")
private Integer settleType;
/**
* 创建人姓名
*/
@Schema(description = "创建人(派单人)")
private String createName;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}
...@@ -143,6 +143,19 @@ public class TInsuranceDetailController { ...@@ -143,6 +143,19 @@ public class TInsuranceDetailController {
return R.ok(tInsuranceDetailService.getInsuranceDetailById(id)); return R.ok(tInsuranceDetailService.getInsuranceDetailById(id));
} }
/**
* 导出办理
*
* @author licancan
* @param param
* @return {@link R<List<InsuranceExportListVO>>}
*/
@Operation(summary = "导出办理", description = "导出办理")
@PostMapping("/getInsuranceExportList")
public R<List<InsuranceExportListVO>> getInsuranceExportList(@RequestBody InsuranceExportListParam param) {
return R.ok(tInsuranceDetailService.getInsuranceExportList(param));
}
/***********************减员办理********************************/ /***********************减员办理********************************/
/** /**
* 导入减员校验 * 导入减员校验
......
...@@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceDetailVO; import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -48,5 +46,23 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> { ...@@ -48,5 +46,23 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
*/ */
InsuranceDetailVO getInsuranceDetailById(@Param("id") String id); InsuranceDetailVO getInsuranceDetailById(@Param("id") String id);
/**
* 导出办理勾选查询结果
*
* @author licancan
* @param idList
* @return {@link List<InsuranceExportListVO>}
*/
List<InsuranceExportListVO> getInsuranceExportListBySelect(@Param("idList") List<String> idList);
/**
* 导出办理非勾选查询结果
*
* @author licancan
* @param param
* @return {@link List< InsuranceExportListVO>}
*/
List<InsuranceExportListVO> getInsuranceExportList(@Param("param") InsuranceExportListParam param);
/***********************减员办理********************************/ /***********************减员办理********************************/
} }
...@@ -91,6 +91,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -91,6 +91,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/ */
InsuranceDetailVO getInsuranceDetailById(String id); InsuranceDetailVO getInsuranceDetailById(String id);
/**
* 导出办理
*
* @author licancan
* @param param
* @return {@link List<InsuranceExportListVO>}
*/
List<InsuranceExportListVO> getInsuranceExportList(InsuranceExportListParam param);
/***********************减员办理********************************/ /***********************减员办理********************************/
/** /**
* 减员导入校验 * 减员导入校验
......
...@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service; ...@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
...@@ -405,6 +406,58 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -405,6 +406,58 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return insuranceDetailVO; return insuranceDetailVO;
} }
/**
* 导出办理
*
* @param param
* @return {@link List<InsuranceExportListVO>}
* @author licancan
*/
@Override
public List<InsuranceExportListVO> getInsuranceExportList(InsuranceExportListParam param) {
YifuUser user = SecurityUtils.getUser();
List<InsuranceExportListVO> insuranceExportList;
//todo 根据登录人获取数据权限
//如勾选项不为空,则导出勾选记录;否则导出当前筛选条件下 && 「待投保」的结果集
if (CollectionUtils.isNotEmpty(param.getIdList())){
insuranceExportList = baseMapper.getInsuranceExportListBySelect(param.getIdList());
}else {
insuranceExportList = baseMapper.getInsuranceExportList(param);
}
if (CollectionUtils.isNotEmpty(insuranceExportList)){
List<TInsuranceDetail> detailList = new ArrayList<>();
//根据项目编码获取项目名称
List<String> collect = insuranceExportList.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 (InsuranceExportListVO record : insuranceExportList) {
JSONObject jsonObject = (JSONObject) data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getString("departName")).orElse(""));
}
TInsuranceDetail detail = new TInsuranceDetail();
detail.setId(record.getId());
//update状态由「待投保」置为「投保中」
detail.setBuyHandleStatus(CommonConstants.TWO_INT);
if (record.getBuyType() == CommonConstants.ONE_INT){
// if 投保类型 == 新增,then 更新保单生效日期为:T+1,无需考虑节假日
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
detailList.add(detail);
}
}
//批量更新
if (CollectionUtils.isNotEmpty(detailList)){
this.saveOrUpdateBatch(detailList);
}
}
return insuranceExportList;
}
/** /**
* 商险新增校验 * 商险新增校验
* *
......
...@@ -182,4 +182,76 @@ ...@@ -182,4 +182,76 @@
left join t_insurance_settle tis on detail.DEFAULT_SETTLE_ID = tis.ID left join t_insurance_settle tis on detail.DEFAULT_SETTLE_ID = tis.ID
where detail.ID = #{id} where detail.ID = #{id}
</select> </select>
<select id="getInsuranceExportListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceExportListVO">
select detail.id as id,
detail.ORDER_NO as orderNo,
detail.DEPT_NO as deptNo,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.BUY_TYPE as buyType,
detail.POST as post,
detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
detail.INSURANCE_CITY_NAME as insuranceCityName,
detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
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.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
detail.SETTLE_MONTH as settleMonth,
detail.SETTLE_TYPE as settleType,
detail.CREATE_NAME as createName,
detail.REMARK as remark
from t_insurance_detail detail
where detail.id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
ORDER BY detail.CREATE_TIME DESC
</select>
<select id="getInsuranceExportList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceExportListVO">
select detail.id as id,
detail.ORDER_NO as orderNo,
detail.DEPT_NO as deptNo,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.BUY_TYPE as buyType,
detail.POST as post,
detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
detail.INSURANCE_CITY_NAME as insuranceCityName,
detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
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.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
detail.SETTLE_MONTH as settleMonth,
detail.SETTLE_TYPE as settleType,
detail.CREATE_NAME as createName,
detail.REMARK as remark
from t_insurance_detail detail
where detail.DELETE_FLAG = 0 and detail.BUY_HANDLE_STATUS = 1
<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.deptNo != null and param.deptNo.trim() != ''">
and detail.DEPT_NO like concat('%',replace(replace(#{deptNo},'_','\_'),'%','\%'),'%')
</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> </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