Browse Source

异步接口定时轮询 (未完成...)

JoeLazy 3 months ago
parent
commit
2bc236213e

+ 26 - 0
src/main/java/com/sundata/internalevaluation/business/mapper/IrbonlineAsynTaskInfoMapper.java

@@ -0,0 +1,26 @@
+package com.sundata.internalevaluation.business.mapper;
+
+import com.sundata.internalevaluation.business.model.IrbonlineAsynTaskInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author JoeLazy
+ * @date 2025-02-27 18:16:01
+ * @description: mapper接口
+ */
+
+@Mapper
+public interface IrbonlineAsynTaskInfoMapper {
+
+    /**
+     * 根据任务的状态查询任务
+     * @param status 状态的列表
+     * @return 任务列表信息
+     */
+    List<IrbonlineAsynTaskInfo> getTaskInfoListByStatus(@Param("status") String[] status);
+}

+ 182 - 0
src/main/java/com/sundata/internalevaluation/business/model/IrbonlineAsynTaskInfo.java

@@ -0,0 +1,182 @@
+package com.sundata.internalevaluation.business.model;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author JoeLazy
+ * @date 2025-02-27 16:51:55
+ * @description: 异步接口任务表
+ */
+public class IrbonlineAsynTaskInfo {
+
+    /**
+     * 接口流水号   任务编号
+     */
+    private String taskId;
+
+
+    /**
+     * 申请单号
+     */
+    private String applyNo;
+
+
+    /**
+     * 授信类型   1-预授信,2-授信
+     */
+    private String credType;
+
+
+    /**
+     * 规则集编号
+     */
+    private String rulesNo;
+
+
+    /**
+     * 模型编号
+     */
+    private String modelNo;
+
+
+    /**
+     * 授信方案编号
+     */
+    private String creditNo;
+
+
+    /**
+     * 任务状态   01-处理完成,02处理中,03-未处理,04-处理失败
+     */
+    private String taskStatus;
+
+
+    public IrbonlineAsynTaskInfo() {
+    }
+
+    public IrbonlineAsynTaskInfo(String taskId, String applyNo, String credType, String rulesNo, String modelNo, String creditNo, String taskStatus) {
+        this.taskId = taskId;
+        this.applyNo = applyNo;
+        this.credType = credType;
+        this.rulesNo = rulesNo;
+        this.modelNo = modelNo;
+        this.creditNo = creditNo;
+        this.taskStatus = taskStatus;
+    }
+
+    /**
+     * 获取
+     * @return taskId
+     */
+    public String getTaskId() {
+        return taskId;
+    }
+
+    /**
+     * 设置
+     * @param taskId
+     */
+    public void setTaskId(String taskId) {
+        this.taskId = taskId;
+    }
+
+    /**
+     * 获取
+     * @return applyNo
+     */
+    public String getApplyNo() {
+        return applyNo;
+    }
+
+    /**
+     * 设置
+     * @param applyNo
+     */
+    public void setApplyNo(String applyNo) {
+        this.applyNo = applyNo;
+    }
+
+    /**
+     * 获取
+     * @return credType
+     */
+    public String getCredType() {
+        return credType;
+    }
+
+    /**
+     * 设置
+     * @param credType
+     */
+    public void setCredType(String credType) {
+        this.credType = credType;
+    }
+
+    /**
+     * 获取
+     * @return rulesNo
+     */
+    public String getRulesNo() {
+        return rulesNo;
+    }
+
+    /**
+     * 设置
+     * @param rulesNo
+     */
+    public void setRulesNo(String rulesNo) {
+        this.rulesNo = rulesNo;
+    }
+
+    /**
+     * 获取
+     * @return modelNo
+     */
+    public String getModelNo() {
+        return modelNo;
+    }
+
+    /**
+     * 设置
+     * @param modelNo
+     */
+    public void setModelNo(String modelNo) {
+        this.modelNo = modelNo;
+    }
+
+    /**
+     * 获取
+     * @return creditNo
+     */
+    public String getCreditNo() {
+        return creditNo;
+    }
+
+    /**
+     * 设置
+     * @param creditNo
+     */
+    public void setCreditNo(String creditNo) {
+        this.creditNo = creditNo;
+    }
+
+    /**
+     * 获取
+     * @return taskStatus
+     */
+    public String getTaskStatus() {
+        return taskStatus;
+    }
+
+    /**
+     * 设置
+     * @param taskStatus
+     */
+    public void setTaskStatus(String taskStatus) {
+        this.taskStatus = taskStatus;
+    }
+
+    public String toString() {
+        return "IrbonlineAsynTaskInfo{taskId = " + taskId + ", applyNo = " + applyNo + ", credType = " + credType + ", rulesNo = " + rulesNo + ", modelNo = " + modelNo + ", creditNo = " + creditNo + ", taskStatus = " + taskStatus + "}";
+    }
+}

