Commit 333eb914 authored by huyuchen's avatar huyuchen

hyc-导出已投保名册中增加被替换信息

parent a3d25282
......@@ -368,4 +368,36 @@ public class InsuredListVo implements Serializable {
@Schema(description = "被替换人项目名称")
@ExcelIgnore
private String coverProjectNo;
/**
* 替换人姓名
*/
@Schema(description = "替换人姓名")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "替换人姓名")
private String replaceEmpName;
/**
* 替换人身份证号
*/
@Schema(description = "替换人身份证号)")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "替换人身份证号")
private String replaceEmpIdcardNo;
/**
* 替换人项目名称
*/
@Schema(description = "替换人项目名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "替换人项目名称")
private String replaceProjectName;
/**
* 替换人封面抬头
*/
@Schema(description = "替换人封面抬头")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "替换人封面抬头")
private String replaceInvoiceTitle;
}
......@@ -4433,37 +4433,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
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;
//处理封面抬头
//获取所有项目信息
Map<String, ProjectSetInfoVo> data = null;
try {
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(new ArrayList<>());
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
data = setInfoByCodes.getData().getProjectSetInfoVoMap();
}
} catch (Exception e) {
e.printStackTrace();
}
for (int i = 0; i <= count; ) {
// 获取实际记录
param.setLimitStart(i);
param.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
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);
TInsuranceReplace one;
TInsuranceReplace fromOne;
TInsuranceDetail byId;
ProjectSetInfoVo coverObject = null;
ProjectSetInfoVo coverObject;
for (InsuredListVo vo:list){
//被替换人
one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
......@@ -4472,40 +4469,42 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Optional.ofNullable(one).isPresent()) {
byId = this.getById(one.getFromInsuranceDetailId());
if (Optional.ofNullable(byId).isPresent()) {
//根据项目编码获取项目名称
Map<String, ProjectSetInfoVo> dataReplace = null;
try {
List<String> collect = new ArrayList<>();
collect.add(byId.getDeptNo());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
dataReplace = setInfoByCodes.getData().getProjectSetInfoVoMap();
}
}catch (Exception e){
e.printStackTrace();
dataReplace = null;
}
vo.setCoverEmpName(byId.getEmpName());
vo.setCoverEmpIdcardNo(byId.getEmpIdcardNo());
vo.setCoverProjectName(byId.getDeptName());
coverObject = null;
if (Common.isNotNull(dataReplace)){
coverObject = dataReplace.get(byId.getDeptNo());
}
if (null != coverObject) {
if (Common.isNotNull(data) && Common.isNotNull(data.get(byId.getDeptNo()))){
coverObject = data.get(byId.getDeptNo());
vo.setCoverInvoiceTitle(Optional.ofNullable(coverObject.getInvoiceTitleInsurance()).orElse(""));
}else {
vo.setCoverInvoiceTitle("未获取到对应项目信息");
}
}
}
//替换人
fromOne = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getFromInsuranceDetailId, vo.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Optional.ofNullable(fromOne).isPresent()) {
byId = this.getById(fromOne.getToInsuranceDetailId());
if (Optional.ofNullable(byId).isPresent()) {
vo.setReplaceEmpName(byId.getEmpName());
vo.setReplaceEmpIdcardNo(byId.getEmpIdcardNo());
vo.setReplaceProjectName(byId.getDeptName());
if (Common.isNotNull(data) && Common.isNotNull(data.get(byId.getDeptNo()))){
coverObject = data.get(byId.getDeptNo());
vo.setReplaceInvoiceTitle(Optional.ofNullable(coverObject.getInvoiceTitleInsurance()).orElse(""));
}else {
vo.setReplaceInvoiceTitle("未获取到对应项目信息");
}
}
}
//购买月数
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(""));
}
if (Common.isNotNull(data) && Common.isNotNull(data.get(vo.getDeptNo()))) {
coverObject = data.get(vo.getDeptNo());
vo.setInvoiceTitle(Optional.ofNullable(coverObject.getInvoiceTitleInsurance()).orElse(""));
}
util.convertEntityAsso(vo,null,null,null,allFields);
}
......
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