xiaohanzi 5 лет назад
Родитель
Сommit
3a7b765ea7
11 измененных файлов: 184 добавлений и 141 удалений
  1. +2
    -1
      mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql
  2. +17
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  3. +2
    -2
      mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java
  4. +3
    -3
      mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java
  6. +5
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  7. +105
    -86
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  8. +4
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java
  9. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  10. +32
    -30
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  11. +11
    -10
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 2
- 1
mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql Просмотреть файл

@@ -51,6 +51,7 @@ ALTER TABLE `wx_profit_sharing_receiver`
ADD COLUMN `plat` SMALLINT(3) NOT NULL DEFAULT 1 COMMENT '平台 1:微信 2:阿里 3:头条'; ADD COLUMN `plat` SMALLINT(3) NOT NULL DEFAULT 1 COMMENT '平台 1:微信 2:阿里 3:头条';





ALTER TABLE wx_rent_contract DROP COLUMN shop_id; ALTER TABLE wx_rent_contract DROP COLUMN shop_id;


CREATE TABLE `wx_rent_contract_shop` ( CREATE TABLE `wx_rent_contract_shop` (
@@ -61,5 +62,5 @@ CREATE TABLE `wx_rent_contract_shop` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='租金合同关联的店铺'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='租金合同关联的店铺';




ALTER TABLE `wx_rent_contract` ADD COLUMN `shop_name` VARCHAR(30) COMMENT '店铺名称';
ALTER TABLE `wx_rent_contract` ADD COLUMN `shop_name` VARCHAR(100) COMMENT '店铺名称';



+ 17
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java Просмотреть файл

@@ -1,5 +1,7 @@
package com.iformall.domain.po; package com.iformall.domain.po;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField; 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;
@@ -9,6 +11,8 @@ import com.iformall.enums.EnumRentContractAdjustPeriod;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;

import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;


import java.math.BigDecimal; import java.math.BigDecimal;
@@ -257,5 +261,18 @@ public class WxRentContract extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType")
private Integer contractType; private Integer contractType;


public List<Long> shopIdsByRentInfo() {
List<Long> shopList = Lists.newArrayList();
String rentInfo = this.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size();
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
Long shopId = rentInfoObject.getLong("shopId");
shopList.add(shopId);
}
return shopList;
}
} }



+ 2
- 2
mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java Просмотреть файл

@@ -20,8 +20,8 @@ public class WxRentPropertyContractVo extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "contractNumber") @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "contractNumber")
private String contractNumber; private String contractNumber;


@io.swagger.annotations.ApiModelProperty(value = "商铺号", name = "shopNumber")
private String shopNumber;
@io.swagger.annotations.ApiModelProperty(value = "商铺号", name = "shopName")
private String shopName;


@io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "rentInfo") @io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "rentInfo")
private String rentInfo; private String rentInfo;


+ 3
- 3
mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java Просмотреть файл

@@ -57,11 +57,11 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long>


int selectRentContractCountByShopId(@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId,@Param("shopId") Long shopId,@Param("id") Long id); int selectRentContractCountByShopId(@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId,@Param("shopId") Long shopId,@Param("id") Long id);


void updateInvalidContract(WxRentContract record);
//void updateInvalidContract(WxRentContract record);


List<WxRentContract> selectRentContractByMerchantId(WxRentContract wxRentContract); List<WxRentContract> selectRentContractByMerchantId(WxRentContract wxRentContract);


List<WxRentContract> selectRentContractByShopId(WxRentContract record);
List<WxRentContract> selectRentContractByShopId(@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId,@Param("shopId") Long shopId,@Param("status") Integer status);


//List<WxRentContract> selectRentContractByShopIds(@Param("shopIds") Collection<Long> shopIds,@Param("shopIdsRegexp") String shopIdsRegexp,@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId); //List<WxRentContract> selectRentContractByShopIds(@Param("shopIds") Collection<Long> shopIds,@Param("shopIdsRegexp") String shopIdsRegexp,@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId);


@@ -69,7 +69,7 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long>


//Integer getShopType(WxRentContract wxRentContract); //Integer getShopType(WxRentContract wxRentContract);


//List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record);
List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record);


WxRentContract getByBill(WxBillRent billRent); WxRentContract getByBill(WxBillRent billRent);




+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java Просмотреть файл

@@ -10,7 +10,7 @@ import com.iformall.domain.vo.WxRentPropertyContractVo;
*/ */
public interface WxRentPropertyContractService { public interface WxRentPropertyContractService {


//PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize);
PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize);


ResultData getContractInfo(Long id); ResultData getContractInfo(Long id);




+ 5
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java Просмотреть файл

@@ -1131,9 +1131,12 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
wxPropertyContract.updateTenantInfo(wxRentContract); wxPropertyContract.updateTenantInfo(wxRentContract);
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
wxPropertyContract.setMerchantId(wxRentContract.getMerchantId()); wxPropertyContract.setMerchantId(wxRentContract.getMerchantId());
} else {
wxPropertyContract.setShopId(wxRentContract.getShopId());
} }
if (wxRentContract.shopIdsByRentInfo().size()==0) {
wxPropertyContract.setShopId(wxRentContract.shopIdsByRentInfo().get(0));
}
List<WxPropertyContract> select = wxPropertyContractMapper.selectList(new QueryWrapper(wxPropertyContract)); List<WxPropertyContract> select = wxPropertyContractMapper.selectList(new QueryWrapper(wxPropertyContract));
if (select.size() > 0) { if (select.size() > 0) {
// long count = select.stream().filter(propertyContract -> propertyContract.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) || // long count = select.stream().filter(propertyContract -> propertyContract.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) ||


+ 105
- 86
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -214,9 +214,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
result.put("wxMerchant", null); result.put("wxMerchant", null);
} }
//关联的店铺 //关联的店铺
if (wxRentContract.getShopId() != null) {
if (wxRentContract.shopIdsByRentInfo().size()> 0) {
WxShop record = new WxShop(); WxShop record = new WxShop();
record.setId(wxRentContract.getShopId());
//record.setId(wxRentContract.getShopId());
record.setIds(wxRentContract.shopIdsByRentInfo());
List<Map<String, Object>> list = wxShopMapper.findListMap(record); List<Map<String, Object>> list = wxShopMapper.findListMap(record);
result.put("wxShops", list); result.put("wxShops", list);
} else { } else {
@@ -445,13 +446,14 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return new ResultData(ErrorCode.SHOP_NOT_SELECTED); return new ResultData(ErrorCode.SHOP_NOT_SELECTED);
} }
//查询rent_info 包括 shopId //查询rent_info 包括 shopId
String shopName = "";
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
WxRentContract wxRentContract = new WxRentContract(); WxRentContract wxRentContract = new WxRentContract();
wxRentContract.updateTenantInfo(record); wxRentContract.updateTenantInfo(record);
Long shopId = rentInfoObject.getLong("shopId"); Long shopId = rentInfoObject.getLong("shopId");
//wxRentContract.setShopId(shopId); //wxRentContract.setShopId(shopId);
int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract);
int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract.getTenantId(),wxRentContract.getParentTenantId(),shopId,wxRentContract.getId());
String shopNumber = rentInfoObject.getString("shopNumber"); String shopNumber = rentInfoObject.getString("shopNumber");
if (count > 0) { if (count > 0) {
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租");
@@ -477,6 +479,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }
if (!shopList.contains(shopId)) { if (!shopList.contains(shopId)) {
shopList.add(shopId); shopList.add(shopId);
shopName = shopName +","+ shopNumber;
} }
} }


