Commit ca1f70e4 authored by Administrator's avatar Administrator

添加异常抛出到日志

parent 869b9229
......@@ -2,11 +2,15 @@ package com.yxproject.start.api;
import com.yxproject.start.entity.DetailReceiptListEntity;
import com.yxproject.start.service.CardDetailedListService;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -20,6 +24,8 @@ public class CardDetailedListApi {
@Autowired
private CardDetailedListService cardDetailedListService;
Logger logger= Logger.getLogger(CardDetailedListApi.class);
/**
* 查询身份证详单
*通过身份证号
......@@ -27,8 +33,16 @@ public class CardDetailedListApi {
* @return
*/
@RequestMapping("findCardDetailedList")
public List<DetailReceiptListEntity> findCardDetailedList(@RequestParam("idCard") String idCard) {
List<DetailReceiptListEntity> list = cardDetailedListService.findCardDetailedListByIdCard(idCard);
public List<DetailReceiptListEntity> findCardDetailedList(@RequestParam("idCard") String idCard, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<DetailReceiptListEntity> list = new ArrayList<DetailReceiptListEntity>();
try{
list = cardDetailedListService.findCardDetailedListByIdCard(idCard);
} catch (Exception e){
logger.error("身份证号:" + idCard);
logger.error("Exception 通过身份证号查询身份证详单异常", e);
}
return list;
}
......@@ -40,8 +54,16 @@ public class CardDetailedListApi {
* @return
*/
@RequestMapping("findAllCardDetailedList")
public List<Map<String,Object>> findAllCardDetailedList(@RequestParam("idCard") String idCard) {
List<Map<String,Object>> list = cardDetailedListService.findAllCardDetailedListByIdCard(idCard);
public List<Map<String,Object>> findAllCardDetailedList(@RequestParam("idCard") String idCard, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String,Object>> list = new ArrayList <>();
try{
list = cardDetailedListService.findAllCardDetailedListByIdCard(idCard);
} catch (Exception e){
logger.error("身份证号:" + idCard);
logger.error("Exception 通过身份证号查询所有的身份证详单异常", e);
}
return list;
}
......
......@@ -6,6 +6,7 @@ import com.yxproject.start.utils.ExportExcel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -31,6 +32,8 @@ public class ExportExcelApi {
@Autowired
private ReceiptService receiptService;
Logger logger= Logger.getLogger(ExportExcelApi.class);
/**
* 导出公安网数据
*/
......@@ -42,7 +45,7 @@ public class ExportExcelApi {
JSONArray jsonArray = JSONArray.fromObject(jsonObject.get("list"));
// String type = jsonObject.get("type").toString();
String name = jsonObject.get("name").toString();
List<Map<String, Object>> mapList = detailReceiptListService.selectPostDetails(jsonArray,name);
List<Map<String, Object>> mapList = detailReceiptListService.selectPostDetails(jsonArray, name);
response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8");
String dateTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd");
......@@ -59,21 +62,31 @@ public class ExportExcelApi {
return b;
} catch (FileNotFoundException e) {
e.printStackTrace();
logger.error("导出文件名:" + fout);
logger.error("FileNotFoundException 导出公安网数据未找到异常", e);
} catch (IOException e) {
e.printStackTrace();
logger.error("导出文件名:" + fout);
logger.error("IOException 导出公安网数据IO异常", e);
}
return null;
}
/**
* 导出交接单
*/
@RequestMapping("printReceiptExcelData")
public Map<String, Object> printReceiptExcelData(@RequestBody String list) {
JSONObject jsonObject = JSONObject.fromObject(list);
JSONArray jsonArray = JSONArray.fromObject(jsonObject.get("list"));
String type = jsonObject.get("type").toString();
Map<String, Object> map = receiptService.selectReceiptList(jsonArray, Long.valueOf(type));
public Map<String, Object> printReceiptExcelData(@RequestBody String list, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = null;
JSONArray jsonArray;
String type = null;
Map<String, Object> map = null;
try {
jsonObject=JSONObject.fromObject(list);
type=jsonObject.get("type").toString();
jsonArray=JSONArray.fromObject(jsonObject.get("list"));
map=receiptService.selectReceiptList(jsonArray, Long.valueOf(type));
// response.setContentType("application/x-download");
// response.setCharacterEncoding("UTF-8");
// String dateTime = DateFormatUtils.format(new Date(), "yyyy_MM_dd");
......@@ -97,6 +110,11 @@ public class ExportExcelApi {
// e.printStackTrace();
// }
// return null;
}catch (Exception e) {
e.printStackTrace();
logger.error("异常参数:" + jsonObject);
logger.error("Exception 导出交接单异常", e);
}
return map;
}
......
......@@ -7,6 +7,8 @@ import com.yxproject.start.service.FilesService;
import com.yxproject.start.service.NewFilesService;
import com.yxproject.start.service.PreproPersonService;
import com.yxproject.start.utils.ZipUtils;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
......@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -39,13 +42,16 @@ public class ExportXMLApi {
@Autowired
private FilesService filesService;
Logger logger= Logger.getLogger(ExportXMLApi.class);
/**
* 导出制证数据包
*/
@RequestMapping("printXmlData")
// @RequiresPermissions("userInfo.add")//权限管理;
public byte[] printXmlData(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard") String IDCard, @RequestParam("oldFile") String oldFile, @RequestParam("newFile") String newFile, @RequestParam("SSXQDM") String SSXQDM, @RequestParam("cardType") String cardType, @RequestParam("state") String state, @RequestParam("uploadDate") String uploadDate, @RequestParam("downloadState") String downloadState, HttpServletResponse response) {
public byte[] printXmlData(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard") String IDCard, @RequestParam("oldFile") String oldFile, @RequestParam("newFile") String newFile, @RequestParam("SSXQDM") String SSXQDM, @RequestParam("cardType") String cardType, @RequestParam("state") String state, @RequestParam("uploadDate") String uploadDate, @RequestParam("downloadState") String downloadState, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
//使用Servlet实现文件下载的时候,避免浏览器自动打开文件
List<PreproPersonEntity> preproPersonEntities = preproPersonService.selectAllPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate), downloadState);
// List<PreproPersonEntity> preproPersonEntities = preproPersonService.selectAllPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate));
......@@ -140,6 +146,8 @@ public class ExportXMLApi {
xml = createToMakePackageXML(preproPersonEntityList1, filesEntity, "\\zhang");
} catch (IOException e) {
e.printStackTrace();
logger.error("个人上传受理号:" + uploadNo + "个人身份证号:" + IDCard + "包号:" + oldFile + "新文件名:" + newFile + "签发机关:" + SSXQDM + "制证类型:" + cardType + "是否有效(1有效,0无效):" + state + "下载时间:" + uploadDate + "下载状态(0未下载,1已下载):" + downloadState);
logger.error("IOException 导出制证数据包IO异常", e);
}
documentList.add(xml);
}
......@@ -155,6 +163,8 @@ public class ExportXMLApi {
out = new ZipOutputStream(response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
logger.error("制证包数据打包名:" + zipName);
logger.error("IOException 制证包数据打包下载IO异常", e);
}
try {
for (String document : documentList) {
......@@ -163,15 +173,17 @@ public class ExportXMLApi {
}
} catch (Exception e) {
e.printStackTrace();
logger.error("制证包数据打包名:" + zipName);
logger.error("Exception 制证包数据打包下载异常", e);
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
logger.error("制证包数据打包名:" + zipName);
logger.error("IOException 制证包数据打包下载IO异常", e);
}
}
}
return null;
}
......@@ -283,6 +295,7 @@ public class ExportXMLApi {
writer.close();
} catch (IOException e) {
e.printStackTrace();
logger.error("IOException XML文件生成异常", e);
}
System.out.println("XML文件生成成功..." + new Date());
return "D:\\XML\\" + "ZAGL_ZZJH_" + filesEntity.getDwdm() + simpleDateFormat.format(new Date()) + cardType + files_seq + ".xml";
......
package com.yxproject.start.api;
import com.yxproject.start.service.PersonPostService;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("FilesAnalysis")
public class FilesAnalysisApi {
@Autowired
private PersonPostService personPostService;
Logger logger= Logger.getLogger(FilesAnalysisApi.class);
/**
* 文件解析 修改解析状态
* @param fileId
......@@ -19,8 +25,15 @@ public class FilesAnalysisApi {
* @return
*/
@RequestMapping("anailsis")
public boolean filesAnailsis(@RequestParam(value = "fileId") String fileId,@RequestParam(value = "creatTime") String creatTime){
personPostService.updateIsPost(fileId,creatTime);
public boolean filesAnailsis(@RequestParam(value = "fileId") String fileId,@RequestParam(value = "creatTime") String creatTime, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
personPostService.updateIsPost(fileId,creatTime);
}catch (Exception e){
logger.error("文件ID:" + fileId + "生成时间:" + creatTime);
logger.error("Exception 文件解析 修改解析状态异常", e);
}
return true;
}
}
......@@ -3,12 +3,16 @@ package com.yxproject.start.api;
import com.yxproject.start.entity.NewFilesEntity;
import com.yxproject.start.service.InfoManagementService;
import org.apache.ibatis.annotations.Param;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@RestController
......@@ -17,6 +21,8 @@ public class InfoManagementApi {
@Autowired
private InfoManagementService infoManagementService;
Logger logger= Logger.getLogger(InfoManagementApi.class);
/**
* 按条件查询制证信息数据
* @param beginFileName
......@@ -29,8 +35,16 @@ public class InfoManagementApi {
* @return
*/
@RequestMapping("selectInfoManagement")
public List<NewFilesEntity>selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
List<NewFilesEntity> resultList = infoManagementService.selectInfoManagement(beginFileName, endFileName, gajgMc, replaceDate(beginDate), replaceDate(endDate), Long.valueOf(currPage),Long.valueOf(pageSize));
public List<NewFilesEntity>selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<NewFilesEntity> resultList = new ArrayList<NewFilesEntity>();
try {
infoManagementService.selectInfoManagement(beginFileName, endFileName, gajgMc, replaceDate(beginDate), replaceDate(endDate), Long.valueOf(currPage),Long.valueOf(pageSize));
}catch (Exception e){
logger.error("起始文件名:" + beginFileName + "截止文件名:" + endFileName + "公安机关名称:" + gajgMc + "起始时间:" + beginDate + "截止时间:" + endDate + "页数:" + currPage + "行数:" + pageSize);
logger.error("Exception 按条件查询制证信息数据异常", e);
}
return resultList;
}
......@@ -45,9 +59,17 @@ public class InfoManagementApi {
* @return
*/
@RequestMapping("selectCount")
public long selectCount(@Param("beginFileId")String beginFileId, @Param("endFileId")String endFileId, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate){
long count= infoManagementService.count(beginFileId,endFileId,gajgMc,replaceDate(beginDate),replaceDate(endDate));
return count;
public long selectCount(@Param("beginFileId")String beginFileId, @Param("endFileId")String endFileId, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
long count= 0;
try {
count = infoManagementService.count(beginFileId,endFileId,gajgMc,replaceDate(beginDate),replaceDate(endDate));
}catch (Exception e){
logger.error( "公安机关名称:" + gajgMc + "起始时间:" + beginDate + "截止时间:" + endDate);
logger.error("Exception 查询制证信息数据条数异常", e);
}
return count;
}
/**
......@@ -61,10 +83,18 @@ public class InfoManagementApi {
*/
@RequestMapping("deleteInfo")
@Transactional(rollbackFor = Exception.class)
public boolean deleteInfo(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate){
boolean result= infoManagementService.deleteInfo(beginFileName,endFileName,gajgMc,replaceDate(beginDate),replaceDate(endDate));
//更改新文件状态
infoManagementService.updatePackageNo(beginFileName,endFileName,gajgMc,replaceDate(beginDate),replaceDate(endDate));
public boolean deleteInfo(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean result = true;
try {
result = infoManagementService.deleteInfo(beginFileName,endFileName,gajgMc,replaceDate(beginDate),replaceDate(endDate));
//更改新文件状态
infoManagementService.updatePackageNo(beginFileName,endFileName,gajgMc,replaceDate(beginDate),replaceDate(endDate));
}catch (Exception e){
logger.error("起始文件名:" + beginFileName + "截止文件名:" + endFileName + "公安机关名称:" + gajgMc + "起始时间:" + beginDate + "截止时间:" + endDate);
logger.error("Exception 删除制证信息数据异常", e);
}
return result;
}
......
......@@ -3,11 +3,15 @@ package com.yxproject.start.api;
import com.yxproject.start.service.DataAuditingService;
import com.yxproject.start.service.ReceiptService;
import com.yxproject.start.service.TaskListService;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -26,6 +30,8 @@ public class ReportApi {
@Autowired
private ReceiptService receiptService;
Logger logger= Logger.getLogger(ReportApi.class);
/**
* 查询报表
* 数据核验
......@@ -34,8 +40,16 @@ public class ReportApi {
* @return
*/
@RequestMapping("queryDataAuditingReport")
public List<Map<String, Object>> queryDataAuditingReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate,@RequestParam(value = "policeName") String policeName,@RequestParam(value = "policeCode") String policeCode) {
List<Map<String, Object>> mapList = dataAuditingService.selectDataAuditingReport(replaceDate(startDate), replaceDate(endDate),policeName,policeCode);
public List<Map<String, Object>> queryDataAuditingReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate,@RequestParam(value = "policeName") String policeName,@RequestParam(value = "policeCode") String policeCode, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> mapList = new ArrayList <>();
try {
mapList = dataAuditingService.selectDataAuditingReport(replaceDate(startDate), replaceDate(endDate),policeName,policeCode);
}catch (Exception e){
logger.error("开始时间:" + startDate + "结束时间:" + endDate + "公安机关名称:" + policeName + "公安机关代码:" + policeCode);
logger.error("Exception 查询数据核验报表异常", e);
}
return mapList;
}
......@@ -47,8 +61,16 @@ public class ReportApi {
* @return
*/
@RequestMapping("queryFilmPrintReport")
public List<Map<String, Object>> queryFilmPrintReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate) {
List<Map<String, Object>> mapList = taskListService.selectFilmReport(replaceDate(startDate), replaceDate(endDate));
public List<Map<String, Object>> queryFilmPrintReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> mapList = new ArrayList <>();
try {
mapList = taskListService.selectFilmReport(replaceDate(startDate), replaceDate(endDate));
}catch (Exception e){
logger.error("开始时间:" + startDate + "结束时间:" + endDate);
logger.error("Exception 查询膜打印报表异常", e);
}
return mapList;
}
......@@ -61,9 +83,17 @@ public class ReportApi {
* @return
*/
@RequestMapping("queryWorkGroupReport")
public List<Map<String,Object>> queryWorkGroupReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate,@RequestParam(value = "workGroup") String workGroup) {
List<Map<String,Object>> map = taskListService.selectWorkGroupReport(replaceDate(startDate), replaceDate(endDate), workGroup);
return map;
public List<Map<String,Object>> queryWorkGroupReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate,@RequestParam(value = "workGroup") String workGroup, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> mapList = new ArrayList <>();
try {
mapList = taskListService.selectWorkGroupReport(replaceDate(startDate), replaceDate(endDate), workGroup);
}catch (Exception e){
logger.error("开始时间:" + startDate + "结束时间:" + endDate + "工作组:" + workGroup);
logger.error("Exception 查询工作组报表异常", e);
}
return mapList;
}
/**
......@@ -75,8 +105,16 @@ public class ReportApi {
* @return
*/
@RequestMapping("querySortingReport")
public List<Map<String, Object>> querySortingReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate,@RequestParam(value = "name") String name) {
List<Map<String, Object>> mapList = receiptService.selectReceiptReport(replaceDate(startDate), replaceDate(endDate), name);
public List<Map<String, Object>> querySortingReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate,@RequestParam(value = "name") String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> mapList = new ArrayList <>();
try {
mapList = receiptService.selectReceiptReport(replaceDate(startDate), replaceDate(endDate), name);
}catch (Exception e){
logger.error("开始时间:" + startDate + "结束时间:" + endDate + "分拣人员:" + name);
logger.error("Exception 查询分拣报表异常", e);
}
return mapList;
}
......@@ -88,8 +126,16 @@ public class ReportApi {
* @return
*/
@RequestMapping("queryQualityCheckReport")
public List<Map<String, Object>> queryQualityCheckReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate) {
List<Map<String, Object>> mapList = taskListService.selectQualityCheckReport(replaceDate(startDate), replaceDate(endDate));
public List<Map<String, Object>> queryQualityCheckReport(@RequestParam(value = "startDate") String startDate,@RequestParam(value = "endDate") String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> mapList = new ArrayList <>();
try {
mapList = taskListService.selectQualityCheckReport(replaceDate(startDate), replaceDate(endDate));
}catch (Exception e){
logger.error("开始时间:" + startDate + "结束时间:" + endDate);
logger.error("Exception 查询质检(仓库)报表异常", e);
}
return mapList;
}
......
package com.yxproject.start.api;
import com.yxproject.start.service.SelectSerialNumberService;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -23,43 +26,53 @@ public class SelectApi {
@Autowired
private SelectSerialNumberService selectSerialNumberService;
@RequestMapping(value = "selectByCard")
public Map<String, Object> selectByCard(@RequestParam("id") String string) {
String id = formateAcceptNo(string);
Map<String, Object> resultMap = new HashMap<>();
if (id.length() == 11) {
List<Map<String, Object>> workOrderData = selectSerialNumberService.selectByWorkOrderFromYX(id);
List<Map<String, Object>> ACCdata = new ArrayList<>();
List<Map<String, Object>> PRODData = new ArrayList<>();
resultMap.put("workOrderData", workOrderData);
resultMap.put("ACCdata", ACCdata);
resultMap.put("PRODData", PRODData);
} else if (id.length() == 8) {
List<Map<String, Object>> workOrderData = selectSerialNumberService.selectByGroupNo(id.replace("e","E").replace("g","G"));
List<Map<String, Object>> ACCdata = new ArrayList<>();
List<Map<String, Object>> PRODData = new ArrayList<>();
resultMap.put("workOrderData", workOrderData);
resultMap.put("ACCdata", ACCdata);
resultMap.put("PRODData", PRODData);
} else if (id.length() == 10 || id.length() == 18) {
Logger logger= Logger.getLogger(SelectApi.class);
//查询是否是特证,如果是,返回新的任务单信息
List<Map<String, Object>> workOrderData = selectSerialNumberService.selectByAcceptNoOrCardIdFromTaskList2(id.replace("e","E").replace("g","G"));
if (workOrderData.size() != 0) {
@RequestMapping(value = "selectByCard")
public Map<String, Object> selectByCard(@RequestParam("id") String id, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String, Object> resultMap = null;
try {
resultMap = new HashMap<>();
id = formateAcceptNo(id);
if (id.length() == 11) {
List<Map<String, Object>> workOrderData = selectSerialNumberService.selectByWorkOrderFromYX(id);
List<Map<String, Object>> ACCdata = new ArrayList<>();
List<Map<String, Object>> PRODData = new ArrayList<>();
resultMap.put("workOrderData", workOrderData);
} else {
List<Map<String, Object>> workOrderData2 = selectSerialNumberService.selectByAcceptNoOrCardIdFromTaskList(id.replace("e","E").replace("g","G"));
resultMap.put("workOrderData", workOrderData2);
}
resultMap.put("ACCdata", ACCdata);
resultMap.put("PRODData", PRODData);
} else if (id.length() == 8) {
List<Map<String, Object>> workOrderData = selectSerialNumberService.selectByGroupNo(id);
List<Map<String, Object>> ACCdata = new ArrayList<>();
List<Map<String, Object>> PRODData = new ArrayList<>();
resultMap.put("workOrderData", workOrderData);
resultMap.put("ACCdata", ACCdata);
resultMap.put("PRODData", PRODData);
} else if (id.length() == 10 || id.length() == 18) {
//查询是否是特证,如果是,返回新的任务单信息
List<Map<String, Object>> workOrderData = selectSerialNumberService.selectByAcceptNoOrCardIdFromTaskList2(id);
if (workOrderData.size() != 0) {
resultMap.put("workOrderData", workOrderData);
} else {
List<Map<String, Object>> workOrderData2 = selectSerialNumberService.selectByAcceptNoOrCardIdFromTaskList(id);
resultMap.put("workOrderData", workOrderData2);
}
List<Map<String, Object>> ACCdata = selectSerialNumberService.selectByAcceptNoOrCardIdFromACC(id.replace("e","E").replace("g","G"));
List<Map<String, Object>> PRODData = selectSerialNumberService.selectByAcceptNoOrCardIdFromPROD(id.replace("e","E").replace("g","G"));
List<Map<String, Object>> ACCdata = selectSerialNumberService.selectByAcceptNoOrCardIdFromACC(id);
List<Map<String, Object>> PRODData = selectSerialNumberService.selectByAcceptNoOrCardIdFromPROD(id);
resultMap.put("ACCdata", ACCdata);
resultMap.put("PRODData", PRODData);
resultMap.put("ACCdata", ACCdata);
resultMap.put("PRODData", PRODData);
} else {
} else {
// return null;
}
}catch (Exception e){
logger.error("传入的组号8位、受理号10位、身份证号18位、任务单号11位" + id);
logger.error("Exception SelectApi异常", e);
}
return resultMap;
}
......
package com.yxproject.start.api;
import com.yxproject.start.service.SpecialCardService;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -19,13 +23,24 @@ public class SpecialCardApi {
@Autowired
private SpecialCardService specialCardService;
Logger logger= Logger.getLogger(SpecialCardApi.class);
/**
* 查询特殊证件详情
* @param groupNo 组号
* @return
*/
@RequestMapping("selectSpecialCard")
public List<Map> updateState2(@RequestParam("groupNo") String groupNo) {
return specialCardService.selectSpecialCardByGroupNo(groupNo);
public List<Map> updateState2(@RequestParam("groupNo") String groupNo, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map> map = new ArrayList<>();
try {
map = specialCardService.selectSpecialCardByGroupNo(groupNo);
}catch (Exception e){
logger.error("组号:" + groupNo );
logger.error("Exception 查询特殊证件详情异常", e);
}
return map;
}
}
package com.yxproject.start.api;
import com.yxproject.start.service.PreproPersonService;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("updateState")
public class UpdateStateApi {
@Autowired
PreproPersonService preproPersonService;
Logger logger= Logger.getLogger(UpdateStateApi.class);
@RequestMapping("updateState")
public boolean updateState(@RequestParam(value = "state") String state,@RequestParam(value = "acceptNo") String acceptNo){
preproPersonService.uploadState(state,acceptNo);
public boolean updateState(@RequestParam(value = "state") String state,@RequestParam(value = "acceptNo") String acceptNo, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
preproPersonService.uploadState(state,acceptNo);
}catch (Exception e){
logger.error("状态(是否打包):" + state + "受理号:" + acceptNo);
logger.error("Exception updateState异常", e);
}
return true;
}
......
......@@ -2,6 +2,8 @@ package com.yxproject.start.api;
import com.yxproject.start.entity.UserInfo;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
......@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashMap;
import java.util.Map;
......@@ -22,8 +25,12 @@ import java.util.Map;
@RequestMapping("user")
public class UserApi {
Logger logger= Logger.getLogger(UserApi.class);
@PostMapping("login")
public Map<String, Object> submitLogin(@RequestBody String jsonStr) {
public Map<String, Object> submitLogin(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
String username = jsonObject.getString("username");
String password = jsonObject.getString("password");
......@@ -40,21 +47,33 @@ public class UserApi {
} catch (UnknownAccountException e) {
resultMap.put("status", 201);
resultMap.put("message", "账号不存在!");
logger.error("不存在的用户名:" + username);
logger.error("", e);
} catch (IncorrectCredentialsException e1) {
resultMap.put("status", 202);
resultMap.put("message", "密码错误!");
logger.error("用户密码错误,用户名:" + username + "错误密码:" + password);
logger.error("", e1);
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", "用户名密码错误");
logger.error("用户名错误:" + username + "错误密码:" + password);
logger.error("Exception 用户登录异常", e);
}
return resultMap;
}
@RequestMapping("logout")
public void logout() {
Subject subject = SecurityUtils.getSubject();
if (subject.isAuthenticated()) {
subject.logout();
public void logout( HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
Subject subject = SecurityUtils.getSubject();
if (subject.isAuthenticated()) {
subject.logout();
}
}catch (Exception e){
logger.error("Exception 用户登出异常", e);
}
}
......
......@@ -2,11 +2,14 @@ package com.yxproject.start.api;
import com.yxproject.start.entity.PreproPersonEntity;
import com.yxproject.start.service.PreproPersonService;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -21,34 +24,45 @@ import java.util.Map;
public class queryPreproPerson {
@Autowired
private PreproPersonService preproPersonService;
Logger logger= Logger.getLogger(queryPreproPerson.class);
/**
* 查询制证数据
*/
@RequestMapping("queryPreproPerson")
// @RequiresPermissions("userInfo.add")//权限管理;
public Map<String,Object> printXmlData(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard")String IDCard,@RequestParam("oldFile") String oldFile, @RequestParam("newFile")String newFile, @RequestParam("SSXQDM")String SSXQDM, @RequestParam("cardType")String cardType, @RequestParam("state")String state,@RequestParam("uploadDate")String uploadDate,@RequestParam("currPage")String currPage,@RequestParam("pageSize")String pageSize,@RequestParam("downloadState")String downloadState, HttpServletResponse response){
List<Map<String, Object>> preproPersonEntities = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate),currPage,pageSize,downloadState);
Map<String,Object> map = new LinkedHashMap<>();
//todo
List<Map<String, Object>> preproPersonEntityList = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate),downloadState);
map.put("total",preproPersonEntityList.size());
int youSum =0;
int puSum=0;
int invaildCount = 0;
for (Map<String, Object> map1 :preproPersonEntityList){
if ("9".equals(map1.get("CARD_TYPE_ID")+"")){
youSum++;
}else if ("0".equals(map1.get("CARD_TYPE_ID")+"")){
puSum++;
}
if ("0".equals(map1.get("IS_VALID")+"")){
invaildCount++;
public Map<String,Object> printXmlData(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard")String IDCard,@RequestParam("oldFile") String oldFile, @RequestParam("newFile")String newFile, @RequestParam("SSXQDM")String SSXQDM, @RequestParam("cardType")String cardType, @RequestParam("state")String state,@RequestParam("uploadDate")String uploadDate,@RequestParam("currPage")String currPage,@RequestParam("pageSize")String pageSize,@RequestParam("downloadState")String downloadState, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String,Object> map = null;
try {
map = new LinkedHashMap<>();
List<Map<String, Object>> preproPersonEntities = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate),currPage,pageSize,downloadState);
//todo
List<Map<String, Object>> preproPersonEntityList = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate),downloadState);
map.put("total",preproPersonEntityList.size());
int youSum =0;
int puSum=0;
int invaildCount = 0;
for (Map<String, Object> map1 :preproPersonEntityList){
if ("9".equals(map1.get("CARD_TYPE_ID")+"")){
youSum++;
}else if ("0".equals(map1.get("CARD_TYPE_ID")+"")){
puSum++;
}
if ("0".equals(map1.get("IS_VALID")+"")){
invaildCount++;
}
}
map.put("list",preproPersonEntities);
map.put("youSum",youSum);
map.put("puSum",puSum);
map.put("invaildCount",invaildCount);
}catch (Exception e){
logger.error("oldFile:" + uploadNo + "公民身份号码:" + IDCard+ "包号:" + oldFile+ "文件名:" + newFile+ "签发机关:" + SSXQDM+ "制证类型代码(9邮寄0大批):" + cardType + "是否有效(1有效,0无效):" + state + "上传时间:" + uploadDate+ "页数:" + currPage+ "条数:" + pageSize+ "生成时间:" + downloadState);
logger.error("Exception 查询制证数据异常", e);
}
map.put("list",preproPersonEntities);
map.put("youSum",youSum);
map.put("puSum",puSum);
map.put("invaildCount",invaildCount);
return map;
}
......@@ -57,13 +71,21 @@ public class queryPreproPerson {
*/
@RequestMapping("updatePreproPerson")
// @RequiresPermissions("userInfo.add")//权限管理;
public Map<String,Object> updatePreproPerson(@RequestParam("id") String id, @RequestParam("isValid")String isValid, HttpServletResponse response){
PreproPersonEntity preproPersonEntity = new PreproPersonEntity();
preproPersonEntity.setId(Long.valueOf(id));
preproPersonEntity.setIsValid(Long.valueOf(isValid));
preproPersonService.updatePreproPersonIsValid(preproPersonEntity);
Map<String,Object> map = new LinkedHashMap<>();
map.put("msg","成功更新制证数据是否有效");
public Map<String,Object> updatePreproPerson(@RequestParam("id") String id, @RequestParam("isValid")String isValid, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String,Object> map = null;
try {
PreproPersonEntity preproPersonEntity = new PreproPersonEntity();
preproPersonEntity.setId(Long.valueOf(id));
preproPersonEntity.setIsValid(Long.valueOf(isValid));
preproPersonService.updatePreproPersonIsValid(preproPersonEntity);
map = new LinkedHashMap<>();
map.put("msg","成功更新制证数据是否有效");
} catch (Exception e){
logger.error("制证信息ID:" + id + "是否有效(1有效,0无效):" + isValid );
logger.error("Exception 更新制证数据是否有效异常", e);
}
return map;
}
......@@ -72,11 +94,19 @@ public class queryPreproPerson {
*/
@RequestMapping("queryPreproPersonCount")
// @RequiresPermissions("userInfo.add")//权限管理;
public Map<String,Object> queryPreproPersonCount(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard")String IDCard,@RequestParam("oldFile") String oldFile, @RequestParam("newFile")String newFile, @RequestParam("SSXQDM")String SSXQDM, @RequestParam("cardType")String cardType, @RequestParam("state")String state,@RequestParam("uploadDate")String uploadDate,@RequestParam("downloadState")String downloadState, HttpServletResponse response){
Map<String,Object> map = new LinkedHashMap<>();
//todo
List<Map<String, Object>> preproPersonEntityList = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate),downloadState);
map.put("total",preproPersonEntityList.size());
public Map<String,Object> queryPreproPersonCount(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard")String IDCard,@RequestParam("oldFile") String oldFile, @RequestParam("newFile")String newFile, @RequestParam("SSXQDM")String SSXQDM, @RequestParam("cardType")String cardType, @RequestParam("state")String state,@RequestParam("uploadDate")String uploadDate,@RequestParam("downloadState")String downloadState, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String,Object> map = null;
try {
map = new LinkedHashMap<>();
//todo
List<Map<String, Object>> preproPersonEntityList = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, replaceDate(uploadDate),downloadState);
map.put("total",preproPersonEntityList.size());
}catch (Exception e){
logger.error("oldFile:" + uploadNo + "公民身份号码:" + IDCard+ "包号:" + oldFile+ "文件名:" + newFile+ "签发机关:" + SSXQDM+ "制证类型代码(9邮寄0大批):" + cardType + "是否有效(1有效,0无效):" + state + "上传时间:" + uploadDate+ "页数:" + "生成时间:" + downloadState);
logger.error("Exception 查询制证数据总数异常", e);
}
return map;
}
......
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