| @@ -98,12 +98,12 @@ public class WxBillBaseEntity extends TenantEntity { | |||
| // @TableField(exist = false) | |||
| // protected Integer onlyOwe; | |||
| //账单逾期计算提前天数 | |||
| //账单逾期计算截止时间 | |||
| @TableField(exist = false) | |||
| private Integer oweBillBeforeDays; | |||
| private Date oweBillLastTime; | |||
| //临期计算提前天数 | |||
| //临期计算截止时间 | |||
| @TableField(exist = false) | |||
| private Integer nearBillBeforeDays; | |||
| private Date nearBillLastTime; | |||
| } | |||
| @@ -104,8 +104,13 @@ public class WxBillAllHelper { | |||
| bill.setStarttime(starttime); | |||
| bill.setEndtime(enttime); | |||
| bill.setRentShopType(wxMerchant.getType()); | |||
| bill.setOweBillBeforeDays(wxMerchant.getOweBillBeforeDays()); | |||
| bill.setNearBillBeforeDays(wxMerchant.getNearBillBeforeDays()); | |||
| Date nowBegin = DateUtils.getDayBegin(new Date()); | |||
| if (null != wxMerchant.getOweBillBeforeDays()) { | |||
| bill.setOweBillLastTime(DateUtils.getSecondsTimeAfter(wxMerchant.getOweBillBeforeDays()*3600, nowBegin)); | |||
| } | |||
| if (null != wxMerchant.getNearBillBeforeDays()) { | |||
| bill.setNearBillLastTime(DateUtils.getSecondsTimeAfter(wxMerchant.getNearBillBeforeDays()*3600, nowBegin)); | |||
| } | |||
| } | |||
| public WxBillSum getBillRentSum(WxMerchant wxMerchant,Date starttime, Date enttime) { | |||
| @@ -380,7 +380,7 @@ public class DateUtils { | |||
| Date date = new Date(myTime * 1000); | |||
| return formatter.format(date); | |||
| } | |||
| /** | |||
| * 获得当前时间前几小时的时间 | |||
| * | |||
| @@ -403,10 +403,14 @@ public class DateUtils { | |||
| * @return | |||
| */ | |||
| public static String getSecondsTimeBefore(int seconds, Date myDate) { | |||
| SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| return formatter.format(getDateTimeBefore(seconds, myDate)); | |||
| } | |||
| public static Date getDateTimeBefore(int seconds, Date myDate) { | |||
| long myTime = (myDate.getTime() / 1000) - seconds; | |||
| Date date = new Date(myTime * 1000); | |||
| return formatter.format(date); | |||
| return date; | |||
| } | |||
| /** | |||
| @@ -102,16 +102,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != buildWay ">and br.`build_way` = #{buildWay}</if> | |||
| <if test=" null != merchantIds "> | |||
| @@ -123,16 +123,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| @@ -107,16 +107,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| @@ -103,16 +103,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| @@ -114,16 +114,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| @@ -134,16 +134,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if> | |||
| @@ -122,16 +122,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != manageFeeType ">and br.`manage_fee_type` = #{manageFeeType}</if> | |||
| <if test=" null != hasMerchant ">and br.`merchant_id` is not null</if> | |||
| @@ -139,16 +139,11 @@ | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6) | |||
| ) | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != nearBillBeforeDays and null != oweBillBeforeDays"> | |||
| and (br.`starttime` >= DATE_SUB(NOW(),INTERVAL #{nearBillBeforeDays} DAY) | |||
| and br.`starttime` < DATE_SUB(NOW(),INTERVAL #{oweBillBeforeDays} DAY) | |||
| and br.status not in (3,6) | |||
| ) | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.status not in (3,6)) | |||
| </if> | |||
| <if test=" null != rentContractIdList "> | |||
| and br.`rent_contract_id` in | |||