v3.7.2 版本代码合并

This commit is contained in:
JEECG
2024-12-09 15:10:46 +08:00
parent 64b29f47e0
commit b0c4194602
118 changed files with 12729 additions and 1596 deletions

View File

@ -5,12 +5,15 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.enums.MessageTypeEnum;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.StaticConfig;
import org.jeecg.modules.message.entity.SysMessage;
import org.jeecg.modules.message.handle.ISendMsgHandle;
import org.jeecg.modules.message.mapper.SysMessageMapper;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,6 +46,9 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
@Autowired
private RedisUtil redisUtil;
@Autowired
private SysMessageMapper sysMessageMapper;
/**
* 真实姓名变量
@ -78,6 +84,23 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
@Override
public void sendMessage(MessageDTO messageDTO) {
String content = messageDTO.getContent();
String title = messageDTO.getTitle();
//update-begin---author:wangshuai---date:2024-11-20---for:【QQYUN-8523】敲敲云发邮件通知不稳定---
boolean timeJobSendEmail = this.isTimeJobSendEmail(messageDTO.getToUser(), title, content);
if(timeJobSendEmail){
return;
}
//update-end---author:wangshuai---date:2024-11-20---for:【QQYUN-8523】敲敲云发邮件通知不稳定---
this.sendEmailMessage(messageDTO);
}
/**
* 直接发送邮件
*
* @param messageDTO
*/
public void sendEmailMessage(MessageDTO messageDTO) {
String[] arr = messageDTO.getToUser().split(",");
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<SysUser>().in(SysUser::getUsername, arr);
List<SysUser> list = sysUserMapper.selectList(query);
@ -213,4 +236,35 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 1 / 1000);
return token;
}
/**
* 是否定时发送邮箱
* @param toUser
* @param title
* @param content
* @return
*/
private boolean isTimeJobSendEmail(String toUser, String title, String content) {
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
Boolean timeJobSend = staticConfig.getTimeJobSend();
if(null != timeJobSend && timeJobSend){
this.addSysSmsSend(toUser,title,content);
return true;
}
return false;
}
/**
* 保存到短信发送表
*/
private void addSysSmsSend(String toUser, String title, String content) {
SysMessage sysMessage = new SysMessage();
sysMessage.setEsTitle(title);
sysMessage.setEsContent(content);
sysMessage.setEsReceiver(toUser);
sysMessage.setEsSendStatus("0");
sysMessage.setEsSendNum(0);
sysMessage.setEsType(MessageTypeEnum.YJ.getType());
sysMessageMapper.insert(sysMessage);
}
}

View File

