Bladeren bron

1、引入easyexcel;

guanzi 4 jaren geleden
bovenliggende
commit
e4e599a816

+ 7 - 0
saas-backen/pom.xml

@@ -183,6 +183,13 @@
             <version>8.0.3</version>
         </dependency>
 
+        <!-- easyexcel -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.0.5</version>
+        </dependency>
+
 <!--        <dependency>-->
 <!--            <groupId>com.jlefebure</groupId>-->
 <!--            <artifactId>spring-boot-starter-minio</artifactId>-->

+ 7 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/excel/OnAllAnalysedListener.java

@@ -0,0 +1,7 @@
+package com.pavis.app.saasbacken.excel;
+
+import java.util.List;
+
+public interface OnAllAnalysedListener<T> {
+    void onAllAnalysed(List<T> ExcelDataList);
+}

+ 247 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/excel/org/EnterpriseBasicInfoExcelData.java

@@ -0,0 +1,247 @@
+package com.pavis.app.saasbacken.excel.org;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.*;
+
+/**
+ * <p>
+ * 组织机构信息
+ * </p>
+ *
+ * @author chen.cong
+ * @since 2018-06-23
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Data
+public class EnterpriseBasicInfoExcelData {
+
+    /**
+     * 企业名称
+     */
+    private String name;
+    /**
+     * 法定代表人
+     */
+    private String legalrepresentativename;
+    /**
+     * 经营状态
+     */
+    private String managestatus;
+    /**
+     * 注册基本(万元)
+     */
+    private String registrationcapital;
+    /**
+     * 实缴资本(万元)
+     */
+    private String practicalcapital;
+    /**
+     * 曾用名
+     */
+    private String formername;
+    /**
+     * 所属行业
+     */
+    private String categoryname;
+    /**
+     * 统一社会信用代码
+     */
+    private String orgcode;
+    /**
+     * 纳税人识别号
+     */
+    private String taxpayercode;
+    /**
+     * 工商注册号
+     */
+    private String registercode;
+    /**
+     * 组织机构代码
+     */
+    private String institutioncode;
+    /**
+     * 登记机关
+     */
+    private String registeroffice;
+    /**
+     * 成立日期
+     */
+    private String registrationdate;
+    /**
+     * 企业类型
+     */
+    private String registrationtype;
+    /**
+     * 经营期限
+     */
+    private String operatingperiod;
+    /**
+     * 行政区划
+     */
+    private String administrativedivision;
+    /**
+     * 核准日期
+     */
+    private String approvaltime;
+    /**
+     * 注册地址
+     */
+    private String detailaddress;
+    /**
+     * 经营范围
+     */
+    private String businessscope;
+    /**
+     * 发明专利
+     */
+    private String patentcount;
+    /**
+     * 实用新型
+     */
+    private String patentforutilitycount;
+    /**
+     * 软件著作权
+     */
+    private String patentforsoftwarecount;
+    /**
+     * 是否国高
+     */
+    private String iskunitaka;
+    /**
+     * 高企证书号
+     */
+    private String highenterprisecode;
+    /**
+     * 高新领域代码
+     */
+    private String highandnewcode;
+    /**
+     * 是否省级重点企业研究院
+     */
+    private String isprovincialemphasisenterprise;
+    /**
+     * 省级重点企业认定年份
+     */
+    private String emphasisdate;
+    /**
+     * 省级重点企业研究院名称
+     */
+    private String emphasisname;
+    /**
+     * 是否省级企业研究院
+     */
+    private String isprovincialenterprise;
+    /**
+     * 省级企业认定年份
+     */
+    private String provincialdate;
+    /**
+     * 省级企业研究院名称
+     */
+    private String provincialname;
+    /**
+     * 是否省高新技术研究开发中心(浙江)
+     */
+    private String ishighandnewenterprise;
+    /**
+     * 省高新技术研究院开发中心认定年份
+     */
+    private String highandnewdate;
+    /**
+     * 省高新技术研究开发中心名称
+     */
+    private String highandnewname;
+    /**
+     * 是否省科小
+     */
+    private String isprovincesciencesmall;
+    /**
+     * 省科小认定时间
+     */
+    private String provincesciencesmalldate;
+    /**
+     * 是否"杭州市"雏鹰计划企业
+     */
+    private String iseyasenterprise;
+    /**
+     * 雏鹰计划认定年份
+     */
+    private String eyasdate;
+    /**
+     * 是否市级企业研发中心
+     */
+    private String ismunicipalresearch;
+    /**
+     * 市级企业研发中心认定年份
+     */
+    private String municipalresearchdate;
+    /**
+     * 市级企业研发中心名称
+     */
+    private String municipalresearchname;
+    /**
+     * 是否飞地在建研发中心
+     */
+    private String isfeidienterprise;
+    /**
+     * 飞地研发中心专职研发人数
+     */
+    private String feidipeoplecount;
+    /**
+     * 飞地研发中心场地面积
+     */
+    private String feidiarea;
+    /**
+     * 企业法定代表人手机
+     */
+    private String legalrepresentativetel;
+    /**
+     * 技术负责人姓名
+     */
+    private String technologycontact;
+    /**
+     * 技术负责人手机
+     */
+    private String technologycontactphone;
+    /**
+     * 财务联系人姓名
+     */
+    private String financialcontact;
+    /**
+     * 财务联系人电话
+     */
+    private String financialcontactphone;
+    /**
+     * 科技联络人
+     */
+    private String sciencecontact;
+    /**
+     * 科技联络人联系方式
+     */
+    private String sciencecontactphone;
+    /**
+     * 职工总数
+     */
+    private String workercount;
+    /**
+     * 乡镇街道平台
+     */
+    private String townplatform;
+    /**
+     * 是否规上
+     */
+    private String hasregulationorg;
+
+
+    private Long id;
+    private String reqId;
+
+    private String errorRemark;
+    private JSONObject errorMsg;
+
+
+}

