Просмотр исходного кода

[滞纳金][修改][修改滞纳金自动累加逻辑]

release_toaliyun_real
luozukai 6 лет назад
Родитель
Сommit
6bdcadb185
7 измененных файлов: 60 добавлений и 127 удалений
  1. +9
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java
  2. +6
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java
  3. +5
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java
  4. +1
    -61
      mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java
  5. +15
    -61
      mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java
  6. +12
    -2
      mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml
  7. +12
    -2
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml

+ 9
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java Просмотреть файл

@@ -6,6 +6,8 @@ import com.iformall.domain.po.WxBillProperty;
import com.iformall.domain.po.WxBillRent; import com.iformall.domain.po.WxBillRent;
import com.iformall.enums.EnumBillAction; import com.iformall.enums.EnumBillAction;
import com.iformall.mapper.WxBillActionMapper; import com.iformall.mapper.WxBillActionMapper;
import com.iformall.mapper.WxBillPropertyMapper;
import com.iformall.mapper.WxBillRentMapper;
import com.iformall.service.WxBillPropertyService; import com.iformall.service.WxBillPropertyService;
import com.iformall.service.WxBillRentService; import com.iformall.service.WxBillRentService;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -30,7 +32,10 @@ public class LatePayBillActionSchedule {
private WxBillPropertyService wxBillPropertyService; private WxBillPropertyService wxBillPropertyService;
@Autowired @Autowired
private WxBillActionMapper wxBillActionMapper; private WxBillActionMapper wxBillActionMapper;

@Autowired
private WxBillRentMapper wxBillRentMapper;
@Autowired
private WxBillPropertyMapper wxBillPropertyMapper;
/** /**
* 每天凌晨1点执行 * 每天凌晨1点执行
*/ */
@@ -61,6 +66,9 @@ public class LatePayBillActionSchedule {
billAction.setDetails("系统计入"+ divide.toString()+"元"); billAction.setDetails("系统计入"+ divide.toString()+"元");
wxBillActionMapper.insertSelective(billAction); wxBillActionMapper.insertSelective(billAction);
} }

wxBillRentMapper.autoAddLatePayPrice();
wxBillPropertyMapper.autoAddLatePayPrice();
logger.info("账单滞纳金更新结束"); logger.info("账单滞纳金更新结束");
} }




+ 6
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java Просмотреть файл

@@ -2,6 +2,7 @@ package com.iformall.mapper;


import com.iformall.common.CommonMapper; import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxBillProperty; import com.iformall.domain.po.WxBillProperty;
import com.iformall.domain.po.WxBillRent;
import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxPropertyContract;
import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxRentContract;


@@ -46,4 +47,9 @@ public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long>
WxBillProperty selectBillOne(WxBillProperty propertyQuery); WxBillProperty selectBillOne(WxBillProperty propertyQuery);


List<WxBillProperty> findLatePayBill(); List<WxBillProperty> findLatePayBill();

/**
* 累加每一天的滞纳金
*/
void autoAddLatePayPrice();
} }

+ 5
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java Просмотреть файл

@@ -44,4 +44,9 @@ public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> {
WxBillRent selectBillOne(WxBillRent rentQuery); WxBillRent selectBillOne(WxBillRent rentQuery);


List<WxBillRent> findLatePayBill(); List<WxBillRent> findLatePayBill();

/**
* 累加每一天的滞纳金
*/
void autoAddLatePayPrice();
} }

+ 1
- 61
mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java Просмотреть файл

@@ -57,20 +57,6 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService {
PageHelper.startPage(pageIndex, pageSize); PageHelper.startPage(pageIndex, pageSize);
List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record);
PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList); PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList);
billRentList.stream().forEach(b -> {
if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
});
return pageInfo; return pageInfo;
} }


