!28 同步Ruoyi更新调整快递相关查询排序

Merge pull request !28 from Bo/bo_dev
This commit is contained in:
Bo 2021-08-16 10:10:59 +00:00 committed by Gitee
commit 52e52b642a
21 changed files with 236 additions and 105 deletions

View File

@ -22,11 +22,18 @@ public class ExpressInfo extends BaseEntity
@Excel(name = "消息",type= Excel.Type.EXPORT)
private String message;
/** 出货单号 */
@Excel(name = "出货单号")
private String deliveryNum;
/** 送货客户*/
@Excel(name = "送货客户")
private String customer;
/** 客服人员*/
@Excel(name = "客服人员")
private String csName;
/** 快递单号 */
@Excel(name = "快递单号")
private String nu;
@ -97,6 +104,7 @@ public class ExpressInfo extends BaseEntity
/** 查询类型*/
private String queryType;
public static long getSerialVersionUID() {
return serialVersionUID;
}
@ -269,6 +277,22 @@ public class ExpressInfo extends BaseEntity
this.queryType = queryType;
}
public String getCsName() {
return csName;
}
public void setCsName(String csName) {
this.csName = csName;
}
public String getCustomer() {
return customer;
}
public void setCustomer(String customer) {
this.customer = customer;
}
@Override
public String toString() {
return "ExpressInfo{" +
@ -293,6 +317,8 @@ public class ExpressInfo extends BaseEntity
", queryUserName='" + queryUserName + '\'' +
", queryId='" + queryId + '\'' +
", queryType='" + queryType + '\'' +
", csName='" + csName + '\'' +
", customer='" + customer + '\'' +
'}';
}
}

View File

