xiaohanzi 5 лет назад
Родитель
Сommit
950f37d455
7 измененных файлов: 72 добавлений и 67 удалений
  1. +53
    -47
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  2. +3
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  3. +4
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java
  4. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  5. +2
    -16
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  6. +3
    -1
      mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml
  7. +6
    -0
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 53
- 47
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java Просмотреть файл

@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -249,60 +250,65 @@ public class WxRentContractController extends WxContractBaseController {
@GetMapping("/merchantShops")
@ApiImplicitParams({
@ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true)})
@ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true),
@ApiImplicitParam(name = "contractId", value = "contractId", dataType = "Long", paramType = "query", required = true)})
@SystemControllerLog(description = "租赁合同-终结合同")
public ResultData merchantShops(Long merchantId) {
logger.debug("[" + getIpAddr() + "] WxRentContractController::endRentContract");
return new ResultData(wxMerchantService.getMerchantShopList(merchantId));
}
@GetMapping("/merchantShopsRenewable")
@ApiImplicitParams({
@ApiImplicitParam(name = "contractId", value = "contractId", dataType = "Long", paramType = "query", required = true),
@ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true)})
@SystemControllerLog(description = "租赁合同-终结合同")
public ResultData merchantShopsRenewable(Long merchantId,Long contractId) {
logger.debug("[" + getIpAddr() + "] WxRentContractController::endRentContract");
List<WxShop> allist = new ArrayList<WxShop>();
List<WxShop> shopList = wxMerchantService.getMerchantShopList(merchantId);
public ResultData merchantShops(Long merchantId,Long contractId) {
List<Long> shopList = wxMerchantService.getMerchantShopIds(merchantId);
if (null == shopList) {
return new ResultData(Result.ERROR,"商户未绑定店铺!");
}
WxRentContract rentContract = wxRentContractService.getSimpleDeatil(contractId);
if (null == rentContract) {
return new ResultData(Result.ERROR,"租金合同不存在!");
WxRentContract rentq = new WxRentContract();
List<Integer> status = new ArrayList<Integer>();
status.add(EnumRentContractStatus.PAING.getCode());
status.add(EnumRentContractStatus.READY_FOR_PAING.getCode());
rentq.setStatuss(status);
rentq.updateTenantInfo(getUser());
List<WxRentContract> rentContractList = wxRentContractService.findList(rentq);
List<Long> rentShopList = new ArrayList<Long>();
if (null != rentContractList) {
for (WxRentContract rent : rentContractList) {
List<Long> shopidlist = rent.shopIdsByRentInfo();
if (null != shopidlist) {
for (Long sid: shopidlist) {
if (!rentShopList.contains(sid)) {
rentShopList.add(sid);
}
}
}
}
}
//如果是新建,或者修改,此时能查询出来未在有效合同里面的店铺
if (rentContract.getStatus().intValue() != EnumRentContractStatus.PAING.getCode()
&& rentContract.getStatus().intValue() != EnumRentContractStatus.OUT_DATE.getCode()) {
return new ResultData(Result.ERROR,"租金合同状态为计租中或者正常到期才能续签。");
//如果是续签,则还能查询出来合同本身的店铺
List<Long> currentContractShopIds = null;
if (null != contractId) {
WxRentContract rentContract = wxRentContractService.getSimpleDeatil(contractId);
if (null == rentContract) {
return new ResultData(Result.ERROR,"租金合同不存在!");
}
if (rentContract.getStatus().intValue() != EnumRentContractStatus.PAING.getCode()
&& rentContract.getStatus().intValue() != EnumRentContractStatus.OUT_DATE.getCode()) {
return new ResultData(Result.ERROR,"租金合同状态为计租中或者正常到期才能续签。");
}
currentContractShopIds = rentContract.shopIdsByRentInfo();
if (null != currentContractShopIds) {
currentContractShopIds.stream().filter(si -> shopList.contains(si));
}
}
List<Long> shopIds = rentContract.shopIdsByRentInfo();
if (null != shopIds) {
List<WxShop> contractShops = wxShopService.getByIds(shopIds);
//如果合同状态是计租中,则商铺不显示
if (rentContract.getStatus().intValue() != EnumRentContractStatus.PAING.getCode()) {
if (null != contractShops) {
for (WxShop s:contractShops) {
if (shopList.contains(s)) {
shopList.remove(s);
}
}
}
}
}
return new ResultData(shopList);
}
//去掉正常状态的合同里的店铺
shopList.stream().filter(s -> !rentShopList.contains(s));
List<WxShop> shops = wxShopService.getByIds(shopList);
//再加上合同里面店铺
if(null != currentContractShopIds && currentContractShopIds.size() > 0 ) {
List<WxShop> contractShops = wxShopService.getByIds(currentContractShopIds);
contractShops.stream().filter( cs -> !shopList.contains(cs.getId()));
shops.addAll(contractShops);
}
return new ResultData(shops);
}

@GetMapping("getMerchantList")
@SystemControllerLog(description = "获取商户列表")


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

@@ -98,8 +98,10 @@ public class WxRentContract extends TenantEntity {
private Integer receivePeriod;
@io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "filepath")
private String filepath;
@io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期", name = "status")
@io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期", name = "status")
private Integer status;
@TableField(exist = false)
private List<Integer> statuss;
@io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "contractNumber")
private String contractNumber;
@io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit")


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

@@ -1,6 +1,9 @@
package com.iformall.mapper;

import java.util.*;

import org.apache.ibatis.annotations.Param;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxMerchantShop;

@@ -8,7 +11,7 @@ public interface WxMerchantShopMapper extends CommonMapper<WxMerchantShop, Strin

List<WxMerchantShop> findList(WxMerchantShop wxMerchantShop);
List<Long> findShopIds(@Param("merchantId") Long merchantId);



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

@@ -155,5 +155,5 @@ public interface WxMerchantService {

void disableMerchat(Long id);
List<WxShop> getMerchantShopList(Long merchantId);
List<Long> getMerchantShopIds(Long merchantId);
}

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

@@ -863,21 +863,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
}

@Override
public List<WxShop> getMerchantShopList(Long merchantId) {
WxMerchantShop wxMerchantShop = new WxMerchantShop();
wxMerchantShop.setMerchantId(merchantId);
wxMerchantShop.setIsDel(0);
List<WxMerchantShop> shopList = wxMerchantShopMapper.findList(wxMerchantShop);
if (null != shopList) {
List<Long> shopIds = new ArrayList<Long>();
for (WxMerchantShop ws: shopList) {
shopIds.add(ws.getShopId());
}
WxShop shop = new WxShop();
shop.setIds(shopIds);
return wxShopMapper.findList(shop);
}
return null;
public List<Long> getMerchantShopIds(Long merchantId) {
return wxMerchantShopMapper.findShopIds(merchantId);
}
}

+ 3
- 1
mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml Просмотреть файл

@@ -71,7 +71,9 @@
<include refid="dynamicWhereConditions" />
</select>
<select id="findShopIds" parameterType="Long" resultType="Long">
select shop_id from wx_merchant_shop where `merchant_id` = #{merchantId} and is_del = 0
</select>


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

@@ -129,6 +129,12 @@
<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 != statuss ">
and status in
<foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")">
#{statusItem}
</foreach>
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">


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