Commit 6f8628ee by 墨竹

feat:获取交集门店id

parent 9ac95126
...@@ -140,6 +140,7 @@ public interface StaffApiService { ...@@ -140,6 +140,7 @@ public interface StaffApiService {
StaffDTO getWxStaffOne(String wxEnterpriseId); StaffDTO getWxStaffOne(String wxEnterpriseId);
/** /**
* 获取超管
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @return
*/ */
...@@ -246,7 +247,7 @@ public interface StaffApiService { ...@@ -246,7 +247,7 @@ public interface StaffApiService {
/** /**
* 获取好办门店数据权限 * 导购gic门店和好办企业门店交集
* 超管返回所有门店 * 超管返回所有门店
* *
* @param clerkId 职员id * @param clerkId 职员id
...@@ -256,4 +257,16 @@ public interface StaffApiService { ...@@ -256,4 +257,16 @@ public interface StaffApiService {
*/ */
List<String> getHaoBanStoreRolesByClerkId(String clerkId); List<String> getHaoBanStoreRolesByClerkId(String clerkId);
/**
* 门店筛选器id和好办企业门店交集
*
* @param storeWidgetId 存储部件id
* @param enterpriseId 企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-05-09 16:34:56
*/
List<String> getHaoBanStoreRolesByStoreWidgetId(String storeWidgetId,String enterpriseId);
} }
...@@ -21,7 +21,6 @@ public interface WxEnterpriseRelatedMapper { ...@@ -21,7 +21,6 @@ public interface WxEnterpriseRelatedMapper {
List<TabHaobanWxEnterpriseRelated> listByWxenterpriseId(String wxEnterpriseId); List<TabHaobanWxEnterpriseRelated> listByWxenterpriseId(String wxEnterpriseId);
@Deprecated
TabHaobanWxEnterpriseRelated findOneByEnterpriseId(String enterpriseId); TabHaobanWxEnterpriseRelated findOneByEnterpriseId(String enterpriseId);
List<TabHaobanWxEnterpriseRelated> queryAllHasGicEnterpriseId(); List<TabHaobanWxEnterpriseRelated> queryAllHasGicEnterpriseId();
......
...@@ -28,6 +28,7 @@ import com.gic.haoban.manage.api.enums.SecretTypeEnum; ...@@ -28,6 +28,7 @@ import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
...@@ -102,6 +103,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -102,6 +103,8 @@ public class StaffApiServiceImpl implements StaffApiService {
private PowerService powerService; private PowerService powerService;
@Autowired @Autowired
private StoreRangeService storeRangeService; private StoreRangeService storeRangeService;
@Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
...@@ -1311,9 +1314,22 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1311,9 +1314,22 @@ public class StaffApiServiceImpl implements StaffApiService {
List<String> gicStoreIds = getStoreIdList(clerkId); List<String> gicStoreIds = getStoreIdList(clerkId);
//取交集 //取交集
Sets.SetView<String> intersection = Sets.intersection(Sets.newHashSet(enterpriseIdStoreIds), Sets.newHashSet(gicStoreIds)); Sets.SetView<String> intersection = Sets.intersection(Sets.newHashSet(enterpriseIdStoreIds), Sets.newHashSet(gicStoreIds));
return new ArrayList<>(intersection); return intersection.stream().collect(Collectors.toList());
} }
@Override
public List<String> getHaoBanStoreRolesByStoreWidgetId(String storeWidgetId, String enterpriseId) {
TabHaobanWxEnterpriseRelated enterpriseRelated = wxEnterpriseRelatedMapper.findOneByEnterpriseId(enterpriseId);
if (enterpriseRelated == null) {
//商户未关联好办
return Collections.emptyList();
}
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(enterpriseId, enterpriseRelated.getWxEnterpriseId());
List<String> storeWidgetIdStoreIds = getStoreWidgetIdStoreIds(storeWidgetId, enterpriseId);
//取交集
Sets.SetView<String> intersection = Sets.intersection(Sets.newHashSet(enterpriseIdStoreIds), Sets.newHashSet(storeWidgetIdStoreIds));
return intersection.stream().collect(Collectors.toList());
}
/** /**
* 门店筛选器id企业端获取gic门店id列表 * 门店筛选器id企业端获取gic门店id列表
...@@ -1329,8 +1345,21 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1329,8 +1345,21 @@ public class StaffApiServiceImpl implements StaffApiService {
if (clerkDetail == null) { if (clerkDetail == null) {
return Collections.emptyList(); return Collections.emptyList();
} }
return getStoreWidgetIdStoreIds(clerkDetail.getStoreWidgetId(), clerkDetail.getEnterpriseId());
}
/**
* 获取门店筛选器门店ids
*
* @param storeWidgetId
* @param enterpriseId
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-05-09 16:43:50
*/
private List<String> getStoreWidgetIdStoreIds(String storeWidgetId,String enterpriseId) {
// 门店id列表 // 门店id列表
List<String> storeIdList = storeWidgetService.getStoreWidgetStore(clerkDetail.getStoreWidgetId(), clerkDetail.getEnterpriseId(), null, null, 2); List<String> storeIdList = storeWidgetService.getStoreWidgetStore(storeWidgetId, enterpriseId, null, null, 2);
if (CollectionUtils.isEmpty(storeIdList)) { if (CollectionUtils.isEmpty(storeIdList)) {
return Collections.emptyList(); return Collections.emptyList();
} }
......
...@@ -182,8 +182,7 @@ ...@@ -182,8 +182,7 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_wx_enterprise_related from tab_haoban_wx_enterprise_related
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR} where enterprise_id = #{enterpriseId,jdbcType=VARCHAR} and status_flag = 1 limit 1
and status_flag = 1
</select> </select>
<select id="queryAllHasGicEnterpriseId" resultMap="BaseResultMap" > <select id="queryAllHasGicEnterpriseId" resultMap="BaseResultMap" >
......
...@@ -78,11 +78,16 @@ public class LoginController extends WebBaseController { ...@@ -78,11 +78,16 @@ public class LoginController extends WebBaseController {
@Autowired @Autowired
private ClerkService clerkService; private ClerkService clerkService;
/**
* 企微后台登录
* @param auth_code
* @param response
*/
@RequestMapping("login") @RequestMapping("login")
@Deprecated
public void login(String auth_code, HttpServletResponse response) { public void login(String auth_code, HttpServletResponse response) {
String userJson = qywxCorpApiService.getLoginUserInfo(config.getCorpid(), auth_code); String userJson = qywxCorpApiService.getLoginUserInfo(config.getCorpid(), auth_code);
if (StringUtils.isBlank(userJson)) { if (StringUtils.isBlank(userJson)) {
logger.info("未查询到用户:auth_code:{}",auth_code);
return; return;
} }
...@@ -128,44 +133,6 @@ public class LoginController extends WebBaseController { ...@@ -128,44 +133,6 @@ public class LoginController extends WebBaseController {
} }
} }
@RequestMapping("login_local")
@Deprecated
public HaobanResponse login() {
LoginDTO loginVO = new LoginDTO();
StaffDTO staff = staffApiService.selectById("2205f92cdb5f468cb996e91dded414c2");
String token = ToolUtil.randomUUID() + "-" + ToolUtil.randomStringByTime();
logger.info("【好办登录】staff={}", JSON.toJSONString(staff));
loginVO.setWxEnterpriseId(staff.getWxEnterpriseId());
loginVO.setStaffDTO(staff);
AuthWebRequestUtil.setAppLoginUser(token, EntityUtil.changeEntityByOrika(WebLoginDTO.class,loginVO));
Cookie cookie = new Cookie("token", token);
cookie.setPath("/");
return resultResponse(HaoBanErrCode.ERR_1, loginVO);
}
/**
* 获取登录信息
*
* @return res
*/
@RequestMapping("get-login-info")
public HaobanResponse getLoginInfo() {
return resultResponse(HaoBanErrCode.ERR_1, AuthWebRequestUtil.getLoginUser());
}
/**
* 好办-扫码登录
* @return
* @throws UnsupportedEncodingException
*/
@RequestMapping("get-login-qrcode")
public HaobanResponse getLoginQrcode() throws UnsupportedEncodingException {
String corpid = config.getCorpid();
String redirectUri = config.getHost() + "login";
String url = "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid=" + corpid + "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") + "&state=web_login@gyoss9&usertype=admin";
return resultResponse(HaoBanErrCode.ERR_1, URL.decode(url));
}
/** /**
* 运维登录 * 运维登录
* *
...@@ -318,6 +285,58 @@ public class LoginController extends WebBaseController { ...@@ -318,6 +285,58 @@ public class LoginController extends WebBaseController {
return null; return null;
} }
@RequestMapping("login_local")
@Deprecated
public HaobanResponse login() {
LoginDTO loginVO = new LoginDTO();
StaffDTO staff = staffApiService.selectById("2205f92cdb5f468cb996e91dded414c2");
String token = ToolUtil.randomUUID() + "-" + ToolUtil.randomStringByTime();
logger.info("【好办登录】staff={}", JSON.toJSONString(staff));
loginVO.setWxEnterpriseId(staff.getWxEnterpriseId());
loginVO.setStaffDTO(staff);
AuthWebRequestUtil.setAppLoginUser(token, EntityUtil.changeEntityByOrika(WebLoginDTO.class,loginVO));
Cookie cookie = new Cookie("token", token);
cookie.setPath("/");
return resultResponse(HaoBanErrCode.ERR_1, loginVO);
}
/**
* 获取登录信息
*
* @return res
*/
@RequestMapping("get-login-info")
public HaobanResponse getLoginInfo() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String phoneNumber = loginUser.getStaffDTO().getPhoneNumber();
if (StringUtils.isNotBlank(phoneNumber)){
ClerkDTO clerkDTO = clerkService.getClerkByPhoneNumber(phoneNumber);
String enterpriseId = loginUser.getEnterpriseId();
if (StringUtils.isBlank(enterpriseId)) {
loginUser.setEnterpriseId(clerkDTO.getEnterpriseId());
}
Integer superAdmin = clerkDTO.getSuperAdmin();
if (superAdmin != null && superAdmin == 1) {
loginUser.getStaffDTO().setSuperManagerFlag(1);
}
}
return resultResponse(HaoBanErrCode.ERR_1, loginUser);
}
/**
* 好办-扫码登录
* @return
* @throws UnsupportedEncodingException
*/
@RequestMapping("get-login-qrcode")
public HaobanResponse getLoginQrcode() throws UnsupportedEncodingException {
String corpid = config.getCorpid();
String redirectUri = config.getHost() + "login";
String url = "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid=" + corpid + "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") + "&state=web_login@gyoss9&usertype=admin";
return resultResponse(HaoBanErrCode.ERR_1, URL.decode(url));
}
/** /**
* 登录微信企业列表 * 登录微信企业列表
* @param random * @param random
......
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