给系统管理模块增加操作的判断条件
This commit is contained in:
@@ -77,7 +77,9 @@ public class FunctionService {
|
|||||||
public List<FunctionEx> select(String name, String type, int offset, int rows)throws Exception {
|
public List<FunctionEx> select(String name, String type, int offset, int rows)throws Exception {
|
||||||
List<FunctionEx> list=null;
|
List<FunctionEx> list=null;
|
||||||
try{
|
try{
|
||||||
list= functionMapperEx.selectByConditionFunction(name, type, offset, rows);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
list = functionMapperEx.selectByConditionFunction(name, type, offset, rows);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -87,7 +89,9 @@ public class FunctionService {
|
|||||||
public Long countFunction(String name, String type)throws Exception {
|
public Long countFunction(String name, String type)throws Exception {
|
||||||
Long result=null;
|
Long result=null;
|
||||||
try{
|
try{
|
||||||
result= functionMapperEx.countsByFunction(name, type);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = functionMapperEx.countsByFunction(name, type);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -99,11 +103,13 @@ public class FunctionService {
|
|||||||
Function functions = JSONObject.parseObject(obj.toJSONString(), Function.class);
|
Function functions = JSONObject.parseObject(obj.toJSONString(), Function.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
functions.setState(false);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
functions.setType("电脑版");
|
functions.setState(false);
|
||||||
result=functionsMapper.insertSelective(functions);
|
functions.setType("电脑版");
|
||||||
logService.insertLog("功能",
|
result = functionsMapper.insertSelective(functions);
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(functions.getName()).toString(),request);
|
logService.insertLog("功能",
|
||||||
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(functions.getName()).toString(), request);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -115,9 +121,11 @@ public class FunctionService {
|
|||||||
Function functions = JSONObject.parseObject(obj.toJSONString(), Function.class);
|
Function functions = JSONObject.parseObject(obj.toJSONString(), Function.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=functionsMapper.updateByPrimaryKeySelective(functions);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
logService.insertLog("功能",
|
result = functionsMapper.updateByPrimaryKeySelective(functions);
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(functions.getName()).toString(), request);
|
logService.insertLog("功能",
|
||||||
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(functions.getName()).toString(), request);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -142,13 +150,15 @@ public class FunctionService {
|
|||||||
for(Function functions: list){
|
for(Function functions: list){
|
||||||
sb.append("[").append(functions.getName()).append("]");
|
sb.append("[").append(functions.getName()).append("]");
|
||||||
}
|
}
|
||||||
logService.insertLog("功能", sb.toString(),
|
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
String [] idArray=ids.split(",");
|
String [] idArray=ids.split(",");
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result = functionMapperEx.batchDeleteFunctionByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = functionMapperEx.batchDeleteFunctionByIds(new Date(), userInfo == null ? null : userInfo.getId(), idArray);
|
||||||
|
logService.insertLog("功能", sb.toString(),
|
||||||
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ public class MaterialPropertyService {
|
|||||||
public List<MaterialProperty> select(String name, int offset, int rows)throws Exception {
|
public List<MaterialProperty> select(String name, int offset, int rows)throws Exception {
|
||||||
List<MaterialProperty> list=null;
|
List<MaterialProperty> list=null;
|
||||||
try{
|
try{
|
||||||
list=materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
list = materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -74,7 +76,9 @@ public class MaterialPropertyService {
|
|||||||
public Long countMaterialProperty(String name)throws Exception {
|
public Long countMaterialProperty(String name)throws Exception {
|
||||||
Long result=null;
|
Long result=null;
|
||||||
try{
|
try{
|
||||||
result=materialPropertyMapperEx.countsByMaterialProperty(name);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = materialPropertyMapperEx.countsByMaterialProperty(name);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -86,9 +90,11 @@ public class MaterialPropertyService {
|
|||||||
MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class);
|
MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=materialPropertyMapper.insertSelective(materialProperty);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
logService.insertLog("商品属性",
|
result = materialPropertyMapper.insertSelective(materialProperty);
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(materialProperty.getNativeName()).toString(), request);
|
logService.insertLog("商品属性",
|
||||||
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(materialProperty.getNativeName()).toString(), request);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -100,9 +106,11 @@ public class MaterialPropertyService {
|
|||||||
MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class);
|
MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
logService.insertLog("商品属性",
|
result = materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialProperty.getNativeName()).toString(), request);
|
logService.insertLog("商品属性",
|
||||||
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialProperty.getNativeName()).toString(), request);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -121,14 +129,16 @@ public class MaterialPropertyService {
|
|||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteMaterialPropertyByIds(String ids) throws Exception{
|
public int batchDeleteMaterialPropertyByIds(String ids) throws Exception{
|
||||||
logService.insertLog("商品属性",
|
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
String [] idArray=ids.split(",");
|
String [] idArray=ids.split(",");
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=materialPropertyMapperEx.batchDeleteMaterialPropertyByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = materialPropertyMapperEx.batchDeleteMaterialPropertyByIds(new Date(), userInfo == null ? null : userInfo.getId(), idArray);
|
||||||
|
logService.insertLog("商品属性",
|
||||||
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.jsh.erp.service.platformConfig;
|
package com.jsh.erp.service.platformConfig;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.entities.PlatformConfig;
|
import com.jsh.erp.datasource.entities.PlatformConfig;
|
||||||
import com.jsh.erp.datasource.entities.PlatformConfigExample;
|
import com.jsh.erp.datasource.entities.PlatformConfigExample;
|
||||||
import com.jsh.erp.datasource.mappers.PlatformConfigMapper;
|
import com.jsh.erp.datasource.mappers.PlatformConfigMapper;
|
||||||
import com.jsh.erp.datasource.mappers.PlatformConfigMapperEx;
|
import com.jsh.erp.datasource.mappers.PlatformConfigMapperEx;
|
||||||
import com.jsh.erp.exception.JshException;
|
import com.jsh.erp.exception.JshException;
|
||||||
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -20,6 +22,9 @@ import java.util.List;
|
|||||||
public class PlatformConfigService {
|
public class PlatformConfigService {
|
||||||
private Logger logger = LoggerFactory.getLogger(PlatformConfigService.class);
|
private Logger logger = LoggerFactory.getLogger(PlatformConfigService.class);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PlatformConfigMapper platformConfigMapper;
|
private PlatformConfigMapper platformConfigMapper;
|
||||||
|
|
||||||
@@ -51,7 +56,9 @@ public class PlatformConfigService {
|
|||||||
public List<PlatformConfig> select(String platformKey, int offset, int rows)throws Exception {
|
public List<PlatformConfig> select(String platformKey, int offset, int rows)throws Exception {
|
||||||
List<PlatformConfig> list=null;
|
List<PlatformConfig> list=null;
|
||||||
try{
|
try{
|
||||||
list=platformConfigMapperEx.selectByConditionPlatformConfig(platformKey, offset, rows);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
list = platformConfigMapperEx.selectByConditionPlatformConfig(platformKey, offset, rows);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -61,7 +68,9 @@ public class PlatformConfigService {
|
|||||||
public Long countPlatformConfig(String platformKey)throws Exception {
|
public Long countPlatformConfig(String platformKey)throws Exception {
|
||||||
Long result=null;
|
Long result=null;
|
||||||
try{
|
try{
|
||||||
result=platformConfigMapperEx.countsByPlatformConfig(platformKey);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = platformConfigMapperEx.countsByPlatformConfig(platformKey);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -73,7 +82,9 @@ public class PlatformConfigService {
|
|||||||
PlatformConfig platformConfig = JSONObject.parseObject(obj.toJSONString(), PlatformConfig.class);
|
PlatformConfig platformConfig = JSONObject.parseObject(obj.toJSONString(), PlatformConfig.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=platformConfigMapper.insertSelective(platformConfig);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = platformConfigMapper.insertSelective(platformConfig);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -85,7 +96,9 @@ public class PlatformConfigService {
|
|||||||
PlatformConfig platformConfig = JSONObject.parseObject(obj.toJSONString(), PlatformConfig.class);
|
PlatformConfig platformConfig = JSONObject.parseObject(obj.toJSONString(), PlatformConfig.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result = platformConfigMapper.updateByPrimaryKeySelective(platformConfig);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = platformConfigMapper.updateByPrimaryKeySelective(platformConfig);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -96,7 +109,9 @@ public class PlatformConfigService {
|
|||||||
public int deletePlatformConfig(Long id, HttpServletRequest request)throws Exception {
|
public int deletePlatformConfig(Long id, HttpServletRequest request)throws Exception {
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=platformConfigMapper.deleteByPrimaryKey(id);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = platformConfigMapper.deleteByPrimaryKey(id);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -110,7 +125,9 @@ public class PlatformConfigService {
|
|||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=platformConfigMapper.deleteByExample(example);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = platformConfigMapper.deleteByExample(example);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -120,11 +137,13 @@ public class PlatformConfigService {
|
|||||||
public int updatePlatformConfigByKey(String platformKey, String platformValue)throws Exception {
|
public int updatePlatformConfigByKey(String platformKey, String platformValue)throws Exception {
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
PlatformConfig platformConfig = new PlatformConfig();
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
platformConfig.setPlatformValue(platformValue);
|
PlatformConfig platformConfig = new PlatformConfig();
|
||||||
PlatformConfigExample example = new PlatformConfigExample();
|
platformConfig.setPlatformValue(platformValue);
|
||||||
example.createCriteria().andPlatformKeyEqualTo(platformKey);
|
PlatformConfigExample example = new PlatformConfigExample();
|
||||||
result = platformConfigMapper.updateByExampleSelective(platformConfig, example);
|
example.createCriteria().andPlatformKeyEqualTo(platformKey);
|
||||||
|
result = platformConfigMapper.updateByExampleSelective(platformConfig, example);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.UserMapperEx;
|
|||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.exception.JshException;
|
import com.jsh.erp.exception.JshException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import com.jsh.erp.utils.Tools;
|
import com.jsh.erp.utils.Tools;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -37,6 +38,9 @@ public class TenantService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserMapperEx userMapperEx;
|
private UserMapperEx userMapperEx;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
@@ -70,11 +74,13 @@ public class TenantService {
|
|||||||
public List<TenantEx> select(String loginName, String type, String enabled, int offset, int rows)throws Exception {
|
public List<TenantEx> select(String loginName, String type, String enabled, int offset, int rows)throws Exception {
|
||||||
List<TenantEx> list= new ArrayList<>();
|
List<TenantEx> list= new ArrayList<>();
|
||||||
try{
|
try{
|
||||||
list = tenantMapperEx.selectByConditionTenant(loginName, type, enabled, offset, rows);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
if (null != list) {
|
list = tenantMapperEx.selectByConditionTenant(loginName, type, enabled, offset, rows);
|
||||||
for (TenantEx tenantEx : list) {
|
if (null != list) {
|
||||||
tenantEx.setCreateTimeStr(Tools.getCenternTime(tenantEx.getCreateTime()));
|
for (TenantEx tenantEx : list) {
|
||||||
tenantEx.setExpireTimeStr(Tools.getCenternTime(tenantEx.getExpireTime()));
|
tenantEx.setCreateTimeStr(Tools.getCenternTime(tenantEx.getCreateTime()));
|
||||||
|
tenantEx.setExpireTimeStr(Tools.getCenternTime(tenantEx.getExpireTime()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
@@ -86,7 +92,9 @@ public class TenantService {
|
|||||||
public Long countTenant(String loginName, String type, String enabled)throws Exception {
|
public Long countTenant(String loginName, String type, String enabled)throws Exception {
|
||||||
Long result=null;
|
Long result=null;
|
||||||
try{
|
try{
|
||||||
result=tenantMapperEx.countsByTenant(loginName, type, enabled);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = tenantMapperEx.countsByTenant(loginName, type, enabled);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -105,7 +113,9 @@ public class TenantService {
|
|||||||
if(tenant.getExpireTime()==null) {
|
if(tenant.getExpireTime()==null) {
|
||||||
tenant.setExpireTime(Tools.addDays(new Date(), tryDayLimit)); //租户允许试用的天数
|
tenant.setExpireTime(Tools.addDays(new Date(), tryDayLimit)); //租户允许试用的天数
|
||||||
}
|
}
|
||||||
result=tenantMapper.insertSelective(tenant);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = tenantMapper.insertSelective(tenant);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -117,11 +127,13 @@ public class TenantService {
|
|||||||
Tenant tenant = JSONObject.parseObject(obj.toJSONString(), Tenant.class);
|
Tenant tenant = JSONObject.parseObject(obj.toJSONString(), Tenant.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
//如果租户下的用户限制数量为1,则将该租户之外的用户全部禁用
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
if(1 == tenant.getUserNumLimit()) {
|
//如果租户下的用户限制数量为1,则将该租户之外的用户全部禁用
|
||||||
userMapperEx.disableUserByLimit(tenant.getTenantId());
|
if (1 == tenant.getUserNumLimit()) {
|
||||||
|
userMapperEx.disableUserByLimit(tenant.getTenantId());
|
||||||
|
}
|
||||||
|
result = tenantMapper.updateByPrimaryKeySelective(tenant);
|
||||||
}
|
}
|
||||||
result=tenantMapper.updateByPrimaryKeySelective(tenant);
|
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -132,7 +144,9 @@ public class TenantService {
|
|||||||
public int deleteTenant(Long id, HttpServletRequest request)throws Exception {
|
public int deleteTenant(Long id, HttpServletRequest request)throws Exception {
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result= tenantMapper.deleteByPrimaryKey(id);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = tenantMapper.deleteByPrimaryKey(id);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -146,7 +160,9 @@ public class TenantService {
|
|||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result= tenantMapper.deleteByExample(example);
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
|
result = tenantMapper.deleteByExample(example);
|
||||||
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
@@ -179,21 +195,23 @@ public class TenantService {
|
|||||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
String statusStr ="";
|
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||||
if(status) {
|
String statusStr = "";
|
||||||
statusStr ="批量启用";
|
if (status) {
|
||||||
} else {
|
statusStr = "批量启用";
|
||||||
statusStr ="批量禁用";
|
} else {
|
||||||
|
statusStr = "批量禁用";
|
||||||
|
}
|
||||||
|
logService.insertLog("用户",
|
||||||
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ids).append("-").append(statusStr).toString(),
|
||||||
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
|
Tenant tenant = new Tenant();
|
||||||
|
tenant.setEnabled(status);
|
||||||
|
TenantExample example = new TenantExample();
|
||||||
|
example.createCriteria().andIdIn(idList);
|
||||||
|
result = tenantMapper.updateByExampleSelective(tenant, example);
|
||||||
}
|
}
|
||||||
logService.insertLog("用户",
|
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ids).append("-").append(statusStr).toString(),
|
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
|
||||||
Tenant tenant = new Tenant();
|
|
||||||
tenant.setEnabled(status);
|
|
||||||
TenantExample example = new TenantExample();
|
|
||||||
example.createCriteria().andIdIn(idList);
|
|
||||||
result = tenantMapper.updateByExampleSelective(tenant, example);
|
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user