| @@ -156,6 +156,21 @@ public class WxRentContract implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value = "租期(月)", name = "lease") | |||
| private Integer lease; | |||
| @io.swagger.annotations.ApiModelProperty(value = "类型", name = "type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") | |||
| private Integer adjustRatio; | |||
| @io.swagger.annotations.ApiModelProperty(value = "调整周期", name = "adjustPeriod") | |||
| private Integer adjustPeriod; | |||
| @io.swagger.annotations.ApiModelProperty(value = "支付比例", name = "payRatio") | |||
| private Integer payRatio; | |||
| @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") | |||
| private Integer revenue; | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| @@ -365,6 +380,46 @@ public class WxRentContract implements Serializable { | |||
| this.lease = lease; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer type) { | |||
| this.type = type; | |||
| } | |||
| public Integer getAdjustRatio() { | |||
| return adjustRatio; | |||
| } | |||
| public void setAdjustRatio(Integer adjustRatio) { | |||
| this.adjustRatio = adjustRatio; | |||
| } | |||
| public Integer getAdjustPeriod() { | |||
| return adjustPeriod; | |||
| } | |||
| public void setAdjustPeriod(Integer adjustPeriod) { | |||
| this.adjustPeriod = adjustPeriod; | |||
| } | |||
| public Integer getPayRatio() { | |||
| return payRatio; | |||
| } | |||
| public void setPayRatio(Integer payRatio) { | |||
| this.payRatio = payRatio; | |||
| } | |||
| public Integer getRevenue() { | |||
| return revenue; | |||
| } | |||
| public void setRevenue(Integer revenue) { | |||
| this.revenue = revenue; | |||
| } | |||
| public static enum Field { | |||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"), Price_ASC("`price` ASC"), Price_DESC("`price` DESC"), RentalStartDate_ASC("`rental_start_date` ASC"), RentalStartDate_DESC("`rental_start_date` DESC"), RentalEndDate_ASC("`rental_end_date` ASC"), RentalEndDate_DESC("`rental_end_date` DESC"), SignDate_ASC("`sign_date` ASC"), SignDate_DESC("`sign_date` DESC"), ReceivePeriod_ASC("`receive_period` ASC"), ReceivePeriod_DESC("`receive_period` DESC"), TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), Filepath_ASC("`filepath` ASC"), Filepath_DESC("`filepath` DESC"), Status_ASC("`status` ASC"), Status_DESC("`status` DESC"), ContractNumber_ASC("`contract_number` ASC"), ContractNumber_DESC("`contract_number` DESC"), Deposit_ASC("`deposit` ASC"), Deposit_DESC("`deposit` DESC"), PayDate_ASC("`pay_date` ASC"), PayDate_DESC("`pay_date` DESC"), IsDel_ASC("`is_del` ASC"), IsDel_DESC("`is_del` DESC"), MerchantName_ASC("`merchant_name` ASC"), MerchantName_DESC("`merchant_name` DESC"), Brand_ASC("`brand` ASC"), Brand_DESC("`brand` DESC"), BusinessId_ASC("`business_id` ASC"), BusinessId_DESC("`business_id` DESC"), ShopType_ASC("`shop_type` ASC"), ShopType_DESC("`shop_type` DESC"), ShopId_ASC("`shop_id` ASC"), ShopId_DESC("`shop_id` DESC"), Updatetime_ASC("`updatetime` ASC"), Updatetime_DESC("`updatetime` DESC"), Createtime_ASC("`createtime` ASC"), Createtime_DESC("`createtime` DESC"); | |||
| private String value; | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumRentContractType { | |||
| RENT_BY_AREA(1, "面积"), | |||
| RENT_BY_JOINT(2, "联营扣点") | |||
| ; | |||
| public static EnumRentContractType getEnum(Integer code) { | |||
| for (EnumRentContractType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumRentContractType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -23,6 +23,8 @@ import org.springframework.transaction.annotation.Transactional; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.*; | |||
| import java.math.BigDecimal; | |||
| import java.math.RoundingMode; | |||
| import java.net.HttpURLConnection; | |||
| import java.net.URL; | |||
| import java.util.*; | |||
| @@ -142,12 +144,29 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| instance.add(Calendar.MONTH, record.getLease()); | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| record.setRentalEndDate(instance.getTime()); | |||
| record.setPrice(record.getPrice() != null ? record.getPrice() : 0); | |||
| record.setDeposit(record.getDeposit() != null ? record.getDeposit() : 0); | |||
| record.setUpdatetime(new Date()); | |||
| if (record.getPrice() == 0 || record.getDeposit() == 0) { | |||
| record.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||
| if(record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())){ | |||
| if(record.getRevenue()==null || record.getRevenue().intValue()==0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"营业额不能为空且大于0"); | |||
| } | |||
| if(record.getPayRatio()==null || record.getPayRatio().intValue()==0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"支付比例不能为空且大于0"); | |||
| } | |||
| BigDecimal hundred = new BigDecimal(100); | |||
| BigDecimal oneThousand = new BigDecimal(10000); | |||
| BigDecimal revenue = new BigDecimal(record.getRevenue()).divide(hundred); | |||
| BigDecimal payRatio = new BigDecimal(record.getPayRatio()).divide(oneThousand); | |||
| BigDecimal price = revenue.multiply(payRatio).setScale(2,RoundingMode.HALF_EVEN); | |||
| record.setPrice(price.multiply(hundred).intValue()); | |||
| } | |||
| if(record.getPrice()==null || record.getPrice().intValue()==0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"租金不能为空且大于0"); | |||
| } | |||
| if(record.getDeposit()==null || record.getDeposit().intValue()==0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"押金不能为空且大于0"); | |||
| } | |||
| record.setUpdatetime(new Date()); | |||
| try { | |||
| WxRentContract wxRentContractParams = new WxRentContract(); | |||
| wxRentContractParams.setTenantId(record.getTenantId()); | |||
| @@ -28,11 +28,19 @@ | |||
| <result column="pay_account" jdbcType="VARCHAR" property="payAccount"/> | |||
| <result column="filename" jdbcType="VARCHAR" property="filename"/> | |||
| <result column="lease" jdbcType="INTEGER" property="lease"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="revenue" jdbcType="INTEGER" property="revenue"/> | |||
| <result column="adjust_ratio" jdbcType="INTEGER" property="adjustRatio"/> | |||
| <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/> | |||
| <result column="pay_ratio" jdbcType="INTEGER" property="payRatio"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`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` | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`, | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -63,6 +71,7 @@ | |||
| <if test=" null != payAccount ">and `pay_account` = #{payAccount}</if> | |||
| <if test=" null != filename ">and `filename` = #{filename}</if> | |||
| <if test=" null != lease ">and `lease` = #{lease}</if> | |||
| <if test=" null != type ">and `type` = #{type}</if> | |||
| <if test=" null != ids "> | |||
| @@ -84,7 +93,7 @@ | |||
| <select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.`status`, | |||
| rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName, | |||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId | |||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type | |||
| 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 | |||
| @@ -95,6 +104,7 @@ | |||
| <if test=" null != shopNumber and shopNumber!=''">and s.`shop_number` like concat('%',#{shopNumber},'%')</if> | |||
| <if test=" null != status ">and rc.`status` = #{status}</if> | |||
| <if test=" null != shopId ">and rc.`shop_id` = #{shopId}</if> | |||
| <if test=" null != type ">and rc.`type` = #{type}</if> | |||
| </where> | |||
| order by rc.id desc | |||