| @@ -21,6 +21,8 @@ public class WxPropertyContract implements Serializable { | |||
| // 审核状态,0未审核 1审核中 2审核完成 3驳回 4合同作废 | |||
| private Integer applyStatus; | |||
| // 审批流1合同2账单3终止审批 | |||
| private Integer businessType; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @@ -164,6 +166,14 @@ public class WxPropertyContract implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||
| private Map<String, Object> flowParams; | |||
| public Integer getBusinessType() { | |||
| return businessType; | |||
| } | |||
| public void setBusinessType(Integer businessType) { | |||
| this.businessType = businessType; | |||
| } | |||
| public Map<String, Object> getFlowParams() { | |||
| return flowParams; | |||
| } | |||
| @@ -185,6 +185,10 @@ public class WxRentContract implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value = "审核状态", name = "applyStatus") | |||
| private Integer applyStatus; | |||
| // 审批流1合同2账单3终止审批 | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批流类型", name = "businessType") | |||
| private Integer businessType; | |||
| @io.swagger.annotations.ApiModelProperty(value = "开户行", name = "bankName") | |||
| private String bankName; | |||
| @@ -202,8 +206,13 @@ public class WxRentContract implements Serializable { | |||
| private Date fixEndDate; | |||
| public Integer getBusinessType() { | |||
| return businessType; | |||
| } | |||
| public void setBusinessType(Integer businessType) { | |||
| this.businessType = businessType; | |||
| } | |||
| public Date getFixStartDate() { | |||
| return fixStartDate; | |||
| @@ -11,6 +11,7 @@ public enum EnumBillRentStatus { | |||
| PAID(3, "已结清"), | |||
| NOT_EXPIRED(4,"未到期"), | |||
| RETURN(5, "已退还"), | |||
| INVALID(6, "失效"), | |||
| ; | |||
| public static EnumBillRentStatus getEnum(Integer code) { | |||
| @@ -0,0 +1,37 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by luozukai | |||
| * 终止合同类型 | |||
| */ | |||
| public enum EnumEndProperty { | |||
| END_RENT(1, "终止租赁合同"), | |||
| END_RENT_AND_PROPERTY(2, "终止租赁和物业合同"), | |||
| ; | |||
| public static EnumEndProperty getEnum(Integer code) { | |||
| for (EnumEndProperty value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumEndProperty(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -2,6 +2,8 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -21,7 +23,7 @@ public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long> | |||
| void updateWaitPayStatus(Map<String,Object> params); | |||
| void updateInvalidStatus(WxBillProperty wxBillProperty); | |||
| void updateInvalidStatusByRent(WxRentContract wxRentContract); | |||
| } | |||
| @@ -21,4 +21,5 @@ public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> { | |||
| void updateWaitPayStatus(Map<String,Object> params); | |||
| void updateInvalidStatus(WxBillRent wxBillRent); | |||
| } | |||
| @@ -41,4 +41,6 @@ public interface WxPropertyContractMapper extends CommonMapper<WxPropertyContrac | |||
| void updateStatus(WxPropertyContract wxPropertyContract); | |||
| long queryOweCount(WxPropertyContract wxPropertyContract); | |||
| void updateStatusByRentContractId(WxPropertyContract wxPropertyContract); | |||
| } | |||
| @@ -8,9 +8,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxFlowRecordMapper; | |||
| import com.iformall.mapper.WxPropertyContractMapper; | |||
| import com.iformall.mapper.WxRentContractMapper; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| @@ -66,6 +64,10 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| private WxPropertyContractService wxPropertyContractService; | |||
| @Autowired | |||
| private WxFlowRecordMapper wxFlowRecordMapper; | |||
| @Autowired | |||
| private WxBillRentMapper wxBillRentMapper; | |||
| @Autowired | |||
| private WxBillPropertyMapper wxBillPropertyMapper; | |||
| /** | |||
| * 获取流程key,1合同 2账单 | |||
| @@ -105,6 +107,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| WxRentContract rent = new WxRentContract(); | |||
| rent.setId(businessId); | |||
| rent.setApplyStatus(applyStatus); | |||
| rent.setBusinessType(flowType); | |||
| wxRentContractService.updateApplyStatus(rent); | |||
| // 如果审批完成,而且是补录直接改为已签约状态(普通需要绑定商户才是已签约) | |||
| @@ -115,6 +118,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| wxPropertyContract.setId(businessId); | |||
| wxPropertyContract.setApplyStatus(applyStatus); | |||
| wxPropertyContract.setBusinessType(flowType); | |||
| wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | |||
| // 审批完成,物业合同的合同状态需要和租赁合同同步(一致) | |||
| @@ -127,36 +131,43 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| WxRentContract rent = new WxRentContract(); | |||
| rent.setId(businessId); | |||
| rent.setApplyStatus(applyStatus); | |||
| wxRentContractService.updateApplyStatus(rent); | |||
| rent.setBusinessType(flowType); | |||
| //合同状态改成提前终止 | |||
| if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| WxRentContract updateRentContract = new WxRentContract(); | |||
| updateRentContract.setId(businessId); | |||
| updateRentContract.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); | |||
| wxRentContractMapper.updateStatus(updateRentContract); | |||
| rent.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); | |||
| //终止租赁合同,同时终止物业合同 | |||
| String endProperty = getVariableByKey(variables,"endProperty"); | |||
| if("2".equals(endProperty)){ | |||
| if(EnumEndProperty.END_RENT_AND_PROPERTY.getCode().toString().equals(endProperty)){ | |||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| wxPropertyContract.setRentContractId(businessId); | |||
| wxPropertyContract.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); | |||
| wxPropertyContractMapper.updateStatusByRentContractId(wxPropertyContract); | |||
| //账单失效 | |||
| wxBillPropertyMapper.updateInvalidStatusByRent(rent); | |||
| } | |||
| // todo 账单失效 | |||
| //账单失效 | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setRentContractId(businessId); | |||
| wxBillRentMapper.updateInvalidStatus(wxBillRent); | |||
| } | |||
| wxRentContractService.updateApplyStatus(rent); | |||
| }else if(contractType.intValue() == 3 || contractType.intValue() == 4){ | |||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| wxPropertyContract.setId(businessId); | |||
| wxPropertyContract.setApplyStatus(applyStatus); | |||
| wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | |||
| wxPropertyContract.setBusinessType(flowType); | |||
| if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| WxPropertyContract updateRentContract = new WxPropertyContract(); | |||
| updateRentContract.setId(businessId); | |||
| updateRentContract.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); | |||
| wxPropertyContractMapper.updateStatus(updateRentContract); | |||
| wxPropertyContract.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); | |||
| // todo 账单失效 | |||
| //账单失效 | |||
| WxBillProperty wxBillProperty = new WxBillProperty(); | |||
| wxBillProperty.setPropertyContractId(businessId); | |||
| wxBillPropertyMapper.updateInvalidStatus(wxBillProperty); | |||
| } | |||
| wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | |||
| } | |||
| } | |||
| } | |||
| @@ -117,8 +117,18 @@ | |||
| where br.tenant_id=#{tenantId} and br.status!=#{paid} and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| <update id="updateInvalidStatus" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| update wx_bill_property set status = 6 where property_contract_id = #{propertyContractId} | |||
| and status = 4 | |||
| </update> | |||
| <update id="updateInvalidStatusByRent" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_bill_property set status = 6 where property_contract_id in | |||
| (select id from wx_property_contract where rent_contract_id = #{id}) | |||
| and status = 4 | |||
| </update> | |||
| </mapper> | |||
| @@ -118,6 +118,12 @@ | |||
| where br.tenant_id=#{tenantId} and br.status!=#{paid} and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| <update id="updateInvalidStatus" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| update wx_bill_rent set status = 6 where rent_contract_id = #{rentContractId} | |||
| and status = 4 | |||
| </update> | |||
| </mapper> | |||
| @@ -34,8 +34,8 @@ | |||
| <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/> | |||
| <result column="apply_status" property="applyStatus"/> | |||
| <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/> | |||
| <result column="business_type" property="businessType"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -44,7 +44,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` | |||
| `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -103,7 +103,7 @@ | |||
| f.floor_name floorName,b.building_name buildingName,receive_period receivePeriod, | |||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate, | |||
| start_date startDate,end_date endDate,rc.rent_contract_id rentContractId,br.`name` brandName, | |||
| s.addr,rc.apply_status applyStatus,rc.adjust_period adjustPeriod | |||
| s.addr,rc.apply_status applyStatus,rc.adjust_period adjustPeriod,rc.business_type businessType | |||
| from wx_property_contract rc | |||
| left join wx_shop s on rc.shop_id=s.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||
| @@ -181,13 +181,20 @@ | |||
| </select> | |||
| <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxPropertyContract"> | |||
| update wx_property_contract set apply_status=#{applyStatus} where id=#{id} | |||
| update wx_property_contract set apply_status=#{applyStatus} | |||
| <if test=" null != businessType ">,set business_type=#{businessType}</if> | |||
| where id=#{id} | |||
| </update> | |||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxPropertyContract"> | |||
| update wx_property_contract set status=#{status} where id=#{id} | |||
| </update> | |||
| <update id="updateStatusByRentContractId" parameterType="com.iformall.domain.po.WxPropertyContract"> | |||
| update wx_property_contract set status=#{status} where rent_contract_id=#{rentContractId} | |||
| </update> | |||
| <select id="queryOweCount" parameterType="com.iformall.domain.po.WxPropertyContract" resultType="Long"> | |||
| select count(*) from wx_property_contract r,wx_bill_property b | |||
| where b.property_contract_id = r.id and b.status = 1 | |||
| @@ -40,6 +40,7 @@ | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="fix_start_date" property="fixStartDate"/> | |||
| <result column="fix_end_date" property="fixEndDate"/> | |||
| <result column="business_type" property="businessType"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -47,7 +48,7 @@ | |||
| `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`, | |||
| `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type`,fix_start_date,fix_end_date | |||
| `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type`,fix_start_date,fix_end_date,business_type | |||
| </sql> | |||
| @@ -106,6 +107,7 @@ | |||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, | |||
| rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | |||
| bankName,rc.merchant_id merchantId,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate | |||
| ,rc.business_type businessType | |||
| 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 | |||
| @@ -164,7 +166,10 @@ | |||
| </update> | |||
| <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set apply_status=#{applyStatus} where id=#{id} | |||
| update wx_rent_contract | |||
| set apply_status=#{applyStatus} | |||
| <if test=" null != businessType ">,business_type=#{businessType}</if> | |||
| where id=#{id} | |||
| </update> | |||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||