| @@ -8,6 +8,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.WxShopUsersInfo; | |||
| import com.iformall.domain.po.WxShopUsersPerson; | |||
| @@ -83,6 +84,34 @@ public class WxShopController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("根据关键字查询") | |||
| @GetMapping("search") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData search(@ModelAttribute WxShop wxShop, Integer pageNum, Integer pageSize) { | |||
| if (null == wxShop) wxShop = new WxShop(); | |||
| wxShop.updateTenantInfo(getTenantInfo()); | |||
| setDataRule(wxShop); | |||
| if (StringUtils.isNotBlank(wxShop.getSearchKey())) { | |||
| //searchKey可以是铺位号,可以是业主或者租户名称,电话 | |||
| WxShopUsers suq = new WxShopUsers(); | |||
| suq.updateTenantInfo(wxShop); | |||
| suq.setSearchKey(wxShop.getSearchKey()); | |||
| List<Long> shopIdList = wxShopService.getUserShopIds(suq); | |||
| if (null != shopIdList && shopIdList.size() <= 0 ) { | |||
| wxShop.setId(-1L); | |||
| }else { | |||
| wxShop.setOrShopIds(shopIdList); | |||
| } | |||
| wxShop.setShopNumber(wxShop.getSearchKey()); | |||
| } | |||
| final PageInfo<WxShop> page = wxShopService.listAsPage(wxShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -24,25 +24,6 @@ public class WxShop extends TenantEntity { | |||
| protected Long id; | |||
| @TableField(exist = false) | |||
| private List<Long> notInIdList; | |||
| @TableField(exist = false) | |||
| private Long rentContractId; | |||
| @TableField(exist = false) | |||
| private String linkPerson; | |||
| @TableField(exist = false) | |||
| private String linkPhone; | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| @TableField(exist = false) | |||
| private String floorForRule; | |||
| @Excel(name="类型",width = 20,orderNum = "1", | |||
| replace = {"商铺_null", "固定点位_1", "临时促销点位_2", "宣传点位_3","ATM点位_4","仓库点位_5","其他点位_6"}) | |||
| @io.swagger.annotations.ApiModelProperty(value = "点位类型", name = "pointType") | |||
| @@ -191,6 +172,19 @@ public class WxShop extends TenantEntity { | |||
| this.rent_unit = rentUnit; | |||
| } | |||
| @TableField(exist = false) | |||
| private List<Long> notInIdList; | |||
| @TableField(exist = false) | |||
| private Long rentContractId; | |||
| @TableField(exist = false) | |||
| private String linkPerson; | |||
| @TableField(exist = false) | |||
| private String linkPhone; | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| @TableField(exist = false) | |||
| private String floorForRule; | |||
| @TableField(exist = false) | |||
| private Integer isOwnMerchantShop; | |||
| @TableField(exist = false) | |||
| @@ -232,5 +226,15 @@ public class WxShop extends TenantEntity { | |||
| //账单完结备注 | |||
| @TableField(exist = false) | |||
| private String billCompleteRemark; | |||
| @TableField(exist = false) | |||
| private String searchKey; | |||
| @TableField(exist = false) | |||
| private List<Long> orShopIds; | |||
| @TableField(exist = false) | |||
| private Integer shopUserType; | |||
| @TableField(exist = false) | |||
| private String shopUserTypeName; | |||
| @TableField(exist = false) | |||
| private String shopUserName; | |||
| } | |||
| @@ -91,4 +91,6 @@ public class WxShopUsers extends TenantEntity { | |||
| private String sexName; | |||
| @TableField(exist = false) | |||
| private String linkPerson; | |||
| @TableField(exist = false) | |||
| private String searchKey; | |||
| } | |||
| @@ -75,5 +75,6 @@ public class WxShopUsersInfo extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private String phoneEqual; | |||
| @TableField(exist = false) | |||
| private String searchKey; | |||
| } | |||
| @@ -116,7 +116,33 @@ public class WxShopServiceImpl implements WxShopService { | |||
| @Override | |||
| public PageInfo<WxShop> listAsPage(WxShop record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopMapper.findList(record)); | |||
| PageInfo<WxShop> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopMapper.findList(record)); | |||
| if (null != page && null != page.getList() && page.getList().size() > 0 ){ | |||
| List<Long> shopIdList = new ArrayList<>(); | |||
| for (int i = 0 ; i < page.getList().size(); i ++) { | |||
| WxShop shop = page.getList().get(i); | |||
| shopIdList.add(shop.getId()); | |||
| } | |||
| WxShopUsers suq = new WxShopUsers(); | |||
| suq.updateTenantInfo(record); | |||
| suq.setShopIds(shopIdList); | |||
| suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); | |||
| Map<Long, WxShopUsers> shopUserMap = this.getShopUserMap(suq); | |||
| if (null != shopUserMap) { | |||
| for (int i = 0 ; i < page.getList().size(); i ++) { | |||
| WxShop shop = page.getList().get(i); | |||
| WxShopUsers su = shopUserMap.get(shop.getId()); | |||
| if (null != su) { | |||
| shop.setShopUserType(su.getType()); | |||
| shop.setShopUserTypeName(su.getTypeName()); | |||
| shop.setShopUserName(su.getName()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return page; | |||
| } | |||
| @Override | |||
| @@ -1090,6 +1116,17 @@ public class WxShopServiceImpl implements WxShopService { | |||
| @Override | |||
| public List<Long> getUserShopIds(WxShopUsers wxShopUsers) { | |||
| if (StringUtils.isNotBlank(wxShopUsers.getSearchKey())) { | |||
| WxShopUsersInfo sui = new WxShopUsersInfo(); | |||
| sui.updateTenantInfo(wxShopUsers); | |||
| sui.setSearchKey(wxShopUsers.getSearchKey()); | |||
| List<Long> infoIds = wxShopUsersInfoMapper.findIdList(sui); | |||
| if (null == infoIds || infoIds.size() <= 0 ) { | |||
| wxShopUsers.setId(-1L); | |||
| }else { | |||
| wxShopUsers.setInfoIds(infoIds); | |||
| } | |||
| } | |||
| return wxShopUsersMapper.findShopIdList(wxShopUsers); | |||
| } | |||
| @@ -153,6 +153,14 @@ | |||
| #{tidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != orShopIds "> | |||
| and (id in | |||
| <foreach collection="orShopIds" index="index" item="oridItem" open="(" separator="," close=")"> | |||
| #{oridItem} | |||
| </foreach> | |||
| or `shop_number` like concat('%', #{shopNumber},'%')) | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -56,6 +56,10 @@ | |||
| and `phone` = #{phoneEqual} | |||
| </if> | |||
| <if test=" null != searchKey and searchKey != '' "> | |||
| and (`name` like concat('%', #{searchKey},'%') or `phone` like concat('%', #{searchKey},'%')) | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||