k94314517
2024-03-29 2b88f76c533a2fa94cd029b8a88c2d4da437552c
git ch
已添加1个文件
已修改12个文件
719 ■■■■ 文件已修改
server/company/src/main/java/com/doumee/api/business/UnionApplyController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/company/src/main/java/com/doumee/api/business/UnionChangeController.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java 379 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/join/UnionChangeJoinMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/UnionApply.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/UnionChange.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/UnionApplyService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/shop/src/main/java/com/doumee/api/business/UnionApplyController.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/shop/src/main/java/com/doumee/api/business/UnionChangeController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/company/src/main/java/com/doumee/api/business/UnionApplyController.java
@@ -82,55 +82,6 @@
        ExcelExporter.build(UnionApply.class).export(unionApplyService.findPage(pageWrap).getRecords(), "合并投保单信息表", response);
    }
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @RequiresPermissions("business:unionapply:query")
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(unionApplyService.findById(id));
    }
    @PreventRepeat
    @ApiOperation("创建合并单")
    @PostMapping("/merge")
    @RequiresPermissions("business:unionapply:create")
    public ApiResponse merge(@RequestBody SaveUnionApplyDTO saveUnionApplyDTO) {
        return ApiResponse.success(unionApplyService.merge(saveUnionApplyDTO));
    }
    @ApiOperation("关闭合并单")
    @GetMapping("/close")
    @RequiresPermissions("business:unionapply:close")
    public ApiResponse close(@RequestParam Integer id) {
        unionApplyService.cancelMerge(id);
        return ApiResponse.success(null);
    }
    @PreventRepeat
    @ApiOperation("上传投保单")
    @PostMapping("/uploadToubaodan")
    @RequiresPermissions("business:unionapply:create")
    public ApiResponse uploadToubaodan(@RequestBody UploadMultifileDTO uploadMultifileDTO) {
        unionApplyService.uploadToubaodan(uploadMultifileDTO);
        return ApiResponse.success(null);
    }
    @ApiOperation("签署申请单")
    @GetMapping("/getSignLink")
    @RequiresPermissions("business:unionapply:query")
    public ApiResponse getSignLink(@RequestParam Integer id) {
        unionApplyService.getSignLink(id);
        return ApiResponse.success(null);
    }
    @ApiOperation("上传保险单")
    @PostMapping("/uploadBXD")
    @RequiresPermissions("business:unionchange:query")
    public ApiResponse uploadBXD(@RequestBody UnionApplyBXDDTO unionApplyBXDDTO) {
        unionApplyService.uploadBXD(unionApplyBXDDTO);
        return ApiResponse.success(null);
    }
}
server/company/src/main/java/com/doumee/api/business/UnionChangeController.java
@@ -90,40 +90,4 @@
        return ApiResponse.success(unionChangeService.findById(id));
    }
    @PreventRepeat
    @ApiOperation("创建合并单")
    @PostMapping("/merge")
    @RequiresPermissions("business:unionchange:create")
    public ApiResponse merge(@RequestBody SaveUnionChangeDTO saveUnionChangeDTO) {
        return ApiResponse.success(unionChangeService.merge(saveUnionChangeDTO));
    }
    @ApiOperation("关闭合并单")
    @GetMapping("/close")
    @RequiresPermissions("business:unionchange:close")
    public ApiResponse close(@RequestParam Integer id) {
        unionChangeService.cancelMerge(id);
        return ApiResponse.success(null);
    }
    @ApiOperation("签署申请单")
    @GetMapping("/getSignLink")
    @RequiresPermissions("business:unionchange:query")
    public ApiResponse getSignLink(@RequestParam Integer id) {
        unionChangeService.getSignLink(id);
        return ApiResponse.success(null);
    }
    @ApiOperation("上传保险单")
    @PostMapping("/uploadBXD")
    @RequiresPermissions("business:unionchange:query")
    public ApiResponse uploadBXD(@RequestBody UnionChangeBXDDTO unionChangeBXDDTO) {
        unionChangeService.uploadBXD(unionChangeBXDDTO);
        return ApiResponse.success(null);
    }
}
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
@@ -3,10 +3,8 @@
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.model.ApplyChagneDetail;
import com.doumee.dao.business.model.ApplyChange;
import com.doumee.dao.business.model.ApplyDetail;
import com.doumee.dao.business.model.InsuranceApply;
import com.doumee.dao.business.model.*;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
@@ -26,6 +24,7 @@
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Excel导出实现
@@ -1278,4 +1277,376 @@
        private Field field;
    }
    /**
     * å¯¼å‡º åˆå¹¶å• æ¢åŽ‚ ç”³è¯·è¯¦å•
     * @param data æ•°æ®
     * @param sheetName Sheet名称
     */
    public String exportUnionChangeOtherUnitExcelToPdf (UnionChange data, String sheetName) {
        SXSSFWorkbook sxssfWorkbook;
        try {
            sxssfWorkbook = new SXSSFWorkbook();
            Sheet sheet = sxssfWorkbook.createSheet(sheetName);
            for (int i = 0; i < 8; i++) {
                sheet.setColumnWidth(i, ((i==3|| i== 4|| i== 5 ||i== 6 || i==7)?16:8) * 2 * 256);
            }
            sheet.createFreezePane(0, 1);
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,7));
            Row title = sheet.createRow(0);
            title.setHeight((short) 2000);
            Cell c = title.createCell(0);
            c.setCellValue(sheetName);
            configFirstCell(sxssfWorkbook,c);
            for (int i = 0; i < 8; i++) {
                if(i>0){
                    title.createCell(i).setCellValue("");
                }
                configTitleCell(sxssfWorkbook,title.getCell(i));
            }
            Row header1 = sheet.createRow(1);
            header1.createCell(0).setCellValue("投保人");
            header1.createCell(1).setCellValue("保险方案");
            header1.createCell(2).setCellValue("");
            header1.createCell(3).setCellValue("");
            header1.createCell(4).setCellValue("保单号");
            header1.createCell(5).setCellValue("保险生效起期");
            header1.createCell(6).setCellValue("保险生效止期");
            header1.createCell(7).setCellValue("换厂人数");
            header1.createCell(8).setCellValue("期望批单生效期");
            for (int i = 0; i < 9; i++) {
                configFirstCell(sxssfWorkbook,header1.getCell(i));
            }
            sheet.addMergedRegion(new CellRangeAddress(1  ,1,1,3));
            Row header2 = sheet.createRow(2);
            header2.createCell(0).setCellValue(data.getShopName());
            header2.createCell(1).setCellValue(data.getSolutionsName());
            header2.createCell(2).setCellValue("");
            header2.createCell(3).setCellValue("");
            header2.createCell(4).setCellValue(data.getApplyCode());
            header2.createCell(5).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getStartTime()));
            header2.createCell(6).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getEndTime()));
            header2.createCell(7).setCellValue(data.getApplyChagneDetailList().stream().filter(i->i.getType().equals(Constants.TWO)).collect(Collectors.toList()).size());
            header2.createCell(8).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getApplyStartTime()));
            sheet.addMergedRegion(new CellRangeAddress(2  ,2,1,3));
            for (int i = 0; i < 9; i++) {
                configDataCell(sxssfWorkbook,header2.getCell(i));
            }
            Row header3 = sheet.createRow(3);
            header3.createCell(0).setCellValue("被保险人");
            header3.createCell(1).setCellValue(data.getCompanyNames());
            header3.createCell(2).setCellValue("");
            header3.createCell(3).setCellValue("");
            header3.createCell(4).setCellValue("");
            header3.createCell(5).setCellValue("");
            header3.createCell(6).setCellValue("");
            header3.createCell(7).setCellValue("");
            header3.createCell(8).setCellValue("");
            for (int i = 0; i < 9; i++) {
                configFirstCell(sxssfWorkbook,header3.getCell(i));
            }
            sheet.addMergedRegion(new CellRangeAddress(3  ,3,1,8));
            Row header4 = sheet.createRow(4);
            header4.createCell(0).setCellValue("序号");
            header4.createCell(1).setCellValue("员工姓名");
            header4.createCell(2).setCellValue("性别");
            header4.createCell(3).setCellValue("身份证号");
            header4.createCell(4).setCellValue("被保险人");
            header4.createCell(5).setCellValue("原派遣单位");
            header4.createCell(6).setCellValue("原所所属工种");
            header4.createCell(7).setCellValue("更改后派遣单位");
            header4.createCell(8).setCellValue("更改后所属工种");
            for (int i = 0; i < 9; i++) {
                configFirstCell(sxssfWorkbook,header4.getCell(i));
            }
            List<ApplyChagneDetail> otherChangeDetailList = data.getApplyChagneDetailList().stream().filter(i->i.getType().equals(Constants.TWO)).collect(Collectors.toList());
            Integer row = 4;
            if(CollectionUtils.isNotEmpty(otherChangeDetailList)){
                row = row + 1;
                Row header5 = sheet.createRow(row);
                header5.createCell(0).setCellValue("序号");
                header5.createCell(1).setCellValue("员工姓名");
                header5.createCell(2).setCellValue("性别");
                header5.createCell(3).setCellValue("身份证号");
                header5.createCell(4).setCellValue("被保险人");
                header5.createCell(5).setCellValue("原派遣单位");
                header5.createCell(6).setCellValue("原所属工种");
                header5.createCell(7).setCellValue("更改后派遣单位");
                header5.createCell(8).setCellValue("更改后所属工种");
                for (int i = 0; i < 9; i++) {
                    configFirstCell(sxssfWorkbook,header5.getCell(i));
                }
                for (int rowIndex = 0; rowIndex < otherChangeDetailList.size(); rowIndex++) {
                    row = row + 1;
                    Row header6 = sheet.createRow(row);
                    ApplyChagneDetail applyChagneDetail = otherChangeDetailList.get(rowIndex);
                    header6.createCell(0).setCellValue(rowIndex + 1);
                    header6.createCell(1).setCellValue(applyChagneDetail.getMemberName());
                    header6.createCell(2).setCellValue(Constants.equalsInteger(applyChagneDetail.getSex(),0)?"男":(Constants.equalsInteger(applyChagneDetail.getSex(),1)?"女":"-"));
                    header6.createCell(3).setCellValue(applyChagneDetail.getIdcardNo());
                    header6.createCell(4).setCellValue(applyChagneDetail.getCompanyName());
                    header6.createCell(5).setCellValue(applyChagneDetail.getOldDuName());
                    header6.createCell(6).setCellValue(applyChagneDetail.getOldWorkTypeName());
                    header6.createCell(7).setCellValue(applyChagneDetail.getDuName());
                    header6.createCell(8).setCellValue(applyChagneDetail.getWorkTypeName());
                    for (int i = 0; i < 9; i++) {
                        configFirstCell(sxssfWorkbook,header6.getCell(i));
                    }
                }
            }
            int rowIndex =  row + 1 ;
            Row header6= sheet.createRow(rowIndex);
            header6.createCell(0).setCellValue("投保企业申明:\n" +
                    "1、在申请书上填写的一切内容属实,否则本企业承担一切法律责任。\n" +
                    "2、由于变更受益人产生的法律纠纷本企业愿承担一切法律责任。\n" +
                    "3、本申请表的签章为本企业亲自签署,如由此产生的法律纠纷本企业愿承担一切法律责任。\n");
            for (int i = 1; i < 9; i++) {
                header6.createCell(i).setCellValue("");
            }
            for (int i =0; i < 9; i++) {
                if(i>0){
                    header6.createCell(i).setCellValue("");
                }
                configInfoCell(sxssfWorkbook,header6.getCell(i),HorizontalAlignment.LEFT);
            }
            header6.setHeight((short) 2000);
            sheet.addMergedRegion(new CellRangeAddress(rowIndex ,rowIndex,0,8));
            Row header7= sheet.createRow(rowIndex+1);
            header7.setHeight((short) 3000);
            header7.createCell(0).setCellValue("投保人签章 ï¼š                            \n \n \n" +"日期:     å¹´     æœˆ     æ—¥    ");
            for (int i =0; i < 9; i++) {
                if(i>0){
                    header7.createCell(i).setCellValue("");
                }
                configInfoCell(sxssfWorkbook,header7.getCell(i),HorizontalAlignment.RIGHT);
            }
            sheet.addMergedRegion(new CellRangeAddress(rowIndex+1 ,rowIndex+1,0,8));
            //临时缓冲区
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            //创建临时文件
            sxssfWorkbook.write(out);
            byte [] bookByteAry = out.toByteArray();
            InputStream     in = new ByteArrayInputStream(bookByteAry);
            String tempExcel = saveIsToFile(in);
            String tempPdf =System.getProperty("java.io.tmpdir")+File.separator+UUID.randomUUID().toString()+".pdf";