@@ -485,6 +488,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
record.setStatus(EnumRentContractStatus.DRAFT.getCode()); record.setStatus(EnumRentContractStatus.DRAFT.getCode());
Date tempDate = record.getRentalStartDate(); Date tempDate = record.getRentalStartDate();
record.setRentalStartDate(oldRentStartDate); record.setRentalStartDate(oldRentStartDate);
record.setShopName(shopName);
wxRentContractMapper.insert(record); wxRentContractMapper.insert(record);
wxRentContractShopMapper.deleteShops(record.getId()); wxRentContractShopMapper.deleteShops(record.getId());
record.setShopIdList(shopList); record.setShopIdList(shopList);
@@ -519,26 +523,27 @@ public class WxRentContractServiceImpl implements WxRentContractService {


@Override @Override
public List<Long> getShopIds(WxRentContract record) { public List<Long> getShopIds(WxRentContract record) {
List<Long> shopList = Lists.newArrayList();
if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
String rentInfo = record.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size();
//查询rent_info 包括 shopId
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
WxRentContract wxRentContract = new WxRentContract();
wxRentContract.updateTenantInfo(record);
Long shopId = rentInfoObject.getLong("shopId");
shopList.add(shopId);
}
} else {
WxRentContract wxRentContract = new WxRentContract();
wxRentContract.updateTenantInfo(record);
wxRentContract.setShopId(record.getShopId());
shopList.add(record.getShopId());
}
return shopList;
return record.shopIdsByRentInfo();
// List<Long> shopList = Lists.newArrayList();
// if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
// String rentInfo = record.getRentInfo();
// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
// int size = rentInfoArray.size();
// //查询rent_info 包括 shopId
// for (int i = 0; i < size; i++) {
// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
// WxRentContract wxRentContract = new WxRentContract();
// wxRentContract.updateTenantInfo(record);
// Long shopId = rentInfoObject.getLong("shopId");
// shopList.add(shopId);
// }
// } else {
// WxRentContract wxRentContract = new WxRentContract();
// wxRentContract.updateTenantInfo(record);
// wxRentContract.setShopId(record.getShopId());
// shopList.add(record.getShopId());
// }
// return shopList;
} }


@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
@@ -586,6 +591,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record);
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
int count = 1; int count = 1;
List<Long> shopIds = record.shopIdsByRentInfo();
for (WxBillRent bill:record.getPreviewBillRentList()) { for (WxBillRent bill:record.getPreviewBillRentList()) {
bill.setId(idWorker.nextId()); bill.setId(idWorker.nextId());
Date date = new Date(); Date date = new Date();
@@ -602,7 +608,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bill.setLatePayRatio(0); bill.setLatePayRatio(0);
bill.setPay(0L); bill.setPay(0L);
bill.setIsDel(EnumDelStatus.NOT_DEL.getCode()); bill.setIsDel(EnumDelStatus.NOT_DEL.getCode());
bill.setShopId(record.getShopId());
if (null != shopIds && shopIds.size() == 1) {
bill.setShopId(shopIds.get(0));
}
setExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod()); setExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod());
if (bill.getReceivePay().equals(0L)) { if (bill.getReceivePay().equals(0L)) {
bill.setStatus(EnumBillRentStatus.PAID.getCode()); bill.setStatus(EnumBillRentStatus.PAID.getCode());
@@ -772,7 +780,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillDeposit.setIsDel(0); wxBillDeposit.setIsDel(0);
wxBillDeposit.setMerchantId(wxRentContract.getMerchantId()); wxBillDeposit.setMerchantId(wxRentContract.getMerchantId());
wxBillDeposit.setUserId(userId); wxBillDeposit.setUserId(userId);
wxBillDeposit.setShopId(wxRentContract.getShopId());
if (wxRentContract.shopIdsByRentInfo().size()==1) {
wxBillDeposit.setShopId(wxRentContract.shopIdsByRentInfo().get(0));
}
wxBillDeposit.setCreatetime(date); wxBillDeposit.setCreatetime(date);
wxBillDeposit.setUpdatetime(date); wxBillDeposit.setUpdatetime(date);
wxBillDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); wxBillDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode());
@@ -855,8 +865,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if (shopId == null) { if (shopId == null) {
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除");
} }
wxRentContractQuery.setShopId(Long.valueOf(shopId));
int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery);
//wxRentContractQuery.setShopId(Long.valueOf(shopId));
int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery.getTenantId(),wxRentContractQuery.getParentTenantId(),Long.valueOf(shopId),wxRentContractQuery.getId());
if (count > 0) { if (count > 0) {
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租");
} }
@@ -1694,23 +1704,26 @@ public class WxRentContractServiceImpl implements WxRentContractService {
result.put("buildArea", buildAreaStr); result.put("buildArea", buildAreaStr);
result.put("operationArea", operationAreaStr); result.put("operationArea", operationAreaStr);
} else { } else {
WxShop record = new WxShop();
record.setId(wxRentContract.getShopId());
List<Map<String, Object>> wxShops = wxShopMapper.findListMap(record);
if (!wxShops.isEmpty()) {
//店铺信息
Map<String, Object> wxShop = wxShops.get(0);
result.put("shopNumber", wxShop.get("shopNumber"));
result.put("floorName", wxShop.get("floor"));
result.put("buildingName", wxShop.get("building"));
result.put("buildArea", wxShop.get("buildArea"));
result.put("operationArea", wxShop.get("operationArea"));
} else {
result.put("shopNumber", " ");
result.put("floorName", " ");
result.put("buildingName", " ");
result.put("buildArea", " ");
result.put("operationArea", " ");
//record.setId(wxRentContract.getShopId());
if (wxRentContract.shopIdsByRentInfo().size() == 0) {
result.put("shopNumber", " ");
result.put("floorName", " ");
result.put("buildingName", " ");
result.put("buildArea", " ");
result.put("operationArea", " ");
}else {
WxShop record = new WxShop();
record.setIds(wxRentContract.shopIdsByRentInfo());
List<Map<String, Object>> wxShops = wxShopMapper.findListMap(record);
if (!wxShops.isEmpty()) {
//店铺信息
Map<String, Object> wxShop = wxShops.get(0);
result.put("shopNumber", wxShop.get("shopNumber"));
result.put("floorName", wxShop.get("floor"));
result.put("buildingName", wxShop.get("building"));
result.put("buildArea", wxShop.get("buildArea"));
result.put("operationArea", wxShop.get("operationArea"));
}
} }
} }
//MALL信息 //MALL信息
@@ -2511,7 +2524,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
record.setUpdatetime(date); record.setUpdatetime(date);


