* 'dev' of http://192.168.124.50/wangliwen/share-platform: (26 commits)
  部门名称模糊查询、分页数量bug
  能力统计详情 资源名称模糊查询与缓存
  统计详情增加资源名称筛选
  创建show分支
  1.个人中心-浏览记录查询条件按组件类型细分 2.全局搜索去除视频资源搜索结果统计
  ...
  导出 与界面内容一致
  全局格式化
  ...
  全局数量排序
  会议室改为会客厅、首页统计顺序
  减少数据资源接口调用超时日志输出
  。。。
  屮
  配置是否发送亚微消息
  1.能力使用申请应用系统查询增加查询自己部门上架应用限制 2.能力使用统计时间错误bug 3.部门列表查询bug修复
  部门分页、url前缀改为ucs-admin
  区域部门管理员只出本区域部门信息
  ...
  ...
  ...
This commit is contained in:
huangweixiong 2022-11-04 15:29:34 +08:00
commit d86766de4e
26 changed files with 340 additions and 54 deletions

View File

@ -16,6 +16,8 @@ import io.renren.modules.resource.excel.census.config.CustomCellWriteHeightConfi
import io.renren.modules.resource.excel.census.config.CustomCellWriteWeightConfig;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceBrowse.service.ResourceBrowseService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
@ -472,9 +474,18 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "资源类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "resourceName", value = "资源名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
})
public Result selectCensusResourceTable(@RequestParam Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
}
// else if (SuperAdminEnum.YES.value() == user.getSuperAdmin()) { // 超级管理员
//
// }
return new Result().ok(resourceService.selectCensusResourceTable(params));
}
@ -489,6 +500,14 @@ public class CensusController {
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
})
public void exportSelectCensusResourceTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
}
// else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
//
// }
ArrayList<Map> resultList = (ArrayList<Map>) resourceDao.selectCensusResourceTable(params);
List<List<Object>> date = resultList.stream().map(index -> {
List<Object> data = new ArrayList<>();
@ -539,9 +558,18 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "资源类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "resourceName", value = "资源名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
})
public Result selectCensusApplyTable(@RequestParam Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
}
// else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
//
// }
return new Result().ok(resourceService.selectCensusApplyTable(params));
}
@ -556,6 +584,14 @@ public class CensusController {
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
})
public void exportSelectCensusApplyTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
UserDetail user = SecurityUser.getUser();
if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
}
// else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
//
// }
ArrayList<Map> resultList = (ArrayList<Map>) resourceDao.selectCensusApplyTable(params);
List<List<Object>> date = resultList.stream().map(index -> {
List<Object> data = new ArrayList<>();

View File

@ -56,14 +56,14 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl<SysLogOperationD
.like(StringUtils.isNotBlank(operation), "operation", operation)
.between(StringUtils.isNotBlank(startDate), "create_date", startDate, endDate);
if (params.containsKey("operationType")) {
queryWrapper.ne("request_uri", "/renren-admin/resource/updateVisits");
queryWrapper.ne("request_uri", "/ucs-admin/resource/updateVisits");
if ("all".equals(operationType)) {
queryWrapper.and(wrapper ->
wrapper.like("request_uri", "/renren-admin/resource%/insert")
wrapper.like("request_uri", "/ucs-admin/resource%/insert")
.or()
.like("request_uri", "/renren-admin/resource%/update")
.like("request_uri", "/ucs-admin/resource%/update")
.or()
.like("request_uri", "/renren-admin/resource%/delete"));
.like("request_uri", "/ucs-admin/resource%/delete"));
} else {
queryWrapper.like(StringUtils.isNotBlank(operationType), "request_uri", operationType);
}

View File

@ -29,6 +29,7 @@ import org.apache.shiro.session.UnknownSessionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@ -65,6 +66,9 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
@Autowired
private NoticeUntil noticeUntil;
@Value("#{new Boolean(${notice.yawei})}")
private Boolean noticeYaWei; // 是否发送消息到亚微中心
@Override
public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<SysNoticeEntity> wrapper = new QueryWrapper<>();
@ -212,11 +216,15 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
MessageData<String> message = new MessageData<String>().msg(notice.getTitle());
webSocketServer.sendMessage(finalUserIdList, message);
}, executor).thenRunAsync(() -> {
if (noticeYaWei) {
try {
sendToYaweiUser(notice, finalUserIdList);
} catch (Exception exception) {
logger.error("", exception);
}
} else {
logger.info("无需发送到第三方 亚微消息");
}
}, executor);
}
}