//            ExcelToPdfTool.excelToPdf(in,tempPdf);//转PDF
            ExcelToPdfTool.excelToPdf(tempExcel,tempPdf);//转PDF
            File f = new File(tempPdf);
            if(f!=null && f.isFile() && f.length()>0){
                return tempPdf;
            }
        } catch (Exception e) {
            // throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
        return null;
    }
    /**
     * å¯¼å‡º åˆå¹¶å•加减保申请详单
     * @param data æ•°æ®
     * @param sheetName Sheet名称
     */
    public String exportUnionChangeExcelToPdf (UnionChange data, String sheetName) {
        SXSSFWorkbook sxssfWorkbook;
        try {
            sxssfWorkbook = new SXSSFWorkbook();
            Sheet sheet = sxssfWorkbook.createSheet(sheetName);
            for (int i = 0; i < 12; i++) {
                sheet.setColumnWidth(i, ((i==3|| i==4|| i== 5 || i==9||i==10||  i==11)?16:8) * 2 * 256);
            }
            sheet.createFreezePane(0, 1);
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,11));
            Row title = sheet.createRow(0);
            title.setHeight((short) 2000);
            for (int i = 0; i < 12; i++) {
                title.createCell(i).setCellValue(i==0?sheetName:"");
                configTitleCell(sxssfWorkbook,title.getCell(i));
            }
            Row header1 = sheet.createRow(1);
            header1.createCell(0).setCellValue("投保人");
            header1.createCell(1).setCellValue("保险方案");
            header1.createCell(2).setCellValue("保单号");
            header1.createCell(3).setCellValue("保险生效起期");
            header1.createCell(4).setCellValue("保险生效止期");
            header1.createCell(5).setCellValue("加保人数");
            header1.createCell(6).setCellValue("减保人数");
            header1.createCell(7).setCellValue("期望批单生效期");
            for (int i = 0; i < 8; i++) {
                configFirstCell(sxssfWorkbook,header1.getCell(i));
            }
            Row header2 = sheet.createRow(2);
            header2.createCell(0).setCellValue(data.getShopName());
            header2.createCell(1).setCellValue(data.getSolutionsName());
            header2.createCell(2).setCellValue(data.getApplyCode());
            header2.createCell(3).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getStartTime()));
            header2.createCell(4).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getEndTime()));
            header2.createCell(5).setCellValue(data.getApplyChagneDetailList().stream().filter(i->i.getType().equals(Constants.ZERO)).collect(Collectors.toList()).size());
            header2.createCell(6).setCellValue(data.getApplyChagneDetailList().stream().filter(i->i.getType().equals(Constants.ONE)).collect(Collectors.toList()).size());
            header2.createCell(7).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getValidTime()));
            for (int i = 0; i < 8; i++) {
                configDataCell(sxssfWorkbook,   header2.getCell(i));
            }
            Row header3 = sheet.createRow(3);
            header3.createCell(0).setCellValue("被保险人");
            header3.createCell(1).setCellValue(data.getCompanyNames());
            header3.createCell(2).setCellValue("");
            header3.createCell(3).setCellValue("");
            header3.createCell(4).setCellValue("");
            header3.createCell(5).setCellValue("");
            header3.createCell(6).setCellValue("");
            header3.createCell(7).setCellValue("");
            for (int i = 0; i < 8; i++) {
                configFirstCell(sxssfWorkbook,header3.getCell(i));
            }
            sheet.addMergedRegion(new CellRangeAddress(3  ,3,1,7));
            Integer row = 4;
            List<ApplyChagneDetail> addChangeDetailList = data.getApplyChagneDetailList().stream().filter(i->i.getType().equals(Constants.ZERO)).collect(Collectors.toList());
            if(CollectionUtils.isNotEmpty(addChangeDetailList)){
                Row header4 = sheet.createRow(row);
                header4.createCell(0).setCellValue("加保人员");
                for (int i = 0; i < 8; i++) {
                    configFirstCell(sxssfWorkbook,   header4.getCell(i));
                }
                sheet.addMergedRegion(new CellRangeAddress(row  ,row,0,7));
                row = row + 1;
                Row header5 = sheet.createRow(row);
                header5.createCell(0).setCellValue("序号");
                header5.createCell(1).setCellValue("员工姓名");
                header5.createCell(2).setCellValue("性别");
                header5.createCell(3).setCellValue("身份证号");
                header5.createCell(4).setCellValue("被保险人");
                header5.createCell(5).setCellValue("派遣单位");
                header5.createCell(6).setCellValue("");
                header5.createCell(7).setCellValue("所属工种");
                for (int i = 0; i < 8; i++) {
                    configFirstCell(sxssfWorkbook,header5.getCell(i));
                }
                sheet.addMergedRegion(new CellRangeAddress(row  ,row,5,6));
                for (int rowIndex = 0; rowIndex < addChangeDetailList.size(); rowIndex++) {
                    row = row + 1 ;
                    Row header6 = sheet.createRow(row);
                    ApplyChagneDetail applyChagneDetail = addChangeDetailList.get(rowIndex);
                    header6.createCell(0).setCellValue(rowIndex + 1);
                    header6.createCell(1).setCellValue(applyChagneDetail.getMemberName());
                    header6.createCell(2).setCellValue(Constants.equalsInteger(applyChagneDetail.getSex(),0)?"男":(Constants.equalsInteger(applyChagneDetail.getSex(),1)?"女":"-"));
                    header6.createCell(3).setCellValue(applyChagneDetail.getIdcardNo());
                    header6.createCell(4).setCellValue(applyChagneDetail.getCompanyName());
                    header6.createCell(5).setCellValue(applyChagneDetail.getDuName());
                    header6.createCell(6).setCellValue("");
                    header6.createCell(7).setCellValue(applyChagneDetail.getWorkTypeName());
                    for (int i = 0; i < 8; i++) {
                        configFirstCell(sxssfWorkbook,header6.getCell(i));
                    }
                    sheet.addMergedRegion(new CellRangeAddress(row  ,row,5,6));
                }
            }
            List<ApplyChagneDetail> reduceChangeDetailList = data.getApplyChagneDetailList().stream().filter(i->i.getType().equals(Constants.ONE)).collect(Collectors.toList());
            row = row + 1;
            if(CollectionUtils.isNotEmpty(reduceChangeDetailList)){
                Row header4 = sheet.createRow(row);
                header4.createCell(0).setCellValue("减保人员");
                for (int i = 0; i < 8; i++) {
                    configFirstCell(sxssfWorkbook,   header4.getCell(i));
                }
                sheet.addMergedRegion(new CellRangeAddress(row  ,row,0,7));
                row = row + 1;
                Row header5 = sheet.createRow(row);
                header5.createCell(0).setCellValue("序号");
                header5.createCell(1).setCellValue("员工姓名");
                header5.createCell(2).setCellValue("性别");
                header5.createCell(3).setCellValue("身份证号");
                header5.createCell(4).setCellValue("被保险人");
                header5.createCell(5).setCellValue("派遣单位");
                header5.createCell(6).setCellValue("");
                header5.createCell(7).setCellValue("所属工种");
                for (int i = 0; i < 8; i++) {
                    configFirstCell(sxssfWorkbook,header5.getCell(i));
                }
                sheet.addMergedRegion(new CellRangeAddress(row  ,row,5,6));
                row = row + 1 ;
                for (int rowIndex = 0; rowIndex < reduceChangeDetailList.size(); rowIndex++) {
                    row = row + rowIndex;
                    Row header6 = sheet.createRow(row);
                    ApplyChagneDetail applyChagneDetail = reduceChangeDetailList.get(rowIndex);
                    header6.createCell(0).setCellValue(rowIndex + 1);
                    header6.createCell(1).setCellValue(applyChagneDetail.getMemberName());
                    header6.createCell(2).setCellValue(Constants.equalsInteger(applyChagneDetail.getSex(),0)?"男":(Constants.equalsInteger(applyChagneDetail.getSex(),1)?"女":"-"));
                    header6.createCell(3).setCellValue(applyChagneDetail.getIdcardNo());
                    header6.createCell(4).setCellValue(applyChagneDetail.getCompanyName());
                    header6.createCell(5).setCellValue(applyChagneDetail.getDuName());
                    header6.createCell(6).setCellValue("");
                    header6.createCell(7).setCellValue(applyChagneDetail.getWorkTypeName());
                    for (int i = 0; i < 8; i++) {
                        configFirstCell(sxssfWorkbook,header6.getCell(i));
                    }
                    sheet.addMergedRegion(new CellRangeAddress(row  ,row,5,6));
                }
            }
            int rowIndex = row + 1;
            Row header6= sheet.createRow(rowIndex);
            header6.createCell(0).setCellValue("投保企业申明:\n" +
                    "1、在申请书上填写的一切内容属实,否则本企业承担一切法律责任。\n" +
                    "2、由于变更受益人产生的法律纠纷本企业愿承担一切法律责任。\n" +
                    "3、本申请表的签章为本企业亲自签署,如由此产生的法律纠纷本企业愿承担一切法律责任。\n");
            for (int i = 1; i < 8; i++) {
                header6.createCell(i).setCellValue("");
            }
            for (int i =0; i < 8; i++) {
                if(i>0){
                    header6.createCell(i).setCellValue("");
                }
                configInfoCell(sxssfWorkbook,header6.getCell(i),HorizontalAlignment.LEFT);
            }
            header6.setHeight((short) 2000);
            sheet.addMergedRegion(new CellRangeAddress(rowIndex ,rowIndex,0,11));
            Row header7= sheet.createRow(rowIndex+1);
            header7.setHeight((short) 3000);
            header7.createCell(0).setCellValue("投保人签章 ï¼š                            \n \n \n" +"日期:     å¹´     æœˆ     æ—¥    ");
            for (int i =0; i < 8; i++) {
                if(i>0){
                    header7.createCell(i).setCellValue("");
                }
                configInfoCell(sxssfWorkbook,header7.getCell(i),HorizontalAlignment.RIGHT);
            }
            sheet.addMergedRegion(new CellRangeAddress(rowIndex+1 ,rowIndex+1,0,11));
            //临时缓冲区
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            //创建临时文件
            sxssfWorkbook.write(out);
            byte [] bookByteAry = out.toByteArray();
            InputStream     in = new ByteArrayInputStream(bookByteAry);
            String tempExcel = saveIsToFile(in);
            String tempPdf =System.getProperty("java.io.tmpdir")+File.separator+UUID.randomUUID().toString()+".pdf";
