| @@ -177,7 +177,7 @@ public class WxRentContractController extends WxContractBaseController { | |||
| if (wxRentContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode().intValue() && null == wxRentContract.getMonthAverageDays()) { | |||
| return new ResultData(Result.ERROR,"请填写月平均天数"); | |||
| } | |||
| return wxRentContractService.update(wxRentContract, user,user.getName(),EnumFromType.OTHER.getCode(),oldDate,false); | |||
| return wxRentContractService.update(wxRentContract, user,user.getName(),EnumFromType.OTHER.getCode(),oldDate,false,true); | |||
| } | |||
| /** | |||
| @@ -775,7 +775,7 @@ public class WxRentContractController extends WxContractBaseController { | |||
| rentContract.updateTenantInfo(user); | |||
| rentContract.setAdjustPeriodHandle(); | |||
| rentContract.setRentStartType(wxRentContract.getRentStartType()); | |||
| return wxRentContractService.update(rentContract, user,user.getName(), EnumFromType.SWITCH.getCode(),oldDate,false); | |||
| return wxRentContractService.update(rentContract, user,user.getName(), EnumFromType.SWITCH.getCode(),oldDate,false,false); | |||
| } | |||
| // @GetMapping("exportContract") | |||
| @@ -192,6 +192,8 @@ public class TenantInfoImpl implements TenantInfo { | |||
| return true; | |||
| if ("com.iformall.mapper.WxRentContractFreePeriodMapper.inertPeriods".equals(ms.getId())) | |||
| return true; | |||
| if ("com.iformall.mapper.WxRentContractRevenueJumpMapper.inertJumps".equals(ms.getId())) | |||
| return true; | |||
| if ("com.iformall.mapper.WxActivityJoinMapper.updateSendMsg".equals(ms.getId())) | |||
| return true; | |||
| if ("com.iformall.mapper.WxActivityJoinMapper.updateStatus".equals(ms.getId())) | |||
| @@ -126,3 +126,19 @@ CREATE TABLE `wx_rent_contract_free_period` ( | |||
| ALTER TABLE wx_rent_contract DROP COLUMN bus_discount_time; | |||
| ALTER TABLE wx_rent_contract DROP COLUMN revenue_year; | |||
| CREATE TABLE `wx_rent_contract_revenue_jump` ( | |||
| `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 '创建时间', | |||
| `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', | |||
| `min_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '最小金额', | |||
| `max_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '最大金额', | |||
| `rent_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '固定租金', | |||
| `rate` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '扣点', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; | |||
| ALTER TABLE wx_rent_contract ADD COLUMN revenue_jumps_remark varchar(1000) COMMENT '联营扣点跳点设置说明'; | |||
| @@ -491,6 +491,11 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") | |||
| private Integer contractType; | |||
| @TableField(exist = false) | |||
| private List<WxRentContractRevenueJump> revenueJumps; | |||
| @io.swagger.annotations.ApiModelProperty(value = "联营跳点设置说明", name = "revenueJumpsRemark") | |||
| private String revenueJumpsRemark; | |||
| public List<Long> shopIdsByRentInfo() { | |||
| @@ -580,5 +585,6 @@ public class WxRentContract extends TenantEntity { | |||
| this.setFreePeriods(voList); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| 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_revenue_jump") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxRentContractRevenueJump 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 = "合同编号", name = "rentContractId") | |||
| private Long rentContractId; | |||
| @io.swagger.annotations.ApiModelProperty(value="最小金额",name="minMoney") | |||
| private String minMoney; | |||
| @io.swagger.annotations.ApiModelProperty(value="最大金额",name="maxMoney") | |||
| private String maxMoney; | |||
| @io.swagger.annotations.ApiModelProperty(value="固定租金",name="rentMoney") | |||
| private String rentMoney; | |||
| @io.swagger.annotations.ApiModelProperty(value="扣点",name="rate") | |||
| private String rate; | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxRentContractRevenueJump; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| public interface WxRentContractRevenueJumpMapper extends CommonMapper<WxRentContractRevenueJump, Long> { | |||
| List<WxRentContractRevenueJump> findList(WxRentContractRevenueJump wxBillRent); | |||
| WxRentContractRevenueJump selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void inertJumps(@Param("tenantId")String tenantId,@Param("list")List<WxRentContractRevenueJump> list); | |||
| void deleteByContract(WxRentContractRevenueJump wxBillRent); | |||
| } | |||
| @@ -51,7 +51,7 @@ public interface WxRentContractService { | |||
| */ | |||
| ResultData save(WxRentContract record,MallUserInfo user,String userName,Date oldRentStartDate); | |||
| ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate); | |||
| ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate,boolean setRevenJumps); | |||
| ResultData updateOneStep(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate); | |||
| @@ -21,6 +21,7 @@ import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.WxRentContractFreePeriod; | |||
| import com.iformall.domain.po.WxRentContractRevenueJump; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.BillTimeVo; | |||
| @@ -58,6 +59,7 @@ import com.iformall.mapper.WxMerchantTradeDailyMapper; | |||
| import com.iformall.mapper.WxPropertyContractMapper; | |||
| import com.iformall.mapper.WxRentContractFreePeriodMapper; | |||
| import com.iformall.mapper.WxRentContractMapper; | |||
| import com.iformall.mapper.WxRentContractRevenueJumpMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxFlowRecordService; | |||
| @@ -120,6 +122,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Autowired | |||
| WxRentContractFreePeriodMapper wxRentContractFreePeriodMapper; | |||
| @Autowired | |||
| WxRentContractRevenueJumpMapper wxRentContractRevenueJumpMapper; | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @@ -592,7 +597,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //@Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate) { | |||
| public ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate,boolean setRevenJumps) { | |||
| //查询预账单用于展示 | |||
| WxAllBill wxBillRent = new WxAllBill(); | |||
| wxBillRent.setRentContractId(record.getId()); | |||
| @@ -601,7 +606,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| List<WxAllBill> resultList = wxAllBillMapper.findList(wxBillRent); | |||
| //更新 | |||
| ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate); | |||
| ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate,setRevenJumps); | |||
| if (resultData.code != Result.SUCCESS) { | |||
| return resultData; | |||
| } | |||
| @@ -659,12 +664,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| List<WxAllBill> resultList = wxAllBillMapper.findList(wxBillRent); | |||
| //更新 | |||
| ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate); | |||
| ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate,false); | |||
| if (resultData.code != Result.SUCCESS) { | |||
| return resultData; | |||
| } | |||
| WxRentContract wxRentContract = (WxRentContract)resultData.data; | |||
| wxRentContract.setPreviewBillRentList(resultList); | |||
| WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); | |||
| jq.updateTenantInfo(record); | |||
| jq.setRentContractId(record.getId()); | |||
| wxRentContract.setRevenueJumps(wxRentContractRevenueJumpMapper.findList(jq)); | |||
| return new ResultData(wxRentContract); | |||
| } | |||
| @@ -820,7 +830,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| } | |||
| public ResultData getResultDataForUpdate(WxRentContract record, MallUserInfo user,int from,Date oldRentStartDate,boolean writeFinal) { | |||
| public ResultData getResultDataForUpdate(WxRentContract record, MallUserInfo user,int from,Date oldRentStartDate,boolean writeFinal,boolean setRevenJumps) { | |||
| //更新租赁合同信息 | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(record.getId()); | |||
| if (wxRentContract == null) { | |||
| @@ -907,6 +917,31 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| wxRentContractMapper.updateById(record); | |||
| record.setRentalStartDate(tempDate); | |||
| if (setRevenJumps) { | |||
| WxRentContractRevenueJump jumpsDel = new WxRentContractRevenueJump(); | |||
| jumpsDel.updateTenantInfo(record); | |||
| jumpsDel.setRentContractId(record.getId()); | |||
| wxRentContractRevenueJumpMapper.deleteByContract(jumpsDel); | |||
| if (null != record.getRevenueJumps()) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| List<WxRentContractRevenueJump> jlist = new ArrayList<WxRentContractRevenueJump>(); | |||
| for (int i = 0 ; i < record.getRevenueJumps().size(); i++) { | |||
| WxRentContractRevenueJump jp = record.getRevenueJumps().get(i); | |||
| jp.updateTenantInfo(record); | |||
| jp.setId(idWorker.nextId()); | |||
| jp.setRentContractId(record.getId()); | |||
| jp.setCreateTime(new Date()); | |||
| jp.setUpdateTime(new Date()); | |||
| jlist.add(jp); | |||
| } | |||
| if (jlist.size() > 0 ) { | |||
| wxRentContractRevenueJumpMapper.inertJumps(record.getTenantId(), jlist); | |||
| } | |||
| } | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("更新租赁合同信息失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| @@ -130,6 +130,7 @@ | |||
| <result column="month_average_days" jdbcType="INTEGER" property="monthAverageDays"/> | |||
| <result column="revenue_fixed_rent_price" jdbcType="INTEGER" property="revenueFixedRentPrice"/> | |||
| <result column="revenue_rent_price" jdbcType="VARCHAR" property="revenueRentPrice"/> | |||
| <result column="revenue_jumps_remark" jdbcType="VARCHAR" property="revenueJumpsRemark"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -139,7 +140,7 @@ | |||
| `tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,`price_detail`,`create_by`,`update_by`, | |||
| `first_party_bank_info`,`second_party_bank_info`,`second_party_tax_info`,`day_price_calcute`, | |||
| `property_name`,`property_fee`,`fee_cycle`,`water_fee`,`electricity_fees`,`month_average_days`, | |||
| `deposit`,cashtype_content_lsit,cashtype_lsit,`pay_date`,`is_del`,`merchant_name`, | |||
| `deposit`,cashtype_content_lsit,cashtype_lsit,`pay_date`,`is_del`,`merchant_name`,`revenue_jumps_remark`, | |||
| `brand`,`business_id`,`shop_type`,`shop_type_str`,`updatetime`,`createtime`,`link_person`,`link_phone`,`link_address`, | |||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`revenue_ratio`,`revenue_ratio_way`,`revenue_ratio_set`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | |||
| `start_date`,`end_date`,`shop_name`,`from_id`,`end_contract_time`,`revenue_fixed_rent_price`,`revenue_rent_price`, | |||
| @@ -380,6 +381,7 @@ | |||
| <result column="month_average_days" property="monthAverageDays"/> | |||
| <result column="revenue_fixed_rent_price" jdbcType="INTEGER" property="revenueFixedRentPrice"/> | |||
| <result column="revenue_rent_price" jdbcType="VARCHAR" property="revenueRentPrice"/> | |||
| <result column="revenue_jumps_remark" jdbcType="VARCHAR" property="revenueJumpsRemark"/> | |||
| </resultMap> | |||
| @@ -388,7 +390,7 @@ | |||
| rc.price as rent_price,rc.contract_number,rc.shop_name,rc.type,rc.apply_status,rc.price_detail,rc.revenue_fixed_rent_price,rc.revenue_rent_price, | |||
| rc.rent_shop_type,rc.rent_info,pc.price as property_price,rc.merchant_id,pc.`status` as property_status, | |||
| rc.price_unit as rent_price_unit,pc.price_unit as property_price_unit,rc.day_price_calcute, | |||
| rc.business_type businessType,rc.bus_discount_ratio,rc.month_average_days | |||
| rc.business_type businessType,rc.bus_discount_ratio,rc.month_average_days,rc.revenue_jumps_remark | |||
| from wx_rent_contract rc left join wx_property_contract pc on rc.id=pc.rent_contract_id | |||
| <where> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -487,7 +489,7 @@ | |||
| rc.`deposit`,rc.cashtype_content_lsit,rc.cashtype_lsit,rc.`pay_date`,rc.`is_del`,rc.`merchant_name`, | |||
| rc.`brand`,rc.`business_id`,rc.`shop_type`,rc.`shop_type_str`,rc.`updatetime`,rc.`createtime`,rc.`link_person`,rc.`link_phone`,rc.`link_address`, | |||
| rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`revenue_ratio`,rc.`revenue_ratio_way`,rc.`revenue_ratio_set`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`, | |||
| rc.`start_date`,rc.`end_date`,rc.`shop_name`,rc.`from_id`,`rc.end_contract_time`, | |||
| rc.`start_date`,rc.`end_date`,rc.`shop_name`,rc.`from_id`,`rc.end_contract_time`,rc.`revenue_jumps_remark`, | |||
| rc.`apply_status`,rc.`bank_name`,rc.`rent_shop_type`,rc.`fix_start_date`,rc.`fix_end_date`, | |||
| rc.`business_type`,rc.`rent_info`, rc.`file_names`,rc.price_unit,rent_price,rc.other_rent_price_info,rc.`subject_name`,rc.rent_start_type, | |||
| rc.`rent_input_way`,rc.`adjust_ratio_way`,rc.`operation_type`,rc.late_pay_ratio,rc.late_pay_day,rc.bus_discount_ratio, | |||
| @@ -509,7 +511,7 @@ | |||
| rc.`shop_type_sub`,rc.`lease_purpose`,rc.`contractual_rules`,rc.`delivery_date`,rc.`delivery_grace_period`,rc.`opening_date`,rc.`business_hours`,rc.`scope_metre`, | |||
| rc.`price`,rc.rent_area,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, rc.`receive_period_unit`, | |||
| rc.`tenant_id`,rc.`parent_tenant_id`,rc.`filepath`,rc.`status`,rc.`contract_number`,rc.`price_detail`,rc.`create_by`,rc.`update_by`, | |||
| rc.`first_party_bank_info`,rc.`second_party_bank_info`,rc.`second_party_tax_info`, | |||
| rc.`first_party_bank_info`,rc.`second_party_bank_info`,rc.`second_party_tax_info`,rc.`revenue_jumps_remark`, | |||
| rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`, | |||
| rc.`deposit`,rc.cashtype_content_lsit,rc.cashtype_lsit,rc.`pay_date`,rc.`is_del`,rc.`merchant_name`, | |||
| rc.`brand`,rc.`business_id`,rc.`shop_type`,rc.`shop_type_str`,rc.`updatetime`,rc.`createtime`,rc.`link_person`,rc.`link_phone`,rc.`link_address`, | |||
| @@ -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.WxRentContractRevenueJumpMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContractRevenueJump"> | |||
| <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="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/> | |||
| <result column="min_money" jdbcType="VARCHAR" property="minMoney"/> | |||
| <result column="max_money" jdbcType="VARCHAR" property="maxMoney"/> | |||
| <result column="rent_money" jdbcType="VARCHAR" property="rentMoney"/> | |||
| <result column="rate" jdbcType="VARCHAR" property="rate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`min_money`,`max_money`,`rent_money`,`rate` | |||
| </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 != 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.WxRentContractRevenueJump" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_rent_contract_revenue_jump | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_rent_contract_revenue_jump where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <insert id="inertJumps" parameterType="HashMap"> | |||
| INSERT INTO wx_rent_contract_revenue_jump ( | |||
| <include refid="allColumns"/> | |||
| ) | |||
| VALUES | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.createTime},#{item.updateTime}, | |||
| #{item.rentContractId},#{item.minMoney},#{item.maxMoney},#{item.rentMoney},#{item.rate} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| <delete id="deleteByContract" parameterType="com.iformall.domain.po.WxRentContractRevenueJump"> | |||
| delete from wx_rent_contract_revenue_jump where `rent_contract_id` = #{rentContractId} | |||
| </delete> | |||
| </mapper> | |||