View File

@ -203,6 +203,7 @@ public class ResourceController {
List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM tb_data_resource", Long.class);
ids.forEach(id -> {
ResourceDTO data = resourceService.selectWithAttrs(id);
data.setUpdateDate(new Date());
resourceService.update(data);
});
}, executor);
@ -718,4 +719,12 @@ public class ResourceController {
return new Result().ok(resourceService.getSquareList(jsonObject));
}
@GetMapping("/getAppListByDept")
@ApiOperation("/根据部门查询部门上架应用列表")
@LogOperation("/根据部门查询部门上架应用列表")
public Result getAppListByDept(String key) {
return new Result().ok(resourceService.getAppListByDept(key));
}
}

View File

@ -19,6 +19,8 @@ import java.util.Map;
*/
@Mapper
public interface ResourceDao extends BaseDao<ResourceEntity> {
static final String selectCensusResourceTableKey = "selectCensusResourceTable";
static final String selectCensusApplyTableKey = "selectCensusApplyTable";
Integer deleteByIds(@Param("ids") List<Long> idList);
@ -193,8 +195,10 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map<String, Object>> selectDeptDetailTypeCountList(Map params);
@Cacheable(value = selectCensusResourceTableKey, key = "#p0")
List<Map> selectCensusResourceTable(Map params);
@Cacheable(value = selectCensusApplyTableKey, key = "#p0")
List<Map> selectCensusApplyTable(Map params);
List<Map> selectCollectList(@Param("resourceType") String resourceType, @Param("attrType") String attrType);
@ -215,4 +219,6 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
Integer getSquareListCount(@Param("type") String type, @Param("deptType") Integer deptType, @Param("area") String area);
List<Map> getAppListByDept(@Param("deptId") Long deptId, @Param("key") String key);
}

View File

@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.Charset;
@ -77,6 +78,9 @@ public class TsingtaoDataResourceService extends AbstractDataResourceService {
result.put("data", objects);
return result;
} catch (ResourceAccessException e) {
logger.error("青岛市资源数据接口连接超时!!!");
return null;
} catch (Exception e) {
logger.error("青岛市资源数据调用失败!!!", e);
return null;

View File

@ -11,6 +11,7 @@ import okhttp3.Request;
import okhttp3.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.client.ResourceAccessException;
import java.util.concurrent.TimeUnit;
@ -47,8 +48,12 @@ public class TsingtaoXHADataResourceService extends AbstractDataResourceService
} else {
logger.error("西海岸数据资源列表获取失败");
}
} catch (Exception exception) {
logger.error("西海岸数据资源列表获取失败", exception);
} catch (ResourceAccessException e) {
logger.error("西海岸资源数据接口连接超时!!!");
return null;
} catch (Exception e) {
logger.error("西海岸资源数据调用失败!!!", e);
return null;
}
return result;
}

View File

@ -159,4 +159,7 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object getPotentialList();
Object getSquareList(JSONObject jsonObject);
Object getAppListByDept(String key);
}

View File