@ -140,6 +140,8 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
ei.setQueryUserName(ShiroUtils.getSysUser().getUserName());
ei.setQueryType("excel");
ei.setQueryTime(queryTime);
ei.setCustomer(expressInfo.getCustomer()); //送货客户
ei.setCsName(expressInfo.getCsName()); //客服人员
//expressInfoService.insertExpressInfo(ei);
expressInfoListForInsert.add(ei);
/* for(int i=1;i<1001;i++){ //测试批量插入效率用时打开Mark产生5万条数据

View File

@ -26,12 +26,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="queryId" column="queryId" />
<result property="queryType" column="queryType" />
<result property="deliveryNum" column="deliveryNum" />
<result property="csName" column="csName" />
<result property="customer" column="customer" />
</resultMap>
<sql id="selectExpressInfoVo">
select sid, message, nu, deliveryNum, ischeck, com, status, `data`, `state`, `condition`, routeInfo, returnCode, `result`, phone,
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType, csName, customer
from expressInfo
</sql>
@ -43,6 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="queryId != null and queryId != ''"> and queryId = #{queryId}</if>
<if test="deliveryNum != null and deliveryNum != ''"> and deliveryNum = #{deliveryNum}</if>
<if test="csName != null and csName != ''"> and csName = #{csName}</if>
<if test="customer != null and customer != ''"> and customer = #{customer}</if>
</where>
</select>
@ -74,6 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="queryId != null">queryId,</if>
<if test="queryType != null">queryType,</if>
<if test="deliveryNum != null">deliveryNum,</if>
<if test="csName != null">csName,</if>
<if test="customer != null">customer,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="message != null">#{message},</if>
@ -96,6 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="queryId != null">#{queryId},</if>
<if test="queryType != null">#{queryType},</if>
<if test="deliveryNum != null">#{deliveryNum},</if>
<if test="csName != null">#{csName},</if>
<if test="customer != null">#{customer},</if>
</trim>
</insert>
@ -121,6 +129,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="queryId != null">queryId = #{queryId},</if>
<if test="queryType != null">queryType = #{queryType},</if>
<if test="deliveryNum != null">deliveryNum = #{deliveryNum},</if>
<if test="csName != null">csName = #{csName},</if>
<if test="customer != null">customer = #{customer},</if>
</trim>
where message = #{message}
</update>
@ -138,12 +148,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchInsertExpressInfo">
insert into expressInfo(message, nu, deliveryNum, ischeck, com, status, `data`, `state`, `condition`, routeInfo, returnCode, `result`, phone,
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType) values
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType, csName, customer) values
<foreach item="expressInfo" index="index" collection="list" separator=",">
( #{expressInfo.message}, #{expressInfo.nu}, #{expressInfo.deliveryNum}, #{expressInfo.ischeck}, #{expressInfo.com}, #{expressInfo.status},
#{expressInfo.data}, #{expressInfo.state}, #{expressInfo.condition}, #{expressInfo.routeInfo}, #{expressInfo.returnCode},
#{expressInfo.result}, #{expressInfo.phone}, #{expressInfo.collectTime}, #{expressInfo.singedTime}, #{expressInfo.lastUpdateTime},
#{expressInfo.queryTime}, #{expressInfo.queryUserName}, #{expressInfo.queryId}, #{expressInfo.queryType}
#{expressInfo.queryTime}, #{expressInfo.queryUserName}, #{expressInfo.queryId}, #{expressInfo.queryType}, #{expressInfo.csName}, #{expressInfo.customer}
)
</foreach>
</insert>

View File

@ -55,6 +55,14 @@
field: 'deliveryNum',
title: '出货单号'
},
{
field: 'customer',
title: '送货客户'
},
{
field: 'csName',
title: '客服人员'
},
{
field: 'nu',
title: '快递单号'

View File

@ -84,6 +84,8 @@
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}",
sortName: "lastresponsetime",
sortOrder: "desc",
modalName: "快递订阅推送信息",
columns: [{
checkbox: true

View File

@ -90,6 +90,8 @@
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
sortName: "subscribetime",
sortOrder: "desc",
modalName: "快递订阅",
columns: [{
checkbox: true

View File

@ -18,7 +18,7 @@ import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.controller.demo.domain.CustomerModel;
@ -265,7 +265,7 @@ public class DemoOperateController extends BaseController
{
if (StringUtils.isNull(userList) || userList.size() == 0)
{
throw new BusinessException("导入用户数据不能为空!");
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
@ -315,7 +315,7 @@ public class DemoOperateController extends BaseController
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new BusinessException(failureMsg.toString());
throw new ServiceException(failureMsg.toString());
}
else
{

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RuoYi - 403</title>
<title>RuoYi - 500</title>
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
<link th:href="@{/css/animate.min.css}" rel="stylesheet"/>
<link th:href="@{/css/style.min.css}" rel="stylesheet"/>

View File

@ -1,30 +0,0 @@
package com.ruoyi.common.exception;
/**
* 业务异常
*
* @author ruoyi
*/
public class BusinessException extends RuntimeException
{
private static final long serialVersionUID = 1L;
protected final String message;
public BusinessException(String message)
{
this.message = message;
}
public BusinessException(String message, Throwable e)
{
super(message, e);
this.message = message;
}
@Override
public String getMessage()
{
return message;
}
}

View File

@ -0,0 +1,58 @@
package com.ruoyi.common.exception;
/**
* 全局异常
*
* @author ruoyi
*/
public class GlobalException extends RuntimeException
{
private static final long serialVersionUID = 1L;
/**
* 错误提示
*/
private String message;
/**
* 错误明细内部调试错误
*
* {@link CommonResult#getDetailMessage()} 一致的设计
*/
private String detailMessage;
/**
* 空构造方法避免反序列化问题
*/
public GlobalException()
{
}
public GlobalException(String message)
{
this.message = message;
}
public String getDetailMessage()
{
return detailMessage;
}
public GlobalException setDetailMessage(String detailMessage)
{
this.detailMessage = detailMessage;
return this;
}
public String getMessage()
{
return message;
}
public GlobalException setMessage(String message)
{
this.message = message;
return this;
}
}

View File

