|
|
@@ -2,14 +2,18 @@ package com.xunmei.system.service.impl;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.xunmei.common.core.constant.CacheConstants;
|
|
|
import com.xunmei.common.core.exception.ServiceException;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
import com.xunmei.common.core.utils.bean.BeanUtils;
|
|
|
+import com.xunmei.common.redis.utils.RedisUtils;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.system.api.domain.SysArea;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
+import com.xunmei.system.api.vo.SysOrgVO;
|
|
|
import com.xunmei.system.domain.SysNfcBind;
|
|
|
import com.xunmei.system.domain.vo.SysAreaCheckVO;
|
|
|
import com.xunmei.system.mapper.ISysAreaMapper;
|
|
|
@@ -61,19 +65,21 @@ public class SysAreaCheckServiceImpl extends ServiceImpl<SysAreaCheckMapper, Sys
|
|
|
//下穿
|
|
|
//先全部查出
|
|
|
sysAreaCheck.setCheckSub(true);
|
|
|
- QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
- queryWrapper.eq("parent_id",-1);
|
|
|
+ QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("parent_id", -1);
|
|
|
SysOrg sysOrg1 = sysOrgMapper.selectOne(queryWrapper);
|
|
|
- if (null==sysAreaCheck.getOrgId()){
|
|
|
+ if (null == sysAreaCheck.getOrgId()) {
|
|
|
sysAreaCheck.setOrgId(sysOrg1.getId());
|
|
|
}
|
|
|
- if (sysAreaCheck.getCheckSub()) {
|
|
|
- List<Long> ids = orgService.selectCheckSubOrgIdList(sysAreaCheck.getOrgId());
|
|
|
+ /* if (sysAreaCheck.getCheckSub()) {
|
|
|
+ // List<Long> ids = orgService.selectCheckSubOrgIdList(sysAreaCheck.getOrgId());
|
|
|
+ // List<SysOrgVO> cacheList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
+ // List<Long> collect = cacheList.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
//清空前端传递的org_id
|
|
|
sysAreaCheck.setOrgId(null);
|
|
|
//添加in条件
|
|
|
- query.in("org_id", ids);
|
|
|
- }
|
|
|
+ query.in("org_id", collect);
|
|
|
+ }*/
|
|
|
//时间范围查询
|
|
|
if (sysAreaCheck.getParams().get("beginTime") != null && sysAreaCheck.getParams().get("endTime") != null) {
|
|
|
query.between("create_time", sysAreaCheck.getParams().get("beginTime"), sysAreaCheck.getParams().get("endTime"));
|
|
|
@@ -140,6 +146,15 @@ public class SysAreaCheckServiceImpl extends ServiceImpl<SysAreaCheckMapper, Sys
|
|
|
*/
|
|
|
@Override
|
|
|
public int insertSysAreaCheck(SysAreaCheck sysAreaCheck) {
|
|
|
+ QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("check_name", sysAreaCheck.getCheckName());
|
|
|
+ queryWrapper.eq("area_id", sysAreaCheck.getAreaId());
|
|
|
+ queryWrapper.eq("org_id", sysAreaCheck.getOrgId());
|
|
|
+ queryWrapper.eq("del_flag", 0);
|
|
|
+ Long aLong = baseMapper.selectCount(queryWrapper);
|
|
|
+ if (aLong > 0) {
|
|
|
+ throw new ServiceException("名称不能重复");
|
|
|
+ }
|
|
|
sysAreaCheck.setCreateTime(DateUtils.getNowDate());
|
|
|
sysAreaCheck.setCreateBy(SecurityUtils.getUsername());
|
|
|
sysAreaCheck.setUpdateBy(SecurityUtils.getUsername());
|
|
|
@@ -175,7 +190,7 @@ public class SysAreaCheckServiceImpl extends ServiceImpl<SysAreaCheckMapper, Sys
|
|
|
query.eq("del_flag", "0");
|
|
|
query.in("check_id", ids);
|
|
|
List<SysNfcBind> sysNfcBinds = sysNfcBindMapper.selectList(query);
|
|
|
- if(CollectionUtils.isNotEmpty(sysNfcBinds)){
|
|
|
+ if (CollectionUtils.isNotEmpty(sysNfcBinds)) {
|
|
|
throw new ServiceException("数据使用中,不能删除");
|
|
|
}
|
|
|
int i = 0;
|