@ -45,10 +45,13 @@ import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dao.SysDeptDao;
import io.renren.modules.sys.dao.SysRegionDao;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.entity.SysDeptEntity;
import io.renren.modules.sys.enums.SuperAdminEnum;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
import lombok.SneakyThrows;
@ -103,6 +106,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private static final String SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY = "selectDTOPageSpecilTotal";
private static final String SELECTWITHATTRS_KEY = "selectWithAttrs";
private static final String SELECTCENSUSRESOURCETABLEKEY = "selectCensusResourceTable";
private static final String selectCensusApplyTableKey = "selectCensusApplyTable";
@Value("${system.startDay}")
private String systemDay;
@ -225,18 +232,21 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
wrapper.in(true, "del_flag", 0, 5);
}
}
if (params.containsKey("infoList")) {
// TODO
}
wrapper.orderByAsc("del_flag").orderByDesc("create_date");
return wrapper;
}
@Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void save(ResourceDTO dto) {
super.save(dto);
}
@Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void update(ResourceDTO dto) {
super.update(dto);
}
@ -244,7 +254,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void insertWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity);
@ -308,7 +318,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, selectCensusApplyTableKey, SELECTCENSUSRESOURCETABLEKEY}, allEntries = true)
public void createMixAbility(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity);
@ -351,7 +361,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void deleteWithAttrs(JSONObject jsonObject) {
JSONArray jsonArray = jsonObject.getJSONArray("ids");
List<Long> idList = jsonArray.toJavaList(Long.class);
@ -365,7 +375,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
@Transactional
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void updateWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity);
@ -1179,7 +1189,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
* 同步知识库
*/
@Override
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY}, allEntries = true)
@CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, SELECTWITHATTRS_KEY, SELECTCENSUSRESOURCETABLEKEY, selectCensusApplyTableKey}, allEntries = true)
public void KnowledgeBase() {
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
final int pageSize = CPU_NUM * 10;
@ -2024,24 +2034,24 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
});
}, executor);
CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施
HashMap<Object, Object> queryMap = new HashMap<>();
queryMap.put("cameraName", keyWorld);
Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, "");
resultList.add(new HashMap<String, Object>() {
{
put("count", countNew + "");
put("type", "基础设施");
}
});
//2022-11-1 去除摄像头查询
//CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施
// HashMap<Object, Object> queryMap = new HashMap<>();
// queryMap.put("cameraName", keyWorld);
// Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, "");
// resultList.add(new HashMap<String, Object>() {
// {
// put("count", countNew + "");
// put("type", "基础设施");
// }
// });
//
//}, executor);
}, executor);
//统计增加会议室搜索结果
CompletableFuture<Void> meetingRoomCount = CompletableFuture.runAsync(() -> { //会议室
meetCountNew[0] = tMeetingroomMapper.selectByName(keyWorld).size();
}, executor);
CompletableFuture<Void> meetingRoomCount = CompletableFuture.runAsync(() -> meetCountNew[0] = tMeetingroomMapper.selectByName(keyWorld).size(), executor);
CompletableFuture<Void> all = CompletableFuture.allOf(DBresourceCount, dataResourceCount, infrastructureCount, meetingRoomCount);
CompletableFuture<Void> all = CompletableFuture.allOf(DBresourceCount, dataResourceCount, meetingRoomCount);
all.join();
}
@ -2049,6 +2059,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
default:
break;
}
//未查到的类型返回数量0
List<String> temp = new ArrayList<>();
resultList.forEach(map -> {
@ -2072,6 +2083,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectApplyDeptDetailTypeCountList(Map params) {
UserDetail user = SecurityUser.getUser();
if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) {
logger.info("管理员区域");
} else if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
}
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { // 部门精准查
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
@ -2248,6 +2267,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectDeptDetailTypeCountList(Map params) {
UserDetail user = SecurityUser.getUser();
if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) {
logger.info("管理员区域");
} else if (user.getDeptId() != null) {
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
}
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) {
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
@ -2520,4 +2547,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}};
}
@Override
public Object getAppListByDept(String key) {
Long deptId = SecurityUser.getUser().getDeptId();
return resourceDao.getAppListByDept(deptId, key);
}
}

View File

