取逾期逻辑

pull/5/head
infin_caishuxiao 8 years ago
parent 13e87fb9d9
commit 99687e14d5

@ -86,6 +86,11 @@
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<!-- xxl-job-core -->
<dependency>
<groupId>com.xuxueli</groupId>

@ -1,19 +1,13 @@
package com.infincash.cron.collection;
import java.util.List;
public interface CronCollectionService {
/**
*
* @return
*/
List<Collection> readCollection();
/**
*
* @return
* @throws InfintechException
*/
int assignCollection(List<Collection> list);
void assignCollection() throws InfintechException;
/**
*

@ -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<TBizCollectionRecord> rList = recordMapper.queryAll(badDebtDay);
if (rList == null || rList.size() == 0)
{
throw new InfintechException("recordMapper.queryAll(badDebtDay) empty! badDebtDay: " + badDebtDay);
}
List<TBizCollectionOverdueBucket> bList = bucketMapper.queryAll();
if (bList == null || bList.size() == 0)
{
throw new InfintechException("bucketMapper.queryAll() empty!");
}
getWhichBucket(bList, rList);
}
private Map<String, List<TBizCollectionRecord>> getWhichBucket(List<TBizCollectionOverdueBucket> bList, List<TBizCollectionRecord> rList)
{
// <k-v>:= <system_role_id - List<record>>
Map<String, List<TBizCollectionRecord>> 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<TBizCollectionRecord> 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;
}
}

@ -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);
}
}

@ -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<String> execute(String param) throws Exception {
// List<RiskStatsDTO> 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;
// }
//}

@ -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<String> execute(String param) throws Exception {
// List<RiskStatsDTO> 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;
// }
//}

@ -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<String> execute(String param) throws Exception {
List<RiskStatsDTO> list = service.readCollection();
int res = service.assignCollection(list);
XxlJobLogger.log("assignCollection: " + res);
if(res < list.size()){
return FAIL;
public ReturnT<String> 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;
}
}

@ -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);
}

@ -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<TBizCollectionOverdueBucket> queryAll();
}

@ -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<TBizCollectionRecord> 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);
}

@ -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();
}
}

@ -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;
}
}

@ -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));
}
}

@ -18,27 +18,29 @@
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.infincash.statistics.risk.table.stats" targetProject="src/main/java">
<javaModelGenerator targetPackage="com.infincash.cron.collection.table" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="main.resources.mapping.stats" targetProject="src">
<sqlMapGenerator targetPackage="main.resources.mapping.prd" targetProject="src">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.infincash.statistics.risk.mapper.stats" targetProject="src/main/java">
<javaClientGenerator type="XMLMAPPER" targetPackage="com.infincash.cron.collection.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<!--
<table
tableName="t_stats_risk_detail"
domainObjectName="TStatsRiskDetail"
tableName="t_biz_collection_overdue_bucket"
domainObjectName="TBizCollectionOverdueBucket"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false">
</table>
-->
</context>
</generatorConfiguration>

@ -1,17 +1,6 @@
<?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.infincash.statistics.risk.mapper.prd.TRiskRuleMapper">
<resultMap id="riskStatsDTOMap" type="com.infincash.statistics.risk.table.prd.extend.RiskStatsDTO">
<result property="riskRuleId" column="risk_rule_id" />
<result property="count" column="count1" />
<result property="time" column="time" />
</resultMap>
<!-- id, risk_rule_id, count(1) as count1, now() as time resultType="com.infincash.statistics.risk.table.prd.extend.RiskStatsDTO" -->
<select id="selectCollection" resultType="java.lang.String" >
select
</select>
<mapper namespace="com.infincash.statistics.risk.mapper.prd.CronCollectionMapper">
<select id="selectTel1Employee" resultType="java.lang.String" >
select user_id from t_system_user_role t1 inner join t_system_role t2 on t1.role_id = t2.role_id and t2.role_name='电催_1';
</select>
@ -21,5 +10,4 @@
<select id="selectDoorEmployee" resultType="java.lang.String" >
select user_id from t_system_user_role t1 inner join t_system_role t2 on t1.role_id = t2.role_id and t2.role_name='地催';
</select>
</mapper>

@ -0,0 +1,160 @@
<?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.infincash.cron.collection.mapper.TBizCollectionOverdueBucketMapper">
<resultMap id="BaseResultMap" type="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
<id column="id" jdbcType="SMALLINT" property="id" />
<result column="interval_id" jdbcType="SMALLINT" property="intervalId" />
<result column="left_closed_interval" jdbcType="SMALLINT" property="leftClosedInterval" />
<result column="t_system_role_id" jdbcType="VARCHAR" property="tSystemRoleId" />
</resultMap>
<sql id="Base_Column_List">
id, interval_id, left_closed_interval, t_system_role_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_biz_collection_overdue_bucket
where id = #{id,jdbcType=SMALLINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
delete from t_biz_collection_overdue_bucket
where id = #{id,jdbcType=SMALLINT}
</delete>
<insert id="insert" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
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>
<insert id="insertSelective" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
insert into t_biz_collection_overdue_bucket
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="intervalId != null">
interval_id,
</if>
<if test="leftClosedInterval != null">
left_closed_interval,
</if>
<if test="tSystemRoleId != null">
t_system_role_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=SMALLINT},
</if>
<if test="intervalId != null">
#{intervalId,jdbcType=SMALLINT},
</if>
<if test="leftClosedInterval != null">
#{leftClosedInterval,jdbcType=SMALLINT},
</if>
<if test="tSystemRoleId != null">
#{tSystemRoleId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
update t_biz_collection_overdue_bucket
<set>
<if test="intervalId != null">
interval_id = #{intervalId,jdbcType=SMALLINT},
</if>
<if test="leftClosedInterval != null">
left_closed_interval = #{leftClosedInterval,jdbcType=SMALLINT},
</if>
<if test="tSystemRoleId != null">
t_system_role_id = #{tSystemRoleId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=SMALLINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
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}
</update>
<resultMap id="BaseResultMap" type="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
<id column="id" jdbcType="SMALLINT" property="id" />
<result column="interval_id" jdbcType="SMALLINT" property="intervalId" />
<result column="left_closed_interval" jdbcType="SMALLINT" property="leftClosedInterval" />
<result column="t_system_role_id" jdbcType="VARCHAR" property="tSystemRoleId" />
</resultMap>
<sql id="Base_Column_List">
id, interval_id, left_closed_interval, t_system_role_id
</sql>
<select id="queryAll" parameterType="java.lang.Short" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_biz_collection_overdue_bucket
order by interval_id
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
delete from t_biz_collection_overdue_bucket
where id = #{id,jdbcType=SMALLINT}
</delete>
<insert id="insert" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
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>
<insert id="insertSelective" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
insert into t_biz_collection_overdue_bucket
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="intervalId != null">
interval_id,
</if>
<if test="leftClosedInterval != null">
left_closed_interval,
</if>
<if test="tSystemRoleId != null">
t_system_role_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=SMALLINT},
</if>
<if test="intervalId != null">
#{intervalId,jdbcType=SMALLINT},
</if>
<if test="leftClosedInterval != null">
#{leftClosedInterval,jdbcType=SMALLINT},
</if>
<if test="tSystemRoleId != null">
#{tSystemRoleId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
update t_biz_collection_overdue_bucket
<set>
<if test="intervalId != null">
interval_id = #{intervalId,jdbcType=SMALLINT},
</if>
<if test="leftClosedInterval != null">
left_closed_interval = #{leftClosedInterval,jdbcType=SMALLINT},
</if>
<if test="tSystemRoleId != null">
t_system_role_id = #{tSystemRoleId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=SMALLINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.infincash.cron.collection.table.TBizCollectionOverdueBucket">
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}
</update>
</mapper>

@ -0,0 +1,261 @@
<?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.infincash.cron.collection.mapper.TBizCollectionRecordMapper">
<resultMap id="BaseResultMap" type="com.infincash.cron.collection.table.TBizCollectionRecord">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="fk_t_project" jdbcType="VARCHAR" property="fkTProject" />
<result column="fk_t_user" jdbcType="VARCHAR" property="fkTUser" />
<result column="fk_system_user" jdbcType="VARCHAR" property="fkSystemUser" />
<result column="project_number" jdbcType="VARCHAR" property="projectNumber" />
<result column="user_login_name" jdbcType="VARCHAR" property="userLoginName" />
<result column="user_real_name" jdbcType="VARCHAR" property="userRealName" />
<result column="user_phone" jdbcType="VARCHAR" property="userPhone" />
<result column="loan_time" jdbcType="TIMESTAMP" property="loanTime" />
<result column="project_period" jdbcType="VARCHAR" property="projectPeriod" />
<result column="first_price_loan" jdbcType="DECIMAL" property="firstPriceLoan" />
<result column="repayment_date" jdbcType="TIMESTAMP" property="repaymentDate" />
<result column="overdue_day_count" jdbcType="SMALLINT" property="overdueDayCount" />
<result column="fk_t_biz_collection_overdue_bucket_interval_id" jdbcType="SMALLINT" property="fkTBizCollectionOverdueBucketIntervalId" />
<result column="collector_login_name" jdbcType="VARCHAR" property="collectorLoginName" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="state" jdbcType="TINYINT" property="state" />
<result column="full_repay_date" jdbcType="TIMESTAMP" property="fullRepayDate" />
<result column="last_collection_time" jdbcType="TIMESTAMP" property="lastCollectionTime" />
<result column="next_collection_time" jdbcType="TIMESTAMP" property="nextCollectionTime" />
<result column="histry_collection_count" jdbcType="SMALLINT" property="histryCollectionCount" />
</resultMap>
<select id="queryAll" parameterType="java.lang.String" resultMap="BaseResultMap">
select
t1.id,
t1.number project_number,
t1.loan_time,
t1.deadline,
t1.unit,
t1.first_price_loan,
t2.repayment_date
from t_project t1 inner join t_project_refund t2 on t1.id=t2.project_id and t1.status in ('7')
where
t1.loan_time > #{_parameter}
</select>
<insert id="insertSelective" parameterType="com.infincash.cron.collection.table.TBizCollectionRecord">
insert into t_biz_collection_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="fkTProject != null">
fk_t_project,
</if>
<if test="fkTUser != null">
fk_t_user,
</if>
<if test="fkSystemUser != null">
fk_system_user,
</if>
<if test="waitOrRecord != null">
wait_or_record,
</if>
<if test="projectNumber != null">
project_number,
</if>
<if test="userLoginName != null">
user_login_name,
</if>
<if test="userRealName != null">
user_real_name,
</if>
<if test="userPhone != null">
user_phone,
</if>
<if test="loanTime != null">
loan_time,
</if>
<if test="projectPeriod != null">
project_period,
</if>
<if test="firstPriceLoan != null">
first_price_loan,
</if>
<if test="repaymentDate != null">
repayment_date,
</if>
<if test="overdueDayCount != null">
overdue_day_count,
</if>
<if test="fkTBizCollectionOverdueBucketIntervalId != null">
fk_t_biz_collection_overdue_bucket_interval_id,
</if>
<if test="collectorLoginName != null">
collector_login_name,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="state != null">
state,
</if>
<if test="fullRepayDate != null">
full_repay_date,
</if>
<if test="lastCollectionTime != null">
last_collection_time,
</if>
<if test="nextCollectionTime != null">
next_collection_time,
</if>
<if test="histryCollectionCount != null">
histry_collection_count,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="fkTProject != null">
#{fkTProject,jdbcType=VARCHAR},
</if>
<if test="fkTUser != null">
#{fkTUser,jdbcType=VARCHAR},
</if>
<if test="fkSystemUser != null">
#{fkSystemUser,jdbcType=VARCHAR},
</if>
<if test="waitOrRecord != null">
#{waitOrRecord,jdbcType=TINYINT},
</if>
<if test="projectNumber != null">
#{projectNumber,jdbcType=VARCHAR},
</if>
<if test="userLoginName != null">
#{userLoginName,jdbcType=VARCHAR},
</if>
<if test="userRealName != null">
#{userRealName,jdbcType=VARCHAR},
</if>
<if test="userPhone != null">
#{userPhone,jdbcType=VARCHAR},
</if>
<if test="loanTime != null">
#{loanTime,jdbcType=TIMESTAMP},
</if>
<if test="projectPeriod != null">
#{projectPeriod,jdbcType=VARCHAR},
</if>
<if test="firstPriceLoan != null">
#{firstPriceLoan,jdbcType=DECIMAL},
</if>
<if test="repaymentDate != null">
#{repaymentDate,jdbcType=TIMESTAMP},
</if>
<if test="overdueDayCount != null">
#{overdueDayCount,jdbcType=SMALLINT},
</if>
<if test="fkTBizCollectionOverdueBucketIntervalId != null">
#{fkTBizCollectionOverdueBucketIntervalId,jdbcType=SMALLINT},
</if>
<if test="collectorLoginName != null">
#{collectorLoginName,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="state != null">
#{state,jdbcType=TINYINT},
</if>
<if test="fullRepayDate != null">
#{fullRepayDate,jdbcType=TIMESTAMP},
</if>
<if test="lastCollectionTime != null">
#{lastCollectionTime,jdbcType=TIMESTAMP},
</if>
<if test="nextCollectionTime != null">
#{nextCollectionTime,jdbcType=TIMESTAMP},
</if>
<if test="histryCollectionCount != null">
#{histryCollectionCount,jdbcType=SMALLINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.infincash.cron.collection.table.TBizCollectionRecord">
update t_biz_collection_record
<set>
<if test="fkTProject != null">
fk_t_project = #{fkTProject,jdbcType=VARCHAR},
</if>
<if test="fkTUser != null">
fk_t_user = #{fkTUser,jdbcType=VARCHAR},
</if>
<if test="fkSystemUser != null">
fk_system_user = #{fkSystemUser,jdbcType=VARCHAR},
</if>
<if test="waitOrRecord != null">
wait_or_record = #{waitOrRecord,jdbcType=TINYINT},
</if>
<if test="projectNumber != null">
project_number = #{projectNumber,jdbcType=VARCHAR},
</if>
<if test="userLoginName != null">
user_login_name = #{userLoginName,jdbcType=VARCHAR},
</if>
<if test="userRealName != null">
user_real_name = #{userRealName,jdbcType=VARCHAR},
</if>
<if test="userPhone != null">
user_phone = #{userPhone,jdbcType=VARCHAR},
</if>
<if test="loanTime != null">
loan_time = #{loanTime,jdbcType=TIMESTAMP},
</if>
<if test="projectPeriod != null">
project_period = #{projectPeriod,jdbcType=VARCHAR},
</if>
<if test="firstPriceLoan != null">
first_price_loan = #{firstPriceLoan,jdbcType=DECIMAL},
</if>
<if test="repaymentDate != null">
repayment_date = #{repaymentDate,jdbcType=TIMESTAMP},
</if>
<if test="overdueDayCount != null">
overdue_day_count = #{overdueDayCount,jdbcType=SMALLINT},
</if>
<if test="fkTBizCollectionOverdueBucketIntervalId != null">
fk_t_biz_collection_overdue_bucket_interval_id = #{fkTBizCollectionOverdueBucketIntervalId,jdbcType=SMALLINT},
</if>
<if test="collectorLoginName != null">
collector_login_name = #{collectorLoginName,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="state != null">
state = #{state,jdbcType=TINYINT},
</if>
<if test="fullRepayDate != null">
full_repay_date = #{fullRepayDate,jdbcType=TIMESTAMP},
</if>
<if test="lastCollectionTime != null">
last_collection_time = #{lastCollectionTime,jdbcType=TIMESTAMP},
</if>
<if test="nextCollectionTime != null">
next_collection_time = #{nextCollectionTime,jdbcType=TIMESTAMP},
</if>
<if test="histryCollectionCount != null">
histry_collection_count = #{histryCollectionCount,jdbcType=SMALLINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
Loading…
Cancel
Save