@ -0,0 +1,57 @@
package com.ruoyi.common.exception;
/**
* 业务异常
*
* @author ruoyi
*/
public final class ServiceException extends RuntimeException
{
private static final long serialVersionUID = 1L;
/**
* 错误提示
*/
private String message;
/**
* 错误明细内部调试错误
*
* {@link CommonResult#getDetailMessage()} 一致的设计
*/
private String detailMessage;
/**
* 空构造方法避免反序列化问题
*/
public ServiceException()
{
}
public ServiceException(String message)
{
this.message = message;
}
public String getDetailMessage()
{
return detailMessage;
}
public ServiceException setDetailMessage(String detailMessage)
{
this.detailMessage = detailMessage;
return this;
}
public String getMessage()
{
return message;
}
public ServiceException setMessage(String message)
{
this.message = message;
return this;
}
}

View File

@ -292,13 +292,13 @@ public class HttpUtils
}
log.info("recv - {}", result);
} catch (ConnectException e) {
log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
log.error("调用HttpUtils.sendXmlPost ConnectException, url=" + url + ",param=" + param, e);
} catch (SocketTimeoutException e) {
log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e);
log.error("调用HttpUtils.sendXmlPost SocketTimeoutException, url=" + url + ",param=" + param, e);
} catch (IOException e) {
log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e);
log.error("调用HttpUtils.sendXmlPost IOException, url=" + url + ",param=" + param, e);
} catch (Exception e) {
log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e);
log.error("调用HttpsUtil.sendXmlPost Exception, url=" + url + ",param=" + param, e);
} finally {
try {
if (out != null) {
@ -334,7 +334,7 @@ public class HttpUtils
result=restTemplate.postForEntity(url,params,String.class);
statusCode=result.getStatusCode().value();
}catch (RestClientException e){
System.out.println("POST Request uri: "+url+", params:"+params+" error:"+e.getMessage());
log.error("POST Request uri: "+url+", params:"+params+" error:"+e.getMessage());
}
Map<String,String> map=new HashMap<>();
map.put("statusCode",String.valueOf(statusCode));
@ -343,7 +343,6 @@ public class HttpUtils
} else{
map.put("result",String.valueOf(statusCode));
}
return map;
}
}

View File

