Pārlūkot izejas kodu

fix

release_toaliyun_real
winter pirms 1 gada
vecāks
revīzija
34ec63895c
2 mainītis faili ar 41 papildinājumiem un 15 dzēšanām
  1. +13
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  2. +28
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 13
- 6
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java Parādīt failu

@@ -905,17 +905,23 @@ public class WxRentContractController extends WxContractBaseController {
List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class); List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class);
integers.add(0, 0); integers.add(0, 0);
int years = integers.size(); int years = integers.size();
//合同以什么日期来计算开始计租日期
if(rentContract.getRentStartType()!=null &&rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){
wxRentContract.setRentalStartDate(wxRentContract.getStartDate());
}
List<Date> yearList = wxRentContractService.getYearList(years, 12, rentContract.getRentalStartDate()); List<Date> yearList = wxRentContractService.getYearList(years, 12, rentContract.getRentalStartDate());
if (null != yearList ) {
if (null != yearList && yearList.size() > 0) {
List<WxRentContractYearsVo> retList = new ArrayList<WxRentContractYearsVo>(); List<WxRentContractYearsVo> retList = new ArrayList<WxRentContractYearsVo>();
Date begin = rentContract.getRentalStartDate();
for (int i = 0 ; i < yearList.size() ; i ++) {
Date end = yearList.get(i);
Date begin = null;
for (int i = 0 ; i < yearList.size()-1 ; i ++) {
int yearindex = i+1;
begin = yearList.get(i);
Date end = yearList.get(i+1);
Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1); Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1);
WxRentContractYearsVo vo = new WxRentContractYearsVo(); WxRentContractYearsVo vo = new WxRentContractYearsVo();
vo.setStart(begin); vo.setStart(begin);
vo.setEnd(realEnd); vo.setEnd(realEnd);
vo.setRemark("第"+i+1+"年度");
vo.setRemark("第"+yearindex+"年度");
retList.add(vo); retList.add(vo);
begin = end; begin = end;
} }
@@ -935,7 +941,8 @@ public class WxRentContractController extends WxContractBaseController {
if (null == rentContract) { if (null == rentContract) {
return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同"); return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同");
} }
rentContract.setYearsBegin(wxRentContract.getYearsBegin());
rentContract.setYearsEnd(wxRentContract.getYearsEnd());
WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); WxRentContractRevenueJump jq = new WxRentContractRevenueJump();
jq.updateTenantInfo(rentContract); jq.updateTenantInfo(rentContract);
jq.setRentContractId(rentContract.getId()); jq.setRentContractId(rentContract.getId());


+ 28
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Parādīt failu