List<Long> shopList = Lists.newArrayList(); List<Long> shopList = Lists.newArrayList();
if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
String shopName = "";
//if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
String rentInfo = record.getRentInfo(); String rentInfo = record.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size(); int size = rentInfoArray.size();
@@ -2529,17 +2543,21 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if (wxShop == null) { if (wxShop == null) {
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除");
} }
shopList.add(shopId);
if (!shopList.contains(shopId)) {
shopList.add(shopId);
shopName = shopName+","+shopNumber;
}
} }
} else {
shopList.add(record.getShopId());
}
//} else {
// shopList.add(record.getShopId());
//}


try { try {
record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode());
record.setStatus(EnumRentContractStatus.DRAFT.getCode()); record.setStatus(EnumRentContractStatus.DRAFT.getCode());
Date tempDate = record.getRentalStartDate(); Date tempDate = record.getRentalStartDate();
record.setRentalStartDate(oldRentStartDate); record.setRentalStartDate(oldRentStartDate);
record.setShopName(shopName);
wxRentContractMapper.insert(record); wxRentContractMapper.insert(record);
record.setRentalStartDate(tempDate); record.setRentalStartDate(tempDate);
} catch (Exception e) { } catch (Exception e) {
@@ -2548,14 +2566,15 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }


//生成预览账单(补录第二步,第三步走编辑) //生成预览账单(补录第二步,第三步走编辑)
if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null
&& !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0l)) {
wxBillRentMapper.deletePreviewBill(record);
//重新生成
List<WxBillRent> resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode(),true);
record.setPreviewBillRentList(resultList);
}

// if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null
// && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0l)) {
// wxBillRentMapper.deletePreviewBill(record);
// //重新生成
// List<WxBillRent> resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode(),true);
// record.setPreviewBillRentList(resultList);
// }
List<WxBillRent> resultList = buildRent(null, record, EnumIsPreview.YES.getCode(),true);
record.setPreviewBillRentList(resultList);
EventUtil.publistRentEvent(this, record); EventUtil.publistRentEvent(this, record);
return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record);
} }
@@ -2581,7 +2600,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
&& !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) { && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) {
//删除预账单,重新生成 //删除预账单,重新生成
wxBillRentMapper.deletePreviewBill(record); wxBillRentMapper.deletePreviewBill(record);
resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode(),true);
resultList = buildRent( null, record, EnumIsPreview.YES.getCode(),true);
} }
} }


