jiangping
2024-01-30 a9ca0823ab8f33ca85abebcf6ec4a8da235adb49
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -5,12 +5,12 @@
import com.doumee.dao.business.model.Solutions;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.ServletOutputStream;
import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLDecoder;
@@ -79,6 +79,7 @@
    public static final String TAXES_FILE = "TAXES_FILE";
    public static final String APPLY_FILE ="APPLY_FILE" ;
    public static final String SETTLE_FILE ="SETTLE_FILE" ;
    public static final String DU_FILE ="DU_FILE" ;
    public static final String SIGN_DONE_NOTIFY_URL = "SIGN_DONE_NOTIFY_URL";
    /**
@@ -166,8 +167,7 @@
        Integer sex = 1;
        if (matcher.matches()) {
            int genderCode = Integer.parseInt(idCard.substring(16, 17)); // 从第17位开始提取性别编码(奇数为男性,偶数为女性)
            if ((genderCode % 2 == 1)) {
            if ((genderCode % 2 == 1) ) {
                sex = 1;
            } else {
                sex = 2;
@@ -406,8 +406,9 @@
        BD_SIGNED_PDF(9, "签署后保单申请表PDF", "签署后保单申请表PDF"),
        COM_SING_IMG(10, "企业印章", "企业印章"),
        BD_DONE_PDF(11, "最终报单", "最终报单"),
        CA_PD_PDF(12, "最终报单", "最终报单"),
        CA_APPLY_JIAJIAN_SIGN(13, "加减保申请签章文件", "加减保申请签章文件"),
        CA_APPLY_CHANGEUNIT_SIGN(14, "换厂申请签章文件", "换厂申请签章文件"),
        ;
@@ -658,6 +659,55 @@
    }
    public  enum ApplyCollectStatus {
        DSP(0, "待审批"),
        DCD(1, "待出单"),
        BZZ(2, "保障中"),
        YGQ(3, "已过期"),
        YTH(4, "已退回"),
        THSQZ(5, "申请退回"),
        YGB(6, "已关闭"),
        DQYQZ(7, "待签署"),
        ;
        // 成员变量
        private String name;
        private int key;
        // 构造方法
        ApplyCollectStatus(int key, String name) {
            this.name = name;
            this.key = key;
        }
        // 普通方法
        public static String getName(int index) {
            for (ApplyCollectStatus c : ApplyCollectStatus.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        // get set 方法
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
    }
    public  enum ApplyLogType {
        UPLOAD(0, "提交投保","提交意见:${param}"),
@@ -683,6 +733,9 @@
        CA_PALTFORM_REFUSE_APPLY(20, "驳回退回申请",""),
        CA_PALTFORM_EDIT_PIDAN(21, "修改批单","修改原因:${param}"),
        PALTFORM_EDIT_BD(22, "修改保单","修改原因:${param}"),
        CA_JIAJIAN_APPLY_SIGN(23, "加减保申请企业签章",""),
        CA_CHANGUNIT_APPLY_SIGN(24, "换成申请企业签章",""),
        ;
        // 成员变量
        private String name;
@@ -741,28 +794,31 @@
    }
    public  enum InsuranceApplyStatus {
        UPLOAD(0, "提交投保",""),
        PLATFORM_RETURN(1, "审核不通过","提交意见:${param}"),
        WAIT_SIGNATURE(2, "已上传代签申请表待企业签章",""),
        SIGNATURE(3, "已签章待上传保险单",""),
        FAIL_RETURN(4, "保单出具失败退回",""),
        UPLOAD_INSURANCE(5, "保单完成","保险生效起期:${param}变更为${param1}"),
        COMPANY_BACK_APPLY_UPLOAD(6, "企业申请退回(提交投保)","提交意见:${param}"),
        COMPANY_BACK_APPLY_WAIT_SIGNATURE(7, "企业申请退回(待签章)","提交意见:${param}"),
        COMPANY_BACK_APPLY_SIGNATURE(8, "企业申请退回(已签章)","提交意见:${param}"),
        CLOSE(9, "订单关闭",""),
        PLATFORM_CHECK_PASS(10,"平台投保审核通过",""),
        UPLOAD(0, "提交投保","",0),
        PLATFORM_RETURN(1, "审核不通过","提交意见:${param}",4),
        WAIT_SIGNATURE(2, "已上传代签申请表待企业签章","",7),
        SIGNATURE(3, "已签章待上传保险单","",1),
        FAIL_RETURN(4, "保单出具失败退回","",4),
        UPLOAD_INSURANCE(5, "保单完成","保险生效起期:${param}变更为${param1}",2),
        COMPANY_BACK_APPLY_UPLOAD(6, "企业申请退回(提交投保)","提交意见:${param}",5),
        COMPANY_BACK_APPLY_WAIT_SIGNATURE(7, "企业申请退回(待签章)","提交意见:${param}",5),
        COMPANY_BACK_APPLY_SIGNATURE(8, "企业申请退回(已签章)","提交意见:${param}",5),
        CLOSE(9, "订单关闭","",6),
        PLATFORM_CHECK_PASS(10,"平台投保审核通过","提交意见:${param}",1),
        ;
        // 成员变量
        private String name;
        private String info;
        private int key;
        private int collectStatus;
        // 构造方法
        InsuranceApplyStatus(int key, String name,String info) {
        InsuranceApplyStatus(int key, String name,String info,int collectStatus) {
            this.name = name;
            this.key = key;
            this.info = info;
            this.collectStatus = collectStatus;
        }
        // 普通方法
@@ -770,6 +826,25 @@
            for (InsuranceApplyStatus c : InsuranceApplyStatus.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        public static List<Integer> getKesByStatus(Integer collectStatus) {
            List<Integer>  list = new ArrayList<>();
            if(collectStatus!=null){
                for (InsuranceApplyStatus c : InsuranceApplyStatus.values()) {
                    if (Constants.equalsInteger(c.getCollectStatus() ,collectStatus)) {
                        list.add(c.getKey());
                    }
                }
            }
            return list;
        }
        public static Integer getCollectStatus(Integer index) {
            for (InsuranceApplyStatus c : InsuranceApplyStatus.values()) {
                if (Constants.equalsInteger(c.getKey() , index)) {
                    return c.collectStatus;
                }
            }
            return null;
@@ -807,6 +882,14 @@
        public void setInfo(String info) {
            this.info = info;
        }
        public int getCollectStatus() {
            return collectStatus;
        }
        public void setCollectStatus(int collectStatus) {
            this.collectStatus = collectStatus;
        }
    }
    public static BigDecimal countDetailFee(Solutions solutions,Date startDate, Date endDate){
@@ -817,6 +900,7 @@
        }
        return solutions.getPrice().multiply(new BigDecimal(cycle));
    }
    public static BigDecimal countDetailFee(int timeUnit ,BigDecimal price,Date startDate, Date endDate){
        //查询保险实际周期
        Integer cycle = DateUtil.calculateBetween(endDate,startDate,timeUnit);
@@ -1256,7 +1340,8 @@
            InputStream inStream = null;
            OutputStream os = null;
            try {
                file = File.createTempFile("", fileName);
                String tempDir = System.getProperty("java.io.tmpdir")+fileName;
                file = new File(tempDir);
                //下载
                urlfile = new URL(url);
                inStream = urlfile.openStream();
@@ -1286,4 +1371,20 @@
        return file;
    }
    public static void packFilesToZip(List<File> files,    ServletOutputStream os) throws IOException {
        try (ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(os)) {
            for (File file : files) {
                ZipArchiveEntry entry = new ZipArchiveEntry(file.getName());
                zipOutputStream.putArchiveEntry(entry);
                try (FileInputStream fileInputStream = new FileInputStream(file)) {
                    byte[] buffer = new byte[1024];
                    int length;
                    while ((length = fileInputStream.read(buffer)) > 0) {
                        zipOutputStream.write(buffer, 0, length);
                    }
                }
                zipOutputStream.closeArchiveEntry();
            }
        }
    }
}