Commit 840a7088 authored by hkl's avatar hkl

Merge branch 'dev' into 'master'

Dev

See merge request !7
parents 06358b81 10ff90f5
......@@ -22,10 +22,6 @@
<artifactId>TinyPinyin</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-local-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
......
......@@ -22,7 +22,7 @@ public class CodeGenerate {
System.out.println("projectPath = " + projectPath);
// 输出目录
String outputDir = projectPath + "\\jeecg-module-system\\jeecg-system-biz\\src\\main\\java\\";
String outputDir = projectPath + "\\jeecg-module-system\\src\\main\\java\\";
// 模块名
String moduleName = "deviceAsset";
......
package org.jeecg.config.jimureport;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.SysUserCacheInfo;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* 自定义积木报表鉴权(如果不进行自定义,则所有请求不做权限控制)
* * 1.自定义获取登录token
* * 2.自定义获取登录用户
* @author: jeecg-boot
*/
@Slf4j
@Component
public class JimuReportTokenService implements JmReportTokenServiceI {
@Autowired
private SysBaseApiImpl sysBaseApi;
@Autowired
@Lazy
private RedisUtil redisUtil;
@Override
public String getToken(HttpServletRequest request) {
return TokenUtils.getTokenByRequest(request);
}
@Override
public String getUsername(String token) {
return JwtUtil.getUsername(token);
}
@Override
public Boolean verifyToken(String token) {
return TokenUtils.verifyToken(token, sysBaseApi, redisUtil);
}
@Override
public Map<String, Object> getUserInfo(String token) {
Map<String, Object> map = new HashMap(5);
String username = JwtUtil.getUsername(token);
//此处通过token只能拿到一个信息 用户账号 后面的就是根据账号获取其他信息 查询数据或是走redis 用户根据自身业务可自定义
SysUserCacheInfo userInfo = null;
try {
userInfo = sysBaseApi.getCacheUser(username);
} catch (Exception e) {
log.error("获取用户信息异常:"+ e.getMessage());
return map;
}
//设置账号名
map.put(SYS_USER_CODE, userInfo.getSysUserCode());
//设置部门编码
map.put(SYS_ORG_CODE, userInfo.getSysOrgCode());
// 将所有信息存放至map 解析sql/api会根据map的键值解析
return map;
}
}
......@@ -24,14 +24,14 @@ import java.util.Date;
import java.util.Map;
/**
* @Description: 发送系统消息
* @Author: wangshuai
* @Date: 2022年3月22日 18:48:20
*/
* @Description: 发送系统消息
* @Author: wangshuai
* @Date: 2022年3月22日 18:48:20
*/
@Component("systemSendMsgHandle")
public class SystemSendMsgHandle implements ISendMsgHandle {
public static final String FROM_USER="system";
public static final String FROM_USER = "system";
@Resource
private SysAnnouncementMapper sysAnnouncementMapper;
......@@ -47,22 +47,24 @@ public class SystemSendMsgHandle implements ISendMsgHandle {
/**
* 该方法会发送3种消息:系统消息、企业微信 钉钉
*
* @param esReceiver 发送人
* @param esTitle 标题
* @param esContent 内容
* @param esTitle 标题
* @param esContent 内容
*/
@Override
public void sendMsg(String esReceiver, String esTitle, String esContent) {
if(oConvertUtils.isEmpty(esReceiver)){
throw new JeecgBootException("被发送人不能为空");
if (oConvertUtils.isEmpty(esReceiver)) {
throw new JeecgBootException("被发送人不能为空");
}
ISysBaseAPI sysBaseApi = SpringContextUtils.getBean(ISysBaseAPI.class);
MessageDTO messageDTO = new MessageDTO(FROM_USER,esReceiver,esTitle,esContent);
MessageDTO messageDTO = new MessageDTO(FROM_USER, esReceiver, esTitle, esContent);
sysBaseApi.sendSysAnnouncement(messageDTO);
}
/**
* 仅发送系统消息
*
* @param messageDTO
*/
@Override
......@@ -71,24 +73,24 @@ public class SystemSendMsgHandle implements ISendMsgHandle {
String title = messageDTO.getTitle();
String content = messageDTO.getContent();
String fromUser = messageDTO.getFromUser();
Map<String,Object> data = messageDTO.getData();
Map<String, Object> data = messageDTO.getData();
String[] arr = messageDTO.getToUser().split(",");
for(String username: arr){
for (String username : arr) {
doSend(title, content, fromUser, username, data);
}
}
private void doSend(String title, String msgContent, String fromUser, String toUser, Map<String, Object> data){
private void doSend(String title, String msgContent, String fromUser, String toUser, Map<String, Object> data) {
SysAnnouncement announcement = new SysAnnouncement();
if(data!=null){
if (data != null) {
//摘要信息
Object msgAbstract = data.get(CommonConstant.NOTICE_MSG_SUMMARY);
if(msgAbstract!=null){
if (msgAbstract != null) {
announcement.setMsgAbstract(msgAbstract.toString());
}
// 任务节点ID
Object taskId = data.get(CommonConstant.NOTICE_MSG_BUS_ID);
if(taskId!=null){
if (taskId != null) {
announcement.setBusId(taskId.toString());
announcement.setBusType(Vue3MessageHrefEnum.BPM_TASK.getBusType());
}
......@@ -108,10 +110,10 @@ public class SystemSendMsgHandle implements ISendMsgHandle {
String userId = toUser;
String[] userIds = userId.split(",");
String anntId = announcement.getId();
for(int i=0;i<userIds.length;i++) {
if(oConvertUtils.isNotEmpty(userIds[i])) {
for (int i = 0; i < userIds.length; i++) {
if (oConvertUtils.isNotEmpty(userIds[i])) {
SysUser sysUser = userMapper.getUserByName(userIds[i]);
if(sysUser==null) {
if (sysUser == null) {
continue;
}
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
......
......@@ -30,21 +30,12 @@ package ${package.Entity};
@Accessors(chain = true)
</#if>
</#if>
<#if table.convert>
@TableName("${schemaName}${table.name}")
</#if>
<#if swagger>
@ApiModel(value = "${entity}对象", description = "${table.comment!}")
</#if>
<#if superEntityClass??>
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
public class ${entity} extends Model<${entity}> {
<#elseif entitySerialVersionUID>
public class ${entity} implements Serializable {
<#else>
public class ${entity} {
</#if>
public class ${entity}DTO {
<#if entitySerialVersionUID>
private static final long serialVersionUID = 1L;
......@@ -64,26 +55,6 @@ package ${package.Entity};
*/
</#if>
</#if>
<#if field.keyFlag>
<#-- 主键 -->
<#if field.keyIdentityFlag>
@TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
<#elseif idType??>
@TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
<#elseif field.convert>
@TableId("${field.annotationColumnName}")
</#if>
<#-- 普通字段 -->
<#elseif field.fill??>
<#-- ----- 存在字段填充设置 ----->
<#if field.convert>
@TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
<#else>
@TableField(fill = FieldFill.${field.fill})
</#if>
<#elseif field.convert>
@TableField("${field.annotationColumnName}")
</#if>
<#-- 乐观锁注解 -->
<#if field.versionField>
@Version
......
......@@ -30,21 +30,12 @@ package ${package.Entity};
@Accessors(chain = true)
</#if>
</#if>
<#if table.convert>
@TableName("${schemaName}${table.name}")
</#if>
<#if swagger>
@ApiModel(value = "${entity}对象", description = "${table.comment!}")
</#if>
<#if superEntityClass??>
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
public class ${entity} extends Model<${entity}> {
<#elseif entitySerialVersionUID>
public class ${entity} implements Serializable {
<#else>
public class ${entity} {
</#if>
public class ${entity}VO {
<#if entitySerialVersionUID>
private static final long serialVersionUID = 1L;
......
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