|
@@ -3,13 +3,11 @@ package com.qmth.themis.backend.api;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
-import com.qmth.themis.business.config.SystemConfig;
|
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.dto.response.TBOrgDto;
|
|
import com.qmth.themis.business.dto.response.TBOrgDto;
|
|
import com.qmth.themis.business.entity.TBOrg;
|
|
import com.qmth.themis.business.entity.TBOrg;
|
|
import com.qmth.themis.business.entity.TBUser;
|
|
import com.qmth.themis.business.entity.TBUser;
|
|
import com.qmth.themis.business.service.TBOrgService;
|
|
import com.qmth.themis.business.service.TBOrgService;
|
|
-import com.qmth.themis.business.util.EhcacheUtil;
|
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
import com.qmth.themis.common.contanst.Constants;
|
|
import com.qmth.themis.common.contanst.Constants;
|
|
@@ -18,7 +16,6 @@ import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
-import org.springframework.cache.annotation.CachePut;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -45,7 +42,7 @@ public class TBOrgController {
|
|
@Resource
|
|
@Resource
|
|
RedisUtil redisUtil;
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
-// @CachePut(value = "org_cache", key = "'orgCacheQuery'")
|
|
|
|
|
|
+ // @CachePut(value = "org_cache", key = "'orgCacheQuery'")
|
|
// @Cacheable(value = "org_cache", key = "#p0")
|
|
// @Cacheable(value = "org_cache", key = "#p0")
|
|
@ApiOperation(value = "机构查询分页接口")
|
|
@ApiOperation(value = "机构查询分页接口")
|
|
@RequestMapping(value = "/query", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/query", method = RequestMethod.POST)
|
|
@@ -63,6 +60,9 @@ public class TBOrgController {
|
|
if (Objects.isNull(tbOrg)) {
|
|
if (Objects.isNull(tbOrg)) {
|
|
throw new BusinessException(ExceptionResultEnum.ORG_INFO_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.ORG_INFO_IS_NULL);
|
|
}
|
|
}
|
|
|
|
+ if (Objects.nonNull(tbOrg.getCode()) && Objects.equals(tbOrg.getCode().toUpperCase(), SystemConstant.ADMIN)) {
|
|
|
|
+ throw new BusinessException("admin为超级管理员专属code,请重新输入");
|
|
|
|
+ }
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
if (Objects.isNull(tbOrg.getId())) {
|
|
if (Objects.isNull(tbOrg.getId())) {
|
|
tbOrg.setId(Constants.idGen.next());
|
|
tbOrg.setId(Constants.idGen.next());
|
|
@@ -71,7 +71,7 @@ public class TBOrgController {
|
|
tbOrg.setUpdateId(tbUser.getId());
|
|
tbOrg.setUpdateId(tbUser.getId());
|
|
}
|
|
}
|
|
redisUtil.setOrg(tbOrg.getId(), tbOrg);
|
|
redisUtil.setOrg(tbOrg.getId(), tbOrg);
|
|
- EhcacheUtil.put(SystemConstant.orgCodeCache, tbOrg.getCode(), tbOrg);
|
|
|
|
|
|
+ redisUtil.setOrgCode(tbOrg.getCode(), tbOrg);
|
|
tbOrgService.saveOrUpdate(tbOrg);
|
|
tbOrgService.saveOrUpdate(tbOrg);
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
@@ -103,7 +103,7 @@ public class TBOrgController {
|
|
tbOrg.setEnable(enable);
|
|
tbOrg.setEnable(enable);
|
|
tbOrgService.updateById(tbOrg);
|
|
tbOrgService.updateById(tbOrg);
|
|
redisUtil.setOrg(orgId, tbOrg);
|
|
redisUtil.setOrg(orgId, tbOrg);
|
|
- EhcacheUtil.put(SystemConstant.orgCodeCache, tbOrg.getCode(), tbOrg);
|
|
|
|
|
|
+ redisUtil.setOrgCode(tbOrg.getCode(), tbOrg);
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
}
|
|
}
|