Commit 98355d56 authored by 李灿灿's avatar 李灿灿

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

parent d8ebbb3e
......@@ -113,6 +113,15 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
*/
List<InsuredListVo> getInsuredList(@Param("param") InsuredParam param);
/**
* 已投保列表不分页查询统计(excel导出统计)
*
* @author licancan
* @param param
* @return {@link long}
*/
long getInsuredListCount(@Param("param") InsuredParam param);
/**
* 已减员列表分页查询
*
......
......@@ -3375,35 +3375,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isNotNull(param.getAuthSql()) && param.getAuthSql().contains("1=2 CONCAT")) {
param.setAuthSql(param.getAuthSql().replace("1=2 CONCAT", "CONCAT"));
}
List<InsuredListVo> insuredList;
insuredList = this.baseMapper.getInsuredList(param);
if (CollectionUtils.isNotEmpty(insuredList)){
//根据项目编码获取项目名称
List<String> collect = insuredList.stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuredListVo record : insuredList) {
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(), record.getPolicyEnd().toString()));
if (data != null) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject) {
record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
}
}
}
}
}catch (Exception e){
for (InsuredListVo record : insuredList) {
record.setProjectName(CommonConstants.EMPTY_STRING);
}
}
}
List<InsuredListVo> list = new ArrayList<>();
//处理导出
String fileName = "商险已投保人员名册" + DateUtil.getThisTime() + CommonConstants.XLSX;
long count = insuredList.size();
long count = this.baseMapper.getInsuredListCount(param);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
......@@ -3422,28 +3398,51 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
// 获取实际记录
param.setLimitStart(i);
param.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
if (Common.isNotNull(insuredList)){
list = this.baseMapper.getInsuredList(param);
if (Common.isNotNull(list)){
//处理封面抬头
//根据项目编码获取项目名称
Map<String, ProjectSetInfoVo> data = null;
try {
List<String> collect = list.stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
data = setInfoByCodes.getData().getProjectSetInfoVoMap();
}
}catch (Exception e){
e.printStackTrace();
data = null;
}
util = new ExcelUtil<>(InsuredListVo.class);
for (InsuredListVo vo:insuredList){
for (InsuredListVo vo:list){
//购买月数
vo.setBuyMonth(LocalDateUtil.betweenMonth(vo.getPolicyStart().toString(), vo.getPolicyEnd().toString()));
if (Objects.nonNull(data)) {
ProjectSetInfoVo jsonObject = data.get(vo.getDeptNo());
if (null != jsonObject) {
vo.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
}
}
util.convertEntityAsso(vo,null,null,null,allFields);
}
}
if (Common.isNotNull(insuredList)){
if (Common.isNotNull(list)){
writeSheet = EasyExcel.writerSheet("sheet"+index).build();
excelWriter.write(insuredList,writeSheet);
excelWriter.write(list,writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(insuredList)){
insuredList.clear();
if (Common.isNotNull(list)){
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("sheet"+index).build();
excelWriter.write(insuredList,writeSheet);
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(insuredList)){
insuredList.clear();
if (Common.isNotNull(list)){
list.clear();
}
out.flush();
excelWriter.finish();
......
......@@ -608,6 +608,77 @@
${param.authSql}
</if>
ORDER BY a.CREATE_TIME DESC
<if test="param != null">
<if test="param.limitStart != null">
limit #{param.limitStart},#{param.limitEnd}
</if>
</if>
</select>
<select id="getInsuredListCount" resultType="java.lang.Long">
select
count(1)
from
t_insurance_detail a
where
a.DELETE_FLAG = 0
and
a.BUY_HANDLE_STATUS = 3
<if test="param.createName != null and param.createName.trim() != ''">
and a.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.buyType != null">
and a.BUY_TYPE = #{param.buyType}
</if>
<if test="param.reduceHandleStatus != null">
and a.REDUCE_HANDLE_STATUS = #{param.reduceHandleStatus}
</if>
<if test="param.empName != null and param.empName.trim() != ''">
and a.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
and a.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and a.DEPT_NO = #{param.deptNo}
</if>
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and a.INSURANCE_COMPANY_NAME = #{param.insuranceCompanyName}
</if>
<if test="param.policyNo != null and param.policyNo.trim() != ''">
and a.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
AND a.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00')
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
AND a.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
and (
(a.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyStart}, ' 00:00:00') and a.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(a.POLICY_START <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and a.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(a.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and a.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
)
</if>
<if test="param.createStartTime != null and param.createStartTime.trim() != ''">
AND a.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.createStartTime}, ' 00:00:00')
</if>
<if test="param.createEndTime != null and param.createEndTime.trim() != ''">
AND a.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.createEndTime}, ' 23:59:59')
</if>
<if test="param.invoiceNo != null and param.invoiceNo.trim() != ''">
and a.INVOICE_NO like concat('%',replace(replace(#{param.invoiceNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.isUse != null">
and a.IS_USE = #{param.isUse}
</if>
<if test="param.isOverdue != null ">
and a.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
ORDER BY a.CREATE_TIME DESC
</select>
<!-- 已减员列表分页查询-->
<select id="getInsuranceRefundPageList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundListVo">
......
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