fix: 信用卡账单日消费,账单修改。
This commit is contained in:
@@ -332,6 +332,61 @@ public class CreditCardBillServiceImpl implements ICreditCardBillService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//如果账单日消费计入下期(isNextBillDate=1)且今天是账单日,需要生成下一个账单周期
|
||||||
|
if(isNextBillDate.equals("1") && dayOfMonth == bankCard.getBillDate()){
|
||||||
|
//计算下一个账单日期
|
||||||
|
String nextBillDateStr;
|
||||||
|
if(month==12){
|
||||||
|
nextBillDateStr=(year+1)+"-01-"+String.format("%02d", bankCard.getBillDate());
|
||||||
|
}else{
|
||||||
|
nextBillDateStr=year+"-"+String.format("%02d", month+1)+"-"+String.format("%02d", bankCard.getBillDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
Date nextBillDate;
|
||||||
|
try {
|
||||||
|
nextBillDate=formatter.parse(nextBillDateStr);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算下一个账单周期的起始日期
|
||||||
|
Calendar nextCalendarStart = Calendar.getInstance();
|
||||||
|
nextCalendarStart.setTime(nextBillDate);
|
||||||
|
nextCalendarStart.add(Calendar.MONTH, -1);
|
||||||
|
//账单日当天的消费计入下期,所以下期账单从账单日当天开始
|
||||||
|
Date nextStartDate = nextCalendarStart.getTime();
|
||||||
|
String nextPeriodStart = formatter.format(nextStartDate);
|
||||||
|
|
||||||
|
//计算下一个账单周期的结束日期(下个账单日前一天)
|
||||||
|
Calendar nextCalendarEnd = Calendar.getInstance();
|
||||||
|
nextCalendarEnd.setTime(nextBillDate);
|
||||||
|
nextCalendarEnd.add(Calendar.DATE, -1);
|
||||||
|
Date nextEndDate = nextCalendarEnd.getTime();
|
||||||
|
String nextPeriodEnd= formatter.format(nextEndDate);
|
||||||
|
|
||||||
|
//检查下一个账单周期是否已存在
|
||||||
|
CreditCardBillDto nextCreditCardBillDto=new CreditCardBillDto();
|
||||||
|
nextCreditCardBillDto.setCreditCardId(bankCard.getId());
|
||||||
|
nextCreditCardBillDto.setBillDate(nextBillDateStr);
|
||||||
|
nextCreditCardBillDto.setBillState("0");
|
||||||
|
List<CreditCardBillVo> nextCreditCardBillList=creditCardBillMapper.selectCreditCardBillList(nextCreditCardBillDto);
|
||||||
|
|
||||||
|
if(nextCreditCardBillList.size()==0){
|
||||||
|
//插入下一个账单周期的未出账单
|
||||||
|
CreditCardBill nextCreditCardBill=new CreditCardBill();
|
||||||
|
nextCreditCardBill.setBillDate(nextBillDate);
|
||||||
|
nextCreditCardBill.setName(simpleDateFormat.format(nextBillDate));
|
||||||
|
nextCreditCardBill.setBillDatePeriod(nextPeriodStart+"~"+nextPeriodEnd);
|
||||||
|
nextCreditCardBill.setCreateBy(bankCard.getCreateBy());
|
||||||
|
nextCreditCardBill.setCreateTime(DateUtils.getNowDate());
|
||||||
|
nextCreditCardBill.setId(IdWorker.getId());
|
||||||
|
nextCreditCardBill.setCreditCardId(bankCard.getId());
|
||||||
|
nextCreditCardBill.setBillAmount(0.0);
|
||||||
|
nextCreditCardBill.setBillState("0");
|
||||||
|
creditCardBillMapper.insertCreditCardBill(nextCreditCardBill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -464,6 +519,61 @@ public class CreditCardBillServiceImpl implements ICreditCardBillService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//如果账单日消费计入下期(isNextBillDate=1)且今天是账单日,需要生成下一个账单周期
|
||||||
|
if(isNextBillDate.equals("1") && dayOfMonth == bankCard.getBillDate()){
|
||||||
|
//计算下一个账单日期
|
||||||
|
String nextBillDateStr;
|
||||||
|
if(month==12){
|
||||||
|
nextBillDateStr=(year+1)+"-01-"+String.format("%02d", bankCard.getBillDate());
|
||||||
|
}else{
|
||||||
|
nextBillDateStr=year+"-"+String.format("%02d", month+1)+"-"+String.format("%02d", bankCard.getBillDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
Date nextBillDate;
|
||||||
|
try {
|
||||||
|
nextBillDate=formatter.parse(nextBillDateStr);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算下一个账单周期的起始日期
|
||||||
|
Calendar nextCalendarStart = Calendar.getInstance();
|
||||||
|
nextCalendarStart.setTime(nextBillDate);
|
||||||
|
nextCalendarStart.add(Calendar.MONTH, -1);
|
||||||
|
//账单日当天的消费计入下期,所以下期账单从账单日当天开始
|
||||||
|
Date nextStartDate = nextCalendarStart.getTime();
|
||||||
|
String nextPeriodStart = formatter.format(nextStartDate);
|
||||||
|
|
||||||
|
//计算下一个账单周期的结束日期(下个账单日前一天)
|
||||||
|
Calendar nextCalendarEnd = Calendar.getInstance();
|
||||||
|
nextCalendarEnd.setTime(nextBillDate);
|
||||||
|
nextCalendarEnd.add(Calendar.DATE, -1);
|
||||||
|
Date nextEndDate = nextCalendarEnd.getTime();
|
||||||
|
String nextPeriodEnd= formatter.format(nextEndDate);
|
||||||
|
|
||||||
|
//检查下一个账单周期是否已存在
|
||||||
|
CreditCardBillDto nextCreditCardBillDto=new CreditCardBillDto();
|
||||||
|
nextCreditCardBillDto.setCreditCardId(bankCard.getId());
|
||||||
|
nextCreditCardBillDto.setBillDate(nextBillDateStr);
|
||||||
|
nextCreditCardBillDto.setBillState("0");
|
||||||
|
List<CreditCardBillVo> nextCreditCardBillList=creditCardBillMapper.selectCreditCardBillList(nextCreditCardBillDto);
|
||||||
|
|
||||||
|
if(nextCreditCardBillList.size()==0){
|
||||||
|
//插入下一个账单周期的未出账单
|
||||||
|
CreditCardBill nextCreditCardBill=new CreditCardBill();
|
||||||
|
nextCreditCardBill.setBillDate(nextBillDate);
|
||||||
|
nextCreditCardBill.setName(simpleDateFormat.format(nextBillDate));
|
||||||
|
nextCreditCardBill.setBillDatePeriod(nextPeriodStart+"~"+nextPeriodEnd);
|
||||||
|
nextCreditCardBill.setCreateBy(bankCard.getCreateBy());
|
||||||
|
nextCreditCardBill.setCreateTime(DateUtils.getNowDate());
|
||||||
|
nextCreditCardBill.setId(IdWorker.getId());
|
||||||
|
nextCreditCardBill.setCreditCardId(bankCard.getId());
|
||||||
|
nextCreditCardBill.setBillAmount(0.0);
|
||||||
|
nextCreditCardBill.setBillState("0");
|
||||||
|
creditCardBillMapper.insertCreditCardBill(nextCreditCardBill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,6 +186,61 @@ public class InvestJobImpl implements IInvestJobService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//如枟账单日消费计入下期(isNextBillDate=1)且今天是账单日,需要生成下一个账单周期
|
||||||
|
if(isNextBillDate.equals("1") && dayOfMonth == bankCard.getBillDate()){
|
||||||
|
//计算下一个账单日期
|
||||||
|
String nextBillDateStr;
|
||||||
|
if(month==12){
|
||||||
|
nextBillDateStr=(year+1)+"-01-"+String.format("%02d", bankCard.getBillDate());
|
||||||
|
}else{
|
||||||
|
nextBillDateStr=year+"-"+String.format("%02d", month+1)+"-"+String.format("%02d", bankCard.getBillDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
Date nextBillDate;
|
||||||
|
try {
|
||||||
|
nextBillDate=formatter.parse(nextBillDateStr);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算下一个账单周期的起始日期
|
||||||
|
Calendar nextCalendarStart = Calendar.getInstance();
|
||||||
|
nextCalendarStart.setTime(nextBillDate);
|
||||||
|
nextCalendarStart.add(Calendar.MONTH, -1);
|
||||||
|
//账单日当天的消费计入下期,所以下期账单从账单日当天开始
|
||||||
|
Date nextStartDate = nextCalendarStart.getTime();
|
||||||
|
String nextPeriodStart = formatter.format(nextStartDate);
|
||||||
|
|
||||||
|
//计算下一个账单周期的结束日期(下个账单日前一天)
|
||||||
|
Calendar nextCalendarEnd = Calendar.getInstance();
|
||||||
|
nextCalendarEnd.setTime(nextBillDate);
|
||||||
|
nextCalendarEnd.add(Calendar.DATE, -1);
|
||||||
|
Date nextEndDate = nextCalendarEnd.getTime();
|
||||||
|
String nextPeriodEnd= formatter.format(nextEndDate);
|
||||||
|
|
||||||
|
//检查下一个账单周期是否已存在
|
||||||
|
CreditCardBillDto nextCreditCardBillDto=new CreditCardBillDto();
|
||||||
|
nextCreditCardBillDto.setCreditCardId(bankCard.getId());
|
||||||
|
nextCreditCardBillDto.setBillDate(nextBillDateStr);
|
||||||
|
nextCreditCardBillDto.setBillState("0");
|
||||||
|
List<CreditCardBillVo> nextCreditCardBillList=creditCardBillMapper.selectCreditCardBillList(nextCreditCardBillDto);
|
||||||
|
|
||||||
|
if(nextCreditCardBillList.size()==0){
|
||||||
|
//插入下一个账单周期的未出账单
|
||||||
|
CreditCardBill nextCreditCardBill=new CreditCardBill();
|
||||||
|
nextCreditCardBill.setBillDate(nextBillDate);
|
||||||
|
nextCreditCardBill.setName(simpleDateFormat.format(nextBillDate));
|
||||||
|
nextCreditCardBill.setBillDatePeriod(nextPeriodStart+"~"+nextPeriodEnd);
|
||||||
|
nextCreditCardBill.setCreateBy(bankCard.getCreateBy());
|
||||||
|
nextCreditCardBill.setCreateTime(DateUtils.getNowDate());
|
||||||
|
nextCreditCardBill.setId(IdWorker.getId());
|
||||||
|
nextCreditCardBill.setCreditCardId(bankCard.getId());
|
||||||
|
nextCreditCardBill.setBillAmount(0.0);
|
||||||
|
nextCreditCardBill.setBillState("0");
|
||||||
|
creditCardBillMapper.insertCreditCardBill(nextCreditCardBill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user