Commit a2615aab by 徐高华

好办登录

parent d1507cce
......@@ -87,6 +87,8 @@ public interface WxEnterpriseRelatedApiService {
*/
public List<WxEnterpriseDTO> listWxEnterpriseByEid(String enterpriseId);
public List<WxEnterpriseDTO> listWxEnterpriseByEid(String enterpriseId , String clerkPhoneNumber);
/**
* 根据商户id 获取所有被绑定分组
*
......
package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.RightService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
......@@ -72,6 +75,8 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
private StoreService storeService;
@Autowired
private RightService rightService;
@Autowired
private ClerkService clerkService ;
/**
* 查询好办所有的企业id
......@@ -492,6 +497,26 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
}
@Override
public List<WxEnterpriseDTO> listWxEnterpriseByEid(String enterpriseId, String clerkPhoneNumber) {
List<WxEnterpriseDTO> list = new ArrayList<>();
ClerkDTO clerk = this.clerkService.getUserByPhoneNumber(clerkPhoneNumber, enterpriseId);
if(null == clerk || StringUtils.isBlank(clerk.getHbEnt())) {
return list ;
}
List<WxEnterpriseDTO> dtoList = this.listWxEnterpriseByEid(enterpriseId) ;
logger.info("用户管辖微信企业phone={},hbEnt={},dtoList={}",clerkPhoneNumber,clerk.getHbEnt(),JSON.toJSONString(dtoList));
if(CollectionUtils.isEmpty(dtoList)) {
return list ;
}
for(WxEnterpriseDTO item : dtoList) {
if(clerk.getHbEnt().contains(item.getWxEnterpriseId())) {
list.add(item) ;
}
}
return list;
}
@Override
public List<StoreRangeInfoDTO> listAllBindStoreOrGroup(String enterpriseId) {
List<TabStoreRange> tabStoreRanges = storeRangeService.queryAllBindRangeByEnterpriseId(enterpriseId);
return EntityUtil.changeEntityListNew(StoreRangeInfoDTO.class, tabStoreRanges);
......
......@@ -186,7 +186,7 @@ public class LoginController extends WebBaseController {
JSONObject jsonObject = JSONObject.parseObject(o);
String gicEnterpriseId = jsonObject.getString("enterpriseId");
String loginPhoneNumber = jsonObject.getString("phoneNumber");
List<WxEnterpriseDTO> enterpriseDTOList = wxEnterpriseRelatedApiService.listWxEnterpriseByEid(gicEnterpriseId);
List<WxEnterpriseDTO> enterpriseDTOList = wxEnterpriseRelatedApiService.listWxEnterpriseByEid(gicEnterpriseId,loginPhoneNumber);
if (CollectionUtils.isEmpty(enterpriseDTOList)) {
logger.info("登录失败,不存在对应企业:{}", o);
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false, false));
......@@ -358,8 +358,9 @@ public class LoginController extends WebBaseController {
logger.info(o);
JSONObject jsonObject = JSONObject.parseObject(o);
String gicEnterpriseId = jsonObject.getString("enterpriseId");
String phoneNumber = jsonObject.getString("phoneNumber") ;
String wxEnterpriseId = jsonObject.getString("wxEnterpriseId");
List<WxEnterpriseDTO> enterpriseDTOList = wxEnterpriseRelatedApiService.listWxEnterpriseByEid(gicEnterpriseId);
List<WxEnterpriseDTO> enterpriseDTOList = wxEnterpriseRelatedApiService.listWxEnterpriseByEid(gicEnterpriseId,phoneNumber);
if (CollectionUtils.isEmpty(enterpriseDTOList)) {
logger.info("登录失败,不存在对应企业:{}", o);
return resultResponse(HaoBanErrCode.ERR_6);
......@@ -395,11 +396,11 @@ public class LoginController extends WebBaseController {
}
@RequestMapping("/gic-login-check")
public ModelAndView gicLogin(String code, String hbEnt) {
logger.info("gic登录code={},hbEnt={}", code, hbEnt);
PowerClerkDTO clerkDTO = this.userService.haobanLoginBack(code);
public ModelAndView gicLogin(String clerkId, String hbEnt) {
logger.info("gic登录clerkId={},hbEnt={}", clerkId, hbEnt);
PowerClerkDTO clerkDTO = this.userService.haobanLoginBack(clerkId);
if (clerkDTO == null) {
logger.info("登录失败,code失效:{}", code);
logger.info("登录失败,code失效:{}", clerkId);
ModelAndView model = new ModelAndView(new RedirectView("/haoban-web/#/gic-error", false));
return model;
}
......@@ -420,7 +421,7 @@ public class LoginController extends WebBaseController {
new RedirectView("/haoban-3/#/loginMore?random=" + random, false, false));
return model;
}
logger.info("登录失败,code失效:{}", code);
logger.info("登录失败,code失效:{}", clerkId);
ModelAndView model = new ModelAndView(new RedirectView("/haoban-web/#/gic-error", false));
return model;
}
......
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