| @@ -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)'; | |||||
| @@ -168,6 +168,9 @@ public class WxPropertyContract extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit") | @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit") | ||||
| private Integer priceUnit; | private Integer priceUnit; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit") | |||||
| private String rentPrice; | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -213,6 +213,9 @@ public class WxRentContract extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit") | @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit") | ||||
| private Integer priceUnit; | private Integer priceUnit; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit") | |||||
| private String rentPrice; | |||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC") | Id_ASC("`id` ASC"), Id_DESC("`id` DESC") | ||||
| , MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC") | , MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC") | ||||
| @@ -18,6 +18,7 @@ import com.iformall.service.WxPropertyContractService; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.collections.map.HashedMap; | import org.apache.commons.collections.map.HashedMap; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | 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); | return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | ||||
| } | } | ||||
| //init dateDiff | |||||
| //m:init dateDiff | |||||
| if(wxPropertyContract.getRentalStartDate() != null && wxPropertyContract.getRentalEndDate() != null){ | if(wxPropertyContract.getRentalStartDate() != null && wxPropertyContract.getRentalEndDate() != null){ | ||||
| Calendar instance = Calendar.getInstance(); | Calendar instance = Calendar.getInstance(); | ||||
| instance.setTime(wxPropertyContract.getRentalEndDate()); | instance.setTime(wxPropertyContract.getRentalEndDate()); | ||||
| @@ -101,6 +102,32 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| result.put("totalPeriodDay",array[1]); | 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.setPrice(wxPropertyContract.getPrice() != null ? wxPropertyContract.getPrice() : 0); | ||||
| wxPropertyContract.setDeposit(wxPropertyContract.getDeposit() != null ? wxPropertyContract.getDeposit() : 0); | wxPropertyContract.setDeposit(wxPropertyContract.getDeposit() != null ? wxPropertyContract.getDeposit() : 0); | ||||
| @@ -123,7 +123,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | ||||
| } | } | ||||
| //init dateDiff | |||||
| //m: init dateDiff | |||||
| if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ | if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ | ||||
| Calendar instance = Calendar.getInstance(); | Calendar instance = Calendar.getInstance(); | ||||
| instance.setTime(wxRentContract.getRentalEndDate()); | instance.setTime(wxRentContract.getRentalEndDate()); | ||||
| @@ -133,32 +133,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| result.put("totalPeriodDay",array[1]); | 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 租赁单价 | //m: init 租赁单价 | ||||
| String rentInfo = wxRentContract.getRentInfo(); | String rentInfo = wxRentContract.getRentInfo(); | ||||
| if(StringUtils.isNotBlank(rentInfo)){ | if(StringUtils.isNotBlank(rentInfo)){ | ||||
| @@ -176,7 +150,41 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| } | } | ||||
| wxRentContract.setRentInfo(rentInfoArray.toJSONString()); | 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); | result.put("wxRentContract", wxRentContract); | ||||
| //关联的商户 | //关联的商户 | ||||
| @@ -39,7 +39,7 @@ | |||||
| <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | ||||
| <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | ||||
| <result column="price_unit" property="priceUnit"/> | <result column="price_unit" property="priceUnit"/> | ||||
| <result column="rent_price" property="rentPrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -48,7 +48,7 @@ | |||||
| `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`, | `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`, | ||||
| `shop_type`,`shop_id`,`updatetime`,`createtime`,`rent_area`, | `shop_type`,`shop_id`,`updatetime`,`createtime`,`rent_area`, | ||||
| `link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`, | `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> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -45,6 +45,7 @@ | |||||
| <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | ||||
| <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | ||||
| <result column="price_unit" property="priceUnit"/> | <result column="price_unit" property="priceUnit"/> | ||||
| <result column="rent_price" property="rentPrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| @@ -55,7 +56,7 @@ | |||||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | ||||
| `start_date`,`end_date`, | `start_date`,`end_date`, | ||||
| `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_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> | </sql> | ||||