|
|
@ -27,10 +27,7 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.*; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -50,6 +47,24 @@ public class AlRepaymentEntryServiceImpl extends ServiceImpl<AlRepaymentEntryMap |
|
|
|
AlRepaymentEntry alRepaymentEntry = new AlRepaymentEntry(); |
|
|
|
AlRepaymentEntry alRepaymentEntry = new AlRepaymentEntry(); |
|
|
|
BeanUtils.copyProperties(alRepaymentEntryReq,alRepaymentEntry); |
|
|
|
BeanUtils.copyProperties(alRepaymentEntryReq,alRepaymentEntry); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
|
|
SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
Date one = null; |
|
|
|
|
|
|
|
Date two = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if(alRepaymentEntry.getRepaymentDate() != null){ |
|
|
|
|
|
|
|
one = formatter2.parse(formatter.format(alRepaymentEntry.getRepaymentDate())+" 00:00:00"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(alRepaymentEntry.getActualRepaymentDate() != null){ |
|
|
|
|
|
|
|
two = formatter2.parse(formatter.format(alRepaymentEntry.getActualRepaymentDate())+" 00:00:00"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
alRepaymentEntry.setRepaymentDate(one); |
|
|
|
|
|
|
|
alRepaymentEntry.setActualRepaymentDate(two); |
|
|
|
|
|
|
|
|
|
|
|
Map map = DgApplyAmountInfoController.getUserIdAndName(); |
|
|
|
Map map = DgApplyAmountInfoController.getUserIdAndName(); |
|
|
|
String name = map.get("name").toString(); |
|
|
|
String name = map.get("name").toString(); |
|
|
|
Integer userId = Integer.parseInt(map.get("userId").toString()); |
|
|
|
Integer userId = Integer.parseInt(map.get("userId").toString()); |
|
|
@ -164,7 +179,19 @@ public class AlRepaymentEntryServiceImpl extends ServiceImpl<AlRepaymentEntryMap |
|
|
|
|
|
|
|
|
|
|
|
List<AlRepaymentEntryRes>list = this.baseMapper.selectBind(); |
|
|
|
List<AlRepaymentEntryRes>list = this.baseMapper.selectBind(); |
|
|
|
Date date = new Date(); |
|
|
|
Date date = new Date(); |
|
|
|
long times1 = date.getTime();//当前时间
|
|
|
|
//long times1 = date.getTime();//当前时间
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
|
|
SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
Date four = null; |
|
|
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
four = formatter2.parse(formatter.format(now)+" 00:00:00"); |
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
long times1 = four.getTime();//当前时间
|
|
|
|
|
|
|
|
|
|
|
|
//遍历list取出应还款日,计算逾期天数=当前时间-应还款日
|
|
|
|
//遍历list取出应还款日,计算逾期天数=当前时间-应还款日
|
|
|
|
for (AlRepaymentEntryRes res:list) { |
|
|
|
for (AlRepaymentEntryRes res:list) { |
|
|
@ -179,7 +206,7 @@ public class AlRepaymentEntryServiceImpl extends ServiceImpl<AlRepaymentEntryMap |
|
|
|
AlInsuranceList alInsuranceList = new AlInsuranceList(); |
|
|
|
AlInsuranceList alInsuranceList = new AlInsuranceList(); |
|
|
|
alInsuranceList.setId(res.getInsuranceId()); |
|
|
|
alInsuranceList.setId(res.getInsuranceId()); |
|
|
|
//如果存在当前日期超过应还款日时的数据,则计算逾期天数,并且状态改为已逾期,同时要处理保后管理模块内容
|
|
|
|
//如果存在当前日期超过应还款日时的数据,则计算逾期天数,并且状态改为已逾期,同时要处理保后管理模块内容
|
|
|
|
if(times1 > times2){ |
|
|
|
if(res.getActualRepaymentDate()==null && times1 > times2){ |
|
|
|
int days = (int)((times1-times2)/1000/60/60/24); |
|
|
|
int days = (int)((times1-times2)/1000/60/60/24); |
|
|
|
entry.setOverdueDays(days); |
|
|
|
entry.setOverdueDays(days); |
|
|
|
entry.setRepaymentStatus(3);//已逾期
|
|
|
|
entry.setRepaymentStatus(3);//已逾期
|
|
|
@ -189,16 +216,16 @@ public class AlRepaymentEntryServiceImpl extends ServiceImpl<AlRepaymentEntryMap |
|
|
|
alInsuranceList.setPaymentStatus(2);//已逾期
|
|
|
|
alInsuranceList.setPaymentStatus(2);//已逾期
|
|
|
|
alInsuranceList.setIsOverdue(0);//是否逾期过:0->是;1->否;
|
|
|
|
alInsuranceList.setIsOverdue(0);//是否逾期过:0->是;1->否;
|
|
|
|
alInsuranceListMapper.updateById(alInsuranceList); |
|
|
|
alInsuranceListMapper.updateById(alInsuranceList); |
|
|
|
}else if(times1==times2){//应还款日=当前日期,则显示状态为待还款
|
|
|
|
}else if(res.getActualRepaymentDate()==null && times1==times2){//应还款日=当前日期,则显示状态为待还款
|
|
|
|
entry.setRepaymentStatus(1);//待还款
|
|
|
|
entry.setRepaymentStatus(1);//待还款
|
|
|
|
this.baseMapper.updateById(entry);//更新状态
|
|
|
|
this.baseMapper.updateById(entry);//更新状态
|
|
|
|
}else if(times3 <= times1){//实际还款日不超过当前日期时,状态为已还款
|
|
|
|
}else if(res.getActualRepaymentDate()!=null && times3 <= times1){//实际还款日不超过当前日期时,状态为已还款
|
|
|
|
entry.setRepaymentStatus(2);//已还款
|
|
|
|
entry.setRepaymentStatus(2);//已还款
|
|
|
|
this.baseMapper.updateById(entry);//更新状态
|
|
|
|
this.baseMapper.updateById(entry);//更新状态
|
|
|
|
}else if(times1 <= times2){//当前日期未到应还款日,状态为未到期
|
|
|
|
}else if(res.getActualRepaymentDate()==null && times1 <= times2){//当前日期未到应还款日,状态为未到期
|
|
|
|
entry.setRepaymentStatus(4);//未到期
|
|
|
|
entry.setRepaymentStatus(4);//未到期
|
|
|
|
this.baseMapper.updateById(entry);//更新状态
|
|
|
|
this.baseMapper.updateById(entry);//更新状态
|
|
|
|
if(res.getRemainAmount().doubleValue()>0){//如果存在剩余额度,保后管理列表状态为还款中
|
|
|
|
if(res.getRemainAmount()!=null && res.getActualRepaymentDate()==null && res.getRemainAmount().doubleValue()>0){//如果存在剩余额度,保后管理列表状态为还款中
|
|
|
|
alInsuranceList.setPaymentStatus(1);//还款中
|
|
|
|
alInsuranceList.setPaymentStatus(1);//还款中
|
|
|
|
alInsuranceListMapper.updateById(alInsuranceList); |
|
|
|
alInsuranceListMapper.updateById(alInsuranceList); |
|
|
|
} |
|
|
|
} |
|
|
|