+ 670 - 0
src/main/java/com/sundata/internalevaluation/business/model/IrbonlineRecApplyInfo.java

@@ -0,0 +1,670 @@
+package com.sundata.internalevaluation.business.model;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author JoeLazy
+ * @date 2025-02-27 19:47:27
+ * @description: 预授信、授信申请信息
+ */
+public class IrbonlineRecApplyInfo {
+
+
+    /**
+     * 申请编号
+     */
+    private String applyNo;
+
+
+    /**
+     * 授信类型  1-预授信,2-授信
+     */
+    private String credType;
+
+
+    /**
+     * 预授信申请单号
+     */
+    private String creditApplyNo;
+
+
+    /**
+     * 证件编号  身份证号需要脱敏,前4位和最后2位展示原值,其余 * 代替
+     */
+    private String cardNo;
+
+
+    /**
+     * 申请人姓名
+     */
+    private String applyName;
+
+
+    /**
+     * 信贷客户号
+     */
+    private String custNo;
+
+
+    /**
+     * 产品编号
+     */
+    private String productCode;
+
+
+    /**
+     * 是否白名单
+     */
+    private Integer isWhiteList;
+
+
+    /**
+     * 月收入
+     */
+    private BigDecimal monthlyIncome;
+
+
+    /**
+     * 职业
+     */
+    private String profession;
+
+
+    /**
+     * 职务
+     */
+    private String job;
+
+
+    /**
+     * 职级
+     */
+    private String ranks;
+
+
+    /**
+     * 优惠利率类型
+     */
+    private String discountRateType;
+
+
+    /**
+     * 优惠利率
+     */
+    private BigDecimal discountRate;
+
+
+    /**
+     * 利率   通过优惠利率类型 优惠利率计算
+     */
+    private BigDecimal rate;
+
+
+    /**
+     * 贷款期限
+     */
+    private BigDecimal deadline;
+
+
+    /**
+     * 意向额度
+     */
+    private BigDecimal intentionQuota;
+
+
+    /**
+     * 白名单单位类型
+     */
+    private String whiteUnitsType;
+
+
+    /**
+     * 报名单单位小类
+     */
+    private String whiteUnitsSmallType;
+
+
+    /**
+     * 征信流水号  夜间批次查询征信保存
+     */
+    private String crereptNo;
+
+
+    /**
+     * 是否担保人  0-否,1-是
+     */
+    private Integer isGaurtor;
+
+
+    /**
+     * 是否需要担保人 0-否,1-是
+     */
+    private Integer isNeed;
+
+
+    /**
+     * 申请状态  1-处理中,2-处理成功,3-处理失败
+     */
+    private String applyStatus;
+
+
+    /**
+     * 申请时间 接受请求时间  yyyy-MM-dd HH:mm:ss
+     */
+    private LocalDateTime applyTime;
+
+
+    /**
+     * 开始时间  接受请求时间  yyyy-MM-dd HH:mm:ss
+     */
+    private LocalDateTime startTime;
+
+
+    /**
+     * 完成时间  计算完成时间  yyyy-MM-dd HH:mm:ss
+     */
+    private LocalDateTime finishTime;
+
+
+    /**
+     * 申请日期  yyyy-MM-dd
+     */
+    private LocalDate applyDate;
+
+
+    /**
+     * 接口流水号
+     */
+    private String taskId;
+
+
+    public IrbonlineRecApplyInfo() {
+    }
+
+    public IrbonlineRecApplyInfo(String applyNo, String credType, String creditApplyNo, String cardNo, String applyName, String custNo, String productCode, Integer isWhiteList, BigDecimal monthlyIncome, String profession, String job, String ranks, String discountRateType, BigDecimal discountRate, BigDecimal rate, BigDecimal deadline, BigDecimal intentionQuota, String whiteUnitsType, String whiteUnitsSmallType, String crereptNo, Integer isGaurtor, Integer isNeed, String applyStatus, LocalDateTime applyTime, LocalDateTime startTime, LocalDateTime finishTime, LocalDate applyDate, String taskId) {
+        this.applyNo = applyNo;
+        this.credType = credType;
+        this.creditApplyNo = creditApplyNo;
+        this.cardNo = cardNo;
+        this.applyName = applyName;
+        this.custNo = custNo;
+        this.productCode = productCode;
+        this.isWhiteList = isWhiteList;
+        this.monthlyIncome = monthlyIncome;
+        this.profession = profession;
+        this.job = job;
+        this.ranks = ranks;
+        this.discountRateType = discountRateType;
+        this.discountRate = discountRate;
+        this.rate = rate;
+        this.deadline = deadline;
+        this.intentionQuota = intentionQuota;
+        this.whiteUnitsType = whiteUnitsType;
+        this.whiteUnitsSmallType = whiteUnitsSmallType;
+        this.crereptNo = crereptNo;
+        this.isGaurtor = isGaurtor;
+        this.isNeed = isNeed;
+        this.applyStatus = applyStatus;
+        this.applyTime = applyTime;
+        this.startTime = startTime;
+        this.finishTime = finishTime;
+        this.applyDate = applyDate;
+        this.taskId = taskId;
+    }
+
+    /**
+     * 获取
+     * @return applyNo
+     */
+    public String getApplyNo() {
+        return applyNo;
+    }
+
+    /**
+     * 设置
+     * @param applyNo
+     */
+    public void setApplyNo(String applyNo) {
+        this.applyNo = applyNo;
+    }
+
+    /**
+     * 获取
+     * @return credType
+     */
+    public String getCredType() {
+        return credType;
+    }
+
+    /**
+     * 设置
+     * @param credType
+     */
+    public void setCredType(String credType) {
+        this.credType = credType;
+    }
+
+    /**
+     * 获取
+     * @return creditApplyNo
+     */
+    public String getCreditApplyNo() {
+        return creditApplyNo;
+    }
+
+    /**
+     * 设置
+     * @param creditApplyNo
+     */
+    public void setCreditApplyNo(String creditApplyNo) {
+        this.creditApplyNo = creditApplyNo;
+    }
+
+    /**
+     * 获取
+     * @return cardNo
+     */
+    public String getCardNo() {
+        return cardNo;
+    }
+
+    /**
+     * 设置
+     * @param cardNo
+     */
+    public void setCardNo(String cardNo) {
+        this.cardNo = cardNo;
+    }
+
+    /**
+     * 获取
+     * @return applyName
+     */
+    public String getApplyName() {
+        return applyName;
+    }
+
+    /**
+     * 设置
+     * @param applyName
+     */
+    public void setApplyName(String applyName) {
+        this.applyName = applyName;
+    }
+
+    /**
+     * 获取
+     * @return custNo
+     */
+    public String getCustNo() {
+        return custNo;
+    }
+
+    /**
+     * 设置
+     * @param custNo
+     */
+    public void setCustNo(String custNo) {
+        this.custNo = custNo;
+    }
+
+    /**
+     * 获取
+     * @return productCode
+     */
+    public String getProductCode() {
+        return productCode;
+    }
+
+    /**
+     * 设置
+     * @param productCode
+     */
+    public void setProductCode(String productCode) {
+        this.productCode = productCode;
+    }
+
+    /**
+     * 获取
+     * @return isWhiteList
+     */
+    public Integer getIsWhiteList() {
+        return isWhiteList;
+    }
+
+    /**
+     * 设置
+     * @param isWhiteList
+     */
+    public void setIsWhiteList(Integer isWhiteList) {
+        this.isWhiteList = isWhiteList;
+    }
+
+    /**
+     * 获取
+     * @return monthlyIncome
+     */
+    public BigDecimal getMonthlyIncome() {
+        return monthlyIncome;
+    }
+
+    /**
+     * 设置
+     * @param monthlyIncome
+     */
+    public void setMonthlyIncome(BigDecimal monthlyIncome) {
+        this.monthlyIncome = monthlyIncome;
+    }
+
+    /**
+     * 获取
+     * @return profession
+     */
+    public String getProfession() {
+        return profession;
+    }
+
+    /**
+     * 设置
+     * @param profession
+     */
+    public void setProfession(String profession) {
+        this.profession = profession;
+    }
+
+    /**
+     * 获取
+     * @return job
+     */
+    public String getJob() {
+        return job;
+    }
+
+    /**
+     * 设置
+     * @param job
+     */
+    public void setJob(String job) {
+        this.job = job;
+    }
+
+    /**
+     * 获取
+     * @return ranks
+     */
+    public String getRanks() {
+        return ranks;
+    }
+
+    /**
+     * 设置
+     * @param ranks
+     */
+    public void setRanks(String ranks) {
+        this.ranks = ranks;
+    }
+
+    /**
+     * 获取
+     * @return discountRateType
+     */
+    public String getDiscountRateType() {
+        return discountRateType;
+    }
+
+    /**
+     * 设置
+     * @param discountRateType
+     */
+    public void setDiscountRateType(String discountRateType) {
+        this.discountRateType = discountRateType;
+    }
+
+    /**
+     * 获取
+     * @return discountRate
+     */
+    public BigDecimal getDiscountRate() {
+        return discountRate;
+    }
+
+    /**
+     * 设置
+     * @param discountRate
+     */
+    public void setDiscountRate(BigDecimal discountRate) {
+        this.discountRate = discountRate;
+    }
+
+    /**
+     * 获取
+     * @return rate
+     */
+    public BigDecimal getRate() {
+        return rate;
+    }
+
+    /**
+     * 设置
+     * @param rate
+     */
+    public void setRate(BigDecimal rate) {
+        this.rate = rate;
+    }
+
+    /**
+     * 获取
+     * @return deadline
+     */
+    public BigDecimal getDeadline() {
+        return deadline;
+    }
+
+    /**
+     * 设置
+     * @param deadline
+     */
+    public void setDeadline(BigDecimal deadline) {
+        this.deadline = deadline;
+    }
+
+    /**
+     * 获取
+     * @return intentionQuota
+     */
+    public BigDecimal getIntentionQuota() {
+        return intentionQuota;
+    }
+
+    /**
+     * 设置
+     * @param intentionQuota
+     */
+    public void setIntentionQuota(BigDecimal intentionQuota) {
+        this.intentionQuota = intentionQuota;
+    }
+
+    /**
+     * 获取
+     * @return whiteUnitsType
+     */
+    public String getWhiteUnitsType() {
+        return whiteUnitsType;
+    }
+
+    /**
+     * 设置
+     * @param whiteUnitsType
+     */
+    public void setWhiteUnitsType(String whiteUnitsType) {
+        this.whiteUnitsType = whiteUnitsType;
+    }
+
+    /**
+     * 获取
+     * @return whiteUnitsSmallType
+     */
+    public String getWhiteUnitsSmallType() {
+        return whiteUnitsSmallType;
+    }
+
+    /**
+     * 设置
+     * @param whiteUnitsSmallType
+     */
+    public void setWhiteUnitsSmallType(String whiteUnitsSmallType) {
+        this.whiteUnitsSmallType = whiteUnitsSmallType;
+    }
+
+    /**
+     * 获取
+     * @return crereptNo
+     */
+    public String getCrereptNo() {
+        return crereptNo;
+    }
+
+    /**
+     * 设置
+     * @param crereptNo
+     */
+    public void setCrereptNo(String crereptNo) {
+        this.crereptNo = crereptNo;
+    }
+
+    /**
+     * 获取
+     * @return isGaurtor
+     */
+    public Integer getIsGaurtor() {
+        return isGaurtor;
+    }
+
+    /**
+     * 设置
+     * @param isGaurtor
+     */
+    public void setIsGaurtor(Integer isGaurtor) {
+        this.isGaurtor = isGaurtor;
+    }
+
+    /**
+     * 获取
+     * @return isNeed
+     */
+    public Integer getIsNeed() {
+        return isNeed;
+    }
+
+    /**
+     * 设置
+     * @param isNeed
+     */
+    public void setIsNeed(Integer isNeed) {
+        this.isNeed = isNeed;
+    }
+
+    /**
+     * 获取
+     * @return applyStatus
+     */
+    public String getApplyStatus() {
+        return applyStatus;
+    }
+
+    /**
+     * 设置
+     * @param applyStatus
+     */
+    public void setApplyStatus(String applyStatus) {
+        this.applyStatus = applyStatus;
+    }
+
+    /**
+     * 获取
+     * @return applyTime
+     */
+    public LocalDateTime getApplyTime() {
+        return applyTime;
+    }
+
+    /**
+     * 设置
+     * @param applyTime
+     */
+    public void setApplyTime(LocalDateTime applyTime) {
+        this.applyTime = applyTime;
+    }
+
+    /**
+     * 获取
+     * @return startTime
+     */
+    public LocalDateTime getStartTime() {
+        return startTime;
+    }
+
+    /**
+     * 设置
+     * @param startTime
+     */
+    public void setStartTime(LocalDateTime startTime) {
+        this.startTime = startTime;
+    }
+
+    /**
+     * 获取
+     * @return finishTime
+     */
+    public LocalDateTime getFinishTime() {
+        return finishTime;
+    }
+
+    /**
+     * 设置
+     * @param finishTime
+     */
+    public void setFinishTime(LocalDateTime finishTime) {
+        this.finishTime = finishTime;
+    }
+
+    /**
+     * 获取
+     * @return applyDate
+     */
+    public LocalDate getApplyDate() {
+        return applyDate;
+    }
+
+    /**
+     * 设置
+     * @param applyDate
+     */
+    public void setApplyDate(LocalDate applyDate) {
+        this.applyDate = applyDate;
+    }
+
+    /**
+     * 获取
+     * @return taskId
+     */
+    public String getTaskId() {
+        return taskId;
+    }
+
+    /**
+     * 设置
+     * @param taskId
+     */
+    public void setTaskId(String taskId) {
+        this.taskId = taskId;
+    }
+
+    public String toString() {
+        return "IrbonlineRecApplyInfo{applyNo = " + applyNo + ", credType = " + credType + ", creditApplyNo = " + creditApplyNo + ", cardNo = " + cardNo + ", applyName = " + applyName + ", custNo = " + custNo + ", productCode = " + productCode + ", isWhiteList = " + isWhiteList + ", monthlyIncome = " + monthlyIncome + ", profession = " + profession + ", job = " + job + ", ranks = " + ranks + ", discountRateType = " + discountRateType + ", discountRate = " + discountRate + ", rate = " + rate + ", deadline = " + deadline + ", intentionQuota = " + intentionQuota + ", whiteUnitsType = " + whiteUnitsType + ", whiteUnitsSmallType = " + whiteUnitsSmallType + ", crereptNo = " + crereptNo + ", isGaurtor = " + isGaurtor + ", isNeed = " + isNeed + ", applyStatus = " + applyStatus + ", applyTime = " + applyTime + ", startTime = " + startTime + ", finishTime = " + finishTime + ", applyDate = " + applyDate + ", taskId = " + taskId + "}";
+    }
+}

