jiangping
2024-01-25 55f9b16dcdaa97f4bc328f2ecb5096624d19c08e
开发业务接口
已修改6个文件
406 ■■■■■ 文件已修改
server/company/src/main/java/com/doumee/api/business/ApplyChangeController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java 263 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelToPdfTool.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/third/SignService.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/company/src/main/java/com/doumee/api/business/ApplyChangeController.java
@@ -84,16 +84,28 @@
    }
    @ApiOperation("导出加减保详情单")
    @PostMapping("/exportJiajianBaoExcel")
    @RequiresPermissions("business:insuranceapply:exportExcel")
    @RequiresPermissions("business:applychange:exportExcel")
    public void exportJiajianBaoExcel (@RequestBody ApplyChange model, HttpServletResponse response) {
        ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcel(applyChangeService.exportJiajianBaoExcel(model),   response);
    }
    @ApiOperation("导出换厂申请详情单")
    @PostMapping("/exportChangeUnitExcel")
    @RequiresPermissions("business:insuranceapply:exportExcel")
    @RequiresPermissions("business:applychange:exportExcel")
    public void exportChangeUnitExcel (@RequestBody ApplyChange model, HttpServletResponse response) {
        ExcelExporter.build(ApplyChange.class).exportChangeUnitExcel(applyChangeService.exportChangeUnitExcel(model),   response);
    }
    @ApiOperation("获取加减保签章地址")
    @PostMapping("/getJiajianBaoSignLink")
    @RequiresPermissions("business:applychange:sign")
    public ApiResponse<String> getSignLinkJiajiabao (@RequestBody ApplyChange model, HttpServletResponse response) {
        return ApiResponse.success( applyChangeService.getSignLinkJiajiabao(model));
    }
    @ApiOperation("获取缓存申请签章地址")
    @PostMapping("/getChangeUnitSignLink")
    @RequiresPermissions("business:applychange:sign")
    public ApiResponse<String> getChangeUnitSignLink (@RequestBody ApplyChange model, HttpServletResponse response) {
        return ApiResponse.success( applyChangeService.getSignLinkChangeUnit(model));
    }
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
@@ -17,8 +17,7 @@
import org.springframework.core.annotation.AnnotationConfigurationException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URLEncoder;
@@ -313,7 +312,26 @@
//        style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        // 字体
        Font font = workbook.createFont();
        font.setFontHeightInPoints((short)24);
        font.setFontHeightInPoints((short)12);
        font.setBold(true);
        style.setFont(font);
        // 设置边框
        configCellBorder(style);
        cell.setCellStyle(style);
    }
    /**
     * 配置列头单元格
     */
    private void configInfoCell (SXSSFWorkbook workbook, Cell cell,HorizontalAlignment p ) {
        CellStyle style = workbook.createCellStyle();
        style.setAlignment(p);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置背景
        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
//        style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        // 字体
        Font font = workbook.createFont();
        font.setFontHeightInPoints((short)12);
        font.setBold(true);
        style.setFont(font);
        // 设置边框
@@ -440,6 +458,9 @@
            header1.createCell(3).setCellValue("保险生效止期");
            header1.createCell(4).setCellValue("投保人数");
            header1.createCell(5).setCellValue("总费用(元)");
            for (int i = 0; i < 6; i++) {
                configFirstCell(sxssfWorkbook,header1.getCell(i));
            }
            Row header2 = sheet.createRow(2);
            header2.createCell(0).setCellValue(data.getCompanyName());
            header2.createCell(1).setCellValue(data.getSolutionsName());
@@ -458,6 +479,9 @@
            header4.createCell(3).setCellValue("身份证号");
            header4.createCell(4).setCellValue("派遣单位");
            header4.createCell(5).setCellValue("所属工种");
            for (int i = 0; i < 6; i++) {
                configFirstCell(sxssfWorkbook,header4.getCell(i));
            }
            if(data.getApplyDetailList()!=null){
            // 创建数据记录
                for (int rowIndex = 0; rowIndex < data.getApplyDetailList().size(); rowIndex++) {
@@ -550,6 +574,9 @@
            header1.createCell(9).setCellValue("加保人数");
            header1.createCell(10).setCellValue("减保人数");
            header1.createCell(11).setCellValue("期望批单生效期");
            for (int i = 0; i < 12; i++) {
                configFirstCell(sxssfWorkbook,header1.getCell(i));
            }
            sheet.addMergedRegion(new CellRangeAddress(1  ,1,0,2));
            sheet.addMergedRegion(new CellRangeAddress(1  ,1,6,8));
@@ -571,7 +598,9 @@
            header2.createCell(6).setCellValue("减保人员");
            sheet.addMergedRegion(new CellRangeAddress(3  ,3,0,5));
            sheet.addMergedRegion(new CellRangeAddress(3  ,3,6,11));
            for (int i = 0; i < 12; i++) {
                configFirstCell(sxssfWorkbook,header2.getCell(i));
            }
            Row header4 = sheet.createRow(4);
            header4.createCell(0).setCellValue("序号");
            header4.createCell(1).setCellValue("员工姓名");
@@ -585,6 +614,9 @@
            header4.createCell(9).setCellValue("身份证号");
            header4.createCell(10).setCellValue("派遣单位");
            header4.createCell(11).setCellValue("所属工种");
            for (int i = 0; i < 12; i++) {
                configFirstCell(sxssfWorkbook,header4.getCell(i));
            }
            int maxNum = data.getAddNum()>data.getDelNum()?data.getAddNum():data.getDelNum();
            // 创建数据记录
            for (int rowIndex = 0; rowIndex <maxNum; rowIndex++) {
@@ -622,6 +654,128 @@
            }
        }
    }
    /**
     * 导出加减保申请详单
     * @param data 数据
     * @param sheetName Sheet名称
     */
    public String exportJiajianBaoExcelToPdf (ApplyChange data, String sheetName) {
        SXSSFWorkbook sxssfWorkbook;
        try {
            sxssfWorkbook = new SXSSFWorkbook();
            Sheet sheet = sxssfWorkbook.createSheet(sheetName);
            sheet.createFreezePane(0, 1);
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,8));
            Row title = sheet.createRow(0);
            title.setHeight((short) 1000);
            Cell c = title.createCell(0);
            c.setCellValue(sheetName);
            configFirstCell(sxssfWorkbook,c);
            Row header1 = sheet.createRow(1);
            header1.createCell(0).setCellValue("投保企业");
            header1.createCell(3).setCellValue("保险方案");
            header1.createCell(4).setCellValue("保单号");
            header1.createCell(5).setCellValue("保险生效起期");
            header1.createCell(6).setCellValue("保险生效止期");
            header1.createCell(9).setCellValue("加保人数");
            header1.createCell(10).setCellValue("减保人数");
            header1.createCell(11).setCellValue("期望批单生效期");
            for (int i = 0; i < 12; i++) {
                configFirstCell(sxssfWorkbook,header1.getCell(i));
            }
            sheet.addMergedRegion(new CellRangeAddress(1  ,1,0,2));
            sheet.addMergedRegion(new CellRangeAddress(1  ,1,6,8));
            Row header2 = sheet.createRow(2);
            header2.createCell(0).setCellValue(data.getCompanyName());
            header2.createCell(3).setCellValue(data.getSolutionsName());
            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(9).setCellValue(data.getAddNum());
            header2.createCell(10).setCellValue(data.getDelNum());
            header2.createCell(11).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getValidTime()));
            sheet.addMergedRegion(new CellRangeAddress(2 ,2,0,2));
            sheet.addMergedRegion(new CellRangeAddress(2  ,2,6,8));
            //空白行
            Row header3 = sheet.createRow(3);
            header2.createCell(0).setCellValue("加保人员");
            header2.createCell(6).setCellValue("减保人员");
            sheet.addMergedRegion(new CellRangeAddress(3  ,3,0,5));
            sheet.addMergedRegion(new CellRangeAddress(3  ,3,6,11));
            for (int i = 0; i < 12; i++) {
                configFirstCell(sxssfWorkbook,header2.getCell(i));
            }
            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("性别");
            header4.createCell(9).setCellValue("身份证号");
            header4.createCell(10).setCellValue("派遣单位");
            header4.createCell(11).setCellValue("所属工种");
            for (int i = 0; i < 12; i++) {
                configFirstCell(sxssfWorkbook,header4.getCell(i));
            }
            int maxNum = data.getAddNum()>data.getDelNum()?data.getAddNum():data.getDelNum();
            // 创建数据记录
            for (int rowIndex = 0; rowIndex <maxNum; rowIndex++) {
                ApplyChagneDetail addModel =  data.getAddDetailList().size()> rowIndex?data.getAddDetailList().get(rowIndex):null;
                ApplyChagneDetail delModel =  data.getDelDetailList().size()> rowIndex?data.getDelDetailList().get(rowIndex):null;
                Row header5 = sheet.createRow(rowIndex + 5);
                if(addModel!=null){
                    header5.createCell(0).setCellValue(rowIndex+1);
                    header5.createCell(1).setCellValue(StringUtils.defaultString(addModel.getMemberName(),""));
                    header5.createCell(2).setCellValue(Constants.equalsInteger(addModel.getSex(),0)?"男":(Constants.equalsInteger(addModel.getSex(),1)?"女":"-"));
                    header5.createCell(3).setCellValue(StringUtils.defaultString(addModel.getIdcardNo(),""));
                    header5.createCell(4).setCellValue(StringUtils.defaultString(addModel.getDuName(),""));
                    header5.createCell(5).setCellValue(StringUtils.defaultString(addModel.getWorkTypeName(),""));
                }
                if(delModel!=null){
                    header5.createCell(6).setCellValue(rowIndex+1);
                    header5.createCell(7).setCellValue(StringUtils.defaultString(delModel.getMemberName(),""));
                    header5.createCell(8).setCellValue(Constants.equalsInteger(delModel.getSex(),0)?"男":(Constants.equalsInteger(delModel.getSex(),1)?"女":"-"));
                    header5.createCell(9).setCellValue(StringUtils.defaultString(delModel.getIdcardNo(),""));
                    header5.createCell(10).setCellValue(StringUtils.defaultString(delModel.getDuName(),""));
                    header5.createCell(11).setCellValue(StringUtils.defaultString(delModel.getWorkTypeName(),""));
                }
            }
            int rowIndex = 4+data.getChangeDetailList().size();
            Row header6= sheet.createRow(4+data.getChangeDetailList().size());
            header6.createCell(0).setCellValue("投保企业申明:\n" +
                    "1、在申请书上填写的一切内容属实,否则本企业承担一切法律责任。\n" +
                    "2、由于变更受益人产生的法律纠纷本企业愿承担一切法律责任。\n" +
                    "3、本申请表的签章为本企业亲自签署,如由此产生的法律纠纷本企业愿承担一切法律责任。\n");
            configInfoCell(sxssfWorkbook,header6.getCell(0),HorizontalAlignment.LEFT);
            sheet.addMergedRegion(new CellRangeAddress(rowIndex ,rowIndex,1,12));
            Row header7= sheet.createRow(rowIndex+1);
            header7.createCell(0).setCellValue("投保企业签章 :                            \n" +"日期:     年     月     日    ");
            sheet.addMergedRegion(new CellRangeAddress(rowIndex+1 ,rowIndex+1,1,12));
            configInfoCell(sxssfWorkbook,header7.getCell(0),HorizontalAlignment.RIGHT);
            //临时缓冲区
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            //创建临时文件
            sxssfWorkbook.write(out);
            byte [] bookByteAry = out.toByteArray();
            InputStream     in = new ByteArrayInputStream(bookByteAry);
            String tempPdf =System.getProperty("java.io.tmpdir")+File.separator+UUID.randomUUID().toString()+".pdf";
            ExcelToPdfTool.excelToPdf(in,tempPdf);//转PDF
            File f = new File(tempPdf);
            if(f!=null && f.isFile()){
                return tempPdf;
            }
        } catch (Exception e) {
            // throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
        return null;
    }
    /**
     * 导出加减保申请详单
     * @param data 数据
@@ -648,6 +802,9 @@
            header1.createCell(5).setCellValue("保险生效止期");
            header1.createCell(6).setCellValue("换厂人数");
            header1.createCell(7).setCellValue("期望批单生效期");
            for (int i = 0; i < 8; i++) {
                configFirstCell(sxssfWorkbook,header1.getCell(i));
            }
            sheet.addMergedRegion(new CellRangeAddress(1  ,1,1,2));
            Row header2 = sheet.createRow(2);
@@ -669,6 +826,9 @@
            header4.createCell(5).setCellValue("原所所属工种");
            header4.createCell(6).setCellValue("更改后派遣单位");
            header4.createCell(7).setCellValue("更改后所属工种");
            for (int i = 0; i < 8; i++) {
                configFirstCell(sxssfWorkbook,header4.getCell(i));
            }
            // 创建数据记录
            for (int rowIndex = 0; rowIndex <data.getChangeDetailList().size(); rowIndex++) {
                ApplyChagneDetail addModel = data.getChangeDetailList().get(rowIndex);
@@ -696,6 +856,101 @@
            }
        }
    }
    /**
     * 导出加减保申请详单
     * @param data 数据
     * @param sheetName Sheet名称
     */
    public String exportChangeUnitExcelToPdf (ApplyChange data, String sheetName) {
        SXSSFWorkbook sxssfWorkbook;
        try {
            sxssfWorkbook = new SXSSFWorkbook();
            Sheet sheet = sxssfWorkbook.createSheet(sheetName);
            sheet.createFreezePane(0, 1);
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,8));
            Row title = sheet.createRow(0);
            title.setHeight((short) 1000);
            Cell c = title.createCell(0);
            c.setCellValue(sheetName);
            configFirstCell(sxssfWorkbook,c);
            Row header1 = sheet.createRow(1);
            header1.createCell(0).setCellValue("投保企业");
            header1.createCell(1).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));
            }
            sheet.addMergedRegion(new CellRangeAddress(1  ,1,1,2));
            Row header2 = sheet.createRow(2);
            header2.createCell(0).setCellValue(data.getCompanyName());
            header2.createCell(1).setCellValue(data.getSolutionsName());
            header2.createCell(3).setCellValue(data.getApplyCode());
            header2.createCell(4).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getStartTime()));
            header2.createCell(5).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getEndTime()));
            header2.createCell(6).setCellValue(data.getChangeNum());
            header2.createCell(7).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getValidTime()));
            sheet.addMergedRegion(new CellRangeAddress(2  ,2,1,2));
            Row header4 = sheet.createRow(3);
            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("更改后所属工种");
            for (int i = 0; i < 8; i++) {
                configFirstCell(sxssfWorkbook,header4.getCell(i));
            }
            // 创建数据记录
            for (int rowIndex = 0; rowIndex <data.getChangeDetailList().size(); rowIndex++) {
                ApplyChagneDetail addModel = data.getChangeDetailList().get(rowIndex);
                Row header5 = sheet.createRow(rowIndex + 4);
                header5.createCell(0).setCellValue(rowIndex+1);
                header5.createCell(1).setCellValue(StringUtils.defaultString(addModel.getMemberName(),""));
                header5.createCell(2).setCellValue(Constants.equalsInteger(addModel.getSex(),0)?"男":(Constants.equalsInteger(addModel.getSex(),1)?"女":"-"));
                header5.createCell(3).setCellValue(StringUtils.defaultString(addModel.getIdcardNo(),""));
                header5.createCell(4).setCellValue(StringUtils.defaultString(addModel.getOldDuName(),""));
                header5.createCell(5).setCellValue(StringUtils.defaultString(addModel.getOldWorkTypeName(),""));
                header5.createCell(6).setCellValue(StringUtils.defaultString(addModel.getDuName(),""));
                header5.createCell(7).setCellValue(StringUtils.defaultString(addModel.getWorkTypeName(),""));
            }
            int rowIndex = 4+data.getChangeDetailList().size();
            Row header6= sheet.createRow(4+data.getChangeDetailList().size());
            header6.createCell(0).setCellValue("投保企业申明:\n" +
                    "1、在申请书上填写的一切内容属实,否则本企业承担一切法律责任。\n" +
                    "2、由于变更受益人产生的法律纠纷本企业愿承担一切法律责任。\n" +
                    "3、本申请表的签章为本企业亲自签署,如由此产生的法律纠纷本企业愿承担一切法律责任。\n");
            configInfoCell(sxssfWorkbook,header6.getCell(0),HorizontalAlignment.LEFT);
            sheet.addMergedRegion(new CellRangeAddress(rowIndex ,rowIndex,1,8));
            Row header7= sheet.createRow(rowIndex+1);
            header7.createCell(0).setCellValue("投保企业签章 :                            \n" +"日期:     年     月     日    ");
            sheet.addMergedRegion(new CellRangeAddress(rowIndex+1 ,rowIndex+1,1,8));
            configInfoCell(sxssfWorkbook,header7.getCell(0),HorizontalAlignment.RIGHT);
            //临时缓冲区
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            //创建临时文件
             sxssfWorkbook.write(out);
            byte [] bookByteAry = out.toByteArray();
            InputStream     in = new ByteArrayInputStream(bookByteAry);
            String tempPdf =System.getProperty("java.io.tmpdir")+File.separator+UUID.randomUUID().toString()+".pdf";
            ExcelToPdfTool.excelToPdf(in,tempPdf);//转PDF
            File f = new File(tempPdf);
            if(f!=null && f.isFile()){
                return tempPdf;
            }
            return tempPdf;
        } catch (Exception e) {
           // throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
        return null;
    }
    @Data
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelToPdfTool.java
@@ -2,6 +2,8 @@
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;
import java.io.InputStream;
/**
 * Excel导出实现
 * @author Eva.Caesar Liu
@@ -30,7 +32,20 @@
            //创建Workbook 实例并加载示例文档
            Workbook workbook = new Workbook();
            workbook.loadFromFile(inputExcelPath);
            //转换时设置工作表适应宽度
            workbook.getConverterSetting().setSheetFitToWidth(true);
            //获取第一个工作表
            Worksheet worksheet = workbook.getWorksheets().get(0);
            //保存为PDF文档格式
            worksheet.saveToPdf(outputPdfPath);
        }
        public static void excelToPdf(InputStream is,String outputPdfPath) {
            //创建Workbook 实例并加载示例文档
            Workbook workbook = new Workbook();
            workbook.loadFromStream(is);
            //转换时设置工作表适应宽度
            workbook.getConverterSetting().setSheetFitToWidth(true);
server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
@@ -112,4 +112,8 @@
    ApplyChange exportJiajianBaoExcel(ApplyChange model);
    ApplyChange exportChangeUnitExcel(ApplyChange model);
    String getSignLinkJiajiabao(ApplyChange model);
    String getSignLinkChangeUnit(ApplyChange model);
}
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -1,6 +1,8 @@
package com.doumee.service.business.impl;
import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
@@ -21,6 +23,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doumee.service.business.third.SignService;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
@@ -56,6 +59,10 @@
    @Autowired
    private ApplyChangeJoinMapper applyChangeJoinMapper;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private SignService signService;
    @Autowired
    private ApplyChagneDetailJoinMapper applyChagneDetailJoinMapper;
@@ -946,6 +953,59 @@
        model.setChangeNum(model.getChangeDetailList().size());
        return model;
    }
    /**
     * 导出换厂申请表
     * @param param
     * @return
     */
    @Override
    public  String  getSignLinkJiajiabao(ApplyChange param){
        ApplyChange model = exportJiajianBaoExcel(param);
        return  getOnlineSignLink(model);
    }
    /**
     * 导出换厂申请表
     * @param param
     * @return
     */
    @Override
    public  String  getSignLinkChangeUnit(ApplyChange param){
        ApplyChange model = exportChangeUnitExcel(param);
        return  getOnlineSignLink(model);
    }
    private String getOnlineSignLink(ApplyChange model) {
        if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getType())){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该申请状态已流转,当前不支持签章操作!");
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        Company company = user.getCompany();
        if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.ONE)){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业尚未具备在线签章条件,请联系平台管理员确认~");
        }
        String fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"缓存申请表");
        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
        String applyNo = signService.applySignLocalFile(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),null,company.getSignId(),notifyUrl);
        if(StringUtils.isBlank(applyNo) ){
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!");
        }
        String link = signService.signLink(applyNo,company.getEmail(),company.getCode());
        if(StringUtils.isBlank(link) ){
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!");
        }
        ApplyChange update= new ApplyChange();
        update.setId(model.getId());
        update.setEditor(user.getId());
        update.setEditDate(new Date());
        update.setSignApplyNo(applyNo);
        applyChangeMapper.updateById(update);
        return  link;
    }
    /**
server/service/src/main/java/com/doumee/service/business/third/SignService.java
@@ -295,6 +295,54 @@
      return null;
    }
    /**
     * 发起签约
     * @param name
     * @param fileUrl
     * @param file
     * @param creditCoe
     * @param email
     * @param postionJson
     */
    public String applySignLocalFile(String name,String fullname,String file,String creditCoe,String email,String postionJson,String singId,String notifyUrl){
      try {
          String url=SERVICE_URL+"/v2/sign/applySign";
          Map<String, Object>  params=bodyParams;
          params.put("contractName",name); //合同名称
          params.put("serverCa",1); //使用云证书
          params.put("file",new File(file));
          params.put("dealType",5); //指定合同文件签署方式 5 为部分自动签
          params.put("positionType",1); //指定通过表单域方式设置签字位置
          params.put("fileType",0);
          params.put("needQifengSign",1);
          params.put("notifyUrl",notifyUrl);
          JSONArray signatories=new JSONArray();
          SignatoryReq sReq=new SignatoryReq();
          sReq.setFullName(fullname); //企业姓名
          sReq.setIdentityType(11); //证件类型
          sReq.setIdentityCard(creditCoe);//营业执照号
          sReq.setEmail(email); //在君子签注册认证的邮箱
//        sReq.setChapteJson("[{\"page\":0,\"chaptes\":[{\"offsetX\":0.12,\"offsetY\":0.23}]},{\"page\":1,\"chaptes\":[{\"offsetX\":0.45,\"offsetY\":0.67}]}]");
//          sReq.setChapteJson(postionJson);
          sReq.setSearchKey(postionJson);
          sReq.setSignId(singId);
          sReq.setNoNeedVerify(1);
          signatories.add(sReq);
          params.put("signatories",signatories.toJSONString());
          System.out.println(signatories.toJSONString());
          String str= HttpClientUtils.init().getPost(url,null,params,true);
          System.out.println(str);
          saveInterfaceLog(url,"【电子签】发起签约",JSONObject.toJSONString(params),str);
          JSONObject json = JSONObject.parseObject(str);
          if(json!=null && json.getBoolean("success")){
              return  json.getString("data");
          }
      }catch (Exception e){
      }
      return null;
    }
    /**