@ -51,6 +51,9 @@ public class SendMsgJob implements Job {
md.setToUser(sysMessage.getEsReceiver());
md.setType(sysMessage.getEsType());
md.setToAll(false);
//update-begin---author:wangshuai---date:2024-11-12---for:【QQYUN-8523】敲敲云发邮件通知不稳定---
md.setIsTimeJob(true);
//update-end---author:wangshuai---date:2024-11-12---for:【QQYUN-8523】敲敲云发邮件通知不稳定---
sysBaseAPI.sendTemplateMessage(md);
//发送消息成功
sysMessage.setEsSendStatus(SendMsgStatusEnum.SUCCESS.getCode());

View File

@ -18,7 +18,7 @@ import static org.springframework.boot.actuate.endpoint.annotation.Selector.Matc
* @Date: 2024/5/13 17:02
*/
@Component
@Endpoint(id = "httptrace-new")
@Endpoint(id = "jeecghttptrace")
public class CustomHttpTraceEndpoint{
private final CustomInMemoryHttpTraceRepository repository;

View File

@ -1276,12 +1276,6 @@ public class SysUserController {
updateUser.setUpdateBy(JwtUtil.getUserNameByToken(request));
updateUser.setUpdateTime(new Date());
sysUserService.revertLogicDeleted(Arrays.asList(userIds.split(",")), updateUser);
// 用户变更,触发同步工作流
List<String> userNameList = sysUserService.userIdToUsername(Arrays.asList(userIds.split(",")));
if (!userNameList.isEmpty()) {
String joinedString = String.join(",", userNameList);
}
}
return Result.ok("还原成功");
}

View File

@ -557,4 +557,64 @@ public class ThirdLoginController {
}
}
}
/**
* 新版钉钉登录
*
* @param authCode
* @param state
* @param tenantId
* @param response
* @return
*/
@ResponseBody
@GetMapping("/oauth2/dingding/login")
public String OauthDingDingLogin(@RequestParam(value = "authCode", required = false) String authCode,
@RequestParam("state") String state,
@RequestParam(name = "tenantId",defaultValue = "0") String tenantId,
HttpServletResponse response) {
SysUser loginUser = thirdAppDingtalkService.oauthDingDingLogin(authCode,Integer.valueOf(tenantId));
try {
String redirect = "";
if (state.indexOf("?") > 0) {
String[] arr = state.split("\\?");
state = arr[0];
if(arr.length>1){
redirect = arr[1];
}
}
String token = saveToken(loginUser);
state += "/oauth2-app/login?oauth2LoginToken=" + URLEncoder.encode(token, "UTF-8") + "&tenantId=" + URLEncoder.encode(tenantId, "UTF-8");
state += "&thirdType=DINGTALK";
if (redirect != null && redirect.length() > 0) {
state += "&" + redirect;
}
log.info("OAuth2登录重定向地址: " + state);
try {
response.sendRedirect(state);
return "ok";
} catch (IOException e) {
log.error(e.getMessage(),e);
return "重定向失败";
}
} catch (UnsupportedEncodingException e) {
log.error(e.getMessage(),e);
return "解码失败";
}
}
/**
* 获取企业id和应用id
* @param tenantId
* @return
*/
@ResponseBody
@GetMapping("/get/corpId/clientId")
public Result<SysThirdAppConfig> getCorpIdClientId(@RequestParam(value = "tenantId", defaultValue = "0") String tenantId){
Result<SysThirdAppConfig> result = new Result<>();
SysThirdAppConfig sysThirdAppConfig = thirdAppDingtalkService.getCorpIdClientId(Integer.valueOf(tenantId));
result.setSuccess(true);
result.setResult(sysThirdAppConfig);
return result;
}
}

View File

