提交代码
parent
6d76c84442
commit
f57eb151db
|
@ -9,6 +9,7 @@ import com.ruoyi.common.annotation.Anonymous;
|
|||
import com.ruoyi.common.annotation.RateLimiter;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
|
@ -16,16 +17,22 @@ import com.ruoyi.common.core.redis.RedisCache;
|
|||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.*;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.exception.user.BlackListException;
|
||||
import com.ruoyi.common.utils.AuthRsaUtils;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.MultipartFileUtils;
|
||||
import com.ruoyi.common.utils.http.HttpClientUtil;
|
||||
import com.ruoyi.common.utils.ip.IpUtils;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceGroup;
|
||||
|
@ -70,6 +77,9 @@ public class LabourApiController extends BaseController {
|
|||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceGroupService surProjectAttendanceGroupService;
|
||||
|
||||
|
@ -154,13 +164,21 @@ public class LabourApiController extends BaseController {
|
|||
if(file==null){
|
||||
throw new RuntimeException("请上传文件资源...");
|
||||
}
|
||||
String ipAddress = IpUtils.getIpAddr();
|
||||
log.info("labourApi.pushProfileImage.ipAddress......{}",ipAddress);
|
||||
// IP黑名单校验
|
||||
String blackStr = configService.selectConfigByKey("api.labour.whiteIPList");
|
||||
if (!IpUtils.isMatchedIp(blackStr,ipAddress))
|
||||
{
|
||||
throw new BlackListException();
|
||||
}
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(StringUtils.equals(ShiFouEnum.SHI.getCode(),sysApplyConfig.getIsDel())){
|
||||
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(),HttpStatusEnum.DISABLE.getCode());
|
||||
}
|
||||
try {
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), file);
|
||||
String fileName = FileUploadUtils.uploadImages(RuoYiConfig.getUploadPath(), file);
|
||||
return success(fileName);
|
||||
}catch (Exception e){
|
||||
throw new ServiceException(e.getMessage(),HttpStatusEnum.DARA_EXCEPTION.getCode());
|
||||
|
@ -498,8 +516,13 @@ public class LabourApiController extends BaseController {
|
|||
if(StringUtils.isNull(surProjectAttendanceUser.getCompanyTypeId())){
|
||||
throw new ServiceException("人员部门类型信息不完整",HttpStatusEnum.DARA_EXCEPTION.getCode());
|
||||
}
|
||||
surProjectAttendanceData.setAppId(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceData.setCfgid(sysApplyConfig.getCfgId());
|
||||
surProjectAttendanceData.setAppId(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceData.setProjectId(sysApplyConfig.getProjectId());
|
||||
surProjectAttendanceData.setProjectName(sysApplyConfig.getProjectName());
|
||||
surProjectAttendanceData.setDeptId(sysApplyConfig.getDeptId());
|
||||
surProjectAttendanceData.setDeptName(sysApplyConfig.getDeptName());
|
||||
surProjectAttendanceData.setVendorsCode(VendorsCodeEnum.YANZHU.getCode());
|
||||
surProjectAttendanceData.setCompanyId(surProjectAttendanceUser.getCompanyId());
|
||||
surProjectAttendanceData.setCompanyName(surProjectAttendanceUser.getCompanyName());
|
||||
surProjectAttendanceData.setWorkerName(surProjectAttendanceUser.getName());
|
||||
|
|
|
@ -14,6 +14,8 @@ ruoyi:
|
|||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 服务回调地址
|
||||
projectUrl: http://127.0.0.1:8091/jhapi/
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
|
@ -32,7 +34,12 @@ server:
|
|||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
#微信公众号配置
|
||||
wechat:
|
||||
mpAppId: wxe6fd9ad863ac09bf
|
||||
mpAppSecret: ed08e7f6f42a40fc9fa0ebbc1bc6a1db
|
||||
# 数据源配置
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
|
|
@ -14,6 +14,8 @@ ruoyi:
|
|||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 服务回调地址
|
||||
projectUrl: http://127.0.0.1:8091/jhapi/
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
|
@ -32,6 +34,11 @@ server:
|
|||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
#微信公众号配置
|
||||
wechat:
|
||||
mpAppId: wx90a9158b6acc5584
|
||||
mpAppSecret: ec23a5d78f12afa569c64794570d753c
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
|
|
|
@ -14,6 +14,8 @@ ruoyi:
|
|||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 服务回调地址
|
||||
projectUrl: http://127.0.0.1:8091/jhapi/
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
|
@ -32,6 +34,11 @@ server:
|
|||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
#微信公众号配置
|
||||
wechat:
|
||||
mpAppId: wxe6fd9ad863ac09bf
|
||||
mpAppSecret: ed08e7f6f42a40fc9fa0ebbc1bc6a1db
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
|
|
|
@ -15,6 +15,10 @@ user:
|
|||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 微信资源验证访问
|
||||
web:
|
||||
resources:
|
||||
static-locations: classpath:/wxstatic/
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CIDdpE5WbJ0acBKs
|
|
@ -169,6 +169,12 @@
|
|||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-mp</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -33,6 +33,11 @@ public class RuoYiConfig
|
|||
/** 验证码类型 */
|
||||
private static String captchaType;
|
||||
|
||||
/**
|
||||
* 服务回调地址
|
||||
*/
|
||||
private static String projectUrl;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
|
@ -101,6 +106,14 @@ public class RuoYiConfig
|
|||
RuoYiConfig.captchaType = captchaType;
|
||||
}
|
||||
|
||||
public static String getProjectUrl() {
|
||||
return projectUrl;
|
||||
}
|
||||
|
||||
public void setProjectUrl(String projectUrl) {
|
||||
RuoYiConfig.projectUrl = projectUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导入上传路径
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Map;
|
||||
/**
|
||||
* Created by tao.
|
||||
* Date: 2023/3/21 15:02
|
||||
* 描述:
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Component
|
||||
//从配置文件里获取
|
||||
@ConfigurationProperties(prefix = "wechat")
|
||||
public class WechatAccountConfig {
|
||||
|
||||
/**
|
||||
* 公众平台id
|
||||
*/
|
||||
private String mpAppId;
|
||||
|
||||
/**
|
||||
* 公众平台密钥
|
||||
*/
|
||||
private String mpAppSecret;
|
||||
|
||||
/**
|
||||
* 微信模版id
|
||||
*/
|
||||
private Map<String, String> templateId;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.ruoyi.common.config;
|
||||
|
||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* Created by tao.
|
||||
* Date: 2023/3/21 15:00
|
||||
* 描述:
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class WechatMpConfig {
|
||||
|
||||
@Autowired
|
||||
private WechatAccountConfig accountConfig;
|
||||
|
||||
/**
|
||||
* @author :tao
|
||||
* @date :Created in 2021/3/12 10:15
|
||||
* @param: :
|
||||
* @return: WxMpService 对象
|
||||
* 配置wxMpConfigStorage,返回 WxMpService 对象
|
||||
*/
|
||||
@Bean
|
||||
public WxMpService wxMpService() {
|
||||
WxMpService wxMpService = new WxMpServiceImpl();
|
||||
wxMpService.setWxMpConfigStorage(wxMpConfigStorage());
|
||||
return wxMpService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author :tao
|
||||
* @date :Created in 2021/3/12 10:20
|
||||
* @param: :
|
||||
* @return: WxMpConfigStorage 对象
|
||||
* 配置AppId、和AppSecret,获取WxMpConfigStorage 对象
|
||||
*/
|
||||
@Bean
|
||||
public WxMpConfigStorage wxMpConfigStorage() {
|
||||
WxMpInMemoryConfigStorage wxMpConfigStorage = new WxMpInMemoryConfigStorage();
|
||||
wxMpConfigStorage.setAppId(accountConfig.getMpAppId());
|
||||
wxMpConfigStorage.setSecret(accountConfig.getMpAppSecret());
|
||||
return wxMpConfigStorage;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -32,12 +32,17 @@ public class FileUploadUtils
|
|||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 100 * 1024 * 1024;
|
||||
public static final long DEFAULT_MAX_SIZE = 200 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认大小 1M
|
||||
*/
|
||||
public static final long API_PROFILE_MAX_SIZE = 1 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认的文件名最大长度 100
|
||||
*/
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 100;
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 200;
|
||||
|
||||
/**
|
||||
* 默认上传的地址
|
||||
|
@ -105,6 +110,10 @@ public class FileUploadUtils
|
|||
{
|
||||
try
|
||||
{
|
||||
if (file.getSize() > API_PROFILE_MAX_SIZE)
|
||||
{
|
||||
throw new FileSizeLimitExceededException(1);
|
||||
}
|
||||
return upload(baseDir, file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -161,10 +161,10 @@ public class TokenService
|
|||
String userKey = getTokenKey(uuid);
|
||||
LoginUser user = redisCache.getCacheObject(userKey);
|
||||
user.setLoginTime(System.currentTimeMillis());
|
||||
int mobileExpireTime = expireTime * 3650 * 60 ;
|
||||
int mobileExpireTime = 24;//expireTime * 3650 * 60 ;
|
||||
user.setExpireTime(user.getLoginTime() + mobileExpireTime * MILLIS_MINUTE);
|
||||
// 根据uuid将loginUser缓存
|
||||
redisCache.setCacheObject(userKey, user, mobileExpireTime, TimeUnit.MINUTES);
|
||||
redisCache.setCacheObject(userKey, user, mobileExpireTime, TimeUnit.HOURS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
|
|||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/register', '/wxbuild', '/wxbinding']
|
||||
const whiteList = ['/login', '/register', '/wxAuth']
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
|
|
|
@ -62,13 +62,8 @@ export const constantRoutes = [
|
|||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/wxbuild',
|
||||
component: () => import('@/views/wxsetting/wxInit/build'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/wxbinding',
|
||||
component: () => import('@/views/wxsetting/wxInit/binding'),
|
||||
path: '/wxAuth',
|
||||
component: () => import('@/views/wxsetting/wxAuth/index'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
<template>
|
||||
<div class="app-content">
|
||||
<div class="top"></div>
|
||||
<div class="top-tips">
|
||||
<svg
|
||||
t="1711465680527"
|
||||
class="icon"
|
||||
viewBox="0 0 1059 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="4613"
|
||||
width="32"
|
||||
height="32"
|
||||
>
|
||||
<path
|
||||
d="M648.490101 1013.692421 648.490101 943.34831C844.095194 897.066596 989.80068 721.769482 989.80068 512 989.80068 302.264649 844.095194 126.967535 648.490101 80.65169L648.490101 34.165189 648.490101 10.341711C882.151323 57.783881 1058.062796 264.345044 1058.062796 512 1058.062796 759.689087 882.151323 966.25025 648.490101 1013.692421ZM68.262116 716.786348C30.547297 716.786348 0 686.239051 0 648.524232L0 375.475768C0 337.79508 30.547297 307.213652 68.262116 307.213652L238.917406 307.213652 546.096927 0.034131 546.096927 1023.965869 238.917406 716.786348 68.262116 716.786348ZM477.834811 853.34471 477.834811 170.723552 273.048463 375.509899 68.262116 375.509899 68.262116 648.558363 273.048463 648.558363 477.834811 853.34471ZM819.14539 494.934471C819.14539 612.550097 749.040197 713.543897 648.490101 759.108859L648.490101 681.392441C709.926005 641.936938 750.883274 573.401773 750.883274 494.934471 750.883274 416.5013 709.926005 347.966136 648.490101 308.510633L648.490101 230.794214C749.040197 276.359176 819.14539 377.352976 819.14539 494.934471Z"
|
||||
fill="#866cff"
|
||||
p-id="4614"
|
||||
></path>
|
||||
</svg>
|
||||
<span style="vertical-align: middle">关注公众号,接收更多服务提醒</span>
|
||||
</div>
|
||||
<div class="body-imgs">
|
||||
<el-image
|
||||
class="img"
|
||||
src="https://szgcwx.jhncidg.com/staticFiles/qr.jpg"
|
||||
></el-image>
|
||||
</div>
|
||||
<div class="body_title"> 长按识别或截图扫码关注公众号 </div>
|
||||
<div class="body_title"> 长按识别或截图扫码关注公众号 </div>
|
||||
<div class="body_content"> 关注公众号后在当前页面点击<svg t="1711468259951" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15811" width="32" height="32"><path d="M392.522 926.944c-30.204-14.388-45.066-40.377-45.272-73.982-0.15-43.7 0.793-162.034 1.042-205.73l1.268-221.946c-10.56 11.888-19.918 22.196-28.748 32.909-34.24 41.51-97.297 35.575-121.282-20.623-13.768-32.22-7.347-62.997 16.18-89.559 43.048-48.637 86.23-97.004 129.276-145.243 4.142-4.759 6.162-9.127 6.2-15.641-0.095-29.886 0.34-59.769 0.247-89.654 0.03-5.443 0.978-7.83 7.349-7.793 142.258 0.945 284.776 1.759 427.295 2.44 5.316 0.031 6.767 1.37 6.736 6.81-0.311 31.08-0.356 62.294-0.667 93.374-0.032 5.579 1.002 10.499 3.499 15.3 11.957 22.249 23.653 44.494 35.477 66.878 2.236 4.13 3.145 8.255 3.118 13.038l-1.348 235.889c-0.05 8.635-1.427 16.733-3.6 24.954-10.197 41.117-41.758 55.813-72.163 53.515-13.276-1.139-25.07-6.117-35.782-14.152-7.992 27.456-22.464 49.02-49.614 58.694-27.954 9.803-52.48 1.96-72.82-18.215-27.187 39.3-61.246 48.53-103.489 25.58L494.3 850.481c-0.052 9.166-0.899 18.197-3.739 27.078-13.666 44.686-58.962 68.067-98.039 49.384z m359.267-738.455c6.376 0.036 7.978-1.546 7.88-7.79-0.305-16.473-0.076-33.205 0.285-49.806 0.16-4.786-1.161-5.853-5.945-5.88-121.8-0.564-243.6-1.26-365.262-2.087-4.916-0.028-6.38 1.156-6.283 6.21 0.169 16.866 0.072 33.735-0.289 50.602-0.158 5.446 1.426 6.648 6.741 6.678 60.568 0.214 120.999 0.56 181.57 0.905 60.3 0.344 120.868 0.427 181.303 1.168zM417.78 900.126c16.477-1.633 32.505-17.35 36.065-35.93 0.963-5.039 1.257-10.079 1.286-15.132 0.476-60.167 1.249-195.368 1.322-255.544 0.037-6.376 1.647-8.885 8.016-7.788 0.928 0.136 1.989 0.011 3.055 0.017 6.375 0.036 13.425-1.647 18.994 0.507 6.095 2.426 2.99 11.18 5.611 16.77 2.892 6.257 5.912 12.518 10.658 17.592 18.22 19.628 47.201 15.544 61.282-8.283 6.307-10.856 7.568-22.672 6.84-34.764-0.233-5.844 1.112-8.757 7.481-7.526 1.197 0.139 2.662 0.015 3.856 0.022 6.371 0.036 13.29-1.523 18.992 0.503 6.627 2.565 2.729 11.046 5.347 16.638 3.547 6.926 6.561 13.85 12.377 19.195 28.144 26.463 59.898 1.406 65.082-23.005 3.006-13.66 1.09-27.36 1.832-41.169 0.301-6.108-2.577-13.959 1.167-17.524 3.734-3.83 11.69-0.726 17.67-1.091l0.796 0.004c11.955 0.069 11.69 0.067 14.543 11.37 2.336 9.844 6.798 18.9 14.469 25.588 10.044 8.692 21.705 13.804 35.145 8.835 16.104-5.754 25.87-17.654 29.423-34.235 0.948-4.378 1.245-9.028 1.405-13.674 0.43-75.314 0.86-150.619 1.423-225.929 0.025-4.387-0.88-8.378-3.119-12.24-11.316-19.06-22.627-38.12-33.674-57.307-2.237-4.001-4.62-5.738-9.398-5.765-126.85-0.593-253.701-1.317-380.676-2.175-3.984-0.022-7.042 0.622-9.984 3.926-43.45 49.032-87.297 98.063-130.877 146.96-14.969 16.783-17.478 36.03-10.017 56.261 10.99 29.816 43.625 35.98 65.015 12.46 25.26-27.753 50.13-55.77 75.126-83.787 3.606-3.83 7.088-7.794 12.296-13.344l-0.413 72.389-2.492 436.314c-0.044 7.707 0.71 15.148 3.722 22.602 7.329 18.9 23.073 30.015 40.354 28.26z" p-id="15812" fill="#728ce3"></path></svg>进入授权页面 </div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "build",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
watch: {},
|
||||
created() {},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<style scope>
|
||||
.app-content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #191d28
|
||||
url("https://szgcwx.jhncidg.com/staticFiles/img/CORE_40247DD946964A15AA0D4000E1031E19.png")
|
||||
no-repeat bottom/100%;
|
||||
.top {
|
||||
width: 100%;
|
||||
height: 25px;
|
||||
}
|
||||
.top-tips {
|
||||
width: 90%;
|
||||
height: 45px;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
line-height: 45px;
|
||||
background-color: #273051;
|
||||
color: #866cff;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
.icon {
|
||||
padding: 6px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.body-imgs {
|
||||
margin-top: 50px;
|
||||
text-align: center;
|
||||
.img {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
.body_title {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
color: #5b9fff;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
.body_content {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -7,22 +7,30 @@
|
|||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.8.6</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.yanzhu.jh</groupId>
|
||||
<artifactId>yanzhu-jh</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-poi</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -450,7 +450,7 @@ public class AttendanceJgwTask {
|
|||
if(arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
SurProjectAttendanceGroup group=SurProjectAttendanceGroup.createJgw(json);
|
||||
SurProjectAttendanceGroup group=SurProjectAttendanceGroup.createJgw(json,true);
|
||||
group.setBizLicense(json.getString("corpCode"));
|
||||
String type=json.getString("corpType");
|
||||
if("009".equals(type)){ //总包人员
|
||||
|
@ -495,7 +495,7 @@ public class AttendanceJgwTask {
|
|||
if(arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
SurProjectAttendanceGroup group=SurProjectAttendanceGroup.createJgw(json);
|
||||
SurProjectAttendanceGroup group=SurProjectAttendanceGroup.createJgw(json,true);
|
||||
group.setBizLicense(json.getString("corpCode"));
|
||||
String type=json.getString("corpType");
|
||||
if("009".equals(type)){ //总包人员
|
||||
|
@ -771,7 +771,7 @@ public class AttendanceJgwTask {
|
|||
/**
|
||||
* 查询参建单位
|
||||
* @param jo
|
||||
* @param l
|
||||
* @param startId
|
||||
* @param it
|
||||
*/
|
||||
private void doSyncProContractor(JSONObject jo, long startId, SurProjectAttendanceCfg it) {
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
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.web.bind.annotation.*;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* 微信openId绑定
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2023-08-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wxAuth")
|
||||
public class WxAuthController 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 {
|
||||
/*当用户同意授权后,会回调所设置的url并把authorization code传过来,
|
||||
然后用这个code获得access token,其中也包含用户的openid等信息*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.yanzhu.jh.wxsetting.service;
|
||||
|
||||
/**
|
||||
* 微信消息推送
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2023-08-24
|
||||
*/
|
||||
public interface wxMessageService {
|
||||
|
||||
}
|
Loading…
Reference in New Issue