|
@@ -1,6 +1,8 @@
|
|
package com.jpsoft.picc.modules.base.controller;
|
|
package com.jpsoft.picc.modules.base.controller;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
+import com.itextpdf.text.BaseColor;
|
|
|
|
+import com.itextpdf.text.Element;
|
|
import com.jpsoft.picc.modules.base.entity.Company;
|
|
import com.jpsoft.picc.modules.base.entity.Company;
|
|
import com.jpsoft.picc.modules.base.entity.CompanyMember;
|
|
import com.jpsoft.picc.modules.base.entity.CompanyMember;
|
|
import com.jpsoft.picc.modules.base.entity.InsuranceDefinitionLimit;
|
|
import com.jpsoft.picc.modules.base.entity.InsuranceDefinitionLimit;
|
|
@@ -17,16 +19,22 @@ import com.jpsoft.picc.modules.business.service.InsurancePolicyService;
|
|
import com.jpsoft.picc.modules.common.config.OSSConfig;
|
|
import com.jpsoft.picc.modules.common.config.OSSConfig;
|
|
import com.jpsoft.picc.modules.common.config.PdfConfig;
|
|
import com.jpsoft.picc.modules.common.config.PdfConfig;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
-import com.jpsoft.picc.modules.common.utils.ItextPDFUtil;
|
|
|
|
-import com.jpsoft.picc.modules.common.utils.OSSUtil;
|
|
|
|
-import com.jpsoft.picc.modules.common.utils.VelocityHelper;
|
|
|
|
-import com.jpsoft.picc.modules.common.utils.Watermark;
|
|
|
|
|
|
+import com.jpsoft.picc.modules.common.utils.*;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
+import org.apache.poi.util.StringUtil;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.DateTime;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
@@ -281,6 +289,85 @@ public class AttachmentController {
|
|
return entity;
|
|
return entity;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value="被保险人列表")
|
|
|
|
+ @RequestMapping(value = "/pub/attachment/downloadPolicyMemberXls",method = RequestMethod.GET)
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name="policyId",value = "每月投保单ID",required = true,paramType = "query")
|
|
|
|
+ })
|
|
|
|
+ public ResponseEntity downloadPolicyMemberXls(String policyId){
|
|
|
|
+ ResponseEntity entity;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
|
+ headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
|
|
|
+
|
|
|
|
+ //设置编码 为了解决中文名称乱码问题
|
|
|
|
+ String fileName = "被保险人列表.xls";
|
|
|
|
+ String downloadFileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
|
|
|
|
+
|
|
|
|
+ //将编码加到http头信息中
|
|
|
|
+ headers.setContentDispositionFormData("attachment", downloadFileName);
|
|
|
|
+
|
|
|
|
+ Workbook workbook = new HSSFWorkbook();
|
|
|
|
+ Sheet sheet = workbook.createSheet();
|
|
|
|
+
|
|
|
|
+ //表头
|
|
|
|
+ Row rowTitle = sheet.createRow(0);
|
|
|
|
+
|
|
|
|
+ Cell cellTitle1 = rowTitle.createCell(0);
|
|
|
|
+ cellTitle1.setCellValue("序号");
|
|
|
|
+
|
|
|
|
+ Cell cellTitle2 = rowTitle.createCell(1);
|
|
|
|
+ cellTitle2.setCellValue("姓名");
|
|
|
|
+
|
|
|
|
+ Cell cellTitle3 = rowTitle.createCell(2);
|
|
|
|
+ cellTitle3.setCellValue("证件类型");
|
|
|
|
+
|
|
|
|
+ Cell cellTitle4 = rowTitle.createCell(3);
|
|
|
|
+ cellTitle4.setCellValue("证件号码");
|
|
|
|
+
|
|
|
|
+ Cell cellTitle5 = rowTitle.createCell(4);
|
|
|
|
+ cellTitle5.setCellValue("性别");
|
|
|
|
+
|
|
|
|
+ Cell cellTitle6 = rowTitle.createCell(5);
|
|
|
|
+ cellTitle6.setCellValue("年龄");
|
|
|
|
+
|
|
|
|
+ Cell cellTitle7 = rowTitle.createCell(6);
|
|
|
|
+ cellTitle7.setCellValue("岗位/工种");
|
|
|
|
+
|
|
|
|
+ Cell cellTitle8 = rowTitle.createCell(7);
|
|
|
|
+ cellTitle8.setCellValue("健康情况");
|
|
|
|
+
|
|
|
|
+ List<InsurancePolicyMember> memberList = insurancePolicyMemberService.findByPolicyId(policyId);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (int i =0;i<memberList.size();i++){
|
|
|
|
+ InsurancePolicyMember member = memberList.get(i);
|
|
|
|
+
|
|
|
|
+ Row row = sheet.createRow(i+1);
|
|
|
|
+ row.createCell(0).setCellValue(String.valueOf(i+1));
|
|
|
|
+ row.createCell(1).setCellValue(member.getCompanyMember().getName());
|
|
|
|
+ row.createCell(2).setCellValue(member.getCompanyMember().getCardTypeN());
|
|
|
|
+ row.createCell(3).setCellValue(member.getCompanyMember().getCardNo());
|
|
|
|
+ row.createCell(4).setCellValue(member.getCompanyMember().getSex() ? "男" : "女");
|
|
|
|
+ row.createCell(5).setCellValue(member.getCompanyMember().getAge());
|
|
|
|
+ row.createCell(6).setCellValue(member.getCompanyMember().getJobName());
|
|
|
|
+ row.createCell(7).setCellValue(member.getCompanyMember().getHealthStatus());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
|
+ workbook.write(output);
|
|
|
|
+
|
|
|
|
+ entity = new ResponseEntity<>(output.toByteArray(), headers, HttpStatus.OK);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+ entity = new ResponseEntity<String>(ex.getMessage(),HttpStatus.OK);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation(value="身份证附件打包下载")
|
|
@ApiOperation(value="身份证附件打包下载")
|
|
@RequestMapping(value = "/pub/attachment/downloadIdCardZip",method = RequestMethod.GET)
|
|
@RequestMapping(value = "/pub/attachment/downloadIdCardZip",method = RequestMethod.GET)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@@ -390,6 +477,15 @@ public class AttachmentController {
|
|
fileList.add(fileMap);
|
|
fileList.add(fileMap);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //人员名单.xls
|
|
|
|
+ if(StringUtils.isNotEmpty(policyId)){
|
|
|
|
+ Map<String,String> fileMap = new HashMap<>();
|
|
|
|
+ fileMap.put("fileUrl",basePath + "pub/attachment/downloadPolicyMemberXls?policyId=" + policyId);
|
|
|
|
+ fileMap.put("fileName", "投保人列表.xls");
|
|
|
|
+
|
|
|
|
+ fileList.add(fileMap);
|
|
|
|
+ }
|
|
|
|
+
|
|
//身份证
|
|
//身份证
|
|
List<InsurancePolicyMember> policyMemberList = insurancePolicyMemberService.findByPolicyId(policyId);
|
|
List<InsurancePolicyMember> policyMemberList = insurancePolicyMemberService.findByPolicyId(policyId);
|
|
|
|
|