@ -82,6 +82,17 @@ public class ShiroConfig {
filterMap.put("/upload", "anon");
filterMap.put("/upload/**", "anon");
filterMap.put("/census/center/v3/**", "oauth2");
filterMap.put("/census/center/exportSelectApplyDeptDetailTypeCountList", "oauth2");
filterMap.put("/census/center/exportSelectDeptDetailTypeCountList", "oauth2");
filterMap.put("/census/center/exportSelectCensusResourceTable", "oauth2");
filterMap.put("/census/center/exportSelectCensusApplyTable", "oauth2");
filterMap.put("/census/center/selectApplyDeptDetailTypeCountList", "oauth2");
filterMap.put("/census/center/selectDeptDetailTypeCountList", "oauth2");
filterMap.put("/census/center/selectCensusResourceTable", "oauth2");
filterMap.put("/census/center/selectCensusApplyTable", "oauth2");
filterMap.put("/census/center/**", "anon"); // 全局各类统计 包含 /census/center/v2
filterMap.put("/metrics/**", "anon");
filterMap.put("/gateway-monitor/**", "anon");

View File

@ -1,6 +1,8 @@
package io.renren.modules.sys.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
@ -8,17 +10,22 @@ import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.enums.SuperAdminEnum;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.*;
@ -46,6 +53,17 @@ public class SysDeptController {
return new Result<List<SysDeptDTO>>().ok(list);
}
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "deptName", value = "部门名称", paramType = "query", dataType = "String")
})
public Result<PageData<SysDeptDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
return new Result<PageData<SysDeptDTO>>().ok(sysDeptService.page(params));
}
@GetMapping("listForRegion")
@ApiOperation("查询区域管理员管理的部门")
@LogOperation("查询区域管理员管理的部门")
@ -66,12 +84,24 @@ public class SysDeptController {
@LogOperation("查询所有部门列表")
// @RequiresPermissions("sys:dept:list")
public Result<List<Map<String, Object>>> all(String name) {
UserDetail user = SecurityUser.getUser();
List<Map<String, Object>> list = new ArrayList<>();
if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
if (StringUtils.isNotEmpty(name)) {
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s';", "%" + name + "%"));
} else {
list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
}
} else { // 区域管理员
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
if (sysDeptDTO.getDistrict() != null) {
if (StringUtils.isNotEmpty(name)) {
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s' AND WHERE district = %d;", "%" + name + "%", sysDeptDTO.getDistrict()));
} else {
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE district = %d;", sysDeptDTO.getDistrict()));
}
}
}
return new Result<List<Map<String, Object>>>().ok(list);
}

View File

@ -167,8 +167,8 @@ public class SysUserController {
// @RequiresPermissions("sys:user:export")
@ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType = "String")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
params.put("export", true);
List<SysUserDTO> list = sysUserService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "用户管理", list, SysUserExcel.class);
}

View File

@ -53,4 +53,8 @@ public class SysDictDataDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Date updateDate;
@ApiModelProperty(value = "启用状态")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Integer status;
}

View File

@ -52,6 +52,9 @@ public class SysDictTypeDTO implements Serializable {
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Date updateDate;
@ApiModelProperty(value = "启用状态")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Integer status;
@ApiModelProperty(value = "对应字典数据")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)

View File

@ -47,4 +47,9 @@ public class SysDictDataEntity extends BaseEntity {
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 启用状态
*/
private Integer status;
}

View File

@ -43,4 +43,9 @@ public class SysDictTypeEntity extends BaseEntity {
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 启用状态
*/
private Integer status;
}

View File