@@ -2473,8 +2473,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }
//根据时间区间计算 //根据时间区间计算
//固定租金需要再计算,因为跳点设置的租金是单价 //固定租金需要再计算,因为跳点设置的租金是单价
String rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, rentDecimal.toPlainString(),startDate,
String rentNeedpay = "0";
if (rentDecimal.compareTo(new BigDecimal(0)) > 0 ) {
rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, rentDecimal.toPlainString(),startDate,
endDate,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); endDate,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod());
}
rentDecimal = new BigDecimal(rentNeedpay); rentDecimal = new BigDecimal(rentNeedpay);
BigDecimal[] bs = new BigDecimal[] {revenueDecimal,rentDecimal}; BigDecimal[] bs = new BigDecimal[] {revenueDecimal,rentDecimal};
return bs; return bs;
@@ -2531,10 +2534,13 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for( int i = 0 ; i < yearList.size() ; i ++) { for( int i = 0 ; i < yearList.size() ; i ++) {
Date yearEndDate = yearList.get(i); Date yearEndDate = yearList.get(i);
if (rentBill.getEndtime().before(yearEndDate) || rentBill.getEndtime().equals(yearEndDate)) { if (rentBill.getEndtime().before(yearEndDate) || rentBill.getEndtime().equals(yearEndDate)) {
yearIndex = i;
yearIndex = i-1;
break; break;
} }
} }
if (yearIndex <= 0 ) {
yearIndex = 0;
}
//免租期 //免租期
List<Date> freePeriods = getFreeDays(rentcontract); List<Date> freePeriods = getFreeDays(rentcontract);
//根据租金和扣点来计算 //根据租金和扣点来计算
@@ -2551,11 +2557,15 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}else { }else {
jumppay = jumppay.add(jumpRentPay); jumppay = jumppay.add(jumpRentPay);
} }
StringBuffer sb = new StringBuffer();
if (jumppay.compareTo(new BigDecimal(needpay)) > 0 ) { if (jumppay.compareTo(new BigDecimal(needpay)) > 0 ) {
sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".");
needpay = jumppay.toPlainString(); needpay = jumppay.toPlainString();
}else {
sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+".");
} }
//保存销售额 //保存销售额
WxRentContractRevenueSales rs = new WxRentContractRevenueSales(); WxRentContractRevenueSales rs = new WxRentContractRevenueSales();
rs.updateTenantInfo(rentcontract); rs.updateTenantInfo(rentcontract);
@@ -2583,7 +2593,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }
//更新账单费用 //更新账单费用
rentBill.setMoneyChangeDetail("原合同租金金额:"+rentBill.getReceivePay()+"元,计算之后为:"+needpay+"元。");
sb.append("原合同租金金额:"+rentBill.getNeedPay()+"元,计算之后为:"+needpay+"元。");
rentBill.setMoneyChangeDetail(sb.toString());
rentBill.setReceivePay(needpay); rentBill.setReceivePay(needpay);
rentBill.setBillRemark("设置销售额,自动计算"); rentBill.setBillRemark("设置销售额,自动计算");
rentBill.setUpdatetime(new Date()); rentBill.setUpdatetime(new Date());
@@ -2595,7 +2606,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxAllBillMapper.updateById(rentBill); wxAllBillMapper.updateById(rentBill);
//物业账单应收就改为0,因为金额已经合并了 //物业账单应收就改为0,因为金额已经合并了
if (null != propertyBill) { if (null != propertyBill) {
propertyBill.setMoneyChangeDetail("原合同物业金额:"+propertyBill.getReceivePay()+"元,已合并到租金,调整为:0元。");
propertyBill.setMoneyChangeDetail("原合同物业金额:"+propertyBill.getNeedPay()+"元,已合并到租金,调整为:0元。");
propertyBill.setReceivePay("0"); propertyBill.setReceivePay("0");
propertyBill.setBillRemark("设置销售额,已自动计算合并到租金"); propertyBill.setBillRemark("设置销售额,已自动计算合并到租金");
if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) {
@@ -2628,12 +2639,13 @@ public class WxRentContractServiceImpl implements WxRentContractService {
List<Long> billIdList = wxRentContractRevenueSalesMapper.findBillId(rsq); List<Long> billIdList = wxRentContractRevenueSalesMapper.findBillId(rsq);
Date realStartTime = null; Date realStartTime = null;
Date realEndTime = null; Date realEndTime = null;
if (null != billIdList || billIdList.size() > 0 ) {
if (null != billIdList && billIdList.size() > 0 ) {
WxAllBill abq = new WxAllBill(); WxAllBill abq = new WxAllBill();
abq.updateTenantInfo(rentcontract); abq.updateTenantInfo(rentcontract);
abq.setIds(billIdList); abq.setIds(billIdList);
abq.setStarttimeEqual(rentcontract.getYearsBegin());
abq.setStarttimeEqual(rentcontract.getYearsEnd());
abq.setStarttime(rentcontract.getYearsBegin());
abq.setEndtime(rentcontract.getYearsEnd());
abq.setSortColumn(" starttime asc"); abq.setSortColumn(" starttime asc");
List<WxAllBill> billList = wxAllBillMapper.findList(abq); List<WxAllBill> billList = wxAllBillMapper.findList(abq);
if (null == billList || billList.size() <= 0 ){ if (null == billList || billList.size() <= 0 ){
@@ -2642,7 +2654,14 @@ public class WxRentContractServiceImpl implements WxRentContractService {
realStartTime = billList.get(0).getStarttime(); realStartTime = billList.get(0).getStarttime();
realEndTime = billList.get(billList.size()-1).getEndtime(); realEndTime = billList.get(billList.size()-1).getEndtime();
} }
BigDecimal sum = new BigDecimal(0);
BigDecimal sum = wxRentContractRevenueSalesMapper.findSumSalesMoney(rsq);
if (null == sum || sum.compareTo(new BigDecimal(0)) <= 0 ) {
WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo();
vo.setTotalSales("0");
vo.setTotalRevenue("0");
vo.setBillReceivePay("0");
return vo;
}
//计算跳点。 //计算跳点。
BigDecimal[] jumppays = calcuteReveneuJump(sum, rentcontract,rentcontract.getYearsBegin(), rentcontract.getYearsEnd(),null); BigDecimal[] jumppays = calcuteReveneuJump(sum, rentcontract,rentcontract.getYearsBegin(), rentcontract.getYearsEnd(),null);
BigDecimal jumpRevenuePay = jumppays[0]; BigDecimal jumpRevenuePay = jumppays[0];


Notiek ielāde…
Atcelt
Saglabāt