From 6317076e2627a06794210de4b3c21cb686425736 Mon Sep 17 00:00:00 2001 From: winter Date: Thu, 20 Jan 2022 20:02:57 +0800 Subject: [PATCH 1/2] fix wxshop --- .../controller/basic/WxMapController.java | 2 +- .../contract/WxRentContractController.java | 6 +- .../invest/InvestCustomerController.java | 4 +- .../invest/InvestTaskController.java | 2 +- .../iformall/mapper/WxMerchantShopMapper.java | 2 +- .../com/iformall/mapper/WxShopMapper.java | 4 +- .../com/iformall/service/WxBrandService.java | 3 +- .../iformall/service/WxBusinessService.java | 2 + .../com/iformall/service/WxShopService.java | 12 +- .../service/impl/WxBrandServiceImpl.java | 18 + .../service/impl/WxBusinessServiceImpl.java | 16 + .../service/impl/WxChartServiceImpl.java | 6 +- .../service/impl/WxMerchantServiceImpl.java | 8 +- .../impl/WxPropertyContractServiceImpl.java | 13 +- .../impl/WxRentContractServiceImpl.java | 20 +- .../service/impl/WxShopServiceImpl.java | 457 ++++++++++++++++-- .../service/invest/InvestBizService.java | 9 +- .../invest/impl/InvestBizServiceImpl.java | 26 +- .../resources/mapper/WxMerchantShopMapper.xml | 27 ++ .../main/resources/mapper/WxShopMapper.xml | 183 ++----- 20 files changed, 586 insertions(+), 234 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMapController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMapController.java index 336ca5439..9b3755db3 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMapController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMapController.java @@ -137,7 +137,7 @@ public class WxMapController extends BaseController { @SystemControllerLog(description = "店铺管理-id查询") public ResultData findShopById(Long id) { logger.debug("[" + getIpAddr() + "] WxMapController::findShopById"); - return new ResultData(Result.SUCCESS, "查询成功", wxShopService.detailById(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxShopService.detailById(this.getTenantInfo(),id)); } @ApiOperation("根据id查询接口") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index 5104a37c2..a8a798abd 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -386,10 +386,10 @@ public class WxRentContractController extends WxContractBaseController { //去重 shopList.removeAll(currentContractShopIds); } - List shops = wxShopService.getByIds(shopList); + List shops = wxShopService.getByIds(rentq,shopList); //再加上合同里面店铺 if(null != currentContractShopIds && currentContractShopIds.size() > 0 ) { - List contractShops = wxShopService.getByIds(currentContractShopIds); + List contractShops = wxShopService.getByIds(rentq,currentContractShopIds); contractShops.stream().filter( cs -> !shopList.contains(cs.getId())); shops.addAll(contractShops); } @@ -892,7 +892,7 @@ public class WxRentContractController extends WxContractBaseController { for (WxRentContract wrc: clist) { List shopIds = wrc.shopIdsByRentInfo(); if (null != shopIds) { - List shops = wxShopService.getByIds(shopIds); + List shops = wxShopService.getByIds(this.getFinalTenantInfo(),shopIds); String shopName = ""; for (WxShop shop : shops) { shopName = shopName +","+shop.getShopNumber(); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java index c675ce312..eb7f78801 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java @@ -46,7 +46,7 @@ public class InvestCustomerController extends InvestBaseController{ @SystemControllerLog(description = "客户信息列表") @GetMapping("/list/simple") public InvestResultData> listSimple() { - return execute(null, p -> investBizService.queryCustomer()); + return execute(null, p -> investBizService.queryCustomer(this.getTenantInfo())); } /** @@ -56,7 +56,7 @@ public class InvestCustomerController extends InvestBaseController{ @ApiOperation(value = "分页列表接口") @GetMapping("/list") public InvestResultData> list(InvestDemandQuery params) { - return execute(params, p -> investBizService.queryPageDemand(p)); + return execute(params, p -> investBizService.queryPageDemand(this.getTenantInfo(),p)); } /** diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java index b9d213f25..2430b7366 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java @@ -41,7 +41,7 @@ public class InvestTaskController extends InvestBaseController { @ApiOperation("分页列表接口") @GetMapping("/list") public InvestResultData> list(InvestTaskQuery params) { - return execute(params, p -> bizService.queryPageTask(p)); + return execute(params, p -> bizService.queryPageTask(this.getTenantInfo(),p)); } /** diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java index 56142a0b9..f223224d7 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java @@ -19,5 +19,5 @@ public interface WxMerchantShopMapper extends CommonMapper shopIds); - + List> rentRateHistory(Map params); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java index 3e25a92bf..41cc84ef7 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java @@ -33,12 +33,10 @@ public interface WxShopMapper extends CommonMapper { int hasShopNumber(WxShop wxShop); int hasShopSid(WxShop wxShop); - List findListWithMerchantMap(WxShop record); + List findListWithMerchantMap(WxShop record); Long getCountByWxShop(WxShop wxShop); - List> rentRateHistory(Map params); - void updateUnRentByIds(@Param("ids")List shopIds); Map detailById(@Param("id") Long id); diff --git a/mallinkService/src/main/java/com/iformall/service/WxBrandService.java b/mallinkService/src/main/java/com/iformall/service/WxBrandService.java index 4b63fbde5..bfdca9471 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBrandService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBrandService.java @@ -42,7 +42,6 @@ public interface WxBrandService { */ void deleteById(Long id); - ResultData save(WxBrand wxBrand); ResultData update(WxBrand wxBrand); @@ -55,5 +54,7 @@ public interface WxBrandService { * @return */ ResultData hasBrand(WxBrand wxBrand); + + Map getAllMap(TenantEntity tenantEntity); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxBusinessService.java b/mallinkService/src/main/java/com/iformall/service/WxBusinessService.java index 25dac7942..84ddc3ce2 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBusinessService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBusinessService.java @@ -21,6 +21,8 @@ public interface WxBusinessService { * @return */ PageInfo listAsPage(WxBusiness record, Integer pageIndex, Integer pageSize); + + Map findAllMap(); /** * 根据实体查询列表 diff --git a/mallinkService/src/main/java/com/iformall/service/WxShopService.java b/mallinkService/src/main/java/com/iformall/service/WxShopService.java index b87ca9630..8774463a4 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxShopService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxShopService.java @@ -30,7 +30,9 @@ public interface WxShopService { PageInfo> listMapAsPage(WxShop record, Integer pageIndex, Integer pageSize); - PageInfo> notRentListMapAsPage(WxShop record, Integer pageIndex, Integer pageSize); + PageInfo> notRentListMapAsPage(WxShop record,Integer pageIndex,Integer pageSize); + + List findListWithMerchantMap(WxShop record); /** * 根据Id获得实体 @@ -40,7 +42,11 @@ public interface WxShopService { */ WxShop getById(Long id); - List getByIds(Collection ids); + List getByIds(TenantEntity tenantEntity,Collection ids); + + PageInfo> findListMap(WxShop record,Integer pageIndex,Integer pageSize); + + List> rentRateHistory(TenantEntity tenantEntity,Map params); /** * 保存或更新实体 @@ -83,7 +89,7 @@ public interface WxShopService { void exportNotRentShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response); @Deprecated - Map detailById(Long id); + Map detailById(TenantEntity tenantEntity,Long id); Map detailBySid(TenantEntity tenantInfo, String sid); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java index 970ec80f4..17fc75e43 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java @@ -8,6 +8,7 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.WxBrand; +import com.iformall.domain.po.WxBusiness; import com.iformall.domain.po.WxShop; import com.iformall.enums.EnumDelFlag; import com.iformall.exception.MallinkException; @@ -111,5 +112,22 @@ public class WxBrandServiceImpl implements WxBrandService { return new ResultData(ResultData.SUCCESS, "查询成功", count > 0 ? true : false); } + @Override + public Map getAllMap(TenantEntity tenantEntity) { + WxBrand brandQ = new WxBrand(); + brandQ.updateTenantInfo(tenantEntity); + List brandList = wxBrandMapper.findList(brandQ); + Map map = new HashMap(); + if (null != brandList) { + for (int i = 0 ; i < brandList.size() ; i++) { + WxBrand b = brandList.get(i); + if (null != b) { + map.put(b.getId(), b); + } + } + } + return map; + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java index b552c71f4..6d47700b7 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java @@ -25,6 +25,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -206,4 +207,19 @@ public class WxBusinessServiceImpl implements WxBusinessService { return new ResultData(pageInfo); } + @Override + public Map findAllMap() { + List list = wxBusinessMapper.findListAll(); + Map map = new HashMap(); + if (null != list) { + for (int i = 0 ; i < list.size() ; i++) { + WxBusiness b = list.get(i); + if (null != b) { + map.put(b.getId(), b); + } + } + } + return map; + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index 6af25ba38..ee6a211a2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -128,6 +128,10 @@ public class WxChartServiceImpl implements WxChartDataService { @Lazy @Autowired private WxCUserCarService wxCUserCarService; + + @Lazy + @Autowired + private WxShopService wxShopService; @@ -719,7 +723,7 @@ public class WxChartServiceImpl implements WxChartDataService { Long total = wxShopMapper.getCountByWxShop(query); // List allList = wxShopMapper.findList(query); - List> mapList = wxShopMapper.rentRateHistory(queryMap); + List> mapList = wxShopService.rentRateHistory(tenantEntity,queryMap); if(CollectionUtils.isNotEmpty(mapList)){ String startTime = (String)mapList.get(0).get("xTime"); String endTime = (String)mapList.get(mapList.size()-1).get("xTime"); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index af1d08522..6dd5a531d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -297,7 +297,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { for (WxMerchantShop merchantShop : wxMerchantShopList) { WxShop record = new WxShop(); record.setId(merchantShop.getShopId()); - List> shoplist = wxShopMapper.findListMap(record); + record.updateTenantInfo(wxMerchant); + PageInfo> pageInfo = wxShopService.findListMap(record,1,10000); + List> shoplist = pageInfo.getList(); if (shoplist.size() > 0) { shops.add(shoplist.get(0)); } @@ -1082,7 +1084,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { for (WxMerchantShop merchantShop : wxMerchantShopList) { WxShop shop = new WxShop(); shop.setId(merchantShop.getShopId()); - List> shoplist = wxShopMapper.findListMap(shop); + shop.updateTenantInfo(merchant); + PageInfo> shopPageInfo = wxShopService.findListMap(shop,1,10000); + List> shoplist = shopPageInfo.getList(); if (shoplist.size() > 0) { shops.add(shoplist.get(0)); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index a3665f58e..419c72db0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -64,17 +65,25 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService @Autowired WxRentContractMapper wxRentContractMapper; + @Lazy @Autowired WxFlowService wxFlowService; + @Lazy @Autowired WxFlowRecordService wxFlowRecordService; + @Lazy @Autowired WxRentContractService wxRentContractService; + @Lazy @Autowired WxPayAccountBillService wxPayAccountBillService; + + @Lazy + @Autowired + WxShopService wxShopService; @Override public PageInfo listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { @@ -189,7 +198,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService WxShop record = new WxShop(); if (null != wrc.shopIdsByRentInfo() && wrc.shopIdsByRentInfo().size()>0) { record.setIds(wrc.shopIdsByRentInfo()); - List> list = wxShopMapper.findListMap(record); + record.updateTenantInfo(wxPropertyContract); + PageInfo> shopPageInfo = wxShopService.findListMap(record,1,10000); + List> list = shopPageInfo.getList(); result.put("wxShops", list); }else { result.put("wxShops", Collections.EMPTY_LIST); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index b677e93cd..345b36c88 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -34,6 +34,7 @@ import org.joda.time.format.DateTimeFormatter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -63,6 +64,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxShopMapper wxShopMapper; + @Lazy @Autowired WxMerchantService wxMerchantService; @@ -87,15 +89,19 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxBrandMapper WxBrandMapper; + @Lazy @Autowired WxFlowRecordService wxFlowRecordService; + @Lazy @Autowired RuntimeService runtimeService; + @Lazy @Autowired private TaskService taskService; + @Lazy @Autowired private WxFlowService wxFlowService; @@ -108,12 +114,18 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxBillPropertyMapper wxBillPropertyMapper; + @Lazy @Autowired WxPropertyContractService wxPropertyContractService; + @Lazy @Autowired WxPayAccountBillService wxPayAccountBillService; + @Lazy + @Autowired + WxShopService wxShopService; + // @Override // public Map listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { // //Object rentContractStatusInfo = getRentContractStatusInfo(record); @@ -220,7 +232,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { WxShop record = new WxShop(); //record.setId(wxRentContract.getShopId()); record.setIds(wxRentContract.shopIdsByRentInfo()); - List> list = wxShopMapper.findListMap(record); + record.updateTenantInfo(wxRentContract); + PageInfo> shopPageInfo = wxShopService.findListMap(record,1,10000); + List> list = shopPageInfo.getList(); result.put("wxShops", list); } else { result.put("wxShops", Collections.EMPTY_LIST); @@ -1927,7 +1941,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { }else { WxShop record = new WxShop(); record.setIds(wxRentContract.shopIdsByRentInfo()); - List> wxShops = wxShopMapper.findListMap(record); + record.updateTenantInfo(wxRentContract); + PageInfo> shopPageInfo = wxShopService.findListMap(record,1,10000); + List> wxShops = shopPageInfo.getList(); if (!wxShops.isEmpty()) { //店铺信息 Map wxShop = wxShops.get(0); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java index d0d1a58c0..5c0bfca67 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java @@ -1,5 +1,26 @@ package com.iformall.service.impl; +import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -7,32 +28,30 @@ import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; +import com.iformall.domain.po.WxBrand; +import com.iformall.domain.po.WxBusiness; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantShop; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxShop; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxNotRentShopVo; import com.iformall.domain.vo.WxShopVo; -import com.iformall.enums.*; +import com.iformall.enums.EnumDelStatus; +import com.iformall.enums.EnumRentContractStatus; +import com.iformall.enums.EnumRentShopType; +import com.iformall.enums.EnumShopStatus; +import com.iformall.enums.EnumUserAdmin; +import com.iformall.mapper.WxMerchantMapper; import com.iformall.mapper.WxMerchantShopMapper; import com.iformall.mapper.WxRentContractMapper; import com.iformall.mapper.WxShopMapper; import com.iformall.service.ExcelService; +import com.iformall.service.WxBrandService; +import com.iformall.service.WxBusinessService; import com.iformall.service.WxMallBuildingService; import com.iformall.service.WxMallFloorService; import com.iformall.service.WxShopService; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.Serializable; -import java.util.*; @Service public class WxShopServiceImpl implements WxShopService { @@ -57,6 +76,17 @@ public class WxShopServiceImpl implements WxShopService { @Lazy @Autowired WxMallBuildingService wxMallBuildingService; + + @Autowired + WxMerchantMapper wxMerchantMapper; + + @Lazy + @Autowired + WxBusinessService wxBusinessService; + + @Lazy + @Autowired + WxBrandService wxBrandService; @Override public List selectList(QueryWrapper queryWrapper) { @@ -70,18 +100,7 @@ public class WxShopServiceImpl implements WxShopService { @Override public PageInfo> listMapAsPage(WxShop record, Integer pageIndex, Integer pageSize) { - PageHelper.startPage(pageIndex, pageSize); - List> shops = wxShopMapper.findListMap(record); - PageInfo> pageInfo = new PageInfo<>(shops); - return pageInfo; - } - - @Override - public PageInfo> notRentListMapAsPage(WxShop record, Integer pageIndex, Integer pageSize) { - PageHelper.startPage(pageIndex, pageSize); - List> shops = wxShopMapper.notRentListMapAsPage(record); - PageInfo> pageInfo = new PageInfo<>(shops); - return pageInfo; + return findListMap(record, pageIndex, pageSize); } @Override @@ -89,11 +108,216 @@ public class WxShopServiceImpl implements WxShopService { return wxShopMapper.selectById(id); } - public List getByIds(Collection ids) { + private Map getFloorMap(TenantEntity tenantEntity) { + return wxMallFloorService.getFloorMap(tenantEntity); + } + + private Map getBuildingMap(TenantEntity tenantEntity) { + return wxMallBuildingService.getBuildingMap(tenantEntity); + } + + private Map getBussinessMap() { + return wxBusinessService.findAllMap(); + } + + private Map getBrandMap(TenantEntity tenantEntity) { + return wxBrandService.getAllMap(tenantEntity); + } + + @Override + public List getByIds(TenantEntity tenantEntity,Collection ids) { if(CollectionUtils.isEmpty(ids)) { return new ArrayList<>() ; } - return wxShopMapper.selectBatchByIds((List) ids) ; + Map floorMap = getFloorMap(tenantEntity); + Map buildingMap = getBuildingMap(tenantEntity); + List shopList = wxShopMapper.selectBatchByIds((List) ids) ; + if (null != shopList) { + for (int i = 0 ; i < shopList.size(); i ++) { + WxShop shop = shopList.get(i); + if (null != shop) { + if (null != shop.getBuilding()) { + shop.setBuildingName(buildingMap.get(shop.getBuilding())); + } + if (null != shop.getFloor()) { + shop.setFloorName(floorMap.get(shop.getFloor())); + } + } + } + } + return shopList; + } + + @Override + public PageInfo> notRentListMapAsPage(WxShop record,Integer pageIndex,Integer pageSize) { + Map floorMap = getFloorMap(record); + Map buildingMap = getBuildingMap(record); + PageInfo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopMapper.notRentListMapAsPage(record)); + List> shopList = pageInfo.getList(); + if (null != shopList) { + for (int i = 0 ; i < shopList.size(); i ++) { + Map shop = shopList.get(i); + if (null != shop) { + Long building = (Long)shop.get("buildingId"); + if (null != building) { + shop.put("building", buildingMap.get(building)); + } + Long floor = (Long)shop.get("floorId"); + if (null != floor) { + shop.put("floor", floorMap.get(floor)); + } + } + } + } + return pageInfo; + } + + private Map getMerchantMap(TenantEntity tenantEntity,List merchantIds,Map merchantMap) { + if (null == merchantMap) { + merchantMap = new HashMap(); + } + if (null != merchantIds && merchantIds.size() > 0 ) { + WxMerchant merchantQ = new WxMerchant(); + merchantQ.updateTenantInfo(tenantEntity); + merchantQ.setIds(merchantIds); + List merchantList = wxMerchantMapper.findList(merchantQ); + if (null != merchantList && merchantList.size() > 0 ) { + for (int i = 0 ; i < merchantList.size() ; i ++) { + WxMerchant m = merchantList.get(i); + if (null != m) { + merchantMap.put(m.getId(), m); + } + } + } + } + return merchantMap; + } + + private void initShopMerchantMap(WxShop record,Map shopMerchantIdMap,Map merchantMap) { + WxMerchantShop merchantShopQ = new WxMerchantShop(); + merchantShopQ.updateTenantInfo(record); + merchantShopQ.setShopId(record.getId()); + merchantShopQ.setShopIdList(record.getIds()); + merchantShopQ.setIsDel(0); + List merchantShopList = wxMerchantShopMapper.findList(merchantShopQ); + if (null != merchantShopList && merchantShopList.size() > 0) { + List merchantIds = new ArrayList(); + + for (int i = 0 ;i < merchantShopList.size() ; i ++) { + WxMerchantShop ms = merchantShopList.get(i); + if (null != ms ) { + if (!merchantIds.contains(ms.getId())) { + merchantIds.add(ms.getId()); + } + if (null != ms.getShopId() && null != ms.getMerchantId()) { + shopMerchantIdMap.put(ms.getShopId(), ms.getMerchantId()); + } + } + } + merchantMap = getMerchantMap(record,merchantIds,merchantMap); + } + } + + @Override + public PageInfo> findListMap(WxShop record,Integer pageIndex,Integer pageSize) { + Map floorMap = getFloorMap(record); + Map buildingMap = getBuildingMap(record); + + Map shopMerchantIdMap = new HashMap(); + Map merchantMap = new HashMap(); + initShopMerchantMap(record, shopMerchantIdMap, merchantMap); + + PageInfo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopMapper.findListMap(record)); + List> shopList = pageInfo.getList() ; + if (null != shopList) { + for (int i = 0 ; i < shopList.size(); i ++) { + Map shop = shopList.get(i); + if (null != shop) { + Long build = (Long)shop.get("buildingId"); + if (null != build) { + shop.put("building", buildingMap.get(build)); + } + Long floor = (Long)shop.get("floorId"); + if (null != floor) { + shop.put("floor", floorMap.get(floor)); + } + Long shopId = (Long)shop.get("id"); + if (null != shopId) { + Long merchantId = shopMerchantIdMap.get(shopId); + if (null != merchantId && null != merchantMap) { + WxMerchant m = merchantMap.get(merchantId); + if (null != m) { + shop.put("merchantName", m.getName()); + shop.put("merchantId", m.getId()); + shop.put("linkPerson", m.getLinkPerson()); + shop.put("linkPhone", m.getLinkPhone()); + } + } + } + } + } + } + return pageInfo; + } + + @Override + public List findListWithMerchantMap(WxShop record){ + List shopList = wxShopMapper.findListWithMerchantMap(record); + if (null == shopList) { + return null; + } + Map floorMap = this.getFloorMap(record); + Map buildingMap = this.getBuildingMap(record); + Map brandMap = this.getBrandMap(record); + Map businessMap = this.getBussinessMap(); + + Map shopMerchantIdMap = new HashMap(); + Map merchantMap = new HashMap(); + initShopMerchantMap(record, shopMerchantIdMap, merchantMap); + + List volist = new ArrayList(); + for (int i = 0 ; i < shopList.size() ; i ++) { + WxShop shop = shopList.get(i); + if (null != shop) { + WxShopVo vo = new WxShopVo(); + try { + BeanUtils.copyProperties(vo, shop); + vo.setBuildingName(buildingMap.get(vo.getBuilding())); + vo.setFloorName(floorMap.get(vo.getFloor())); + Long merchangId = shopMerchantIdMap.get(vo.getId()); + if (null != merchangId) { + WxMerchant merchant = merchantMap.get(merchangId); + if (null != merchant) { + vo.setMerchantId(merchant.getId()); + vo.setMerchantName(merchant.getName()); + vo.setLinkPhone(merchant.getLinkPhone()); + vo.setLinkPerson(merchant.getLinkPerson()); + if (null != merchant.getBrand()) { + WxBrand brand = brandMap.get(merchant.getBrand()); + if (null != brand) { + vo.setBrandName(brand.getName()); + } + } + if (null != merchant.getBusinessId()) { + WxBusiness business = businessMap.get(merchant.getBusinessId()); + if (null != business) { + vo.setBusiness(business.getTitle()); + } + } + } + } + volist.add(vo); + } catch (IllegalAccessException e) { + logger.error("WxShopVo error",e); + } catch (InvocationTargetException e) { + logger.error("WxShopVo error",e); + } + } + } + if (volist.size() <= 0 ) { + return null; + } + return volist; } @Override @@ -202,6 +426,37 @@ public class WxShopServiceImpl implements WxShopService { } params.put("shopId",shopId); Map map=wxShopMapper.getMerchantShopByShopId(params); + + Map shopMerchantIdMap = new HashMap(); + Map merchantMap = new HashMap(); + WxShop record = new WxShop(); + record.updateTenantInfo(tenantEntity); + Long sid = null; + if (!StringUtils.isBlank(shopId)) { + sid = Long.parseLong(shopId); + } + if (null != sid) { + record.setId(sid); + initShopMerchantMap(record, shopMerchantIdMap, merchantMap); + if (null != map) { + WxMerchant merchant = merchantMap.get(sid); + if (null != merchant) { + map.put("merchantName", merchant.getName()); + map.put("linkPerson", merchant.getLinkPerson()); + map.put("linkPhone", merchant.getLinkPhone()); + + WxRentContract rentContractQ = new WxRentContract(); + rentContractQ.updateTenantInfo(tenantEntity); + rentContractQ.setMerchantId(merchant.getId()); + List rentList = wxRentContractMapper.findList(rentContractQ); + if (null != rentList && rentList.size() > 0 ) { + WxRentContract rc = rentList.get(0); + map.put("price", rc.getPrice()); + map.put("receivePeriod", rc.getReceivePeriod()); + } + } + } + } return new ResultData(ResultData.SUCCESS,"",map); } @@ -221,13 +476,78 @@ public class WxShopServiceImpl implements WxShopService { public PageInfo> listShopFromContract(WxShop wxShop, Integer pageIndex, Integer pageSize) { PageHelper.startPage(pageIndex, pageSize); List> shops = wxShopMapper.listShopFromContract(wxShop); + if (null != shops) { + Map floorMap = this.getFloorMap(wxShop); + Map buildingMap = this.getBuildingMap(wxShop); + Map shopMerchantIdMap = new HashMap(); + Map merchantMap = new HashMap(); + initShopMerchantMap(wxShop, shopMerchantIdMap, merchantMap); + for (int i = 0 ; i shop = shops.get(i); + if (null != shop) { + Long buildId = (Long)shop.get("buildingId"); + if (null != buildId) { + shop.put("building", buildingMap.get(buildId)); + } + Long floorId = (Long)shop.get("floorId"); + if (null != floorId) { + shop.put("floor", floorMap.get(floorId)); + } + + Long id = (Long)shop.get("id"); + Long merchantId = shopMerchantIdMap.get(id); + if (null != merchantId) { + WxMerchant m = merchantMap.get(merchantId); + if (null != m) { + shop.put("merchantName", m.getName()); + shop.put("merchantId", m.getId()); + shop.put("linkPerson", m.getLinkPerson()); + shop.put("linkPhone", m.getLinkPhone()); + shop.put("brand", m.getBrand()); + shop.put("businessId", m.getBusinessId()); + shop.put("shopType", m.getShopType()); + } + } + } + } + } + + PageInfo> pageInfo = new PageInfo<>(shops); return pageInfo; } + @Override + public List> rentRateHistory(TenantEntity tenantEntity,Map params){ + String building = StringUtils.trimToNull((String)params.get("building")); + String floor = StringUtils.trimToNull((String)params.get("floor")); + String businessId = StringUtils.trimToNull((String)params.get("businessId")); + if ((!StringUtils.isBlank(building)) || (!StringUtils.isBlank(floor)) || (!StringUtils.isBlank(businessId))) { + WxShop shopQ = new WxShop(); + shopQ.updateTenantInfo(tenantEntity); + if (null != building) { + shopQ.setBuilding(Long.parseLong(building)); + } + if (null != floor) { + shopQ.setFloor(Long.parseLong(floor)); + } + if (null != businessId) { + shopQ.setBusinessId(Integer.parseInt(businessId)); + if (shopQ.getBusinessId() == 0 ) { + shopQ.setBusinessId(null); + } + } + List shopIds = wxShopMapper.findIdList(shopQ); + if(null != shopIds && shopIds.size() > 0 ) { + params.put("shopIds", shopIds); + } + } + return wxMerchantShopMapper.rentRateHistory(params); + } + @Override public void exportShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) { - List list = wxShopMapper.findListWithMerchantMap(wxShop); + List list = findListWithMerchantMap(wxShop); String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表"; excelService.exportExcel(list, null, name, WxShopVo.class, name + ".xlsx", response, false); } @@ -235,29 +555,54 @@ public class WxShopServiceImpl implements WxShopService { @Override public void exportNotRentShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) { wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); - List> shops = wxShopMapper.notRentListMapAsPage(wxShop); + PageInfo> pageInfo = notRentListMapAsPage(wxShop,1,10000); + List> shops = pageInfo.getList(); List notRentShopVoList = new ArrayList<>(); - for (Map m:shops) { - WxNotRentShopVo notRentShopVo = new WxNotRentShopVo(); - notRentShopVo.setBuildArea(((Long)m.get("buildArea")).toString()); - notRentShopVo.setBuilding(((String)m.get("building"))); - notRentShopVo.setFloor((String)m.get("floor")); - notRentShopVo.setFreeDay((Long) m.get("freeDay")); - notRentShopVo.setOperationArea(((Long) m.get("operationArea")).toString()); - Integer point = (Integer) m.get("type"); - if(point != null){ - notRentShopVo.setPointType(EnumRentShopType.getEnum(point).getMessage()); - } - notRentShopVo.setShopNumber((String) m.get("shopNumber")); - notRentShopVoList.add(notRentShopVo); + if ( null != shops) { + for (Map m:shops) { + WxNotRentShopVo notRentShopVo = new WxNotRentShopVo(); + notRentShopVo.setBuildArea(((Long)m.get("buildArea")).toString()); + notRentShopVo.setBuilding(((String)m.get("building"))); + notRentShopVo.setFloor((String)m.get("floor")); + notRentShopVo.setFreeDay((Long) m.get("freeDay")); + notRentShopVo.setOperationArea(((Long) m.get("operationArea")).toString()); + Integer point = (Integer) m.get("type"); + if(point != null){ + notRentShopVo.setPointType(EnumRentShopType.getEnum(point).getMessage()); + } + notRentShopVo.setShopNumber((String) m.get("shopNumber")); + notRentShopVoList.add(notRentShopVo); + } } String name = "未出租商铺列表"; excelService.exportExcel(notRentShopVoList, null, name, WxNotRentShopVo.class, name + ".xlsx", response, false); } @Override - public Map detailById(Long id) { - return wxShopMapper.detailById(id); + public Map detailById(TenantEntity tenantEntity,Long id) { + Map shop = wxShopMapper.detailById(id); + if (null == shop) { + return null; + } + Map buildMap = this.getBuildingMap(tenantEntity); + Map floorMap = this.getFloorMap(tenantEntity); + Map businessMap = this.getBussinessMap(); + Long build = (Long)shop.get("buildingId"); + if (null != build) { + shop.put("building", buildMap.get(build)); + } + Long floor = (Long)shop.get("floorId"); + if (null != floor) { + shop.put("floor", floorMap.get(floor)); + } + Integer businessId = (Integer)shop.get("businessId"); + if (null != businessId) { + WxBusiness business = businessMap.get(businessId); + if (null != business) { + shop.put("businessName", business.getTitle()); + } + } + return shop; } @Override @@ -267,15 +612,33 @@ public class WxShopServiceImpl implements WxShopService { wxShop.setSid(sid); List> shops = wxShopMapper.detailBySid(wxShop); if(shops != null && shops.size() > 0){ - return shops.get(0); + Map shop = shops.get(0); + Map buildMap = this.getBuildingMap(tenantInfo); + Map floorMap = this.getFloorMap(tenantInfo); + Map businessMap = this.getBussinessMap(); + Long build = (Long)shop.get("buildingId"); + if (null != build) { + shop.put("building", buildMap.get(build)); + } + Long floor = (Long)shop.get("floorId"); + if (null != floor) { + shop.put("floor", floorMap.get(floor)); + } + Integer businessId = (Integer)shop.get("businessId"); + if (null != businessId) { + WxBusiness business = businessMap.get(businessId); + if (null != business) { + shop.put("businessName", business.getTitle()); + } + } } return null; } @Override public Map> findMerchantShopVoListMap(TenantEntity tenantEntity, List merchantIds) { - Map floorMap = wxMallFloorService.getFloorMap(tenantEntity); - Map buildingMap = wxMallBuildingService.getBuildingMap(tenantEntity); + Map floorMap = getFloorMap(tenantEntity); + Map buildingMap = getBuildingMap(tenantEntity); List shopIds = wxMerchantShopMapper.findShopIds(merchantIds); List shopVoList = wxShopMapper.newFindShopVoList(tenantEntity.getTenantId(),shopIds); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java index 8ae58a192..59318a05e 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java @@ -2,6 +2,7 @@ package com.iformall.service.invest; import com.iformall.domain.dto.InvestDemandDto; import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.invest.InvestMessageEntity; import com.iformall.domain.po.invest.InvestTaskEntity; import com.iformall.domain.vo.invest.*; @@ -14,9 +15,9 @@ import java.util.Map; public interface InvestBizService { - InvestPageResult queryPageDemand(InvestDemandQuery params); + InvestPageResult queryPageDemand(TenantEntity tenantEntity,InvestDemandQuery params); - void exportCustomer(InvestDemandQuery params, HttpServletResponse response); + void exportCustomer(TenantEntity tenantEntity,InvestDemandQuery params, HttpServletResponse response); void exportCustomerTemplate(HttpServletResponse response); @@ -24,9 +25,9 @@ public interface InvestBizService { Map queryCustomerImportCount() ; - List queryCustomer(); + List queryCustomer(TenantEntity tenantEntity); - InvestPageResult queryPageTask(InvestTaskQuery params); + InvestPageResult queryPageTask(TenantEntity tenantEntity,InvestTaskQuery params); InvestPageResult queryPageFollowRecord(InvestFollowQuery params); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index 6cac49e00..0cd2cbbd5 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -15,6 +15,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.dto.InvestDemandDto; import com.iformall.domain.dto.InvestTaskDto; import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.invest.*; import com.iformall.domain.vo.WxShopVo; import com.iformall.domain.vo.invest.*; @@ -79,7 +80,7 @@ public class InvestBizServiceImpl implements InvestBizService { private String fmUploadDir; @Override - public InvestPageResult queryPageDemand(InvestDemandQuery params) { + public InvestPageResult queryPageDemand(TenantEntity tenantEntity,InvestDemandQuery params) { InvestPageResult investPage = new InvestPageResult<>(); InvestDemandDto queryParams = convert(params, this::doConvertDemand); InvestCustomerEntity customerParams = null; @@ -111,7 +112,7 @@ public class InvestBizServiceImpl implements InvestBizService { queryWrapperCustomer.orderByDesc(InvestCustomerEntity::getCreateDate); InvestPageResult customers = customerService.queryPage(buildPageQuery(params, null), queryWrapperCustomer); - List resultList = getTargeInfoList(demandList, customers.getRecords()); + List resultList = getTargeInfoList(tenantEntity,demandList, customers.getRecords()); BeanUtils.copyProperties(customers, investPage); investPage.setRecords(resultList); if (CollectionUtils.isEmpty(customers.getRecords())) { @@ -122,7 +123,7 @@ public class InvestBizServiceImpl implements InvestBizService { } @Override - public void exportCustomer(InvestDemandQuery params, HttpServletResponse response) { + public void exportCustomer(TenantEntity tenantEntity,InvestDemandQuery params, HttpServletResponse response) { InvestDemandDto queryParams = convert(params, this::doConvertDemand); InvestCustomerEntity customerParams = null; InvestDemandEntity demandParams = null; @@ -145,7 +146,7 @@ public class InvestBizServiceImpl implements InvestBizService { queryWrapperCustomer.orderByDesc(InvestCustomerEntity::getCreateDate); Collection customers = customerService.list(queryWrapperCustomer); if (CollectionUtils.isNotEmpty(customers)) { - List resultList = getCustomerVOList(demandList, customers); + List resultList = getCustomerVOList(tenantEntity,demandList, customers); excelService.exportExcel(resultList, null, "客户信息", InvestCustomerVo.class, "客户信息.xlsx", response, false); } } @@ -488,9 +489,9 @@ public class InvestBizServiceImpl implements InvestBizService { } @Override - public List queryCustomer() { + public List queryCustomer(TenantEntity tenantEntity) { List customerEntities = customerService.list(); - return getTargeInfoList(new ArrayList<>(), customerEntities); + return getTargeInfoList(tenantEntity,new ArrayList<>(), customerEntities); } private InvestDemandDto doConvertDemand(InvestDemandQuery params) { @@ -515,7 +516,7 @@ public class InvestBizServiceImpl implements InvestBizService { } @Override - public InvestPageResult queryPageTask(InvestTaskQuery params) { + public InvestPageResult queryPageTask(TenantEntity tenantEntity,InvestTaskQuery params) { InvestTaskDto queryParams = convert(params, this::doConvertTask); InvestTaskEntity taskParams = null; WxShop shopParams = null; @@ -547,7 +548,7 @@ public class InvestBizServiceImpl implements InvestBizService { Collection taskList = taskPage.getRecords(); //2、目标信息 - Collection shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId)); + Collection shops = shopService.getByIds(tenantEntity,getIds(taskList, InvestTaskEntity::getTargetId)); //3、商品合同信息 // Map shopContractMap = new HashMap<>(); // if (CollectionUtils.isNotEmpty(shops)) { @@ -886,6 +887,7 @@ public class InvestBizServiceImpl implements InvestBizService { if (Objects.nonNull(shop)) { WxShop shopMapQuery = new WxShop(); shopMapQuery.setIds(Arrays.asList(taskEntity.getTargetId())); + shopMapQuery.updateTenantInfo(shop); Collection> shopMap = shopService.listMapAsPage(shopMapQuery, 1, 10).getList(); for (Map stringObjectMap : shopMap) { Long shopId = Long.valueOf(String.valueOf(stringObjectMap.get("id"))); @@ -1257,11 +1259,11 @@ public class InvestBizServiceImpl implements InvestBizService { return ownerInfo; } - private List getCustomerVOList(List demandList, Collection customers) { + private List getCustomerVOList(TenantEntity tenantEntity,List demandList, Collection customers) { Map demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); //3、目标信息 - Collection shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); + Collection shops = shopService.getByIds(tenantEntity,getIds(demandList, InvestDemandEntity::getTargetId)); Map shopsMap = getMap(shops, WxShop::getId); //4、品牌 @@ -1282,14 +1284,14 @@ public class InvestBizServiceImpl implements InvestBizService { return resultList; } - private List getTargeInfoList(List demandList, Collection customers) { + private List getTargeInfoList(TenantEntity tenantEntity,List demandList, Collection customers) { Map demindsMap = new HashMap<>(); Map shopsMap = new HashMap<>(); Map usersMap = new HashMap<>(); if (CollectionUtils.isNotEmpty(demandList)) { demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); //3、目标信息 - Collection shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); + Collection shops = shopService.getByIds(tenantEntity,getIds(demandList, InvestDemandEntity::getTargetId)); shopsMap = getMap(shops, WxShop::getId); //5、用户 usersMap = getMap(userInfoService.getByIds(getIds(demandList, InvestDemandEntity::getOwner)), MallUserInfo::getId); diff --git a/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml index cafcd1872..1a23663f0 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml @@ -119,5 +119,32 @@ + + diff --git a/mallinkService/src/main/resources/mapper/WxShopMapper.xml b/mallinkService/src/main/resources/mapper/WxShopMapper.xml index e266df578..e0e4d3253 100644 --- a/mallinkService/src/main/resources/mapper/WxShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxShopMapper.xml @@ -158,12 +158,10 @@ 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,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId, - m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone, - s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,rent,rent_unit,s.business_id as - businessId,s.create_date create_date + 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.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 - left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0 - left join wx_merchant m on ms.merchant_id=m.id - left join wx_mall_building b on s.building=b.id - left join wx_mall_floor f on s.floor=f.id - where s.is_del=0 + where s.is_del=0 and s.`type` = #{type} @@ -280,19 +272,15 @@ order by ${sortColumns} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select - s.id as - id,s.shop_number,s.build_area,s.img_url,s.operation_area,s.status,s.manager,s.manager_phone,s.addr,s.type,s.point_type, - b.building_name,f.floor_name, - m.id merchantId,m.name merchantName,m.link_person,m.link_phone, - brand.name brandName, - bus.title business,s.create_date as create_date - from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0 - left join wx_merchant m on ms.merchant_id=m.id - left join wx_mall_building b on s.building=b.id - left join wx_mall_floor f on s.floor=f.id - left join wx_business bus on m.business_id = bus.id - left join wx_brand brand on m.brand = brand.id - where s.is_del=0 + s.id as id,s.shop_number,s.build_area,s.img_url,s.operation_area,s.status,s.manager,s.manager_phone,s.addr,s.type,s.point_type, + s.create_date,s.building,s.floor + from wx_shop s + where s.is_del=0 and s.`id` = #{id} @@ -477,9 +415,6 @@ order by ${sortColumns} - - - - select count(*) from wx_shop where shop_number=#{shopNumber} and `type`=#{type} + select count(1) from wx_shop where shop_number=#{shopNumber} and `type`=#{type} and is_del=0 and `tenant_id` = #{tenantId} @@ -591,7 +512,7 @@ - - update wx_shop set status = 0 where id in @@ -681,14 +572,10 @@ @@ -697,14 +584,10 @@ 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,b.building_name building,f.floor_name floor,s.manager,s.manager_phone managerPhone, - s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,rent,rent_unit, - s.business_id as businessId,bu.title businessName,s.create_date create_date - from wx_shop s - left join wx_mall_building b on s.building=b.id - left join wx_mall_floor f on s.floor=f.id - left join wx_business bu on s.business_id = bu.id - where s.`is_del` = 0 and s.`sid` = #{sid} + s.status,s.manager,s.manager_phone managerPhone,s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,s.rent,s.rent_unit, + s.business_id as businessId,s.create_date,s.building as buildingId,s.floor as floorId + + from wx_shop s where s.`is_del` = 0 and s.`sid` = #{sid} and s.`tenant_id` = #{tenantId} From c7833221f7f51e1786c75a4fd78803d679bb4468 Mon Sep 17 00:00:00 2001 From: winter Date: Thu, 20 Jan 2022 20:14:17 +0800 Subject: [PATCH 2/2] fix wxshop --- .../main/java/com/iformall/domain/po/WxShop.java | 5 ++++- .../com/iformall/mapper/WxRentContractMapper.java | 2 ++ .../iformall/service/impl/WxShopServiceImpl.java | 6 ++++++ .../main/resources/mapper/WxRentContractMapper.xml | 11 +++++++++++ .../src/main/resources/mapper/WxShopMapper.xml | 13 ++++--------- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java b/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java index 9a6746305..0d0ab01e1 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java @@ -12,6 +12,7 @@ import lombok.ToString; import java.math.BigDecimal; import java.util.Date; +import java.util.List; @TableName(value = "wx_shop") @Data @@ -20,7 +21,9 @@ import java.util.Date; public class WxShop extends TenantEntity { protected Long id; - + + @TableField(exist = false) + private List notInIdList; @TableField(exist = false) private Long rentContractId; diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java index 5723998a4..993d8982f 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java @@ -59,4 +59,6 @@ public interface WxRentContractMapper extends CommonMapper List> currentValidByMerchantId(WxRentContract rentContract); + List getUsedRentShopIds(WxRentContract wxRentContract); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java index 5c0bfca67..0a06d197a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java @@ -475,6 +475,12 @@ public class WxShopServiceImpl implements WxShopService { @Override public PageInfo> listShopFromContract(WxShop wxShop, Integer pageIndex, Integer pageSize) { PageHelper.startPage(pageIndex, pageSize); + WxRentContract wxRentContractQ = new WxRentContract(); + wxRentContractQ.updateTenantInfo(wxShop); + List usedShopIds = wxRentContractMapper.getUsedRentShopIds(wxRentContractQ); + if (null != usedShopIds && usedShopIds.size() > 0 ) { + wxShop.setNotInIdList(usedShopIds); + } List> shops = wxShopMapper.listShopFromContract(wxShop); if (null != shops) { Map floorMap = this.getFloorMap(wxShop); diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 0332d54ca..f2850e981 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -536,6 +536,17 @@ + + diff --git a/mallinkService/src/main/resources/mapper/WxShopMapper.xml b/mallinkService/src/main/resources/mapper/WxShopMapper.xml index e0e4d3253..c6c9d002f 100644 --- a/mallinkService/src/main/resources/mapper/WxShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxShopMapper.xml @@ -461,16 +461,11 @@ and s.`status` = #{status} - + and s.id not in( - SELECT shop_id FROM wx_rent_contract WHERE status in(1,2,3,4,8) - and rent_shop_type=2 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - + + #{notInIdItem} + )