diff --git a/infintech-executors/executor-collection-dispatcher/pom.xml b/infintech-executors/executor-collection-dispatcher/pom.xml
index 0db0707b..084ebdb4 100644
--- a/infintech-executors/executor-collection-dispatcher/pom.xml
+++ b/infintech-executors/executor-collection-dispatcher/pom.xml
@@ -86,6 +86,11 @@
mysql-connector-java
runtime
+
+ com.google.guava
+ guava
+ ${guava.version}
+
com.xuxueli
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionService.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionService.java
index bcc2d2a5..3149038e 100644
--- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionService.java
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionService.java
@@ -1,19 +1,13 @@
package com.infincash.cron.collection;
-import java.util.List;
-
public interface CronCollectionService {
/**
* 查询全部未分配订单
- * @return
- */
- List readCollection();
-
- /**
* 分配待催收订单
* @return
+ * @throws InfintechException
*/
- int assignCollection(List list);
+ void assignCollection() throws InfintechException;
/**
* 离职员工催收订单分配
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java
index d11012b1..8e646f72 100644
--- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronCollectionServiceImpl.java
@@ -1,5 +1,84 @@
package com.infincash.cron.collection;
-public class CronCollectionServiceImpl implements CronCollectionService{
+import static com.infincash.util.Jdk8DateUtils.*;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.infincash.cron.collection.mapper.TBizCollectionOverdueBucketMapper;
+import com.infincash.cron.collection.mapper.TBizCollectionRecordMapper;
+import com.infincash.cron.collection.table.TBizCollectionOverdueBucket;
+import com.infincash.cron.collection.table.TBizCollectionRecord;
+import com.xxl.job.core.log.XxlJobLogger;
+
+public class CronCollectionServiceImpl implements CronCollectionService
+{
+ @Autowired
+ TBizCollectionRecordMapper recordMapper;
+
+ @Autowired
+ TBizCollectionOverdueBucketMapper bucketMapper;
+
+ @Override
+ public void assignCollection() throws InfintechException
+ {
+ //90天以上的是坏账
+ String badDebtDay = getDateAfter(-90);
+ List rList = recordMapper.queryAll(badDebtDay);
+ if (rList == null || rList.size() == 0)
+ {
+ throw new InfintechException("recordMapper.queryAll(badDebtDay) empty! badDebtDay: " + badDebtDay);
+ }
+ List bList = bucketMapper.queryAll();
+ if (bList == null || bList.size() == 0)
+ {
+ throw new InfintechException("bucketMapper.queryAll() empty!");
+ }
+ getWhichBucket(bList, rList);
+ }
+
+ private Map> getWhichBucket(List bList, List rList)
+ {
+ // := >
+ Map> listMap = Maps.newHashMap();
+ for (TBizCollectionRecord r : rList)
+ {
+ Date d = r.getRepaymentDate();
+ Date now = new Date();
+ long diffDate = dateSubstract(now, d);
+ XxlJobLogger.log("d:" + d.toString() + ", now:" + now.toString() + ", diffDate:" + diffDate);
+ for (int i = 0; i < bList.size() - 1; i++)
+ {
+ long lbegin = bList.get(i).getLeftClosedInterval().longValue();
+ long lend = bList.get(i + 1).getLeftClosedInterval().longValue();
+ if (diffDate >= lbegin && diffDate < lend)
+ {
+ //取system_role
+ String systemRoleId = bList.get(i).gettSystemRoleId();
+ List tmpList = listMap.get(systemRoleId);
+ if (tmpList == null) {
+ tmpList = Lists.newLinkedList();
+ tmpList.add(r);
+ listMap.put(systemRoleId, tmpList);
+ } else {
+ tmpList.add(r);
+ }
+ }
+ }
+ }
+ return listMap;
+ }
+
+ @Override
+ public int assignExemployeeCollection()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
}
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/InfintechException.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/InfintechException.java
new file mode 100644
index 00000000..22e4a568
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/InfintechException.java
@@ -0,0 +1,24 @@
+package com.infincash.cron.collection;
+
+public class InfintechException extends Exception {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 807018557994813625L;
+
+ public InfintechException() {
+ super();
+ }
+
+ public InfintechException(String msg) {
+ super(msg);
+ }
+
+ public InfintechException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ public InfintechException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerCheckFullRepay.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerCheckFullRepay.java
new file mode 100644
index 00000000..c76b1871
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerCheckFullRepay.java
@@ -0,0 +1,44 @@
+//package com.infincash.cron.collection.jobhandler;
+//
+//import java.util.List;
+//
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import com.infincash.cron.collection.CronCollectionService;
+//import com.infincash.statistics.risk.RiskService;
+//import com.infincash.statistics.risk.table.prd.extend.RiskStatsDTO;
+//import com.xxl.job.core.biz.model.ReturnT;
+//import com.xxl.job.core.handler.IJobHandler;
+//import com.xxl.job.core.handler.annotation.JobHandler;
+//import com.xxl.job.core.log.XxlJobLogger;
+//
+///**
+// * 任务Handler示例(Bean模式)
+// *
+// * 开发步骤: 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”;
+// * 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例;
+// * 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
+// * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
+// *
+// * @author xuxueli 2015-12-19 19:43:36
+// */
+//@JobHandler(value = "checkFullRepay")
+//@Component
+//public class CronJobHandlerCheckFullRepay extends IJobHandler {
+// @Autowired
+// CronCollectionService service;
+//
+// @Override
+// public ReturnT execute(String param) throws Exception {
+// List list = service.assignCollection();
+// int res = service.assignCollection(list);
+// XxlJobLogger.log("assignCollection: " + res);
+// if(res < list.size()){
+// return FAIL;
+// }
+// res = service.assignExemployeeCollection();
+// XxlJobLogger.log("assignCollection: " + res);
+// return SUCCESS;
+// }
+//}
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerCheckOverdueInterval.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerCheckOverdueInterval.java
new file mode 100644
index 00000000..bc161673
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerCheckOverdueInterval.java
@@ -0,0 +1,44 @@
+//package com.infincash.cron.collection.jobhandler;
+//
+//import java.util.List;
+//
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import com.infincash.cron.collection.CronCollectionService;
+//import com.infincash.statistics.risk.RiskService;
+//import com.infincash.statistics.risk.table.prd.extend.RiskStatsDTO;
+//import com.xxl.job.core.biz.model.ReturnT;
+//import com.xxl.job.core.handler.IJobHandler;
+//import com.xxl.job.core.handler.annotation.JobHandler;
+//import com.xxl.job.core.log.XxlJobLogger;
+//
+///**
+// * 任务Handler示例(Bean模式)
+// *
+// * 开发步骤: 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”;
+// * 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例;
+// * 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
+// * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
+// *
+// * @author xuxueli 2015-12-19 19:43:36
+// */
+//@JobHandler(value = "checkOverdueInterval")
+//@Component
+//public class CronJobHandlerCheckOverdueInterval extends IJobHandler {
+// @Autowired
+// CronCollectionService service;
+//
+// @Override
+// public ReturnT execute(String param) throws Exception {
+// List list = service.queryAll();
+// int res = service.assignCollection(list);
+// XxlJobLogger.log("assignCollection: " + res);
+// if(res < list.size()){
+// return FAIL;
+// }
+// res = service.assignExemployeeCollection();
+// XxlJobLogger.log("assignCollection: " + res);
+// return SUCCESS;
+// }
+//}
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronJobHandler.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerScanCollection.java
similarity index 58%
rename from infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronJobHandler.java
rename to infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerScanCollection.java
index e52cb1be..157e0791 100644
--- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/CronJobHandler.java
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/jobhandler/CronJobHandlerScanCollection.java
@@ -1,12 +1,10 @@
-package com.infincash.cron.collection;
-
-import java.util.List;
+package com.infincash.cron.collection.jobhandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.infincash.statistics.risk.RiskService;
-import com.infincash.statistics.risk.table.prd.extend.RiskStatsDTO;
+import com.infincash.cron.collection.CronCollectionService;
+import com.infincash.cron.collection.InfintechException;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
@@ -22,22 +20,20 @@ import com.xxl.job.core.log.XxlJobLogger;
*
* @author xuxueli 2015-12-19 19:43:36
*/
-@JobHandler(value = "collectionDispatch")
+@JobHandler(value = "scanCollection")
@Component
-public class CronJobHandler extends IJobHandler {
+public class CronJobHandlerScanCollection extends IJobHandler {
@Autowired
CronCollectionService service;
@Override
- public ReturnT execute(String param) throws Exception {
- List list = service.readCollection();
- int res = service.assignCollection(list);
- XxlJobLogger.log("assignCollection: " + res);
- if(res < list.size()){
- return FAIL;
+ public ReturnT execute(String param) {
+ try {
+ service.assignCollection();
+ return SUCCESS;
+ } catch (InfintechException e) {
+ XxlJobLogger.log("assignCollection: " + e.getMessage());
+ return FAIL;
}
- res = service.assignExemployeeCollection();
- XxlJobLogger.log("assignCollection: " + res);
- return SUCCESS;
}
}
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/CronCollectionMapper.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/CronCollectionMapper.java
new file mode 100644
index 00000000..4325f207
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/CronCollectionMapper.java
@@ -0,0 +1,17 @@
+package com.infincash.cron.collection.mapper;
+
+import com.infincash.cron.collection.table.TBizCollectionRecord;
+
+public interface CronCollectionMapper {
+ int deleteByPrimaryKey(Long id);
+
+ int insert(TBizCollectionRecord record);
+
+ int insertSelective(TBizCollectionRecord record);
+
+ TBizCollectionRecord selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(TBizCollectionRecord record);
+
+ int updateByPrimaryKey(TBizCollectionRecord record);
+}
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/TBizCollectionOverdueBucketMapper.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/TBizCollectionOverdueBucketMapper.java
new file mode 100644
index 00000000..2695354f
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/TBizCollectionOverdueBucketMapper.java
@@ -0,0 +1,9 @@
+package com.infincash.cron.collection.mapper;
+
+import java.util.List;
+
+import com.infincash.cron.collection.table.TBizCollectionOverdueBucket;
+
+public interface TBizCollectionOverdueBucketMapper {
+ List queryAll();
+}
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/TBizCollectionRecordMapper.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/TBizCollectionRecordMapper.java
new file mode 100644
index 00000000..579f2338
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/mapper/TBizCollectionRecordMapper.java
@@ -0,0 +1,21 @@
+package com.infincash.cron.collection.mapper;
+
+import java.util.List;
+
+import com.infincash.cron.collection.table.TBizCollectionRecord;
+
+public interface TBizCollectionRecordMapper {
+ List queryAll(String badDebtDay);
+
+ int deleteByPrimaryKey(Long id);
+
+ int insert(TBizCollectionRecord record);
+
+ int insertSelective(TBizCollectionRecord record);
+
+ TBizCollectionRecord selectByPrimaryKey(Long id);
+
+ int updateByPrimaryKeySelective(TBizCollectionRecord record);
+
+ int updateByPrimaryKey(TBizCollectionRecord record);
+}
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/table/TBizCollectionOverdueBucket.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/table/TBizCollectionOverdueBucket.java
new file mode 100644
index 00000000..91cf99ac
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/table/TBizCollectionOverdueBucket.java
@@ -0,0 +1,43 @@
+package com.infincash.cron.collection.table;
+
+public class TBizCollectionOverdueBucket {
+ private Short id;
+
+ private Short intervalId;
+
+ private Short leftClosedInterval;
+
+ private String tSystemRoleId;
+
+ public Short getId() {
+ return id;
+ }
+
+ public void setId(Short id) {
+ this.id = id;
+ }
+
+ public Short getIntervalId() {
+ return intervalId;
+ }
+
+ public void setIntervalId(Short intervalId) {
+ this.intervalId = intervalId;
+ }
+
+ public Short getLeftClosedInterval() {
+ return leftClosedInterval;
+ }
+
+ public void setLeftClosedInterval(Short leftClosedInterval) {
+ this.leftClosedInterval = leftClosedInterval;
+ }
+
+ public String gettSystemRoleId() {
+ return tSystemRoleId;
+ }
+
+ public void settSystemRoleId(String tSystemRoleId) {
+ this.tSystemRoleId = tSystemRoleId == null ? null : tSystemRoleId.trim();
+ }
+}
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/table/TBizCollectionRecord.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/table/TBizCollectionRecord.java
new file mode 100644
index 00000000..707cfac0
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/cron/collection/table/TBizCollectionRecord.java
@@ -0,0 +1,240 @@
+package com.infincash.cron.collection.table;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class TBizCollectionRecord {
+ private Long id;
+
+ private String fkTProject;
+
+ private String fkTUser;
+
+ private String fkSystemUser;
+
+ private String projectNumber;
+
+ private String userLoginName;
+
+ private String userRealName;
+
+ private String userPhone;
+
+ private Date loanTime;
+
+ private Integer deadline;
+
+ private String unit;
+
+ private BigDecimal firstPriceLoan;
+
+ private Date repaymentDate;
+
+ private Short overdueDayCount;
+
+ private Short fkTBizCollectionOverdueBucketIntervalId;
+
+ private String collectorLoginName;
+
+ private Date updateTime;
+
+ private String updateBy;
+
+ private Byte state;
+
+ private Date fullRepayDate;
+
+ private Date lastCollectionTime;
+
+ private Date nextCollectionTime;
+
+ private Short histryCollectionCount;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getFkTProject() {
+ return fkTProject;
+ }
+
+ public void setFkTProject(String fkTProject) {
+ this.fkTProject = fkTProject == null ? null : fkTProject.trim();
+ }
+
+ public String getFkTUser() {
+ return fkTUser;
+ }
+
+ public void setFkTUser(String fkTUser) {
+ this.fkTUser = fkTUser == null ? null : fkTUser.trim();
+ }
+
+ public String getFkSystemUser() {
+ return fkSystemUser;
+ }
+
+ public void setFkSystemUser(String fkSystemUser) {
+ this.fkSystemUser = fkSystemUser == null ? null : fkSystemUser.trim();
+ }
+
+ public String getProjectNumber() {
+ return projectNumber;
+ }
+
+ public void setProjectNumber(String projectNumber) {
+ this.projectNumber = projectNumber == null ? null : projectNumber.trim();
+ }
+
+ public String getUserLoginName() {
+ return userLoginName;
+ }
+
+ public void setUserLoginName(String userLoginName) {
+ this.userLoginName = userLoginName == null ? null : userLoginName.trim();
+ }
+
+ public String getUserRealName() {
+ return userRealName;
+ }
+
+ public void setUserRealName(String userRealName) {
+ this.userRealName = userRealName == null ? null : userRealName.trim();
+ }
+
+ public String getUserPhone() {
+ return userPhone;
+ }
+
+ public void setUserPhone(String userPhone) {
+ this.userPhone = userPhone == null ? null : userPhone.trim();
+ }
+
+ public Date getLoanTime() {
+ return loanTime;
+ }
+
+ public void setLoanTime(Date loanTime) {
+ this.loanTime = loanTime;
+ }
+
+ public BigDecimal getFirstPriceLoan() {
+ return firstPriceLoan;
+ }
+
+ public void setFirstPriceLoan(BigDecimal firstPriceLoan) {
+ this.firstPriceLoan = firstPriceLoan;
+ }
+
+ public Date getRepaymentDate() {
+ return repaymentDate;
+ }
+
+ public void setRepaymentDate(Date repaymentDate) {
+ this.repaymentDate = repaymentDate;
+ }
+
+ public Short getOverdueDayCount() {
+ return overdueDayCount;
+ }
+
+ public void setOverdueDayCount(Short overdueDayCount) {
+ this.overdueDayCount = overdueDayCount;
+ }
+
+ public Short getFkTBizCollectionOverdueBucketIntervalId() {
+ return fkTBizCollectionOverdueBucketIntervalId;
+ }
+
+ public void setFkTBizCollectionOverdueBucketIntervalId(Short fkTBizCollectionOverdueBucketIntervalId) {
+ this.fkTBizCollectionOverdueBucketIntervalId = fkTBizCollectionOverdueBucketIntervalId;
+ }
+
+ public String getCollectorLoginName() {
+ return collectorLoginName;
+ }
+
+ public void setCollectorLoginName(String collectorLoginName) {
+ this.collectorLoginName = collectorLoginName == null ? null : collectorLoginName.trim();
+ }
+
+ public Date getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getUpdateBy() {
+ return updateBy;
+ }
+
+ public void setUpdateBy(String updateBy) {
+ this.updateBy = updateBy == null ? null : updateBy.trim();
+ }
+
+ public Byte getState() {
+ return state;
+ }
+
+ public void setState(Byte state) {
+ this.state = state;
+ }
+
+ public Date getFullRepayDate() {
+ return fullRepayDate;
+ }
+
+ public void setFullRepayDate(Date fullRepayDate) {
+ this.fullRepayDate = fullRepayDate;
+ }
+
+ public Date getLastCollectionTime() {
+ return lastCollectionTime;
+ }
+
+ public void setLastCollectionTime(Date lastCollectionTime) {
+ this.lastCollectionTime = lastCollectionTime;
+ }
+
+ public Date getNextCollectionTime() {
+ return nextCollectionTime;
+ }
+
+ public void setNextCollectionTime(Date nextCollectionTime) {
+ this.nextCollectionTime = nextCollectionTime;
+ }
+
+ public Short getHistryCollectionCount() {
+ return histryCollectionCount;
+ }
+
+ public void setHistryCollectionCount(Short histryCollectionCount) {
+ this.histryCollectionCount = histryCollectionCount;
+ }
+
+ public Integer getDeadline()
+ {
+ return deadline;
+ }
+
+ public void setDeadline(Integer deadline)
+ {
+ this.deadline = deadline;
+ }
+
+ public String getUnit()
+ {
+ return unit;
+ }
+
+ public void setUnit(String unit)
+ {
+ this.unit = unit;
+ }
+}
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/util/Jdk8DateUtils.java b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/util/Jdk8DateUtils.java
index a1521037..0b89eeb7 100644
--- a/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/util/Jdk8DateUtils.java
+++ b/infintech-executors/executor-collection-dispatcher/src/main/java/com/infincash/util/Jdk8DateUtils.java
@@ -8,31 +8,39 @@ import java.time.format.DateTimeFormatter;
import java.util.Date;
public class Jdk8DateUtils {
- public static LocalDateTime toLocalDateTime(Date date) {
+ public static LocalDateTime date2LocalDateTime(Date date) {
// ZoneId utc7 = ZoneId.of("Asia/Ho_Chi_Minh");
Instant ins = date.toInstant();
return LocalDateTime.ofInstant(ins, ZoneId.systemDefault());
}
- public static String toString(LocalDateTime ldt) {
- return toString(ldt, "yyyy-MM-dd HH:mm:ss");
+ public static String localDateTime2String(LocalDateTime ldt) {
+ return localDateTime2String(ldt, "yyyy-MM-dd HH:mm:ss");
}
- public static String toString(LocalDateTime ldt, String formatter) {
- LocalDate localDate = ldt.toLocalDate();
+ public static String localDate2String(LocalDate ld) {
+ return ld.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+ }
+
+ public static String localDateTime2String(LocalDateTime ldt, String formatter) {
//LocalDate 格式化 HH:mm:ss会抛异常java.time.temporal.UnsupportedTemporalTypeException
String sDate = ldt.format(DateTimeFormatter.ofPattern(formatter));
return sDate;
}
- public static long substract(Date a, Date b) {
- LocalDateTime aa = toLocalDateTime(a);
- LocalDateTime bb = toLocalDateTime(b);
+ public static long dateSubstract(Date a, Date b) {
+ LocalDateTime aa = date2LocalDateTime(a);
+ LocalDateTime bb = date2LocalDateTime(b);
return aa.toLocalDate().toEpochDay() - bb.toLocalDate().toEpochDay();
}
+ public static String getDateAfter(long days) {
+ return localDate2String(date2LocalDateTime(new Date()).toLocalDate().plusDays(days));
+ }
+
public static void main(String[] args) {
- System.out.println(toString(toLocalDateTime(new Date())));
+// System.out.println(localDateTime2String(date2LocalDateTime(new Date())));
+ System.out.println(getDateAfter(-90));
}
}
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/resources/generator/generatorConfig.xml b/infintech-executors/executor-collection-dispatcher/src/main/resources/generator/generatorConfig.xml
index 2e14bde5..fb70d035 100644
--- a/infintech-executors/executor-collection-dispatcher/src/main/resources/generator/generatorConfig.xml
+++ b/infintech-executors/executor-collection-dispatcher/src/main/resources/generator/generatorConfig.xml
@@ -18,27 +18,29 @@
-
+
-
+
-
+
+
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/CronCollectionMapper.xml b/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/CronCollectionMapper.xml
index 55506736..94a813d1 100644
--- a/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/CronCollectionMapper.xml
+++ b/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/CronCollectionMapper.xml
@@ -1,17 +1,6 @@
-
-
-
-
-
-
-
-
-
+
@@ -21,5 +10,4 @@
-
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/TBizCollectionOverdueBucketMapper.xml b/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/TBizCollectionOverdueBucketMapper.xml
new file mode 100644
index 00000000..6dc92b75
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/TBizCollectionOverdueBucketMapper.xml
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+ id, interval_id, left_closed_interval, t_system_role_id
+
+
+
+ delete from t_biz_collection_overdue_bucket
+ where id = #{id,jdbcType=SMALLINT}
+
+
+ insert into t_biz_collection_overdue_bucket (id, interval_id, left_closed_interval,
+ t_system_role_id)
+ values (#{id,jdbcType=SMALLINT}, #{intervalId,jdbcType=SMALLINT}, #{leftClosedInterval,jdbcType=SMALLINT},
+ #{tSystemRoleId,jdbcType=VARCHAR})
+
+
+ insert into t_biz_collection_overdue_bucket
+
+
+ id,
+
+
+ interval_id,
+
+
+ left_closed_interval,
+
+
+ t_system_role_id,
+
+
+
+
+ #{id,jdbcType=SMALLINT},
+
+
+ #{intervalId,jdbcType=SMALLINT},
+
+
+ #{leftClosedInterval,jdbcType=SMALLINT},
+
+
+ #{tSystemRoleId,jdbcType=VARCHAR},
+
+
+
+
+ update t_biz_collection_overdue_bucket
+
+
+ interval_id = #{intervalId,jdbcType=SMALLINT},
+
+
+ left_closed_interval = #{leftClosedInterval,jdbcType=SMALLINT},
+
+
+ t_system_role_id = #{tSystemRoleId,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=SMALLINT}
+
+
+ update t_biz_collection_overdue_bucket
+ set interval_id = #{intervalId,jdbcType=SMALLINT},
+ left_closed_interval = #{leftClosedInterval,jdbcType=SMALLINT},
+ t_system_role_id = #{tSystemRoleId,jdbcType=VARCHAR}
+ where id = #{id,jdbcType=SMALLINT}
+
+
+
+
+
+
+
+
+ id, interval_id, left_closed_interval, t_system_role_id
+
+
+
+ delete from t_biz_collection_overdue_bucket
+ where id = #{id,jdbcType=SMALLINT}
+
+
+ insert into t_biz_collection_overdue_bucket (id, interval_id, left_closed_interval,
+ t_system_role_id)
+ values (#{id,jdbcType=SMALLINT}, #{intervalId,jdbcType=SMALLINT}, #{leftClosedInterval,jdbcType=SMALLINT},
+ #{tSystemRoleId,jdbcType=VARCHAR})
+
+
+ insert into t_biz_collection_overdue_bucket
+
+
+ id,
+
+
+ interval_id,
+
+
+ left_closed_interval,
+
+
+ t_system_role_id,
+
+
+
+
+ #{id,jdbcType=SMALLINT},
+
+
+ #{intervalId,jdbcType=SMALLINT},
+
+
+ #{leftClosedInterval,jdbcType=SMALLINT},
+
+
+ #{tSystemRoleId,jdbcType=VARCHAR},
+
+
+
+
+ update t_biz_collection_overdue_bucket
+
+
+ interval_id = #{intervalId,jdbcType=SMALLINT},
+
+
+ left_closed_interval = #{leftClosedInterval,jdbcType=SMALLINT},
+
+
+ t_system_role_id = #{tSystemRoleId,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=SMALLINT}
+
+
+ update t_biz_collection_overdue_bucket
+ set interval_id = #{intervalId,jdbcType=SMALLINT},
+ left_closed_interval = #{leftClosedInterval,jdbcType=SMALLINT},
+ t_system_role_id = #{tSystemRoleId,jdbcType=VARCHAR}
+ where id = #{id,jdbcType=SMALLINT}
+
+
\ No newline at end of file
diff --git a/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/TBizCollectionRecordMapper.xml b/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/TBizCollectionRecordMapper.xml
new file mode 100644
index 00000000..9613a5f5
--- /dev/null
+++ b/infintech-executors/executor-collection-dispatcher/src/main/resources/mapping/prd/TBizCollectionRecordMapper.xml
@@ -0,0 +1,261 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into t_biz_collection_record
+
+
+ id,
+
+
+ fk_t_project,
+
+
+ fk_t_user,
+
+
+ fk_system_user,
+
+
+ wait_or_record,
+
+
+ project_number,
+
+
+ user_login_name,
+
+
+ user_real_name,
+
+
+ user_phone,
+
+
+ loan_time,
+
+
+ project_period,
+
+
+ first_price_loan,
+
+
+ repayment_date,
+
+
+ overdue_day_count,
+
+
+ fk_t_biz_collection_overdue_bucket_interval_id,
+
+
+ collector_login_name,
+
+
+ update_time,
+
+
+ update_by,
+
+
+ state,
+
+
+ full_repay_date,
+
+
+ last_collection_time,
+
+
+ next_collection_time,
+
+
+ histry_collection_count,
+
+
+
+
+ #{id,jdbcType=BIGINT},
+
+
+ #{fkTProject,jdbcType=VARCHAR},
+
+
+ #{fkTUser,jdbcType=VARCHAR},
+
+
+ #{fkSystemUser,jdbcType=VARCHAR},
+
+
+ #{waitOrRecord,jdbcType=TINYINT},
+
+
+ #{projectNumber,jdbcType=VARCHAR},
+
+
+ #{userLoginName,jdbcType=VARCHAR},
+
+
+ #{userRealName,jdbcType=VARCHAR},
+
+
+ #{userPhone,jdbcType=VARCHAR},
+
+
+ #{loanTime,jdbcType=TIMESTAMP},
+
+
+ #{projectPeriod,jdbcType=VARCHAR},
+
+
+ #{firstPriceLoan,jdbcType=DECIMAL},
+
+
+ #{repaymentDate,jdbcType=TIMESTAMP},
+
+
+ #{overdueDayCount,jdbcType=SMALLINT},
+
+
+ #{fkTBizCollectionOverdueBucketIntervalId,jdbcType=SMALLINT},
+
+
+ #{collectorLoginName,jdbcType=VARCHAR},
+
+
+ #{updateTime,jdbcType=TIMESTAMP},
+
+
+ #{updateBy,jdbcType=VARCHAR},
+
+
+ #{state,jdbcType=TINYINT},
+
+
+ #{fullRepayDate,jdbcType=TIMESTAMP},
+
+
+ #{lastCollectionTime,jdbcType=TIMESTAMP},
+
+
+ #{nextCollectionTime,jdbcType=TIMESTAMP},
+
+
+ #{histryCollectionCount,jdbcType=SMALLINT},
+
+
+
+
+
+ update t_biz_collection_record
+
+
+ fk_t_project = #{fkTProject,jdbcType=VARCHAR},
+
+
+ fk_t_user = #{fkTUser,jdbcType=VARCHAR},
+
+
+ fk_system_user = #{fkSystemUser,jdbcType=VARCHAR},
+
+
+ wait_or_record = #{waitOrRecord,jdbcType=TINYINT},
+
+
+ project_number = #{projectNumber,jdbcType=VARCHAR},
+
+
+ user_login_name = #{userLoginName,jdbcType=VARCHAR},
+
+
+ user_real_name = #{userRealName,jdbcType=VARCHAR},
+
+
+ user_phone = #{userPhone,jdbcType=VARCHAR},
+
+
+ loan_time = #{loanTime,jdbcType=TIMESTAMP},
+
+
+ project_period = #{projectPeriod,jdbcType=VARCHAR},
+
+
+ first_price_loan = #{firstPriceLoan,jdbcType=DECIMAL},
+
+
+ repayment_date = #{repaymentDate,jdbcType=TIMESTAMP},
+
+
+ overdue_day_count = #{overdueDayCount,jdbcType=SMALLINT},
+
+
+ fk_t_biz_collection_overdue_bucket_interval_id = #{fkTBizCollectionOverdueBucketIntervalId,jdbcType=SMALLINT},
+
+
+ collector_login_name = #{collectorLoginName,jdbcType=VARCHAR},
+
+
+ update_time = #{updateTime,jdbcType=TIMESTAMP},
+
+
+ update_by = #{updateBy,jdbcType=VARCHAR},
+
+
+ state = #{state,jdbcType=TINYINT},
+
+
+ full_repay_date = #{fullRepayDate,jdbcType=TIMESTAMP},
+
+
+ last_collection_time = #{lastCollectionTime,jdbcType=TIMESTAMP},
+
+
+ next_collection_time = #{nextCollectionTime,jdbcType=TIMESTAMP},
+
+
+ histry_collection_count = #{histryCollectionCount,jdbcType=SMALLINT},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
\ No newline at end of file