+ 23 - 0
src/main/java/com/sundata/internalevaluation/business/mybatis/IrbonlAsynTaskInfoMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sundata.internalevaluation.business.mapper.IrbonlineAsynTaskInfoMapper">
+    <select id="getTaskInfoListByStatus" resultType="com.sundata.internalevaluation.business.model.IrbonlineAsynTaskInfo"
+            parameterType="arraylist">
+        select
+        taskId as taskId,
+        applyNo as applyNo,
+        credType as credType,
+        rulesNo as rulesNo,
+        modelNo as modelNo,
+        creditNo as creditNo,
+        tasktatus as taskStatus
+        from irbonlne_asyntaskinfo
+        where taskStatus in
+        <foreach collection="status" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+
+    </select>
+</mapper>

+ 36 - 0
src/main/java/com/sundata/internalevaluation/business/service/IrbonlineAsynTaskInfoService.java

@@ -0,0 +1,36 @@
+package com.sundata.internalevaluation.business.service;
+
+import com.sundata.internalevaluation.business.mapper.IrbonlineAsynTaskInfoMapper;
+import com.sundata.internalevaluation.business.model.IrbonlineAsynTaskInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author JoeLazy
+ * @date 2025-02-27 18:12:36
+ * @description: 异步接口任务 服务层
+ */
+
+@Service
+public class IrbonlineAsynTaskInfoService {
+
+
+    @Autowired
+    private IrbonlineAsynTaskInfoMapper irbonlineAsynTaskInfoMapper;
+
+    /**
+     * 根据任务的状态查询任务
+     * @param status 状态的列表
+     * @return 任务列表信息
+     */
+    public List<IrbonlineAsynTaskInfo> getTaskInfoListByStatus(String ... status) {
+        return irbonlineAsynTaskInfoMapper.getTaskInfoListByStatus(status);
+    }
+
+
+
+}

