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 8888b8295..10f87c0c6 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -218,6 +218,17 @@ public class WxRentContract implements Serializable { @io.swagger.annotations.ApiModelProperty(value = "物业合同预账单列表", name = "reviewBillPropertyPList") private List reviewBillPropertyPList; + @io.swagger.annotations.ApiModelProperty(value = "租金信息", name = "rentInfo") + private String rentInfo; + + public String getRentInfo() { + return rentInfo; + } + + public void setRentInfo(String rentInfo) { + this.rentInfo = rentInfo; + } + public List getReviewBillPropertyPList() { return reviewBillPropertyPList; } 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 b480c7505..ac0f0670f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -2,6 +2,7 @@ package com.iformall.service.impl; import cn.afterturn.easypoi.word.WordExportUtil; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; @@ -480,6 +481,27 @@ public class WxRentContractServiceImpl implements WxRentContractService { return rentList; } + public int[] computePrice(WxRentContract wxRentContract) { + + JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); + int arraySize = rentInfoArray.size(); + int[] priceArr = new int[arraySize]; + for (int i = 0; i < arraySize; i++) { + double priceSum = 0; + for (int j = i; j < arraySize; j++) { + JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); + double price = rentInfoObject.getDoubleValue("price");//1000 2000 3000 + JSONArray adjustRatio = rentInfoObject.getJSONArray("adjustRatio");//[1000] + adjustRatio.set(0, 0); + int ratio = adjustRatio.getIntValue(j);//0 1000 + price = price + price * ratio / 10000.0;//1000 2000 3000 + priceSum = priceSum + price;//1000 2000 3000 + } + priceArr[i] = new BigDecimal(priceSum).setScale(0, RoundingMode.HALF_EVEN).intValue();//6000 + } + return priceArr; + } + public List buildRentMonth(WxMerchant wxMerchant, Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Integer price,Integer isPreview) { String adjustRatio = wxRentContract.getAdjustRatio(); List integers = JSONArray.parseArray(adjustRatio, Integer.class); diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 906a41873..cc1a59017 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -42,6 +42,7 @@ + @@ -49,7 +50,7 @@ `tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`, `brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`, `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, - `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type`,fix_start_date,fix_end_date,business_type + `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type`,fix_start_date,fix_end_date,business_type,rent_info @@ -108,7 +109,7 @@ rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name bankName,rc.merchant_id merchantId,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate - ,rc.business_type businessType,rc.adjust_period adjustPeriod + ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo from wx_rent_contract rc left join wx_shop s on rc.shop_id=s.id left join wx_mall_floor f on s.floor=f.id