//            ExcelToPdfTool.excelToPdf(in,tempPdf);//转PDF
            ExcelToPdfTool.excelToPdf(tempExcel,tempPdf);//转PDF
            File f = new File(tempPdf);
            if(f!=null && f.isFile() && f.length()>0){
                return tempPdf;
            }
        } catch (Exception e) {
            e.printStackTrace();
            // throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
        return null;
    }
}
server/service/src/main/java/com/doumee/dao/business/join/UnionChangeJoinMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
package com.doumee.dao.business.join;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.UnionChange;
import com.github.yulichang.base.mapper.MPJJoinMapper;
/**
 * @author æ±Ÿè¹„蹄
 * @date 2024/03/12 11:34
 */
public interface UnionChangeJoinMapper extends MPJJoinMapper<UnionChange> {
}
server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java
@@ -147,6 +147,10 @@
    @TableField(exist = false)
    private Integer solutionId;
    @ApiModelProperty(value = "员工企业名称")
    @TableField(exist = false)
    private String companyName;
    @ApiModelProperty(value = "年龄")
    @TableField(exist = false)
    private long age;
server/service/src/main/java/com/doumee/dao/business/model/UnionApply.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -62,17 +63,14 @@
    @ApiModelProperty(value = "实际保险生效止期")
    @ExcelColumn(name="实际保险生效止期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endTime;
    @ApiModelProperty(value = "实际保险生效起期")
    @ExcelColumn(name="实际保险生效起期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date startTime;
    @ApiModelProperty(value = "最近操作时间")
    @ExcelColumn(name="最近操作时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date checkDate;
    @ApiModelProperty(value = "最近操作备注")
@@ -107,4 +105,8 @@
    @ExcelColumn(name="方案编码(关联solutions)")
    private Integer solutionId;
    @ApiModelProperty(value = "方案名称", example = "1")
    @TableField(exist = false)
    private String solutionName;
}
server/service/src/main/java/com/doumee/dao/business/model/UnionChange.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -9,6 +10,7 @@
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
/**
 * åŠ å‡ä¿æ¢åŽ‚åˆå¹¶å•ä¿¡æ¯è¡¨
@@ -93,4 +95,35 @@
    @ExcelColumn(name="合并保单主键")
    private Integer unionApplyId;
    @ApiModelProperty(value = "商户名称")
    @TableField(exist = false)
    private String shopName;
    @ApiModelProperty(value = "方案名称")
    @TableField(exist = false)
    private String solutionsName;
    @ApiModelProperty(value = "合并单编号")
    @TableField(exist = false)
    private String applyCode;
    @ApiModelProperty(value = "实际保险生效止期")
    @TableField(exist = false)
    private Date endTime;
    @ApiModelProperty(value = "实际保险生效起期")
    @TableField(exist = false)
    private Date startTime;
    @ApiModelProperty(value = "企业名称 ,分割")
    @TableField(exist = false)
    private String companyNames;
    @ApiModelProperty(value = "明细行记录")
    @TableField(exist = false)
    private List<ApplyChagneDetail> applyChagneDetailList;
}
server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
@@ -129,4 +129,5 @@
     */
    void uploadBXD(UnionApplyBXDDTO unionApplyBXDDTO);
    UnionApply detail(Integer applyId);
}
server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
@@ -157,7 +157,8 @@
            newVersion = dispatchUnitMapper.selectOne(new QueryWrapper<DispatchUnit>().lambda()
                    .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
                    .eq(DispatchUnit::getDataType,Constants.TWO)
                    .eq(DispatchUnit::getBaseId,model.getId()).last(" limit 1"));
                    .eq(DispatchUnit::getBaseId,model.getId())
                    .last(" limit 1"));
        }
        if(Objects.isNull(newVersion)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到派遣单位最新版本");
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
@@ -141,6 +141,12 @@
        IPage<UnionApply> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<UnionApply> queryWrapper = new QueryWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user.getType().equals(Constants.TWO)){
            queryWrapper.lambda().eq(UnionApply::getCompanyId, pageWrap.getModel().getCompanyId());
        }
        if (pageWrap.getModel().getId() != null) {
            queryWrapper.lambda().eq(UnionApply::getId, pageWrap.getModel().getId());
        }
