Procházet zdrojové kódy

Merge commit '5ccfde51285bc26bfd64d14a6a72190f54a0a622' into release

release_toaliyun_real
luozukai před 6 roky
rodič
revize
6e6a9f6b9a
12 změnil soubory, kde provedl 105 přidání a 96 odebrání
  1. +3
    -28
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  2. +2
    -0
      mallinkAdmin/src/main/resources/db/migration/V201908021153__L_ALTER_CONTENT.sql
  3. +1
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
  4. +2
    -40
      mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java
  5. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java
  6. +5
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java
  7. +5
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java
  8. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
  9. +10
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  10. +7
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  11. +34
    -10
      mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml
  12. +33
    -9
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml

+ 3
- 28
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java Zobrazit soubor

@@ -56,39 +56,14 @@ public class WxRentContractController extends BaseController {
WxBillRentMapper wxBillRentMapper; WxBillRentMapper wxBillRentMapper;
@Autowired @Autowired
WxBillPropertyMapper wxBillPropertyMapper; WxBillPropertyMapper wxBillPropertyMapper;
@Autowired
private WxBillActionMapper wxBillActionMapper;
@Autowired
private WxBillPropertyService wxBillPropertyService;
@GetMapping("autolatePay") @GetMapping("autolatePay")
@SystemControllerLog(description = "autolatePay") @SystemControllerLog(description = "autolatePay")
public ResultData autolatePay(String startDate, String endDate) throws Exception{ public ResultData autolatePay(String startDate, String endDate) throws Exception{
try { try {
logger.info("账单滞纳金更新开始"); logger.info("账单滞纳金更新开始");
final IdWorker idWorker = IdWorker.get();
List<WxBillRent> billRentList = wxBillRentService.findLatePayBill();
for (WxBillRent wxBillRent : billRentList) {
WxBillAction billAction = new WxBillAction();
billAction.setId(idWorker.nextId());
billAction.setUserName("系统端");
billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode());
billAction.setBillId(wxBillRent.getId());
BigDecimal divide = new BigDecimal(wxBillRent.getOwe()).multiply(new BigDecimal(wxBillRent.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
billAction.setDetails("系统计入"+ divide.toString()+"元");
wxBillActionMapper.insertSelective(billAction);
}

List<WxBillProperty> billPropertyList = wxBillPropertyService.findLatePayBill();
for (WxBillProperty wxBillRent : billPropertyList) {
WxBillAction billAction = new WxBillAction();
billAction.setId(idWorker.nextId());
billAction.setUserName("系统端");
billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode());
billAction.setBillId(wxBillRent.getId());
BigDecimal divide = new BigDecimal(wxBillRent.getOwe()).multiply(new BigDecimal(wxBillRent.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
billAction.setDetails("系统计入"+ divide.toString()+"元");
wxBillActionMapper.insertSelective(billAction);
}
wxBillRentMapper.insertBillAction();
wxBillPropertyMapper.insertBillAction();

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


+ 2
- 0
mallinkAdmin/src/main/resources/db/migration/V201908021153__L_ALTER_CONTENT.sql Zobrazit soubor

@@ -0,0 +1,2 @@
alter table wx_rent_contract modify `late_pay_day` INT(10) DEFAULT 0;
alter table wx_property_contract modify `late_pay_day` INT(10) DEFAULT 0;

+ 1
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java Zobrazit soubor

@@ -106,8 +106,7 @@ public class WxCouponChannelController extends BaseController {
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode());
wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC);
WxCouponChannelVo vo = wxCouponChannelService.change(wxCouponChannel);
return new ResultData(vo);
return wxCouponChannelService.change(wxCouponChannel);
} }






+ 2
- 40
mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java Zobrazit soubor

@@ -1,22 +1,12 @@
package com.iformall.schedule; package com.iformall.schedule;


import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxBillAction;
import com.iformall.domain.po.WxBillProperty;
import com.iformall.domain.po.WxBillRent;
import com.iformall.enums.EnumBillAction;
import com.iformall.mapper.WxBillActionMapper;
import com.iformall.mapper.WxBillPropertyMapper; import com.iformall.mapper.WxBillPropertyMapper;
import com.iformall.mapper.WxBillRentMapper; import com.iformall.mapper.WxBillRentMapper;
import com.iformall.service.WxBillPropertyService;
import com.iformall.service.WxBillRentService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;


/** /**
* @author luozukai * @author luozukai
@@ -24,13 +14,6 @@ import java.util.List;
@Component @Component
public class LatePayBillActionSchedule { public class LatePayBillActionSchedule {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxBillRentService wxBillRentService;
@Autowired
private WxBillPropertyService wxBillPropertyService;
@Autowired
private WxBillActionMapper wxBillActionMapper;
@Autowired @Autowired
private WxBillRentMapper wxBillRentMapper; private WxBillRentMapper wxBillRentMapper;
@Autowired @Autowired
@@ -42,30 +25,9 @@ public class LatePayBillActionSchedule {
public void updateBillStatus() { public void updateBillStatus() {
try { try {
logger.info("账单滞纳金更新开始"); logger.info("账单滞纳金更新开始");
final IdWorker idWorker = IdWorker.get();
List<WxBillRent> billRentList = wxBillRentService.findLatePayBill();
for (WxBillRent wxBillRent : billRentList) {
WxBillAction billAction = new WxBillAction();
billAction.setId(idWorker.nextId());
billAction.setUserName("系统端");
billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode());
billAction.setBillId(wxBillRent.getId());
BigDecimal divide = new BigDecimal(wxBillRent.getOwe()).multiply(new BigDecimal(wxBillRent.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
billAction.setDetails("系统计入"+ divide.toString()+"元");
wxBillActionMapper.insertSelective(billAction);
}
wxBillRentMapper.insertBillAction();
wxBillPropertyMapper.insertBillAction();


List<WxBillProperty> billPropertyList = wxBillPropertyService.findLatePayBill();
for (WxBillProperty wxBillRent : billPropertyList) {
WxBillAction billAction = new WxBillAction();
billAction.setId(idWorker.nextId());
billAction.setUserName("系统端");
billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode());
billAction.setBillId(wxBillRent.getId());
BigDecimal divide = new BigDecimal(wxBillRent.getOwe()).multiply(new BigDecimal(wxBillRent.getLatePayRatio())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
billAction.setDetails("系统计入"+ divide.toString()+"元");
wxBillActionMapper.insertSelective(billAction);
}
wxBillRentMapper.autoAddLatePayPrice(); wxBillRentMapper.autoAddLatePayPrice();
wxBillPropertyMapper.autoAddLatePayPrice(); wxBillPropertyMapper.autoAddLatePayPrice();
logger.info("账单滞纳金更新结束"); logger.info("账单滞纳金更新结束");


+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java Zobrazit soubor

@@ -40,6 +40,7 @@ public class WxScoreRules extends BaseEntity {
" {\"businessId\":8,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + " {\"businessId\":8,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":9,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + " {\"businessId\":9,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":10,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + " {\"businessId\":10,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":11,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":6,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}" + " {\"businessId\":6,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}" +
"]}," + "]}," +
"{\"id\":3,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"绑定车牌1个\"}," + "{\"id\":3,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"绑定车牌1个\"}," +
@@ -62,6 +63,7 @@ public class WxScoreRules extends BaseEntity {
" {\"businessId\":8,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + " {\"businessId\":8,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":9,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + " {\"businessId\":9,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":10,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + " {\"businessId\":10,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":11,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," +
" {\"businessId\":6,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}" + " {\"businessId\":6,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}" +
"]}," + "]}," +
"{\"id\":3,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"绑定车牌1个\"}," + "{\"id\":3,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"绑定车牌1个\"}," +


+ 5
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java Zobrazit soubor

@@ -52,4 +52,9 @@ public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long>
* 累加每一天的滞纳金 * 累加每一天的滞纳金
*/ */
void autoAddLatePayPrice(); void autoAddLatePayPrice();

/**
* 保存billAction
*/
void insertBillAction();
} }

+ 5
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java Zobrazit soubor

@@ -49,4 +49,9 @@ public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> {
* 累加每一天的滞纳金 * 累加每一天的滞纳金
*/ */
void autoAddLatePayPrice(); void autoAddLatePayPrice();

/**
* 保存billAction
*/
void insertBillAction();
} }

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java Zobrazit soubor

@@ -70,6 +70,6 @@ public interface WxCouponChannelService {


void updateStatusByCouponId(Long couponId,String tenantId,int status); void updateStatusByCouponId(Long couponId,String tenantId,int status);


WxCouponChannelVo change(WxCouponChannel wxCouponChannel);
ResultData change(WxCouponChannel wxCouponChannel);


} }