@ -1,5 +1,6 @@
package io.renren.modules.sys.service;
import io.renren.common.page.PageData;
import io.renren.common.service.BaseService;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.entity.SysDeptEntity;
@ -12,6 +13,8 @@ import java.util.Map;
*/
public interface SysDeptService extends BaseService<SysDeptEntity> {
PageData<SysDeptDTO> page(Map<String, Object> params);
List<SysDeptDTO> list(Map<String, Object> params);
SysDeptDTO get(Long id);

View File

@ -3,6 +3,7 @@ package io.renren.modules.sys.service.impl;
import io.renren.common.constant.Constant;
import io.renren.common.exception.ErrorCode;
import io.renren.common.exception.RenException;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.BaseServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.common.utils.TreeUtils;
@ -23,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@ -30,6 +32,28 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
@Autowired
private SysUserService sysUserService;
@Override
public PageData<SysDeptDTO> page(Map<String, Object> params) {
long curPage = 1;
long limit = 10;
if (params.get(Constant.PAGE) != null) {
curPage = Long.parseLong((String) params.get(Constant.PAGE));
}
if (params.get(Constant.LIMIT) != null) {
limit = Long.parseLong((String) params.get(Constant.LIMIT));
}
//普通管理员只能查询所属部门及子部门的数据
UserDetail user = SecurityUser.getUser();
if (user.getSuperAdmin() == SuperAdminEnum.NO.value()) {
params.put("deptIdList", getSubDeptIdList(user.getDeptId()));
}
//查询部门列表
List<SysDeptEntity> entityList = baseDao.getList(params);
List<SysDeptDTO> dtoList = ConvertUtils.sourceToTarget(entityList, SysDeptDTO.class);
List<SysDeptDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData( TreeUtils.build(result), dtoList.size());
}
@Override
public List<SysDeptDTO> list(Map<String, Object> params) {
//普通管理员只能查询所属部门及子部门的数据

View File

@ -97,6 +97,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
@Override
public List<SysUserDTO> list(Map<String, Object> params) {
//转换成like
paramsToLike(params, "username", "real_name");
// 普通管理员只能查询所属部门及子部门的数据
UserDetail user = SecurityUser.getUser();
if (user.getSuperAdmin() == SuperAdminEnum.NO.value()) {
@ -106,6 +108,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
if (roleDTO != null) {
params.put("role_id", roleDTO.getId());
}
if (params.containsKey("export")) { // 导出特殊处理
params.remove("role_id");
}
List<SysUserEntity> entityList = baseDao.getList(params);
return ConvertUtils.sourceToTarget(entityList, SysUserDTO.class);

View File

@ -18,7 +18,7 @@ big_date:
assignee_meet_role_id: 1576849766277849089
# 需要进行统计数目的资源 type/需要进行统计申请的资源类型 applyType
census:
type: 组件服务,应用资源,基础设施,数据资源,知识库
type: 应用资源,组件服务,基础设施,数据资源,知识库
applyType: 应用资源,业务组件,图层服务,开发组件,智能算法
# 海信网关
hisense:
@ -36,7 +36,7 @@ server:
min-spare: 30
port: 9090
servlet:
context-path: /renren-admin
context-path: /ucs-admin
session:
cookie:
http-only: true
@ -152,4 +152,6 @@ front:
# 基础设施,部门最大申请数量
infrastructure:
dept-can-apply-max: 10
# 是否发亚微消息
notice:
yawei: true

View File

@ -0,0 +1,4 @@
ALTER TABLE `sys_dict_data`
ADD COLUMN `status` int NULL DEFAULT 1 COMMENT '启用状态(0未启用 1启用)' AFTER `update_date`;
ALTER TABLE `sys_dict_type`
ADD COLUMN `status` int NULL DEFAULT 1 COMMENT '启用状态(0未启用 1启用)' AFTER `update_date`;

View File

@ -80,4 +80,24 @@
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
<!-- selectCensusResourceTable缓存 -->
<cache name="selectCensusResourceTable"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
<!-- selectCensusResourceTable缓存 -->
<cache name="selectCensusApplyTable"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="true"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>

View File

@ -25,6 +25,7 @@
</select>
<update id="updateApplyState">
update sys_notice set apply_state = #{applyState} where receiver_type_ids like concat('%', #{userId}, '%') and apply_id=#{applyId}
update sys_notice set apply_state = #{applyState} where receiver_type_ids like concat('%', #{userId}, '%') and
apply_id=#{applyId}
</update>
</mapper>

View File

@ -1639,7 +1639,22 @@
<select id="selectTypeCountByName" resultType="java.util.Map">
SELECT
type,
count(id) AS "count"
count(id) AS "count",
(
CASE
type
WHEN '应用资源' THEN
1
WHEN '组件服务' THEN
2
WHEN '基础设施' THEN
3
WHEN '知识库' THEN
5
WHEN '数据资源' THEN
4
END
) AS "type_index"
FROM tb_data_resource
WHERE 1 = 1
AND del_flag = 0
@ -1763,7 +1778,8 @@
END
) AS "type"
FROM
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.dept_id, d.del_flag FROM tb_data_resource d LEFT JOIN
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.dept_id, d.del_flag FROM tb_data_resource d
LEFT JOIN
tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND a.del_flag=0) tdr,
sys_dept sd,
sys_user su,
@ -1796,7 +1812,7 @@
GROUP BY
sd.id,
tdr.type
<if test="type == null or type == '' or type == '会议室'">
<if test="type == null or type == '' or type == '会客厅'">
UNION
SELECT
@ -1922,6 +1938,12 @@
<if test="type != null and type != ''">
AND tdr.type = #{type}
</if>
<if test="region != null and region != ''">
AND sd.district = #{region}
</if>
<if test="resourceName != null and resourceName != ''">
AND tdr.name LIKE CONCAT( '%', #{resourceName}, '%' )
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(tdr.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if>
@ -1934,7 +1956,7 @@
tdr.NAME AS resourceName,
dept.`name` AS resourceDeptName,
tdr.type,
DATE_FORMAT(tdr.create_date,'%Y-%m-%d %T') AS createDate,
DATE_FORMAT(taa.create_date,'%Y-%m-%d %T') AS createDate,
taa.approve_status AS approveStatus,
taa.apply_flag AS applyNumber
FROM
@ -1975,18 +1997,24 @@
<if test="type != null and type != ''">
AND tdr.type = #{type}
</if>
<if test="region != null and region != ''">
AND sd.district = #{region}
</if>
<if test="resourceName != null and resourceName != ''">
AND tdr.name LIKE CONCAT( '%', #{resourceName}, '%' )
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if>
<if test="type == null or type == '' or type == '会议室'">
<if test="type == null or type == '' or type == '会客厅'">
UNION ALL
SELECT
tmb.dept AS 'deptName',
tm.`name` AS 'resourceName',
'青岛市大数据发展管理局' AS 'resourceDeptName',
'会议室' AS 'type',
'会客厅' AS 'type',
tmb.create_date AS 'createDate',
CASE tmb.state WHEN 1 THEN '审核中' WHEN 2 THEN '通过' WHEN 3 THEN '不通过' ELSE '审核中' END AS
'approveStatus',
@ -2010,6 +2038,9 @@
<if test="deptId != null and deptId != ''">
AND tmb.dept = #{deptId}
</if>
<if test="resourceName != null and resourceName != ''">
AND tm.name LIKE CONCAT( '%', #{resourceName}, '%' )
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(tmb.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if>
@ -2033,9 +2064,13 @@
FROM tb_data_attr a INNER JOIN mysql.help_topic b ON a.attr_type='应用领域' AND a.del_flag=0 AND b.help_topic_id
<![CDATA[ < ]]> (length(a.attr_value) - length(REPLACE(a.attr_value, ';', '')) + 1)) tda
ON tdr.id=tda.data_resource_id
LEFT JOIN (select sdd.sort, sdd.dict_label from sys_dict_data sdd left join tb_data_category tdc on
sdd.dict_type_id=tdc.link_value
where 1=1 and sdd.status=1 and tdc.del_flag=0 and tdc.name='应用领域' and tdc.root_category='应用资源') dict ON
dict.dict_label=tda.attr_value
WHERE 1=1 AND tdr.del_flag=0 AND tdr.type='应用资源'
GROUP BY tda.attr_value
ORDER BY count DESC
ORDER BY ANY_VALUE(IFNULL(dict.sort, 9999)) ASC
</select>
<select id="getPraiseList" resultType="java.util.Map">
@ -2263,4 +2298,21 @@
</if>
</select>
<select id="getAppListByDept" resultType="java.util.Map">
SELECT
tdr.id,
tdr.NAME,
tdr.create_date
FROM
tb_data_resource tdr
WHERE
1 = 1
AND tdr.del_flag = 0
AND tdr.dept_id = #{deptId}
<if test="key != null and key != ''">
AND tdr.name like CONCAT('%', #{key}, '%')
</if>
ORDER BY create_date DESC
</select>
</mapper>

View File

@ -54,10 +54,20 @@
<select id="selectResourceBrowseByTypeAndUser" parameterType="java.util.Map"
resultType="io.renren.modules.resourceBrowse.dto.ResourceBrowseDTO">
SELECT a.* FROM tb_resource_browse a INNER JOIN tb_data_resource b ON a.resource_id = b.id
SELECT a.*, c.attr_value FROM tb_resource_browse a INNER JOIN tb_data_resource b ON a.resource_id = b.id
LEFT JOIN tb_data_attr c ON b.id = c.data_resource_id
WHERE a.state = 0
AND c.del_flag = 0
AND c.attr_type = '组件类型'
<if test="params.type != null and params.type != ''">
<choose>
<when test="params.type == '应用资源' or params.type == '知识库'">
AND b.type = #{params.type}
</when>
<otherwise>
AND c.attr_value = #{params.type}
</otherwise>
</choose>
</if>
<if test="params.name != null and params.name != ''">
AND (b.name LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))) OR b.type

View File

@ -7,12 +7,14 @@
select t1.*,(select t2.name from sys_dept t2 where t2.id=t1.pid)parentName from sys_dept t1
where 1 = 1 AND name != '访客部门'
<if test="deptIdList != null">
t1.id in
AND t1.id in
<foreach item="id" collection="deptIdList" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="deptName != null and deptName.trim() != ''">
and t1.name LIKE CONCAT( '%', #{deptName}, '%' )
</if>
order by t1.sort asc
</select>