Commit 7765eff1 authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.修改系统首页大屏总览接口,增加区分组织机构逻辑,完成接口冒烟测试;
2.修改系统首页获取井场列表接口,增加区分组织机构逻辑,完成接口冒烟测试;
3.修改系统首页井场功能下钻后提示报错问题,修改用电功率数据获取逻辑,修复报错问题;
4.修改输电线路分页列表查询接口,增加查询条件,在查询父线路列表时只查询10千伏线路,修改线上接口文档同时完成接口冒烟测试;
5.修改系统首页井场实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
6.修改系统首页用能分析接口,增加区分组织机构逻辑,完成接口冒烟测试;
7.修改系统首页井场用能分析(双坐标轴)接口,增加区分组织机构逻辑,完成接口冒烟测试;
8.修改系统首页累积用电接口,增加区分组织机构逻辑,完成接口冒烟测试;
9.修改系统首页光伏实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
10.修改系统首页井场效果评价接口,增加区分组织机构逻辑,完成接口冒烟测试;
11.修改系统首页先导实验井间开制度接口,增加区分组织机构逻辑,完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 580ed807
package pps.core.auth;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
......@@ -346,7 +346,7 @@ public class HttpRequestClient {
.addHeader(HttpHeaders.AUTHORIZATION, auth.getAuth())
.addHeader("Accept", ContentType.APPLICATION_JSON.toString())
.addHeader("Content-type", ContentType.APPLICATION_JSON.toString());
if (StringUtils.isNotBlank(json)) {
if (CharSequenceUtil.isNotBlank(json)) {
reqBuilder.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
}
try {
......
package pps.core.common.utils;
import org.apache.commons.lang3.StringUtils;
import cn.hutool.core.text.CharSequenceUtil;
import java.util.regex.Pattern;
......@@ -25,7 +25,7 @@ public class PatternUtil {
* 字符串脱敏模糊处理
*/
public static String desensitization(String str) {
if (StringUtils.isBlank(str)) {
if (CharSequenceUtil.isBlank(str)) {
return str;
}
//先判断手机号
......@@ -46,7 +46,7 @@ public class PatternUtil {
public static boolean easyCheckIdCard(String IdCard) {
//字符串为空或者不符合简单的18位校验返回false
String regex = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";
if (StringUtils.isBlank(IdCard) || !Pattern.matches(regex, IdCard)) {
if (CharSequenceUtil.isBlank(IdCard) || !Pattern.matches(regex, IdCard)) {
return false;
}
return true;
......@@ -68,7 +68,7 @@ public class PatternUtil {
//邮箱加*号
public static String reStr(String str) {
if (StringUtils.isBlank(str)) {
if (CharSequenceUtil.isBlank(str)) {
return str;
}
String name = str;
......
package pps.core.system.cache;
import cn.hutool.core.text.CharSequenceUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.core.common.utils.CounterBuilder;
import xstartup.annotation.XText;
import xstartup.base.XContext;
......@@ -124,7 +124,7 @@ public class SysDictionaryCache implements XCacheObject, XCacheLife {
public static void delete(XContext context, String alias, String dicId) {
List<SysDictionaryCache> list = Tool.get(Tool.class).list(context, alias, SysDictionaryCache.class);
if (ObjectUtils.isNotEmpty(list)) {
list = list.stream().filter((SysDictionaryCache b) -> !StringUtils.equals(b.getId(), dicId))
list = list.stream().filter((SysDictionaryCache b) -> !CharSequenceUtil.equals(b.getId(), dicId))
.collect(Collectors.toList());
}
CounterBuilder.globalCounterBuilder.addCounter("deleteCache");
......
......@@ -5,7 +5,6 @@ import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.core.common.utils.ManifestComponentInfoHelper;
import pps.core.system.cache.SysDictionaryCache;
import pps.core.system.entity.SysDictionaryEnt;
......@@ -47,7 +46,7 @@ public class PpsCoreSystemModule extends XModule {
List<SysDictionaryEnt> sysDictionarys = dictionaryMapper.selectList(new LambdaQueryWrapper<SysDictionaryEnt>()
.isNotNull(SysDictionaryEnt::getAlias).gt(SysDictionaryEnt::getEndTime, DateUtil.date())
);
sysDictionarys = sysDictionarys.stream().filter(p -> !StringUtils.equals("", p.getAlias())).collect(Collectors.toList());
sysDictionarys = sysDictionarys.stream().filter(p -> !CharSequenceUtil.equals("", p.getAlias())).collect(Collectors.toList());
for (SysDictionaryEnt dictObj : sysDictionarys) {
List<SysDictionaryCache> list = new ArrayList<>();
SysDictionaryCache dictMap = new SysDictionaryCache();
......@@ -72,7 +71,7 @@ public class PpsCoreSystemModule extends XModule {
if (ObjectUtils.isNotEmpty(sysDictionaryChilds)) {
SysDictionaryCache dict = iterator.next();
for (SysDictionaryEnt dictChild : sysDictionaryChilds) {
if (StringUtils.equals(dict.getId(), dictChild.getPid())) {
if (CharSequenceUtil.equals(dict.getId(), dictChild.getPid())) {
List<SysDictionaryCache> sysDictionaryList = dictCashMap.get(aliasObj);
SysDictionaryCache dictMap = new SysDictionaryCache();
XCopyUtils.copyObject(dictChild, dictMap);
......
package pps.core.system.provider.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.base.Splitter;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import pps.cloud.system.service.SysOrganizationCloudService;
import pps.cloud.system.service.SystemDictionaryService;
import pps.cloud.system.service.SystemUserRoleRelService;
......@@ -114,7 +113,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider
set.addAll(Arrays.asList(split));
}
}
if (!CollectionUtils.isEmpty(set)) {
if (CollUtil.isNotEmpty(set)) {
SystemDictionaryService dictService = context.getBean(SystemDictionaryService.class);
CreateSysDictionaryInput mediaTypesInput = new CreateSysDictionaryInput();
mediaTypesInput.setAlias("MEDIUM_TYPE");
......@@ -192,7 +191,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider
List<String> roleList = roleRelResult.getResult().stream().map(GetSysUserRoleRelOutput::getRoleId).collect(Collectors.toList());
String value = LoginConfig.adminRoles.findValue(context);
session.setDevops(0);
if (StringUtils.isNotBlank(value)) {
if (CharSequenceUtil.isNotBlank(value)) {
roleList.stream().filter(value::contains).findFirst().ifPresent(role -> session.setDevops(1));
}
}
......@@ -208,7 +207,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider
List<String> roleList = roleRelResult.getResult().stream().map(GetSysUserRoleRelOutput::getRoleId).collect(Collectors.toList());
String value = LoginConfig.adminRoles.findValue(context);
if (StringUtils.isNotBlank(value)) {
if (CharSequenceUtil.isNotBlank(value)) {
roleList.stream().filter(value::contains).findFirst().ifPresent(role -> session.setIsSuperAdmin(BusinessConstant.ONE));
}
......
......@@ -35,7 +35,7 @@ import java.util.List;
public class SysAreaService {
@XText("查询地区树")
@XApiPost
@XApiPost(anonymous = true)
public XListResult<GetSysAreaViewOutputTree> getSysAreaTree(XContext context, GetSysAreaInput input) {
//先从缓存中获取
List<SysAreaCache> sysAreaCaches = SysAreaCache.list(context, BusinessConstant.SYS_AREA_CACHE);
......@@ -73,7 +73,7 @@ public class SysAreaService {
XCopyUtils.copyObject(input, record);
List<SysAreaView> areaViews = mapper.selectListAll(record);
List<GetSysAreaViewOutputTree> list = XCopyUtils.copyNewList(areaViews, GetSysAreaViewOutputTree.class);
List<GetSysAreaViewOutputTree> trees = new ArrayList<>();
List<GetSysAreaViewOutputTree> trees = new ArrayList<>(list.size());
for (GetSysAreaViewOutputTree tree : list) {
if (tree.getLev().equals(0)) {
trees.add(tree);
......@@ -81,7 +81,7 @@ public class SysAreaService {
//子集
for (GetSysAreaViewOutputTree it : list) {
if (tree.getId().equals(it.getParentId())) {
if (tree.getChildren() == null) {
if (CollUtil.isEmpty(tree.getChildren())) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(it);
......@@ -167,7 +167,7 @@ public class SysAreaService {
SysAreaView record = new SysAreaView();
XCopyUtils.copyObject(input, record);
SysAreaView view = mapper.selectOne(record);
if (view == null) {
if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysAreaViewOutput output = new GetSysAreaViewOutput();
......
package pps.core.system.service;
import com.alibaba.csp.sentinel.util.StringUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.util.CollectionUtils;
import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysAuthOuScopeEnt;
import pps.core.system.entity.SysAuthOuScopeView;
......@@ -43,19 +43,19 @@ public class SysAuthOuScopeService {
SysAuthOuScopeMapper sysAuthOuScopeMapper = context.getBean(SysAuthOuScopeMapper.class);
SysAuthOuScopeViewMapper sysAuthOuScopeViewMapper = context.getBean(SysAuthOuScopeViewMapper.class);
//删除原关系
QueryWrapper<SysAuthOuScopeEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysAuthOuScopeEnt::getUserId, input.getUserId());
List<SysAuthOuScopeEnt> sysAuthOuScopeEnts = sysAuthOuScopeMapper.selectList(queryWrapper);
List<SysAuthOuScopeEnt> sysAuthOuScopeEnts = sysAuthOuScopeMapper.selectList(new QueryWrapper<SysAuthOuScopeEnt>()
.lambda()
.eq(SysAuthOuScopeEnt::getUserId, input.getUserId()));
List<SysAuthOuScopeEnt> deleteList = new ArrayList<>();
//查询已存在的组织机构和功能
if (!CollectionUtils.isEmpty(sysAuthOuScopeEnts)) {
if (CollUtil.isNotEmpty(sysAuthOuScopeEnts)) {
for (SysAuthOuScopeEnt scopeEnt : sysAuthOuScopeEnts) {
List<String> ouIds = input.getOuIds();
for (String ouId : ouIds) {
List<String> menuIds = input.getMenuIds();
for (String menuId : menuIds) {
if (scopeEnt != null) {
if (ouId.equals(scopeEnt.getOuId()) && menuId.equals(scopeEnt.getMenuId())) {
if (ObjectUtil.isNotNull(scopeEnt)) {
if (CharSequenceUtil.equals(ouId, scopeEnt.getOuId()) && CharSequenceUtil.equals(menuId, scopeEnt.getMenuId())) {
deleteList.add(scopeEnt);
}
}
......@@ -63,11 +63,12 @@ public class SysAuthOuScopeService {
}
}
}
if (!CollectionUtils.isEmpty(deleteList)) {
if (CollUtil.isNotEmpty(deleteList)) {
List<String> collect = deleteList.stream().map(SysAuthOuScopeEnt::getId).collect(Collectors.toList());
sysAuthOuScopeMapper.deleteBatchIds(collect);
}
//创建新关系
PpsUserSession session = context.getSession(PpsUserSession.class);
List<SysAuthOuScopeView> viewList = new ArrayList<>();
List<String> ouIds = input.getOuIds();
for (String ouId : ouIds) {
......@@ -78,14 +79,13 @@ public class SysAuthOuScopeService {
entity.setOuId(ouId);
entity.setUserId(input.getUserId());
entity.setId(UUID.randomUUID().toString());
PpsUserSession session = context.getSession(PpsUserSession.class);
entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName());
entity.setCreateTime(new Date());
viewList.add(entity);
}
}
if (!CollectionUtils.isEmpty(viewList)) {
if (CollUtil.isNotEmpty(viewList)) {
sysAuthOuScopeViewMapper.batchInsert(viewList);
}
//返回执行成功的结果,事务提交
......@@ -96,16 +96,17 @@ public class SysAuthOuScopeService {
@XText("批量删除")
@XApiPost
public XServiceResult batchDeleteSysAuthOuScope(XContext context, BatchDeleteSysAuthOuScopeInput input) {
SysAuthOuScopeMapper mapper = context.getBean(SysAuthOuScopeMapper.class);
List<String> idList = input.getIdList();
if (!ObjectUtils.isEmpty(idList)) {
idList = idList.stream().filter(item -> !StringUtil.isBlank(item)).collect(Collectors.toList());
if (ObjectUtil.isNotNull(idList)) {
idList = idList.stream()
.filter(CharSequenceUtil::isNotBlank)
.collect(Collectors.toList());
}
if (ObjectUtils.isEmpty(idList)) {
if (CollUtil.isEmpty(idList)) {
return XServiceResult.error(context, XError.NotFound);
}
int i = mapper.deleteBatchIds(idList);
context.getLogger().debug("批量删除:{}", i);
SysAuthOuScopeMapper mapper = context.getBean(SysAuthOuScopeMapper.class);
mapper.deleteBatchIds(idList);
return XServiceResult.OK;
}
......
package pps.core.system.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.cloud.system.service.SystemDictionaryService;
import pps.cloud.system.service.data.sys_dictionary.*;
import pps.core.system.cache.SysDictionaryCache;
......@@ -36,7 +36,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService {
QueryWrapper<SysDictionaryEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysDictionaryEnt::getAlias, input.getAlias());
SysDictionaryEnt sysDictionaryEnt = mapper.selectOne(queryWrapper);
list = list.stream().filter((SysDictionaryCache dic) -> StringUtils.equals(dic.getPid(), sysDictionaryEnt.getId()) && !StringUtils.equals(dic.getAlias(), input.getAlias()))
list = list.stream().filter((SysDictionaryCache dic) -> CharSequenceUtil.equals(dic.getPid(), sysDictionaryEnt.getId()) && !CharSequenceUtil.equals(dic.getAlias(), input.getAlias()))
.collect(Collectors.toList());
if (ObjectUtils.isEmpty(list)) {
list = new ArrayList<>();
......@@ -64,7 +64,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService {
List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic);
String ouIdPath = sysOrganizationRelEnt.getOuIdPath();
String ouId = sysOrganizationRelEnt.getOuId();
if (StringUtils.isNotBlank(ouIdPath)) {
if (CharSequenceUtil.isNotBlank(ouIdPath)) {
List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> {
if (ouIdPath.contains(p.getOuId()) && p.getUseLowerLevel() == 1) {
return p.getDicCode();
......@@ -112,7 +112,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService {
List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic);
String ouIdPath = sysOrganizationRelEnt.getOuIdPath();
String ouId = sysOrganizationRelEnt.getOuId();
if (StringUtils.isNotBlank(ouIdPath)) {
if (CharSequenceUtil.isNotBlank(ouIdPath)) {
List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> {
if (ouIdPath.contains(p.getOuId()) && p.getUseLowerLevel() == 1) {
return p.getDicCode();
......
package pps.core.system.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.util.CollectionUtils;
import pps.cloud.system.service.SysOrganizationCloudService;
import pps.cloud.system.service.data.sys_organization.*;
import pps.core.common.constant.BusinessConstant;
......@@ -13,7 +13,6 @@ import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult;
import xstartup.data.XSingleResult;
......@@ -29,9 +28,9 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
@Override
public XSingleResult<GetSysOrganizationViewOutput> getSysOrganizationById(XContext context, GetSysOrganizationViewInput input) {
SysOrganizationMapper mapper = context.getBean(SysOrganizationMapper.class);
QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationEnt::getId, input.getId());
SysOrganizationEnt ent = mapper.selectOne(queryWrapper);
SysOrganizationEnt ent = mapper.selectOne(new QueryWrapper<SysOrganizationEnt>()
.lambda()
.eq(SysOrganizationEnt::getId, input.getId()));
GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput();
XCopyUtils.copyObject(ent, output);
return XSingleResult.success(output);
......@@ -42,26 +41,26 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class);
SysOrganizationMapper sysOrganizationMapper = context.getBean(SysOrganizationMapper.class);
SysOrganizationRelMapper sysOrganizationRelMapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysUserOrganizationRelEnt> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(SysUserOrganizationRelEnt::getUserId, input.getUserId())
List<SysUserOrganizationRelEnt> relEnts = mapper.selectList(new QueryWrapper<SysUserOrganizationRelEnt>()
.lambda()
.eq(SysUserOrganizationRelEnt::getUserId, input.getUserId())
.le(SysUserOrganizationRelEnt::getEffectTime, new Date())
.ge(SysUserOrganizationRelEnt::getEndTime, new Date());
List<SysUserOrganizationRelEnt> relEnts = mapper.selectList(wrapper);
.ge(SysUserOrganizationRelEnt::getEndTime, new Date()));
GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput();
if (CollUtil.isNotEmpty(relEnts)) {
if (XStringUtils.isNotEmpty(relEnts.get(0).getOuId())) {
QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationEnt::getId, relEnts.get(0).getOuId())
.eq(SysOrganizationEnt::getIsDeleted, 1);
SysOrganizationEnt sysOrganizationEnt = sysOrganizationMapper.selectOne(queryWrapper);
if (CharSequenceUtil.isNotBlank(relEnts.get(0).getOuId())) {
SysOrganizationEnt sysOrganizationEnt = sysOrganizationMapper.selectOne(new QueryWrapper<SysOrganizationEnt>()
.lambda()
.eq(SysOrganizationEnt::getId, relEnts.get(0).getOuId())
.eq(SysOrganizationEnt::getIsDeleted, 1));
XCopyUtils.copyObject(sysOrganizationEnt, output);
output.setOuId(relEnts.get(0).getOuId());
QueryWrapper<SysOrganizationRelEnt> qw = new QueryWrapper<>();
qw.lambda().eq(SysOrganizationRelEnt::getOuId, relEnts.get(0).getOuId())
List<SysOrganizationRelEnt> sysOrganizationRelEnts = sysOrganizationRelMapper.selectList(new QueryWrapper<SysOrganizationRelEnt>()
.lambda()
.eq(SysOrganizationRelEnt::getOuId, relEnts.get(0).getOuId())
.le(SysOrganizationRelEnt::getEffectTime, new Date())
.ge(SysOrganizationRelEnt::getEndTime, new Date());
List<SysOrganizationRelEnt> sysOrganizationRelEnts = sysOrganizationRelMapper.selectList(qw);
if (!CollectionUtils.isEmpty(sysOrganizationRelEnts)) {
.ge(SysOrganizationRelEnt::getEndTime, new Date()));
if (CollUtil.isNotEmpty(sysOrganizationRelEnts)) {
output.setOuPath(sysOrganizationRelEnts.get(0).getOuIdPath());
}
}
......
package pps.core.system.service;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -18,7 +20,6 @@ import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.base.data.CustomQueryInput;
import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult;
import xstartup.data.XPageResult;
import xstartup.data.XServiceResult;
......@@ -47,12 +48,12 @@ public class SysOrganizationPropertyService {
mediaTypesInput.setAlias("MEDIUM_TYPE");
XListResult<QuerySysDictionaryViewOutput> mediaTypes = dictService.querySysDictionarysByAlias(context, mediaTypesInput);
List<QuerySysDictionaryViewOutput> mediaTypesResult = mediaTypes.getResult();
if (XStringUtils.isEmpty(input.getOuId())) {
if (CharSequenceUtil.isBlank(input.getOuId())) {
PpsUserSession session = context.getSession(PpsUserSession.class);
if (BusinessConstant.ZERO.equals(session.getIsSuperAdmin())) {
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getOuId, session.getOuId())
.le(true, SysOrganizationPropertyEnt::getEffectTime, date)
.ge(true, SysOrganizationPropertyEnt::getEndTime, date);
.le(SysOrganizationPropertyEnt::getEffectTime, date)
.ge(SysOrganizationPropertyEnt::getEndTime, date);
} else {
List<GetSysOrganizationPropertyOutput> list = new ArrayList<>();
for (QuerySysDictionaryViewOutput viewOutput : mediaTypesResult) {
......@@ -65,8 +66,8 @@ public class SysOrganizationPropertyService {
}
} else {
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getOuId, input.getOuId())
.le(true, SysOrganizationPropertyEnt::getEffectTime, date)
.ge(true, SysOrganizationPropertyEnt::getEndTime, date);
.le(SysOrganizationPropertyEnt::getEffectTime, date)
.ge(SysOrganizationPropertyEnt::getEndTime, date);
}
List<SysOrganizationPropertyEnt> propertyEnts = mapper.selectList(queryWrapper);
List<GetSysOrganizationPropertyOutput> outputs = XCopyUtils.copyNewList(propertyEnts, GetSysOrganizationPropertyOutput.class);
......@@ -107,10 +108,10 @@ public class SysOrganizationPropertyService {
@XApiPost
public XServiceResult updateSysOrganizationProperty(XContext context, UpdateSysOrganizationPropertyInput input) {
SysOrganizationPropertyMapper mapper = context.getBean(SysOrganizationPropertyMapper.class);
QueryWrapper<SysOrganizationPropertyEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getId, input.getId());
SysOrganizationPropertyEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysOrganizationPropertyEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationPropertyEnt>()
.lambda()
.eq(SysOrganizationPropertyEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -121,10 +122,10 @@ public class SysOrganizationPropertyService {
@XApiPost
public XServiceResult deleteSysOrganizationProperty(XContext context, DeleteSysOrganizationPropertyInput input) {
SysOrganizationPropertyMapper mapper = context.getBean(SysOrganizationPropertyMapper.class);
QueryWrapper<SysOrganizationPropertyEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getId, input.getId());
SysOrganizationPropertyEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysOrganizationPropertyEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationPropertyEnt>()
.lambda()
.eq(SysOrganizationPropertyEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
mapper.deleteById(entity);
......
package pps.core.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -37,10 +38,10 @@ public class SysOrganizationRelService {
@XApiPost
public XServiceResult deleteSysOrganizationRel(XContext context, DeleteSysOrganizationRelInput input) {
SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationRelEnt::getId, input.getId());
SysOrganizationRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationRelEnt>()
.lambda()
.eq(SysOrganizationRelEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
mapper.deleteById(entity);
......@@ -50,10 +51,10 @@ public class SysOrganizationRelService {
@XApiGet
public XSingleResult<GetSysOrganizationRelOutput> getSysOrganizationRel(XContext context, GetSysOrganizationRelInput input) {
SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationRelEnt::getId, input.getId());
SysOrganizationRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationRelEnt>()
.lambda()
.eq(SysOrganizationRelEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysOrganizationRelOutput output = new GetSysOrganizationRelOutput();
......@@ -95,7 +96,7 @@ public class SysOrganizationRelService {
SysOrganizationRelView record = new SysOrganizationRelView();
XCopyUtils.copyObject(input, record);
SysOrganizationRelView view = mapper.selectOne(record);
if (view == null) {
if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysOrganizationRelViewOutput output = new GetSysOrganizationRelViewOutput();
......
package pps.core.system.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.util.CollectionUtils;
import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysRoleMenuAuthEnt;
import pps.core.system.entity.SysRoleMenuAuthView;
......@@ -42,33 +43,29 @@ public class SysRoleMenuAuthService {
return XTransactionHelper.begin(context, () -> {
//删除原关系
SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class);
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getRoleId, input.getRoleId());
PageHelper.startPage(1, 1000);
List<SysRoleMenuAuthEnt> sysUserRoleRelEnts = mapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(sysUserRoleRelEnts)) {
List<String> collect = sysUserRoleRelEnts.stream().map(SysRoleMenuAuthEnt::getId).collect(Collectors.toList());
mapper.deleteBatchIds(collect);
List<SysRoleMenuAuthEnt> sysUserRoleRelEnts = mapper.selectList(new QueryWrapper<SysRoleMenuAuthEnt>()
.lambda()
.eq(SysRoleMenuAuthEnt::getRoleId, input.getRoleId()));
if (CollUtil.isNotEmpty(sysUserRoleRelEnts)) {
mapper.deleteBatchIds(sysUserRoleRelEnts.stream().map(SysRoleMenuAuthEnt::getId).collect(Collectors.toList()));
}
//创建新关系
PpsUserSession session = context.getSession(PpsUserSession.class);
SysRoleMenuAuthViewMapper viewMapper = context.getBean(SysRoleMenuAuthViewMapper.class);
List<String> menuIdList = input.getMenuIds();
Date now = new Date();
List<SysRoleMenuAuthView> viewList = new ArrayList<>();
for (String menuId : menuIdList) {
for (String menuId : input.getMenuIds()) {
SysRoleMenuAuthView entity = new SysRoleMenuAuthView();
entity.setId(UUID.randomUUID().toString());
entity.setMenuId(menuId);
entity.setRoleId(input.getRoleId());
PpsUserSession session = context.getSession(PpsUserSession.class);
if (session != null) {
entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName());
}
entity.setCreateTime(now);
viewList.add(entity);
}
if (!CollectionUtils.isEmpty(viewList)) {
if (CollUtil.isNotEmpty(viewList)) {
viewMapper.batchInsert(viewList);
}
//返回执行成功的结果,事务提交
......@@ -94,7 +91,7 @@ public class SysRoleMenuAuthService {
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getId, input.getId());
SysRoleMenuAuthEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -105,10 +102,10 @@ public class SysRoleMenuAuthService {
@XApiPost
public XServiceResult deleteSysRoleMenuAuth(XContext context, DeleteSysRoleMenuAuthInput input) {
SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class);
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getId, input.getId());
SysRoleMenuAuthEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysRoleMenuAuthEnt entity = mapper.selectOne(new QueryWrapper<SysRoleMenuAuthEnt>()
.lambda()
.eq(SysRoleMenuAuthEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
mapper.deleteById(entity);
......@@ -118,10 +115,10 @@ public class SysRoleMenuAuthService {
@XApiGet
public XSingleResult<GetSysRoleMenuAuthOutput> getSysRoleMenuAuth(XContext context, GetSysRoleMenuAuthInput input) {
SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class);
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getId, input.getId());
SysRoleMenuAuthEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysRoleMenuAuthEnt entity = mapper.selectOne(new QueryWrapper<SysRoleMenuAuthEnt>()
.lambda()
.eq(SysRoleMenuAuthEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysRoleMenuAuthOutput output = new GetSysRoleMenuAuthOutput();
......@@ -157,7 +154,7 @@ public class SysRoleMenuAuthService {
SysRoleMenuAuthView record = new SysRoleMenuAuthView();
XCopyUtils.copyObject(input, record);
SysRoleMenuAuthView view = mapper.selectOne(record);
if (view == null) {
if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysRoleMenuAuthViewOutput output = new GetSysRoleMenuAuthViewOutput();
......
package pps.core.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -37,10 +38,10 @@ public class SysUserGroupRoleRelService {
@XApiPost
public XServiceResult updateSysUserGroupRoleRel(XContext context, UpdateSysUserGroupRoleRelInput input) {
SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class);
QueryWrapper<SysUserGroupRoleRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserGroupRoleRelEnt::getId, input.getId());
SysUserGroupRoleRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysUserGroupRoleRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserGroupRoleRelEnt>()
.lambda()
.eq(SysUserGroupRoleRelEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -51,10 +52,10 @@ public class SysUserGroupRoleRelService {
@XApiPost
public XServiceResult deleteSysUserGroupRoleRel(XContext context, DeleteSysUserGroupRoleRelInput input) {
SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class);
QueryWrapper<SysUserGroupRoleRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserGroupRoleRelEnt::getId, input.getId());
SysUserGroupRoleRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysUserGroupRoleRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserGroupRoleRelEnt>()
.lambda()
.eq(SysUserGroupRoleRelEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
mapper.deleteById(entity);
......@@ -64,10 +65,10 @@ public class SysUserGroupRoleRelService {
@XApiPost
public XSingleResult<GetSysUserGroupRoleRelOutput> getSysUserGroupRoleRel(XContext context, GetSysUserGroupRoleRelInput input) {
SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class);
QueryWrapper<SysUserGroupRoleRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserGroupRoleRelEnt::getId, input.getId());
SysUserGroupRoleRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysUserGroupRoleRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserGroupRoleRelEnt>()
.lambda().
eq(SysUserGroupRoleRelEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysUserGroupRoleRelOutput output = new GetSysUserGroupRoleRelOutput();
......@@ -103,7 +104,7 @@ public class SysUserGroupRoleRelService {
SysUserGroupRoleRelView record = new SysUserGroupRoleRelView();
XCopyUtils.copyObject(input, record);
SysUserGroupRoleRelView view = mapper.selectOne(record);
if (view == null) {
if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysUserGroupRoleRelViewOutput output = new GetSysUserGroupRoleRelViewOutput();
......
package pps.core.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -36,10 +37,10 @@ public class SysUserOrganizationRelService {
@XApiPost
public XServiceResult updateSysUserOrganizationRel(XContext context, UpdateSysUserOrganizationRelInput input) {
SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class);
QueryWrapper<SysUserOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserOrganizationRelEnt::getId, input.getId());
SysUserOrganizationRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysUserOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserOrganizationRelEnt>()
.lambda()
.eq(SysUserOrganizationRelEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -50,10 +51,10 @@ public class SysUserOrganizationRelService {
@XApiPost
public XServiceResult deleteSysUserOrganizationRel(XContext context, DeleteSysUserOrganizationRelInput input) {
SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class);
QueryWrapper<SysUserOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserOrganizationRelEnt::getId, input.getId());
SysUserOrganizationRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysUserOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserOrganizationRelEnt>()
.lambda()
.eq(SysUserOrganizationRelEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
mapper.deleteById(entity);
......@@ -66,7 +67,7 @@ public class SysUserOrganizationRelService {
QueryWrapper<SysUserOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserOrganizationRelEnt::getId, input.getId());
SysUserOrganizationRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysUserOrganizationRelOutput output = new GetSysUserOrganizationRelOutput();
......@@ -102,7 +103,7 @@ public class SysUserOrganizationRelService {
SysUserOrganizationRelView record = new SysUserOrganizationRelView();
XCopyUtils.copyObject(input, record);
SysUserOrganizationRelView view = mapper.selectOne(record);
if (view == null) {
if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysUserOrganizationRelViewOutput output = new GetSysUserOrganizationRelViewOutput();
......
package pps.core.system.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.util.CollectionUtils;
import pps.core.common.constant.BusinessConstant;
import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysOrganizationView;
......@@ -18,7 +19,6 @@ import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.base.exception.XServiceException;
import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult;
import xstartup.data.XPageResult;
import xstartup.data.XServiceResult;
......@@ -42,30 +42,29 @@ public class SysUserRoleRelService {
return XTransactionHelper.begin(context, () -> {
//删除原关系
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserRoleRelEnt::getUserId, input.getUserId());
List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(sysUserRoleRelEnts)) {
List<String> collect = sysUserRoleRelEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList());
mapper.deleteBatchIds(collect);
List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
.lambda()
.eq(SysUserRoleRelEnt::getUserId, input.getUserId()));
if (CollUtil.isNotEmpty(sysUserRoleRelEnts)) {
mapper.deleteBatchIds(sysUserRoleRelEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()));
}
//创建新关系
SysUserRoleRelViewMapper viewMapper = context.getBean(SysUserRoleRelViewMapper.class);
List<String> roleIdList = input.getRoleIdList();
Date now = new Date();
List<SysUserRoleRelView> viewList = new ArrayList<>();
PpsUserSession session = context.getSession(PpsUserSession.class);
for (String roleId : roleIdList) {
SysUserRoleRelView entity = new SysUserRoleRelView();
entity.setId(UUID.randomUUID().toString());
entity.setUserId(input.getUserId());
entity.setRoleId(roleId);
PpsUserSession session = context.getSession(PpsUserSession.class);
entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName());
entity.setCreateTime(now);
viewList.add(entity);
}
if (!CollectionUtils.isEmpty(viewList)) {
if (CollUtil.isNotEmpty(viewList)) {
viewMapper.batchInsert(viewList);
}
//返回执行成功的结果,事务提交
......@@ -80,41 +79,40 @@ public class SysUserRoleRelService {
return XTransactionHelper.begin(context, () -> {
//查询原关系
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserRoleRelEnt::getRoleId, input.getRoleId());
List<String> userIds = input.getUserIdList().stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList());
queryWrapper.lambda().in(SysUserRoleRelEnt::getUserId, userIds);
List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(queryWrapper);
List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
.lambda()
.eq(SysUserRoleRelEnt::getRoleId, input.getRoleId())
.in(SysUserRoleRelEnt::getUserId, input.getUserIdList().stream()
.map(SysUserRoleRelEnt::getId).collect(Collectors.toList())));
//创建新关系
SysUserRoleRelViewMapper viewMapper = context.getBean(SysUserRoleRelViewMapper.class);
List<SysUserRoleRelEnt> userIdList = input.getUserIdList();
Date now = new Date();
List<SysUserRoleRelView> viewList = new ArrayList<>();
List<SysUserRoleRelEnt> entList = new ArrayList<>();
PpsUserSession session = context.getSession(PpsUserSession.class);
for (SysUserRoleRelEnt user : userIdList) {
SysUserRoleRelView entity = new SysUserRoleRelView();
entity.setId(UUID.randomUUID().toString());
entity.setUserId(user.getId());
entity.setRoleId(input.getRoleId());
PpsUserSession session = context.getSession(PpsUserSession.class);
entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName());
entity.setCreateTime(now);
viewList.add(entity);
//同一个用户添加多次删除调旧的
for (SysUserRoleRelEnt roleRelEnt : sysUserRoleRelEnts) {
if (roleRelEnt.getUserId().equals(user.getId())) {
if (CharSequenceUtil.equals(roleRelEnt.getUserId(), user.getId())) {
entList.add(roleRelEnt);
break;
}
}
}
if (!CollectionUtils.isEmpty(viewList)) {
if (CollUtil.isNotEmpty(viewList)) {
viewMapper.batchInsert(viewList);
}
if (!CollectionUtils.isEmpty(entList)) {
List<String> collect = entList.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList());
mapper.deleteBatchIds(collect);
if (CollUtil.isNotEmpty(entList)) {
mapper.deleteBatchIds(entList.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()));
}
//返回执行成功的结果,事务提交
return XServiceResult.OK;
......@@ -139,11 +137,9 @@ public class SysUserRoleRelService {
SysUserRoleRelView record = new SysUserRoleRelView();
XCopyUtils.copyObject(input, record);
PageHelper.startPage(input.getPage(), input.getLimit());
PpsUserSession session = context.getSession(PpsUserSession.class);
Integer isSuperAdmin = session.getIsSuperAdmin();
List<SysUserRoleRelView> list;
record.setEndTime(new Date());
if (XStringUtils.isNotEmpty(input.getOuId())) {
if (CharSequenceUtil.isNotBlank(input.getOuId())) {
List<String> ouIds = new ArrayList<>();
ouIds.add(input.getOuId());
record.setOuIds(ouIds);
......@@ -152,6 +148,8 @@ public class SysUserRoleRelService {
List<QuerySysUserRoleRelViewOutput> outputs = XCopyUtils.copyNewList(pageInfo.getList(), QuerySysUserRoleRelViewOutput.class);
return XPageResult.success(outputs, input, pageInfo.getTotal());
}
PpsUserSession session = context.getSession(PpsUserSession.class);
Integer isSuperAdmin = session.getIsSuperAdmin();
if (BusinessConstant.ZERO.equals(isSuperAdmin)) {
//查询当前用户所属组织机构的子级
SysOrganizationViewMapper sysOrganizationViewMapper = context.getBean(SysOrganizationViewMapper.class);
......@@ -161,7 +159,7 @@ public class SysUserRoleRelService {
sysOrganizationView.setParentOuId(session.getOuId());
List<SysOrganizationView> viewList = sysOrganizationViewMapper.selectOuSonByParentOuId(sysOrganizationView);
List<String> ouIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(viewList)) {
if (CollUtil.isNotEmpty(viewList)) {
for (SysOrganizationView organizationView : viewList) {
ouIds.add(organizationView.getId());
}
......@@ -182,12 +180,11 @@ public class SysUserRoleRelService {
public XServiceResult deleteSysUserRoleRel(XContext context, DeleteSysUserRoleRelOutput input) throws XServiceException {
return XTransactionHelper.begin(context, () -> {
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(SysUserRoleRelEnt::getId, input.getIds());
List<SysUserRoleRelEnt> relEnts = mapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(relEnts)) {
List<String> collect = relEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList());
mapper.deleteBatchIds(collect);
List<SysUserRoleRelEnt> relEnts = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
.lambda()
.in(SysUserRoleRelEnt::getId, input.getIds()));
if (CollUtil.isNotEmpty(relEnts)) {
mapper.deleteBatchIds(relEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()));
}
//返回执行成功的结果,事务提交
return XServiceResult.OK;
......
......@@ -26,9 +26,9 @@ public class SysUserRoleRelServiceImpl implements SystemUserRoleRelService {
@XText("获取用户角色")
public XListResult<GetSysUserRoleRelOutput> getSysRoleByUserId(XContext context, GetSysUserRoleRelInput input) {
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserRoleRelEnt::getUserId, input.getUserId());
List<SysUserRoleRelEnt> list = mapper.selectList(queryWrapper);
List<SysUserRoleRelEnt> list = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
.lambda()
.eq(SysUserRoleRelEnt::getUserId, input.getUserId()));
List<GetSysUserRoleRelOutput> outputs = XCopyUtils.copyNewList(list, GetSysUserRoleRelOutput.class);
return XListResult.success(outputs);
}
......
package pps.core.system.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysUserWithUserGroupRelEnt;
import pps.core.system.entity.SysUserWithUserGroupRelView;
......@@ -47,16 +47,15 @@ public class SysUserWithUserGroupRelService {
SysUserWithUserGroupRelViewMapper userWithUserGroupRelViewMapper = context.getBean(SysUserWithUserGroupRelViewMapper.class);
//删除原关系
QueryWrapper<SysUserWithUserGroupRelEnt> queryWrapper = new QueryWrapper<>();
if (StringUtils.equals("1", input.getType())) {
if (CharSequenceUtil.equals("1", input.getType())) {
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserGroupId, input.getUserGroupId());
} else {
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserId, input.getUserId());
}
PageHelper.startPage(1, 1000);
List<SysUserWithUserGroupRelEnt> sysAuthOuScopeEnts = userGroupWithRole.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(sysAuthOuScopeEnts)) {
List<String> collect = sysAuthOuScopeEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList());
userGroupWithRole.deleteBatchIds(collect);
if (CollUtil.isNotEmpty(sysAuthOuScopeEnts)) {
userGroupWithRole.deleteBatchIds(sysAuthOuScopeEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()));
}
//创建新关系
Date now = new Date();
......@@ -64,7 +63,7 @@ public class SysUserWithUserGroupRelService {
List<SysUserWithUserGroupRelView> viewList = new ArrayList<>();
for (String groupId : groupIdList) {
SysUserWithUserGroupRelView entity = new SysUserWithUserGroupRelView();
if (StringUtils.equals("1", input.getType())) {
if (CharSequenceUtil.equals("1", input.getType())) {
entity.setUserId(groupId);
entity.setUserGroupId(input.getUserGroupId());
} else {
......@@ -78,7 +77,7 @@ public class SysUserWithUserGroupRelService {
entity.setCreateTime(now);
viewList.add(entity);
}
if (!CollectionUtils.isEmpty(viewList)) {
if (CollUtil.isNotEmpty(viewList)) {
userWithUserGroupRelViewMapper.batchInsert(viewList);
}
return XServiceResult.OK;
......@@ -88,13 +87,12 @@ public class SysUserWithUserGroupRelService {
public XServiceResult createSysUserWithUserGroupRel(XContext context, CreateSysUserWithUserGroupRelInput input) {
//删除原关系
SysUserWithUserGroupRelMapper delMapper = context.getBean(SysUserWithUserGroupRelMapper.class);
QueryWrapper<SysUserWithUserGroupRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserId, input.getUserId());
PageHelper.startPage(1, 1000);
List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(sysUserGroupEnts)) {
List<String> collect = sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList());
delMapper.deleteBatchIds(collect);
List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(new QueryWrapper<SysUserWithUserGroupRelEnt>()
.lambda()
.eq(SysUserWithUserGroupRelEnt::getUserId, input.getUserId()));
if (CollUtil.isNotEmpty(sysUserGroupEnts)) {
delMapper.deleteBatchIds(sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()));
}
SysUserWithUserGroupRelMapper mapper = context.getBean(SysUserWithUserGroupRelMapper.class);
List<SysUserWithUserGroupRelEnt> list = new ArrayList<>();
......@@ -113,13 +111,12 @@ public class SysUserWithUserGroupRelService {
public XServiceResult createSysUserGroupWithUserRel(XContext context, CreateSysUserGroupWithUserRelInput input) {
//删除原关系
SysUserWithUserGroupRelMapper delMapper = context.getBean(SysUserWithUserGroupRelMapper.class);
QueryWrapper<SysUserWithUserGroupRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserGroupId, input.getUserGroupId());
PageHelper.startPage(1, 1000);
List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(sysUserGroupEnts)) {
List<String> collect = sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList());
delMapper.deleteBatchIds(collect);
List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(new QueryWrapper<SysUserWithUserGroupRelEnt>()
.lambda()
.eq(SysUserWithUserGroupRelEnt::getUserGroupId, input.getUserGroupId()));
if (CollUtil.isNotEmpty(sysUserGroupEnts)) {
delMapper.deleteBatchIds(sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()));
}
SysUserWithUserGroupRelMapper mapper = context.getBean(SysUserWithUserGroupRelMapper.class);
List<SysUserWithUserGroupRelEnt> list = new ArrayList<>();
......
package pps.core.system.service;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import pps.cloud.system.service.SystemAreaService;
import pps.cloud.system.service.data.sys_area.GetSysAreaInput;
import pps.cloud.system.service.data.sys_area.GetSysAreaOutput;
......@@ -20,7 +21,6 @@ import xstartup.data.XSingleResult;
import xstartup.feature.api.annotation.XApiPost;
import java.util.List;
import java.util.Objects;
@XService
public class SystemAreaServiceImpl implements SystemAreaService {
......@@ -48,9 +48,9 @@ public class SystemAreaServiceImpl implements SystemAreaService {
Integer parentId = input.getParentId();
SysAreaMapper mapper = context.getBean(SysAreaMapper.class);
SysAreaEnt sysAreaEnt = mapper.selectOne(new LambdaQueryWrapper<SysAreaEnt>()
.eq(Objects.nonNull(id), SysAreaEnt::getId, id)
.eq(Objects.nonNull(parentId), SysAreaEnt::getParentId, parentId)
.eq(StringUtils.isNotEmpty(name), SysAreaEnt::getName, name)
.eq(ObjectUtil.isNotNull(id), SysAreaEnt::getId, id)
.eq(ObjectUtil.isNotNull(parentId), SysAreaEnt::getParentId, parentId)
.eq(CharSequenceUtil.isNotBlank(name), SysAreaEnt::getName, name)
.last(BusinessConstant.LAST_LIMIT)
);
return XSingleResult.success(XCopyUtils.copyNewObject(sysAreaEnt, GetSysAreaOutput.class));
......
package pps.core.system.utils;
import org.apache.commons.lang3.StringUtils;
import cn.hutool.core.text.CharSequenceUtil;
import pps.core.common.utils.PatternUtil;
import pps.core.common.utils.RSAUtil;
import pps.core.system.config.LoginConfig;
......@@ -18,7 +18,7 @@ public class UserInfoUtil {
//敏感信息rsa加密
public static String encrypt(String str) {
if (StringUtils.isBlank(str)) {
if (CharSequenceUtil.isBlank(str)) {
return str;
}
XContext context = XServiceContext.build(UserInfoUtil.class);
......@@ -29,7 +29,7 @@ public class UserInfoUtil {
//敏感信息rsa解密
public static String decrypt(String str) {
if (StringUtils.isBlank(str)) {
if (CharSequenceUtil.isBlank(str)) {
return str;
}
XContext context = XServiceContext.build(UserInfoUtil.class);
......
package pps.core.base.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.util.CollectionUtils;
import pps.core.base.entity.BaseDataEnt;
import pps.core.base.entity.BaseDataImportLogEnt;
import pps.core.base.entity.BaseDataView;
......@@ -337,7 +337,7 @@ public class BaseDataService {
BaseDataImportLogEnt ent = logMapper.selectOne(logEntQueryWrapper);
if (ent == null)
return XServiceResult.OK;
if (!CollectionUtils.isEmpty(input.getKeyNames())) {
if (CollUtil.isNotEmpty(input.getKeyNames())) {
for (String keyName : input.getKeyNames()) {
CalcBaseDataInput calcBaseDataInput = new CalcBaseDataInput("", keyName, input.getLineId(), "train_val", XDateUtils.getString(ent.getBeginDate()), XDateUtils.getString(ent.getEndDate()));
doTrainData(context, calcBaseDataInput);
......
package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import org.springframework.util.CollectionUtils;
import pps.core.base.entity.BaseLineAttenuationRateEnt;
import pps.core.base.entity.BaseLineAttenuationRateView;
import pps.core.base.entity.BaseProjectInfoEnt;
......@@ -66,7 +66,7 @@ public class BaseProjectInfoService {
entity.setIsDeleted(0);
mapper.insert(entity);
List<BaseLineAttenuationRateView> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(input.getList())) {
if (CollUtil.isNotEmpty(input.getList())) {
BaseLineAttenuationRateViewMapper rateMapper = context.getBean(BaseLineAttenuationRateViewMapper.class);
for (CreateBaseLineAttenuationRateInput rateInput : input.getList()) {
BaseLineAttenuationRateView ent = XCopyUtils.copyNewObject(rateInput, BaseLineAttenuationRateView.class);
......@@ -107,7 +107,7 @@ public class BaseProjectInfoService {
queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getType, 1);
rateMapper.delete(queryRateWrapper);
List<BaseLineAttenuationRateView> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(input.getList())) {
if (CollUtil.isNotEmpty(input.getList())) {
BaseLineAttenuationRateViewMapper rateViewMapper = context.getBean(BaseLineAttenuationRateViewMapper.class);
for (CreateBaseLineAttenuationRateInput rateInput : input.getList()) {
BaseLineAttenuationRateView ent = XCopyUtils.copyNewObject(rateInput, BaseLineAttenuationRateView.class);
......@@ -157,7 +157,7 @@ public class BaseProjectInfoService {
queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getLineId, entity.getId());
queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getType, 1);
List<BaseLineAttenuationRateEnt> list = rateMapper.selectList(queryRateWrapper);
if (!CollectionUtils.isEmpty(list)) {
if (CollUtil.isNotEmpty(list)) {
List<CreateBaseLineAttenuationRateInput> rateInputs = XCopyUtils.copyNewList(list, CreateBaseLineAttenuationRateInput.class);
output.setList(rateInputs);
}
......
package pps.core.base.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.core.base.entity.SysPageInfoEnt;
import pps.core.base.mapper.SysPageInfoMapper;
import pps.core.base.service.data.sys_page_info.*;
......@@ -54,13 +54,13 @@ public class SysPageInfoService {
if (entity == null) {
return XServiceResult.error(context, XError.NotFound);
}
if (StringUtils.isNotBlank(input.getPageContext())) {
if (CharSequenceUtil.isNotBlank(input.getPageContext())) {
entity.setPageContext(input.getPageContext());
}
if (StringUtils.isNotBlank(input.getPageName())) {
if (CharSequenceUtil.isNotBlank(input.getPageName())) {
entity.setPageName(input.getPageName());
}
if (StringUtils.isNotBlank(input.getPageRemark())) {
if (CharSequenceUtil.isNotBlank(input.getPageRemark())) {
entity.setPageRemark(input.getPageRemark());
}
entity.setModifyTime(new Date());
......@@ -104,10 +104,10 @@ public class SysPageInfoService {
public XPageResult<QuerySysPageInfoOutput> querySysPageInfo(XContext context, QuerySysPageInfoInput input) {
SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class);
QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(input.getPageId())) {
if (CharSequenceUtil.isNotBlank(input.getPageId())) {
queryWrapper.lambda().eq(SysPageInfoEnt::getPageId, input.getPageId());
}
if (StringUtils.isNotBlank(input.getPageName())) {
if (CharSequenceUtil.isNotBlank(input.getPageName())) {
queryWrapper.lambda().like(SysPageInfoEnt::getPageName, input.getPageName());
}
if (ObjectUtils.isNotEmpty(input.getReleaseState())) {
......
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