Просмотр исходного кода

[租赁合同][修改][租赁录入方式及年租金调整方式]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
a664b8892c
5 измененных файлов: 116 добавлений и 16 удалений
  1. +6
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  2. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustRatioWay.java
  3. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumRentContractRentInputWay.java
  4. +28
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  5. +8
    -3
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 6
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java Просмотреть файл

@@ -220,6 +220,12 @@ public class WxRentContract extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "1按租赁日生产2按计租日生成账单", name = "rentStartType")
private Integer rentStartType;

@io.swagger.annotations.ApiModelProperty(value = "租金录入方式1合铺录入2分铺录入", name = "rent_input_way")
private Integer rentInputWay;

@io.swagger.annotations.ApiModelProperty(value = "年租金调整方式1按比例2按金额", name = "adjust_ratio_way")
private Integer adjustRatioWay;

// public Integer getAdjustPeriod() {
// if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){
// return EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode();


+ 37
- 0
mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustRatioWay.java Просмотреть файл

@@ -0,0 +1,37 @@
package com.iformall.enums;


/**
* @author gongbiao
*/

public enum EnumRentContractAdjustRatioWay {

RATIO(1, "按比例"),
MONEY(2, "按金额"),;

public static EnumRentContractAdjustRatioWay getEnum(Integer code) {
for (EnumRentContractAdjustRatioWay value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumRentContractAdjustRatioWay(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 37
- 0
mallinkService/src/main/java/com/iformall/enums/EnumRentContractRentInputWay.java Просмотреть файл

@@ -0,0 +1,37 @@
package com.iformall.enums;


/**
* @author gongbiao
*/

public enum EnumRentContractRentInputWay {

WHOLE(1, "合铺录入"),
PART(2, "分铺录入"),;

public static EnumRentContractRentInputWay getEnum(Integer code) {
for (EnumRentContractRentInputWay value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumRentContractRentInputWay(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 28
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -761,7 +761,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}

//计算租金,每年-每个店铺租金
public List<long[]> computePrice(String rentInfo,Integer priceUnit) {
public List<long[]> computePrice(String rentInfo, WxRentContract wxRentContract) {

JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int arraySize = rentInfoArray.size();
@@ -777,18 +777,32 @@ public class WxRentContractServiceImpl implements WxRentContractService {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(0);
JSONArray adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
int adjustRatioSize = adjustRatio.size();

for (int i = 0; i < adjustRatioSize; i++) {
long[] priceArrs = new long[arraySize];
for (int j = 0; j < arraySize; j++) {
rentInfoObject = rentInfoArray.getJSONObject(j);
adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100)));
BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply);
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
//判断年租金调整方式
if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) {
for (int i = 0; i < adjustRatioSize; i++) {
long[] priceArrs = new long[arraySize];
for (int j = 0; j < arraySize; j++) {
rentInfoObject = rentInfoArray.getJSONObject(j);
adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100)));
BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply);
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
priceList.add(priceArrs);
}
} else {
for (int i = 0; i < adjustRatioSize; i++) {
long[] priceArrs = new long[arraySize];
for (int j = 0; j < arraySize; j++) {
rentInfoObject = rentInfoArray.getJSONObject(j);
adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(new BigDecimal(adjustRatio.getString(i)));
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
priceList.add(priceArrs);
}
priceList.add(priceArrs);
}

return priceList;
}

@@ -797,10 +811,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
long[] priceArrs = null;
List<Map<String, Object>> shopInfos = new ArrayList<>();
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) &&
wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
List<long[]> priceList = computePrice(rentInfo,wxRentContract.getPriceUnit());
List<long[]> priceList = computePrice(rentInfo, wxRentContract);
size = priceList.size();
priceArrs = new long[size];
for (int i = 0; i < size; i++) {
@@ -1693,7 +1708,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
adjustRatioList.add(adjustRatioStr.toString());
}
List<long[]> priceList = computePrice(rentInfo,wxRentContract.getPriceUnit());
List<long[]> priceList = computePrice(rentInfo, wxRentContract);
int size = priceList.size();
priceArrs = new long[size];
for (int i = 0; i < size; i++) {


+ 8
- 3
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Просмотреть файл

@@ -48,7 +48,10 @@
<result column="rent_price" property="rentPrice"/>
<result column="subject_name" property="subjectName"/>
<result column="rent_start_type" property="rentStartType"/>

<result column="rent_input_way" property="rentInputWay"/>
<result column="adjust_ratio_way" property="adjustRatioWay"/>
</resultMap>
<sql id="allColumns">
@@ -58,7 +61,8 @@
`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`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type
`business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type,
`rent_input_way`,`adjust_ratio_way`
</sql>
@@ -118,7 +122,8 @@
rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name
bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate
,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names
fileNames,rc.price_unit,rc.subject_name subjectName
fileNames,rc.price_unit,rc.subject_name subjectName,rc.`rent_input_way` rentInputWay,rc.`adjust_ratio_way`
adjustRatioWay
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


Загрузка…
Отмена
Сохранить