引入fastjson, 增加逾期天数计算

pull/5/head
infin_caishuxiao 8 years ago
parent bafe95ee0e
commit a658b298e3

@ -91,6 +91,11 @@
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>${guava.version}</version> <version>${guava.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- xxl-job-core --> <!-- xxl-job-core -->
<dependency> <dependency>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>

@ -62,11 +62,31 @@ public class CronCollectionServiceImpl implements CronCollectionService
String userRealName = (String) tmpMap.get("real_name"); String userRealName = (String) tmpMap.get("real_name");
s.setFkSystemUser(userId); s.setFkSystemUser(userId);
s.setCollectorLoginName(userRealName); s.setCollectorLoginName(userRealName);
long ll = dateSubstract(new Date(), s.getRepaymentDate());
s.setOverdueDayCount(Short.valueOf("" + ll));
String tmp = "";
tmp += s.getDeadline();
if("0".equals(s.getUnit().trim())) {
//天
tmp += " Day";
} else if ("1".equals(s.getUnit().trim())) {
//月
tmp += " Month";
} else {
throw new InfintechException("getUnit error! unit:" + s.getUnit());
}
s.setProjectPeriod(tmp);
a++; a++;
} }
//拼接List //拼接List
resultList.addAll(list); resultList.addAll(list);
} }
if (resultList.size()==0) {
throw new InfintechException("resultList empty!");
}
XxlJobLogger.log("new");
XxlJobLogger.log(resultList.get(0).toString());
collectionMapper.insertBatch(resultList); collectionMapper.insertBatch(resultList);
} }

@ -3,6 +3,8 @@ package com.infincash.cron.collection.table;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.alibaba.fastjson.JSON;
public class TBizCollection { public class TBizCollection {
private Long id; private Long id;
@ -24,6 +26,8 @@ public class TBizCollection {
private Integer deadline; private Integer deadline;
private String projectPeriod;
private String unit; private String unit;
private BigDecimal firstPriceLoan; private BigDecimal firstPriceLoan;
@ -237,4 +241,20 @@ public class TBizCollection {
{ {
this.unit = unit; this.unit = unit;
} }
public String getProjectPeriod()
{
return projectPeriod;
}
public void setProjectPeriod(String projectPeriod)
{
this.projectPeriod = projectPeriod;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
} }

@ -34,10 +34,13 @@
t_u.login_name user_login_name, t_u.login_name user_login_name,
t_ub.real_name user_real_name, t_ub.real_name user_real_name,
t_u.phone user_phone, t_u.phone user_phone,
t_biz.user_id fk_t_user,
t_biz.fk_t_project,
t_biz.loan_time, t_biz.loan_time,
t_biz.deadline, t_biz.deadline,
t_biz.unit, t_biz.unit,
t_biz.first_price_loan, t_biz.repayment_date t_biz.first_price_loan,
t_biz.repayment_date
from from
( (
select select
@ -67,51 +70,31 @@
<insert id="insertBatch" parameterType="com.infincash.cron.collection.table.TBizCollection"> <insert id="insertBatch" parameterType="com.infincash.cron.collection.table.TBizCollection">
insert into t_biz_collection_record insert into t_biz_collection_record
"collectorLoginName": "HARRY",
"deadline": 1,
"firstPriceLoan": 1800000.00,
"fkSystemUser": "00101519376707262349",
"loanTime": 1511663497000,
"projectNumber": "GO20171125435400",
"repaymentDate": 1514217600000,
"unit": "1",
"userLoginName": "MF_qmjoqz",
"userPhone": "085934509604",
"userRealName": "Sandhi Trisnadi"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="fkTProject != null">
fk_t_project, fk_t_project,
</if>
<if test="fkTUser != null">
fk_t_user, fk_t_user,
</if>
<if test="fkSystemUser != null">
fk_system_user, fk_system_user,
</if>
<if test="waitOrRecord != null">
wait_or_record,
</if>
<if test="projectNumber != null">
project_number, project_number,
</if>
<if test="userLoginName != null">
user_login_name, user_login_name,
</if>
<if test="userRealName != null">
user_real_name, user_real_name,
</if>
<if test="userPhone != null">
user_phone, user_phone,
</if>
<if test="loanTime != null">
loan_time, loan_time,
</if>
<if test="projectPeriod != null">
project_period, project_period,
</if>
<if test="firstPriceLoan != null">
first_price_loan, first_price_loan,
</if> repayment_date
<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>
<if test="collectorLoginName != null"> <if test="collectorLoginName != null">
collector_login_name, collector_login_name,
@ -141,9 +124,6 @@
VALUES VALUES
<foreach collection ="list" item="oneItem" index= "index" separator =","> <foreach collection ="list" item="oneItem" index= "index" separator =",">
( (
<if test="id != null">
#{oneItem.id,jdbcType=BIGINT},
</if>
<if test="fkTProject != null"> <if test="fkTProject != null">
#{oneItem.fkTProject,jdbcType=VARCHAR}, #{oneItem.fkTProject,jdbcType=VARCHAR},
</if> </if>

@ -17,6 +17,7 @@
<properties> <properties>
<guava.version>23.6-jre</guava.version> <guava.version>23.6-jre</guava.version>
<fastjson.version>1.2.46</fastjson.version>
</properties> </properties>
</project> </project>
Loading…
Cancel
Save