@ -51,10 +51,10 @@ public class SysThirdAppConfig {
@ApiModelProperty(value = "钉钉/企业微信应用id对应的秘钥")
private String clientSecret;
/**企业微信自建应用Secret*/
@Excel(name = "企业微信自建应用Secret", width = 15)
@ApiModelProperty(value = "企业微信自建应用Secret")
private String agentAppSecret;
/**钉钉企业id*/
@Excel(name = "钉钉企业id", width = 15)
@ApiModelProperty(value = "钉钉企业id")
private String corpId;
/**第三方类别(dingtalk 钉钉 wechat_enterprise 企业微信)*/
@Excel(name = "第三方类别(dingtalk 钉钉 wechat_enterprise 企业微信)", width = 15)

View File

@ -443,4 +443,19 @@ public interface ISysUserService extends IService<SysUser> {
* @param ipAddress ip地址
*/
void sendChangePhoneSms(JSONObject jsonObject, String username, String ipAddress);
/**
* 发送注销用户手机号验证密码[敲敲云专用]
* @param jsonObject
* @param username
* @param ipAddress
*/
void sendLogOffPhoneSms(JSONObject jsonObject, String username, String ipAddress);
/**
* 用户注销[敲敲云专用]
* @param jsonObject
* @param username
*/
void userLogOff(JSONObject jsonObject, String username);
}

View File

@ -1597,7 +1597,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
// 邮件消息要解析Markdown
message.setContent(HTMLUtils.parseMarkdown(message.getContent()));
}
emailSendMsgHandle.sendMessage(message);
//update-begin---author:wangshuai---date:2024-11-20---for:【QQYUN-8523】敲敲云发邮件通知不稳定---
if(message.getIsTimeJob() != null && message.getIsTimeJob()){
emailSendMsgHandle.sendEmailMessage(message);
}else{
emailSendMsgHandle.sendMessage(message);
}
//update-end---author:wangshuai---date:2024-11-20---for:【QQYUN-8523】敲敲云发邮件通知不稳定---
}else if(MessageTypeEnum.DD.getType().equals(messageType)){
ddSendMsgHandle.sendMessage(message);
}else if(MessageTypeEnum.QYWX.getType().equals(messageType)){

View File

@ -1978,15 +1978,50 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
}
//step4 发送短信验证码
this.sendPhoneSms(phone, ipAddress);
String redisKey = CommonConstant.CHANGE_PHONE_REDIS_KEY_PRE+phone;
this.sendPhoneSms(phone, ipAddress,redisKey);
}
@Override
public void sendLogOffPhoneSms(JSONObject jsonObject, String username, String ipAddress) {
String phone = jsonObject.getString("phone");
//通过用户名查询数据库中的手机号
SysUser userByNameAndPhone = userMapper.getUserByNameAndPhone(phone, username);
if (null == userByNameAndPhone) {
throw new JeecgBootException("当前用户手机号不匹配,无法修改!");
}
String code = CommonConstant.LOG_OFF_PHONE_REDIS_KEY_PRE + phone;
this.sendPhoneSms(phone, ipAddress, code);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void userLogOff(JSONObject jsonObject, String username) {
String phone = jsonObject.getString("phone");
String smsCode = jsonObject.getString("smscode");
//通过用户名查询数据库中的手机号
SysUser userByNameAndPhone = userMapper.getUserByNameAndPhone(phone, username);
if (null == userByNameAndPhone) {
throw new JeecgBootException("当前用户手机号不匹配,无法注销!");
}
String code = CommonConstant.LOG_OFF_PHONE_REDIS_KEY_PRE + phone;
Object redisSmdCode = redisUtil.get(code);
if (null == redisSmdCode) {
throw new JeecgBootException("验证码失效,无法注销!");
}
if (!redisSmdCode.toString().equals(smsCode)) {
throw new JeecgBootException("验证码不匹配,无法注销!");
}
this.deleteUser(userByNameAndPhone.getId());
redisUtil.removeAll(code);
redisUtil.removeAll(CacheConstant.SYS_USERS_CACHE + phone);
}
/**
* 发送短信验证码
* @param phone
*/
private void sendPhoneSms(String phone, String clientIp) {
String redisKey = CommonConstant.CHANGE_PHONE_REDIS_KEY_PRE+phone;
private void sendPhoneSms(String phone, String clientIp,String redisKey) {
Object object = redisUtil.get(redisKey);
if (object != null) {

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jeecg.dingtalk.api.base.JdtBaseAPI;
import com.jeecg.dingtalk.api.core.response.Response;
import com.jeecg.dingtalk.api.core.util.HttpUtil;
import com.jeecg.dingtalk.api.core.vo.AccessToken;
import com.jeecg.dingtalk.api.core.vo.PageResult;
import com.jeecg.dingtalk.api.department.JdtDepartmentAPI;
@ -46,10 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@ -1254,4 +1252,57 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
}
}
}
//=================================== begin 新版钉钉登录 ============================================
/**
* 钉钉登录获取用户信息
* 【QQYUN-9421】钉钉登录后打开了敲敲云换其他账号登录后再打开敲敲云显示的是原来账号的应用
* @param authCode
* @param tenantId
* @return
*/
public SysUser oauthDingDingLogin(String authCode, Integer tenantId) {
Long count = tenantMapper.tenantIzExist(tenantId);
if(ObjectUtil.isEmpty(count) || 0 == count){
throw new JeecgBootException("租户不存在!");
}
SysThirdAppConfig config = configMapper.getThirdConfigByThirdType(tenantId, MessageTypeEnum.DD.getType());
String accessToken = this.getTenantAccessToken(config);
if(StringUtils.isEmpty(accessToken)){
throw new JeecgBootBizTipException("accessToken获取失败");
}
String getUserInfoUrl = "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=" + accessToken;
Map<String,String> params = new HashMap<>();
params.put("code",authCode);
Response<JSONObject> userInfoResponse = HttpUtil.post(getUserInfoUrl, JSON.toJSONString(params));
if (userInfoResponse.isSuccess()) {
String userId = userInfoResponse.getResult().getString("userid");
// 判断第三方用户表有没有这个人
LambdaQueryWrapper<SysThirdAccount> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysThirdAccount::getThirdType, THIRD_TYPE);
queryWrapper.eq(SysThirdAccount::getTenantId, tenantId);
queryWrapper.and((wrapper)->wrapper.eq(SysThirdAccount::getThirdUserUuid,userId).or().eq(SysThirdAccount::getThirdUserId,userId));
SysThirdAccount thirdAccount = sysThirdAccountService.getOne(queryWrapper);
if (thirdAccount != null) {
return this.getSysUserByThird(thirdAccount, null, userId, accessToken, tenantId);
}else{
throw new JeecgBootException("该用户没有同步,请先同步!");
}
}
return null;
}
/**
* 根据租户id获取企业id和应用id
* 【QQYUN-9421】钉钉登录后打开了敲敲云换其他账号登录后再打开敲敲云显示的是原来账号的应用
* @param tenantId
*/
public SysThirdAppConfig getCorpIdClientId(Integer tenantId) {
LambdaQueryWrapper<SysThirdAppConfig> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysThirdAppConfig::getThirdType, THIRD_TYPE);
queryWrapper.eq(SysThirdAppConfig::getTenantId, tenantId);
queryWrapper.select(SysThirdAppConfig::getCorpId,SysThirdAppConfig::getClientId);
return configMapper.selectOne(queryWrapper);
}
//=================================== end 新版钉钉登录 ============================================
}

