| @@ -43,7 +43,7 @@ public class WxBusinessController extends BaseController { | |||||
| @SystemControllerLog(description = "业态-全列表") | @SystemControllerLog(description = "业态-全列表") | ||||
| public ResultData listAll() { | public ResultData listAll() { | ||||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | ||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantInfo(),null); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantInfo(),null,null); | |||||
| return new ResultData(busList); | return new ResultData(busList); | ||||
| } | } | ||||
| @@ -1,27 +1,22 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.RedisCache; | import com.iformall.annotation.RedisCache; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxBusiness; | |||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.enums.EnumAppPlat; | |||||
| import com.iformall.service.WxBusinessService; | import com.iformall.service.WxBusinessService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.List; | |||||
| import java.util.stream.Collectors; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/wxBusiness") | @RequestMapping("/api/wxBusiness") | ||||
| @Api(description = "业态查询接口") | @Api(description = "业态查询接口") | ||||
| public class WxBusinessController extends BaseController { | public class WxBusinessController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| @@ -31,7 +26,11 @@ public class WxBusinessController extends BaseController { | |||||
| @ApiOperation("业态全列表接口") | @ApiOperation("业态全列表接口") | ||||
| @GetMapping("listAll") | @GetMapping("listAll") | ||||
| public ResultData listAll(Integer filter) { | public ResultData listAll(Integer filter) { | ||||
| return new ResultData(wxBusinessService.findListAll(getTenantInfo(),filter)); | |||||
| EnumAppPlat appPlat = getCUser().getAppPlat(); | |||||
| if(appPlat == null){ | |||||
| appPlat = EnumAppPlat.WX; | |||||
| } | |||||
| return new ResultData(wxBusinessService.findListAll(getTenantInfo(),filter,appPlat.getCode())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -12,7 +12,7 @@ public interface WxBusinessMapper extends CommonMapper<WxBusiness, String> { | |||||
| List<WxBusiness> findListAll(); | List<WxBusiness> findListAll(); | ||||
| List<WxBusiness> findListForMerchant(@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId); | List<WxBusiness> findListForMerchant(@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId); | ||||
| List<WxBusiness> findListForCoupon(@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId); | |||||
| List<WxBusiness> findListForCoupon(@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId, @Param("platCode") Integer platCode); | |||||
| List<Map<String,Object>> businessDataList(WxBusiness wxBusiness); | List<Map<String,Object>> businessDataList(WxBusiness wxBusiness); | ||||
| @@ -35,7 +35,7 @@ public interface WxBusinessService { | |||||
| * | * | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| List<WxBusiness> findListAll(TenantEntity tenantEntity, Integer filter); | |||||
| List<WxBusiness> findListAll(TenantEntity tenantEntity, Integer filter,Integer platCode); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -50,15 +50,18 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxBusiness> findListAll(TenantEntity tenantEntity, Integer filter) { | |||||
| if (filter == null) | |||||
| public List<WxBusiness> findListAll(TenantEntity tenantEntity, Integer filter,Integer paltCode) { | |||||
| if (filter == null){ | |||||
| return wxBusinessMapper.findListAll(); | return wxBusinessMapper.findListAll(); | ||||
| else if (filter.equals(EnumBusinessFilter.FILTER_BY_COUPON.getCode())) | |||||
| return wxBusinessMapper.findListForCoupon(tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); | |||||
| else if (filter.equals(EnumBusinessFilter.FILTER_BY_MERCHANT.getCode())) | |||||
| }else if (filter.equals(EnumBusinessFilter.FILTER_BY_COUPON.getCode())) { | |||||
| if (paltCode == null) | |||||
| paltCode = EnumAppPlat.WX.getCode(); | |||||
| return wxBusinessMapper.findListForCoupon(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), paltCode); | |||||
| }else if (filter.equals(EnumBusinessFilter.FILTER_BY_MERCHANT.getCode())) { | |||||
| return wxBusinessMapper.findListForMerchant(tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); | return wxBusinessMapper.findListForMerchant(tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); | ||||
| else | |||||
| }else { | |||||
| return wxBusinessMapper.findListAll(); | return wxBusinessMapper.findListAll(); | ||||
| } | |||||
| } | } | ||||
| @@ -599,7 +599,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| kwMerchantMeterDataDto.setLimitCount(null); | kwMerchantMeterDataDto.setLimitCount(null); | ||||
| List <KwMerchantMeterDataVo> businessPower = kwMerchantMeterService.findDataVoList(kwMerchantMeterDataDto); | List <KwMerchantMeterDataVo> businessPower = kwMerchantMeterService.findDataVoList(kwMerchantMeterDataDto); | ||||
| List <WxBusiness> businessList = wxBusinessService.findListAll(tenantEntity,null); | |||||
| List <WxBusiness> businessList = wxBusinessService.findListAll(tenantEntity,null,null); | |||||
| businessList.stream().forEach(b->{ | businessList.stream().forEach(b->{ | ||||
| Optional<KwMerchantMeterDataVo> businessData = businessPower.stream().filter(bd->bd.getBusinessId().equals(b.getId())).findAny(); | Optional<KwMerchantMeterDataVo> businessData = businessPower.stream().filter(bd->bd.getBusinessId().equals(b.getId())).findAny(); | ||||
| if (businessData.isPresent()) { | if (businessData.isPresent()) { | ||||
| @@ -291,12 +291,13 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| @Override | @Override | ||||
| public List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel) { | public List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel) { | ||||
| List<WxCouponChannelVo> list = new ArrayList<>(); | |||||
| List<Long> mcids = new ArrayList<>(); | List<Long> mcids = new ArrayList<>(); | ||||
| if(wxCouponChannel.getMerchantId() != null){ | if(wxCouponChannel.getMerchantId() != null){ | ||||
| mcids = wxCouponMerchantMapper.findOneMerchantProductIds(wxCouponChannel.getTenantId(), wxCouponChannel.getMerchantId()); | mcids = wxCouponMerchantMapper.findOneMerchantProductIds(wxCouponChannel.getTenantId(), wxCouponChannel.getMerchantId()); | ||||
| if(mcids == null || mcids.isEmpty()){ | if(mcids == null || mcids.isEmpty()){ | ||||
| return null; | |||||
| return list; | |||||
| } | } | ||||
| } | } | ||||
| WxCoupon couponQ = new WxCoupon(); | WxCoupon couponQ = new WxCoupon(); | ||||
| @@ -312,15 +313,15 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| } | } | ||||
| List<Long> cids = wxCouponMapper.findIdList(couponQ); | List<Long> cids = wxCouponMapper.findIdList(couponQ); | ||||
| if(cids == null || cids.isEmpty()){ | if(cids == null || cids.isEmpty()){ | ||||
| return null; | |||||
| return list; | |||||
| } | } | ||||
| cids.retainAll(mcids); | cids.retainAll(mcids); | ||||
| if(cids.isEmpty()){ | if(cids.isEmpty()){ | ||||
| return null; | |||||
| return list; | |||||
| } | } | ||||
| wxCouponChannel.setCouponIds(cids); | wxCouponChannel.setCouponIds(cids); | ||||
| List<WxCouponChannelVo> list = wxCouponChannelMapper.newfindCList(wxCouponChannel); | |||||
| list = wxCouponChannelMapper.newfindCList(wxCouponChannel); | |||||
| List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | ||||
| Map<Long,WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds,wxCouponChannel); | Map<Long,WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds,wxCouponChannel); | ||||
| for (WxCouponChannelVo cc:list) { | for (WxCouponChannelVo cc:list) { | ||||
| @@ -83,14 +83,20 @@ | |||||
| where | where | ||||
| (select count(*) from wx_coupon_channel cc | (select count(*) from wx_coupon_channel cc | ||||
| where b.id = cc.business | where b.id = cc.business | ||||
| and cc.status = 0 | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and cc.`tenant_id` = #{tenantId} | and cc.`tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and cc.`parent_tenant_id` = #{parentTenantId} | and cc.`parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| and cc.status = 0 | |||||
| and cc.target_ad = 1) > 0 | |||||
| <if test=" null != platCode and platCode = 1"> | |||||
| and cc.target_ad = 1 | |||||
| </if> | |||||
| <if test=" null != platCode and platCode = 3"> | |||||
| and cc.target_ad = 101 | |||||
| </if> | |||||
| ) > 0 | |||||
| order by create_date asc | order by create_date asc | ||||
| </select> | </select> | ||||
| @@ -43,7 +43,7 @@ public class WxBusinessController extends BaseController { | |||||
| @SystemControllerLog(description = "业态-全列表") | @SystemControllerLog(description = "业态-全列表") | ||||
| public ResultData listAll() { | public ResultData listAll() { | ||||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | ||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantInfo(),null); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantInfo(),null,null); | |||||
| return new ResultData(busList); | return new ResultData(busList); | ||||
| } | } | ||||
| @@ -25,7 +25,7 @@ public class WxBusinessController extends BaseController { | |||||
| @ApiOperation("业态全列表接口") | @ApiOperation("业态全列表接口") | ||||
| @GetMapping("listAll") | @GetMapping("listAll") | ||||
| public ResultData listAll(Integer filter) { | public ResultData listAll(Integer filter) { | ||||
| return new ResultData(wxBusinessService.findListAll(getTenantInfo(),filter)); | |||||
| return new ResultData(wxBusinessService.findListAll(getTenantInfo(),filter,null)); | |||||
| } | } | ||||
| } | } | ||||