|  |  | 
 |  |  | import com.doumee.core.constants.ResponseStatus; | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.dao.business.model.Solutions; | 
 |  |  | import io.swagger.models.auth.In; | 
 |  |  | import org.apache.commons.collections4.CollectionUtils; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  |  | 
 |  |  | import java.io.File; | 
 |  |  | import java.io.FileOutputStream; | 
 |  |  | import java.io.InputStream; | 
 |  |  | import java.io.OutputStream; | 
 |  |  | import java.math.BigDecimal; | 
 |  |  | import java.net.URL; | 
 |  |  | import java.net.URLDecoder; | 
 |  |  | import java.time.LocalDate; | 
 |  |  | import java.time.temporal.ChronoUnit; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.regex.Matcher; | 
 |  |  | 
 |  |  |     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 SIGN_DONE_NOTIFY_URL = "SIGN_DONE_NOTIFY_URL"; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 企业数据来源 0平台注册 1后台导入 | 
 |  |  | 
 |  |  |         } | 
 |  |  |         return d.intValue(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static long getAgeByIdCard(String idCard){ | 
 |  |  |         int birthYear = Integer.parseInt(idCard.substring(6, 10)); | 
 |  |  |         int birthMonth = Integer.parseInt(idCard.substring(10, 12)); | 
 |  |  |         int birthDay = Integer.parseInt(idCard.substring(12, 14)); | 
 |  |  |  | 
 |  |  |         LocalDate birthDate = LocalDate.of(birthYear, birthMonth, birthDay); | 
 |  |  |         LocalDate currentDate = LocalDate.now(); | 
 |  |  |         long age = ChronoUnit.YEARS.between(birthDate, currentDate); | 
 |  |  |         return age; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static Integer getSexByIdCard(String idCard){ | 
 |  |  |         Pattern pattern = Pattern.compile("\\d{17}[\\d|x]"); // 定义身份证号码格式的正则表达式 | 
 |  |  |         Matcher matcher = pattern.matcher(idCard); | 
 |  |  |         Integer sex = 1; | 
 |  |  |         if (matcher.matches()) { | 
 |  |  |             int genderCode = Integer.parseInt(idCard.substring(16, 17)); // 从第17位开始提取性别编码(奇数为男性,偶数为女性) | 
 |  |  |  | 
 |  |  |             if ((genderCode % 2 == 1)) { | 
 |  |  |                 sex = 1; | 
 |  |  |             } else { | 
 |  |  |                 sex = 2; | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |            sex = -1; | 
 |  |  |         } | 
 |  |  |         return sex; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 状态 0已保存、1待审核、2审核通过、3退回修改、4审核驳回、5待服务机构确认、6服务机构拒绝、7已分配服务机构、8诊断中 | 
 |  |  |      * (成功上传第一份服务资料)、9服务完成、10已分配评分专家、11已完成(专家上传评分) 12退回修改中 13 已完成退回修改 | 
 |  |  | 
 |  |  |     public  enum SettleClaimsStatus { | 
 |  |  |         WAIT_ACCEPTANCE(0, "待受理"), | 
 |  |  |         RETURN_ACCEPTANCE(1, "退回受理"), | 
 |  |  |         CONFIRM_INFORMATION(2, "确认资料"), | 
 |  |  |         FINISH_ACCEPTANCE(3, "完成受理"), | 
 |  |  |         DEAL_ING(2, "受理中"), | 
 |  |  |         CONFIRM_INFORMATION(3, "确认资料"), | 
 |  |  |         FINISH_ACCEPTANCE(4, "完成受理"), | 
 |  |  |         ; | 
 |  |  |         // 成员变量 | 
 |  |  |         private String name; | 
 |  |  | 
 |  |  |     public  enum SettleClaimsLogType { | 
 |  |  |         UPLOAD(0, "提交报案","提交意见:${param}"), | 
 |  |  |         PLATFORM_RETURN(1, "平台退回","提交意见:${param}"), | 
 |  |  |         CONFIRM_INFORMATION(2, "平台确认资料","提交意见:${param}"), | 
 |  |  |         PLATFORM_CONFIRM_INFORMATION(2, "平台确认资料",""), | 
 |  |  |         PLATFORM_FINISH(3, "平台完成受理","提交意见:${param}"), | 
 |  |  |         UPDATE_DATA(4, "修改信息","提交意见:${param}"), | 
 |  |  |         SUPPLEMENT(5, "补充说明","提交意见:${param}"), | 
 |  |  |         COMPANY_APPLY_RETURN(6, "平台理赔处理","提交意见:${param}"), | 
 |  |  |         COMPANY_APPLY_CLOSE(7, "平台备注标签",""), | 
 |  |  |         PLATFORM_AGREE_BACK(8, "平台添加报案号",""), | 
 |  |  |         PLATFORM_LP_DEAL(6, "平台理赔处理","提交意见:${param}"), | 
 |  |  |         PLATFORM_REMARK(7, "平台备注标签",""), | 
 |  |  |         PLATFORM_ADDCODE(8, "平台添加报案号",""), | 
 |  |  |         PLATFORM_UN_AGREE_BACK(9, "企业下载资料",""), | 
 |  |  |         COMPANY_EDIT(10, "平台下载资料",""), | 
 |  |  |         PLATFORM_DOWNLOAD(10, "平台下载资料",""), | 
 |  |  |         PLATFORM_CHECK_PASS(11, "平台上传资料",""), | 
 |  |  |         ; | 
 |  |  |         // 成员变量 | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | //3=退回申请;4=平台审批通过;0=审批驳回;5=平台审批驳回 | 
 |  |  |     public  enum ApplyChangeLogStatus { | 
 |  |  |         UPLOAD(0, "发起申请"), | 
 |  |  |         RETURN_APPLY(3, "发起退回申请"), | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public  enum ProjectRecord { | 
 |  |  |  | 
 |  |  | 
 |  |  |             this.des = des; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static File getFileByNetFile(String url,String fileName)   { | 
 |  |  |         //对本地文件命名 | 
 |  |  |         File file = null; | 
 |  |  |         try { | 
 |  |  |             URL urlfile; | 
 |  |  |             InputStream inStream = null; | 
 |  |  |             OutputStream os = null; | 
 |  |  |             try { | 
 |  |  |                 file = File.createTempFile("", fileName); | 
 |  |  |                 //下载 | 
 |  |  |                 urlfile = new URL(url); | 
 |  |  |                 inStream = urlfile.openStream(); | 
 |  |  |                 os = new FileOutputStream(file); | 
 |  |  |                 int bytesRead = 0; | 
 |  |  |                 byte[] buffer = new byte[8192]; | 
 |  |  |                 while ((bytesRead = inStream.read(buffer, 0, 8192)) != -1) { | 
 |  |  |                     os.write(buffer, 0, bytesRead); | 
 |  |  |                 } | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                 e.printStackTrace(); | 
 |  |  |             } finally { | 
 |  |  |                 try { | 
 |  |  |                     if (null != os) { | 
 |  |  |                         os.close(); | 
 |  |  |                     } | 
 |  |  |                     if (null != inStream) { | 
 |  |  |                         inStream.close(); | 
 |  |  |                     } | 
 |  |  |                 } catch (Exception e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }catch (Exception e){ | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return file; | 
 |  |  |     } | 
 |  |  | } |