View File

@ -119,12 +119,9 @@ public class ThirdAppWechatEnterpriseServiceImpl implements IThirdAppService {
public String getAppAccessToken(SysThirdAppConfig config) {
//update-begin---author:wangshuai ---date:20230224 for[QQYUN-3440]新建企业微信和钉钉配置表,通过租户模式隔离------------
String corpId = config.getClientId();
String secret = config.getAgentAppSecret();
// 如果没有配置APP秘钥就说明是老企业可以通用秘钥
if (oConvertUtils.isEmpty(secret)) {
secret = config.getClientSecret();
String secret = config.getClientSecret();
//update-end---author:wangshuai ---date:20230224 for[QQYUN-3440]新建企业微信和钉钉配置表,通过租户模式隔离------------
}
AccessToken accessToken = JwAccessTokenAPI.getAccessToken(corpId, secret);
if (accessToken != null) {

View File

@ -147,6 +147,7 @@
fixed:'right'
},
beforeFetch: (params) => {
params.hasQuery = "true";
return Object.assign(params, queryParam);
},
},

View File

@ -202,6 +202,7 @@
fixed: 'right',
},
beforeFetch: async (params) => {
params.hasQuery = "true";
<#if is_range>
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);

View File

@ -931,6 +931,11 @@ export const ${sub.entityName?uncap_first}JVxeColumns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType=='pca'>
type: JVxeTypes.pca,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='popup'>
<#if popupBackFields?length gt 0>
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">

View File

@ -858,6 +858,11 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType=='pca'>
type: JVxeTypes.pca,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='popup'>
<#if popupBackFields?length gt 0>
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">

View File

@ -187,6 +187,11 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType=='pca'>
type: JVxeTypes.pca,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='popup'>
<#if popupBackFields?length gt 0>
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">

View File

@ -53,9 +53,13 @@
</JFormContainer>
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" animated>
<a-tabs v-model:activeKey="activeKey" animated style="overflow:hidden;">
<#list subTables as sub><#rt/>
<#if sub.foreignRelationType =='1'>
<a-tab-pane class="sub-one-form" tab="${sub.ftlDescription}" key="${sub.entityName?uncap_first}" :forceRender="true">
<#else>
<a-tab-pane tab="${sub.ftlDescription}" key="${sub.entityName?uncap_first}" :forceRender="true">
</#if>
<#if sub.foreignRelationType =='1'>
<${Format.humpToShortbar(sub.entityName)}-form ref="${sub.entityName?uncap_first}FormRef" :disabled="disabled"></${Format.humpToShortbar(sub.entityName)}-form>
<#else>
@ -354,4 +358,9 @@
}
});
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
.ant-tabs-tabpane.sub-one-form {
max-height: 340px;
overflow: auto;
}
</style>

View File

