Merge pull request 'develop' (#322) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/322
This commit is contained in:
commit
a797fae7ca
@ -394,8 +394,21 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
}
|
||||
else{
|
||||
Date billMonthDate = DateUtils.parseDate(emisSettleBill.getBillMonth() + "-"+settleDay);
|
||||
paymentDueDate = DateUtils.addMonths(billMonthDate,1);
|
||||
paymentDueDate= DateUtils.addDays(paymentDueDate,creditPeriod.intValue());
|
||||
|
||||
// credit_period 为 30/60/90 且结算日为每月 1 号时,按对应月份月末作为最后付款日
|
||||
if ((creditPeriod.intValue() == 30 || creditPeriod.intValue() == 60 || creditPeriod.intValue() == 90)
|
||||
&& monthUser.getSettleDay() == 1) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(billMonthDate);
|
||||
// 30 -> 加 1 个月,60 -> 加 2 个月,90 -> 加 3 个月
|
||||
cal.add(Calendar.MONTH, creditPeriod.intValue() / 30);
|
||||
// 设置为该月的最后一天
|
||||
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
paymentDueDate = cal.getTime();
|
||||
} else {
|
||||
paymentDueDate = DateUtils.addMonths(billMonthDate,1);
|
||||
paymentDueDate= DateUtils.addDays(paymentDueDate,creditPeriod.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
// 最后付款时间
|
||||
@ -441,10 +454,21 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
updBill.setCreditPeriod(creditPeriod);
|
||||
updBill.setSettleDay(settleDay);
|
||||
|
||||
// 现金账期从寄件开始10天
|
||||
// 根据账期与结算日计算最后付款时间
|
||||
Date billMonthDate = DateUtils.parseDate(oldEmisSettleBill.getBillMonth() + "-" + settleDay);
|
||||
Date paymentDueDate = DateUtils.addMonths(billMonthDate, 1);
|
||||
paymentDueDate = DateUtils.addDays(paymentDueDate, creditPeriod.intValue());
|
||||
Date paymentDueDate;
|
||||
|
||||
if ((creditPeriod.intValue() == 30 || creditPeriod.intValue() == 60 || creditPeriod.intValue() == 90)
|
||||
&& settleDay == 1) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(billMonthDate);
|
||||
cal.add(Calendar.MONTH, creditPeriod.intValue() / 30);
|
||||
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
paymentDueDate = cal.getTime();
|
||||
} else {
|
||||
paymentDueDate = DateUtils.addMonths(billMonthDate, 1);
|
||||
paymentDueDate = DateUtils.addDays(paymentDueDate, creditPeriod.intValue());
|
||||
}
|
||||
|
||||
// 最后付款时间
|
||||
updBill.setPaymentDueDate(paymentDueDate);
|
||||
@ -1584,6 +1608,63 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
||||
@Override
|
||||
public int updateEmisSettleBill(EmisSettleBill emisSettleBill)
|
||||
{
|
||||
// 如果修改了billMonth,需要重新计算最后回款日
|
||||
if (emisSettleBill.getId() != null && StringUtils.isNotEmpty(emisSettleBill.getBillMonth())) {
|
||||
EmisSettleBill oldBill = emisSettleBillMapper.selectEmisSettleBillById(emisSettleBill.getId());
|
||||
if (oldBill != null && !emisSettleBill.getBillMonth().equals(oldBill.getBillMonth())) {
|
||||
// billMonth发生变化,且是月结类型,需要重新计算最后回款日
|
||||
if ("2".equals(oldBill.getSettleType())) {
|
||||
EmisCustomerUser monthUser = getCustomerUserByMonthlyPayCode(oldBill.getCustNo());
|
||||
if (monthUser != null) {
|
||||
// 默认30天,从1号开始
|
||||
BigDecimal creditPeriod = BigDecimal.valueOf(30D);
|
||||
Integer settleDay = 1;
|
||||
|
||||
if (monthUser.getCreditPeriod() != null) {
|
||||
creditPeriod = monthUser.getCreditPeriod();
|
||||
}
|
||||
|
||||
if (monthUser.getSettleDay() != null) {
|
||||
settleDay = monthUser.getSettleDay();
|
||||
}
|
||||
|
||||
Date paymentDueDate = null;
|
||||
// 周结和半月结的特殊处理
|
||||
if (creditPeriod.intValue() == 7) {
|
||||
// // 获取今日零点 T+6,T为出账日
|
||||
// String currDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date());
|
||||
// Date currDayDate = DateUtils.parseDate(currDayStr);
|
||||
// paymentDueDate = DateUtils.addDays(currDayDate, 7);
|
||||
} else if (creditPeriod.intValue() == 15) {
|
||||
// String currDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date());
|
||||
// Date currDayDate = DateUtils.parseDate(currDayStr);
|
||||
// paymentDueDate = DateUtils.addDays(currDayDate, 15);
|
||||
} else {
|
||||
Date billMonthDate = DateUtils.parseDate(emisSettleBill.getBillMonth() + "-" + settleDay);
|
||||
|
||||
// credit_period 为 30/60/90 且结算日为每月 1 号时,按对应月份月末作为最后付款日
|
||||
if ((creditPeriod.intValue() == 30 || creditPeriod.intValue() == 60 || creditPeriod.intValue() == 90)
|
||||
&& monthUser.getSettleDay() == 1) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(billMonthDate);
|
||||
// 30 -> 加 1 个月,60 -> 加 2 个月,90 -> 加 3 个月
|
||||
cal.add(Calendar.MONTH, creditPeriod.intValue() / 30);
|
||||
// 设置为该月的最后一天
|
||||
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
paymentDueDate = cal.getTime();
|
||||
} else {
|
||||
paymentDueDate = DateUtils.addMonths(billMonthDate, 1);
|
||||
paymentDueDate = DateUtils.addDays(paymentDueDate, creditPeriod.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
// 设置重新计算后的最后回款日
|
||||
emisSettleBill.setPaymentDueDate(paymentDueDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return emisSettleBillMapper.updateEmisSettleBill(emisSettleBill);
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from emis_tms_cost_profit b,emis_waybill a
|
||||
<where>
|
||||
a.bill_code=b.bill_code and a.del_flag='0' and b.del_flag='0'
|
||||
and not EXISTS (
|
||||
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(151)
|
||||
)
|
||||
<if test="id != null "> and b.id = #{id}</if>
|
||||
<if test="billCode != null and billCode != ''">and ( FIND_IN_SET(b.`bill_code`,#{billCode}) )</if>
|
||||
<if test="standardFee != null "> and b.standard_fee = #{standardFee}</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user