+ 10
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Zobrazit soubor

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker; import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxCouponChannel;
@@ -138,7 +139,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
} }


@Override @Override
public WxCouponChannelVo change(WxCouponChannel record) {
public ResultData change(WxCouponChannel record) {
Long couponId = 0L; Long couponId = 0L;
if (record.getCouponId() != null) { if (record.getCouponId() != null) {
couponId = record.getCouponId(); couponId = record.getCouponId();
@@ -146,10 +147,13 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
} }
List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(record); List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(record);
if (voList.isEmpty()) { if (voList.isEmpty()) {
return null;
return new ResultData(Result.SUCCESS, "查询成功", null);
} }
Map<String, Object> data = new HashMap<>();
if (voList.size() == 1) { if (voList.size() == 1) {
return voList.get(0);
data.put("size", 1);
data.put("data", voList.get(0));
return new ResultData(Result.SUCCESS, "查询成功", data);
} }
Long finalCouponId = couponId; Long finalCouponId = couponId;
voList = voList.stream() voList = voList.stream()
@@ -157,7 +161,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
.collect(Collectors.toList()); .collect(Collectors.toList());
int size = voList.size(); int size = voList.size();
Random random = new Random(); Random random = new Random();
return voList.get(random.nextInt(size));
data.put("size", size);
data.put("data", voList.get(random.nextInt(size)));
return new ResultData(Result.SUCCESS, "查询成功", data);
} }


private boolean isCouponMerchantValid(Long couponId) { private boolean isCouponMerchantValid(Long couponId) {


+ 7
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Zobrazit soubor

@@ -1000,6 +1000,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return shopInfoStr; return shopInfoStr;
} }



public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Map<String,Object> resultMap = new HashedMap(); Map<String,Object> resultMap = new HashedMap();
@@ -1050,8 +1051,12 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb); needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb);
}else{ }else{
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb);
needpayAfter = getNeedPayMoney(wxRentContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size(),saveDb);
if(billTimeVo.getStartDate().before(endDate)){
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), endDate, i, billTimeVoList.size(), saveDb);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb);
}else{
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb);
}
} }
needpay = needpayFront+needpayAfter; needpay = needpayFront+needpayAfter;
flag = true; flag = true;


+ 34
- 10
mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml Zobrazit soubor

@@ -139,9 +139,9 @@


<update id="updateNotPaidStatus" parameterType="hashmap"> <update id="updateNotPaidStatus" parameterType="hashmap">
update wx_bill_property b set b.status=#{notPaid},b.expired_day= update wx_bill_property b set b.status=#{notPaid},b.expired_day=
DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`property_contract_id`) day))
DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day))
where b.tenant_id=#{tenantId} and b.status!=#{paid} and b.status!=6 and where b.tenant_id=#{tenantId} and b.status!=#{paid} and b.status!=6 and
DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`property_contract_id`) day)) >0
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> </update>


<update id="updateWaitPayStatus" parameterType="hashmap"> <update id="updateWaitPayStatus" parameterType="hashmap">
@@ -226,17 +226,41 @@
AND date_format(starttime,'%Y-%m-%d 00:00:00.0') = #{starttime} AND date_format(endtime,'%Y-%m-%d 00:00:00.0') = #{endtime} AND date_format(starttime,'%Y-%m-%d 00:00:00.0') = #{starttime} AND date_format(endtime,'%Y-%m-%d 00:00:00.0') = #{endtime}
</select> </select>


<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)
<update id="insertBillAction">
insert into wx_bill_action(id,user_name,`action`,bill_id,details)
select
(select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id
,'系统端' user_name,7 `action`,b.id bill_id,
CONCAT('系统计入',
if(b.late_pay_price is null,
round(
b.owe * c.late_pay_ratio * DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) /10000
,2)
,
round(
b.owe * (c.late_pay_ratio) /10000
,2)
)
,'元') details
from wx_bill_property b left join wx_property_contract c on(b.`property_contract_id`=c.id)
where c.late_pay_ratio >0 where c.late_pay_ratio >0
and DATEDIFF(now(), date_add(r.receive_date,interval(c.late_pay_day) day)) >0
</select>
and DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) >0
and b.status!=3 and b.status!=6
</update>


<update id="autoAddLatePayPrice"> <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)
update wx_bill_property b set b.late_pay_price =
if(b.late_pay_price is null,
round(
b.owe * (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`)
* DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) /100
,2)
,
b.late_pay_price +
round(
b.owe * (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) /100
,2)
)
where b.status!=3 and b.status!=6 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 (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; 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;


+ 33
- 9
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Zobrazit soubor

@@ -228,17 +228,41 @@
AND date_format(starttime,'%Y-%m-%d 00:00:00.0') = #{starttime} AND date_format(endtime,'%Y-%m-%d 00:00:00.0') = #{endtime} AND date_format(starttime,'%Y-%m-%d 00:00:00.0') = #{starttime} AND date_format(endtime,'%Y-%m-%d 00:00:00.0') = #{endtime}
</select> </select>


<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)
where c.late_pay_ratio >0 and
DATEDIFF(now(), date_add(r.receive_date,interval(c.late_pay_day) day)) >0
</select>
<update id="insertBillAction">
insert into wx_bill_action(id,user_name,`action`,bill_id,details)
select
(select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id
,'系统端' user_name,7 `action`,b.id bill_id,
CONCAT('系统计入',
if(b.late_pay_price is null,
round(
b.owe * c.late_pay_ratio * DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) /10000
,2)
,
round(
b.owe * (c.late_pay_ratio) /10000
,2)
)
,'元') details
from wx_bill_rent b left join wx_rent_contract c on(b.rent_contract_id=c.id)
where c.late_pay_ratio >0
and DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) >0
and b.status!=3 and b.status!=6
</update>


<update id="autoAddLatePayPrice"> <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)
update wx_bill_rent b set b.late_pay_price =
if(b.late_pay_price is null,
round(
b.owe * (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`)
* DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`rent_contract_id`) day)) /100
,2)
,
b.late_pay_price +
round(
b.owe * (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) /100
,2)
)
where b.status!=3 and b.status!=6 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 (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; 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;


Načítá se…
Zrušit
Uložit