@@ -2637,7 +2656,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {


record.setUpdatetime(new Date()); record.setUpdatetime(new Date());


if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
// if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
String rentInfo = record.getRentInfo(); String rentInfo = record.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size(); int size = rentInfoArray.size();
@@ -2659,21 +2678,21 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除");
} }
} }
} else {
WxRentContract wxRentContractQuery = new WxRentContract();
wxRentContractQuery.updateTenantInfo(record);
wxRentContractQuery.setShopId(record.getShopId());
// long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream().
// filter(rc -> rc.get("status").equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
// || rc.get("status").equals(EnumRentContractStatus.RENT_PAID.getCode())
// || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count();
long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream().
filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode())
|| rc.get("status").equals(EnumRentContractStatus.PAING.getCode())).count();
if (count > 0) {
return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND);
}
}
// } else {
// WxRentContract wxRentContractQuery = new WxRentContract();
// wxRentContractQuery.updateTenantInfo(record);
// wxRentContractQuery.setShopId(record.getShopId());
//// long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream().
//// filter(rc -> rc.get("status").equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
//// || rc.get("status").equals(EnumRentContractStatus.RENT_PAID.getCode())
//// || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count();
// long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream().
// filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode())
// || rc.get("status").equals(EnumRentContractStatus.PAING.getCode())).count();
// if (count > 0) {
// return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND);
// }
// }


try { try {
Date tempDate = record.getRentalStartDate(); Date tempDate = record.getRentalStartDate();
@@ -2764,17 +2783,17 @@ public class WxRentContractServiceImpl implements WxRentContractService {
WxRentContract wxRentContract = new WxRentContract(); WxRentContract wxRentContract = new WxRentContract();
wxRentContract.setTenantId(tenantId); wxRentContract.setTenantId(tenantId);
wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode());
List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(wxRentContract);
for (int i = 0, size = rentContractData.size(); i < size; i++) {
Map<String, Object> contract = rentContractData.get(i);
Object merchantId = contract.get("merchantId");
if (merchantId != null) {
WxMerchant merchant = wxMerchantMapper.selectById((Long) merchantId);
Integer status = merchant.getStatus();
if (status.equals(EnumMerchantStatus.VALID.getCode())) {
wxMerchantService.disableMerchat((Long) merchantId);
}
}
}
// List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(wxRentContract);
// for (int i = 0, size = rentContractData.size(); i < size; i++) {
// Map<String, Object> contract = rentContractData.get(i);
// Object merchantId = contract.get("merchantId");
// if (merchantId != null) {
// WxMerchant merchant = wxMerchantMapper.selectById((Long) merchantId);
// Integer status = merchant.getStatus();
// if (status.equals(EnumMerchantStatus.VALID.getCode())) {
// wxMerchantService.disableMerchat((Long) merchantId);
// }
// }
// }
} }
} }

+ 4
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java Просмотреть файл

@@ -46,10 +46,10 @@ public class WxRentPropertyContractServiceImpl implements WxRentPropertyContract
@Autowired @Autowired
WxRentContractService wxRentContractService; WxRentContractService wxRentContractService;


// @Override
// public PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record, Integer pageIndex, Integer pageSize) {
// return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record));
// }
@Override
public PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record));
}


