|
|
@ -1,6 +1,7 @@
|
|
|
|
package com.infincash.cron.collection;
|
|
|
|
package com.infincash.cron.collection;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.infincash.util.Jdk8DateUtils.*;
|
|
|
|
import static com.infincash.util.Jdk8DateUtils.dateSubstract;
|
|
|
|
|
|
|
|
import static com.infincash.util.Jdk8DateUtils.getDateAfter;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -10,16 +11,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
|
|
import com.infincash.cron.collection.mapper.TBizCollectionMapper;
|
|
|
|
import com.infincash.cron.collection.mapper.TBizCollectionOverdueBucketMapper;
|
|
|
|
import com.infincash.cron.collection.mapper.TBizCollectionOverdueBucketMapper;
|
|
|
|
import com.infincash.cron.collection.mapper.TBizCollectionRecordMapper;
|
|
|
|
import com.infincash.cron.collection.table.TBizCollection;
|
|
|
|
import com.infincash.cron.collection.table.TBizCollectionOverdueBucket;
|
|
|
|
import com.infincash.cron.collection.table.TBizCollectionOverdueBucket;
|
|
|
|
import com.infincash.cron.collection.table.TBizCollectionRecord;
|
|
|
|
|
|
|
|
import com.xxl.job.core.log.XxlJobLogger;
|
|
|
|
import com.xxl.job.core.log.XxlJobLogger;
|
|
|
|
|
|
|
|
|
|
|
|
public class CronCollectionServiceImpl implements CronCollectionService
|
|
|
|
public class CronCollectionServiceImpl implements CronCollectionService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
TBizCollectionRecordMapper recordMapper;
|
|
|
|
TBizCollectionMapper recordMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
TBizCollectionOverdueBucketMapper bucketMapper;
|
|
|
|
TBizCollectionOverdueBucketMapper bucketMapper;
|
|
|
@ -29,7 +30,7 @@ public class CronCollectionServiceImpl implements CronCollectionService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//90天以上的是坏账
|
|
|
|
//90天以上的是坏账
|
|
|
|
String badDebtDay = getDateAfter(-90);
|
|
|
|
String badDebtDay = getDateAfter(-90);
|
|
|
|
List<TBizCollectionRecord> rList = recordMapper.queryAll(badDebtDay);
|
|
|
|
List<TBizCollection> rList = recordMapper.queryAll(badDebtDay);
|
|
|
|
if (rList == null || rList.size() == 0)
|
|
|
|
if (rList == null || rList.size() == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new InfintechException("recordMapper.queryAll(badDebtDay) empty! badDebtDay: " + badDebtDay);
|
|
|
|
throw new InfintechException("recordMapper.queryAll(badDebtDay) empty! badDebtDay: " + badDebtDay);
|
|
|
@ -42,11 +43,11 @@ public class CronCollectionServiceImpl implements CronCollectionService
|
|
|
|
getWhichBucket(bList, rList);
|
|
|
|
getWhichBucket(bList, rList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<TBizCollectionRecord>> getWhichBucket(List<TBizCollectionOverdueBucket> bList, List<TBizCollectionRecord> rList)
|
|
|
|
private Map<String, List<TBizCollection>> getWhichBucket(List<TBizCollectionOverdueBucket> bList, List<TBizCollection> rList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// <k-v>:= <system_role_id - List<record>>
|
|
|
|
// <k-v>:= <system_role_id - List<record>>
|
|
|
|
Map<String, List<TBizCollectionRecord>> listMap = Maps.newHashMap();
|
|
|
|
Map<String, List<TBizCollection>> listMap = Maps.newHashMap();
|
|
|
|
for (TBizCollectionRecord r : rList)
|
|
|
|
for (TBizCollection r : rList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Date d = r.getRepaymentDate();
|
|
|
|
Date d = r.getRepaymentDate();
|
|
|
|
Date now = new Date();
|
|
|
|
Date now = new Date();
|
|
|
@ -60,7 +61,7 @@ public class CronCollectionServiceImpl implements CronCollectionService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//取system_role
|
|
|
|
//取system_role
|
|
|
|
String systemRoleId = bList.get(i).gettSystemRoleId();
|
|
|
|
String systemRoleId = bList.get(i).gettSystemRoleId();
|
|
|
|
List<TBizCollectionRecord> tmpList = listMap.get(systemRoleId);
|
|
|
|
List<TBizCollection> tmpList = listMap.get(systemRoleId);
|
|
|
|
if (tmpList == null) {
|
|
|
|
if (tmpList == null) {
|
|
|
|
tmpList = Lists.newLinkedList();
|
|
|
|
tmpList = Lists.newLinkedList();
|
|
|
|
tmpList.add(r);
|
|
|
|
tmpList.add(r);
|
|
|
|