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

fix: 20221110 投保与退保-已投保-导出已投保名册 由前端导出改为由后端导出

parent 7cede336
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateConverter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
......@@ -23,48 +29,48 @@ public class InsuredListVo implements Serializable {
* 主键
*/
@Schema(description = "主键")
@ExcelIgnore
private String id;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "员工身份证号")
private String empIdcardNo;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
private Integer reduceHandleStatus;
/**
* 投保类型, 1新增、3批增、4替换
*/
@Schema(description = " 投保类型, 1新增、3批增、4替换")
private Integer buyType;
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "投保类型")
@ExcelAttribute(name = "投保类型", readConverterExp = "1=新增,3=批增,4=替换")
private String buyType;
/**
* 项目名称
*/
@Schema(description = "项目名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "项目")
private String projectName;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 投保岗位
*/
@Schema(description = "投保岗位")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "岗位")
private String post;
/**
......@@ -72,6 +78,9 @@ public class InsuredListVo implements Serializable {
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "保单开始时间")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保单开始日期",converter = LocalDateConverter.class)
@DateTimeFormat("yyyy-MM-dd")
private LocalDate policyStart;
/**
......@@ -79,60 +88,81 @@ public class InsuredListVo implements Serializable {
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "保单结束时间")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保单结束日期",converter = LocalDateConverter.class)
@DateTimeFormat("yyyy-MM-dd")
private LocalDate policyEnd;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保险公司")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "险种")
private String insuranceTypeName;
/**
* 购买标准
*/
@Schema(description = "购买标准")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "购买标准(元)")
private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "医保(万元)")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "身故或残疾(万元)")
private String dieDisableQuota;
/**
* 预估保费
*/
@Schema(description = "预估保费")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "预估保费(元)")
private BigDecimal estimatePremium;
/**
* 实际保费
*/
@Schema(description = "实际保费")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "实际保费(元)")
private BigDecimal actualPremium;
/**
* 保单号
*/
@Schema(description = "保单号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保单号")
private String policyNo;
/**
* 发票号
*/
@Schema(description = "发票号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "发票号")
private String invoiceNo;
/**
......@@ -140,103 +170,149 @@ public class InsuredListVo implements Serializable {
*/
@Schema(description = "保单生效日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保单生效日期",converter = LocalDateConverter.class)
@DateTimeFormat("yyyy-MM-dd")
private LocalDate policyEffect;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
@ExcelIgnore
private Integer reduceHandleStatus;
/**
* 项目编码
*/
@Schema(description = "项目编码")
@ExcelIgnore
private String deptNo;
/**
* 商险购买地省code
*/
@Schema(description = "商险购买地省code")
@ExcelIgnore
private Integer insuranceProvince;
/**
* 商险购买地省
*/
@Schema(description = "商险购买地省")
@ExcelIgnore
private String insuranceProvinceName;
/**
* 商险购买地市code
*/
@Schema(description = "商险购买地市code")
@ExcelIgnore
private Integer insuranceCity;
/**
* 商险购买地市
*/
@Schema(description = "商险购买地市")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "商险购买地")
private String insuranceCityName;
/**
* 商险办理省code
*/
@Schema(description = "商险办理省code")
@ExcelIgnore
private Integer insuranceHandleProvince;
/**
* 商险办理省
*/
@Schema(description = "商险办理省")
@ExcelIgnore
private String insuranceHandleProvinceName;
/**
* 商险办理城市code
*/
@Schema(description = "商险办理城市code")
@ExcelIgnore
private Integer insuranceHandleCity;
/**
* 商险办理城市
*/
@Schema(description = "商险办理城市")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "商险办理地")
private String insuranceHandleCityName;
/**
* 是否出险 0未出险 1已出险
*/
@Schema(description = "是否出险 0未出险 1已出险")
private Integer isUse;
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelAttribute(name = "是否出险", readConverterExp = "0=未出险,1=已出险")
@ExcelProperty(value = "是否出险")
private String isUse;
/**
* 是否有效 0有效 1无效
* 是否过期 0未过期 1已过期
*/
@Schema(description = "是否有效 0有效 1无效")
private Integer isEffect;
@Schema(description = "是否过期 0未过期 1已过期")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelAttribute(name = "是否过期", readConverterExp = "0=未过期,1=已过期")
@ExcelProperty(value = "是否过期")
private String isOverdue;
/**
* 是否过期 0未过期 1已过期
* 是否有效 0有效 1无效
*/
@Schema(description = "是否过期 0未过期 1已过期")
private Integer isOverdue;
@Schema(description = "是否有效 0有效 1无效")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelAttribute(name = "是否有效 ", readConverterExp = "0=有效,1=无效")
@ExcelProperty(value = "是否有效")
private String isEffect;
/**
* 派单日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "派单日期")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "派单日期",converter = LocalDateConverter.class)
@DateTimeFormat("yyyy-MM-dd")
private LocalDate createTime;
/**
* 派单人
*/
@Schema(description = "创建人(派单人)")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "派单人")
private String createName;
/**
* 购买月数
*/
@Schema(description = "购买月数")
@ExcelIgnore
private Long buyMonth;
/**
* 创建人所在部门名称
*/
@Schema(description = "创建人所在部门名称")
@ExcelIgnore
private String createUserDeptName;
/**
* 封面抬头
*/
@Schema(description = "封面抬头")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "封面抬头")
private String invoiceTitle;
......
......@@ -120,4 +120,15 @@ public class InsuredParam extends BaseEntity implements Serializable {
@Schema(description = "减员状态 1待减员 2减员中3减员退回,4减员成功")
private Integer reduceHandleStatus;
/**
* @Author fxj
* 查询数据起
**/
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
private int limitEnd;
}
......@@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.Size;
import java.util.List;
......@@ -357,13 +358,14 @@ public class TInsuranceDetailController {
*
* @author zhaji
* @param param 查询条件
* @return {@link R<List<InsuredListVo>>}
* @param response 相应参数
* @return void
*/
@Operation(summary = "已投保列表不分页查询", description = "已投保列表不分页查询")
@PostMapping("/getInsuredList")
@PreAuthorize("@pms.hasPermission('insurance_custserve_insured_export')")
public R getInsuredList(@RequestBody InsuredParam param) {
return tInsuranceDetailService.getInsuredList(param);
public void getInsuredList(@RequestBody InsuredParam param, HttpServletResponse response) {
tInsuranceDetailService.getInsuredList(param,response);
}
/**
......
......@@ -10,6 +10,7 @@ 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.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -204,9 +205,10 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*
* @author zhaji
* @param param 查询参数
* @return {@link List< InsuredListVo>}
* @param response 相应参数
* @return void
*/
R getInsuredList(InsuredParam param);
void getInsuredList(InsuredParam param, HttpServletResponse response);
/**
* 已减员列表分页查询
......
package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -9,10 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Sets;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectSetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
......@@ -45,7 +45,12 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
......@@ -3359,10 +3364,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*
* @author zhaji
* @param param 查询参数
* @return {@link List< InsuredListVo>}
* @param response 相应参数
* @return void
*/
@Override
public R getInsuredList(InsuredParam param) {
public void getInsuredList(InsuredParam param, HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
param.setCreateBy(user.getId());
menuUtil.setAuthSql(user, param);
......@@ -3372,9 +3378,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuredListVo> insuredList;
insuredList = this.baseMapper.getInsuredList(param);
if (CollectionUtils.isNotEmpty(insuredList)){
/*if(insuredList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.EXPORT_TOO_LONG);
}*/
//根据项目编码获取项目名称
List<String> collect = insuredList.stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
try{
......@@ -3398,7 +3401,63 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
return R.ok(insuredList);
//处理导出
String fileName = "商险已投保人员名册" + DateUtil.getThisTime() + CommonConstants.XLSX;
long count = insuredList.size();
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, InsuredListVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
Field[] allFields = InsuredListVo.class.getDeclaredFields();
WriteSheet writeSheet;
ExcelUtil<InsuredListVo> util;
for (int i = 0; i <= count; ) {
// 获取实际记录
param.setLimitStart(i);
param.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
if (Common.isNotNull(insuredList)){
util = new ExcelUtil<>(InsuredListVo.class);
for (InsuredListVo vo:insuredList){
util.convertEntityAsso(vo,null,null,null,allFields);
}
}
if (Common.isNotNull(insuredList)){
writeSheet = EasyExcel.writerSheet("sheet").build();
excelWriter.write(insuredList,writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(insuredList)){
insuredList.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("sheet").build();
excelWriter.write(insuredList,writeSheet);
}
if (Common.isNotNull(insuredList)){
insuredList.clear();
}
out.flush();
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
/**
......
......@@ -538,9 +538,9 @@
a.INVOICE_NO as invoiceNo,
a.POLICY_EFFECT as policyEffect,
a.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
a.INSURANCE_CITY_NAME as insuranceCityName,
CONCAT(a.INSURANCE_PROVINCE_NAME,'/',a.INSURANCE_CITY_NAME) as insuranceCityName,
a.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
a.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
CONCAT(a.INSURANCE_HANDLE_PROVINCE_NAME,'/',a.INSURANCE_HANDLE_CITY_NAME) as insuranceHandleCityName,
a.IS_USE as isUse,
a.IS_EFFECT as isEffect,
a.IS_OVERDUE as isOverdue,
......
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