Browse Source

rent

release_toaliyun_real
xhxu 5 years ago
parent
commit
01f918105c
2 changed files with 94 additions and 5 deletions
  1. +91
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  2. +3
    -3
      mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml

+ 91
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -1054,9 +1054,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int size = 0;
long[] priceArrs = null;
List<Map<String, Object>> shopInfos = new ArrayList<>();
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) &&
if (//wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) &&
wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_COUNT.getCode())) {
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
List<long[]> priceList = computePrice(rentInfo, wxRentContract);
@@ -1175,6 +1176,92 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return shopInfoStr;
}

private String getRentPriceInfo(WxRentContract wxRentContract, long contractNeedPay){
long rentPrice = 0l, siteMoney = 0l, facilityMoney = 0l, administratorMoney = 0l;
if(!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_COUNT.getCode())){
if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
long[] priceList = computePrice(rentInfo, wxRentContract).get(0);
long sum = Arrays.stream(priceList).sum();
int size = rentInfoArray.size();
for (int i = 0;i < size;) {
BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0);
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);

String rentPrice1 = rentInfoObject.getString("rentPrice");
if(StringUtils.isNotBlank(rentPrice1)){
a = new BigDecimal(rentPrice1);
}
JSONObject otherRentPriceInfo = rentInfoObject.getJSONObject("otherRentPriceInfo");
if(otherRentPriceInfo != null ){
String siteMoney1 = otherRentPriceInfo.getString("siteMoney");
if(StringUtils.isNotBlank(siteMoney1)){
b = new BigDecimal(siteMoney1);
}
String facilityMoney1 = otherRentPriceInfo.getString("facilityMoney");
if(StringUtils.isNotBlank(facilityMoney1)){
c = new BigDecimal(facilityMoney1);
}
String administratorMoney1 = otherRentPriceInfo.getString("administratorMoney");
if(StringUtils.isNotBlank(administratorMoney1)){
d = new BigDecimal(administratorMoney1);
}
}

rentPrice += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum))
.multiply(a).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();
siteMoney += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum))
.multiply(b).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();
facilityMoney += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum))
.multiply(c).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();
administratorMoney += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum))
.multiply(d).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();

}
}else{
BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0);
String rentPrice1 = wxRentContract.getRentPrice();
if(StringUtils.isNotBlank(rentPrice1)){
a = new BigDecimal(rentPrice1).divide(new BigDecimal(100));
}
String otherRentPriceInfo1 = wxRentContract.getOtherRentPriceInfo();
if(StringUtils.isNotBlank(otherRentPriceInfo1)){
JSONObject jsonObject = JSONObject.parseObject(otherRentPriceInfo1);
String siteMoney1 = jsonObject.getString("siteMoney");
if(StringUtils.isNotBlank(siteMoney1)){
b = new BigDecimal(siteMoney1);
}
String facilityMoney1 = jsonObject.getString("facilityMoney");
if(StringUtils.isNotBlank(facilityMoney1)){
c = new BigDecimal(facilityMoney1);
}
String administratorMoney1 = jsonObject.getString("administratorMoney");
if(StringUtils.isNotBlank(administratorMoney1)){
d = new BigDecimal(administratorMoney1);
}
}
rentPrice = new BigDecimal(contractNeedPay).multiply(a).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();
siteMoney = new BigDecimal(contractNeedPay).multiply(b).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();
facilityMoney = new BigDecimal(contractNeedPay).multiply(c).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();
administratorMoney = new BigDecimal(contractNeedPay).multiply(d).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue();

}
}else{
rentPrice = contractNeedPay;
}


Map<String,String> resultMap = new HashedMap();
resultMap.put("rentPrice",new BigDecimal(rentPrice).divide(new BigDecimal(100)).toString());
resultMap.put("siteMoney",new BigDecimal(siteMoney).divide(new BigDecimal(100)).toString());
resultMap.put("facilityMoney",new BigDecimal(facilityMoney).divide(new BigDecimal(100)).toString());
resultMap.put("administratorMoney",new BigDecimal(administratorMoney).divide(new BigDecimal(100)).toString());
return resultMap.toString();
}


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) {
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract);
@@ -1265,6 +1352,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRent.setEndtime(billTimeVo.getEndDate());
wxBillRent.setReceiveDate(billTimeVo.getReceiveDate());

wxBillRent.setContractNeedPay(needpay);
wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,needpay));
wxBillRent.setNeedPay(needpay);
wxBillRent.setOwe(needpay);
wxBillRent.setReceivePay(needpay);


+ 3
- 3
mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml View File

@@ -17,6 +17,7 @@
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="shop_id" jdbcType="BIGINT" property="shopId"/>
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="comments" jdbcType="VARCHAR" property="comments"/>
@@ -34,7 +35,7 @@
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,
`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`,
`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`name`,`comments`,
`rent_shop_type`,`return_price`,`pay_way`,`starttime`,`endtime`,freeze,service_charge_pay
</sql>
@@ -84,10 +85,9 @@
<select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultMap="BaseResultMap">
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
br.`owe`,br.`status`,m.`name` merchant_name,s.shop_number,br.`updatetime`,br.`return_price`,br.`merchant_id`,
br.`owe`,br.`status`,m.`name` merchant_name,br.shop_name,br.`updatetime`,br.`return_price`,br.`merchant_id`,
br.shop_id,br.name,br.comments,br.`rent_shop_type`,br.pay_way,br.`starttime`,br.`endtime`,br.freeze,br.service_charge_pay
from wx_bill_other_deposit br left join wx_merchant m on br.merchant_id=m.id
left join wx_shop s on br.shop_id=s.id
<where>
<if test=" null != id ">and br.`id` = #{id}</if>
<if test=" null != freeze ">and br.`freeze` = #{freeze}</if>


Loading…
Cancel
Save