重构异常打印的方式

This commit is contained in:
季圣华
2019-09-05 18:20:12 +08:00
parent 59156e5f74
commit 083c870950
26 changed files with 439 additions and 1541 deletions

View File

@@ -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(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
@@ -295,10 +260,7 @@ public class DepotHeadService {
try{
result = depotHeadMapperEx.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;
}
@@ -308,10 +270,7 @@ public class DepotHeadService {
try{
result = depotHeadMapperEx.findMaterialsListByHeaderId(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;
}
@@ -325,10 +284,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;
}
@@ -342,10 +298,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;
}
@@ -355,10 +308,7 @@ public class DepotHeadService {
try{
list =depotHeadMapperEx.findByAll(beginTime, endTime, type, pid, dids, oId, 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;
}
@@ -368,10 +318,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findByAllCount(beginTime, endTime, type, pid, dids, oId);
}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;
}
@@ -381,10 +328,7 @@ public class DepotHeadService {
try{
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, pid, dids, oId, 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;
}
@@ -394,10 +338,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, pid, dids, oId);
}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;
}
@@ -407,10 +348,7 @@ public class DepotHeadService {
try{
list =depotHeadMapperEx.findStatementAccount(beginTime, endTime, organId, supType, 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;
}
@@ -420,10 +358,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findStatementAccountCount(beginTime, endTime, organId, supType);
}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;
}
@@ -439,10 +374,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findAllMoney(supplierId, type, subType, 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;
}
@@ -503,10 +435,7 @@ public class DepotHeadService {
try{
list = depotHeadMapperEx.getDetailByNumber(number);
}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) {
@@ -558,10 +487,7 @@ public class DepotHeadService {
try{
depotHeadMapperEx.adddepotHead(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);
}
/**入库和出库处理预付款信息*/
@@ -581,10 +507,7 @@ public class DepotHeadService {
try{
depotHeadMapper.updateByExampleSelective(depotHeadOrders, 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);
}
}
}
@@ -616,10 +539,7 @@ public class DepotHeadService {
try{
depotHeadMapperEx.updatedepotHead(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);
}
/**入库和出库处理预付款信息*/
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
@@ -655,10 +575,7 @@ public class DepotHeadService {
try{
depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(id,BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED);
}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);
}
/**回收序列号*/
@@ -673,10 +590,7 @@ public class DepotHeadService {
try{
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long []{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);
}
/**删除单据主表信息*/
@@ -713,10 +627,7 @@ public class DepotHeadService {
try{
result = depotHeadMapperEx.batchDeleteDepotHeadByIds(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;
}