@@ -118,21 +104,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService {
public WxBillProperty getById(Long id) { public WxBillProperty getById(Long id) {
WxBillProperty record = new WxBillProperty(); WxBillProperty record = new WxBillProperty();
record.setId(id); record.setId(id);
WxBillProperty b = wxBillPropertyMapper.queryBillPropertyList(record).get(0);

if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
return b;
return wxBillPropertyMapper.queryBillPropertyList(record).get(0);
} }


@Override @Override
@@ -228,20 +200,6 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService {
updateBillStatus(record); updateBillStatus(record);
PageHelper.startPage(pageIndex, pageSize); PageHelper.startPage(pageIndex, pageSize);
List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record);
billRentList.stream().forEach(b -> {
if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
});
PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList); PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList);
return pageInfo; return pageInfo;
} }
@@ -303,24 +261,6 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService {
String billName = wxBillProperty.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺物业账单" : "多经点位物业账单"; String billName = wxBillProperty.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺物业账单" : "多经点位物业账单";


List<WxBillProperty> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty); List<WxBillProperty> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty);
billPropertyList.stream().forEach(b -> {
if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
if (b.getDepositStatus() == null) {
b.setDepositStatus(0);
}
});

Map<Long, List<WxBillProperty>> collect = billPropertyList.parallelStream() Map<Long, List<WxBillProperty>> collect = billPropertyList.parallelStream()
.collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); .collect(Collectors.groupingBy(WxBillProperty::getMerchantId));
Set<Map.Entry<Long, List<WxBillProperty>>> entries = collect.entrySet(); Set<Map.Entry<Long, List<WxBillProperty>>> entries = collect.entrySet();


+ 15
- 61
mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java Просмотреть файл

@@ -56,20 +56,20 @@ public class WxBillRentServiceImpl implements WxBillRentService {
public PageInfo<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { public PageInfo<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) {
PageHelper.startPage(pageIndex, pageSize); PageHelper.startPage(pageIndex, pageSize);
List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record); List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record);
billRentList.stream().forEach(b -> {
if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
});
// billRentList.stream().forEach(b -> {
// if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
// int latePayDay = 0; //默认第次日开始交滞纳金
// if(b.getLatePayDay() != null){
// latePayDay = b.getLatePayDay();
// }
// Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
// long dayCount = DateUtils.startToEnd(startPay,new Date());
// if(dayCount >0) {
// BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).multiply(new BigDecimal(dayCount)).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
// b.setLatePayPrice(divide.longValue());
// }
// }
// });
PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList); PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList);
return pageInfo; return pageInfo;
} }
@@ -118,21 +118,7 @@ public class WxBillRentServiceImpl implements WxBillRentService {
public WxBillRent getById(Long id) { public WxBillRent getById(Long id) {
WxBillRent record = new WxBillRent(); WxBillRent record = new WxBillRent();
record.setId(id); record.setId(id);
WxBillRent b = wxBillRentMapper.queryBillRentList(record).get(0);

if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
return b;
return wxBillRentMapper.queryBillRentList(record).get(0);
} }


@Override @Override
@@ -227,20 +213,6 @@ public class WxBillRentServiceImpl implements WxBillRentService {
updateBillStatus(record); updateBillStatus(record);
PageHelper.startPage(pageIndex, pageSize); PageHelper.startPage(pageIndex, pageSize);
List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record); List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record);
billRentList.stream().forEach(b -> {
if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
});
PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList); PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList);
return pageInfo; return pageInfo;
} }
@@ -338,24 +310,6 @@ public class WxBillRentServiceImpl implements WxBillRentService {
public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRent wxBillRent) { public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRent wxBillRent) {
String billName = wxBillRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单"; String billName = wxBillRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单";
List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent); List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent);
billRentList.stream().forEach(b -> {
if(b.getLatePayRatio() != null && b.getLatePayRatio() > 0){
int latePayDay = 0; //默认第次日开始交滞纳金
if(b.getLatePayDay() != null){
latePayDay = b.getLatePayDay();
}
Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay);
long dayCount = DateUtils.startToEnd(startPay,new Date());
if(dayCount >0) {
BigDecimal divide = new BigDecimal(b.getOwe()).multiply(new BigDecimal(b.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
b.setLatePayPrice(divide.longValue());
}
}
if (b.getDepositStatus() == null) {
b.setDepositStatus(0);
}
});

Map<Long, List<WxBillRent>> collect = billRentList.parallelStream() Map<Long, List<WxBillRent>> collect = billRentList.parallelStream()
.collect(Collectors.groupingBy(WxBillRent::getMerchantId)); .collect(Collectors.groupingBy(WxBillRent::getMerchantId));
Set<Map.Entry<Long, List<WxBillRent>>> entries = collect.entrySet(); Set<Map.Entry<Long, List<WxBillRent>>> entries = collect.entrySet();


+ 12
- 2
mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml Просмотреть файл

@@ -92,7 +92,7 @@
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,m.`name` case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,m.`name`
merchant_name,s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`, merchant_name,s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`,
br.`revenue`,br.`late_pay_ratio`,br.`late_pay_time`,br.`property_contract_id`,d.receive_pay deposit,
br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`property_contract_id`,d.receive_pay deposit,
br.late_pay_price,d.`status` br.late_pay_price,d.`status`
deposit_status,br.`shop_info`,br.pay_way,br.late_pay_status, deposit_status,br.`shop_info`,br.pay_way,br.late_pay_status,
br.`comments`,br.starttime,br.endtime, br.`comments`,br.starttime,br.endtime,
@@ -228,8 +228,18 @@


<select id="findLatePayBill" resultMap="BaseResultMap"> <select id="findLatePayBill" resultMap="BaseResultMap">
select r.id,r.owe,c.late_pay_ratio from wx_bill_property r left join wx_property_contract c on(r.`property_contract_id`=c.id) select r.id,r.owe,c.late_pay_ratio from wx_bill_property r left join wx_property_contract c on(r.`property_contract_id`=c.id)
where c.late_pay_ratio >0 and DATEDIFF(now(),receive_date) >= if(c.late_pay_day=0,1,c.late_pay_day)
where c.late_pay_ratio >0
and DATEDIFF(now(), date_add(r.receive_date,interval(c.late_pay_day) day)) >0
</select> </select>


<update id="autoAddLatePayPrice">
update wx_bill_property b set b.late_pay_price = b.late_pay_price +
round(
b.owe * (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) /10000
,2)
where b.status!=3 and b.status!=6
and (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) > 0
and DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) >0;
</update>
</mapper> </mapper>