+ 204 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/excel/org/EnterpriseBasicInfoExcelDataListener.java

@@ -0,0 +1,204 @@
+package com.pavis.app.saasbacken.excel.org;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
+import com.pavis.app.saasbacken.excel.OnAllAnalysedListener;
+import com.pavis.app.saasbacken.exception.ExcelHeadException;
+import com.pavis.app.saasbacken.http.ErrorCode;
+import com.pavis.app.saasbacken.utils.CheckUtils;
+import com.pavis.app.saasbacken.utils.ExcelPatternMsgUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author guanhuijuan
+ * @create 2020-06-22 13:20
+ * @desc RecommendedInfoExcelDataListener
+ **/
+
+@Slf4j
+@Component
+public class EnterpriseBasicInfoExcelDataListener extends AnalysisEventListener<EnterpriseBasicInfoExcelData> {
+    private OnAllAnalysedListener<EnterpriseBasicInfoExcelData> onAllAnalysedListener;
+
+    private List<EnterpriseBasicInfoExcelData> enterpriseBasicInfoExcelDataList = Lists.newArrayList();
+
+    /**
+     * 结果标记 默认错误
+     */
+    private boolean isCorrectFormat = true;
+
+    /**
+     * 结果信息
+     */
+    private String resultMessage = "";
+
+    private Map<String,String> errorMap = new HashMap<>();
+    private List<Map<String,String>> errorList = new ArrayList<>();
+    /**
+     * 格式验证。
+     */
+    JSONObject js = new JSONObject();
+
+    public EnterpriseBasicInfoExcelDataListener(OnAllAnalysedListener<EnterpriseBasicInfoExcelData> onAllAnalysedListener) {
+        this.onAllAnalysedListener = onAllAnalysedListener;
+    }
+
+    public EnterpriseBasicInfoExcelDataListener() {
+
+    }
+
+    @Override
+    public void invoke(EnterpriseBasicInfoExcelData enterpriseBasicInfoExcelData, AnalysisContext analysisContext) {
+        // Map<Integer, Map<Integer, String>> map = new HashMap<>();
+        // Map<Integer, JSONObject> map = new HashMap<>();
+        // map.put(analysisContext.readRowHolder().getRowIndex(), checkError(enterpriseBasicInfoExcelData));
+        // System.out.println("***********map:" + JSON.toJSONString(map));
+        if (resultMessage.equals(ExcelPatternMsgUtils.HEAD_NULL_ERROR)
+                || resultMessage.equals(ExcelPatternMsgUtils.HEAD_ERROR)) {
+            try {
+                throw new ExcelHeadException(ErrorCode.ERROR_EXCEL_HEAD.getCode(), ErrorCode.ERROR_EXCEL_HEAD.getMessage());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            js = checkError(enterpriseBasicInfoExcelData);
+            enterpriseBasicInfoExcelData.setErrorRemark(js.toJSONString().equals("{}") ? "" : js.toJSONString());
+            System.out.println("***>" + JSON.toJSONString(enterpriseBasicInfoExcelData));
+            enterpriseBasicInfoExcelDataList.add(enterpriseBasicInfoExcelData);
+            js.clear();
+        }
+
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+        onAllAnalysedListener.onAllAnalysed(enterpriseBasicInfoExcelDataList);
+    }
+
+
+    /**
+     * 这里会一行行的返回头
+     *
+     * @param headMap
+     * @param context
+     */
+    @Override
+    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
+         log.info("解析到一条头数据:{}", JSON.toJSONString(headMap));
+        Map<String, Map<Integer, String>> map = new HashMap<>();
+        map.put(String.valueOf(context.readRowHolder().getRowIndex()), headMap);
+        System.out.println("head map:"+ JSON.toJSONString(map));
+        String basicStr = ExcelPatternMsgUtils.BASIC_TL_HEAD;
+        if (map.containsKey("1")) {
+            if (!JSON.toJSONString(map.get("1")).equals(basicStr)) {
+                log.info("head:{}",basicStr);
+                log.info("excel head:{}",map.get("1"));
+                resultMessage = ExcelPatternMsgUtils.HEAD_ERROR;
+                enterpriseBasicInfoExcelDataList.clear();
+                isCorrectFormat = false;
+                log.info("head:{}",resultMessage);
+                // throw new ExcelHeadException(ErrorCode.ERROR.getCode(), ErrorCode.ERROR.getMessage());
+                // try {
+                //     throw new ExcelHeadException(ErrorCode.ERROR.getCode(), ErrorCode.ERROR.getMessage());
+                //     // throw new Exception("文件类型不匹配,请上传正确类型的文件后再试!");
+                // } catch (Exception e) {
+                //     e.printStackTrace();
+                // }
+            }
+        }
+        // if (map.containsKey(0))  {
+        //     resultMessage = ExcelPatternMsgUtils.HEAD_NULL_ERROR;
+        //     log.info("none head:{}",resultMessage);
+        // }
+    }
+
+    /**
+     * 解析各字段是否符合要求。
+     * @param excelData
+     * @return
+     */
+    public JSONObject checkError(EnterpriseBasicInfoExcelData excelData){
+        List<JSONObject> list = new ArrayList<>();
+        System.out.println(excelData.getName());
+
+        if (StringUtils.isNotEmpty(excelData.getRegistrationcapital()) && !CheckUtils.isNumeric(excelData.getRegistrationcapital())) {
+            log.info("注册资本(万元):{}",excelData.getRegistrationcapital());
+            js.put("registrationcapital", "注册资本(万元)格式有误," + ExcelPatternMsgUtils.NUMBER_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getPracticalcapital()) && !CheckUtils.isTaxNum(excelData.getPracticalcapital())) {
+            log.info("实缴资本(万元):{}", excelData.getPracticalcapital());
+            js.put("practicalcapital", "实缴资本(万元)格式有误," + ExcelPatternMsgUtils.TAX_NUM_MSG);
+        }
+        if (!StringUtils.isEmpty(excelData.getRegistrationdate()) && !CheckUtils.isDate(excelData.getRegistrationdate())){
+            System.out.println("getRegistrationdate");
+            js.put("registrationdate", "成立日期格式有误,"+ ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getOperatingperiod()) && !CheckUtils.isDate(excelData.getOperatingperiod())) {
+            log.info("营业期限:{}",excelData.getOperatingperiod());
+            js.put("operatingperiod", "营业期限格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getApprovaltime()) && !CheckUtils.isDate(excelData.getApprovaltime())) {
+            log.info("营业期限:{}",excelData.getApprovaltime());
+            js.put("approvaltime", "核准日期格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getEmphasisdate()) && !CheckUtils.isDate(excelData.getEmphasisdate())) {
+            log.info("省级重点企业研究院认定年份:{}",excelData.getEyasdate());
+            js.put("emphasisdate","省级重点企业研究院认定年份格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getProvincialdate()) && !CheckUtils.isDate(excelData.getProvincialdate())) {
+            log.info("省级企业研究院认定年份:{}",excelData.getProvincialdate());
+            js.put("provincialdate:{}","省级企业研究院认定年份格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getHighandnewdate()) && !CheckUtils.isDate(excelData.getHighandnewdate())) {
+            js.put("highandnewdate","浙江省高新技术研究开发中心认定年份格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getProvincesciencesmalldate()) && !CheckUtils.isDate(excelData.getProvincesciencesmalldate())) {
+            js.put("provincesciencesmalldate","省科小认定年份格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getEyasdate()) && !CheckUtils.isDate(excelData.getEyasdate())) {
+            js.put("eyasdate","雏鹰计划认定年份格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getMunicipalresearchdate()) && !CheckUtils.isDate(excelData.getMunicipalresearchdate())) {
+            js.put("municipalresearchdate","市级研发中心认定年份格式有误," + ExcelPatternMsgUtils.DATE2_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getLegalrepresentativetel()) && !CheckUtils.isTelephone(excelData.getLegalrepresentativetel())) {
+            log.info("企业法定代表人联系电话," + excelData.getLegalrepresentativetel());
+            js.put("legalrepresentativetel","企业法定代表人联系电话格式有误," + ExcelPatternMsgUtils.TEL_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getTechnologycontactphone()) && !CheckUtils.isTelephone(excelData.getTechnologycontactphone())) {
+            log.info("技术负责人联系电话," + excelData.getTechnologycontactphone());
+            js.put("technologycontactphone","技术负责人联系电话格式有误," + ExcelPatternMsgUtils.TEL_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getFinancialcontactphone()) && !CheckUtils.isTelephone(excelData.getFinancialcontactphone())) {
+            log.info("财务负责人联系电话," + excelData.getFinancialcontactphone());
+            js.put("financialcontactphone","财务负责人联系电话格式有误," + ExcelPatternMsgUtils.TEL_MSG);
+        }
+        if (StringUtils.isNotEmpty(excelData.getSciencecontactphone()) && !CheckUtils.isTelephone(excelData.getSciencecontactphone())) {
+            log.info("科技联络人联系电话," + excelData.getSciencecontactphone());
+            js.put("sciencecontactphone","财务联络人联系电话格式有误," + ExcelPatternMsgUtils.TEL_MSG);
+        }
+        System.out.println(js.toJSONString());
+        list.add(js);
+        System.out.println("企业基本信息,listttt>" + JSON.toJSONString(list));
+        return js;
+    }
+
+    /**
+     * 解析出现错误会进入该方法 具体看源代码或文档
+     */
+    @Override
+    public void onException(Exception exception, AnalysisContext context) throws Exception {
+        throw exception;
+    }
+
+}

+ 18 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/exception/ExcelHeadException.java

@@ -0,0 +1,18 @@
+package com.pavis.app.saasbacken.exception;
+
+import com.pavis.app.saasbacken.http.ErrorCode;
+
+public class ExcelHeadException extends BaseException {
+
+    public ExcelHeadException() {
+        this(ErrorCode.ERROR.getCode(), ErrorCode.ERROR.getMessage());
+    }
+
+    public ExcelHeadException(String msg) {
+        this(ErrorCode.ERROR.getCode(), msg);
+    }
+
+    public ExcelHeadException(int code, String msg) {
+        super(code, msg);
+    }
+}

+ 2 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/exception/GlobalExceptionHandler.java

@@ -74,6 +74,8 @@ public class GlobalExceptionHandler {
             code = ErrorCode.FAIL;
         }else if (className.contains("IsRelationExistException")) {
             code = ErrorCode.IS_RELATION_EXIST;
+        }else if (className.contains("ExcelHeadException")) {
+            code = ErrorCode.ERROR_EXCEL_HEAD;
         }
         return buildBody(ex, code, path, httpStatus);
     }

+ 3 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/http/ErrorCode.java

@@ -43,6 +43,9 @@ public enum ErrorCode {
     ILLEGAL_ARGUMENT(4034, "illegal_argument"),
     FILENAME_NULL(4035,"filename_null"),
 
+    // excel头部信息报错。
+    ERROR_EXCEL_HEAD(5001,"error_excel_head"),
+
 
     /**
      * 系统错误

+ 190 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/utils/CheckUtils.java

@@ -0,0 +1,190 @@
+package com.pavis.app.saasbacken.utils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @program: push-saas
+ * @description:
+ * @author: Guanzi
+ * @created: 2021/12/02 15:39
+ */
+public class CheckUtils {
+
+    /**
+     * 判断是否数字
+     *
+     * @param str
+     * @return
+     */
+    public static boolean isNumeric(String str) {
+        Pattern pattern = Pattern.compile("[0-9]*");
+        return pattern.matcher(str).matches();
+    }
+
+    /**
+     * 匹配税额,
+     * 正负证书或正负小数
+     * @param str
+     * @return
+     */
+    public static boolean isTaxNum(String str){
+        String regex = ExcelPatternMsgUtils.TAX_NUM;
+        return match(regex, str);
+    }
+
+    /**
+     * 验证。
+     * @param regex
+     * @param str
+     * @return
+     */
+    private static boolean match(String regex, String str) {
+        Pattern pattern = Pattern.compile(regex);
+        Matcher matcher = pattern.matcher(str);
+        return matcher.matches();
+    }
+
+    /**
+     * 验证日期时间
+     *
+     * @param str
+     * @return 如果是符合网址格式的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isDate(String str) {
+        // 严格验证时间格式的(匹配[2002-01-31], [1997-04-30],
+        // [2004-01-01])不匹配([2002-01-32], [2003-02-29], [04-01-01])
+        // String regex =
+        // "^((((19|20)(([02468][048])|([13579][26]))-02-29))|((20[0-9][0-9])|(19[0-9][0-9]))-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((01,3-9])|(1[0-2]))-(29|30)))))$";
+        // 没加时间验证的YYYY-MM-DD
+        // String regex =
+        // "^((((1[6-9]|[2-9]\\d)\\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|(((1[6-9]|[2-9]\\d)\\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|(((1[6-9]|[2-9]\\d)\\d{2})-0?2-(0?[1-9]|1\\d|2[0-8]))|(((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$";
+        // 加了时间验证的YYYY-MM-DD 00:00:00
+        // String regex = "^((((1[6-9]|[2-9]\\d)\\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|(((1[6-9]|[2-9]\\d)\\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|(((1[6-9]|[2-9]\\d)\\d{2})-0?2-(0?[1-9]|1\\d|2[0-8]))|(((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-)) (20|21|22|23|[0-1]?\\d):[0-5]?\\d:[0-5]?\\d$";
+        String regex = ExcelPatternMsgUtils.DATE2;
+        return match(regex, str);
+    }
+
+    /**
+     * 是否是中文
+     */
+    public static boolean isChinese(String str) {
+        String regEx = ExcelPatternMsgUtils.CHINESE;
+        Pattern p = Pattern.compile(regEx);
+        Matcher m = p.matcher(str);
+        if (m.find())
+            return true;
+        else
+            return false;
+    }
+
+    /**
+     * 身份证号码正则
+     *
+     * @param num 身份证号码
+     * @return ture false
+     * @author chen.cong
+     * @version 1.0, 2018年3月23日
+     */
+    public static boolean verForm(String num) {
+        String reg = ExcelPatternMsgUtils.IDCARD;
+        if (!num.matches(reg)) {
+            System.out.println("Format Error!");
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 验证非零的正整数
+     *
+     * @param str
+     * @return 如果是符合格式的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isIntNumber(String str) {
+        return match(ExcelPatternMsgUtils.INT_NUMBER, str);
+    }
+
+    /**
+     * 验证邮箱
+     *
+     * @param str
+     * @return 如果是符合的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isEmail(String str) {
+        return match(ExcelPatternMsgUtils.MAIL, str);
+    }
+
+    /**
+     * 验证输入邮政编号
+     *
+     * @param str
+     * @return 如果是符合格式的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isPostalcode(String str) {
+        return match(ExcelPatternMsgUtils.POSTAL_CODE, str);
+    }
+
+    /**
+     * 验证网址Url
+     *
+     * @param str
+     * @return 如果是符合格式的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isUrl(String str) {
+        return match(ExcelPatternMsgUtils.WEBSITE, str);
+    }
+
+    /**
+     * 验证电话号码
+     *
+     * @param str
+     * @return 如果是符合格式的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isTelephone(String str) {
+        return match(ExcelPatternMsgUtils.TEL_OR_PHONE, str);
+        // return match(ExcelPatternMsgUtils.TEL, str);
+    }
+
+
+    /**
+     * 验证输入手机号码
+     *
+     * @param str
+     * @return 如果是符合格式的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isHandset(String str) {
+        return match(ExcelPatternMsgUtils.PHONE, str);
+    }
+
+    /**
+     * 只能输入整数或者小数
+     * @param str
+     * @return
+     */
+    public static boolean isDECIMALOrXS(String str){
+        return match(ExcelPatternMsgUtils.DECIMAL,str);
+    }
+
+    /**
+     * 判断是否为数字和字母的组合。
+     * @param str
+     * @return
+     */
+    public static boolean isLetterDigit(String str) {
+        // String regex = "[A-Z,a-z,0-9,-]*";
+        String regex = ExcelPatternMsgUtils.NUMBER_LETTER;
+        return match(regex, str);
+    }
+    /**
+     * 验证输入两位小数
+     *
+     * @param str
+     * @return 如果是符合格式的字符串,返回 <b>true </b>,否则为 <b>false </b>
+     */
+    public static boolean isDecimal(String str) {
+        return match(ExcelPatternMsgUtils.TWO_DECIMAL, str);
+    }
+
+
+}

File diff suppressed because it is too large
+ 157 - 0
saas-backen/src/main/java/com/pavis/app/saasbacken/utils/ExcelPatternMsgUtils.java


Some files were not shown because too many files changed in this diff