@ -179,11 +179,6 @@
}
});
</script>
<style lang="less" scoped>
.antd-modal-form {
max-height: 340px;
overflow: auto;
}
</style>
<style lang="less" scoped></style>
</#if>
</#list>

View File

@ -871,6 +871,11 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType=='pca'>
type: JVxeTypes.pca,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='popup'>
<#if popupBackFields?length gt 0>
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">

View File

@ -17,7 +17,7 @@ management:
endpoints:
web:
exposure:
include: metrics,httptrace-new
include: metrics,jeecghttptrace
spring:
# flyway配置
@ -48,6 +48,8 @@ spring:
max-file-size: 10MB
max-request-size: 10MB
mail:
# 定时任务发送邮件
timeJobSend: false
host: smtp.163.com
username: jeecgos@163.com
password: ??
@ -226,6 +228,18 @@ jeecg:
secretKey: ??
endpoint: oss-cn-beijing.aliyuncs.com
bucketName: jeecgdev
# 短信模板
sms-template:
# 签名
signature:
# 模板code
templateCode:
# 登录短信、忘记密码模板编码
SMS_175435174:
# 修改密码短信模板编码
SMS_465391221:
# 注册账号短信模板编码
SMS_175430166:
# ElasticSearch 6设置
elasticsearch:
cluster-name: jeecg-ES

View File

@ -17,7 +17,7 @@ management:
endpoints:
web:
exposure:
include: metrics,httptrace-new
include: metrics,jeecghttptrace
spring:
# flyway配置
@ -48,6 +48,8 @@ spring:
max-file-size: 10MB
max-request-size: 10MB
mail:
# 定时任务发送邮件
timeJobSend: false
host: smtp.163.com
username: jeecgos@163.com
password: ??
@ -227,6 +229,18 @@ jeecg:
endpoint: oss-cn-beijing.aliyuncs.com
bucketName: jeecgdev
staticDomain: https://static.jeecg.com
# 短信模板
sms-template:
# 签名
signature:
# 模板code
templateCode:
# 登录短信、忘记密码模板编码
SMS_175435174:
# 修改密码短信模板编码
SMS_465391221:
# 注册账号短信模板编码
SMS_175430166:
# ElasticSearch 设置
elasticsearch:
cluster-name: jeecg-ES

View File

@ -17,7 +17,7 @@ management:
endpoints:
web:
exposure:
include: metrics,httptrace-new
include: metrics,jeecghttptrace
spring:
# flyway配置
@ -48,6 +48,8 @@ spring:
max-file-size: 10MB
max-request-size: 10MB
mail:
# 定时任务发送邮件
timeJobSend: false
host: smtp.163.com
username: jeecgos@163.com
password: ??
@ -227,6 +229,18 @@ jeecg:
endpoint: oss-cn-beijing.aliyuncs.com
bucketName: jeecgdev
staticDomain: https://static.jeecg.com
# 短信模板
sms-template:
# 签名
signature:
# 模板code
templateCode:
# 登录短信、忘记密码模板编码
SMS_175435174:
# 修改密码短信模板编码
SMS_465391221:
# 注册账号短信模板编码
SMS_175430166:
# ElasticSearch 设置
elasticsearch:
cluster-name: jeecg-ES

View File

@ -0,0 +1,9 @@
-- ---author:wangshuai---date:20241108-----for: 修改字段变更为为钉钉企业id---
ALTER TABLE sys_third_app_config
CHANGE COLUMN agent_app_secret corp_id varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '钉钉企业id' AFTER client_secret;
UPDATE `sys_gateway_route` SET `predicates` = '[{\"args\":[\"/websocket/**\",\"/eoaSocket/**\",\"/newsWebsocket/**\",\"/dragChannelSocket/**\"],\"name\":\"Path\"}]' WHERE `id` = 'jeecg-cloud-websocket';
-- ---author:sunjianlei---date:20240930-----for: 【TV360X-2604】【Online表单】按钮权限未激活时增加提示添加查询索引 ---
ALTER TABLE onl_auth_page ADD INDEX idx_onl_auth_page_code(code);
ALTER TABLE onl_auth_page ADD INDEX idx_onl_auth_page_cgform_id(cgform_id);