From 083c8709506ecf860cb1a2ff11916c2abc44e10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Thu, 5 Sep 2019 18:20:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=BC=82=E5=B8=B8=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsh/erp/exception/JshException.java | 27 +++ .../erp/service/account/AccountService.java | 101 +++-------- .../accountHead/AccountHeadService.java | 71 ++------ .../accountItem/AccountItemService.java | 66 ++----- .../com/jsh/erp/service/app/AppService.java | 71 ++------ .../jsh/erp/service/depot/DepotService.java | 86 ++------- .../service/depotHead/DepotHeadService.java | 151 ++++------------ .../service/depotItem/DepotItemService.java | 138 +++------------ .../service/functions/FunctionsService.java | 66 ++----- .../service/inOutItem/InOutItemService.java | 61 ++----- .../com/jsh/erp/service/log/LogService.java | 46 ++--- .../erp/service/material/MaterialService.java | 99 +++-------- .../MaterialCategoryService.java | 86 ++------- .../MaterialPropertyService.java | 46 ++--- .../orgaUserRel/OrgaUserRelService.java | 31 +--- .../organization/OrganizationService.java | 51 ++---- .../jsh/erp/service/person/PersonService.java | 71 ++------ .../com/jsh/erp/service/role/RoleService.java | 51 ++---- .../serialNumber/SerialNumberService.java | 101 +++-------- .../erp/service/supplier/SupplierService.java | 108 +++--------- .../systemConfig/SystemConfigService.java | 51 ++---- .../jsh/erp/service/tenant/TenantService.java | 46 ++--- .../com/jsh/erp/service/unit/UnitService.java | 56 ++---- .../com/jsh/erp/service/user/UserService.java | 165 +++++------------- .../userBusiness/UserBusinessService.java | 71 ++------ .../java/com/jsh/erp/utils/JshException.java | 63 ------- 26 files changed, 439 insertions(+), 1541 deletions(-) create mode 100644 src/main/java/com/jsh/erp/exception/JshException.java delete mode 100644 src/main/java/com/jsh/erp/utils/JshException.java diff --git a/src/main/java/com/jsh/erp/exception/JshException.java b/src/main/java/com/jsh/erp/exception/JshException.java new file mode 100644 index 00000000..d23a1ae3 --- /dev/null +++ b/src/main/java/com/jsh/erp/exception/JshException.java @@ -0,0 +1,27 @@ +package com.jsh.erp.exception; + +import com.jsh.erp.constants.ExceptionConstants; +import org.slf4j.Logger; + +/** + * 封装日志打印,收集日志 + * author: ji shenghua, qq 752718 920 + */ +public class JshException { + + public static void readFail(Logger logger, Exception e) { + logger.error("异常码[{}],异常提示[{}],异常[{}]", + ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e); + throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, + ExceptionConstants.DATA_READ_FAIL_MSG); + } + + public static void writeFail(Logger logger, Exception e) { + logger.error("异常码[{}],异常提示[{}],异常[{}]", + ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); + throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, + ExceptionConstants.DATA_WRITE_FAIL_MSG); + } + + +} diff --git a/src/main/java/com/jsh/erp/service/account/AccountService.java b/src/main/java/com/jsh/erp/service/account/AccountService.java index e49c5fc3..fd077e4d 100644 --- a/src/main/java/com/jsh/erp/service/account/AccountService.java +++ b/src/main/java/com/jsh/erp/service/account/AccountService.java @@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.*; import com.jsh.erp.datasource.vo.AccountVo4InOutList; import com.jsh.erp.datasource.vo.AccountVo4List; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -69,10 +70,7 @@ public class AccountService { try{ list=accountMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; @@ -84,10 +82,7 @@ public class AccountService { try{ list = accountMapperEx.selectByConditionAccount(name, serialNo, remark, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } String timeStr = Tools.getCurrentMonth(); if (null != list && null !=timeStr) { @@ -112,10 +107,7 @@ public class AccountService { try{ result=accountMapperEx.countsByAccount(name, serialNo, remark); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -131,10 +123,7 @@ public class AccountService { try{ result = accountMapper.insertSelective(account); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -147,10 +136,7 @@ public class AccountService { try{ result = accountMapper.updateByPrimaryKeySelective(account); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -161,10 +147,7 @@ public class AccountService { try{ result = accountMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -178,10 +161,7 @@ public class AccountService { try{ result = accountMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -193,10 +173,7 @@ public class AccountService { try{ list = accountMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -209,10 +186,7 @@ public class AccountService { try{ list = accountMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -247,10 +221,7 @@ public class AccountService { try{ dataList = depotHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (dataList != null) { for (DepotHead depotHead : dataList) { @@ -296,10 +267,7 @@ public class AccountService { try{ dataList = accountHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (dataList != null) { for (AccountHead accountHead : dataList) { @@ -340,10 +308,7 @@ public class AccountService { try{ dataList = accountHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (dataList != null) { String ids = ""; @@ -411,10 +376,7 @@ public class AccountService { try{ dataList = depotHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (dataList != null) { for (DepotHead depotHead : dataList) { @@ -442,10 +404,7 @@ public class AccountService { try{ list = accountMapperEx.findAccountInOutList(accountId, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -455,10 +414,7 @@ public class AccountService { try{ result = accountMapperEx.findAccountInOutListCount(accountId); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -475,10 +431,7 @@ public class AccountService { try{ result = accountMapper.updateByExampleSelective(account, example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -493,10 +446,7 @@ public class AccountService { try{ result = accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -530,10 +480,7 @@ public class AccountService { try{ accountHeadList = accountHeadMapperEx.getAccountHeadListByAccountIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(accountHeadList!=null&&accountHeadList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]", @@ -548,10 +495,7 @@ public class AccountService { try{ accountItemList = accountItemMapperEx.getAccountItemListByAccountIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(accountItemList!=null&&accountItemList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]", @@ -566,10 +510,7 @@ public class AccountService { try{ depotHeadList = depotHeadMapperEx.getDepotHeadListByAccountIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(depotHeadList!=null&&depotHeadList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java b/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java index 77b529a1..9d485400 100644 --- a/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java +++ b/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java @@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.AccountHeadMapper; import com.jsh.erp.datasource.mappers.AccountHeadMapperEx; import com.jsh.erp.datasource.mappers.AccountItemMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -47,10 +48,7 @@ public class AccountHeadService { try{ result=accountHeadMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -61,10 +59,7 @@ public class AccountHeadService { try{ list=accountHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -75,10 +70,7 @@ public class AccountHeadService { try{ list = accountHeadMapperEx.selectByConditionAccountHead(type, billNo, beginTime, endTime, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (null != list) { for (AccountHeadVo4ListEx ah : list) { @@ -99,10 +91,7 @@ public class AccountHeadService { try{ result = accountHeadMapperEx.countsByAccountHead(type, billNo, beginTime, endTime); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -114,10 +103,7 @@ public class AccountHeadService { try{ result = accountHeadMapper.insertSelective(accountHead); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -130,10 +116,7 @@ public class AccountHeadService { try{ result = accountHeadMapper.updateByPrimaryKeySelective(accountHead); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -144,10 +127,7 @@ public class AccountHeadService { try{ result = accountHeadMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -161,10 +141,7 @@ public class AccountHeadService { try{ result = accountHeadMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -176,10 +153,7 @@ public class AccountHeadService { try{ list = accountHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -189,10 +163,7 @@ public class AccountHeadService { try{ result = accountHeadMapperEx.getMaxId(); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -208,10 +179,7 @@ public class AccountHeadService { try{ result = accountHeadMapperEx.findAllMoney(supplierId, type, modeName, endTime); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -272,10 +240,7 @@ public class AccountHeadService { try{ list = accountHeadMapperEx.getDetailByNumber(billNo); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (null != list) { for (AccountHeadVo4ListEx ah : list) { @@ -301,10 +266,7 @@ public class AccountHeadService { try{ result = accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -336,10 +298,7 @@ public class AccountHeadService { try{ accountItemList = accountItemMapperEx.getAccountItemListByHeaderIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(accountItemList!=null&&accountItemList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,HeaderIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java b/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java index 4aed68c9..e02d5820 100644 --- a/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java +++ b/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java @@ -12,6 +12,7 @@ import com.jsh.erp.datasource.mappers.AccountItemMapper; import com.jsh.erp.datasource.mappers.AccountItemMapperEx; import com.jsh.erp.datasource.vo.AccountItemVo4List; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.ErpInfo; @@ -51,10 +52,7 @@ public class AccountItemService { try{ result=accountItemMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -66,10 +64,7 @@ public class AccountItemService { try{ list=accountItemMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -79,10 +74,7 @@ public class AccountItemService { try{ list = accountItemMapperEx.selectByConditionAccountItem(name, type, remark, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -92,10 +84,7 @@ public class AccountItemService { try{ result = accountItemMapperEx.countsByAccountItem(name, type, remark); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -107,10 +96,7 @@ public class AccountItemService { try{ result = accountItemMapper.insertSelective(accountItem); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -123,10 +109,7 @@ public class AccountItemService { try{ result = accountItemMapper.updateByPrimaryKeySelective(accountItem); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -137,10 +120,7 @@ public class AccountItemService { try{ result = accountItemMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -154,10 +134,7 @@ public class AccountItemService { try{ result = accountItemMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -169,10 +146,7 @@ public class AccountItemService { try{ list = accountItemMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -183,10 +157,7 @@ public class AccountItemService { try{ result = accountItemMapper.insertSelective(accountItem); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -197,10 +168,7 @@ public class AccountItemService { try{ result = accountItemMapper.updateByPrimaryKeySelective(accountItem); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -210,10 +178,7 @@ public class AccountItemService { try{ list = accountItemMapperEx.getDetailList(headerId); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -301,10 +266,7 @@ public class AccountItemService { try{ result = accountItemMapperEx.batchDeleteAccountItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } diff --git a/src/main/java/com/jsh/erp/service/app/AppService.java b/src/main/java/com/jsh/erp/service/app/AppService.java index 907d5c5c..86683dd8 100644 --- a/src/main/java/com/jsh/erp/service/app/AppService.java +++ b/src/main/java/com/jsh/erp/service/app/AppService.java @@ -10,6 +10,7 @@ import com.jsh.erp.datasource.entities.UserBusiness; import com.jsh.erp.datasource.mappers.AppMapper; import com.jsh.erp.datasource.mappers.AppMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.userBusiness.UserBusinessService; @@ -50,10 +51,7 @@ public class AppService { try{ list=appMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -73,10 +71,7 @@ public class AppService { try{ list=appMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -86,10 +81,7 @@ public class AppService { try{ result=appMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -101,10 +93,7 @@ public class AppService { try{ list=appMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -114,10 +103,7 @@ public class AppService { try{ list=appMapperEx.selectByConditionApp(name, type, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -127,10 +113,7 @@ public class AppService { try{ result=appMapperEx.countsByApp(name, type); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -142,10 +125,7 @@ public class AppService { try{ result=appMapper.insertSelective(app); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -158,10 +138,7 @@ public class AppService { try{ result=appMapper.updateByPrimaryKeySelective(app); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -172,10 +149,7 @@ public class AppService { try{ result=appMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -189,10 +163,7 @@ public class AppService { try{ result=appMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -205,10 +176,7 @@ public class AppService { try{ list=appMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -223,10 +191,7 @@ public class AppService { try{ list=appMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -241,10 +206,7 @@ public class AppService { try{ result=appMapperEx.batchDeleteAppByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -285,10 +247,7 @@ public class AppService { try{ list=appMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } diff --git a/src/main/java/com/jsh/erp/service/depot/DepotService.java b/src/main/java/com/jsh/erp/service/depot/DepotService.java index a999ee23..d349f620 100644 --- a/src/main/java/com/jsh/erp/service/depot/DepotService.java +++ b/src/main/java/com/jsh/erp/service/depot/DepotService.java @@ -7,6 +7,7 @@ import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.mappers.*; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -46,10 +47,7 @@ public class DepotService { try{ result=depotMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -61,10 +59,7 @@ public class DepotService { try{ list=depotMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -77,10 +72,7 @@ public class DepotService { try{ list=depotMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -90,10 +82,7 @@ public class DepotService { try{ list=depotMapperEx.selectByConditionDepot(name, type, remark, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -103,10 +92,7 @@ public class DepotService { try{ result=depotMapperEx.countsByDepot(name, type, remark); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -118,10 +104,7 @@ public class DepotService { try{ result=depotMapper.insertSelective(depot); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -134,10 +117,7 @@ public class DepotService { try{ result= depotMapper.updateByPrimaryKeySelective(depot); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -148,10 +128,7 @@ public class DepotService { try{ result= depotMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -165,10 +142,7 @@ public class DepotService { try{ result= depotMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -180,10 +154,7 @@ public class DepotService { try{ list= depotMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -196,10 +167,7 @@ public class DepotService { try{ list= depotMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -212,10 +180,7 @@ public class DepotService { try{ list= depotMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -225,10 +190,7 @@ public class DepotService { try{ list= depotMapperEx.getDepotList(parameterMap); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -243,10 +205,7 @@ public class DepotService { try{ result= depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -280,10 +239,7 @@ public class DepotService { try{ depotHeadList= depotHeadMapperEx.getDepotHeadListByDepotIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(depotHeadList!=null&&depotHeadList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]", @@ -298,10 +254,7 @@ public class DepotService { try{ depotItemList= depotItemMapperEx.getDepotItemListListByDepotIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(depotItemList!=null&&depotItemList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]", @@ -329,10 +282,7 @@ public class DepotService { try{ result = depotMapper.updateByExampleSelective(depot, example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } diff --git a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java index 00030dc6..d4e99b22 100644 --- a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java +++ b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java @@ -15,6 +15,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount; import com.jsh.erp.datasource.vo.DepotHeadVo4List; import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.serialNumber.SerialNumberService; @@ -65,10 +66,7 @@ public class DepotHeadService { try{ result=depotHeadMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -80,10 +78,7 @@ public class DepotHeadService { try{ list=depotHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -95,10 +90,7 @@ public class DepotHeadService { try{ list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, number, beginTime, endTime, materialParam, depotIds, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (null != list) { for (DepotHeadVo4List dh : list) { @@ -134,10 +126,7 @@ public class DepotHeadService { try{ result=depotHeadMapperEx.countsByDepotHead(type, subType, number, beginTime, endTime, materialParam, depotIds); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -158,10 +147,7 @@ public class DepotHeadService { try{ result=depotHeadMapper.insert(depotHead); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -172,10 +158,7 @@ public class DepotHeadService { try{ dh = depotHeadMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class); depotHead.setId(id); @@ -186,10 +169,7 @@ public class DepotHeadService { try{ result = depotHeadMapper.updateByPrimaryKey(depotHead); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -200,10 +180,7 @@ public class DepotHeadService { try{ result = depotHeadMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -217,10 +194,7 @@ public class DepotHeadService { try{ result = depotHeadMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -232,10 +206,7 @@ public class DepotHeadService { try{ list = depotHeadMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -254,10 +225,7 @@ public class DepotHeadService { try{ result = depotHeadMapper.updateByExampleSelective(depotHead, example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -272,10 +240,7 @@ public class DepotHeadService { depotHeadMapperEx.updateBuildOnlyNumber(); //编号+1 buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } } if(buildOnlyNumber0){ logger.error("异常码[{}],异常提示[{}],参数,InOutItemIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/log/LogService.java b/src/main/java/com/jsh/erp/service/log/LogService.java index 4a984080..b7eccc69 100644 --- a/src/main/java/com/jsh/erp/service/log/LogService.java +++ b/src/main/java/com/jsh/erp/service/log/LogService.java @@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.LogMapper; import com.jsh.erp.datasource.mappers.LogMapperEx; import com.jsh.erp.datasource.vo.LogVo4List; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.Tools; import org.slf4j.Logger; @@ -38,10 +39,7 @@ public class LogService { try{ result=logMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -52,10 +50,7 @@ public class LogService { try{ list=logMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -72,10 +67,7 @@ public class LogService { } } }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -86,10 +78,7 @@ public class LogService { try{ result=logMapperEx.countsByLog(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -101,10 +90,7 @@ public class LogService { try{ result=logMapper.insertSelective(log); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -117,10 +103,7 @@ public class LogService { try{ result=logMapper.updateByPrimaryKeySelective(log); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -131,10 +114,7 @@ public class LogService { try{ result=logMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -148,10 +128,7 @@ public class LogService { try{ result=logMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -233,10 +210,7 @@ public class LogService { try{ logMapper.insertSelective(log); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } } diff --git a/src/main/java/com/jsh/erp/service/material/MaterialService.java b/src/main/java/com/jsh/erp/service/material/MaterialService.java index ef40bd5d..4dc9df06 100644 --- a/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.DepotItemMapperEx; import com.jsh.erp.datasource.mappers.MaterialMapper; import com.jsh.erp.datasource.mappers.MaterialMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; @@ -47,10 +48,7 @@ public class MaterialService { try{ result=materialMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -62,10 +60,7 @@ public class MaterialService { try{ list=materialMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -78,10 +73,7 @@ public class MaterialService { try{ list= materialMapperEx.selectByConditionMaterial(name, model,categoryIds,mpList, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (null != list) { for (MaterialVo4Unit m : list) { @@ -122,10 +114,7 @@ public class MaterialService { try{ result= materialMapperEx.countsByMaterial(name, model,categoryIds,mpList); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -138,10 +127,7 @@ public class MaterialService { try{ result= materialMapper.insertSelective(material); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -160,10 +146,7 @@ public class MaterialService { materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空 } }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return res; @@ -175,10 +158,7 @@ public class MaterialService { try{ result= materialMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -192,10 +172,7 @@ public class MaterialService { try{ result= materialMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -207,10 +184,7 @@ public class MaterialService { try{ list= materialMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -235,10 +209,7 @@ public class MaterialService { try{ list= materialMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -257,10 +228,7 @@ public class MaterialService { try{ result= materialMapper.updateByExampleSelective(material, example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -270,10 +238,7 @@ public class MaterialService { try{ result= materialMapperEx.findUnitName(mId); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -283,10 +248,7 @@ public class MaterialService { try{ list= materialMapperEx.findById(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -296,10 +258,7 @@ public class MaterialService { try{ list= materialMapperEx.findBySelect(); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -312,10 +271,7 @@ public class MaterialService { try{ list= materialMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -326,10 +282,7 @@ public class MaterialService { try{ list= materialMapperEx.findByAll(name, model, categoryIds); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (null != list) { for (MaterialVo4Unit m : list) { @@ -352,8 +305,7 @@ public class MaterialService { info.code = 200; data.put("message", "成功"); } catch (Exception e) { - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); + JshException.writeFail(logger, e); e.printStackTrace(); info.code = 500; data.put("message", e.getMessage()); @@ -367,10 +319,7 @@ public class MaterialService { try{ list= materialMapperEx.getMaterialEnableSerialNumberList(parameterMap); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -385,10 +334,7 @@ public class MaterialService { try{ result= materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -421,10 +367,7 @@ public class MaterialService { try{ depotItemList= depotItemMapperEx.getDepotItemListListByMaterialIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(depotItemList!=null&&depotItemList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,MaterialIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java index 44816478..789aa6ff 100644 --- a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java +++ b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java @@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx; import com.jsh.erp.datasource.mappers.MaterialMapperEx; import com.jsh.erp.datasource.vo.TreeNode; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -46,10 +47,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -60,10 +58,7 @@ public class MaterialCategoryService { try{ list=materialCategoryMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -73,10 +68,7 @@ public class MaterialCategoryService { try{ list = getMCList(parentId); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -105,10 +97,7 @@ public class MaterialCategoryService { try{ list=materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -118,10 +107,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapperEx.countsByMaterialCategory(name, parentId); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -133,10 +119,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapper.insertSelective(materialCategory); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -149,10 +132,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapper.updateByPrimaryKeySelective(materialCategory); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -163,10 +143,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -180,10 +157,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -199,10 +173,7 @@ public class MaterialCategoryService { try{ list=materialCategoryMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -219,10 +190,7 @@ public class MaterialCategoryService { try{ list=materialCategoryMapperEx.getNodeTree(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -264,10 +232,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapperEx.addMaterialCategory(mc); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -289,10 +254,7 @@ public class MaterialCategoryService { try{ result=materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -317,10 +279,7 @@ public class MaterialCategoryService { try{ result= materialCategoryMapperEx.editMaterialCategory(mc); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -339,10 +298,7 @@ public class MaterialCategoryService { try{ mList= materialCategoryMapperEx.getMaterialCategoryBySerialNo(mc.getSerialNo()); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(mList==null||mList.size()<1){ //未查询到对应数据,编号可用 @@ -397,10 +353,7 @@ public class MaterialCategoryService { try{ materialList= materialMapperEx.getMaterialListByCategoryIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(materialList!=null&&materialList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]", @@ -415,10 +368,7 @@ public class MaterialCategoryService { try{ materialCategoryList= materialCategoryMapperEx.getMaterialCategoryListByCategoryIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(materialCategoryList!=null&&materialCategoryList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java b/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java index 4e9537d7..35a58476 100644 --- a/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java +++ b/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java @@ -9,6 +9,7 @@ import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.MaterialPropertyMapper; import com.jsh.erp.datasource.mappers.MaterialPropertyMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -43,10 +44,7 @@ public class MaterialPropertyService { try{ result=materialPropertyMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -58,10 +56,7 @@ public class MaterialPropertyService { try{ list=materialPropertyMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -71,10 +66,7 @@ public class MaterialPropertyService { try{ list=materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -84,10 +76,7 @@ public class MaterialPropertyService { try{ result=materialPropertyMapperEx.countsByMaterialProperty(name); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -99,10 +88,7 @@ public class MaterialPropertyService { try{ result=materialPropertyMapper.insertSelective(materialProperty); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -115,10 +101,7 @@ public class MaterialPropertyService { try{ result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -129,10 +112,7 @@ public class MaterialPropertyService { try{ result=materialPropertyMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -146,10 +126,7 @@ public class MaterialPropertyService { try{ result=materialPropertyMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -168,10 +145,7 @@ public class MaterialPropertyService { try{ result=materialPropertyMapperEx.batchDeleteMaterialPropertyByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; diff --git a/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java b/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java index aaea62d6..0d57cf84 100644 --- a/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java +++ b/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java @@ -9,6 +9,7 @@ import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.OrgaUserRelMapper; import com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.organization.OrganizationService; import com.jsh.erp.service.user.UserService; @@ -53,10 +54,7 @@ public class OrgaUserRelService { try{ result=orgaUserRelMapper.insertSelective(orgaUserRel); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -68,10 +66,7 @@ public class OrgaUserRelService { try{ result=orgaUserRelMapper.updateByPrimaryKeySelective(orgaUserRel); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -81,10 +76,7 @@ public class OrgaUserRelService { try{ result=orgaUserRelMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -97,10 +89,7 @@ public class OrgaUserRelService { try{ result=orgaUserRelMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -137,10 +126,7 @@ public class OrgaUserRelService { try{ result=orgaUserRelMapperEx.addOrgaUserRel(orgaUserRel); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } if(result>0){ return orgaUserRel; @@ -170,10 +156,7 @@ public class OrgaUserRelService { try{ result=orgaUserRelMapperEx.updateOrgaUserRel(orgaUserRel); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } if(result>0){ return orgaUserRel; diff --git a/src/main/java/com/jsh/erp/service/organization/OrganizationService.java b/src/main/java/com/jsh/erp/service/organization/OrganizationService.java index cdae2fc0..2805b9d3 100644 --- a/src/main/java/com/jsh/erp/service/organization/OrganizationService.java +++ b/src/main/java/com/jsh/erp/service/organization/OrganizationService.java @@ -11,6 +11,7 @@ import com.jsh.erp.datasource.mappers.OrganizationMapper; import com.jsh.erp.datasource.mappers.OrganizationMapperEx; import com.jsh.erp.datasource.vo.TreeNode; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -56,10 +57,7 @@ public class OrganizationService { try{ result=organizationMapper.insertSelective(organization); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -71,10 +69,7 @@ public class OrganizationService { try{ result=organizationMapper.updateByPrimaryKeySelective(organization); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -84,10 +79,7 @@ public class OrganizationService { try{ result=organizationMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -100,10 +92,7 @@ public class OrganizationService { try{ result=organizationMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -138,10 +127,7 @@ public class OrganizationService { try{ result=organizationMapperEx.addOrganization(org); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -171,10 +157,7 @@ public class OrganizationService { try{ result=organizationMapperEx.editOrganization(org); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -184,10 +167,7 @@ public class OrganizationService { try{ list=organizationMapperEx.getNodeTree(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -199,10 +179,7 @@ public class OrganizationService { try{ list=organizationMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -214,10 +191,7 @@ public class OrganizationService { try{ list=organizationMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -269,10 +243,7 @@ public class OrganizationService { result=organizationMapperEx.batchDeleteOrganizationByIds( new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } diff --git a/src/main/java/com/jsh/erp/service/person/PersonService.java b/src/main/java/com/jsh/erp/service/person/PersonService.java index 3dea10df..f94d475b 100644 --- a/src/main/java/com/jsh/erp/service/person/PersonService.java +++ b/src/main/java/com/jsh/erp/service/person/PersonService.java @@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.DepotHeadMapperEx; import com.jsh.erp.datasource.mappers.PersonMapper; import com.jsh.erp.datasource.mappers.PersonMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -48,10 +49,7 @@ public class PersonService { try{ result=personMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -63,10 +61,7 @@ public class PersonService { try{ list=personMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -76,10 +71,7 @@ public class PersonService { try{ list=personMapperEx.selectByConditionPerson(name, type, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -89,10 +81,7 @@ public class PersonService { try{ result=personMapperEx.countsByPerson(name, type); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -104,10 +93,7 @@ public class PersonService { try{ result=personMapper.insertSelective(person); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -120,10 +106,7 @@ public class PersonService { try{ result=personMapper.updateByPrimaryKeySelective(person); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -134,10 +117,7 @@ public class PersonService { try{ result=personMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -151,10 +131,7 @@ public class PersonService { try{ result=personMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -166,10 +143,7 @@ public class PersonService { try{ list=personMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -183,10 +157,7 @@ public class PersonService { try{ list=personMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } StringBuffer sb = new StringBuffer(); if (null != list) { @@ -205,10 +176,7 @@ public class PersonService { try{ list=personMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -224,10 +192,7 @@ public class PersonService { try{ result=personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -260,10 +225,7 @@ public class PersonService { try{ accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(accountHeadList!=null&&accountHeadList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]", @@ -278,10 +240,7 @@ public class PersonService { try{ depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(depotHeadList!=null&&depotHeadList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/role/RoleService.java b/src/main/java/com/jsh/erp/service/role/RoleService.java index 74267a23..6a20514f 100644 --- a/src/main/java/com/jsh/erp/service/role/RoleService.java +++ b/src/main/java/com/jsh/erp/service/role/RoleService.java @@ -9,6 +9,7 @@ import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.RoleMapper; import com.jsh.erp.datasource.mappers.RoleMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -42,10 +43,7 @@ public class RoleService { try{ result=roleMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -57,10 +55,7 @@ public class RoleService { try{ list=roleMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -70,10 +65,7 @@ public class RoleService { try{ list=roleMapperEx.selectByConditionRole(name, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -83,10 +75,7 @@ public class RoleService { try{ result=roleMapperEx.countsByRole(name); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -98,10 +87,7 @@ public class RoleService { try{ result=roleMapper.insertSelective(role); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -114,10 +100,7 @@ public class RoleService { try{ result=roleMapper.updateByPrimaryKeySelective(role); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -128,10 +111,7 @@ public class RoleService { try{ result=roleMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -145,10 +125,7 @@ public class RoleService { try{ result=roleMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -161,10 +138,7 @@ public class RoleService { try{ list=roleMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -188,10 +162,7 @@ public class RoleService { try{ result=roleMapperEx.batchDeleteRoleByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } diff --git a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java index 0c1b1a06..ff8c85ed 100644 --- a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java +++ b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java @@ -6,6 +6,7 @@ import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.mappers.*; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.material.MaterialService; @@ -53,10 +54,7 @@ public class SerialNumberService { try{ result=serialNumberMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -67,10 +65,7 @@ public class SerialNumberService { try{ list=serialNumberMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -80,10 +75,7 @@ public class SerialNumberService { try{ list=serialNumberMapperEx.selectByConditionSerialNumber(serialNumber, materialName,offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; @@ -94,10 +86,7 @@ public class SerialNumberService { try{ result=serialNumberMapperEx.countSerialNumber(serialNumber, materialName); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -110,10 +99,7 @@ public class SerialNumberService { try{ result=serialNumberMapper.insertSelective(serialNumber); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -126,10 +112,7 @@ public class SerialNumberService { try{ result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -140,10 +123,7 @@ public class SerialNumberService { try{ result=serialNumberMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -157,10 +137,7 @@ public class SerialNumberService { try{ result=serialNumberMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -172,10 +149,7 @@ public class SerialNumberService { try{ list=serialNumberMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -192,10 +166,7 @@ public class SerialNumberService { try{ result=serialNumberMapper.updateByExampleSelective(serialNumber, example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -206,10 +177,7 @@ public class SerialNumberService { try{ list=serialNumberMapperEx.findById(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -226,10 +194,7 @@ public class SerialNumberService { try{ mlist = materialMapperEx.findByMaterialName(materialName); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(mlist==null||mlist.size()<1){ @@ -250,10 +215,7 @@ public class SerialNumberService { try{ list = serialNumberMapperEx.findBySerialNumber(serialNumber); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(list!=null&&list.size()>0){ if(list.size()>1){ @@ -305,10 +267,7 @@ public class SerialNumberService { try{ result = serialNumberMapperEx.addSerialNumber(serialNumberEx); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } if(result>0){ return serialNumberEx; @@ -333,10 +292,7 @@ public class SerialNumberService { try{ result = serialNumberMapperEx.updateSerialNumber(serialNumberEx); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } if(result>0){ return serialNumberEx; @@ -357,10 +313,7 @@ public class SerialNumberService { try{ mlist = materialMapperEx.findByMaterialName(materialName); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if (mlist == null || mlist.size() < 1) { //商品名称不存在 @@ -461,10 +414,7 @@ public class SerialNumberService { try{ result = serialNumberMapperEx.sellSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId()); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -486,10 +436,7 @@ public class SerialNumberService { try{ result = serialNumberMapperEx.cancelSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId()); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -543,10 +490,7 @@ public class SerialNumberService { try{ serialNumberMapperEx.batAddSerialNumber(list); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } } } @@ -570,10 +514,7 @@ public class SerialNumberService { try{ result = serialNumberMapperEx.batchDeleteSerialNumberByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; diff --git a/src/main/java/com/jsh/erp/service/supplier/SupplierService.java b/src/main/java/com/jsh/erp/service/supplier/SupplierService.java index 93ce849e..8bcb4269 100644 --- a/src/main/java/com/jsh/erp/service/supplier/SupplierService.java +++ b/src/main/java/com/jsh/erp/service/supplier/SupplierService.java @@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.DepotHeadMapperEx; import com.jsh.erp.datasource.mappers.SupplierMapper; import com.jsh.erp.datasource.mappers.SupplierMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.accountHead.AccountHeadService; import com.jsh.erp.service.depotHead.DepotHeadService; import com.jsh.erp.service.log.LogService; @@ -57,10 +58,7 @@ public class SupplierService { try{ result=supplierMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -72,10 +70,7 @@ public class SupplierService { try{ list=supplierMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -117,10 +112,7 @@ public class SupplierService { resList.add(s); } }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return resList; } @@ -130,10 +122,7 @@ public class SupplierService { try{ result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, description); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -145,10 +134,7 @@ public class SupplierService { try{ result=supplierMapper.insertSelective(supplier); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -167,10 +153,7 @@ public class SupplierService { try{ result=supplierMapper.updateByPrimaryKeySelective(supplier); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -181,10 +164,7 @@ public class SupplierService { try{ result=supplierMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return supplierMapper.deleteByPrimaryKey(id); } @@ -198,10 +178,7 @@ public class SupplierService { try{ result=supplierMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -213,10 +190,7 @@ public class SupplierService { try{ list= supplierMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -230,10 +204,7 @@ public class SupplierService { try{ supplier = supplierMapper.selectByPrimaryKey(supplierId); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } int result=0; try{ @@ -242,10 +213,7 @@ public class SupplierService { result=supplierMapper.updateByPrimaryKeySelective(supplier); } }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -258,10 +226,7 @@ public class SupplierService { try{ list = supplierMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -275,10 +240,7 @@ public class SupplierService { try{ list = supplierMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -292,10 +254,7 @@ public class SupplierService { try{ list = supplierMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -309,10 +268,7 @@ public class SupplierService { try{ list = supplierMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -331,10 +287,7 @@ public class SupplierService { try{ result = supplierMapper.updateByExampleSelective(supplier, example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -348,10 +301,7 @@ public class SupplierService { try{ list = supplierMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -362,10 +312,7 @@ public class SupplierService { try{ list = supplierMapperEx.findByAll(supplier, type, phonenum, telephone, description); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -383,8 +330,6 @@ public class SupplierService { info.code = 200; data.put("message", "成功"); } catch (Exception e) { - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); e.printStackTrace(); info.code = 500; data.put("message", e.getMessage()); @@ -403,10 +348,7 @@ public class SupplierService { try{ result = supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -439,10 +381,7 @@ public class SupplierService { try{ accountHeadList = accountHeadMapperEx.getAccountHeadListByOrganIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(accountHeadList!=null&&accountHeadList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]", @@ -457,10 +396,7 @@ public class SupplierService { try{ depotHeadList = depotHeadMapperEx.getDepotHeadListByOrganIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(depotHeadList!=null&&depotHeadList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java index f6331cbd..2585222c 100644 --- a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java +++ b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java @@ -10,6 +10,7 @@ import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.SystemConfigMapper; import com.jsh.erp.datasource.mappers.SystemConfigMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -44,10 +45,7 @@ public class SystemConfigService { try{ result=systemConfigMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -59,10 +57,7 @@ public class SystemConfigService { try{ list=systemConfigMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -71,10 +66,7 @@ public class SystemConfigService { try{ list=systemConfigMapperEx.selectByConditionSystemConfig(companyName, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -84,10 +76,7 @@ public class SystemConfigService { try{ result=systemConfigMapperEx.countsBySystemConfig(companyName); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -99,10 +88,7 @@ public class SystemConfigService { try{ result=systemConfigMapper.insertSelective(systemConfig); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -115,10 +101,7 @@ public class SystemConfigService { try{ result=systemConfigMapper.updateByPrimaryKeySelective(systemConfig); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -129,10 +112,7 @@ public class SystemConfigService { try{ result=systemConfigMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -146,10 +126,7 @@ public class SystemConfigService { try{ result=systemConfigMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -161,10 +138,7 @@ public class SystemConfigService { try{ list=systemConfigMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -180,10 +154,7 @@ public class SystemConfigService { try{ result=systemConfigMapperEx.batchDeleteSystemConfigByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } diff --git a/src/main/java/com/jsh/erp/service/tenant/TenantService.java b/src/main/java/com/jsh/erp/service/tenant/TenantService.java index 0f7f5b2d..1bc5c0c7 100644 --- a/src/main/java/com/jsh/erp/service/tenant/TenantService.java +++ b/src/main/java/com/jsh/erp/service/tenant/TenantService.java @@ -6,6 +6,7 @@ import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.mappers.TenantMapper; import com.jsh.erp.datasource.mappers.TenantMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.utils.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,10 +31,7 @@ public class TenantService { try{ result=tenantMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -44,10 +42,7 @@ public class TenantService { try{ list=tenantMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -57,10 +52,7 @@ public class TenantService { try{ list=tenantMapperEx.selectByConditionTenant(loginName, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -70,10 +62,7 @@ public class TenantService { try{ result=tenantMapperEx.countsByTenant(loginName); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -88,10 +77,7 @@ public class TenantService { tenant.setCreateTime(new Date()); result=tenantMapper.insertSelective(tenant); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -104,10 +90,7 @@ public class TenantService { tenant.setId(id); result=tenantMapper.updateByPrimaryKeySelective(tenant); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -118,10 +101,7 @@ public class TenantService { try{ result= tenantMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -135,10 +115,7 @@ public class TenantService { try{ result= tenantMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -150,10 +127,7 @@ public class TenantService { try{ list= tenantMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } diff --git a/src/main/java/com/jsh/erp/service/unit/UnitService.java b/src/main/java/com/jsh/erp/service/unit/UnitService.java index 8c160e96..f65bddc6 100644 --- a/src/main/java/com/jsh/erp/service/unit/UnitService.java +++ b/src/main/java/com/jsh/erp/service/unit/UnitService.java @@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.MaterialMapperEx; import com.jsh.erp.datasource.mappers.UnitMapper; import com.jsh.erp.datasource.mappers.UnitMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.StringUtil; @@ -45,10 +46,7 @@ public class UnitService { try{ result=unitMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -60,10 +58,7 @@ public class UnitService { try{ list=unitMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -73,10 +68,7 @@ public class UnitService { try{ list=unitMapperEx.selectByConditionUnit(name, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -86,10 +78,7 @@ public class UnitService { try{ result=unitMapperEx.countsByUnit(name); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -101,10 +90,7 @@ public class UnitService { try{ result=unitMapper.insertSelective(unit); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -117,10 +103,7 @@ public class UnitService { try{ result=unitMapper.updateByPrimaryKeySelective(unit); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -131,10 +114,7 @@ public class UnitService { try{ result=unitMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -148,10 +128,7 @@ public class UnitService { try{ result=unitMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -163,10 +140,7 @@ public class UnitService { try{ list=unitMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -181,10 +155,7 @@ public class UnitService { try{ result=unitMapperEx.batchDeleteUnitByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -217,10 +188,7 @@ public class UnitService { try{ materialList=materialMapperEx.getMaterialListByUnitIds(idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(materialList!=null&&materialList.size()>0){ logger.error("异常码[{}],异常提示[{}],参数,UnitIds[{}]", diff --git a/src/main/java/com/jsh/erp/service/user/UserService.java b/src/main/java/com/jsh/erp/service/user/UserService.java index ca2f67c7..100abaeb 100644 --- a/src/main/java/com/jsh/erp/service/user/UserService.java +++ b/src/main/java/com/jsh/erp/service/user/UserService.java @@ -13,12 +13,12 @@ import com.jsh.erp.datasource.mappers.UserMapper; import com.jsh.erp.datasource.mappers.UserMapperEx; import com.jsh.erp.datasource.vo.TreeNodeEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.orgaUserRel.OrgaUserRelService; import com.jsh.erp.service.tenant.TenantService; import com.jsh.erp.service.userBusiness.UserBusinessService; import com.jsh.erp.utils.ExceptionCodeConstants; -import com.jsh.erp.utils.JshException; import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.Tools; import org.slf4j.Logger; @@ -61,10 +61,7 @@ public class UserService { try{ result=userMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -75,10 +72,7 @@ public class UserService { try{ list=userMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -88,10 +82,7 @@ public class UserService { try{ list=userMapperEx.selectByConditionUser(userName, loginName, offset, rows); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -101,10 +92,7 @@ public class UserService { try{ result=userMapperEx.countsByUser(userName, loginName); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -133,10 +121,7 @@ public class UserService { try{ result=userMapper.insertSelective(user); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -157,10 +142,7 @@ public class UserService { try{ result=userMapper.updateByPrimaryKeySelective(user); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -181,10 +163,7 @@ public class UserService { try{ result=userMapper.updateByPrimaryKeySelective(user); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -209,10 +188,7 @@ public class UserService { try{ result=userMapper.updateByPrimaryKeySelective(user); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -223,10 +199,7 @@ public class UserService { try{ result= userMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -240,49 +213,40 @@ public class UserService { try{ result= userMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } - public int validateUser(String username, String password) throws JshException { + public int validateUser(String username, String password) throws Exception { + /**默认是可以登录的*/ + List list = null; try { - /**默认是可以登录的*/ - List list = null; - try { - UserExample example = new UserExample(); - example.createCriteria().andLoginameEqualTo(username); - list = userMapper.selectByExample(example); - } catch (Exception e) { - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e); - return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; - } - - if (null != list && list.size() == 0) { - return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST; - } - - try { - UserExample example = new UserExample(); - example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password); - list = userMapper.selectByExample(example); - } catch (Exception e) { - logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e); - return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; - } - - if (null != list && list.size() == 0) { - return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR; - } - return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT; + UserExample example = new UserExample(); + example.createCriteria().andLoginameEqualTo(username); + list = userMapper.selectByExample(example); } catch (Exception e) { - throw new JshException("unknown exception", e); + logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e); + return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; } + + if (null != list && list.size() == 0) { + return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST; + } + + try { + UserExample example = new UserExample(); + example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password); + list = userMapper.selectByExample(example); + } catch (Exception e) { + logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e); + return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; + } + + if (null != list && list.size() == 0) { + return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR; + } + return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT; } public User getUserByUserName(String username)throws Exception { @@ -292,10 +256,7 @@ public class UserService { try{ list= userMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } User user =null; if(list!=null&&list.size()>0){ @@ -314,10 +275,7 @@ public class UserService { try{ list= userMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list==null?0:list.size(); } @@ -339,10 +297,7 @@ public class UserService { try{ list= userMapperEx.getUserList(parameterMap); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -406,10 +361,7 @@ public class UserService { try{ result= userMapperEx.addUser(ue); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } if(result>0){ return ue; @@ -440,10 +392,7 @@ public class UserService { try{ result= userMapperEx.addUser(ue); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } //更新租户id User user = new User(); @@ -479,10 +428,7 @@ public class UserService { try{ userMapper.updateByPrimaryKeySelective(user); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } } @@ -540,10 +486,7 @@ public class UserService { try{ result=userMapperEx.updateUser(ue); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } if(result>0){ return ue; @@ -622,10 +565,7 @@ public class UserService { try{ list=userMapperEx.getUserListByUserNameOrLoginName(userName,null); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -637,10 +577,7 @@ public class UserService { try{ list=userMapperEx.getUserListByUserNameOrLoginName(null,loginName); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -657,10 +594,7 @@ public class UserService { try{ result=userMapperEx.batDeleteOrUpdateUser(idsArray,BusinessConstants.USER_STATUS_DELETE); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } if(result<1){ logger.error("异常码[{}],异常提示[{}],参数,ids:[{}]", @@ -675,10 +609,7 @@ public class UserService { try{ list=userMapperEx.getNodeTree(); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } diff --git a/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java b/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java index d769a6cb..ed40fb8e 100644 --- a/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java +++ b/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java @@ -7,6 +7,7 @@ import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.mappers.UserBusinessMapper; import com.jsh.erp.datasource.mappers.UserBusinessMapperEx; import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.exception.JshException; import com.jsh.erp.service.CommonQueryManager; import com.jsh.erp.service.app.AppService; import com.jsh.erp.service.functions.FunctionsService; @@ -52,10 +53,7 @@ public class UserBusinessService { try{ result=userBusinessMapper.selectByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return result; } @@ -67,10 +65,7 @@ public class UserBusinessService { try{ list=userBusinessMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -82,10 +77,7 @@ public class UserBusinessService { try{ result=userBusinessMapper.insertSelective(userBusiness); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } // 更新应用权限 if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) { @@ -102,10 +94,7 @@ public class UserBusinessService { try{ result=userBusinessMapper.updateByPrimaryKeySelective(userBusiness); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } // 更新应用权限 if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) { @@ -120,10 +109,7 @@ public class UserBusinessService { try{ result=userBusinessMapper.deleteByPrimaryKey(id); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -137,10 +123,7 @@ public class UserBusinessService { try{ result=userBusinessMapper.deleteByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -157,10 +140,7 @@ public class UserBusinessService { try{ list= userBusinessMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -173,10 +153,7 @@ public class UserBusinessService { try{ list= userBusinessMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } Long id = null; if(list!=null&&list.size() > 0) { @@ -199,10 +176,7 @@ public class UserBusinessService { try{ list= userBusinessMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } if(list!=null&&list.size() > 0) { return true; @@ -224,10 +198,7 @@ public class UserBusinessService { try{ result= userBusinessMapper.updateByExampleSelective(userBusiness, example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -240,10 +211,7 @@ public class UserBusinessService { try{ list= userBusinessMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -257,10 +225,7 @@ public class UserBusinessService { try{ list= userBusinessMapper.selectByExample(example); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, - ExceptionConstants.DATA_READ_FAIL_MSG); + JshException.readFail(logger, e); } return list; } @@ -276,10 +241,7 @@ public class UserBusinessService { try{ result= userBusinessMapperEx.batchDeleteUserBusinessByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } return result; } @@ -324,10 +286,7 @@ public class UserBusinessService { result = userBusinessMapper.insertSelective(userBusiness); } }catch(Exception e){ - logger.error("异常码[{}],异常提示[{}],异常[{}]", - ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e); - throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE, - ExceptionConstants.DATA_WRITE_FAIL_MSG); + JshException.writeFail(logger, e); } } } diff --git a/src/main/java/com/jsh/erp/utils/JshException.java b/src/main/java/com/jsh/erp/utils/JshException.java deleted file mode 100644 index 9b189114..00000000 --- a/src/main/java/com/jsh/erp/utils/JshException.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.jsh.erp.utils; - -/** - * @author jishenghua - * @title: 平台异常基类 - * @description: 用于包装一些异常信息,打印日志等服务 - * @qq 7 5 2 7 1 8 9 2 0 - * @since: 2014-02-24 - */ -@SuppressWarnings("serial") -public class JshException extends Exception { - public long errorCode = -1; - - public String message; - - public JshException() { - super(); - } - - public JshException(String message) { - super(message); - this.message = message; - } - - public JshException(String message, Throwable cause) { - super(message, cause); - this.message = message; - } - - public JshException(Throwable cause) { - super(cause); - } - - public JshException(long errorCode) { - super(); - this.errorCode = errorCode; - } - - public JshException(String message, long errorCode) { - super(message); - this.errorCode = errorCode; - this.message = message; - } - - public JshException(String message, long errorCode, Throwable cause) { - super(message, cause); - this.errorCode = errorCode; - this.message = message; - } - - public JshException(long errorCode, Throwable cause) { - super(cause); - this.errorCode = errorCode; - } - - public long getErrorCode() { - return errorCode; - } - - public String getMessage() { - return message; - } -}