Commit a2615aab by 徐高华

好办登录

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