Commit c1dbc892 by 徐高华

h5托管授权

parent aa832c0a
...@@ -31,6 +31,7 @@ import com.gic.haoban.manage.api.service.StaffApiService; ...@@ -31,6 +31,7 @@ import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.web.qo.open.OpenStaffQO; import com.gic.haoban.manage.web.qo.open.OpenStaffQO;
import com.gic.haoban.manage.web.utils.ImportExcelUtil; import com.gic.haoban.manage.web.utils.ImportExcelUtil;
import com.gic.haoban.manage.web.vo.open.OpenClerkVO;
import com.gic.haoban.manage.web.vo.open.OpenQwAccountInfoVO; import com.gic.haoban.manage.web.vo.open.OpenQwAccountInfoVO;
import com.gic.haoban.manage.web.vo.open.OpenStaffVO; import com.gic.haoban.manage.web.vo.open.OpenStaffVO;
import com.gic.qcloud.BucketNameEnum; import com.gic.qcloud.BucketNameEnum;
...@@ -173,11 +174,26 @@ public class QywxOpenController { ...@@ -173,11 +174,26 @@ public class QywxOpenController {
* @return * @return
*/ */
@RequestMapping("login-init") @RequestMapping("login-init")
public RestResponse<OpenStaffDTO> init(String staffId, @RequestParam(defaultValue = "0") int loginAgainFlag) { @IgnoreLogin
WebLoginDTO login = AuthWebRequestUtil.getLoginUser(); public RestResponse<OpenStaffDTO> init(String staffId, @RequestParam(defaultValue = "0") int loginAgainFlag , String wxEnterpriseId , String enterpriseId) {
String wxEnterpriseId = login.getWxEnterpriseId(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String enterpriseId = login.getEnterpriseId();
ServiceResponse<OpenStaffDTO> staffResp = this.openStaffApiService.getByStaffId(staffId) ; ServiceResponse<OpenStaffDTO> staffResp = this.openStaffApiService.getByStaffId(staffId) ;
if(null != loginUser) {
wxEnterpriseId = loginUser.getWxEnterpriseId();
enterpriseId = loginUser.getEnterpriseId();
if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterpriseId,enterpriseId,staffId)) {
return RestResponse.failure("9999","参数为空") ;
}
}else {
// 未登录直接通过参数授权
if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterpriseId,enterpriseId,staffId)) {
return RestResponse.failure("9999","参数为空") ;
}
OpenStaffDTO openStaff = staffResp.getResult() ;
if(null != openStaff && openStaff.getStatusFlag()==1) {
return RestResponse.failure("9999","导购账号已授权") ;
}
}
String checkMsg = this.check(wxEnterpriseId, enterpriseId , null != staffResp.getResult()); String checkMsg = this.check(wxEnterpriseId, enterpriseId , null != staffResp.getResult());
if (null != checkMsg) { if (null != checkMsg) {
return RestResponse.failure("9999", checkMsg); return RestResponse.failure("9999", checkMsg);
...@@ -198,7 +214,8 @@ public class QywxOpenController { ...@@ -198,7 +214,8 @@ public class QywxOpenController {
ClerkDTO clerk = this.clerkService.getclerkById(clerkId) ; ClerkDTO clerk = this.clerkService.getclerkById(clerkId) ;
o.setClerkType(clerk.getClerkType()); o.setClerkType(clerk.getClerkType());
}); });
relationList = relationList.stream().filter(o -> o.getClerkType() <= 1 && o.getEnterpriseId().equals(enterpriseId)).collect(Collectors.toList()); String _enterpriseId = enterpriseId ;
relationList = relationList.stream().filter(o -> o.getClerkType() <= 1 && o.getEnterpriseId().equals(_enterpriseId)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(relationList)) { if (CollectionUtils.isEmpty(relationList)) {
return RestResponse.failure("9999", "成员需关联gic商户下导购"); return RestResponse.failure("9999", "成员需关联gic商户下导购");
} }
...@@ -366,7 +383,7 @@ public class QywxOpenController { ...@@ -366,7 +383,7 @@ public class QywxOpenController {
*/ */
@IgnoreLogin @IgnoreLogin
@RequestMapping("open-qrcode-for-clerk") @RequestMapping("open-qrcode-for-clerk")
public RestResponse<OpenStaffDTO> cancelOpenStaff(String wxEnterpriseId , String enterpriseId , String clerkCode) { public RestResponse<OpenClerkVO> cancelOpenStaff(String wxEnterpriseId , String enterpriseId , String clerkCode) {
if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterpriseId,enterpriseId,clerkCode)) { if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterpriseId,enterpriseId,clerkCode)) {
return RestResponse.failure("9999","参数为空") ; return RestResponse.failure("9999","参数为空") ;
} }
...@@ -374,38 +391,20 @@ public class QywxOpenController { ...@@ -374,38 +391,20 @@ public class QywxOpenController {
if(null == clerk) { if(null == clerk) {
return RestResponse.failure("9999","该账号在当前企业下不存在") ; return RestResponse.failure("9999","该账号在当前企业下不存在") ;
} }
if(clerk.getClerkType() > 1) {
return RestResponse.failure("9999","非导购") ;
}
String clerkId = clerk.getClerkId() ; String clerkId = clerk.getClerkId() ;
StaffClerkRelationDTO staffClerkRelationDTO = this.staffClerkRelationApiService.getByClerkId(clerkId) ; StaffClerkRelationDTO staffClerkRelationDTO = this.staffClerkRelationApiService.getByClerkId(clerkId) ;
if(null == staffClerkRelationDTO) { if(null == staffClerkRelationDTO) {
return RestResponse.failure("9999","该账号未绑定好办小程序") ; return RestResponse.failure("9999","该账号未绑定好办小程序") ;
} }
String staffId = staffClerkRelationDTO.getStaffId() ; String staffId = staffClerkRelationDTO.getStaffId() ;
ServiceResponse<OpenStaffDTO> staffResp = this.openStaffApiService.getByStaffId(staffId) ; OpenClerkVO vo = new OpenClerkVO() ;
if(!staffResp.isSuccess() || null == staffResp.getResult()) { vo.setClerkId(clerkId);
return RestResponse.failure("9999","此成员未添加到授权列表") ; vo.setStoreId(clerk.getStoreId());
} vo.setStaffId(staffId);
OpenStaffDTO openStaff = staffResp.getResult() ; return RestResponse.successResult(vo);
if(openStaff.getStatusFlag()==1) {
return RestResponse.failure("9999","导购账号已授权") ;
}
String checkMsg = this.check(wxEnterpriseId, enterpriseId , true);
if (null != checkMsg) {
return RestResponse.failure("9999", checkMsg);
}
OpenStaffInitQDTO initQDTO = new OpenStaffInitQDTO();
initQDTO.setWxEnterpriseId(wxEnterpriseId);
initQDTO.setEnterpriseId(enterpriseId);
initQDTO.setStaffId(staffId);
initQDTO.setLoginAgainFlag(0);
ServiceResponse<OpenStaffDTO> initResp = this.openStaffApiService.init(initQDTO);
if (!initResp.isSuccess()) {
return RestResponse.failure("9999", initResp.getMessage());
}
OpenStaffDTO openStaffDTO = initResp.getResult();
openStaffDTO.setStaffName(staffClerkRelationDTO.getStaffName());
StaffDTO staff = this.staffApiService.selectById(openStaffDTO.getStaffId());
openStaffDTO.setStaffHeadImg(staff.getHeadImg());
return RestResponse.successResult(openStaffDTO);
} }
......
package com.gic.haoban.manage.web.vo.open;
import java.io.Serializable;
public class OpenClerkVO implements Serializable {
/**
* 成员id
*/
private String staffId;
private String clerkId ;
private String storeId ;
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
}
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