k94314517
2024-04-03 4001e7479d33cd3fa5a8e00d07ae191ee95c5793
git ch
已修改4个文件
363 ■■■■■ 文件已修改
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java 332 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/UnionChangeService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/shop/src/main/java/com/doumee/api/business/UnionChangeController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
@@ -263,7 +263,7 @@
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置背景
        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
//        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
//        style.setFillForegroundColor(columnConfig.dataBackgroundColor().getIndex());
        // 字体
        Font font = workbook.createFont();
@@ -1280,6 +1280,8 @@
            throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
    }
    public void exportUnionApplyDetailDo (UnionApply data, String sheetName, OutputStream os) {
        SXSSFWorkbook sxssfWorkbook;
        try {
@@ -1387,17 +1389,17 @@
        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);
            for (int i = 0; i < 9; i++) {
                sheet.setColumnWidth(i, ((i==3|| i== 4|| i== 5 ||i== 6 || i==7|| i==8 || i==9)?16:8) * 2 * 256);
            }
            sheet.createFreezePane(0, 1);
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,7));
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,8));
            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++) {
            for (int i = 0; i < 9; i++) {
                if(i>0){
                    title.createCell(i).setCellValue("");
                }
@@ -1433,7 +1435,6 @@
                configDataCell(sxssfWorkbook,header2.getCell(i));
            }
            Row header3 = sheet.createRow(3);
            header3.createCell(0).setCellValue("被保险人");
            header3.createCell(1).setCellValue(data.getCompanyNames());
@@ -1450,23 +1451,10 @@
            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;
            Integer row = 3;
            if(CollectionUtils.isNotEmpty(otherChangeDetailList)){
                row = row + 1;
@@ -1747,4 +1735,308 @@
        }
        return null;
    }
    public void exportUnionChangeDetail(UnionChange model, HttpServletResponse response) {
        try {
            String fileName = "加减保详情单";
            if(model.getType().equals(Constants.ONE)){
                fileName = "更换派遣单位详情单";
            }
            String encodeFileName = URLEncoder.encode(fileName +"_"+model.getShopName(), Charset.forName("UTF-8").toString()) + ".xlsx";
            response.setHeader("Content-Disposition","attachment;filename=" + encodeFileName);
            response.setContentType("application/octet-stream");
            response.setHeader("eva-opera-type", "download");
            response.setHeader("eva-download-filename", encodeFileName);
            if(model.getType().equals(Constants.ZERO)){
                this.exportUnionChangeAddDetailDo(model,"加减保申请表", response.getOutputStream());
            }else{
                this.exportUnionChangeDuDetailDo(model,"更换派遣单位申请表", response.getOutputStream());
            }
        } catch (IOException e) {
            throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
    }
    public void exportUnionChangeAddDetailDo (UnionChange data, String sheetName, OutputStream os) {
        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 )?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);
            for (int i = 0; i < 8; 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));
                }
            }
            sxssfWorkbook.write(os);
            os.close();
        } catch (Exception e) {
            throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    public void exportUnionChangeDuDetailDo (UnionChange data, String sheetName, OutputStream os) {
        SXSSFWorkbook sxssfWorkbook;
        try {
            sxssfWorkbook = new SXSSFWorkbook();
            Sheet sheet = sxssfWorkbook.createSheet(sheetName);
            for (int i = 0; i < 9; i++) {
                sheet.setColumnWidth(i, ((i==3|| i== 4|| i== 5 ||i== 6 || i==7|| i==8 || i==9)?16:8) * 2 * 256);
            }
            sheet.createFreezePane(0, 1);
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,8));
            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 < 9; 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));
            List<ApplyChagneDetail> otherChangeDetailList = data.getApplyChagneDetailList().stream().filter(i->i.getType().equals(Constants.TWO)).collect(Collectors.toList());
            Integer row = 3;
            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));
                    }
                }
            }
            sxssfWorkbook.write(os);
            os.close();
        } catch (Exception e) {
            throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
server/service/src/main/java/com/doumee/service/business/UnionChangeService.java
@@ -133,4 +133,11 @@
     * @return
     */
    UnionChange getDetail(Integer id);
    /**
     * 查看详单 导出
     * @param unionChangeId
     * @return
     */
    UnionChange unionChangeDetail(Integer unionChangeId);
}
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -418,8 +418,11 @@
    }
    @Override
    public UnionChange unionChangeDetail(Integer unionChangeId){
        if(Objects.isNull(unionChangeId)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        UnionChange unionChange = unionChangeJoinMapper.selectJoinOne(UnionChange.class,
                new MPJLambdaWrapper<UnionChange>()
                        .selectAll(UnionChange.class)
@@ -436,8 +439,10 @@
        );
        //企业名称
        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,new MPJLambdaWrapper<ApplyChange>()
                .selectAll(ApplyChange.class)
                .selectAs(Company::getName,ApplyChange::getCompanyName)
                .leftJoin(Company.class,Company::getId,ApplyChange::getCompanyId)
                .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
                .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
                .eq(ApplyChange::getUnionChangeId,unionChangeId)
        );
server/shop/src/main/java/com/doumee/api/business/UnionChangeController.java
@@ -10,6 +10,7 @@
import com.doumee.dao.business.dto.SaveUnionChangeDTO;
import com.doumee.dao.business.dto.SmsCheckDTO;
import com.doumee.dao.business.dto.UnionChangeBXDDTO;
import com.doumee.dao.business.model.UnionApply;
import com.doumee.dao.business.model.UnionChange;
import com.doumee.service.business.UnionChangeService;
import io.swagger.annotations.Api;
@@ -114,8 +115,7 @@
    @PostMapping("/getSignLink")
    @RequiresPermissions("business:unionchange:sign")
    public ApiResponse getSignLink(@RequestBody SmsCheckDTO smsCheckDTO) {
        unionChangeService.getSignLink(smsCheckDTO);
        return ApiResponse.success(null);
        return ApiResponse.success(unionChangeService.getSignLink(smsCheckDTO));
    }
    @ApiOperation("上传保险单")
@@ -125,4 +125,15 @@
        unionChangeService.uploadBXD(unionChangeBXDDTO);
        return ApiResponse.success(null);
    }
    @ApiOperation("导出投保详情单")
    @PostMapping("/exportDetailExcel")
    @RequiresPermissions("business:unionchange:exportExcel")
    public void exportDetailExcel (@RequestBody UnionChange model, HttpServletResponse response) {
        ExcelExporter.build(UnionChange.class).exportUnionChangeDetail(unionChangeService.unionChangeDetail(model.getId()),  response);
    }
}