| @@ -270,9 +270,16 @@ public class WxRentContractController extends WxContractBaseController { | |||
| @ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "contractId", value = "contractId", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData merchantShops(Long merchantId,Long contractId) { | |||
| List<Long> shopList = wxMerchantService.getMerchantShopIds(merchantId); | |||
| if (null == shopList) { | |||
| //如果商户是虚拟商户,则直接返回绑定的铺位 | |||
| List<Long> shopList = null; | |||
| WxMerchant merchant = wxMerchantService.selectById(merchantId); | |||
| if (merchant.getIsPrivate() == EnumYesOrNo.YES.getCode()) { | |||
| shopList = new ArrayList<Long>(); | |||
| shopList.add(Long.parseLong(merchant.getCreateFromId())); | |||
| }else { | |||
| shopList = wxMerchantService.getMerchantShopIds(merchantId); | |||
| } | |||
| if (null == shopList || shopList.size() <= 0 ) { | |||
| return new ResultData(Result.ERROR,"商户未绑定店铺!"); | |||
| } | |||
| WxRentContract rentq = new WxRentContract(); | |||
| @@ -306,9 +313,15 @@ public class WxRentContractController extends WxContractBaseController { | |||
| && 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> _currentContractShopIds = rentContract.shopIdsByRentInfo(); | |||
| if (null != _currentContractShopIds) { | |||
| currentContractShopIds = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < _currentContractShopIds.size() ; i ++) { | |||
| Long cs = _currentContractShopIds.get(i); | |||
| if (shopList.contains(cs)) { | |||
| currentContractShopIds.add(cs); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| //去掉正常状态的合同里的店铺 | |||
| @@ -321,8 +334,14 @@ public class WxRentContractController extends WxContractBaseController { | |||
| //再加上合同里面店铺 | |||
| if(null != currentContractShopIds && currentContractShopIds.size() > 0 ) { | |||
| List<WxShop> contractShops = wxShopService.getByIds(rentq,currentContractShopIds); | |||
| contractShops.stream().filter( cs -> !shopList.contains(cs.getId())); | |||
| shops.addAll(contractShops); | |||
| if (null != contractShops) { | |||
| for (int i = 0 ; i < contractShops.size() ; i ++) { | |||
| WxShop s = contractShops.get(i); | |||
| if (!shopList.contains(s.getId())) { | |||
| shops.add(s); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(shops); | |||
| @@ -0,0 +1 @@ | |||
| ALTER TABLE wx_shop ADD COLUMN sell_status INT(1) NOT NULL DEFAULT 1 COMMENT '销售状态'; | |||
| @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.common.SortColumn; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.enums.EnumShopSellStatus; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -118,6 +119,17 @@ public class WxShop extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="管理人电话",name="managerPhone") | |||
| private String managerPhone; | |||
| @io.swagger.annotations.ApiModelProperty(value = "销售状态EnumShopSellStatus", name = "sellStatus") | |||
| private Integer sellStatus; | |||
| @TableField(exist = false) | |||
| private String sellStatusName; | |||
| public String getSellStatus() { | |||
| if (null != sellStatus) { | |||
| return EnumShopSellStatus.getEnum(sellStatus).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "类型EnumRentShopType", name = "type") | |||
| private Integer type; | |||
| @TableField(exist = false) | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| */ | |||
| public enum EnumShopSellStatus { | |||
| OWNED(1, "自持"), | |||
| SELLED(2, "已售"); | |||
| public static EnumShopSellStatus getEnum(Integer code) { | |||
| for (EnumShopSellStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumShopSellStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -361,6 +361,7 @@ public class WxShopServiceImpl implements WxShopService { | |||
| Date date = new Date(); | |||
| record.setUpdateDate(date); | |||
| record.setCreateDate(date); | |||
| record.setSellStatus(EnumShopSellStatus.OWNED.getCode()); | |||
| //若计租面积无值 则采用建筑面积 | |||
| if (StringUtils.isBlank(record.getOperationArea()) || "0".equals(record.getOperationArea())) { | |||
| record.setOperationArea(record.getBuildArea()); | |||
| @@ -396,16 +397,6 @@ public class WxShopServiceImpl implements WxShopService { | |||
| merchant.setCreditLocked(EnumYesOrNo.NO.getCode()); | |||
| wxMerchantMapper.insert(merchant); | |||
| } | |||
| WxMerchantShop ms = new WxMerchantShop(); | |||
| ms.updateTenantInfo(record); | |||
| ms.setMerchantId(merchant.getId()); | |||
| ms.setShopId(record.getId()); | |||
| ms.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| ms.setCreateDate(new Date()); | |||
| ms.setUpdateDate(new Date()); | |||
| wxMerchantShopMapper.insert(ms); | |||
| record.setStatus(EnumShopStatus.RENT.getCode()); | |||
| } | |||
| @@ -425,15 +416,6 @@ public class WxShopServiceImpl implements WxShopService { | |||
| if (wxShop == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND); | |||
| } | |||
| if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { | |||
| return new ResultData(ErrorCode.SHOP_BAN_DELETED); | |||
| } | |||
| //2、是否关联过商户 | |||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| wxMerchantShop.setShopId(wxShop.getId()); | |||
| wxMerchantShop.updateTenantInfo(wxShop); | |||
| List<WxMerchantShop> wxMerchantShops = wxMerchantShopMapper.findList(wxMerchantShop); | |||
| //如果存在有效的合同,则不允许删除 | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(wxShop); | |||
| @@ -454,15 +436,20 @@ public class WxShopServiceImpl implements WxShopService { | |||
| if (null != plist && plist.size() > 0 ) { | |||
| return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同,不能删除"); | |||
| } | |||
| WxAllBill abq = new WxAllBill(); | |||
| abq.updateTenantInfo(wxShop); | |||
| abq.setQueryShopNumber(wxShop.getShopNumber()); | |||
| abq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| List<WxAllBill> billlist = wxAllBillMapper.findList(abq); | |||
| if (null != billlist && plist.size() > 0 ) { | |||
| return new ResultData(Result.ERROR, "店铺已存在有效的账单,不能删除"); | |||
| } | |||
| //有关联过商户必须是管理员才能删除 | |||
| // WxAllBill abq = new WxAllBill(); | |||
| // abq.updateTenantInfo(wxShop); | |||
| // abq.setQueryShopNumber(wxShop.getShopNumber()); | |||
| // abq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| // List<WxAllBill> billlist = wxAllBillMapper.findList(abq); | |||
| // if (null != billlist && plist.size() > 0 ) { | |||
| // return new ResultData(Result.ERROR, "店铺已存在有效的账单,不能删除"); | |||
| // } | |||
| //2、是否关联过商户 | |||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| wxMerchantShop.setShopId(wxShop.getId()); | |||
| wxMerchantShop.updateTenantInfo(wxShop); | |||
| List<WxMerchantShop> wxMerchantShops = wxMerchantShopMapper.findList(wxMerchantShop); | |||
| int count = wxMerchantShops.size(); | |||
| if (count > 0) { | |||
| //更新标记 | |||
| @@ -475,8 +462,9 @@ public class WxShopServiceImpl implements WxShopService { | |||
| wxMerchantShopMapper.updateById(updateMerchantShop); | |||
| } | |||
| } else { | |||
| // 无关联商铺直接删除 | |||
| wxShopMapper.deleteById(id); | |||
| //虚拟商户是没有中间表的 | |||
| wxShop.setIsDel(EnumDelStatus.DEL.getCode()); | |||
| wxShopMapper.updateById(wxShop); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "删除成功"); | |||
| } | |||
| @@ -26,6 +26,7 @@ | |||
| <result column="manager" jdbcType="VARCHAR" property="manager"/> | |||
| <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="sell_status" jdbcType="INTEGER" property="sellStatus"/> | |||
| <result column="point_type" jdbcType="INTEGER" property="pointType"/> | |||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| @@ -39,7 +40,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,`floor`,`status`,`x`,`y`,`sid`,`addr`, | |||
| `baidu_poi`,`longitude`,`latitude`,`create_date`,`update_date`,`img_url`,`manager`,`manager_phone`, | |||
| `type`,`point_type`,`comments`,`is_del`,DATEDIFF(now(),create_date) freeDay,rent,rent_unit,business_id,pulic_rate | |||
| `type`,`sell_status`,`point_type`,`comments`,`is_del`,DATEDIFF(now(),create_date) freeDay,rent,rent_unit,business_id,pulic_rate | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -79,6 +80,10 @@ | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != sellStatus "> | |||
| and `sell_status` = #{sellStatus} | |||
| </if> | |||
| <if test=" null != x "> | |||
| and `x` = #{x} | |||
| @@ -190,7 +195,7 @@ | |||
| <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap"> | |||
| select s.id id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,CONVERT(s.build_area,DECIMAL(10,2)) buildArea, | |||
| s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,s.status,s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay, | |||
| s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,s.status,s.type,s.sell_status,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay, | |||
| s.business_id as businessId,s.create_date create_date,s.rent,s.rent_unit,s.building as buildingId,s.floor as floorId,s.manager,s.manager_phone managerPhone | |||
| from wx_shop s | |||
| @@ -210,6 +215,10 @@ | |||
| <if test=" null != status"> | |||
| and s.`status` = #{status} | |||
| </if> | |||
| <if test=" null != sellStatus "> | |||
| and s.`sell_status` = #{sellStatus} | |||
| </if> | |||
| <if test=" null != building "> | |||
| and s.`building`= #{building} | |||