| @@ -191,6 +191,31 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| return new ResultData(wxRentContract.getPrice()); | return new ResultData(wxRentContract.getPrice()); | ||||
| } | } | ||||
| /** | |||||
| * 获取免租期 | |||||
| */ | |||||
| @GetMapping("getFreePeriod") | |||||
| public ResultData getFreePeriod(@ModelAttribute WxRentContract wxRentContract) { | |||||
| //查询 | |||||
| WxRentContract contract = wxRentContractService.selectById(wxRentContract.getId()); | |||||
| return new ResultData(wxRentContractService.getFreePeriods(contract)); | |||||
| } | |||||
| /** | |||||
| * 设置免租期 | |||||
| * @param wxRentContract | |||||
| * @return | |||||
| */ | |||||
| @PostMapping("setFreePeriod") | |||||
| public ResultData setFreePeriod(@RequestBody WxRentContract wxRentContract) { | |||||
| if (null == wxRentContract.getFreePeriods()) { | |||||
| return new ResultData(Result.ERROR,"免租期不能为空"); | |||||
| } | |||||
| wxRentContract.updateTenantInfo(getTenantInfo()); | |||||
| wxRentContractService.saveFreePeriods(wxRentContract); | |||||
| return new ResultData(); | |||||
| } | |||||
| /** | /** | ||||
| * 新增第二步 防止前端3秒重复提交 | * 新增第二步 防止前端3秒重复提交 | ||||
| * @param wxRentContract | * @param wxRentContract | ||||
| @@ -190,7 +190,7 @@ public class TenantInfoImpl implements TenantInfo { | |||||
| return true; | return true; | ||||
| if ("com.iformall.mapper.WxAllBillMapper.insertBills".equals(ms.getId())) | if ("com.iformall.mapper.WxAllBillMapper.insertBills".equals(ms.getId())) | ||||
| return true; | return true; | ||||
| if ("com.iformall.mapper.WxBillPropertyMapper.updateBills".equals(ms.getId())) | |||||
| if ("com.iformall.mapper.WxRentContractFreePeriodMapper.inertPeriods".equals(ms.getId())) | |||||
| return true; | return true; | ||||
| if ("com.iformall.mapper.WxActivityJoinMapper.updateSendMsg".equals(ms.getId())) | if ("com.iformall.mapper.WxActivityJoinMapper.updateSendMsg".equals(ms.getId())) | ||||
| return true; | return true; | ||||
| @@ -107,3 +107,19 @@ create table wx_all_bill_98 like wx_all_bill; | |||||
| create table wx_all_bill_99 like wx_all_bill; | create table wx_all_bill_99 like wx_all_bill; | ||||
| drop table wx_all_bill; | drop table wx_all_bill; | ||||
| CREATE TABLE `wx_rent_contract_free_period` ( | |||||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||||
| `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||||
| `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||||
| `update_time` datetime DEFAULT NULL COMMENT '更新时间', | |||||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||||
| `start_date` datetime NOT NULL COMMENT '起租开始时间', | |||||
| `end_date` datetime NOT NULL COMMENT '起租结束时间', | |||||
| `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', | |||||
| `year_index` int(2) NOT NULL COMMENT '年序号', | |||||
| PRIMARY KEY (`id`) | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; | |||||
| @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.common.SortColumn; | import com.iformall.common.SortColumn; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | |||||
| import com.iformall.enums.EnumPriceUnit; | import com.iformall.enums.EnumPriceUnit; | ||||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | import com.iformall.enums.EnumRentContractAdjustPeriod; | ||||
| import com.iformall.enums.EnumRentContractType; | import com.iformall.enums.EnumRentContractType; | ||||
| @@ -564,5 +565,7 @@ public class WxRentContract extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Long propertyContractId; | private Long propertyContractId; | ||||
| @TableField(exist = false) | |||||
| private List<RentContractFreePeriodVo> freePeriods; | |||||
| } | } | ||||
| @@ -0,0 +1,41 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| /** | |||||
| */ | |||||
| @TableName(value = "wx_rent_contract_free_period") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxRentContractFreePeriod extends TenantEntity { | |||||
| private static final long serialVersionUID = 7009117540201976664L; | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||||
| private Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") | |||||
| private Date createTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||||
| private Date updateTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") | |||||
| private Date startDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||||
| private Date endDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "rentContractId") | |||||
| private Long rentContractId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="年序号",name="yearIndex") | |||||
| private Integer yearIndex; | |||||
| } | |||||
| @@ -0,0 +1,25 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxRentContractFreePeriod; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| @Data | |||||
| public class RentContractFreePeriodVo implements Serializable{ | |||||
| private static final long serialVersionUID = 4494858079134918638L; | |||||
| //核销金额记录 | |||||
| private Integer yearIndex; | |||||
| private Date start; | |||||
| private Date end; | |||||
| private List<WxRentContractFreePeriod> periods; | |||||
| } | |||||
| @@ -0,0 +1,21 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxRentContractFreePeriod; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| public interface WxRentContractFreePeriodMapper extends CommonMapper<WxRentContractFreePeriod, Long> { | |||||
| List<WxRentContractFreePeriod> findList(WxRentContractFreePeriod wxBillRent); | |||||
| WxRentContractFreePeriod selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| void inertPeriods(@Param("tenantId")String tenantId,@Param("list")List<WxRentContractFreePeriod> list); | |||||
| void deleteByContract(WxRentContractFreePeriod wxBillRent); | |||||
| } | |||||
| @@ -6,7 +6,9 @@ import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxAllBill; | import com.iformall.domain.po.WxAllBill; | ||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.WxRentContractFreePeriod; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -38,6 +40,7 @@ public interface WxRentContractService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| Map<String, Object> getById(Long id); | Map<String, Object> getById(Long id); | ||||
| WxRentContract selectById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -147,4 +150,8 @@ public interface WxRentContractService { | |||||
| void deletePrewBill(WxRentContract wxRentContract); | void deletePrewBill(WxRentContract wxRentContract); | ||||
| List<RentContractFreePeriodVo> getFreePeriods(WxRentContract wxRentContract); | |||||
| void saveFreePeriods(WxRentContract wxRentContract); | |||||
| } | } | ||||
| @@ -0,0 +1,70 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxRentContractFreePeriodMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContractFreePeriod"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||||
| <result column="start_date" jdbcType="TIMESTAMP" property="startDate"/> | |||||
| <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/> | |||||
| <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/> | |||||
| <result column="year_index" jdbcType="INTEGER" property="yearIndex"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`start_date`,`end_date`,`rent_contract_id`,`year_index` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1=1 | |||||
| <if test=" null != id ">and `id` = #{id}</if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | |||||
| <if test=" null != yearIndex ">and `year_index` = #{yearIndex}</if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxRentContractFreePeriod" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_rent_contract_free_period | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_rent_contract_free_period where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| <insert id="inertPeriods" parameterType="HashMap"> | |||||
| INSERT INTO wx_rent_contract_free_period ( | |||||
| <include refid="allColumns"/> | |||||
| ) | |||||
| VALUES | |||||
| <foreach collection="list" item="item" index="index" separator=","> | |||||
| ( | |||||
| #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.createTime},#{item.updateTime}, | |||||
| #{item.startDate},#{item.endDate},#{item.rentContractId},#{item.yearIndex} | |||||
| ) | |||||
| </foreach> | |||||
| </insert> | |||||
| <delete id="deleteByContract" parameterType="com.iformall.domain.po.WxRentContractFreePeriod"> | |||||
| delete from wx_rent_contract_free_period where `rent_contract_id` = #{rentContractId} | |||||
| </delete> | |||||
| </mapper> | |||||