Commit 1d456fb6 authored by liuxinben's avatar liuxinben

将大部分控制台打印改为日志打印

parent 293e44f4
...@@ -331,7 +331,7 @@ public class AdminApi { ...@@ -331,7 +331,7 @@ public class AdminApi {
// }else{ // }else{
// sysPermission.setParent_ids(str+"/"+jsonObject.getString("parentId")); // sysPermission.setParent_ids(str+"/"+jsonObject.getString("parentId"));
// } // }
System.out.println(sysPermission); // System.out.println(sysPermission);
flag = sysPermissionService.addPermission(sysPermission); flag = sysPermissionService.addPermission(sysPermission);
if (flag) { if (flag) {
map.put("resultMsg", "添加成功"); map.put("resultMsg", "添加成功");
...@@ -542,7 +542,7 @@ public class AdminApi { ...@@ -542,7 +542,7 @@ public class AdminApi {
sysPermission.setName(jsonObject.getString("name")); sysPermission.setName(jsonObject.getString("name"));
sysPermission.setUrl(jsonObject.getString("url")); sysPermission.setUrl(jsonObject.getString("url"));
sysPermission.setPermission(jsonObject.getString("permission")); sysPermission.setPermission(jsonObject.getString("permission"));
System.out.println(sysPermission); // System.out.println(sysPermission);
flag = sysPermissionService.updatePermission(sysPermission); flag = sysPermissionService.updatePermission(sysPermission);
if (flag) { if (flag) {
map.put("resultMsg", "修改成功"); map.put("resultMsg", "修改成功");
......
...@@ -62,10 +62,10 @@ public class ExportXMLApi { ...@@ -62,10 +62,10 @@ public class ExportXMLApi {
//使用Servlet实现文件下载的时候,避免浏览器自动打开文件 //使用Servlet实现文件下载的时候,避免浏览器自动打开文件
List<PreproPersonDto> preproPersonEntities = new ArrayList<>(); List<PreproPersonDto> preproPersonEntities = new ArrayList<>();
List<PreproPersonDto> preproPersonDtos =null; List<PreproPersonDto> preproPersonDtos =null;
System.out.println(new Date()+ "开始查询"); logger.info(new Date()+ "开始查询");
preproPersonDtos=preproPersonService.selectAllPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate1), replaceDate(uploadDate2), downloadState); preproPersonDtos=preproPersonService.selectAllPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate1), replaceDate(uploadDate2), downloadState);
preproPersonEntities.addAll(preproPersonDtos); preproPersonEntities.addAll(preproPersonDtos);
System.out.println(new Date()+ "结束查询"); logger.info(new Date()+ "结束查询");
if (preproPersonEntities.size() > 0) { if (preproPersonEntities.size() > 0) {
//将制证详情详细划分 //将制证详情详细划分
Map<Long, Object> map = new LinkedHashMap<>(); Map<Long, Object> map = new LinkedHashMap<>();
...@@ -114,7 +114,7 @@ public class ExportXMLApi { ...@@ -114,7 +114,7 @@ public class ExportXMLApi {
} }
List<String> documentList = new ArrayList<>(); List<String> documentList = new ArrayList<>();
//执行生成XML文件方法 //执行生成XML文件方法
System.out.println(new Date()+ "开始生成xml"); logger.info(new Date()+ "开始生成xml");
for (List<Map<String, Object>> mapList : lists) { for (List<Map<String, Object>> mapList : lists) {
for (Map<String, Object> objectMap : mapList) { for (Map<String, Object> objectMap : mapList) {
for (String fileId : objectMap.keySet()) { for (String fileId : objectMap.keySet()) {
...@@ -167,7 +167,7 @@ public class ExportXMLApi { ...@@ -167,7 +167,7 @@ public class ExportXMLApi {
} }
} }
System.out.println(new Date()+ "生成xml结束"); logger.info(new Date()+ "生成xml结束");
// -----制证包数据打包下载 // -----制证包数据打包下载
String zipName = "myfile.zip"; String zipName = "myfile.zip";
response.setContentType("APPLICATION/OCTET-STREAM"); response.setContentType("APPLICATION/OCTET-STREAM");
...@@ -181,12 +181,12 @@ public class ExportXMLApi { ...@@ -181,12 +181,12 @@ public class ExportXMLApi {
logger.error("IOException 制证包数据打包下载IO异常", e); logger.error("IOException 制证包数据打包下载IO异常", e);
} }
try { try {
System.out.println(new Date()+ "开始打包"); logger.info(new Date()+ "开始打包");
for (String document : documentList) { for (String document : documentList) {
ZipUtils.doCompress(document, out); ZipUtils.doCompress(document, out);
response.flushBuffer(); response.flushBuffer();
} }
System.out.println(new Date()+ "结束打包"); logger.info(new Date()+ "结束打包");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.error("制证包数据打包名:" + zipName); logger.error("制证包数据打包名:" + zipName);
...@@ -201,7 +201,7 @@ public class ExportXMLApi { ...@@ -201,7 +201,7 @@ public class ExportXMLApi {
} }
} }
} }
System.out.println(new Date()+ "结束"); logger.info(new Date()+ "结束");
return null; return null;
} }
...@@ -344,7 +344,7 @@ public class ExportXMLApi { ...@@ -344,7 +344,7 @@ public class ExportXMLApi {
logger.error("IOException XML文件生成异常", e); logger.error("IOException XML文件生成异常", e);
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("XML文件生成成功..." + new Date()); logger.info("XML文件生成成功..." + new Date());
return "D:\\XML\\" + "ZAGL_YDZZ_" + filesEntity.getDwdm() + getCurrentDate2String("yyyyMMdd") + cardType + files_seq + ".xml"; return "D:\\XML\\" + "ZAGL_YDZZ_" + filesEntity.getDwdm() + getCurrentDate2String("yyyyMMdd") + cardType + files_seq + ".xml";
} }
......
...@@ -82,7 +82,7 @@ public class ReadXmlApi { ...@@ -82,7 +82,7 @@ public class ReadXmlApi {
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) requ; MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) requ;
Iterator<String> iter = multiRequest.getFileNames(); Iterator<String> iter = multiRequest.getFileNames();
while (iter.hasNext()) { while (iter.hasNext()) {
System.out.println("开始获取整体文件信息! "+new Date().getTime()); logger.info("开始获取整体文件信息! "+System.currentTimeMillis());
List<MultipartFile> fileRows = multiRequest.getFiles(iter.next().toString()); List<MultipartFile> fileRows = multiRequest.getFiles(iter.next().toString());
for (MultipartFile item : fileRows) { for (MultipartFile item : fileRows) {
try { try {
...@@ -93,16 +93,16 @@ public class ReadXmlApi { ...@@ -93,16 +93,16 @@ public class ReadXmlApi {
if (StringUtils.isBlank(filename)) { if (StringUtils.isBlank(filename)) {
continue; continue;
} }
logger.error("获取"+filename+"文件信息! "+new Date().getTime()); logger.error("获取"+filename+"文件信息! "+System.currentTimeMillis());
InputStream in = item.getInputStream(); InputStream in = item.getInputStream();
String str = YXStringUtils.inputStream2String(in, "utf-8"); String str = YXStringUtils.inputStream2String(in, "utf-8");
in.close(); in.close();
IDCardFactory idCardFactory = new IDCardFactory(); IDCardFactory idCardFactory = new IDCardFactory();
logger.error("开始解析"+filename+"文件! "+new Date().getTime()); logger.error("开始解析"+filename+"文件! "+System.currentTimeMillis());
Map<String, Object> objectMap = idCardFactory.extractIDCard(str, date); Map<String, Object> objectMap = idCardFactory.extractIDCard(str, date);
logger.error("开始存储"+filename+"文件! "+new Date().getTime()); logger.error("开始存储"+filename+"文件! "+System.currentTimeMillis());
Boolean aBoolean = idcardsFactory(objectMap); Boolean aBoolean = idcardsFactory(objectMap);
logger.error("存储"+filename+"文件完成! "+new Date().getTime()); logger.error("存储"+filename+"文件完成! "+System.currentTimeMillis());
if (!aBoolean){ if (!aBoolean){
errList.add("上传文件名:" + filename+",文件上传失败"); errList.add("上传文件名:" + filename+",文件上传失败");
continue; continue;
...@@ -154,7 +154,7 @@ public class ReadXmlApi { ...@@ -154,7 +154,7 @@ public class ReadXmlApi {
map.put("code","500"); map.put("code","500");
map.put("errMsg",errList); map.put("errMsg",errList);
} }
logger.error("所有文件上传完成! "+new Date().getTime()); logger.error("所有文件上传完成! "+System.currentTimeMillis());
return map; return map;
} }
......
...@@ -59,8 +59,8 @@ public class MyShiroRealm extends AuthorizingRealm { ...@@ -59,8 +59,8 @@ public class MyShiroRealm extends AuthorizingRealm {
System.out.println("MyShiroRealm.doGetAuthenticationInfo()"); System.out.println("MyShiroRealm.doGetAuthenticationInfo()");
//获取用户的输入的账号. //获取用户的输入的账号.
String username = (String) token.getPrincipal(); String username = (String) token.getPrincipal();
System.out.println(username); // System.out.println(username);
System.out.println(token.getCredentials().toString()); // System.out.println(token.getCredentials().toString());
//通过username从数据库中查找 User对象,如果找到,没找到. //通过username从数据库中查找 User对象,如果找到,没找到.
//实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法 //实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法
UserInfo user = userInfoService.findByUsername(username); UserInfo user = userInfoService.findByUsername(username);
......
package com.yxproject.start.utils; package com.yxproject.start.utils;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
...@@ -23,6 +24,8 @@ import static com.yxproject.start.utils.YXStringUtils.getCurrentDate2String; ...@@ -23,6 +24,8 @@ import static com.yxproject.start.utils.YXStringUtils.getCurrentDate2String;
*/ */
public class ExportExcel { public class ExportExcel {
static Logger logger = Logger.getLogger(ExportExcel.class);
/** /**
* 导出公安网信息 * 导出公安网信息
* @param mapList 公安网信息 * @param mapList 公安网信息
...@@ -321,7 +324,7 @@ public class ExportExcel { ...@@ -321,7 +324,7 @@ public class ExportExcel {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("Excel文件生成成功..." + new Date()); logger.info("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; // return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "交接单" + ".xls"; return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "交接单" + ".xls";
} }
...@@ -375,7 +378,7 @@ public class ExportExcel { ...@@ -375,7 +378,7 @@ public class ExportExcel {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("Excel文件生成成功..." + new Date()); logger.info("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; // return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "未妥投信息表" + ".xls"; return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "未妥投信息表" + ".xls";
} }
......
...@@ -3,4 +3,7 @@ ...@@ -3,4 +3,7 @@
异地系统解析制证数据时,添加校验最新的excel格口文件是否被解析 异地系统解析制证数据时,添加校验最新的excel格口文件是否被解析
2022/12/30 2022/12/30
异地系统解析时,添加日志步骤打印 异地系统解析时,添加日志步骤打印
\ No newline at end of file
2023/01/03
将大部分控制台打印改为日志打印
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment