From 56111d8da68b54d49a1341394f62088170b2f071 Mon Sep 17 00:00:00 2001 From: luozukai Date: Fri, 26 Jul 2019 18:18:20 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B4=A6=E5=8D=95][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BB=9E=E7=BA=B3=E9=87=91=E8=AE=A1=E7=AE=97?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WxPropertyContractController.java | 20 +- .../contract/WxRentContractController.java | 17 +- .../migration/V201907261815__L_ALTER_BILL.sql | 11 ++ .../domain/po/WxPropertyContract.java | 7 +- .../iformall/domain/po/WxRentContract.java | 5 + .../service/WxPropertyContractService.java | 5 +- .../impl/WxPropertyContractServiceImpl.java | 174 +++++++++++------- .../impl/WxRentContractServiceImpl.java | 8 - .../resources/mapper/WxBillPropertyMapper.xml | 3 +- .../resources/mapper/WxBillRentMapper.xml | 6 +- .../mapper/WxPropertyContractMapper.xml | 5 +- .../resources/mapper/WxRentContractMapper.xml | 8 +- 12 files changed, 161 insertions(+), 108 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V201907261815__L_ALTER_BILL.sql diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java index 7c3ec44e9..8f9fe1935 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java @@ -4,9 +4,8 @@ import com.iformall.annotation.SystemControllerLog; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillProperty; -import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.*; +import com.iformall.enums.EnumIsPreview; import com.iformall.enums.EnumRentStartType; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxPropertyContractMapper; @@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.List; import java.util.Map; /** @@ -180,4 +180,18 @@ public class WxPropertyContractController extends BaseController { return new ResultData(); } + /** + * 预览账单展示,编辑账期,后端生成账单金额 + * @param wxPropertyContract + * @return + */ + @PostMapping("buildBillPriceList") + @SystemControllerLog(description = "物业合同-生成账单列表金额") + public ResultData buildBillPriceList(@RequestBody WxPropertyContract wxPropertyContract) throws Exception{ + logger.debug("[" + getIpAddr() + "] WxRentContractController::buildBillPriceList"); + WxPropertyContract dbRent = wxPropertyContractMapper.selectByPrimaryKey(wxPropertyContract.getId()); + dbRent.setPreviewBillRentList(wxPropertyContract.getPreviewBillRentList()); + List result = wxPropertyContractService.buildProperty(new WxMerchant(),getUserId(),dbRent, EnumIsPreview.YES.getCode(), false); + return new ResultData(result); + } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index 30762a82e..df366b776 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -84,23 +84,8 @@ public class WxRentContractController extends BaseController { */ @PostMapping("buildBillPriceList") @SystemControllerLog(description = "租赁合同-生成账单列表金额") - public ResultData buildBillPriceList(@ModelAttribute WxRentContract wxRentContract) throws Exception{ + public ResultData buildBillPriceList(@RequestBody WxRentContract wxRentContract) throws Exception{ logger.debug("[" + getIpAddr() + "] WxRentContractController::buildBillPriceList"); - - //todo:test -// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); -// wxRentContract.setId(312447858201595904l); -// List previewBillRentList = new ArrayList<>(); -// WxBillRent b = new WxBillRent(); -// b.setStarttime(sdf.parse("2019-07-10")); -// b.setEndtime(sdf.parse("2020-08-10")); -// previewBillRentList.add(b); -// b = new WxBillRent(); -// b.setStarttime(sdf.parse("2020-08-11")); -// b.setEndtime(sdf.parse("2021-07-30")); -// previewBillRentList.add(b); -// wxRentContract.setPreviewBillRentList(previewBillRentList); - WxRentContract dbRent = wxRentContractMapper.selectByPrimaryKey(wxRentContract.getId()); dbRent.setPreviewBillRentList(wxRentContract.getPreviewBillRentList()); List result = wxRentContractService.buildRent(new WxMerchant(),getUserId(),dbRent, EnumIsPreview.YES.getCode(), false); diff --git a/mallinkAdmin/src/main/resources/db/migration/V201907261815__L_ALTER_BILL.sql b/mallinkAdmin/src/main/resources/db/migration/V201907261815__L_ALTER_BILL.sql new file mode 100644 index 000000000..fe4beb1e2 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201907261815__L_ALTER_BILL.sql @@ -0,0 +1,11 @@ +ALTER TABLE `wx_rent_contract` +ADD COLUMN `late_pay_ratio` INT(10) NULL DEFAULT 0 COMMENT '滞纳金费率'; + +ALTER TABLE `wx_rent_contract` +ADD COLUMN `late_pay_day` INT(10) NULL DEFAULT NULL COMMENT 'n天后开始计算滞纳金'; + +ALTER TABLE `wx_property_contract` +ADD COLUMN `late_pay_ratio` INT(10) NULL DEFAULT 0 COMMENT '滞纳金费率'; + +ALTER TABLE `wx_property_contract` +ADD COLUMN `late_pay_day` INT(10) NULL DEFAULT NULL COMMENT 'n天后开始计算滞纳金'; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index f24156057..2ffc33c64 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -6,11 +6,9 @@ import com.iformall.enums.EnumRentContractAdjustPeriod; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; - import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -143,6 +141,11 @@ public class WxPropertyContract extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") private String adjustRatio; + @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") + private Integer latePayRatio; + + @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio") + private Integer daylatePay; @Transient @io.swagger.annotations.ApiModelProperty(value = "物业预账单列表", name = "previewBillRentList") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 33b6dd51d..56b638156 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -226,6 +226,11 @@ public class WxRentContract extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value = "操作类型1区分租赁物业2合并租赁物业", name = "operationType") private Integer operationType; + @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") + private Integer latePayRatio; + + @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio") + private Integer latePayDay; public void setAdjustPeriodHandle() { if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){ diff --git a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java index 0c3c09852..d954630d7 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java @@ -2,11 +2,10 @@ package com.iformall.service; import com.iformall.common.ResultData; import com.iformall.domain.po.WxBillProperty; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxPropertyContract; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Date; import java.util.List; import java.util.Map; @@ -72,4 +71,6 @@ public interface WxPropertyContractService { List getWxBillPropertyPreview(Long id); Map updateStatus(WxPropertyContract record); + + List buildProperty(WxMerchant wxMerchant, Long userId, WxPropertyContract propertyContract, Integer isPreview,boolean saveDb); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 2115ed210..89a61536f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -344,7 +344,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService //生成预览账单 wxBillPropertyMapper.deletePreviewBill(record); //重新生成 - List billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode()); + List billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode(),true); record.setPreviewBillRentList(billList); message = "保存物业合同信息成功"; @@ -363,7 +363,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService //删除预账单,重新生成 wxBillPropertyMapper.deletePreviewBill(record); //重新生成 - billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode()); + billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode(),true); record.setPreviewBillRentList(billList); } } @@ -532,7 +532,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return JSONObject.toJSONString(shopInfo); } - public List buildRentMonth(WxMerchant wxMerchant, Long userId, WxPropertyContract wxPropertyContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview) { + public List buildRentMonth(WxMerchant wxMerchant, Long userId, WxPropertyContract wxPropertyContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview,boolean saveDb) { String adjustRatio = wxPropertyContract.getAdjustRatio(); String rentInfo = wxPropertyContract.getRentInfo(); Map shopInfo = new HashMap<>(); @@ -598,13 +598,13 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService } yearList.add(startDate); } - Map resultMap = buildRent(receivePeriod, priceArr, yearList, Calendar.MONTH, wxPropertyContract, userId, wxMerchant, billcount, isPreview, shopInfo); + Map resultMap = buildRent(receivePeriod, priceArr, yearList, Calendar.MONTH, wxPropertyContract, userId, wxMerchant, billcount, isPreview, shopInfo,saveDb); List billRentList = (List)resultMap.get("billList"); resultList.addAll(billRentList); return resultList; } - public Map buildRent(int receivePeriod,long[] priceArrs, List yearList,int dayType, WxPropertyContract wxPropertyContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview,Map shopInfo) { + public Map buildRent(int receivePeriod,long[] priceArrs, List yearList,int dayType, WxPropertyContract wxPropertyContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview,Map shopInfo,boolean saveDb) { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); Map resultMap = new HashedMap(); List resultList = new ArrayList<>(); @@ -615,28 +615,58 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService endDate = yearList.get(1); } - List billTimeVoList = WxRentContractServiceImpl.initBillTimeList(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod); + List billTimeVoList = new ArrayList<>(); + if(saveDb){ + billTimeVoList = WxRentContractServiceImpl.initBillTimeList(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod); + }else{ + //预账单编辑账期,生成金额 + for (WxBillProperty rent:wxPropertyContract.getPreviewBillRentList()) { + BillTimeVo billTimeVo = new BillTimeVo(); + billTimeVo.setStartDate(rent.getStarttime()); + billTimeVo.setEndDate(rent.getEndtime()); + billTimeVo.setReceiveDate(DateUtils.getDaySet(rent.getStarttime(),Calendar.DATE,-1)); + billTimeVoList.add(billTimeVo); + } + } int index = 0; for (int i = 0; i < billTimeVoList.size(); i++) { BillTimeVo billTimeVo = billTimeVoList.get(i); + //计算金额 + long needpay = 0; + boolean flag = false; if(yearList.size() > 1) { if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { - logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); - - index++; - if(index >= yearList.size()-1){ - endDate = null; - }else{ - endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始 - logger.info("==========cross:"+sd.format(endDate)); + if(yearList.size() > 1) { + if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { + //logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); + + index++; + if(index >= yearList.size()-1){ + endDate = null; + }else{ + //如果是计算账单金额&cross 拆分日期进行计算 + if(!saveDb && billTimeVo.getEndDate().after(endDate)) { + long needpayFront = getNeedPayMoney(wxPropertyContract,priceArrs[index-1],billTimeVo.getStartDate(),DateUtils.getDaySet(endDate,Calendar.DATE,-1),i,billTimeVoList.size()); + long needpayAfter = getNeedPayMoney(wxPropertyContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size()); + System.out.println(); + needpay = needpayFront+needpayAfter; + flag = true; + } + + endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始 + //logger.info("==========cross:"+sd.format(endDate)); + } + } } } } - //获取price 、shopInfo - long price = priceArrs[index]; + //计算金额 + if(!flag){ + needpay = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size()); + } WxBillProperty wxBillProperty = new WxBillProperty(); wxBillProperty.setIsPreview(isPreview); @@ -647,53 +677,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService wxBillProperty.setEndtime(billTimeVo.getEndDate()); wxBillProperty.setReceiveDate(billTimeVo.getReceiveDate()); - long needpay; - //按日 - if (wxPropertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ - Double priceD = new Double(price); - double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,wxBillProperty.getStarttime(),wxBillProperty.getEndtime()); - needpay = new Double(needpayD).longValue(); - }else{ - //年 需要除12 - Double priceD = new Double(price); - if(EnumPriceUnit.Y.getCode().equals(wxPropertyContract.getPriceUnit())){ - priceD = new Double(price)/12; - } - - SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); - if(i == billTimeVoList.size()-1){//最后 - if(isFirstDay(billTimeVo.getStartDate())){ - int months = WxRentContractServiceImpl.getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01"); - months++; - needpay = new Double(months * priceD).longValue(); - }else { - needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD,billTimeVo.getStartDate(),billTimeVo.getEndDate())).longValue(); - } - }else if(i == 0){//第一期 - if(wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ - if(isFirstDay(billTimeVo.getStartDate())){ - int months = WxRentContractServiceImpl.getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01"); - months++; - needpay = new Double(months * priceD).longValue(); - }else{ - needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, billTimeVo.getStartDate(), billTimeVo.getEndDate())).longValue(); - } - }else{ - int months = WxRentContractServiceImpl.getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01"); - if(isFirstDay(billTimeVo.getStartDate())){ - months++; - } - needpay = new Double(months * priceD).longValue(); - } - }else{//中间 - int months = WxRentContractServiceImpl.getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01"); - if(isFirstDay(billTimeVo.getStartDate())){ - months++; - } - needpay = new Double(months * priceD).longValue(); - } - } - wxBillProperty.setNeedPay(needpay); wxBillProperty.setOwe(needpay); wxBillProperty.setReceivePay(needpay); @@ -715,16 +698,71 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService wxBillProperty.setShopInfo(JSONObject.toJSONString(shopInfo)); } wxBillProperty.setLatePayRatio(0); - //wxBillPropertyMapper.insertSelective(wxBillProperty); resultList.add(wxBillProperty); } //批量生成预账单 - wxBillPropertyMapper.insertBills(resultList); + if(saveDb) { + wxBillPropertyMapper.insertBills(resultList); + } resultMap.put("billcount",billcount); resultMap.put("billList",resultList); return resultMap; } + public long getNeedPayMoney(WxPropertyContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize){ + long needpay; + //按日 + if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ + Double priceD = new Double(price); + double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,startDate,endDate); + needpay = new Double(needpayD).longValue(); + }else{ + //年 需要除12 + Double priceD = new Double(price); + if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ + priceD = new Double(price)/12; + } + + SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); + if(i == billTimeVoListSize - 1){//最后 + if(isFirstDay(startDate)){ + int months = WxRentContractServiceImpl.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01"); + months++; + needpay = new Double(months * priceD).longValue(); + }else { + needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); + } + }else if(i == 0){//第一期 + if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ + if(isFirstDay(startDate)){ + int months = WxRentContractServiceImpl.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01"); + months++; + needpay = new Double(months * priceD).longValue(); + }else{ + needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); + } + }else{ + if(isFirstDay(startDate)){ + int months = WxRentContractServiceImpl.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01"); + if(isFirstDay(startDate)){ + months++; + } + needpay = new Double(months * priceD).longValue(); + }else{ + needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); + } + } + }else{//中间 + int months = WxRentContractServiceImpl.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01"); + if(isFirstDay(startDate)){ + months++; + } + needpay = new Double(months * priceD).longValue(); + } + } + return needpay; + } + public void setExpiredDay(WxBillProperty wxBillProperty,int dayType, int receivePeriod){ Date date = new Date(); if (wxBillProperty.getReceiveDate().before(date)) { @@ -760,8 +798,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService * @param propertyContract * @return */ + @Override @Transactional(rollbackFor = {Exception.class}) - public List buildProperty(WxMerchant wxMerchant,Long userId,WxPropertyContract propertyContract,Integer isPreview) { + public List buildProperty(WxMerchant wxMerchant,Long userId,WxPropertyContract propertyContract,Integer isPreview,boolean saveDb) { List result = new ArrayList<>(); WxPropertyContract wxPropertyContract; @@ -788,7 +827,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService Long price = propertyContract.getPrice(); //按月计租 - result = buildRentMonth(wxMerchant, userId, propertyContract, receivePeriod, lease, rentalStartDate, price,isPreview); + result = buildRentMonth(wxMerchant, userId, propertyContract, receivePeriod, lease, rentalStartDate, price,isPreview,saveDb); } for (int i = 0; i < result.size(); i++) { result.get(i).setPeriod(i+1); @@ -796,7 +835,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return result; } - @Override public void deleteById(Long id) { wxPropertyContractMapper.deleteByPrimaryKey(id); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index bbbb32e6e..6c55c82c5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1034,8 +1034,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { boolean flag = false; if(yearList.size() > 1) { if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { - logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); - if(yearList.size() > 1) { if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { //logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); @@ -1046,14 +1044,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { }else{ //如果是计算账单金额&cross 拆分日期进行计算 if(!saveDb && billTimeVo.getEndDate().after(endDate)) { - logger.info("==========s:"+sd.format(billTimeVo.getStartDate())); - logger.info("==========e:"+sd.format(billTimeVo.getEndDate())); - logger.info("==========endDate:"+sd.format(endDate)); - long needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),DateUtils.getDaySet(endDate,Calendar.DATE,-1),i,billTimeVoList.size()); long needpayAfter = getNeedPayMoney(wxRentContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size()); - logger.info("==========needpayFront:"+needpayFront); - logger.info("==========needpayAfter:"+needpayAfter); System.out.println(); needpay = needpayFront+needpayAfter; flag = true; diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index fe8423111..d2fcfb2d3 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -92,12 +92,13 @@ 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, case when br.late_pay_status=2 then (case when br.late_pay_time is null then 0 - else FLOOR(DATEDIFF(now(),br.late_pay_time)*br.late_pay_ratio/10000*br.owe)end) + else FLOOR(DATEDIFF(now(),date_add(br.receive_date,interval r.late_pay_day day))*r.late_pay_ratio/10000*br.owe)end) else br.late_pay_price end late_pay_price,d.`status` deposit_status,br.`shop_info`,br.pay_way,br.late_pay_status, br.`comments`,br.starttime,br.endtime from wx_bill_property br left join wx_merchant m on br.merchant_id=m.id left join wx_shop s on br.shop_id=s.id + left join wx_property_contract r on br.property_contract_id=r.id left join wx_bill_property_deposit d on br.property_contract_id=d.property_contract_id br.is_preview = 0 diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index a5d822835..cd2e7ddca 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -98,8 +98,10 @@ 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, r.pay_ratio,br.`revenue`,br.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, - d.receive_pay deposit,case when br.late_pay_status=2 then (case when br.late_pay_time is null then 0 - else FLOOR(DATEDIFF(now(),br.late_pay_time)*br.late_pay_ratio/10000*br.owe)end) else br.late_pay_price end + d.receive_pay deposit, + case when br.late_pay_status=2 then (case when br.late_pay_time is null then 0 + else FLOOR(DATEDIFF(now(),date_add(br.receive_date,interval r.late_pay_day day))*r.late_pay_ratio/10000*br.owe)end) + else br.late_pay_price end late_pay_price,d.`status` deposit_status,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime from wx_bill_rent br diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index 382e49422..10f0194e8 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -44,7 +44,8 @@ - + + @@ -54,7 +55,7 @@ `shop_type`,`shop_id`,`updatetime`,`createtime`,`rent_area`, `link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`, `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`, - `file_names`,price_unit,rent_price,subject_name,rent_start_type,`operation_type` + `file_names`,price_unit,rent_price,subject_name,rent_start_type,`operation_type`,late_pay_ratio,late_pay_day diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 5e65f056e..06584821d 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -51,10 +51,10 @@ - - - + + + @@ -65,7 +65,7 @@ `start_date`,`end_date`, `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, `business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type, - `rent_input_way`,`adjust_ratio_way`,`operation_type` + `rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day