| @@ -1,11 +1,15 @@ | |||||
| package com.iformall.controller.base; | package com.iformall.controller.base; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumUserDataRuleType; | |||||
| import com.iformall.service.WxUserDataRuleService; | |||||
| import com.iformall.shiro.UserSession; | import com.iformall.shiro.UserSession; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import org.apache.shiro.SecurityUtils; | import org.apache.shiro.SecurityUtils; | ||||
| import org.apache.shiro.session.Session; | import org.apache.shiro.session.Session; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.WebDataBinder; | import org.springframework.web.bind.WebDataBinder; | ||||
| import org.springframework.web.bind.annotation.InitBinder; | import org.springframework.web.bind.annotation.InitBinder; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| @@ -17,9 +21,13 @@ import java.beans.PropertyEditorSupport; | |||||
| import java.text.ParseException; | import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| @RestController | @RestController | ||||
| public class BaseController { | public class BaseController { | ||||
| @Autowired | |||||
| private WxUserDataRuleService wxUserDataRuleService; | |||||
| @InitBinder | @InitBinder | ||||
| public void InitBinder(WebDataBinder dataBinder) { | public void InitBinder(WebDataBinder dataBinder) { | ||||
| @@ -83,4 +91,13 @@ public class BaseController { | |||||
| String ipaddress = IPUtil.getIpAddr(request); | String ipaddress = IPUtil.getIpAddr(request); | ||||
| return ipaddress; | return ipaddress; | ||||
| } | } | ||||
| public WxUserDataRule getCurrentDataFloors() { | |||||
| WxUserDataRule byUserId = wxUserDataRuleService.findByUserId(getUser().getId()); | |||||
| //没有配置,默认是全部权限 | |||||
| if (byUserId != null && EnumUserDataRuleType.ALL.getCode().intValue() == byUserId.getType().intValue()) { | |||||
| return null; | |||||
| } | |||||
| return byUserId; | |||||
| } | |||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxMallBuilding; | import com.iformall.domain.po.WxMallBuilding; | ||||
| import com.iformall.domain.po.WxMallFloor; | import com.iformall.domain.po.WxMallFloor; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.service.WxMallBuildingService; | import com.iformall.service.WxMallBuildingService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.RedisCacheUtils; | import com.iformall.utils.RedisCacheUtils; | ||||
| @@ -32,13 +33,17 @@ public class WxMallBuildingController extends BaseController { | |||||
| @Qualifier("objectCommonRedisTemplate") | @Qualifier("objectCommonRedisTemplate") | ||||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | RedisTemplate<String, Object> objectCommonRedisTemplate; | ||||
| @UserDataRuleAnnotation("") | |||||
| @ApiOperation("获取楼层楼座数据") | @ApiOperation("获取楼层楼座数据") | ||||
| @GetMapping("getbuildingfloorlist") | @GetMapping("getbuildingfloorlist") | ||||
| @SystemControllerLog(description = "商城-楼座-获取楼层楼座数据") | @SystemControllerLog(description = "商城-楼座-获取楼层楼座数据") | ||||
| public ResultData getbuildingfloorlist(WxMallBuilding wxMallBuilding) { | public ResultData getbuildingfloorlist(WxMallBuilding wxMallBuilding) { | ||||
| wxMallBuilding.updateTenantInfo(getTenantInfo()); | wxMallBuilding.updateTenantInfo(getTenantInfo()); | ||||
| return wxMallBuildingService.getBuildingFloorList(wxMallBuilding); | |||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| if (null != dataRule) { | |||||
| wxMallBuilding.setFloorForRule(dataRule.getFloorIds()); | |||||
| wxMallBuilding.setBusinessForRule(dataRule.getBussinessIds()); | |||||
| } | |||||
| return wxMallBuildingService.getBuildingFloorList(wxMallBuilding,this.getUser()); | |||||
| } | } | ||||
| @ApiOperation("保存楼层楼座地图") | @ApiOperation("保存楼层楼座地图") | ||||
| @@ -13,6 +13,7 @@ import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.WxMerchantRelation; | import com.iformall.domain.po.WxMerchantRelation; | ||||
| import com.iformall.domain.po.WxPayAccount; | import com.iformall.domain.po.WxPayAccount; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | import com.iformall.domain.vo.WxMerchantTradeDetailVo; | ||||
| import com.iformall.domain.vo.WxMerchantTradeVo; | import com.iformall.domain.vo.WxMerchantTradeVo; | ||||
| @@ -62,7 +63,6 @@ public class WxMerchantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantRelationService wxMerchantRelationService; | private WxMerchantRelationService wxMerchantRelationService; | ||||
| @UserDataRuleAnnotation("merchant_list") | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("listVo") | @GetMapping("listVo") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -75,12 +75,16 @@ public class WxMerchantController extends BaseController { | |||||
| wxMerchant.updateTenantInfo(getTenantInfo()); | wxMerchant.updateTenantInfo(getTenantInfo()); | ||||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | ||||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | ||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| if (null != dataRule) { | |||||
| wxMerchant.setFloorForRule(dataRule.getFloorIds()); | |||||
| wxMerchant.setBusinessForRule(dataRule.getBussinessIds()); | |||||
| } | |||||
| final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); | final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @UserDataRuleAnnotation("merchant_list") | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("listVo2") | @GetMapping("listVo2") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -98,6 +102,11 @@ public class WxMerchantController extends BaseController { | |||||
| }else { | }else { | ||||
| wxMerchant.setNoCarVendor(1); | wxMerchant.setNoCarVendor(1); | ||||
| } | } | ||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| if (null != dataRule) { | |||||
| wxMerchant.setFloorForRule(dataRule.getFloorIds()); | |||||
| wxMerchant.setBusinessForRule(dataRule.getBussinessIds()); | |||||
| } | |||||
| final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); | final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -675,7 +675,7 @@ public class WxProjectConfigController extends BaseController { | |||||
| WxMallBuilding b = new WxMallBuilding(); | WxMallBuilding b = new WxMallBuilding(); | ||||
| b.updateTenantInfo(tenantEntity); | b.updateTenantInfo(tenantEntity); | ||||
| ResultData wxMallBuildingFloorList = wxMallBuildingService.getBuildingFloorList(b); | |||||
| ResultData wxMallBuildingFloorList = wxMallBuildingService.getBuildingFloorList(b,null); | |||||
| map.put("wxMallBuildingFloorList",wxMallBuildingFloorList.data); | map.put("wxMallBuildingFloorList",wxMallBuildingFloorList.data); | ||||
| WxAppinfo wxAppinfo = new WxAppinfo(); | WxAppinfo wxAppinfo = new WxAppinfo(); | ||||
| wxAppinfo.setTenantId(wxMall.getTenantId()); | wxAppinfo.setTenantId(wxMall.getTenantId()); | ||||
| @@ -6,6 +6,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxBusiness; | import com.iformall.domain.po.WxBusiness; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxBusinessDataVo; | import com.iformall.domain.vo.WxBusinessDataVo; | ||||
| import com.iformall.enums.EnumMerchantAdmin; | import com.iformall.enums.EnumMerchantAdmin; | ||||
| @@ -45,13 +46,16 @@ public class WxBusinessController extends BaseController { | |||||
| private WxMerchantService wxMerchantService; | private WxMerchantService wxMerchantService; | ||||
| @ApiOperation("业态全列表接口") | @ApiOperation("业态全列表接口") | ||||
| @GetMapping("listAll") | @GetMapping("listAll") | ||||
| @SystemControllerLog(description = "业态-全列表") | @SystemControllerLog(description = "业态-全列表") | ||||
| public ResultData listAll() { | public ResultData listAll() { | ||||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(true,getTenantInfo(),null,null); | |||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| String bussinessRule = null; | |||||
| if (null != dataRule) { | |||||
| bussinessRule = dataRule.getBussinessIds(); | |||||
| } | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(bussinessRule,true,getTenantInfo(),null,null); | |||||
| return new ResultData(busList); | return new ResultData(busList); | ||||
| } | } | ||||
| @@ -9,12 +9,16 @@ import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxUserDataRule; | import com.iformall.domain.po.WxUserDataRule; | ||||
| import com.iformall.enums.EnumUserAdmin; | import com.iformall.enums.EnumUserAdmin; | ||||
| import com.iformall.service.WxUserDataRuleService; | import com.iformall.service.WxUserDataRuleService; | ||||
| import com.iformall.service.util.UserDateRuleCacheUtils; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| 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.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| /** | /** | ||||
| @@ -28,6 +32,10 @@ public class WxUserDataRuleController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxUserDataRuleService wxUserDataRuleService; | private WxUserDataRuleService wxUserDataRuleService; | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||||
| @ApiOperation("编辑") | @ApiOperation("编辑") | ||||
| @PostMapping("/modify") | @PostMapping("/modify") | ||||
| @@ -40,6 +48,7 @@ public class WxUserDataRuleController extends BaseController { | |||||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "系统管理员才能修改信息"); | return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "系统管理员才能修改信息"); | ||||
| } | } | ||||
| wxUserDataRuleService.modify(wxUserDataRule); | wxUserDataRuleService.modify(wxUserDataRule); | ||||
| UserDateRuleCacheUtils.removeMallBuildingCache(objectCommonRedisTemplate, wxUserDataRule.getUserId()); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -32,7 +32,7 @@ public class WxBusinessController extends BaseController { | |||||
| if(appPlat == null){ | if(appPlat == null){ | ||||
| appPlat = EnumAppPlat.WX; | appPlat = EnumAppPlat.WX; | ||||
| } | } | ||||
| return new ResultData(wxBusinessService.findListAll(true,getTenantInfo(),filter,appPlat.getCode())); | |||||
| return new ResultData(wxBusinessService.findListAll(null,true,getTenantInfo(),filter,appPlat.getCode())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -24,6 +24,6 @@ public class WxMallBuildingController extends BaseController { | |||||
| public ResultData getbuildingfloorlist() { | public ResultData getbuildingfloorlist() { | ||||
| WxMallBuilding b = new WxMallBuilding(); | WxMallBuilding b = new WxMallBuilding(); | ||||
| b.updateTenantInfo(getTenantInfo()); | b.updateTenantInfo(getTenantInfo()); | ||||
| return wxMallBuildingService.getBuildingFloorList(b); | |||||
| return wxMallBuildingService.getBuildingFloorList(b,null); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,11 +1,15 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| @TableName(value = "wx_user_data_rule") | @TableName(value = "wx_user_data_rule") | ||||
| @Data | @Data | ||||
| @@ -28,5 +32,21 @@ public class WxUserDataRule extends TenantEntity { | |||||
| private Date createTime; | private Date createTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") | @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") | ||||
| private Date updateTime; | private Date updateTime; | ||||
| public String getFloorIds() { | |||||
| if (StringUtils.isNotEmpty(buildingFloor)) { | |||||
| Object[] data = JSONArray.parseArray(buildingFloor).toArray(); | |||||
| return StringUtils.join(data, ","); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public String getBussinessIds() { | |||||
| if (StringUtils.isNotEmpty(businessForRule)) { | |||||
| Object[] data = JSONArray.parseArray(businessForRule).toArray(); | |||||
| return StringUtils.join(data, ","); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
| @@ -14,4 +14,6 @@ public interface WxMallFloorMapper extends CommonMapper<WxMallFloor, String> { | |||||
| void deleteByTenantId(String tenantId); | void deleteByTenantId(String tenantId); | ||||
| List<WxMallFloor> findIdAndName(String tenantId); | List<WxMallFloor> findIdAndName(String tenantId); | ||||
| List<Long> getBuildindIds(WxMallFloor wxMallFloor); | |||||
| } | } | ||||
| @@ -44,7 +44,7 @@ public interface WxBusinessService { | |||||
| * | * | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| List<WxBusiness> findListAll(boolean isValid,TenantEntity tenantEntity, Integer filter,Integer platCode); | |||||
| List<WxBusiness> findListAll(String bussinessRule,boolean isValid,TenantEntity tenantEntity, Integer filter,Integer platCode); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxMallBuildingFloorDto; | import com.iformall.domain.dto.WxMallBuildingFloorDto; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxMallBuilding; | import com.iformall.domain.po.WxMallBuilding; | ||||
| import com.iformall.domain.po.WxMallFloor; | import com.iformall.domain.po.WxMallFloor; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| @@ -54,7 +55,7 @@ public interface WxMallBuildingService { | |||||
| ResultData getBuildingList(TenantEntity tenantEntity); | ResultData getBuildingList(TenantEntity tenantEntity); | ||||
| ResultData getBuildingFloorList(WxMallBuilding wxMallBuilding); | |||||
| ResultData getBuildingFloorList(WxMallBuilding wxMallBuilding,MallUserInfo mallUser); | |||||
| /** | /** | ||||
| * 新增楼层楼座 | * 新增楼层楼座 | ||||
| @@ -73,10 +73,13 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxBusiness> findListAll(boolean isValid,TenantEntity tenantEntity, Integer filter,Integer paltCode) { | |||||
| public List<WxBusiness> findListAll(String bussinessRule,boolean isValid,TenantEntity tenantEntity, Integer filter,Integer paltCode) { | |||||
| WxBusiness bq = new WxBusiness(); | WxBusiness bq = new WxBusiness(); | ||||
| bq.setFinalTenantId(tenantEntity.getFinalTenantId()); | bq.setFinalTenantId(tenantEntity.getFinalTenantId()); | ||||
| bq.setIsRoot(EnumYesOrNo.YES.getCode()); | bq.setIsRoot(EnumYesOrNo.YES.getCode()); | ||||
| if (null != bussinessRule) { | |||||
| bq.setBusinessForRule(bussinessRule); | |||||
| } | |||||
| Integer isDel = null; | Integer isDel = null; | ||||
| if (isValid) { | if (isValid) { | ||||
| isDel = EnumYesOrNo.NO.getCode(); | isDel = EnumYesOrNo.NO.getCode(); | ||||
| @@ -734,7 +734,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(true,tenantEntity,null,null); | |||||
| List <WxBusiness> businessList = wxBusinessService.findListAll(null,true,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()) { | ||||
| @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxMallBuildingFloorDto; | import com.iformall.domain.dto.WxMallBuildingFloorDto; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.domain.po.WxMallBuilding; | import com.iformall.domain.po.WxMallBuilding; | ||||
| import com.iformall.domain.po.WxMallFloor; | import com.iformall.domain.po.WxMallFloor; | ||||
| @@ -15,6 +16,7 @@ import com.iformall.mapper.WxMallBuildingMapper; | |||||
| import com.iformall.mapper.WxMallFloorMapper; | import com.iformall.mapper.WxMallFloorMapper; | ||||
| import com.iformall.service.WxMallBuildingService; | import com.iformall.service.WxMallBuildingService; | ||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| import com.iformall.service.util.UserDateRuleCacheUtils; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.RedisCacheUtils; | import com.iformall.utils.RedisCacheUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -118,13 +120,28 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData getBuildingFloorList(WxMallBuilding wxMallBuilding) { | |||||
| String key = Constant.mallBuildingPrev + wxMallBuilding.getTenantId(); | |||||
| List<WxMallBuilding> wxMallBuildings = RedisCacheUtils.getCacheListObject(objectCommonRedisTemplate, key, WxMallBuilding.class); | |||||
| if(wxMallBuildings != null){ | |||||
| public ResultData getBuildingFloorList(WxMallBuilding wxMallBuilding,MallUserInfo mallUser) { | |||||
| List<WxMallBuilding> wxMallBuildings = null; | |||||
| if (null != mallUser) { | |||||
| wxMallBuildings = UserDateRuleCacheUtils.getMallBuildingCache(objectCommonRedisTemplate, mallUser.getId()); | |||||
| }else { | |||||
| wxMallBuildings = UserDateRuleCacheUtils.getMallBuildingCache(objectCommonRedisTemplate, Long.parseLong(wxMallBuilding.getTenantId())); | |||||
| } | |||||
| if(wxMallBuildings != null){ | |||||
| return new ResultData(wxMallBuildings); | return new ResultData(wxMallBuildings); | ||||
| } | } | ||||
| wxMallBuildings = new ArrayList<WxMallBuilding>(); | wxMallBuildings = new ArrayList<WxMallBuilding>(); | ||||
| if (null != mallUser && null != wxMallBuilding.getFloorForRule()) { | |||||
| WxMallFloor wf = new WxMallFloor(); | |||||
| wf.updateTenantInfo(mallUser); | |||||
| wf.setFloorForRule(wxMallBuilding.getFloorForRule()); | |||||
| List<Long> bids = wxMallFloorMapper.getBuildindIds(wf); | |||||
| if (null == bids || bids.size() <= 0 ) { | |||||
| wxMallBuilding.setId(-1L); | |||||
| }else { | |||||
| wxMallBuilding.setIds(bids); | |||||
| } | |||||
| } | |||||
| List<WxMallBuilding> buildings = wxMallBuildingMapper.findList(wxMallBuilding); | List<WxMallBuilding> buildings = wxMallBuildingMapper.findList(wxMallBuilding); | ||||
| wxMallBuildings = buildings.stream().map(b -> { | wxMallBuildings = buildings.stream().map(b -> { | ||||
| WxMallBuilding tempb = new WxMallBuilding(); | WxMallBuilding tempb = new WxMallBuilding(); | ||||
| @@ -157,7 +174,11 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||||
| }).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
| building.setFloors(wxMallFloors); | building.setFloors(wxMallFloors); | ||||
| } | } | ||||
| RedisCacheUtils.cache(objectCommonRedisTemplate, key, wxMallBuildings, Constant.EXPIRE); | |||||
| if (null != mallUser) { | |||||
| UserDateRuleCacheUtils.setMallBuildingCache(objectCommonRedisTemplate, mallUser.getId(), wxMallBuildings); | |||||
| }else { | |||||
| UserDateRuleCacheUtils.setMallBuildingCache(objectCommonRedisTemplate, Long.parseLong(wxMallBuilding.getTenantId()), wxMallBuildings); | |||||
| } | |||||
| return new ResultData(wxMallBuildings); | return new ResultData(wxMallBuildings); | ||||
| } | } | ||||
| @@ -2178,16 +2178,16 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| return wxMerchantMapper.findIdList(merchant); | return wxMerchantMapper.findIdList(merchant); | ||||
| } | } | ||||
| private WxShop initShopByPoiId(TenantEntity tenantEntity,String poiId) throws Exception { | |||||
| private WxShop initShopByPoiId(MallUserInfo user,String poiId) throws Exception { | |||||
| String shopNumber = "DYPOI-"+poiId; | String shopNumber = "DYPOI-"+poiId; | ||||
| WxShop shop = wxShopService.getShopByShopNumber(tenantEntity, shopNumber); | |||||
| WxShop shop = wxShopService.getShopByShopNumber(user, shopNumber); | |||||
| if (null == shop) { | if (null == shop) { | ||||
| Long buildingId = null; | Long buildingId = null; | ||||
| Long floorId = null; | Long floorId = null; | ||||
| try { | try { | ||||
| WxMallBuilding b = new WxMallBuilding(); | WxMallBuilding b = new WxMallBuilding(); | ||||
| b.updateTenantInfo(tenantEntity); | |||||
| ResultData builds = wxMallBuildingService.getBuildingFloorList(b); | |||||
| b.updateTenantInfo(user); | |||||
| ResultData builds = wxMallBuildingService.getBuildingFloorList(b,null); | |||||
| if (null == builds || null == builds.data) { | if (null == builds || null == builds.data) { | ||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"楼层楼座未查询到."); | throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"楼层楼座未查询到."); | ||||
| } | } | ||||
| @@ -2207,7 +2207,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"楼层楼座查询错误."+e.getMessage()); | throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"楼层楼座查询错误."+e.getMessage()); | ||||
| } | } | ||||
| shop = new WxShop(); | shop = new WxShop(); | ||||
| shop.updateTenantInfo(tenantEntity); | |||||
| shop.updateTenantInfo(user); | |||||
| shop.setBuildArea("0"); | shop.setBuildArea("0"); | ||||
| shop.setShopNumber(shopNumber); | shop.setShopNumber(shopNumber); | ||||
| shop.setBuilding(buildingId); | shop.setBuilding(buildingId); | ||||
| @@ -140,7 +140,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| // logger.info("mysql >> data"+JSONObject.toJSONString(currentBusinessRuleMap)); | // logger.info("mysql >> data"+JSONObject.toJSONString(currentBusinessRuleMap)); | ||||
| //根据业态来匹配 | //根据业态来匹配 | ||||
| Map<Integer,JSONObject> businessRuleMap = new HashMap<Integer,JSONObject>(); | Map<Integer,JSONObject> businessRuleMap = new HashMap<Integer,JSONObject>(); | ||||
| List<WxBusiness> rootBusiness = wxBusinessService.findListAll(true,tenantEntity, null, null); | |||||
| List<WxBusiness> rootBusiness = wxBusinessService.findListAll(null,true,tenantEntity, null, null); | |||||
| if (null != rootBusiness && rootBusiness.size() > 0 ) { | if (null != rootBusiness && rootBusiness.size() > 0 ) { | ||||
| for (int i = 0 ; i < rootBusiness.size(); i++){ | for (int i = 0 ; i < rootBusiness.size(); i++){ | ||||
| WxBusiness bu = rootBusiness.get(i); | WxBusiness bu = rootBusiness.get(i); | ||||
| @@ -0,0 +1,161 @@ | |||||
| package com.iformall.service.util; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.WxMallBuilding; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxMerchantVo; | |||||
| import com.iformall.enums.EnumCacheKey; | |||||
| import com.iformall.utils.RedisCacheUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public class UserDateRuleCacheUtils { | |||||
| public static void removeMallBuildingCache(RedisTemplate<String, Object> template,Long userId) { | |||||
| String key = "udmallBuilding:"+userId; | |||||
| RedisCacheUtils.removeCache(template, key); | |||||
| } | |||||
| public static void setMallBuildingCache(RedisTemplate<String, Object> template,Long userId,List<WxMallBuilding> wxMallBuildings) { | |||||
| String key = "udmallBuilding:"+userId; | |||||
| RedisCacheUtils.cache(template, key, wxMallBuildings, 24*3600); | |||||
| } | |||||
| public static List<WxMallBuilding> getMallBuildingCache(RedisTemplate<String, Object> template,Long userId) { | |||||
| String key = "udmallBuilding:"+userId; | |||||
| return RedisCacheUtils.getCacheListObject(template, key,WxMallBuilding.class); | |||||
| } | |||||
| public static void removeOnlyCouponCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| String key = "onlyCouponDetail:"+couponId; | |||||
| RedisCacheUtils.removeCache(template, key); | |||||
| } | |||||
| public static void setOnlyCouponCache(RedisTemplate<String, Object> template,Long couponId,WxCoupon coupon) { | |||||
| String key = "onlyCouponDetail:"+couponId; | |||||
| RedisCacheUtils.cache(template, key, coupon, 24*3600); | |||||
| } | |||||
| public static WxCoupon getOnlyCouponCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| String key = "onlyCouponDetail:"+couponId; | |||||
| return RedisCacheUtils.getCacheObject(template, key,WxCoupon.class); | |||||
| } | |||||
| public static void removeCouponCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| String key = "couponDetail:"+couponId; | |||||
| RedisCacheUtils.removeCache(template, key); | |||||
| } | |||||
| public static void setCouponCache(RedisTemplate<String, Object> template,Long couponId,WxCoupon coupon) { | |||||
| String key = "couponDetail:"+couponId; | |||||
| RedisCacheUtils.cache(template, key, coupon, 24*3600); | |||||
| } | |||||
| public static WxCoupon getCouponCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| String key = "couponDetail:"+couponId; | |||||
| return RedisCacheUtils.getCacheObject(template, key,WxCoupon.class); | |||||
| } | |||||
| public static void removeCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,String city) { | |||||
| String key = "couponMerchantNew:"+couponId; | |||||
| if (StringUtils.isNotBlank(city)) { | |||||
| key = key + ":"+city; | |||||
| } | |||||
| RedisCacheUtils.removeCache(template, key); | |||||
| if (StringUtils.isBlank(city)) { | |||||
| //删除下面所有的cityKey | |||||
| RedisCacheUtils.removeCachePrefix(template, key+":"); | |||||
| //删除labelMap | |||||
| removeCouponMerchantLableMapCache(template,couponId); | |||||
| } | |||||
| } | |||||
| public static void setCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,String city,Map<String,List<WxMerchantVo>> merchantList) { | |||||
| String key = "couponMerchantNew:"+couponId; | |||||
| if (StringUtils.isNotBlank(city)) { | |||||
| key = key + ":"+city; | |||||
| } | |||||
| RedisCacheUtils.cache(template, key, merchantList, 24*3600); | |||||
| if (StringUtils.isBlank(city)) { | |||||
| //删除下面所有的cityKey | |||||
| RedisCacheUtils.removeCachePrefix(template, key+":"); | |||||
| //删除labelMap | |||||
| removeCouponMerchantLableMapCache(template,couponId); | |||||
| } | |||||
| } | |||||
| public static Map<String,List<WxMerchantVo>> getCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,String city) { | |||||
| String key = "couponMerchantNew:"+couponId; | |||||
| if (StringUtils.isNotBlank(city)) { | |||||
| key = key + ":"+city; | |||||
| } | |||||
| return (Map<String, List<WxMerchantVo>>) RedisCacheUtils.getCacheMap(template, key); | |||||
| } | |||||
| public static void removeCouponMerchantLableMapCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| String key = "couponMerchantNewLableMap:"+couponId; | |||||
| RedisCacheUtils.removeCache(template, key); | |||||
| } | |||||
| public static void setCouponMerchantLableMapCache(RedisTemplate<String, Object> template,Long couponId,Map<String,List<String>> labeCityList) { | |||||
| String key = "couponMerchantNewLableMap:"+couponId; | |||||
| RedisCacheUtils.cache(template, key, labeCityList, 24*3600); | |||||
| } | |||||
| public static Map<String,List<String>> getCouponMerchantLableMapCache(RedisTemplate<String, Object> template,Long couponId) { | |||||
| String key = "couponMerchantNewLableMap:"+couponId; | |||||
| return (Map<String, List<String>>) RedisCacheUtils.getCacheMap(template, key); | |||||
| } | |||||
| public static void removeDouyinLivePageCache(RedisTemplate<String, Object> template,String tenantId,Integer targetAd,Integer bussiness) { | |||||
| String key = EnumCacheKey.DOUYIN_LIVE_PAGE_LIST.getMessage()+ tenantId+"_"; | |||||
| if (null != targetAd) { | |||||
| key = key + targetAd; | |||||
| if ( null != bussiness) { | |||||
| key = key + "_"+ bussiness; | |||||
| } | |||||
| } | |||||
| RedisCacheUtils.removeCachePrefix(template, key); | |||||
| } | |||||
| public static void setDouyinLivePageCache(RedisTemplate<String, Object> template,PageInfo<WxCoupon> pageList,String tenantId,Integer targetAd,Integer bussiness,Integer pageNum) { | |||||
| String key = EnumCacheKey.DOUYIN_LIVE_PAGE_LIST.getMessage()+ tenantId + "_"+ targetAd + "_"+ bussiness+"_"+pageNum; | |||||
| RedisCacheUtils.cache(template, key, pageList, 3*3600); | |||||
| } | |||||
| public static PageInfo getDouyinLivePageCache(RedisTemplate<String, Object> template,String tenantId,Integer targetAd,Integer bussiness,Integer pageNum) { | |||||
| String key = EnumCacheKey.DOUYIN_LIVE_PAGE_LIST.getMessage()+ tenantId + "_"+ targetAd + "_"+ bussiness+"_"+pageNum; | |||||
| return RedisCacheUtils.getCacheObject(template, key,PageInfo.class); | |||||
| } | |||||
| public static void removeOldDetailCache(RedisTemplate<String, Object> template) { | |||||
| String key = EnumCacheKey.OLD_DETAIL.getMessage(); | |||||
| RedisCacheUtils.removeCachePrefix(template, key); | |||||
| } | |||||
| public static void setOldDetaileCache(RedisTemplate<String, Object> template,WxCouponCVo coupon,Long couponChannelIdL,Long couponIdL) { | |||||
| String key = EnumCacheKey.OLD_DETAIL.getMessage(); | |||||
| if(couponChannelIdL > 0){ | |||||
| key = key + couponChannelIdL; | |||||
| }else if(couponIdL > 0){ | |||||
| key = key + couponIdL; | |||||
| } | |||||
| RedisCacheUtils.cache(template, key, coupon, 3600); | |||||
| } | |||||
| public static WxCouponCVo getOldDetailCache(RedisTemplate<String, Object> template,Long couponChannelIdL,Long couponIdL) { | |||||
| String key = EnumCacheKey.OLD_DETAIL.getMessage(); | |||||
| if(couponChannelIdL > 0){ | |||||
| key = key + couponChannelIdL; | |||||
| }else if(couponIdL > 0){ | |||||
| key = key + couponIdL; | |||||
| } | |||||
| return RedisCacheUtils.getCacheObject(template, key,WxCouponCVo.class); | |||||
| } | |||||
| } | |||||
| @@ -98,6 +98,9 @@ | |||||
| <if test=" null != isDel "> | <if test=" null != isDel "> | ||||
| and `is_del` = #{isDel} | and `is_del` = #{isDel} | ||||
| </if> | </if> | ||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and `id` in (${businessForRule}) | |||||
| </if> | |||||
| order by create_date asc | order by create_date asc | ||||
| </select> | </select> | ||||
| @@ -112,6 +115,9 @@ | |||||
| <if test=" null != isDel "> | <if test=" null != isDel "> | ||||
| and b.`is_del` = #{isDel} | and b.`is_del` = #{isDel} | ||||
| </if> | </if> | ||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and `id` in (${businessForRule}) | |||||
| </if> | |||||
| and | and | ||||
| (select count(*) from wx_merchant m | (select count(*) from wx_merchant m | ||||
| where b.id = m.business_id | where b.id = m.business_id | ||||
| @@ -137,6 +143,9 @@ | |||||
| <if test=" null != isDel "> | <if test=" null != isDel "> | ||||
| and b.`is_del` = #{isDel} | and b.`is_del` = #{isDel} | ||||
| </if> | </if> | ||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and `id` in (${businessForRule}) | |||||
| </if> | |||||
| and | and | ||||
| (select count(*) from wx_coupon_channel cc | (select count(*) from wx_coupon_channel cc | ||||
| where b.id = cc.business | where b.id = cc.business | ||||
| @@ -59,6 +59,11 @@ | |||||
| <if test=" null != updateDate "> | <if test=" null != updateDate "> | ||||
| and `update_date` = #{updateDate} | and `update_date` = #{updateDate} | ||||
| </if> | </if> | ||||
| <if test=" null != floorForRule and '' != floorForRule "> | |||||
| and `id` in (${floorForRule}) | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -90,5 +95,11 @@ | |||||
| from wx_mall_floor | from wx_mall_floor | ||||
| where `tenant_id` = #{tenantId} | where `tenant_id` = #{tenantId} | ||||
| </select> | </select> | ||||
| <select id="getBuildindIds" parameterType="com.iformall.domain.po.WxMallFloor" resultMap="Long"> | |||||
| select distinct building_id | |||||
| from wx_mall_floor | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -37,7 +37,7 @@ public class WxMallBuildingController extends BaseController { | |||||
| public ResultData getbuildingfloorlist() { | public ResultData getbuildingfloorlist() { | ||||
| WxMallBuilding b = new WxMallBuilding(); | WxMallBuilding b = new WxMallBuilding(); | ||||
| b.updateTenantInfo(getTenantInfo()); | b.updateTenantInfo(getTenantInfo()); | ||||
| return wxMallBuildingService.getBuildingFloorList(b); | |||||
| return wxMallBuildingService.getBuildingFloorList(b,this.getUser()); | |||||
| } | } | ||||
| @ApiOperation("保存楼层楼座地图") | @ApiOperation("保存楼层楼座地图") | ||||
| @@ -45,8 +45,7 @@ public class WxBusinessController extends BaseController { | |||||
| @GetMapping("listAll") | @GetMapping("listAll") | ||||
| @SystemControllerLog(description = "业态-全列表") | @SystemControllerLog(description = "业态-全列表") | ||||
| public ResultData listAll() { | public ResultData listAll() { | ||||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(true,getTenantInfo(),null,null); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(null,true,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(true,getTenantInfo(),filter,null)); | |||||
| return new ResultData(wxBusinessService.findListAll(null,true,getTenantInfo(),filter,null)); | |||||
| } | } | ||||
| } | } | ||||