update code

dev_xds
haha 2024-04-01 22:37:40 +08:00
parent f974e753d1
commit 049d84a73b
4 changed files with 10 additions and 96 deletions

View File

@ -194,7 +194,7 @@ export default {
this.$api.publics.getMyProjectList({}).then((response) => {
this.projectOptions = response.rows;
});
listAttendanceConfig({}).then(d=>{
listAttendanceConfig({pageNum:1,pageSize:100}).then(d=>{
this.cfgList=d.rows||[];
});
},

View File

@ -127,7 +127,7 @@ export default {
this.$api.publics.getMyProjectList({}).then((response) => {
this.projectOptions = response.rows;
});
listAttendanceConfig({}).then(d=>{
listAttendanceConfig({pageNum:1,pageSize:100}).then(d=>{
this.cfgList=d.rows||[];
});
},

View File

@ -1,93 +0,0 @@
package com.yanzhu.jh.wxsetting.controller;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
/**
* openId
*
* @author JiangYuQi
* @date 2023-08-24
*/
@Slf4j
@Controller
@RequestMapping("/wxAuth")
public class WxBindingController extends BaseController {
@Autowired
private WxMpService wxMpService;
@GetMapping("/auth")
@ResponseBody
public String auth(@RequestParam(value = "echostr", defaultValue = "没有获取到") String echostr) {
return echostr;
}
/**
* @author tao
* @param:
* @return
*
*/
@GetMapping("/authorize")
public String authorize(@RequestParam(value = "returnUrl", defaultValue = "https://szgc.jhncidg.com/jhapi/") String returnUrl) throws UnsupportedEncodingException {
log.info("【微信网页授权】进来了,参数={}", returnUrl);
//1. 配置
//2. 调用方法
String url = RuoYiConfig.getProjectUrl() + "wxAuth/userInfo";
/*
*
* URLEncoder.decode(returnUrl,"UTF-8"
* https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
*/
String redirectUrl = wxMpService.oauth2buildAuthorizationUrl(url, WxConsts.OAUTH2_SCOPE_USER_INFO, URLEncoder.encode(returnUrl, "utf-8"));
log.info("【微信网页授权】获取code,result={}", redirectUrl);
return "redirect:" + redirectUrl;
}
/**
* @author tao
* @param:
* @return
* url
*/
@GetMapping("/userInfo")
public String userInfo(@RequestParam("code") String code,
@RequestParam("state") String returnUrl) throws WxErrorException {
/*urlauthorization code
codeaccess tokenopenid*/
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken();
try {
//获取access token
wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
log.info("【AccessToken】{}", wxMpOAuth2AccessToken.getAccessToken());
} catch (WxErrorException e) {
log.error("【微信网页授权】{}", e);
}
// 拿到openid
String openId = wxMpOAuth2AccessToken.getOpenId();
log.info("【openid】{}", openId);
log.info("【我是前端要回调的地址:】{}", returnUrl + "&openid=" + openId);
// 顺便获取一下用户信息
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
log.info("【用户信息:】{}", wxMpUser.toString());
//注意拼接参数,第一个参数需要加问号,之后参数使用&拼接的问题
//return "redirect:" + returnUrl + "/#/?openid=" + openId;
return "redirect:" + returnUrl + "&openid=" + openId;
}
}

View File

@ -512,9 +512,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryWorkerOnDuty" parameterType="SurProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
SELECT u.*,b.project_id,b.sub_dept_id
SELECT u.id,u.cfgid,u.app_id,u.vendors_code,u.workerId,u.laborWorkerId,u.workerCategory,u.qrCode,u.name,
u.ethnic,u.nativePlace,u.gender,u.birthDate,u.phone,u.degreeName,u.photo,u.recentPhoto,
u.groupId,u.leader,u.workTypeCode,u.specWorkType,
u.hatCode,u.state,u.enterDate,u.exitDate,u.companyId,u.vendorId,
u.teamId,u.teamName,u.enterType,u.is_del,u.create_by,u.create_time,u.update_by,u.update_time,
b.project_id,b.sub_dept_id,u.companyName,u.workTypeName,u.groupName,
b.project_id,b.sub_dept_id, g.teamname remark
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g
WHERE u.cfgid=b.id and u.state=0 and u.companyId=g.companyId
<if test="id==101">
and g.companyTypeId in (1,6)
</if>