+ 18 - 0
src/main/java/com/sundata/internalevaluation/business/service/IrbonlineRecApplyInfoService.java

@@ -0,0 +1,18 @@
+package com.sundata.internalevaluation.business.service;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author JoeLazy
+ * @date 2025-02-28 09:29:30
+ * @description: 预授信、授信  服务层
+ */
+
+@Service
+public class IrbonlineRecApplyInfoService {
+
+
+
+}

+ 36 - 0
src/main/java/com/sundata/internalevaluation/task/AsyncTask.java

@@ -0,0 +1,36 @@
+package com.sundata.internalevaluation.task;
+
+import com.sundata.internalevaluation.business.model.IrbonlineAsynTaskInfo;
+import com.sundata.internalevaluation.business.service.IrbonlineAsynTaskInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author JoeLazy
+ * @date 2025-02-27 16:22:55
+ * @description: 异步调用的规则集定时任务
+ */
+
+//@Configuration
+@EnableAsync
+@EnableScheduling
+public class AsyncTask {
+
+    @Autowired
+    private IrbonlineAsynTaskInfoService irbonlineAsynTaskInfoService;
+
+
+    @Async
+    @Scheduled(fixedRate = 1000, initialDelay = 5000)
+    public void asyncCalcRulesTask() {
+        List<IrbonlineAsynTaskInfo> taskInfoListByStatus = irbonlineAsynTaskInfoService.getTaskInfoListByStatus("03");
+        System.out.println("异步调用的规则集定时任务");
+    }
+}