@ -66,7 +66,7 @@ import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.UtilException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
@ -195,11 +195,11 @@ public class ExcelUtil<T>
Map<String, PictureData> pictures;
if (isXSSFWorkbook)
{
pictures = getSheetPictrues07((XSSFSheet) sheet, (XSSFWorkbook) wb);
pictures = getSheetPictures07((XSSFSheet) sheet, (XSSFWorkbook) wb);
}
else
{
pictures = getSheetPictrues03((HSSFSheet) sheet, (HSSFWorkbook) wb);
pictures = getSheetPictures03((HSSFSheet) sheet, (HSSFWorkbook) wb);
}
// 获取最后一个非空行的行下标比如总行数为n则返回的为n-1
int rows = sheet.getLastRowNum();
@ -450,7 +450,7 @@ public class ExcelUtil<T>
catch (Exception e)
{
log.error("导出Excel异常{}", e.getMessage());
throw new BusinessException("导出Excel失败请联系网站管理员");
throw new UtilException("导出Excel失败请联系网站管理员");
}
finally
{
@ -1197,7 +1197,7 @@ public class ExcelUtil<T>
* @param workbook 工作簿对象
* @return Map key:图片单元格索引1_1Stringvalue:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictrues03(HSSFSheet sheet, HSSFWorkbook workbook)
public static Map<String, PictureData> getSheetPictures03(HSSFSheet sheet, HSSFWorkbook workbook)
{
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
List<HSSFPictureData> pictures = workbook.getAllPictures();
@ -1230,7 +1230,7 @@ public class ExcelUtil<T>
* @param workbook 工作簿对象
* @return Map key:图片单元格索引1_1Stringvalue:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictrues07(XSSFSheet sheet, XSSFWorkbook workbook)
public static Map<String, PictureData> getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook)
{
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
for (POIXMLDocumentPart dr : sheet.getRelations())

View File

@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.ModelAndView;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.DemoModeException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.PermissionUtils;
@ -27,63 +27,62 @@ public class GlobalExceptionHandler
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
* 权限校验失败 如果请求为ajax返回json普通请求跳转页面
* 权限校验异常ajax请求返回jsonredirect请求跳转页面
*/
@ExceptionHandler(AuthorizationException.class)
public Object handleAuthorizationException(HttpServletRequest request, AuthorizationException e)
public Object handleAuthorizationException(AuthorizationException e, HttpServletRequest request)
{
log.error(e.getMessage(), e);
String requestURI = request.getRequestURI();
log.error("请求地址'{}',权限校验失败'{}'", requestURI, e.getMessage());
if (ServletUtils.isAjaxRequest(request) || StringUtils.isNotEmpty(request.getHeader("token")))
{
return AjaxResult.error(PermissionUtils.getMsg(e.getMessage()));
}
else
{
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("error/unauth");
return modelAndView;
return new ModelAndView("error/unauth");
}
}
/**
* 请求方式不支持
*/
@ExceptionHandler({ HttpRequestMethodNotSupportedException.class })
public AjaxResult handleException(HttpRequestMethodNotSupportedException e, HttpServletRequest request)
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e,
HttpServletRequest request)
{
String requestURI = request.getRequestURI();
String msg = String.format("访问的URL[%s]不支持%s请求", requestURI, e.getMethod());
log.error(msg, e);
return AjaxResult.error(msg);
log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod());
return AjaxResult.error(e.getMessage());
}
/**
* 拦截未知的运行时异常
*/
@ExceptionHandler(RuntimeException.class)
public AjaxResult notFount(RuntimeException e, HttpServletRequest request)
public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request)
{
String requestURI = request.getRequestURI();
String msg = String.format("访问的URL[%s]发生异常%s", requestURI, e.getMessage());
log.error(msg, e);
return AjaxResult.error(msg);
log.error("请求地址'{}',发生未知异常.", requestURI, e);
return AjaxResult.error(e.getMessage());
}
/**
* 系统异常
*/
@ExceptionHandler(Exception.class)
public AjaxResult handleException(Exception e)
public AjaxResult handleException(Exception e, HttpServletRequest request)
{
log.error(e.getMessage(), e);
return AjaxResult.error("服务器错误,请联系管理员");
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生系统异常.", requestURI, e);
return AjaxResult.error(e.getMessage());
}
/**
* 业务异常
*/
@ExceptionHandler(BusinessException.class)
public Object businessException(HttpServletRequest request, BusinessException e)
@ExceptionHandler(ServiceException.class)
public Object handleServiceException(ServiceException e, HttpServletRequest request)
{
log.error(e.getMessage(), e);
if (ServletUtils.isAjaxRequest(request))
@ -92,10 +91,7 @@ public class GlobalExceptionHandler
}
else
{
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("errorMessage", e.getMessage());
modelAndView.setViewName("error/business");
return modelAndView;
return new ModelAndView("error/service", "errorMessage", e.getMessage());
}
}
@ -103,7 +99,7 @@ public class GlobalExceptionHandler
* 自定义验证异常
*/
@ExceptionHandler(BindException.class)
public AjaxResult validatedBindException(BindException e)
public AjaxResult handleBindException(BindException e)
{
log.error(e.getMessage(), e);
String message = e.getAllErrors().get(0).getDefaultMessage();
@ -114,7 +110,7 @@ public class GlobalExceptionHandler
* 演示模式异常
*/
@ExceptionHandler(DemoModeException.class)
public AjaxResult demoModeException(DemoModeException e)
public AjaxResult handleDemoModeException(DemoModeException e)
{
return AjaxResult.error("演示模式,不允许操作");
}

View File

@ -26,7 +26,7 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.text.CharsetKit;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
@ -181,7 +181,7 @@ public class GenTableServiceImpl implements IGenTableService
}
catch (Exception e)
{
throw new BusinessException("导入失败:" + e.getMessage());
throw new ServiceException("导入失败:" + e.getMessage());
}
}
@ -270,7 +270,7 @@ public class GenTableServiceImpl implements IGenTableService
}
catch (IOException e)
{
throw new BusinessException("渲染模板失败,表名:" + table.getTableName());
throw new ServiceException("渲染模板失败,表名:" + table.getTableName());
}
}
}
@ -292,7 +292,7 @@ public class GenTableServiceImpl implements IGenTableService
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
if (StringUtils.isEmpty(dbTableColumns))
{
throw new BusinessException("同步数据失败,原表结构不存在");
throw new ServiceException("同步数据失败,原表结构不存在");
}
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
@ -385,26 +385,26 @@ public class GenTableServiceImpl implements IGenTableService
JSONObject paramsObj = JSONObject.parseObject(options);
if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE)))
{
throw new BusinessException("树编码字段不能为空");
throw new ServiceException("树编码字段不能为空");
}
else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE)))
{
throw new BusinessException("树父编码字段不能为空");
throw new ServiceException("树父编码字段不能为空");
}
else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME)))
{
throw new BusinessException("树名称字段不能为空");
throw new ServiceException("树名称字段不能为空");
}
}
else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
{
if (StringUtils.isEmpty(genTable.getSubTableName()))
{
throw new BusinessException("关联子表的表名不能为空");
throw new ServiceException("关联子表的表名不能为空");
}
else if (StringUtils.isEmpty(genTable.getSubTableFkName()))
{
throw new BusinessException("子表关联的外键名不能为空");
throw new ServiceException("子表关联的外键名不能为空");
}
}
}

