Browse Source

[合同优化][修改][晚上合同优化需求]

release_toaliyun_real
luozukai 7 years ago
parent
commit
5cbcd68de7
7 changed files with 78 additions and 31 deletions
  1. +5
    -0
      mallinkAdmin/src/main/resources/db/migration/V201905211601__L_ALTER_RENT.sql
  2. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  4. +28
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  5. +35
    -27
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  6. +2
    -2
      mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
  7. +2
    -1
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 5
- 0
mallinkAdmin/src/main/resources/db/migration/V201905211601__L_ALTER_RENT.sql View File

@@ -0,0 +1,5 @@
ALTER TABLE wx_property_contract
ADD COLUMN rent_price int(11) DEFAULT 0 COMMENT '多径租金单价(其他放rentInfo)';

ALTER TABLE wx_rent_contract
ADD COLUMN rent_price int(11) DEFAULT 0 COMMENT '多径租金单价(其他放rentInfo)';

+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java View File

@@ -168,6 +168,9 @@ public class WxPropertyContract extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit")
private Integer priceUnit;

@io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit")
private String rentPrice;

public static enum Field
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")


+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java View File

@@ -213,6 +213,9 @@ public class WxRentContract extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit")
private Integer priceUnit;

@io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit")
private String rentPrice;

public static enum Field {
Id_ASC("`id` ASC"), Id_DESC("`id` DESC")
, MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC")


+ 28
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java View File

@@ -18,6 +18,7 @@ import com.iformall.service.WxPropertyContractService;
import com.iformall.utils.Constant;
import com.iformall.utils.DateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -91,7 +92,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND);
}

//init dateDiff
//m:init dateDiff
if(wxPropertyContract.getRentalStartDate() != null && wxPropertyContract.getRentalEndDate() != null){
Calendar instance = Calendar.getInstance();
instance.setTime(wxPropertyContract.getRentalEndDate());
@@ -101,6 +102,32 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
result.put("totalPeriodDay",array[1]);
}

//m:init 租赁单价
String rentInfo = wxPropertyContract.getRentInfo();
if(StringUtils.isNotBlank(rentInfo)){
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size();
//查询rent_info 包括shopId
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
Double rentPrice = rentInfoObject.getDouble("rentPrice");
Long price = wxPropertyContract.getPrice()/100;
if(rentPrice == null){
Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea());
rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
rentInfoObject.put("rentPrice",rentPrice);
}
}
wxPropertyContract.setRentInfo(rentInfoArray.toJSONString());
}else{
if(wxPropertyContract.getRentPrice() == null){
Long price = wxPropertyContract.getPrice()/100;
Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea());
Double rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
wxPropertyContract.setRentPrice(rentPrice.toString());
}
}

wxPropertyContract.setPrice(wxPropertyContract.getPrice() != null ? wxPropertyContract.getPrice() : 0);
wxPropertyContract.setDeposit(wxPropertyContract.getDeposit() != null ? wxPropertyContract.getDeposit() : 0);



+ 35
- 27
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -123,7 +123,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND);
}

//init dateDiff
//m: init dateDiff
if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){
Calendar instance = Calendar.getInstance();
instance.setTime(wxRentContract.getRentalEndDate());
@@ -133,32 +133,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
result.put("totalPeriodDay",array[1]);
}

//商场信息
WxMall wxMall = new WxMall();
wxMall.setTenantId(wxRentContract.getTenantId());
List<WxMall> mallList = wxMallMapper.findList(wxMall);
if (!mallList.isEmpty()) {
result.put("mall", mallList.get(0));
}
wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() : 0);
wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0);

//目前只有多经点位租赁合同
WxShop wxShop = wxShopService.getById(wxRentContract.getShopId());
if(wxShop !=null && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){
//handle adjustPeriod 1日 2月 monthHandleType 2按账单周期 3按自然月
if(wxRentContract.getAdjustPeriod().intValue() == 1){
wxRentContract.setAdjustPeriod(1);
wxRentContract.setMonthHandleType(null);
}else if(wxRentContract.getAdjustPeriod().intValue() == 2){
wxRentContract.setAdjustPeriod(2);
wxRentContract.setMonthHandleType(2);
}else if(wxRentContract.getAdjustPeriod().intValue() == 3){
wxRentContract.setAdjustPeriod(2);
wxRentContract.setMonthHandleType(3);
}
}

//m: init 租赁单价
String rentInfo = wxRentContract.getRentInfo();
if(StringUtils.isNotBlank(rentInfo)){
@@ -176,7 +150,41 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
wxRentContract.setRentInfo(rentInfoArray.toJSONString());
}else{
if(wxRentContract.getRentPrice() == null){
Long price = wxRentContract.getPrice()/100;
Double rentArea = Double.parseDouble(wxRentContract.getRentArea());
Double rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
wxRentContract.setRentPrice(rentPrice.toString());
}
}

//商场信息
WxMall wxMall = new WxMall();
wxMall.setTenantId(wxRentContract.getTenantId());
List<WxMall> mallList = wxMallMapper.findList(wxMall);
if (!mallList.isEmpty()) {
result.put("mall", mallList.get(0));
}
wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() : 0);
wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0);

//目前只有多经点位租赁合同
// WxShop wxShop = wxShopService.getById(wxRentContract.getShopId());
// if(wxShop !=null && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){
// //handle adjustPeriod 1日 2月 monthHandleType 2按账单周期 3按自然月
// if(wxRentContract.getAdjustPeriod().intValue() == 1){
// wxRentContract.setAdjustPeriod(1);
// wxRentContract.setMonthHandleType(null);
// }else if(wxRentContract.getAdjustPeriod().intValue() == 2){
// wxRentContract.setAdjustPeriod(2);
// wxRentContract.setMonthHandleType(2);
// }else if(wxRentContract.getAdjustPeriod().intValue() == 3){
// wxRentContract.setAdjustPeriod(2);
// wxRentContract.setMonthHandleType(3);
// }
// }


result.put("wxRentContract", wxRentContract);
//关联的商户


+ 2
- 2
mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml View File

@@ -39,7 +39,7 @@
<result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
<result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
<result column="price_unit" property="priceUnit"/>
<result column="rent_price" property="rentPrice"/>
</resultMap>
<sql id="allColumns">
@@ -48,7 +48,7 @@
`deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,
`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
`start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`, `file_names`,price_unit,rent_price
</sql>
<sql id="dynamicWhereConditions">


+ 2
- 1
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml View File

@@ -45,6 +45,7 @@
<result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
<result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
<result column="price_unit" property="priceUnit"/>
<result column="rent_price" property="rentPrice"/>

</resultMap>
@@ -55,7 +56,7 @@
`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
`business_type`,`rent_info`, `file_names`,price_unit,rent_price
</sql>


Loading…
Cancel
Save