@@ -220,10 +226,28 @@
    }
    @Override
    public UnionApply detail(Integer applyId){
        UnionApply unionApply = unionApplyJoinMapper.selectJoinOne(UnionApply.class,
                new MPJLambdaWrapper<UnionApply>()
                        .selectAll(UnionApply.class)
                        .selectAs(Solutions::getName,UnionApply::getSolutionName)
                        .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad  where ad.UNION_APPLY_ID = t.id ) as insureNum")
                        .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId)
                        .eq(UnionApply::getId,applyId)
                        .last(" limit 1 ")
        );
        return unionApply;
    }
    @Override
    public Integer merge(SaveUnionApplyDTO saveUnionApplyDTO){
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user.getType().equals(Constants.TWO)){
        if(!user.getType().equals(Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作");
        }
        if(Objects.isNull(saveUnionApplyDTO)
@@ -290,7 +314,7 @@
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void cancelMerge(Integer id){
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user.getType().equals(Constants.TWO)){
        if(!user.getType().equals(Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作!");
        }
        UnionApply unionApply = unionApplyMapper.selectById(id);
@@ -340,6 +364,9 @@
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!user.getType().equals(Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作!");
        }
        UnionApply unionApply = unionApplyMapper.selectById(uploadMultifileDTO.getBusinessId());
        if(Objects.isNull(unionApply)||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
@@ -388,6 +415,9 @@
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!user.getType().equals(Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作!");
        }
        UnionApply unionApply = unionApplyJoinMapper.selectById(id);
        if(unionApply == null ||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
@@ -451,6 +481,9 @@
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!user.getType().equals(Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作!");
        }
        UnionApply unionApply = unionApplyJoinMapper.selectById(unionApplyBXDDTO.getId());
        if(unionApply == null ||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -14,10 +14,7 @@
import com.doumee.dao.business.dto.SaveUnionApplyDTO;
import com.doumee.dao.business.dto.SaveUnionChangeDTO;
import com.doumee.dao.business.dto.UnionChangeBXDDTO;
import com.doumee.dao.business.join.ApplyChagneDetailJoinMapper;
import com.doumee.dao.business.join.ApplyChangeJoinMapper;
import com.doumee.dao.business.join.ApplyDetailJoinMapper;
import com.doumee.dao.business.join.MemberInsuranceJoinMapper;
import com.doumee.dao.business.join.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.CountCyclePriceVO;
import com.doumee.service.business.UnionChangeService;
@@ -35,6 +32,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -50,6 +48,9 @@
    @Autowired
    private UnionChangeMapper unionChangeMapper;
    @Autowired
    private UnionChangeJoinMapper unionChangeJoinMapper;
    @Autowired
    private ApplyChangeJoinMapper applyChangeJoinMapper;
@@ -315,6 +316,57 @@
    }
    public UnionChange unionChangeDetail(Integer unionChangeId){
        UnionChange unionChange = unionChangeJoinMapper.selectJoinOne(UnionChange.class,
                new MPJLambdaWrapper<UnionChange>()
                        .selectAll(UnionChange.class)
                        .selectAs(Company::getName,UnionChange::getShopName)
                        .selectAs(Solutions::getName,UnionChange::getSolutionsName)
                        .selectAs(UnionApply::getCode,UnionChange::getApplyCode)
                        .selectAs(UnionApply::getStartTime,UnionChange::getStartTime)
                        .selectAs(UnionApply::getEndTime,UnionChange::getEndTime)
                        .leftJoin(UnionApply.class,UnionApply::getId,UnionChange::getUnionApplyId)
                        .leftJoin(Company.class,Company::getId,UnionChange::getShopId)
                        .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId)
                        .eq(UnionChange::getId,unionChangeId)
                        .last(" limit 1 ")
        );
        //企业名称
        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,new MPJLambdaWrapper<ApplyChange>()
                .selectAs(Company::getName,ApplyChange::getCompanyName)
                .leftJoin(Company.class,Company::getId,ApplyChange::getCompanyId)
                .eq(ApplyChange::getUnionChangeId,unionChangeId)
        );
        String companyNames = String.join(",",applyChangeList.stream().map(m->m.getCompanyName()).collect(Collectors.toList()));
        List<ApplyChagneDetail> applyChagneDetailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,new MPJLambdaWrapper<ApplyChagneDetail>()
                .selectAll(ApplyChagneDetail.class)
                .selectAs(Member::getName,ApplyChagneDetail::getMemberName)
                .selectAs(Member::getIdcardNo,ApplyChagneDetail::getIdcardNo)
                .selectAs(Member::getSex,ApplyChagneDetail::getSex)
                .selectAs(Company::getName,ApplyChagneDetail::getCompanyName)
                .select("t2.name",ApplyChagneDetail::getWorkTypeName)
                .select("t3.name",ApplyChagneDetail::getDuName)
                .select("t4.name",ApplyChagneDetail::getOldWorkTypeName)
                .select("t5.name",ApplyChagneDetail::getOldDuName)
                .leftJoin(Member.class,Member::getId,ApplyChagneDetail::getMemberId)
                .leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getWorktypeId)
                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getDuId)
                 .leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getOldWorktypeId)
                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getOldDuId)
                .leftJoin(Company.class,Company::getId,Member::getCompanyId)
                .eq(ApplyChagneDetail::getUnionChangeId,unionChangeId)
        );
        unionChange.setCompanyNames(companyNames);
        unionChange.setApplyChagneDetailList(applyChagneDetailList);
        return unionChange;
    }
    /**
     * åˆå¹¶å•(加减保/换厂) - æŠ•保申请签署
     * @param id
@@ -327,7 +379,7 @@
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        UnionChange unionChange = unionChangeMapper.selectById(id);
        UnionChange unionChange = this.unionChangeDetail(id);
        if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
@@ -350,11 +402,10 @@
        String fileUrl = null;
        if(Constants.equalsObject(unionChange.getType(), Constants.ONE)){
//            fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"换厂申请表","被保险人");
            fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeOtherUnitExcelToPdf(unionChange,"换厂申请表");
        }else{
//            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"加减保申请表","被保险人");
            fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeExcelToPdf(unionChange,"加减保申请表");
        }
        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",unionChange.getId().toString());
        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"合并单(加减保/换厂)申请签署",company.getSignId(),notifyUrl);
server/shop/src/main/java/com/doumee/api/business/UnionApplyController.java
@@ -6,6 +6,9 @@
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.SaveUnionApplyDTO;
import com.doumee.dao.business.dto.UnionApplyBXDDTO;
import com.doumee.dao.business.dto.UploadMultifileDTO;
import com.doumee.dao.business.model.UnionApply;
import com.doumee.service.business.UnionApplyService;
import io.swagger.annotations.Api;
@@ -81,10 +84,54 @@
        ExcelExporter.build(UnionApply.class).export(unionApplyService.findPage(pageWrap).getRecords(), "合并投保单信息表", response);
    }
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @RequiresPermissions("business:unionapply:query")
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(unionApplyService.findById(id));
    public ApiResponse<UnionApply> findById(@PathVariable Integer id) {
        return ApiResponse.success(unionApplyService.detail(id));
    }
    @PreventRepeat
    @ApiOperation("创建合并单")
    @PostMapping("/merge")
    @RequiresPermissions("business:unionapply:create")
    public ApiResponse merge(@RequestBody SaveUnionApplyDTO saveUnionApplyDTO) {
        return ApiResponse.success(unionApplyService.merge(saveUnionApplyDTO));
    }
    @ApiOperation("关闭合并单")
    @GetMapping("/close")
    @RequiresPermissions("business:unionapply:close")
    public ApiResponse close(@RequestParam Integer id) {
        unionApplyService.cancelMerge(id);
        return ApiResponse.success(null);
    }
    @PreventRepeat
    @ApiOperation("上传投保单")
    @PostMapping("/uploadToubaodan")
    @RequiresPermissions("business:unionapply:create")
    public ApiResponse uploadToubaodan(@RequestBody UploadMultifileDTO uploadMultifileDTO) {
        unionApplyService.uploadToubaodan(uploadMultifileDTO);
        return ApiResponse.success(null);
    }
    @ApiOperation("签署申请单")
    @GetMapping("/getSignLink")
    @RequiresPermissions("business:unionapply:query")
    public ApiResponse getSignLink(@RequestParam Integer id) {
        unionApplyService.getSignLink(id);
        return ApiResponse.success(null);
    }
    @ApiOperation("上传保险单")
    @PostMapping("/uploadBXD")
    @RequiresPermissions("business:unionchange:query")
    public ApiResponse uploadBXD(@RequestBody UnionApplyBXDDTO unionApplyBXDDTO) {
        unionApplyService.uploadBXD(unionApplyBXDDTO);
        return ApiResponse.success(null);
    }
}
server/shop/src/main/java/com/doumee/api/business/UnionChangeController.java
@@ -6,6 +6,8 @@
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.SaveUnionChangeDTO;
import com.doumee.dao.business.dto.UnionChangeBXDDTO;
import com.doumee.dao.business.model.UnionChange;
import com.doumee.service.business.UnionChangeService;
import io.swagger.annotations.Api;
@@ -87,4 +89,40 @@
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(unionChangeService.findById(id));
    }
    @PreventRepeat
    @ApiOperation("创建合并单")
    @PostMapping("/merge")
    @RequiresPermissions("business:unionchange:create")
    public ApiResponse merge(@RequestBody SaveUnionChangeDTO saveUnionChangeDTO) {
        return ApiResponse.success(unionChangeService.merge(saveUnionChangeDTO));
    }
    @ApiOperation("关闭合并单")
    @GetMapping("/close")
    @RequiresPermissions("business:unionchange:close")
    public ApiResponse close(@RequestParam Integer id) {
        unionChangeService.cancelMerge(id);
        return ApiResponse.success(null);
    }
    @ApiOperation("签署申请单")
    @GetMapping("/getSignLink")
    @RequiresPermissions("business:unionchange:query")
    public ApiResponse getSignLink(@RequestParam Integer id) {
        unionChangeService.getSignLink(id);
        return ApiResponse.success(null);
    }
    @ApiOperation("上传保险单")
    @PostMapping("/uploadBXD")
    @RequiresPermissions("business:unionchange:query")
    public ApiResponse uploadBXD(@RequestBody UnionChangeBXDDTO unionChangeBXDDTO) {
        unionChangeService.uploadBXD(unionChangeBXDDTO);
        return ApiResponse.success(null);
    }
}