Commit bfeff411 by 徐高华

Merge branch 'feature/获取用户敏感信息' into 'developer'

更新qrcode

See merge request !901
parents b8a46522 18a2c40b
......@@ -43,7 +43,6 @@ import com.gic.haoban.manage.web.qo.CommonQO;
import com.gic.haoban.manage.web.vo.*;
import com.gic.haoban.manage.web.vo.notify.CustomerFriendMemberVO;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.fee.UserSensitiveInfoDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
......@@ -53,9 +52,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
......@@ -107,8 +104,6 @@ public class WxStaffController extends WebBaseController {
private HaobanRoleApiService haobanRoleApiService;
@Autowired
private PowerService powerService ;
@Autowired
private QywxCorpApiService qywxCorpApiService;
//选择成员列表
@RequestMapping("/staff-list")
......@@ -1742,49 +1737,6 @@ public class WxStaffController extends WebBaseController {
}
/**
* 获取构造网页授权链接url
* @return
*/
@RequestMapping("get-third-auth-url")
public HaobanResponse getAuthUrl() {
String suiteId = config.getWxSuiteid();
logger.info("通讯录应用ID:{}", suiteId);
String host = config.getHost() + "third-callback";
//haoban-manage3-web 替换成 haoban-manage3-wx
String redictUrl = host.replaceAll("-web", "-wx");
logger.info("替换后的url:{}", redictUrl);
String authorizationUrl = qywxCorpApiService.getAuthorizationUrl(suiteId,redictUrl,"snsapi_privateinfo");
return resultResponse(HaoBanErrCode.ERR_1, authorizationUrl);
}
/**
* 更新成员的qr_code
* @param code
*/
@RequestMapping("third-callback")
public void getAuthUrl(String code, String state, HttpServletResponse response) {
logger.info("获取第三方应用用户敏感信息企微回调的code:{},state:{}", code,state);
String suiteId = config.getWxSuiteid();
ServiceResponse<UserSensitiveInfoDTO> dto = qywxUserApiService.getUserSensitiveInfoDTOByCode(code, suiteId);
UserSensitiveInfoDTO result = dto.getResult();
//更新staff的qr_code
if(null!=result){
logger.info("成员的user_id:{},qr_code:{}", result.getUserid(),result.getQr_code());
staffApiService.updateQrCodeByUserId(result.getUserid(), result.getQr_code());
}
//跳转好办小程序首页
String host = config.getHost();
//haoban-manage3-web 替换成 haoban-manage3-wx
String redictUrl = host.replaceAll("-web", "-wx")+"third_callback.html";
try {
logger.info("跳转的html地址{}",redictUrl);
response.sendRedirect(redictUrl);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 判断成员是否授权获取敏感信息
*/
@RequestMapping("get-sensitive-status")
......@@ -1792,4 +1744,11 @@ public class WxStaffController extends WebBaseController {
int qrCodeByStaffId = staffApiService.getSensitiveStatus(staffId);
return resultResponse(HaoBanErrCode.ERR_1, qrCodeByStaffId);
}
@RequestMapping("update-qr-code")
public HaobanResponse updateQrCode(String staffId , String qrCode){
this.staffApiService.updateQrCodeByStaffId(staffId, qrCode) ;
return resultResponse(HaoBanErrCode.ERR_1);
}
}
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