@Override @Override
public ResultData getContractInfo(Long id) { public ResultData getContractInfo(Long id) {


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java Просмотреть файл

@@ -125,11 +125,11 @@ public class WxShopServiceImpl implements WxShopService {
if (isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) { if (isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) {
//3、合同 两种 都要查一下 存在时不能删除 //3、合同 两种 都要查一下 存在时不能删除
WxRentContract wxRentContract = new WxRentContract(); WxRentContract wxRentContract = new WxRentContract();
wxRentContract.setShopId(wxShop.getId());
//wxRentContract.setShopId(wxShop.getId());
wxRentContract.updateTenantInfo(wxShop); wxRentContract.updateTenantInfo(wxShop);
long count = 0; long count = 0;
if (wxShop.getType().equals(EnumRentShopType.SHOP.getCode())) { if (wxShop.getType().equals(EnumRentShopType.SHOP.getCode())) {
count = wxRentContractMapper.selectRentContractByShopId(wxRentContract).parallelStream()
count = wxRentContractMapper.selectRentContractByShopId(wxRentContract.getTenantId(),wxRentContract.getParentTenantId(),wxShop.getId(),null).parallelStream()
// .filter(r -> !r.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) && // .filter(r -> !r.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) &&
// !r.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) && // !r.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) &&
// !r.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); // !r.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count();


+ 32
- 30
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java Просмотреть файл

@@ -549,21 +549,21 @@ public class InvestBizServiceImpl implements InvestBizService {
//2、目标信息 //2、目标信息
Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId)); Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId));
//3、商品合同信息 //3、商品合同信息
Map<Long, WxRentContract> shopContractMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(shops)) {
Collection<Long> shopPointIds = buildShopContractQuery(shops, EnumRentShopType.POINT);
Collection<Long> shopIds = buildShopContractQuery(shops, EnumRentShopType.SHOP);
shopContractMap = rentContractService.selectRentContractByShopIds(shopPointIds,
StringUtils.join(shopIds, "|"),
InvestUserContext.getUser());
}
for (WxShop shop : shops) {
WxRentContract contract = shopContractMap.get(shop.getId());
if (Objects.nonNull(contract)) {
shop.setStartdate(contract.getRentalStartDate());
shop.setEnddate(contract.getRentalEndDate());
}
}
// Map<Long, WxRentContract> shopContractMap = new HashMap<>();
// if (CollectionUtils.isNotEmpty(shops)) {
// Collection<Long> shopPointIds = buildShopContractQuery(shops, EnumRentShopType.POINT);
// Collection<Long> shopIds = buildShopContractQuery(shops, EnumRentShopType.SHOP);
// shopContractMap = rentContractService.selectRentContractByShopIds(shopPointIds,
// StringUtils.join(shopIds, "|"),
// InvestUserContext.getUser());
// }
// for (WxShop shop : shops) {
// WxRentContract contract = shopContractMap.get(shop.getId());
// if (Objects.nonNull(contract)) {
// shop.setStartdate(contract.getRentalStartDate());
// shop.setEnddate(contract.getRentalEndDate());
// }
// }


Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);
//4、用户信息 //4、用户信息
@@ -765,18 +765,19 @@ public class InvestBizServiceImpl implements InvestBizService {


@Override @Override
public Map<String, Object> shopRentInfo(Long shopId) { public Map<String, Object> shopRentInfo(Long shopId) {
WxShop shop = shopService.getById(shopId);
InvestHelper.notNull(shop, "shop 不存在");
//3、商品合同信息
Map<Long, WxRentContract> shopContractMap = rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()),
StringUtils.join(shop.getId()),
InvestUserContext.getUser());
WxRentContract contract = shopContractMap.get(shop.getId());
InvestHelper.notNull(contract, "合同信息不存在");
Map<String, Object> map = new HashMap<>();
map.put("startdate", contract.getRentalStartDate());
map.put("enddate", contract.getRentalEndDate());
return map;
// WxShop shop = shopService.getById(shopId);
// InvestHelper.notNull(shop, "shop 不存在");
// //3、商品合同信息
// Map<Long, WxRentContract> shopContractMap = rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()),
// StringUtils.join(shop.getId()),
// InvestUserContext.getUser());
// WxRentContract contract = shopContractMap.get(shop.getId());
// InvestHelper.notNull(contract, "合同信息不存在");
// Map<String, Object> map = new HashMap<>();
// map.put("startdate", contract.getRentalStartDate());
// map.put("enddate", contract.getRentalEndDate());
// return map;
return null;
} }


public List<MallUserInfo> queryUserList(EnumInvestUserType userType) { public List<MallUserInfo> queryUserList(EnumInvestUserType userType) {
@@ -921,9 +922,10 @@ public class InvestBizServiceImpl implements InvestBizService {
if (Objects.isNull(shop)) { if (Objects.isNull(shop)) {
return new HashMap<>(); return new HashMap<>();
} }
return rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()),
StringUtils.join(shop.getId(), ""),
InvestUserContext.getUser());
// return rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()),
// StringUtils.join(shop.getId(), ""),
// InvestUserContext.getUser());
return new HashMap<>();
} }


@Override @Override


+ 11
- 10
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Просмотреть файл

@@ -450,7 +450,7 @@
<if test=" null != status ">and status=#{status} and status!=7</if> <if test=" null != status ">and status=#{status} and status!=7</if>
</select> </select>


