Commit 7ee3c6dc by 徐高华

企微托管导购授权

parent 2fc03500
......@@ -19,6 +19,7 @@ import com.gic.enterprise.api.dto.WechatWorkServiceSetting;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.*;
......@@ -217,6 +218,7 @@ public class QywxOpenController {
* @return
*/
@RequestMapping("get-open-staff")
@IgnoreLogin
public RestResponse<OpenStaffDTO> getOpenStaff(Long openStaffId) {
ServiceResponse<OpenStaffDTO> resp = this.openStaffApiService.getById(openStaffId);
if (!resp.isSuccess()) {
......@@ -237,6 +239,7 @@ public class QywxOpenController {
* @return
*/
@RequestMapping("check-code")
@IgnoreLogin
public RestResponse<Void> checkCode(Long openStaffId, String code) {
ServiceResponse<Void> resp = this.openStaffApiService.checkCode(openStaffId, code);
if (!resp.isSuccess()) {
......@@ -343,4 +346,56 @@ public class QywxOpenController {
return vo;
}
/**
* 导购授权
* @param wxEnterpriseId
* @param enterpriseId
* @param clerkCode
* @return
*/
@IgnoreLogin
@RequestMapping("open-qrcode-for-clerk")
public RestResponse<OpenStaffDTO> cancelOpenStaff(String wxEnterpriseId , String enterpriseId , String clerkCode) {
if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterpriseId,enterpriseId,clerkCode)) {
return RestResponse.failure("9999","参数为空") ;
}
ClerkDTO clerk = this.clerkService.getClerkByClerkCode(enterpriseId,clerkCode) ;
if(null == clerk) {
return RestResponse.failure("9999","该账号在当前企业下不存在") ;
}
String clerkId = clerk.getClerkId() ;
StaffClerkRelationDTO staffClerkRelationDTO = this.staffClerkRelationApiService.getByClerkId(clerkId) ;
if(null == staffClerkRelationDTO) {
return RestResponse.failure("9999","该账号未绑定好办小程序") ;
}
String staffId = staffClerkRelationDTO.getStaffId() ;
ServiceResponse<OpenStaffDTO> staffResp = this.openStaffApiService.getByStaffId(staffId) ;
if(!staffResp.isSuccess() || null == staffResp.getResult()) {
return RestResponse.failure("9999","此成员未添加到授权列表") ;
}
OpenStaffDTO openStaff = staffResp.getResult() ;
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);
}
}
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