+ 12
- 2
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Просмотреть файл

@@ -96,7 +96,7 @@
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,r.merchant_name, case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,r.merchant_name,
s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type, s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type,
r.pay_ratio,br.`revenue`,br.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`,
r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`,
d.receive_pay deposit,d.`status` d.receive_pay deposit,d.`status`
deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime,
r.late_pay_day,r.late_pay_ratio r.late_pay_day,r.late_pay_ratio
@@ -231,7 +231,17 @@
<select id="findLatePayBill" resultMap="BaseResultMap"> <select id="findLatePayBill" resultMap="BaseResultMap">
select r.id,r.owe,c.late_pay_ratio from wx_bill_rent r left join wx_rent_contract c on(r.`rent_contract_id`=c.id) select r.id,r.owe,c.late_pay_ratio from wx_bill_rent r left join wx_rent_contract c on(r.`rent_contract_id`=c.id)
where c.late_pay_ratio >0 and where c.late_pay_ratio >0 and
DATEDIFF(now(),receive_date) >= if(c.late_pay_day=0,1,c.late_pay_day)
DATEDIFF(now(), date_add(r.receive_date,interval(c.late_pay_day) day)) >0
</select> </select>

<update id="autoAddLatePayPrice">
update wx_bill_rent b set b.late_pay_price = b.late_pay_price +
round(
b.owe * (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) /10000
,2)
where b.status!=3 and b.status!=6
and (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) > 0
and DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`rent_contract_id`) day)) >0;
</update>
</mapper> </mapper>



Загрузка…
Отмена
Сохранить