<update id="updateInvalidContract" parameterType="com.iformall.domain.po.WxRentContract">
<!-- <update id="updateInvalidContract" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set status=#{status} update wx_rent_contract set status=#{status}
where 1=1 where 1=1
<if test=" null != tenantId and '' != tenantId"> <if test=" null != tenantId and '' != tenantId">
@@ -462,7 +462,7 @@
and id in(select r.id from ( and id in(select r.id from (
select id from wx_rent_contract where json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) select id from wx_rent_contract where json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"'))
and rent_shop_type=1 and status in(0,1) and status!=7)r) and rent_shop_type=1 and status in(0,1) and status!=7)r)
</update>
</update> -->


<select id="selectRentContractByMerchantId" parameterType="com.iformall.domain.po.WxRentContract" <select id="selectRentContractByMerchantId" parameterType="com.iformall.domain.po.WxRentContract"
resultType="com.iformall.domain.po.WxRentContract"> resultType="com.iformall.domain.po.WxRentContract">
@@ -509,7 +509,7 @@
<resultMap id="contractMap" type="com.iformall.domain.vo.WxRentPropertyContractVo"> <resultMap id="contractMap" type="com.iformall.domain.vo.WxRentPropertyContractVo">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="contract_number" property="contractNumber"/> <result column="contract_number" property="contractNumber"/>
<result column="shop_number" property="shopNumber"/>
<result column="shop_name" property="shopName"/>
<result column="merchant_name" property="merchantName"/> <result column="merchant_name" property="merchantName"/>
<result column="rent_info" property="rentInfo"/> <result column="rent_info" property="rentInfo"/>
<result column="rental_start_date" property="rentalStartDate"/> <result column="rental_start_date" property="rentalStartDate"/>
@@ -530,14 +530,13 @@
</resultMap> </resultMap>


<!-- <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap">
<select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap">
select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`, select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`,
rc.price as rent_price,rc.contract_number,s.shop_number,rc.type,rc.apply_status,
rc.price as rent_price,rc.contract_number,rc.shop_name,rc.type,rc.apply_status,
rc.rent_shop_type,rc.rent_info,pc.price as property_price,rc.merchant_id,pc.`status` as property_status, 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.price_unit as rent_price_unit,pc.price_unit as property_price_unit,
rc.business_type businessType,rc.bus_discount_ratio,rc.bus_discount_time rc.business_type businessType,rc.bus_discount_ratio,rc.bus_discount_time
from wx_rent_contract rc left join wx_property_contract pc on rc.id=pc.rent_contract_id from wx_rent_contract rc left join wx_property_contract pc on rc.id=pc.rent_contract_id
left join wx_shop s on rc.shop_id=s.id
<where> <where>
<if test=" null != tenantId and '' != tenantId"> <if test=" null != tenantId and '' != tenantId">
and rc.`tenant_id` = #{tenantId} and rc.`tenant_id` = #{tenantId}
@@ -548,13 +547,15 @@
<if test=" null != merchantName and merchantName!=''">and rc.`merchant_name` like <if test=" null != merchantName and merchantName!=''">and rc.`merchant_name` like
concat('%',#{merchantName},'%') concat('%',#{merchantName},'%')
</if> </if>
<if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1">
<if test=" null != shopNumber and shopNumber!=''">
and (json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%') or rc.shop_name like concat('%',#{shopNumber},'%') )
</if>
<!-- <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1">
and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%') and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%')
</if> </if>
<if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==2"> <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==2">
and s.`shop_number` like concat('%',#{shopNumber},'%') and s.`shop_number` like concat('%',#{shopNumber},'%')

</if>
</if> -->
<if test=" null != status ">and rc.`status` = #{status}</if> <if test=" null != status ">and rc.`status` = #{status}</if>
<if test=" null != type ">and rc.`type` = #{type}</if> <if test=" null != type ">and rc.`type` = #{type}</if>
<if test=" null != rentShopType "> <if test=" null != rentShopType ">
@@ -601,7 +602,7 @@
</where> </where>
<if test=" null != sortColumns">order by ${sortColumns}</if> <if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if> <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if>
</select> -->
</select>


<select id="getByBill" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> <select id="getByBill" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap">
select <include refid="allColumns"/> from wx_rent_contract select <include refid="allColumns"/> from wx_rent_contract


Загрузка…
Отмена
Сохранить