修复空值错误

This commit is contained in:
Menethil
2018-07-23 05:28:07 +08:00
parent b4d2d07642
commit c1e96bfef4
2 changed files with 15 additions and 7 deletions

View File

@@ -1,26 +1,28 @@
package org.linlinjava.litemall.wx.service;
package org.linlinjava.litemall.core.system;
import org.linlinjava.litemall.core.system.SystemInfoPrinter;
import org.linlinjava.litemall.core.util.SystemInfoPrinter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 系统启动服务用于检查系统状态及打印系统信息
*/
@Component
public class SystemInistService {
class SystemInistService {
private SystemInistService systemInistService;
@Autowired
private Environment environment;
@PostConstruct
public void inist() {
private void inist() {
systemInistService = this;
SystemInfoPrinter.printInfo("WX-API 初始化信息", getSystemInfo());
SystemInfoPrinter.printInfo("Litemall 初始化信息", getSystemInfo());
}
private Map<String, String> getSystemInfo() {

View File

@@ -1,4 +1,4 @@
package org.linlinjava.litemall.core.system;
package org.linlinjava.litemall.core.util;
import java.util.Map;
@@ -21,6 +21,9 @@ public class SystemInfoPrinter {
private static void setMaxSize(Map<String, String> infos) {
for (Map.Entry<String, String> entry : infos.entrySet()) {
if (entry.getValue() == null)
continue;
int size = entry.getKey().length() + entry.getValue().length();
if (size > maxSize)
@@ -52,6 +55,9 @@ public class SystemInfoPrinter {
}
private static void printLine(String head, String line) {
if (line == null)
return;
if (head.startsWith(CREATE_PART_COPPER)) {
System.out.println("");
System.out.println(" [[ " + line + " ]]");