优化日志打印的方式

This commit is contained in:
jishenghua 2024-05-28 00:49:48 +08:00
parent 880c93899c
commit d3f0ff3777
34 changed files with 128 additions and 258 deletions

View File

@ -64,7 +64,7 @@ public class AccountController {
}
res = dataArray.toJSONString();
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res = "获取数据失败";
}
return res;
@ -86,7 +86,7 @@ public class AccountController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -136,7 +136,7 @@ public class AccountController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -186,7 +186,7 @@ public class AccountController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -209,7 +209,7 @@ public class AccountController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -110,7 +110,7 @@ public class AccountHeadController {
res.code = 200;
res.data = ahl;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -133,7 +133,7 @@ public class AccountHeadController {
res.code = 200;
res.data = list;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -86,7 +86,7 @@ public class AccountItemController {
res.code = 200;
res.data = outer;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -63,7 +63,7 @@ public class DepotController {
res.code = 200;
res.data = depotList;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -113,7 +113,7 @@ public class DepotController {
outer.put("children", dataArray);
arr.add(outer);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -133,7 +133,7 @@ public class DepotController {
res.code = 200;
res.data = arr;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -196,7 +196,7 @@ public class DepotController {
res.code = 200;
res.data = depotList;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -145,7 +145,7 @@ public class DepotHeadController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -211,7 +211,7 @@ public class DepotHeadController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -294,7 +294,7 @@ public class DepotHeadController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -380,7 +380,7 @@ public class DepotHeadController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -407,7 +407,7 @@ public class DepotHeadController {
res.code = 200;
res.data = dhl;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -431,7 +431,7 @@ public class DepotHeadController {
res.code = 200;
res.data = list;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -493,7 +493,7 @@ public class DepotHeadController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -515,7 +515,7 @@ public class DepotHeadController {
res.code = 200;
res.data = creator;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -588,7 +588,7 @@ public class DepotHeadController {
depotHeadService.debtExport(organId, materialParam, number, type, subType, beginTime, endTime,
status, mpList, request, response);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
}

View File

@ -174,7 +174,7 @@ public class DepotItemController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -300,7 +300,7 @@ public class DepotItemController {
res.code = 200;
res.data = outer;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -388,7 +388,7 @@ public class DepotItemController {
res.code = e.getCode();
res.data = e.getData().get("message");
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -449,7 +449,7 @@ public class DepotItemController {
res.code = e.getCode();
res.data = e.getData().get("message");
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -553,7 +553,7 @@ public class DepotItemController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -637,7 +637,7 @@ public class DepotItemController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -722,7 +722,7 @@ public class DepotItemController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -798,7 +798,7 @@ public class DepotItemController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -891,7 +891,7 @@ public class DepotItemController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "统计失败";
}
@ -928,7 +928,7 @@ public class DepotItemController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -1024,7 +1024,7 @@ public class DepotItemController {
data.put("message", e.getData().get("message"));
res.data = data;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
message = "导入失败,请检查表格内容";
res.code = 500;
data.put("message", message);

View File

@ -189,7 +189,7 @@ public class FunctionController {
}
arr.add(outer);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -271,7 +271,7 @@ public class FunctionController {
res.data = outer;
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -55,7 +55,7 @@ public class InOutItemController {
}
res = dataArray.toJSONString();
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res = "获取数据失败";
}
return res;

View File

@ -51,7 +51,7 @@ public class MaterialAttributeController {
}
}
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return dataArray;
}
@ -69,7 +69,7 @@ public class MaterialAttributeController {
try {
dataArray = materialAttributeService.getValueArrById(id);
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return dataArray;
}

View File

@ -49,7 +49,7 @@ public class MaterialCategoryController {
res.code = 200;
res.data = materialCategoryList;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -86,7 +86,7 @@ public class MaterialCategoryController {
res.code = 200;
res.data = outer;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -141,7 +141,7 @@ public class MaterialController {
res.code = 200;
res.data = list;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -171,7 +171,7 @@ public class MaterialController {
res.code = 200;
res.data = mu;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -194,7 +194,7 @@ public class MaterialController {
res.code = 200;
res.data = arr;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -291,7 +291,7 @@ public class MaterialController {
}
object.put("rows", dataArray);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return object;
}
@ -338,7 +338,7 @@ public class MaterialController {
item.put("unit", material.getUnit() + ratio);
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return item;
}
@ -378,7 +378,7 @@ public class MaterialController {
StringUtil.toNull(expiryNum), StringUtil.toNull(enabled), StringUtil.toNull(enableSerialNumber),
StringUtil.toNull(enableBatchNumber), StringUtil.toNull(remark), response);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
}
@ -397,7 +397,7 @@ public class MaterialController {
try {
res = materialService.importExcel(file, request);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return res;
}
@ -427,7 +427,7 @@ public class MaterialController {
object.put("rows", list);
object.put("total", count);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return object;
}
@ -467,7 +467,7 @@ public class MaterialController {
arr.add(item);
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -549,7 +549,7 @@ public class MaterialController {
res.code = 200;
res.data = list;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -637,7 +637,7 @@ public class MaterialController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -66,7 +66,7 @@ public class MaterialExtendController {
res.code = 200;
res.data = outer;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -91,7 +91,7 @@ public class MaterialExtendController {
res.code = 200;
res.data = materialExtend;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -123,7 +123,7 @@ public class MaterialExtendController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -5,6 +5,8 @@ import com.jsh.erp.service.materialProperty.MaterialPropertyService;
import com.jsh.erp.utils.BaseResponseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -24,6 +26,8 @@ import java.util.List;
@Api(tags = {"商品扩展字段"})
public class MaterialPropertyController {
private Logger logger = LoggerFactory.getLogger(MaterialPropertyController.class);
@Resource
private MaterialPropertyService materialPropertyService;
@ -36,7 +40,7 @@ public class MaterialPropertyController {
res.code = 200;
res.data = list;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -46,7 +46,7 @@ public class MsgController {
res.code = 200;
res.data = list;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -72,7 +72,7 @@ public class MsgController {
res.code = 200;
res.data = "更新成功";
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -98,7 +98,7 @@ public class MsgController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -124,7 +124,7 @@ public class MsgController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -146,7 +146,7 @@ public class MsgController {
res.code = 200;
res.data = "操作成功!";
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -72,7 +72,7 @@ public class OrganizationController {
res.code = 200;
res.data = outer;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -49,7 +49,7 @@ public class PersonController {
res.code = 200;
res.data = personList;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -75,7 +75,7 @@ public class PersonController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -100,7 +100,7 @@ public class PersonController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -137,7 +137,7 @@ public class PersonController {
}
}
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return dataArray;
}

View File

@ -47,7 +47,7 @@ public class PlatformConfigController {
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res = "ERP系统";
}
return res;
@ -67,7 +67,7 @@ public class PlatformConfigController {
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res = "#";
}
return res;
@ -87,7 +87,7 @@ public class PlatformConfigController {
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res = "#";
}
return res;
@ -130,7 +130,7 @@ public class PlatformConfigController {
res.code = 200;
res.data = platformConfig;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -11,6 +11,8 @@ import com.jsh.erp.utils.ComputerInfo;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
@ -31,6 +33,7 @@ import java.util.*;
@RequestMapping("/plugin")
@Api(tags = {"插件管理"})
public class PluginController {
private Logger logger = LoggerFactory.getLogger(PluginController.class);
@Resource
private UserService userService;
@ -74,7 +77,7 @@ public class PluginController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -96,7 +99,7 @@ public class PluginController {
return null;
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
return null;
}
}
@ -128,7 +131,7 @@ public class PluginController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
map.put("message", "plugin '" + id +"' stop failure. " + e.getMessage());
res.code = 500;
res.data = map;
@ -162,7 +165,7 @@ public class PluginController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
map.put("message", "plugin '" + id +"' start failure. " + e.getMessage());
res.code = 500;
res.data = map;
@ -197,7 +200,7 @@ public class PluginController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
map.put("message", "plugin '" + id +"' uninstall failure. " + e.getMessage());
res.code = 500;
res.data = map;
@ -226,7 +229,7 @@ public class PluginController {
return "installByPath failure";
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
return "installByPath failure : " + e.getMessage();
}
}
@ -252,7 +255,7 @@ public class PluginController {
res.data = "抱歉,无操作权限!";
}
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
@ -279,7 +282,7 @@ public class PluginController {
return "installByPath failure";
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
return "uploadConfig failure : " + e.getMessage();
}
}
@ -305,7 +308,7 @@ public class PluginController {
return "backupPlugin failure";
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
return "backupPlugin failure : " + e.getMessage();
}
}
@ -323,7 +326,7 @@ public class PluginController {
res.code = 200;
res.data = DigestUtils.md5DigestAsHex(mac.getBytes());
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -356,7 +359,7 @@ public class PluginController {
res.code = 200;
res.data = data;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -62,7 +62,7 @@ public class RoleController {
}
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}

View File

@ -44,7 +44,7 @@ public class SequenceController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -109,7 +109,7 @@ public class SerialNumberController {
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -94,7 +94,7 @@ public class SupplierController {
}
arr = dataArray;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -122,7 +122,7 @@ public class SupplierController {
}
arr = dataArray;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -167,7 +167,7 @@ public class SupplierController {
}
arr = dataArray;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -196,7 +196,7 @@ public class SupplierController {
}
arr = dataArray;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -265,7 +265,7 @@ public class SupplierController {
outer.put("children", dataArray);
arr.add(outer);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
return arr;
}
@ -287,7 +287,7 @@ public class SupplierController {
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -311,7 +311,7 @@ public class SupplierController {
res.code = 200;
res.data = "导入成功";
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
@ -335,7 +335,7 @@ public class SupplierController {
res.code = 200;
res.data = "导入成功";
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
@ -359,7 +359,7 @@ public class SupplierController {
res.code = 200;
res.data = "导入成功";
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
@ -387,7 +387,7 @@ public class SupplierController {
File file = supplierService.exportExcel(dataList, type);
ExcelUtils.downloadExcel(file, file.getName(), response);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
}

View File

@ -82,7 +82,7 @@ public class SystemConfigController {
res.data = list.get(0);
}
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -109,7 +109,7 @@ public class SystemConfigController {
res.code = 200;
res.data = limit;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
@ -144,7 +144,7 @@ public class SystemConfigController {
res.data = "上传失败!";
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "上传失败!";
}
@ -196,10 +196,10 @@ public class SystemConfigController {
} catch (IOException e) {
logger.error("预览文件失败" + e.getMessage());
response.setStatus(404);
e.printStackTrace();
logger.error(e.getMessage(), e);
} catch (Exception e) {
response.setStatus(404);
e.printStackTrace();
logger.error(e.getMessage(), e);
} finally {
if (inputStream != null) {
try {
@ -258,7 +258,7 @@ public class SystemConfigController {
response.flushBuffer();
} catch (Exception e) {
response.setStatus(404);
e.printStackTrace();
logger.error(e.getMessage(), e);
} finally {
if (outputStream != null) {
try {
@ -285,7 +285,7 @@ public class SystemConfigController {
JSONArray arr = jsonObject.getJSONArray("list");
systemConfigService.exportExcelByParam(title, head, tip, arr, response);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
}

View File

@ -7,6 +7,8 @@ import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.ErpInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -27,6 +29,7 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@RequestMapping(value = "/unit")
@Api(tags = {"单位管理"})
public class UnitController {
private Logger logger = LoggerFactory.getLogger(UnitController.class);
@Resource
private UnitService unitService;
@ -46,7 +49,7 @@ public class UnitController {
res.code = 200;
res.data = unitList;
} catch(Exception e){
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}

View File

@ -52,7 +52,7 @@ public class UserBusinessController {
res.code = 200;
res.data = mapData;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "查询权限失败";
}
@ -104,7 +104,7 @@ public class UserBusinessController {
res.data = "成功";
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "更新权限失败";
}

View File

@ -71,7 +71,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage());
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "用户登录失败";
}
@ -96,7 +96,7 @@ public class UserController {
res.data = data;
}
} catch(Exception e){
logger.error(e.getMessage());
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "用户登录失败";
}
@ -132,6 +132,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取session失败";
}
@ -146,6 +147,7 @@ public class UserController {
redisService.deleteObjectBySession(request,"userId");
redisService.deleteObjectBySession(request,"clientIp");
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "退出失败";
}
@ -220,6 +222,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
@ -247,7 +250,7 @@ public class UserController {
}
}
} catch(Exception e){
logger.error(e.getMessage());
logger.error(e.getMessage(), e);
}
return dataArray;
}
@ -346,6 +349,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取session失败";
}
@ -369,6 +373,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
@ -395,6 +400,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
@ -420,6 +426,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
@ -476,6 +483,7 @@ public class UserController {
res.code = 200;
res.data = data;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}

View File

@ -36,12 +36,9 @@ public class GlobalExceptionHandler {
status.put(ExceptionConstants.GLOBAL_RETURNS_DATA, ExceptionConstants.SERVICE_SYSTEM_ERROR_MSG);
log.error("Global Exception Occured => url : {}, msg : {}", request.getRequestURL(), e.getMessage());
/**
* create by: qiankunpingtai
* create time: 2019/4/18 17:41
* 这里输出完整的堆栈信息否则有些异常完全不知道哪里出错了
*/
log.error("Global Exception Occured => url : {}", request.getRequestURL(), e);
e.printStackTrace();
return status;
}
}

View File

@ -839,7 +839,7 @@ public class MaterialService {
info.code = e.getCode();
info.data = e.getData().get("message");
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
info.code = 500;
info.data = "导入失败";
}

View File

@ -554,7 +554,7 @@ public class SupplierService {
info.code = 200;
data.put("message", "成功");
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
info.code = 500;
data.put("message", e.getMessage());
}

View File

@ -156,7 +156,6 @@ public class UserService {
password = Tools.md5Encryp(password);
user.setPassword(password);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
logger.error(">>>>>>>>>>>>>>转化MD5字符串错误 " + e.getMessage());
}
int result=0;
@ -311,7 +310,6 @@ public class UserService {
redisService.deleteObjectBySession(request,"userId");
userStatus = validateUser(loginName, password);
} catch (Exception e) {
e.printStackTrace();
logger.error(">>>>>>>>>>>>>用户 " + loginName + " 登录 login 方法 访问服务层异常====", e);
msgTip = "access service exception";
}

View File

@ -81,8 +81,7 @@ public abstract class ComputerInfo {
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ignored) {
}
macAddressStr = sb.toString();
@ -122,23 +121,6 @@ public abstract class ComputerInfo {
return InetAddress.getLocalHost().getHostAddress().toString();
}
/**
* 获取电脑唯一标识
*
* @return
*/
public static String getComputerID() {
String id = getMacAddress();
if (id == null || id.equals("")) {
try {
id = getIpAddrAndName();
} catch (IOException e) {
e.printStackTrace();
}
}
return computerName;
}
/**
* 限制创建实例
*/

View File

@ -87,22 +87,6 @@ public class FileUtils {
}
}
/**
* 取当前路径
*
* @return
*/
public static String getCurrentPath() {
File directory = new File(".");
String nowPath = "";
try {
nowPath = directory.getCanonicalFile().toString();
} catch (IOException e) {
e.printStackTrace();
}
return nowPath;
}
/**
* 获取文件扩展名
*
@ -312,23 +296,6 @@ public class FileUtils {
return fileList;
}
/**
* 方法追加文件使用FileWriter
*
* @param fileName
* @param content
*/
public static void appendMethod(String fileName, String content) {
try {
// 打开一个写文件器构造函数中的第二个参数true表示以追加形式写文件
FileWriter writer = new FileWriter(fileName, true);
writer.write(content + "\r\n");
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 判断文件名是否带盘符重新处理
* @param fileName

View File

@ -43,13 +43,13 @@ public final class HttpClient {
JSONObject object = JSONObject.parseObject(entity);
return object;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
throw new RuntimeException(String.format("%s", url) + "查询出现异常");
} finally {
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
}
}

View File

@ -356,21 +356,6 @@ public class Tools {
return str.replace("'", "");
}
/**
* 获取用户IP地址(停用)
*
* @return 用户IP
* @see [#方法#成员]
*/
public static String getCurrentUserIP() {
try {
return InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
return "127.0.0.1";
}
}
/**
* 从Request对象中获得客户端IP处理了HTTP代理服务器和Nginx的反向代理截取了ip
*
@ -445,37 +430,6 @@ public class Tools {
return dataInt;
}
/**
* 解决导出文件中文乱码问题firefox和ie下中文乱码
*/
public static String changeUnicode(String fileName, String browserType) {
String returnFileName = "";
try {
if (browserType.equalsIgnoreCase("MSIE")) {
returnFileName = URLEncoder.encode(fileName, "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
if (returnFileName.length() > 150) {
returnFileName = new String(fileName.getBytes("GB2312"), "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
}
} else if (browserType.equalsIgnoreCase("Firefox")) {
returnFileName = new String(fileName.getBytes("ISO8859-1"), "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
} else {
returnFileName = URLEncoder.encode(fileName, "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
if (returnFileName.length() > 150) {
returnFileName = new String(returnFileName.getBytes("GB2312"), "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
}
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return returnFileName;
}
/**
* 写理财日志内容转化特殊字符
*
@ -546,23 +500,6 @@ public class Tools {
return emailAddress.substring(0, emailAddress.lastIndexOf("@"));
}
/**
* 获取中文编码邮件附件乱码问题解决
*
* @param emailAttchmentTitle
* @return
*/
public static String getChineseString(String emailAttchmentTitle) {
if (emailAttchmentTitle != null && !emailAttchmentTitle.equals("")) {
try {
return new String(emailAttchmentTitle.getBytes(), "ISO-8859-1");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return emailAttchmentTitle;
}
/**
* 判断userTel是否合法userTel只能是数字
*
@ -596,24 +533,6 @@ public class Tools {
return new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime());
}
/**
* 开打指定文件
*
* @param filePath 文件的绝对路径
*/
public static void openFile(String filePath) {
String viewFilePath = filePath.replace("\\", "/");
// Runtime.getRuntime().exec("cmd /c start "+filePath);
// 解决路径中带空格问题
Runtime r = Runtime.getRuntime();
String[] cmdArray = new String[]{"cmd.exe", "/c", viewFilePath};
try {
r.exec(cmdArray);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 判断字符串中是否含有中文
*
@ -747,16 +666,6 @@ public class Tools {
return valSb.toString();
}
// /**
// * 过滤html文件中的图片文件
// * @param content
// * @return
// */
// public static String filterImg(String content)
// {
// return content.matches("/<img(?:.|\\s)*?>/g");
// }
public static void main(String[] args) {
String aa = "的付的反对法的发的说法";
char[] bb = aa.toCharArray();
@ -770,7 +679,6 @@ public class Tools {
System.out.println(md5Encryp("admin"));
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String value = "2333";