View File

@ -7,7 +7,7 @@ import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.CacheUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysConfig;
@ -134,7 +134,7 @@ public class SysConfigServiceImpl implements ISysConfigService
SysConfig config = selectConfigById(configId);
if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
{
throw new BusinessException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
}
configMapper.deleteConfigById(configId);
CacheUtils.remove(getCacheName(), getCacheKey(config.getConfigKey()));

View File

@ -8,9 +8,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
@ -222,7 +221,7 @@ public class SysDeptServiceImpl implements ISysDeptService
// 如果父节点不为"正常"状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
throw new BusinessException("部门停用,不允许新增");
throw new ServiceException("部门停用,不允许新增");
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.insertDept(dept);

View File

@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDictDataMapper;
@ -126,7 +126,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
SysDictType dictType = selectDictTypeById(dictId);
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
{
throw new BusinessException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
}
dictTypeMapper.deleteDictTypeById(dictId);
DictUtils.removeDictCache(dictType.getDictType());

View File

@ -5,7 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.mapper.SysPostMapper;
@ -93,7 +93,7 @@ public class SysPostServiceImpl implements ISysPostService
* @throws Exception
*/
@Override
public int deletePostByIds(String ids) throws BusinessException
public int deletePostByIds(String ids)
{
Long[] postIds = Convert.toLongArray(ids);
for (Long postId : postIds)
@ -101,7 +101,7 @@ public class SysPostServiceImpl implements ISysPostService
SysPost post = selectPostById(postId);
if (countUserPostById(postId) > 0)
{
throw new BusinessException(String.format("%1$s已分配,不能删除", post.getPostName()));
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
}
}
return postMapper.deletePostByIds(postIds);

View File

@ -12,7 +12,7 @@ import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysRoleDept;
@ -160,7 +160,7 @@ public class SysRoleServiceImpl implements ISysRoleService
SysRole role = selectRoleById(roleId);
if (countUserRoleByRoleId(roleId) > 0)
{
throw new BusinessException(String.format("%1$s已分配,不能删除", role.getRoleName()));
throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
}
}
// 删除角色与菜单关联
@ -314,7 +314,7 @@ public class SysRoleServiceImpl implements ISysRoleService
{
if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin())
{
throw new BusinessException("不允许操作超级管理员角色");
throw new ServiceException("不允许操作超级管理员角色");
}
}

View File

@ -8,12 +8,15 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.security.Md5Utils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.EcologyUser;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
@ -25,7 +28,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -405,7 +407,7 @@ public class SysUserServiceImpl implements ISysUserService
{
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
{
throw new BusinessException("不允许操作超级管理员用户");
throw new ServiceException("不允许操作超级管理员用户");
}
}
@ -466,7 +468,7 @@ public class SysUserServiceImpl implements ISysUserService
{
if (StringUtils.isNull(userList) || userList.size() == 0)
{
throw new BusinessException("导入用户数据不能为空!");
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
@ -511,7 +513,7 @@ public class SysUserServiceImpl implements ISysUserService
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new BusinessException(failureMsg.toString());
throw new ServiceException(failureMsg.toString());
}
else
{