Commit d0da3162 authored by hongguangwu's avatar hongguangwu

MVP1.6.4-优化社保士兵-多sheet

parent d320889d
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author hgw
* @Description 社保士兵功能设置
* @Date 2024-5-15 18:15:50
**/
@Data
public class SocialSoldierSetVo implements Serializable {
@ExcelProperty("是否自动提交")
private String isAutoSubmit;
@ExcelProperty("是否自动补充信息")
private String isAutoInsert;
@ExcelProperty("是否上传附件材料")
private String isAutoUpload;
@ExcelProperty("提示已缴费是否继续申报")
private String isDoShenBao;
}
......@@ -17,6 +17,8 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -27,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialSoldierMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierPushService;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierSetVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
......@@ -97,14 +100,26 @@ public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMap
return R.ok("推送成功!");
}
public MultipartFile getFile(List<SocialSoldierYgsAddVo> list) {
File file = null;
public MultipartFile getFile(List<SocialSoldierYgsAddVo> list, int type) {
if (list != null) {
String filePath = "socialFile" + DateUtil.getThisTime() + CommonConstants.XLSX;
EasyExcelFactory.write(filePath, SocialSoldierYgsAddVo.class).sheet("社保明细").doWrite(list);
file = new File(filePath);
}
if (file != null) {
String fileName = "socialSoldierFile" + DateUtil.getThisTime() + CommonConstants.XLSX;
ExcelWriter excelWriter = EasyExcelFactory.write(fileName).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("社保明细").head(SocialSoldierYgsAddVo.class).build();
excelWriter.write(list, writeSheet);
if (type == 2) {
List<SocialSoldierSetVo> setList = new ArrayList<>();
SocialSoldierSetVo vo = new SocialSoldierSetVo();
vo.setIsAutoSubmit("否");
vo.setIsAutoInsert("否");
vo.setIsAutoUpload("否");
vo.setIsDoShenBao("否");
setList.add(vo);
WriteSheet writeSheet2 = EasyExcelFactory.writerSheet("功能设置").head(SocialSoldierSetVo.class).build();
excelWriter.write(setList, writeSheet2);
}
File file = new File(fileName);
excelWriter.finish();
return getMultipartFile(file);
}
return null;
......@@ -149,7 +164,7 @@ public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMap
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ygsAddlist);
MultipartFile file = this.getFile(ygsAddlist, 1);
if (Common.isNotNull(file)) {
log.error("社保增员");
this.getOneAppGetModuleDetail(socialIdList, file, "社保增员");
......@@ -165,7 +180,7 @@ public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMap
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ygsReducelist);
MultipartFile file = this.getFile(ygsReducelist, 2);
if (Common.isNotNull(file)) {
log.error("社保减员");
this.getOneAppGetModuleDetail(socialIdList, file, "社保减员");
......@@ -181,7 +196,7 @@ public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMap
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ysdAddlist);
MultipartFile file = this.getFile(ysdAddlist, 3);
if (Common.isNotNull(file)) {
log.error("医保增员");
this.getOneAppGetModuleDetail(socialIdList, file, "医保增员");
......@@ -197,7 +212,7 @@ public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMap
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ysdReducelist);
MultipartFile file = this.getFile(ysdReducelist, 4);
if (Common.isNotNull(file)) {
log.error("医保减员");
this.getOneAppGetModuleDetail(socialIdList, file, "医保减员");
......
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