Просмотр исходного кода

[租赁合同][修改][判断商铺是否已签约合同]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
841666eff6
3 измененных файлов: 25 добавлений и 10 удалений
  1. +3
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java
  2. +18
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  3. +4
    -0
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

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

@@ -9,7 +9,7 @@ import java.util.Map;
/**
* @author gongbiao
*/
public interface WxRentContractMapper extends CommonMapper<WxRentContract, String> {
public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> {

List<WxRentContract> findList(WxRentContract wxRentContract);

@@ -47,4 +47,6 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Strin

List<WxRentContract> getMerchants(WxRentContract wxRentContract);

int selectRentContractCountByShopId(WxRentContract wxRentContract);

}

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

@@ -205,19 +205,28 @@ public class WxRentContractServiceImpl implements WxRentContractService {
Date date = new Date();
record.setCreatetime(date);
record.setUpdatetime(date);
try {

String rentInfo = record.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size();
if (size == 0) {
return new ResultData(ErrorCode.SHOP_NOT_SELECTED);
}

//查询rent_info 包括 shopId
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
WxRentContract wxRentContract = new WxRentContract();
wxRentContract.setTenantId(record.getTenantId());
wxRentContract.setShopId(record.getShopId());
long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream().
filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode())
&& !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode())
&& !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode())
&& !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode())
&& !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).count();
wxRentContract.setShopId(rentInfoObject.getLong("shopId"));
int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract);
if (count > 0) {
return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND);
String shopNumber = rentInfoObject.getString("shopNumber");
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租");
}
}

try {
record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode());
wxRentContractMapper.insertSelective(record);
} catch (Exception e) {


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

@@ -223,5 +223,9 @@
and merchant_id not in(select merchant_id from wx_property_contract where status in(2,3,4))
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="selectRentContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int">
select count(*) from wx_rent_contract where tenant_id=#{tenantId} and json_contains(json_extract(rent_info,'$[*].shopId'),#{shopId}) and status in (2,3,4)
</select>

</mapper>

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