Commit 27c3d832 by 徐高华

企微托管

parent e027bdd5
package com.gic.haoban.manage.web.controller.haoban;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.qdto.OpenStaffInitQDTO;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.vo.OpenStaffVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 企微托管
*/
@RestController
@RequestMapping("/qw-open")
public class QywxOpenController {
@Autowired
private OpenStaffApiService openStaffApiService ;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService ;
@Autowired
private StaffApiService staffApiService ;
/**
* 获取详情
* @param staffId
* @return
*/
@RequestMapping("get-open-staff")
public RestResponse<OpenStaffVO> getOpenStaff(String staffId , @RequestParam(defaultValue = "0") int authFlag) {
ServiceResponse<OpenStaffDTO> resp = this.openStaffApiService.getByStaffId(staffId) ;
if(!resp.isSuccess()) {
return RestResponse.successResult(null) ;
}
OpenStaffVO vo = new OpenStaffVO() ;
OpenStaffDTO dto = resp.getResult();
String wxEnterpriseId = dto.getWxEnterpriseId() ;
String enterpriseId = dto.getEnterpriseId() ;
if(dto.getStatusFlag()==1) {
if(authFlag==1) {
return RestResponse.failure("9999","无效授权,账号托管中");
}
vo.setStatusFlag(1);
}else {
vo.setStatusFlag(2);
if(authFlag==1) {
OpenStaffInitQDTO qdto = new OpenStaffInitQDTO() ;
qdto.setStaffId(staffId);
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setEnterpriseId(enterpriseId);
ServiceResponse<Long> codeResp = this.openStaffApiService.init(qdto) ;
if(null == codeResp.getResult()) {
return RestResponse.failure("9999",codeResp.getMessage());
}
ServiceResponse<OpenStaffDTO> staffResp =this.openStaffApiService.getById(codeResp.getResult()) ;
if(null == staffResp.getResult()) {
return RestResponse.failure("9999",staffResp.getMessage());
}
vo.setQrcode(staffResp.getResult().getQrCode1());
}
}
WxEnterpriseDTO en = this.wxEnterpriseApiService.getOne(wxEnterpriseId) ;
vo.setCorpName(en.getCorpName());
StaffDTO staffDTO = this.staffApiService.selectById(staffId) ;
vo.setStaffName(staffDTO.getStaffName());
vo.setStaffImage(staffDTO.getHeadImg());
return RestResponse.successResult(vo);
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
public class OpenStaffVO implements Serializable {
/**
* 成员名称
*/
private String staffName ;
/**
* 成员头像
*/
private String staffImage ;
/**
* 企业名称
*/
private String corpName ;
/**
* 1 已登录 2未登录
*/
private Integer statusFlag ;
/**
* 二维码
*/
private String qrcode ;
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getStaffImage() {
return staffImage;
}
public void setStaffImage(String staffImage) {
this.staffImage = staffImage;
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
}
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