重构异常打印的方式
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user