1.增加从缓存获取员工 2.debug的日志调整.
This commit is contained in:
parent
3ce2d6ffa5
commit
ec38f76403
|
|
@ -8,6 +8,7 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
/**
|
||||
|
|
@ -40,4 +41,17 @@ public class RedisConfig extends CachingConfigurerSupport
|
|||
template.afterPropertiesSet();
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean
|
||||
/**
|
||||
* 获取监听容器
|
||||
* @param connectionFactory
|
||||
* @return
|
||||
*/
|
||||
public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory connectionFactory) {
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(connectionFactory);
|
||||
return container;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,12 +77,35 @@
|
|||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- nutz used nutmap-->
|
||||
<dependency>
|
||||
<groupId>org.nutz</groupId>
|
||||
<artifactId>nutz</artifactId>
|
||||
<version>1.r.69.20210929</version>
|
||||
</dependency>
|
||||
<!-- ehcache -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.vaadin.external.google</groupId>
|
||||
<artifactId>android-json</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ public class BulletinRecive extends BaseEntity
|
|||
/** 接收员工ID */
|
||||
@Excel(name = "接收员工ID")
|
||||
private Long reciveUserId;
|
||||
/**
|
||||
* 接收部门ID
|
||||
*/
|
||||
private Long reciveDeptId;
|
||||
|
||||
/** 阅读时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
@ -49,7 +53,15 @@ public class BulletinRecive extends BaseEntity
|
|||
@Excel(name = "A:已阅读,B:已删除 C:未阅读")
|
||||
private String sts;
|
||||
|
||||
/**
|
||||
|
||||
|
||||
public Long getReciveDeptId() {
|
||||
return reciveDeptId;
|
||||
}
|
||||
public void setReciveDeptId(Long reciveDeptId) {
|
||||
this.reciveDeptId = reciveDeptId;
|
||||
}
|
||||
/**
|
||||
* 设置 ReciveId
|
||||
* @param 接收ID
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.cache.service.IOrgCacheService;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -23,8 +24,7 @@ import com.ruoyi.system.mapper.BulletinInfoMapper;
|
|||
import com.ruoyi.system.mapper.BulletinReciveMapper;
|
||||
import com.ruoyi.system.domain.BulletinInfo;
|
||||
import com.ruoyi.system.service.IBulletinInfoService;
|
||||
|
||||
import ecc.c3.util.IDUtil;
|
||||
import com.ruoyi.util.IDUtil;
|
||||
|
||||
/**
|
||||
* 公告栏Service业务层处理
|
||||
|
|
@ -40,6 +40,8 @@ public class BulletinInfoServiceImpl implements IBulletinInfoService
|
|||
private BulletinInfoMapper bulletinInfoMapper;
|
||||
@Autowired
|
||||
private BulletinReciveMapper bulletinReciveMapper;
|
||||
@Autowired
|
||||
private IOrgCacheService orgCacheService;
|
||||
|
||||
/**
|
||||
* 查询公告栏
|
||||
|
|
@ -52,9 +54,8 @@ public class BulletinInfoServiceImpl implements IBulletinInfoService
|
|||
{
|
||||
List<BulletinRecive> reciveUserIdAndbulletinId=bulletinReciveMapper.selectBulletinReciveUserIdByBulletinIds(new String[] {bulletinId});
|
||||
BulletinInfo info= bulletinInfoMapper.selectBulletinInfoByBulletinId(bulletinId);
|
||||
//TODO 把员工换算成名称
|
||||
info.setCreateBy(info.getCreateUserId()+"");
|
||||
info.setUpdateBy(info.getUpdateUserId()+"");
|
||||
info.setCreateBy(orgCacheService.getSysUser(info.getCreateUserId()).map(sysUser->sysUser.getUserName()).orElse(""));
|
||||
info.setUpdateBy(orgCacheService.getSysUser(info.getUpdateUserId()).map(sysUser->sysUser.getUserName()).orElse(""));
|
||||
List<Long> reciveUserIdList=reciveUserIdAndbulletinId.stream().map(userId->userId.getReciveUserId()).collect(Collectors.toList());
|
||||
info.setReceiveStaffIds(reciveUserIdList);
|
||||
info.setReciveStaffNames(StringUtils.join(reciveUserIdList.iterator(), ","));
|
||||
|
|
@ -78,13 +79,14 @@ public class BulletinInfoServiceImpl implements IBulletinInfoService
|
|||
final NutMap reciveBulletinReciveMap=NutMap.NEW();
|
||||
List<BulletinRecive> reciveUserIdAndbulletinIdList=bulletinReciveMapper.selectBulletinReciveUserIdByBulletinIds(bulletinIds);
|
||||
reciveUserIdAndbulletinIdList.forEach(reciveUserIdAndBulletinId->{
|
||||
//TODO 这里要把reciveUserId换算成用户名
|
||||
reciveUserNameMap.addv2(reciveUserIdAndBulletinId.getBulletinId(), reciveUserIdAndBulletinId.getReciveUserId()+"");
|
||||
String reciveUserName=orgCacheService.getSysUser(reciveUserIdAndBulletinId.getReciveUserId()).map(sysUser->sysUser.getUserName()).orElse("");
|
||||
reciveUserNameMap.addv2(reciveUserIdAndBulletinId.getBulletinId(), reciveUserName);
|
||||
reciveBulletinReciveMap.addv2(reciveUserIdAndBulletinId.getBulletinId(), reciveUserIdAndBulletinId);
|
||||
});
|
||||
list.forEach(info->{
|
||||
String reciveStaffNames=String.join(",", reciveUserNameMap.getList(info.getBulletinId(), String.class, Collections.emptyList()));
|
||||
info.setReciveStaffNames(reciveStaffNames);
|
||||
info.setCreateBy(orgCacheService.getSysUser(info.getCreateUserId()).map(sysUser->sysUser.getUserName()).orElse(""));
|
||||
info.setBulletinReciveList(reciveBulletinReciveMap.getList(info.getBulletinId(), BulletinRecive.class,Collections.emptyList()));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cache.service.IOrgCacheService;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
|
||||
|
|
@ -30,6 +31,8 @@ public class BulletinReciveServiceImpl implements IBulletinReciveService
|
|||
private BulletinReciveMapper bulletinReciveMapper;
|
||||
@Autowired
|
||||
private BulletinInfoMapper bulletinInfoMapper;
|
||||
@Autowired
|
||||
private IOrgCacheService orgCacheService;
|
||||
|
||||
@Transactional
|
||||
/**
|
||||
|
|
@ -67,6 +70,12 @@ public class BulletinReciveServiceImpl implements IBulletinReciveService
|
|||
if(reciveList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
reciveList.forEach(recive->{
|
||||
orgCacheService.getSysUser(recive.getReciveUserId()).ifPresent(cacheSysUser->{
|
||||
recive.setCreateBy(cacheSysUser.getUserName());
|
||||
recive.setReciveDeptId(cacheSysUser.getDeptId());
|
||||
});
|
||||
});
|
||||
NutMap map=NutMap.NEW();
|
||||
String[] bulletinIds=new String[reciveList.size()];
|
||||
for (int i = 0; i < bulletinIds.length; i++) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.cache.domain.CacheSysDept;
|
||||
import com.ruoyi.cache.service.IOrgCacheService;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
|
@ -34,6 +37,8 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
@Autowired
|
||||
private IOrgCacheService orgCacheService;
|
||||
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
|
|
@ -218,7 +223,12 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
return deptMapper.insertDept(dept);
|
||||
int updateCount= deptMapper.insertDept(dept);
|
||||
if(updateCount>0) {
|
||||
CacheSysDept cacheDept=new CacheSysDept(dept);
|
||||
orgCacheService.saveDeptInfo(cacheDept);
|
||||
}
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -246,6 +256,10 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||
updateParentDeptStatusNormal(dept);
|
||||
}
|
||||
if(result>0) {
|
||||
CacheSysDept cacheDept=new CacheSysDept(dept);
|
||||
orgCacheService.saveDeptInfo(cacheDept);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ecc.c3.util;
|
||||
package com.ruoyi.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ecc.c3.util;
|
||||
package com.ruoyi.util;
|
||||
|
||||
/**
|
||||
* Twitter_Snowflake<br>
|
||||
|
|
@ -94,6 +94,13 @@
|
|||
<logger name="io.lettuce" level="info" />
|
||||
<logger name="druid.sql" level="info" />
|
||||
<logger name="org.mybatis" level="info" />
|
||||
<logger name="io.micrometer" level="info" />
|
||||
<logger name="com.baomidou" level="info" />
|
||||
<logger name="io.netty" level="info" />
|
||||
<logger name="net.sf" level="info" />
|
||||
<logger name="org.reflections" level="info" />
|
||||
|
||||
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="com.ruoyi.system.mapper" level="debug" />
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue