Commit 22ce39e1 by 徐高华

门店交集

parent f7df5e6a
...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.JSONResponse; import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.dto.PowerClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.PowerService; import com.gic.clerk.api.service.PowerService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -83,16 +82,12 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -83,16 +82,12 @@ public class StaffApiServiceImpl implements StaffApiService {
private StoreGroupService storeGroupService; private StoreGroupService storeGroupService;
@Autowired @Autowired
private UserLoginLogService userLoginLogService; private UserLoginLogService userLoginLogService;
@Autowired @Autowired
private SyncErrorLogService syncErrorLogService; private SyncErrorLogService syncErrorLogService;
@Autowired @Autowired
private QQCloudPicService qqCloudPicService; private QQCloudPicService qqCloudPicService;
@Autowired @Autowired
private StaffClerkRelationService staffClerkRelationService; private StaffClerkRelationService staffClerkRelationService;
@Autowired @Autowired
private SecretSettingService secretSettingService; private SecretSettingService secretSettingService;
@Autowired @Autowired
...@@ -106,8 +101,6 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -106,8 +101,6 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired @Autowired
private StoreRangeService storeRangeService; private StoreRangeService storeRangeService;
@Autowired @Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper;
@Autowired
private EnterpriseService enterpriseService; private EnterpriseService enterpriseService;
@Override @Override
...@@ -1304,22 +1297,35 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1304,22 +1297,35 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public List<String> getHaoBanStoreRolesByClerkId(String clerkId, String wxEnterpriseId) { public List<String> getHaoBanStoreRolesByClerkId(String clerkId, String wxEnterpriseId) {
if(StringUtils.isBlank(clerkId) || StringUtils.isBlank(wxEnterpriseId)) {
logger.info("参数为空clerkId={},wxEid={}", clerkId,wxEnterpriseId);
return Collections.emptyList();
}
String cacheKey = "hb:clerk:store:"+clerkId +wxEnterpriseId;
Object cache = RedisUtil.getCache(cacheKey) ;
if (cache != null) {
logger.info("从缓存中获取通道={},{}", cacheKey,JSON.toJSONString(cache));
return (List<String>) cache;
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (clerkDTO == null) { if (clerkDTO == null) {
logger.info("导购不存在:clerkId:{}", clerkId); logger.info("导购不存在:clerkId:{}", clerkId);
return Collections.emptyList(); return Collections.emptyList();
} }
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId, clerkDTO.getEnterpriseId()); List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId, clerkDTO.getEnterpriseId());
if (CollectionUtils.isNotEmpty(enterpriseIdStoreIds)) { if(CollectionUtils.isEmpty(enterpriseIdStoreIds)) {
logger.info("好办门店id数量:{}", enterpriseIdStoreIds.size()); logger.info("好办门店空,eid={}", clerkDTO.getEnterpriseId());
return Collections.emptyList();
} }
List<String> gicStoreIds = getStoreIdList(clerkId); logger.info("好办门店id数量:{}", enterpriseIdStoreIds.size());
List<String> gicStoreIds = getStoreIdList(clerkDTO);
if (CollectionUtils.isEmpty(gicStoreIds)) { if (CollectionUtils.isEmpty(gicStoreIds)) {
logger.info("gic门店为空"); logger.info("gic门店为空");
return Collections.emptyList(); return Collections.emptyList();
} }
if (gicStoreIds.contains("-1")) { if (gicStoreIds.contains("-1")) {
//gic管理员返回好办企业 //gic管理员返回好办企业
RedisUtil.setCache(cacheKey, enterpriseIdStoreIds , 10L ,TimeUnit.MINUTES);
return enterpriseIdStoreIds; return enterpriseIdStoreIds;
} }
logger.info("gic门店数量:{}", gicStoreIds.size()); logger.info("gic门店数量:{}", gicStoreIds.size());
...@@ -1327,6 +1333,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1327,6 +1333,7 @@ public class StaffApiServiceImpl implements StaffApiService {
Sets.SetView<String> intersection = Sets.intersection(Sets.newHashSet(enterpriseIdStoreIds), Sets.newHashSet(gicStoreIds)); Sets.SetView<String> intersection = Sets.intersection(Sets.newHashSet(enterpriseIdStoreIds), Sets.newHashSet(gicStoreIds));
List<String> storeList = intersection.stream().collect(Collectors.toList()); List<String> storeList = intersection.stream().collect(Collectors.toList());
logger.info("该导购权限:clerkId:{},门店数量:{}", clerkId, storeList.size()); logger.info("该导购权限:clerkId:{},门店数量:{}", clerkId, storeList.size());
RedisUtil.setCache(cacheKey, storeList , 10L ,TimeUnit.MINUTES);
return storeList; return storeList;
} }
...@@ -1367,12 +1374,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1367,12 +1374,8 @@ public class StaffApiServiceImpl implements StaffApiService {
* @author mozhu * @author mozhu
* @date 2022-05-06 16:00:05 * @date 2022-05-06 16:00:05
*/ */
private List<String> getStoreIdList(String clerkId) { private List<String> getStoreIdList(ClerkDTO clerkDTO) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); String clerkId = clerkDTO.getClerkId() ;
if (clerkDTO == null) {
logger.info("导购不存在");
return Collections.emptyList();
}
Integer superAdmin = clerkDTO.getSuperAdmin(); Integer superAdmin = clerkDTO.getSuperAdmin();
if (superAdmin != null && superAdmin == 1) { if (superAdmin != null && superAdmin == 1) {
logger.info("gic超管,clerkId:{}", clerkId); logger.info("gic超管,clerkId:{}", clerkId);
...@@ -1382,12 +1385,11 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1382,12 +1385,11 @@ public class StaffApiServiceImpl implements StaffApiService {
String enterpriseId = clerkDTO.getEnterpriseId(); String enterpriseId = clerkDTO.getEnterpriseId();
EnterpriseSettingDTO enterpriseSetting = enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId); EnterpriseSettingDTO enterpriseSetting = enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId);
if (enterpriseSetting.getEnableAccessControl() != null && enterpriseSetting.getEnableAccessControl() == 1) { if (enterpriseSetting.getEnableAccessControl() != null && enterpriseSetting.getEnableAccessControl() == 1) {
PowerClerkDTO clerkDetail = powerService.getClerkDetail(clerkId); String storeWidgetId = this.powerService.getStoreWidgetId(new Date() , clerkId) ;
if (clerkDetail == null) { if (StringUtils.isBlank(storeWidgetId)) {
logger.info("导购不存在"); logger.info("导购权限不存在");
return Collections.emptyList(); return Collections.emptyList();
} }
String storeWidgetId = clerkDetail.getStoreWidgetId();
StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidgetBykey(storeWidgetId); StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidgetBykey(storeWidgetId);
if (storeWidgetDTO == null) { if (storeWidgetDTO == null) {
logger.info("导购权限不存在"); logger.info("导购权限不存在");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment