Browse Source

fix contract

release_toaliyun_real
xiaohanzi 5 years ago
parent
commit
f43e7d6606
6 changed files with 55 additions and 25 deletions
  1. +35
    -19
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  2. +1
    -1
      mallinkAdmin/src/main/resources/db/migration/V202007311142__GROUP__ADD_002.sql
  3. +14
    -0
      mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql
  4. +1
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java
  5. +1
    -1
      mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
  6. +3
    -3
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 35
- 19
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java View File

@@ -435,11 +435,18 @@ public class WxRentContractController extends WxContractBaseController {
if (contract.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"租赁合同状态为草稿才能进行此操作");
}
//店铺是否存在其他有效合同里面
boolean result = wxRentContractService.hasOtherValidContractShop(contract);
if (result) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"店铺已经在其他计租中或者已签约未到期的合同里面了。");
}
// //店铺是否存在其他有效合同里面
// boolean result = wxRentContractService.hasOtherValidContractShop(contract);
// if (result) {
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"店铺已经在其他计租中或者已签约未到期的合同里面了。");
// }
try {
validConfilit(contract);
} catch (Exception e) {
return new ResultData(Result.ERROR,e.getMessage());
}
wxRentContractService.updateRentContractStatus(wxRentContract.getId());
if(contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) {
wxPropertyContractService.updatePropertyContractStatus(wxRentContract.getPropertyId());
@@ -447,19 +454,8 @@ public class WxRentContractController extends WxContractBaseController {
return new ResultData(Result.SUCCESS,"合同生效成功!");
}
@PostMapping("apply")
@SystemControllerLog(description = "租赁合同-提交审批")
public ResultData apply(@RequestBody WxRentContract wxRentContract) {
WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId());
if (null == rentContract) {
return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同");
}
MallUserInfo user = getUser();
//查询是否有审批流程
if(rentContractHasWorkFlow(rentContract)) {
return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"租赁合同存在工作流,不允许直接生效。");
}
//判断是否该合同的时间和有效的合同是否冲突
private void validConfilit(WxRentContract rentContract) throws Exception {
//判断是否该合同的时间和有效的合同是否冲突
List<Long> shopIds = rentContract.shopIdsByRentInfo();
for (Long sid: shopIds) {
WxRentContract rcq = new WxRentContract();
@@ -471,11 +467,31 @@ public class WxRentContractController extends WxContractBaseController {
if((rentContract.getRentalEndDate().before(crc.getRentalStartDate()) && rentContract.getRentalStartDate().after(new Date())) ||
rentContract.getRentalStartDate().after(crc.getRentalEndDate())) {
}else {
return new ResultData(Result.ERROR,"店铺["+sid+"]的计租时间区间与合同["+crc.getContractNumber()+"]有冲突。");
throw new MallinkException(Result.ERROR, "店铺["+sid+"]的计租时间区间与合同["+crc.getContractNumber()+"]有冲突。");
}
}
}
}
}
@PostMapping("apply")
@SystemControllerLog(description = "租赁合同-提交审批")
public ResultData apply(@RequestBody WxRentContract wxRentContract) {
WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId());
if (null == rentContract) {
return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同");
}
MallUserInfo user = getUser();
//查询是否有审批流程
if(rentContractHasWorkFlow(rentContract)) {
return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"租赁合同存在工作流,不允许直接生效。");
}
try {
validConfilit(rentContract);
} catch (Exception e) {
return new ResultData(Result.ERROR,e.getMessage());
}
if(rentContract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue()) {
if (rentContract.getRentShopType().intValue() == EnumRentShopType.SHOP.getCode().intValue()) {


+ 1
- 1
mallinkAdmin/src/main/resources/db/migration/V202007311142__GROUP__ADD_002.sql View File

@@ -1,7 +1,7 @@
update mall_sale_type set menus = '[1, 2, 5, 6, 8, 10, 50, 101, 102, 104, 105, 106, 108, 203, 204, 206, 207, 501, 502, 503, 504, 505, 506, 507, 511, 512, 522, 523, 509, 591, 595, 601, 605, 621, 622, 623, 624, 625, 626, 627, 671, 901, 902]' where id=100


CREATE DEFINER=`root`@`%` PROCEDURE `init_after_group`(IN tenantId VARCHAR(25),IN subTenantIds VARCHAR(250))
CREATE PROCEDURE `init_after_group`(IN tenantId VARCHAR(25),IN subTenantIds VARCHAR(250))
BEGIN
DECLARE tableName VARCHAR(50);
DECLARE end_flag INT DEFAULT FALSE;


+ 14
- 0
mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql View File

@@ -3,6 +3,8 @@ ADD COLUMN `user_id` bigint(11) COMMENT '用户ID' AFTER `active_time`;

update `wx_c_user` set user_id = id where id in (select id from wx_c_user_basic_info);

create table wx_c_user_basic_info_20200826 like wx_c_user_basic_info;
insert into wx_c_user_basic_info_20200826 select * from wx_c_user_basic_info;

ALTER TABLE `wx_c_user_basic_info`
ADD COLUMN `final_tenant_id` varchar(5) NOT NULL COMMENT '归属租户ID' AFTER `parent_tenant_id`;
@@ -63,6 +65,18 @@ ALTER TABLE `wx_rent_contract` ADD COLUMN `shop_name` VARCHAR(100) COMMENT '店

//待刷语句
//刷shop_name字段,合同状态为4(即将到期)更新为计租中,合同状态为8(补录),9(续签)更新为草稿。租金合同rentinfo
UPDATE wx_rent_contract SET STATUS = 3 , apply_status = 2 WHERE STATUS = 4 AND apply_status = 1;
UPDATE wx_property_contract SET STATUS = 3 WHERE STATUS = 4;

UPDATE wx_rent_contract SET STATUS = 1 WHERE STATUS = 8 AND apply_status = 0;
UPDATE wx_rent_contract SET STATUS = 10 WHERE STATUS = 8 AND apply_status = 1;

UPDATE wx_rent_contract SET STATUS = 1 WHERE STATUS = 9;






ALTER TABLE `wx_rent_contract`
ADD COLUMN `from_id` BIGINT(20) DEFAULT NULL COMMENT '来源ID,针对续签,从哪个合同续签';


+ 1
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java View File

@@ -37,7 +37,7 @@ public class ContractSchedule {
/**
* 凌晨5分
*/
@Scheduled(cron = "0 5 0 * * ?")
@Scheduled(cron = "0 0/2 * * * ?")
public void updateContractStatus() {
//更新合同状态,正常到期


+ 1
- 1
mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml View File

@@ -370,7 +370,7 @@
</update>

<select id="queryOweCount" parameterType="com.iformall.domain.po.WxPropertyContract" resultType="Long">
select count(*) from wx_property_contract r,wx_bill_property b
select count(1) from wx_property_contract r,wx_bill_property b
where b.property_contract_id = r.id and b.status = 1
<if test=" null != id ">and r.id = #{id}</if>
<if test=" null != rentContractId ">and r.rent_contract_id = #{rentContractId}</if>


+ 3
- 3
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml View File

@@ -130,7 +130,7 @@
<if test=" null != endDate and '' != endDate">and `end_date` = #{endDate}</if>
<if test=" null != rentShopType and '' != rentShopType">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != operationType and '' != operationType">and `operation_type` = #{operationType}</if>
<if test=" null != queryShopId and '' != queryShopId">and json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',#{queryShopId},'"'))</if>
<if test=" null != queryShopId and '' != queryShopId">and json_contains(json_extract(rent_info,'$[*].id'),concat('"',#{queryShopId},'"'))</if>
<if test=" null != statuss ">
and status in
<foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")">
@@ -438,7 +438,7 @@
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',#{shopId},'"')) and status in (2,3,4)
and json_contains(json_extract(rent_info,'$[*].id'),concat('"',#{shopId},'"')) and status in (2,3,4)
<if test="id!=null">
and id!=#{id}
</if>
@@ -454,7 +454,7 @@
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) and rent_shop_type =1
and json_contains(json_extract(rent_info,'$[*].id'),concat('"',${shopId},'"')) and rent_shop_type =1
<if test=" null != status ">and status=#{status} and status!=7</if>
</select>



Loading…
Cancel
Save