Commit ca1f70e4 authored by Administrator's avatar Administrator

添加异常抛出到日志

parent 869b9229
......@@ -9,15 +9,15 @@ import com.yxproject.start.service.UserInfoService;
import com.yxproject.start.utils.Md5Utils;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
/**
......@@ -37,6 +37,7 @@ public class AdminApi {
@Autowired
private SysRoleService sysRoleService;
Logger logger= Logger.getLogger(AdminApi.class);
@RequestMapping("test")
public String hello() {
......@@ -50,8 +51,15 @@ public class AdminApi {
* @return
*/
@RequestMapping("getUserList")
public List<UserInfo> selectAllUser() {
List<UserInfo> list = userInfoService.getAllUserInfo();
public List<UserInfo> selectAllUser(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<UserInfo> list = new ArrayList<UserInfo>();
try {
list = userInfoService.getAllUserInfo();
}catch (Exception e){
logger.error("Exception 获得用户列表异常", e);
}
return list;
}
......@@ -61,15 +69,20 @@ public class AdminApi {
* @return
*/
@PostMapping("userAdd")
public Map<String, String> userInfoAdd(@RequestBody String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
public Map<String, String> userInfoAdd(@RequestBody String json, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
Map<String, String> map = null;
try {
jsonObject = JSONObject.fromObject(json);
String salt = UUID.randomUUID().toString();
UserInfo userInfo = new UserInfo();
userInfo.setPassword(Md5Utils.entryptPassword(jsonObject.getString("password"), salt));
userInfo.setSalt(salt);
userInfo.setUsername(jsonObject.getString("username"));
userInfo.setName(jsonObject.getString("name"));
Map<String, String> map = new HashMap<>();
map = new HashMap<>();
boolean flag = false;
flag = userInfoService.addUser(userInfo, Integer.parseInt(jsonObject.getString("roleId")));
if (flag) {
......@@ -77,6 +90,10 @@ public class AdminApi {
} else {
map.put("resultMsg", "添加失败");
}
}catch (Exception e){
logger.error("添加用户参数:" + jsonObject);
logger.error("Exception 用户添加异常", e);
}
return map;
}
......@@ -86,11 +103,19 @@ public class AdminApi {
* @return
*/
@RequestMapping(value = "getUserById", method = RequestMethod.GET)
public Map<String, Object> getUserById(@RequestParam("userId") String userId, HttpServletResponse response) {
public Map<String, Object> getUserById(@RequestParam("userId") String userId, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
response.setCharacterEncoding("UTF-8");
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = null;
try {
map = new HashMap<>();
UserInfo userInfo = userInfoService.getUserInfoByUserId(Integer.parseInt(userId));
map.put("user", userInfo);
}catch (Exception e){
logger.error("用户ID:" + userId);
logger.error("Exception 通过id查询用户异常", e);
}
return map;
}
......@@ -102,9 +127,13 @@ public class AdminApi {
* @return
*/
@RequestMapping(value = "userDel", method = RequestMethod.GET)
public Map<String, Object> userInfoDel(@RequestParam("userId") String userId, HttpServletResponse response) {
public Map<String, Object> userInfoDel(@RequestParam("userId") String userId, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
response.setCharacterEncoding("UTF-8");
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = null;
try {
map = new HashMap<>();
boolean flag = false;
flag = userInfoService.deleteUserInfo(Integer.parseInt(userId));
if (flag) {
......@@ -112,9 +141,11 @@ public class AdminApi {
} else {
map.put("returnMsg", "删除失败");
}
}catch (Exception e){
logger.error("用户ID:" + userId);
logger.error("Exception 用户删除异常", e);
}
return map;
}
/**
......@@ -123,9 +154,13 @@ public class AdminApi {
* @return
*/
@RequestMapping(value = "userBack", method = RequestMethod.GET)
public Map<String, Object> userInfoBack(@RequestParam("userId") String userId, HttpServletResponse response) {
public Map<String, Object> userInfoBack(@RequestParam("userId") String userId, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
response.setCharacterEncoding("UTF-8");
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = null;
try {
map = new HashMap<>();
boolean flag = false;
flag = userInfoService.BackUserInfo(Integer.parseInt(userId));
if (flag) {
......@@ -133,22 +168,37 @@ public class AdminApi {
} else {
map.put("returnMsg", "启用失败");
}
}catch (Exception e){
logger.error("用户ID:" + userId);
logger.error("Exception 用户删除异常", e);
}
return map;
}
@RequestMapping("getRoleList")
public List<SysRole> selectAllRole() {
List<SysRole> list = sysRoleService.getAllRoleInfo();
public List<SysRole> selectAllRole(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<SysRole> list = new ArrayList <SysRole>();
try {
list = sysRoleService.getAllRoleInfo();
}catch (Exception e){
logger.error("Exception 获取角色列表异常", e);
}
return list;
}
@RequestMapping("getPermissionList")
public List<SysPermission> selectAllPermission() {
List<SysPermission> list = sysPermissionService.getAllPermission();
public List<SysPermission> selectAllPermission(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<SysPermission> list = new ArrayList <SysPermission>();;
try {
list = sysPermissionService.getAllPermission();
}catch (Exception e){
logger.error("Exception 获取权限列表异常", e);
}
return list;
}
......@@ -159,9 +209,13 @@ public class AdminApi {
* @return
*/
@RequestMapping("permissionDel")
public Map permissionDel(@RequestParam("permissionId") String permissionId, HttpServletResponse response) {
public Map permissionDel(@RequestParam("permissionId") String permissionId, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
Map map = null;
try {
map = new HashMap();
boolean flag = false;
flag = sysPermissionService.deletePermission(Integer.parseInt(permissionId));
if (flag) {
......@@ -169,6 +223,10 @@ public class AdminApi {
} else {
map.put("returnMsg", "删除失败");
}
}catch (Exception e){
logger.error("id:" + permissionId);
logger.error("Exception 权限删除异常", e);
}
return map;
}
......@@ -178,9 +236,13 @@ public class AdminApi {
* @return
*/
@RequestMapping("permissionOpen")
public Map permissionBack(@RequestParam("permissionId") String permissionId, HttpServletResponse response) {
public Map permissionBack(@RequestParam("permissionId") String permissionId, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
Map map = null;
try {
map = new HashMap();
boolean flag = false;
flag = sysPermissionService.backPermission(Integer.parseInt(permissionId));
if (flag) {
......@@ -188,6 +250,10 @@ public class AdminApi {
} else {
map.put("returnMsg", "启用失败");
}
}catch (Exception e){
logger.error("id:" + permissionId);
logger.error("Exception 权限启用异常", e);
}
return map;
}
......@@ -197,13 +263,20 @@ public class AdminApi {
* @return
*/
@RequestMapping(value = "getPermsById", method = RequestMethod.GET)
public Map<String, Object> getPermsById(@RequestParam("permissionId") String permissionId, HttpServletResponse response) {
public Map<String, Object> getPermsById(@RequestParam("permissionId") String permissionId, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
response.setCharacterEncoding("UTF-8");
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = null;
try {
map = new HashMap<>();
SysPermission sysPermission = sysPermissionService.getPermissionByPId(Integer.parseInt(permissionId));
map.put("permission", sysPermission);
}catch (Exception e){
logger.error("id:" + permissionId);
logger.error("Exception 通过id查询权限异常", e);
}
return map;
}
/**
......@@ -212,13 +285,20 @@ public class AdminApi {
* @return
*/
@RequestMapping(value = "getRoleById", method = RequestMethod.GET)
public Map<String, Object> getRoleById(@RequestParam("roleId") String roleId, HttpServletResponse response) {
public Map<String, Object> getRoleById(@RequestParam("roleId") String roleId, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
response.setCharacterEncoding("UTF-8");
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = null;
try {
map = new HashMap<>();
SysRole sysRole = sysRoleService.getRoleByRoleId(Integer.parseInt(roleId));
map.put("role", sysRole);
}catch (Exception e){
logger.error("id:" + roleId);
logger.error("Exception 通过id查询角色异常", e);
}
return map;
}
/**
......@@ -229,10 +309,15 @@ public class AdminApi {
* @return
*/
@RequestMapping(value = "permissionAdd", method = RequestMethod.POST)
public Map<String, String> userAdd(@RequestBody String jsonStr, HttpServletResponse resp) {
public Map<String, String> userAdd(@RequestBody String jsonStr, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
resp.setCharacterEncoding("UTF-8");
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
Map<String, String> map = null;
JSONObject jsonObject = new JSONObject();
try {
map = new HashMap<>();
jsonObject = JSONObject.fromObject(jsonStr);
boolean flag = false;
String str = "0";
SysPermission sysPermission = new SysPermission();
......@@ -253,6 +338,10 @@ public class AdminApi {
} else {
map.put("resultMsg", "添加失败");
}
}catch (Exception e){
logger.error("权限添加参数:" + jsonObject);
logger.error("Exception 添加权限异常", e);
}
return map;
}
......@@ -265,8 +354,15 @@ public class AdminApi {
*/
@RequestMapping(value = "getAllActiveRoleList", method = RequestMethod.GET)
public List<SysRole> userInfoAdd() {
List<SysRole> list = sysRoleService.getAllActiveRoleInfo();
public List<SysRole> userInfoAdd(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<SysRole> list = new ArrayList <SysRole>();
try {
list = sysRoleService.getAllActiveRoleInfo();
}catch (Exception e){
logger.error("Exception 查询所有非锁定角色异常", e);
}
return list;
}
......@@ -277,8 +373,15 @@ public class AdminApi {
*/
@RequestMapping(value = "getAllActivePermissionList", method = RequestMethod.GET)
public List<SysPermission> getAllActivePermissionList() {
List<SysPermission> list = sysPermissionService.getAllActivePermission();
public List<SysPermission> getAllActivePermissionList(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<SysPermission> list = new ArrayList <SysPermission>();
try {
list = sysPermissionService.getAllActivePermission();
}catch (Exception e){
logger.error("Exception 查询所有非锁定权限异常", e);
}
return list;
}
......@@ -327,10 +430,15 @@ public class AdminApi {
* @return
*/
@RequestMapping("roleAdd")
public Map<String, String> roleAdd(@RequestBody String jsonStr, HttpServletResponse resp) {
public Map<String, String> roleAdd(@RequestBody String jsonStr, HttpServletResponse resp,HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
resp.setCharacterEncoding("UTF-8");
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
Map<String, String> map = null;
JSONObject jsonObject = new JSONObject();
try {
map = new HashMap<>();
jsonObject = JSONObject.fromObject(jsonStr);
boolean flag = false;
SysRole sysRole = new SysRole();
sysRole.setRole(jsonObject.getString("role"));
......@@ -346,19 +454,28 @@ public class AdminApi {
} else {
map.put("resultMsg", "添加失败");
}
}catch (Exception e){
logger.error("添加角色参数:" + jsonObject);
logger.error("Exception 添加角色异常", e);
}
return map;
}
@PostMapping("userUpdate")
public Map<String, String> userInfoUpdate(@RequestBody String json, HttpServletResponse resp) {
public Map<String, String> userInfoUpdate(@RequestBody String json, HttpServletResponse resp,HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
resp.setCharacterEncoding("UTF-8");
JSONObject jsonObject = JSONObject.fromObject(json);
Map<String, String> map = null;
JSONObject jsonObject = new JSONObject();
try {
map = new HashMap<>();
jsonObject = JSONObject.fromObject(json);
UserInfo userInfo = new UserInfo();
userInfo.setUsername(jsonObject.getString("username"));
userInfo.setName(jsonObject.getString("name"));
userInfo.setId(Integer.parseInt(jsonObject.getString("id")));
Map<String, String> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.updateUser(userInfo, Integer.parseInt(jsonObject.getString("roleId")), Integer.parseInt(jsonObject.getString("oldRoleId")));
if (flag) {
......@@ -367,55 +484,75 @@ public class AdminApi {
} else {
map.put("resultMsg", "修改失败");
}
}catch (Exception e){
logger.error("更新用户参数:" + jsonObject);
logger.error("Exception 更新用户异常", e);
}
return map;
}
@RequestMapping("roleUpdate")
public Map roleUpdate(@RequestBody String jsonStr, HttpServletResponse resp) {
public Map roleUpdate(@RequestBody String jsonStr, HttpServletResponse resp,HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
resp.setCharacterEncoding("UTF-8");
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
boolean flag = false;
SysRole sysRole = new SysRole();
Map<String, String> map = null;
JSONObject jsonObject = new JSONObject();
try {
map=new HashMap <>();
jsonObject = JSONObject.fromObject(jsonStr);
boolean flag=false;
SysRole sysRole=new SysRole();
sysRole.setId(Integer.parseInt(jsonObject.getString("roleId")));
sysRole.setRole(jsonObject.getString("role"));
sysRole.setDescription(jsonObject.getString("description"));
String oldPermissionIds = jsonObject.getString("oldPermissionIds");
JSONArray jsonArrayOldPids = JSONArray.fromObject(oldPermissionIds);
String permissionIds = jsonObject.getString("permissionId");
JSONArray jsonArrayPids = JSONArray.fromObject(permissionIds);
flag = sysRoleService.updateRole(sysRole, jsonArrayPids, jsonArrayOldPids);
if (flag) {
String oldPermissionIds=jsonObject.getString("oldPermissionIds");
JSONArray jsonArrayOldPids=JSONArray.fromObject(oldPermissionIds);
String permissionIds=jsonObject.getString("permissionId");
JSONArray jsonArrayPids=JSONArray.fromObject(permissionIds);
flag=sysRoleService.updateRole(sysRole, jsonArrayPids, jsonArrayOldPids);
if(flag){
map.put("resultMsg", "修改成功");
} else {
map.put("resultMsg", "修改失败");
}
}catch (Exception e){
logger.error("更新角色参数:" + jsonObject);
logger.error("Exception 更新角色异常", e);
}
return map;
}
@PostMapping("permissionUpdate")
public Map<String, String> permissionUpdate(@RequestBody String jsonStr, HttpServletResponse resp) {
public Map<String, String> permissionUpdate(@RequestBody String jsonStr, HttpServletResponse resp,HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
resp.setCharacterEncoding("UTF-8");
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
Map<String, String> map = new HashMap<>();
boolean flag = false;
SysPermission sysPermission = new SysPermission();
Map<String, String> map = null;
JSONObject jsonObject = new JSONObject();
try {
map=new HashMap <>();
jsonObject = JSONObject.fromObject(jsonStr);
boolean flag=false;
SysPermission sysPermission=new SysPermission();
sysPermission.setId(Integer.parseInt(jsonObject.getString("id")));
sysPermission.setName(jsonObject.getString("name"));
sysPermission.setUrl(jsonObject.getString("url"));
sysPermission.setPermission(jsonObject.getString("permission"));
System.out.println(sysPermission);
flag = sysPermissionService.updatePermission(sysPermission);
if (flag) {
flag=sysPermissionService.updatePermission(sysPermission);
if(flag){
map.put("resultMsg", "修改成功");
} else {
map.put("resultMsg", "修改失败");
}
}catch (Exception e){
logger.error("更新权限参数:" + jsonObject);
logger.error("Exception 更新权限异常", e);
}
return map;
}
......
......@@ -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;
}
......
......@@ -10,6 +10,8 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
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.RequestBody;
......@@ -27,10 +29,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @auther zhangyusheng
......@@ -47,6 +46,7 @@ public class DeliveredApi {
@Autowired
private ReceiptService receiptService;
Logger logger= Logger.getLogger(DeliveredApi.class);
/**
* 导入妥投信息表
......@@ -56,9 +56,12 @@ public class DeliveredApi {
@Produces(MediaType.APPLICATION_JSON)
@Transactional(rollbackFor = Exception.class)
public boolean ReadDeliveredInfo( @RequestParam("importName") String importName, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
YXJSONResponse yxresp = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
String filename = "";
Map<String,Object> map = new LinkedHashMap<>();
DiskFileItemFactory factory = new DiskFileItemFactory();
// 设置缓冲区的大小为100KB,如果不指定,那么缓冲区的大小默认是10KB
......@@ -96,6 +99,8 @@ public class DeliveredApi {
item.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
logger.error("上传人姓名" + importName + "文件名" + filename);
logger.error("", e);
}
ReadExcel readExcel = new ReadExcel();
List list1 = readExcel.readExcel(file);
......@@ -107,27 +112,36 @@ public class DeliveredApi {
deliveredService.saveDeliveredImportDic(deliveredImportDicEntity);
//保存个人邮寄信息
List<DeliveredInfoEntity> entityList = new ArrayList<>();
int success=0;
int failed = 0;
for (int i = 0; i < list1.size(); i++) {
DeliveredInfoEntity deliveredInfoEntity = new DeliveredInfoEntity();
List list2 = (List) list1.get(i);
//跳过空行和第一行
if (list2 == null || i == 0) {
if (list2 == null || i == 0 ||list2.size()<2) {
continue;
}
deliveredInfoEntity.setWaybillNumber((String) list2.get(0));
deliveredInfoEntity.setFileId(deliveredImportDicEntity.getId());
deliveredInfoEntity.setFileId(deliveredImportDicEntity.getId());
if ("妥投".equals(list2.get(2).toString())){
if ("妥投".equals(list2.get(2)+"")){
deliveredInfoEntity.setDealState((long)1);
success++;
}else {
failed++;
deliveredInfoEntity.setDealState((long)0);
}
entityList.add(deliveredInfoEntity);
}
map.put("success",success);
map.put("failed",failed);
deliveredService.saveDeliveredInfoList(entityList);
} catch (Exception e) {
e.printStackTrace();
logger.error("上传人姓名:" + importName + "文件名:" + filename);
logger.error("Exception 上传文件时发生错误,非法XML文件:", e);
yxresp.outPutError("Exception", "上传文件时发生错误,非法XML文件:" + filename);
continue;
} finally {
......@@ -136,6 +150,8 @@ public class DeliveredApi {
} catch (Exception e) {
e.printStackTrace();
logger.error("上传人姓名:" + importName + "文件名:" + filename);
logger.error("FileUploadException 文件上载发生异常", e);
yxresp.outPutError("FileUploadException", "文件上载发生异常:" + e.getMessage());
} finally {
return true;
......@@ -144,7 +160,8 @@ public class DeliveredApi {
}
}
}catch (Exception e){
logger.error("上传人姓名:" + importName + "文件名:" + filename);
logger.error("Exception 导入妥投信息表异常", e);
}finally {
}
......@@ -157,8 +174,12 @@ public class DeliveredApi {
@RequestMapping("saveDeliveredFailedInfo")
// @RequiresPermissions("userInfo.add")//权限管理;
@Transactional(rollbackFor = Exception.class)
public boolean saveDeliveredFailedInfo(@RequestBody String jsonStr){
JSONArray jsonarray = JSONArray.fromObject(jsonStr);
public boolean saveDeliveredFailedInfo(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonarray = new JSONArray();
try {
jsonarray = JSONArray.fromObject(jsonStr);
List<DeliveredFailedInfoEntity> deliveredFailedInfoEntities = new ArrayList<>();
for (int i = 0; i < jsonarray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonarray.get(i);
......@@ -176,6 +197,10 @@ public class DeliveredApi {
deliveredFailedInfoEntities.add(deliveredFailedInfoEntity);
}
deliveredService.saveDeliveredFailedInfoList(deliveredFailedInfoEntities);
}catch (Exception e){
logger.error("异常参数:" + jsonarray);
logger.error("Exception 登记投递失败信息异常", e);
}
return true;
}
......@@ -188,8 +213,16 @@ public class DeliveredApi {
@RequestMapping("queryDeliveredReport")
// @RequiresPermissions("userInfo.add")//权限管理;
@Transactional(rollbackFor = Exception.class)
public List<Map<String,Object>> queryDeliveredReport(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate){
List<Map<String, Object>> report = deliveredService.selectDeliveredReport(replaceDate(startDate), replaceDate(endDate));
public List<Map<String,Object>> queryDeliveredReport(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> report = new ArrayList <>();
try {
report=deliveredService.selectDeliveredReport(replaceDate(startDate), replaceDate(endDate));
}catch (Exception e){
logger.error("运单寄出开始时间:" + startDate + "运单寄出结束时间:" + endDate);
logger.error("Exception 登记投递失败信息异常", e);
}
return report;
}
......@@ -202,8 +235,16 @@ public class DeliveredApi {
@RequestMapping("queryDeliveredByImportDate")
// @RequiresPermissions("userInfo.add")//权限管理;
@Transactional(rollbackFor = Exception.class)
public List<DeliveredImportDicEntity> queryDeliveredByImportDate(@RequestParam("date") String date){
List<DeliveredImportDicEntity> deliveredImportDicEntities = deliveredService.selectDeliveredByImportDate(replaceDate(date));
public List<DeliveredImportDicEntity> queryDeliveredByImportDate(@RequestParam("date") String date, HttpServletRequest requ){
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<DeliveredImportDicEntity> deliveredImportDicEntities = new ArrayList <DeliveredImportDicEntity>();
try {
deliveredImportDicEntities = deliveredService.selectDeliveredByImportDate(replaceDate(date));
}catch (Exception e){
logger.error("导入妥投信息时间:" + date );
logger.error("Exception 查询导入妥投信息异常", e);
}
return deliveredImportDicEntities;
}
......@@ -215,8 +256,16 @@ public class DeliveredApi {
@RequestMapping("queryDeliveredFailedByRegisterDate")
// @RequiresPermissions("userInfo.add")//权限管理;
@Transactional(rollbackFor = Exception.class)
public List<Map<String, Object>> queryDeliveredFailedByRegisterDate(@RequestParam("date") String date){
List<Map<String, Object>> mapList = deliveredService.selectDeliveredFailedByRegisterDate(replaceDate(date));
public List<Map<String, Object>> queryDeliveredFailedByRegisterDate(@RequestParam("date") String date, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> mapList = new ArrayList <>();
try {
mapList = deliveredService.selectDeliveredFailedByRegisterDate(replaceDate(date));
}catch (Exception e){
logger.error("登记妥投失败信息时间:" + date );
logger.error("Exception 查询登记妥投失败信息异常", e);
}
return mapList;
}
......@@ -228,8 +277,12 @@ public class DeliveredApi {
@RequestMapping("acceptDeliveredFailed")
// @RequiresPermissions("userInfo.add")//权限管理;
@Transactional(rollbackFor = Exception.class)
public boolean acceptDeliveredFailed(@RequestBody String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
public boolean acceptDeliveredFailed(@RequestBody String json, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
try {
jsonObject = JSONObject.fromObject(json);
JSONArray jsonArray = (JSONArray) jsonObject.get("cardIdList");
String name = jsonObject.getString("name")+"";
List<String> list = (List<String>) jsonArray;
......@@ -252,6 +305,10 @@ public class DeliveredApi {
detailReceiptListService.updateDetailReceiptList(detailReceiptListEntity,id);
}
}
}catch (Exception e){
logger.error("妥投失败证件号:" + jsonObject);
logger.error("Exception 库房确认接收妥投失败证件异常", e);
}
return true;
}
......@@ -265,8 +322,15 @@ public class DeliveredApi {
@RequestMapping("deleteDeliveredByFileId")
// @RequiresPermissions("userInfo.add")//权限管理;
@Transactional(rollbackFor = Exception.class)
public boolean deleteDeliveredByFileId(@RequestParam("fileId") String fileId){
public boolean deleteDeliveredByFileId(@RequestParam("fileId") String fileId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
deliveredService.deleteDeliveredByFileId(Long.valueOf(fileId));
}catch (Exception e){
logger.error("妥投信息文件ID:" + fileId);
logger.error("Exception 删除导入妥投信息异常", e);
}
return true;
}
......@@ -278,8 +342,17 @@ public class DeliveredApi {
@RequestMapping("deleteDeliveredFailedById")
// @RequiresPermissions("userInfo.add")//权限管理;
@Transactional(rollbackFor = Exception.class)
public boolean deleteDeliveredFailedById(@RequestParam("id") String id){
return deliveredService.deleteDeliveredFailedById(Long.valueOf(id));
public boolean deleteDeliveredFailedById(@RequestParam("id") String id, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean delivered = true;
try {
delivered = deliveredService.deleteDeliveredFailedById(Long.valueOf(id));
}catch (Exception e){
logger.error("登记妥投失败信息ID:" + id);
logger.error("Exception 删除登记妥投失败信息异常", e);
}
return delivered;
}
/**
......@@ -288,8 +361,16 @@ public class DeliveredApi {
*/
@RequestMapping("queryDeliveredFailedType")
// @RequiresPermissions("userInfo.add")//权限管理;
public List<DeliveredFailedReasonEntity> queryDeliveredFailedType(){
return deliveredService.selectDeliveredFailedType();
public List<DeliveredFailedReasonEntity> queryDeliveredFailedType(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<DeliveredFailedReasonEntity> list = new ArrayList <DeliveredFailedReasonEntity>();
try{
list = deliveredService.selectDeliveredFailedType();
}catch (Exception e){
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";
......
......@@ -8,6 +8,8 @@ import com.yxproject.start.service.FailedCardService;
import com.yxproject.start.service.TaskListService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
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.RequestBody;
......@@ -33,14 +35,23 @@ public class FailedCardApi {
@Autowired
private TaskListService taskListService;
Logger logger= Logger.getLogger(FailedCardApi.class);
/**
* 查询所有废证类型
*
* @return
*/
@RequestMapping("selectFailedCardDic")
public List<FailedCardReasonDicEntity> selectFailedCardDic() {
List<FailedCardReasonDicEntity> resultList = failedCardService.selectFailedCardDic();
public List<FailedCardReasonDicEntity> selectFailedCardDic(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<FailedCardReasonDicEntity> resultList = new ArrayList <FailedCardReasonDicEntity>();
try {
resultList = failedCardService.selectFailedCardDic();
}catch (Exception e){
logger.error("Exception 查询所有废证类型异常", e);
}
return resultList;
}
......@@ -51,9 +62,13 @@ public class FailedCardApi {
* @return
*/
@RequestMapping("selectInfoByCardId")
public List<Map<String, Object>> selectInfoByCardId(@RequestBody String jsonStr ) {
JSONArray jsonarray = JSONArray.fromObject(jsonStr);
public List<Map<String, Object>> selectInfoByCardId(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonarray = new JSONArray();
List<Map<String, Object>> resultList = new ArrayList<>();
try {
jsonarray = JSONArray.fromObject(jsonStr);
for (Object o : jsonarray) {
String acceptNo = o.toString().replace("e", "E").replace("g", "G").replace("l","L");
Map<String, Object> resultMap = failedCardService.selectInfoByCardId(acceptNo);
......@@ -65,6 +80,10 @@ public class FailedCardApi {
}
resultList.add(resultMap);
}
}catch (Exception e){
logger.error("身份证号或受理号:" + jsonarray);
logger.error("Exception 根据身份证号或受理号查询身份信息及组号异常", e);
}
return resultList;
}
......@@ -75,10 +94,17 @@ public class FailedCardApi {
* @return
*/
@RequestMapping("queryFailedCardInfo")
public List<Map<String,Object>> queryFailedCardInfo(@RequestParam("date") String date,@RequestParam("name") String name) {
List<Map<String,Object>> failedCardEntities = failedCardService.selectFailedCardInfo(replaceDate(date), name);
public List<Map<String, Object>> queryFailedCardInfo(@RequestParam("date") String date, @RequestParam("name") String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> failedCardEntities = new ArrayList <>();
try{
failedCardEntities = failedCardService.selectFailedCardInfo(replaceDate(date), name);
}catch (Exception e){
logger.error("提交日期:" + date + "提交人姓名:" + name);
logger.error("Exception 查询提交人上传的废证详情异常", e);
}
return failedCardEntities;
}
/**
......@@ -87,8 +113,17 @@ public class FailedCardApi {
* @return
*/
@RequestMapping("deleteFailedCardInfo")
public boolean deleteFailedCardInfo(@RequestParam("failedCardId") String failedCardId) {
return failedCardService.deleteFailedCardInfo(failedCardId);
public boolean deleteFailedCardInfo(@RequestParam("failedCardId") String failedCardId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean failedCardInfo = true;
try {
failedCardInfo = failedCardService.deleteFailedCardInfo(failedCardId);
}catch (Exception e){
logger.error("废证ID:" + failedCardId);
logger.error("Exception 删除提交人上传的废证详情异常", e);
}
return failedCardInfo;
}
......@@ -100,22 +135,30 @@ public class FailedCardApi {
*/
@RequestMapping("insertFailedCard")
@Transactional(rollbackFor = Exception.class)
public Boolean insertFailedCard(@RequestBody String jsonStr) {
JSONArray jsonarray = JSONArray.fromObject(jsonStr);
public Boolean insertFailedCard(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonarray = new JSONArray();
try{
jsonarray = JSONArray.fromObject(jsonStr);
for (Object o : jsonarray) {
JSONObject jsonObject = (JSONObject) o;
String name = ((JSONObject) o).getString("name");
String acceptNo = formateAcceptNo(((JSONObject) o).getString("cardId"));
String result = failedCardService.selectSpecialCard(acceptNo);
String result = failedCardService.selectSpecialCard(((JSONObject) o).getString("cardId"));
Map<String, Object> idMap;
//判断是否是特殊证件
if (result != null && result != "") {
idMap = failedCardService.selectDataById(acceptNo);
idMap = failedCardService.selectDataById(jsonObject.getString("cardId"));
} else {
idMap = failedCardService.selectCountIdByCardId(acceptNo);
idMap = failedCardService.selectCountIdByCardId(jsonObject.getString("cardId"));
}
int initiator = 5;
failedCardService.insertFailedCard(jsonObject.getString("failedCardReasonId"), idMap.get("ACCEPT_NO").toString(), idMap.get("TASK_ID").toString(), String.valueOf(initiator), jsonObject.getString("note"), idMap.get("WORK_GROUP").toString(),name);
failedCardService.insertFailedCard(jsonObject.getString("failedCardReasonId"), idMap.get("ACCEPT_NO").toString(), idMap.get("TASK_ID").toString(), String.valueOf(initiator), jsonObject.getString("note"), idMap.get("WORK_GROUP").toString(), name);
}
}catch (Exception e){
logger.error("身份证号或受理号:" + jsonarray);
logger.error("Exception 添加废证异常", e);
}
return true;
}
......@@ -128,15 +171,22 @@ public class FailedCardApi {
*/
@RequestMapping("insertRemaining")
@Transactional(rollbackFor = Exception.class)
public Boolean insertRemaining(@RequestBody String jsonStr) {
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
JSONArray jsonarray = JSONArray.fromObject(jsonObject.get("list"));
String name = jsonObject.get("name").toString();
TaskEntity taskEntity = new TaskEntity();
public Boolean insertRemaining(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
JSONArray jsonarray = new JSONArray();
String name;
TaskEntity taskEntity;
try {
jsonObject = JSONObject.fromObject(jsonStr);
jsonarray = JSONArray.fromObject(jsonObject.get("list"));
name = jsonObject.get("name").toString();
taskEntity = new TaskEntity();
for (int i = 0; i < jsonarray.size(); i++) {
/*查询生成任务单需要的数据*/
Map<String, Object> resultMap = failedCardService.selectTaskListDate((jsonarray.get(i)+"").replace("e","E").replace("g","G"));
Map<String, Object> resultMap = failedCardService.selectTaskListDate((String) jsonarray.get(i));
String countyCode = resultMap.get("COUNTY_CODE").toString();
Long cardType = Long.valueOf((BigDecimal) resultMap.get("CARD_TYPE") + "");
String acceptNo = (String) resultMap.get("ACCEPT_NO");
......@@ -161,6 +211,10 @@ public class FailedCardApi {
specialCardEntity.setGroupNo(acceptNo.substring(0, 8));
failedCardService.addSpecialCard(specialCardEntity);
}
}catch (Exception e){
logger.error("身份证号或受理号:" + jsonObject);
logger.error("Exception 生成余证异常", e);
}
return true;
}
......@@ -170,8 +224,15 @@ public class FailedCardApi {
* @return List
*/
@RequestMapping("selectCardType")
public List<String> selectCardType() {
List<String> result = failedCardService.selectCardType();
public List<String> selectCardType(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<String> result = new ArrayList <>();
try {
result = failedCardService.selectCardType();
}catch (Exception e){
logger.error("Exception 查询所有证件类型异常", e);
}
return result;
}
......@@ -183,10 +244,14 @@ public class FailedCardApi {
*/
@RequestMapping("insertBackCard")
@Transactional(rollbackFor = Exception.class)
public boolean insertBackCard(@RequestBody String jsonStr) {
public Boolean insertBackCard(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
TaskEntity taskEntity;
JSONArray jsonarray = new JSONArray();
try {
JSONArray jsonarray = JSONArray.fromObject(jsonStr);
TaskEntity taskEntity = new TaskEntity();
jsonarray = JSONArray.fromObject(jsonStr);
taskEntity = new TaskEntity();
String str2 = null;
for (int i = 0; i < jsonarray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonarray.get(i);
......@@ -216,6 +281,8 @@ public class FailedCardApi {
failedCardService.insertGroupNo(String.valueOf(groupDataMap.get("GROUP_NO")), String.valueOf(groupDataMap.get("TASK_ID")), (Long) groupDataMap.get("VALID_COUNT"), (Long) groupDataMap.get("INVALID_COUNT"));
}
} catch (NullPointerException e) {
logger.error("身份证号或受理号:" + jsonarray);
logger.error("生成历史回迁证异常", e);
return false;
}
return true;
......
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){
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,8 +59,16 @@ 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));
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));
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;
}
......
......@@ -2,12 +2,15 @@ package com.yxproject.start.api;
import com.yxproject.start.entity.CountyDicEntity;
import com.yxproject.start.service.LogService;
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.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -20,6 +23,9 @@ import java.util.Map;
public class LogApi {
@Autowired
private LogService logService;
Logger logger= Logger.getLogger(LogApi.class);
/**
* 查询新包生成日志
* @param newFileName 新文件名
......@@ -31,8 +37,16 @@ public class LogApi {
* @return
*/
@RequestMapping("selectNewFilesLog")
public List<Map<String,Object>> selectNewFilesLog (@RequestParam("newFileName")String newFileName, @RequestParam("cardId")String cardId, @RequestParam("createDate")String createDate, @RequestParam("uploadCountyCode")String uploadCountyCode, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
List<Map<String,Object>> result = logService.selectNewFilesLog(newFileName,cardId,replaceDate(createDate),uploadCountyCode, Long.valueOf(currPage),Long.valueOf(pageSize));
public List<Map<String,Object>> selectNewFilesLog (@RequestParam("newFileName")String newFileName, @RequestParam("cardId")String cardId, @RequestParam("createDate")String createDate, @RequestParam("uploadCountyCode")String uploadCountyCode, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String,Object>> result = new ArrayList <>();
try {
result = logService.selectNewFilesLog(newFileName,cardId,replaceDate(createDate),uploadCountyCode, Long.valueOf(currPage),Long.valueOf(pageSize));
}catch (Exception e){
logger.error("新文件名:" + newFileName + "公民身份号码:" + cardId + "核验时间:" + createDate + "上传地市名称:" + uploadCountyCode + "页数:" + currPage + "行数:" + pageSize);
logger.error("Exception 查询新包生成日志异常", e);
}
return result;
}
......@@ -46,8 +60,16 @@ public class LogApi {
*
*/
@RequestMapping("selectNewFileLogCount")
public int selectNewFileLogCount(@RequestParam("newFileName")String newFileName, @RequestParam("cardId")String cardId,@RequestParam("createDate")String createDate,@RequestParam("uploadCountyCode")String uploadCountyCode){
int total = logService.selectNewFileLogCount(newFileName,cardId,replaceDate(createDate),uploadCountyCode);
public int selectNewFileLogCount(@RequestParam("newFileName")String newFileName, @RequestParam("cardId")String cardId,@RequestParam("createDate")String createDate,@RequestParam("uploadCountyCode")String uploadCountyCode, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
int total = 0;
try {
total = logService.selectNewFileLogCount(newFileName,cardId,replaceDate(createDate),uploadCountyCode);
}catch (Exception e){
logger.error("新文件名:" + newFileName + "公民身份号码:" + cardId + "核验时间:" + createDate + "上传地市名称:" + uploadCountyCode);
logger.error("Exception 查询新包生成日志总数异常", e);
}
return total;
}
......@@ -56,8 +78,15 @@ public class LogApi {
* @return list
*/
@RequestMapping("selectCountyList")
public List<CountyDicEntity> selectCountyList(){
List<CountyDicEntity> list = logService.getCountyList();
public List<CountyDicEntity> selectCountyList(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<CountyDicEntity> list = new ArrayList <>();
try {
list = logService.getCountyList();
}catch (Exception e){
logger.error("Exception 查询公安局列表异常", e);
}
return list;
}
......@@ -69,8 +98,16 @@ public class LogApi {
* @return resultList
*/
@RequestMapping("selectByAnalysisLog")
public List<Map<String,Object>> selectByAnalysisLog(@RequestParam("fileName")String fileName,@RequestParam("analysisTime")String analysisTime, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
List<Map<String,Object>> resultList = logService.selectAnalysisLog(fileName,replaceDate(analysisTime),Long.valueOf(currPage),Long.valueOf(pageSize));
public List<Map<String,Object>> selectByAnalysisLog(@RequestParam("fileName")String fileName,@RequestParam("analysisTime")String analysisTime, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String,Object>> resultList = new ArrayList <>();
try {
resultList = logService.selectAnalysisLog(fileName,replaceDate(analysisTime),Long.valueOf(currPage),Long.valueOf(pageSize));
}catch (Exception e){
logger.error("文件名:" + fileName + "解析时间:" + analysisTime + "页数:" + currPage + "行数:" + pageSize);
logger.error("Exception 查询解析日志异常", e);
}
return resultList;
}
......@@ -82,8 +119,16 @@ public class LogApi {
* @return total
*/
@RequestMapping("selectAnalysisLogCount")
public int selectAnalysisLogCount (@RequestParam("fileName")String fileName,@RequestParam("analysisTime")String analysisTime){
int total = logService.selectAnalysisLogCount(fileName,replaceDate(analysisTime));
public int selectAnalysisLogCount (@RequestParam("fileName")String fileName,@RequestParam("analysisTime")String analysisTime, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
int total = 0;
try {
total = logService.selectAnalysisLogCount(fileName,replaceDate(analysisTime));
}catch (Exception e){
logger.error("文件名:" + fileName + "解析时间:" + analysisTime);
logger.error("Exception 查询解析日志总数异常", e);
}
return total;
}
......@@ -93,11 +138,20 @@ public class LogApi {
* @return resultList
*/
@RequestMapping("selectAnalysisData")
public List<Map<String,Object>> selectAnalysisData(@RequestParam("uploadDate")String uploadDate){
List<Map<String,Object>> resultList = logService.selectAnalysisData(replaceDate(uploadDate));
public List<Map<String,Object>> selectAnalysisData(@RequestParam("uploadDate")String uploadDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String,Object>> resultList = new ArrayList <>();
try {
resultList = logService.selectAnalysisData(replaceDate(uploadDate));
}catch (Exception e){
logger.error("导入时间:" + uploadDate);
logger.error("Exception 根据导入时间查询解析数据异常", e);
}
return resultList;
}
/**
* 解析
* @param printDate
......@@ -106,33 +160,40 @@ public class LogApi {
*/
@RequestMapping("analysis")
@Transactional(rollbackFor = Exception.class)
public boolean analysis(@RequestParam("printDate")String printDate,@RequestParam("fileId")String fileId){
logService.changeCardType(printDate,fileId);
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddhhmmss");
logService.insertAnalysisDate(df.format(new Date()),fileId);
public boolean analysis(@RequestParam("printDate")String printDate,@RequestParam("fileId")String fileId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
logService.changeCardType(printDate, fileId);
SimpleDateFormat df=new SimpleDateFormat("yyyyMMddhhmmss");
logService.insertAnalysisDate(df.format(new Date()), fileId);
//查询XML文件信息
List<Map<String,Object>> resultList = logService.selectFileIdByUploadDate(printDate);
List <Map <String, Object>> resultList=logService.selectFileIdByUploadDate(printDate);
//查询Excel文件信息
Map<String, Object> resultMap = logService.selectFileNameDic(fileId);
Map <String, Object> resultMap=logService.selectFileNameDic(fileId);
//更改解析状态
logService.changeFileState(fileId);
//查询身份数据
List<Map<String, Object>> dataList = logService.selectIdData(fileId);
List <Map <String, Object>> dataList=logService.selectIdData(fileId);
//将身份数据插入到邮寄表中
for (int i=0;i<dataList.size();i++){
logService.insertIdData((String) dataList.get(i).get("GMSFHM"),(String) dataList.get(i).get("SSXQDM"),(String) dataList.get(i).get("YXQQSRQ"),(String) dataList.get(i).get("YXQJZRQ"), (String) dataList.get(i).get("JMSFZSLH"));
for (int i=0; i < dataList.size(); i++) {
logService.insertIdData((String) dataList.get(i).get("GMSFHM"), (String) dataList.get(i).get("SSXQDM"), (String) dataList.get(i).get("YXQQSRQ"), (String) dataList.get(i).get("YXQJZRQ"), (String) dataList.get(i).get("JMSFZSLH"));
}
List<Map<String,Object>> result = new ArrayList<>();
for (int i=0; i<resultList.size();i++){
String fileName=(BigDecimal)(resultList.get(i).get("ID"))+"";
List <Map <String, Object>> result=new ArrayList <>();
for (int i=0; i < resultList.size(); i++) {
String fileName=(BigDecimal) (resultList.get(i).get("ID")) + "";
//查询证件类型计数
Map<String,Object>countMap= logService.selectCountByCardType( (BigDecimal)(resultList.get(i).get("ID"))+"");
resultMap.put("fileName",fileName);
resultMap.put("commonCount",countMap.get("PUSUM"));
resultMap.put("postCount",countMap.get("YOUSUM"));
Map <String, Object> countMap=logService.selectCountByCardType((BigDecimal) (resultList.get(i).get("ID")) + "");
resultMap.put("fileName", fileName);
resultMap.put("commonCount", countMap.get("PUSUM"));
resultMap.put("postCount", countMap.get("YOUSUM"));
result.add(resultMap);
//生成解析表
logService.insertIntoAnalysis(fileId,fileName,String.valueOf(countMap.get("PUSUM")),String.valueOf(countMap.get("YOUSUM")));
logService.insertIntoAnalysis(fileId, fileName, String.valueOf(countMap.get("PUSUM")), String.valueOf(countMap.get("YOUSUM")));
}
}catch (Exception e){
logger.error("导入时间:" + printDate + "文件名:" + fileId);
logger.error("Exception 解析异常", e);
}
return true;
}
......@@ -145,14 +206,22 @@ public class LogApi {
*/
@RequestMapping("deleteFiles")
@Transactional(rollbackFor = Exception.class)
public boolean deleteFiles(@RequestParam("uploadTime")String uploadTime){
List<String> idList =logService.selectId(uploadTime);
public boolean deleteFiles(@RequestParam("uploadTime")String uploadTime, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<String> idList =new ArrayList <String>();
try {
idList = logService.selectId(uploadTime);
for (int i=0;i<idList.size();i++){
logService.deleteFilesData(idList.get(i));
}
for (int i=0;i<idList.size();i++){
logService.deleteFile(idList.get(i));
}
}catch (Exception e){
logger.error("导入时间:" + uploadTime);
logger.error("Exception 解析异常", e);
}
return true;
}
......
......@@ -4,11 +4,15 @@ import com.yxproject.start.entity.CardBodyEntity;
import com.yxproject.start.entity.PlasticFilmEntity;
import com.yxproject.start.service.MaterialManagementService;
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.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;
import java.util.Map;
......@@ -19,6 +23,8 @@ public class MaterialManagementApi {
@Autowired
private MaterialManagementService materialManagementService;
Logger logger= Logger.getLogger(MaterialManagementApi.class);
/**
* 插入膜耗材数据
* @param totalCount
......@@ -27,8 +33,16 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("insertFilm")
public boolean insertFilm(@Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note, @Param("name")String name,@Param("state")String state){
boolean result = materialManagementService.insertFilm(totalCount, plasticFilmType, note,name,Long.valueOf(state));
public boolean insertFilm(@Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note, @Param("name")String name,@Param("state")String state, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean result = true;
try {
result = materialManagementService.insertFilm(totalCount, plasticFilmType, note,name,Long.valueOf(state));
}catch (Exception e){
logger.error("数量:" + totalCount + "膜类型(1出库2入库):" + plasticFilmType + "备注:" + note + "提交人姓名:" + name + "是否审核1审核0未审核:" + state);
logger.error("Exception 插入膜耗材数据异常", e);
}
return result;
}
......@@ -40,8 +54,16 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("insertCardBody")
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note, @Param("name")String name, @Param("cardBodyType")String cardBodyType,@Param("state")String state){
boolean result = materialManagementService.insertCardBody(cardType, totalCount, note,name,cardBodyType,Long.valueOf(state));
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note, @Param("name")String name, @Param("cardBodyType")String cardBodyType,@Param("state")String state, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean result = true;
try {
result = materialManagementService.insertCardBody(cardType, totalCount, note,name,cardBodyType,Long.valueOf(state));
}catch (Exception e){
logger.error("数量:" + totalCount + "卡基类型(1出库2入库):" + cardType + "备注:" + note + "提交人姓名:" + name + "是否审核1审核0未审核:" + state);
logger.error("Exception 插入卡体耗材数据异常", e);
}
return result;
}
......@@ -77,16 +99,22 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("selectCardBodyManagement")
public Map<String,Object> selectCardBodyManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name,@Param("cardBodyType")String cardBodyType){
public Map<String,Object> selectCardBodyManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name,@Param("cardBodyType")String cardBodyType, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String,Object> resultMap = new HashMap<>();
try {
List<CardBodyEntity> cardBodyEntities = materialManagementService.selectCardBody(replaceDate(beginDate),replaceDate(endDate),typeCode,name,cardBodyType);
String cardCount1 = materialManagementService.selectCardCount1(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
String cardCount2 = materialManagementService.selectCardCount2(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
resultMap.put("cardBody",cardBodyEntities);
resultMap.put("cardCount1",cardCount1);
resultMap.put("cardCount2",cardCount2);
}catch (Exception e){
logger.error("起始时间:" + beginDate + "截止时间:" + endDate + "卡基类型(1出库2入库):" + typeCode + "提交人姓名:" + name + "1身份卡2港澳3台湾:" + cardBodyType);
logger.error("Exception 查询卡机统计数据异常", e);
}
return resultMap;
}
......@@ -97,16 +125,22 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("selectPlasticFilmManagement")
public Map<String,Object> selectPlasticFilmManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name){
public Map<String,Object> selectPlasticFilmManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("typeCode")String typeCode,@Param("name")String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String,Object> resultMap = new HashMap<>();
try {
List<PlasticFilmEntity> plasticFilmEntities = materialManagementService.selectFilm(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
String plasticFilmCount1=materialManagementService.selectFilmCount1(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
String plasticFilmCount2=materialManagementService.selectFilmCount2(replaceDate(beginDate),replaceDate(endDate),typeCode,name);
resultMap.put("plasticFilm",plasticFilmEntities);
resultMap.put("plasticFilmCount1",plasticFilmCount1);
resultMap.put("plasticFilmCount2",plasticFilmCount2);
}catch (Exception e){
logger.error( "起始时间:" + beginDate + "截止时间:" + endDate + "膜类型(1出库2入库):" + typeCode + "提交人姓名:" + name);
logger.error("Exception 查询膜统计数据异常", e);
}
return resultMap;
}
/**
......@@ -115,19 +149,36 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("updateCardBody")
public boolean updateCardBody(@Param("id")String id){
return materialManagementService.updateCardBodyState(Long.valueOf(id));
public boolean updateCardBody(@Param("id")String id, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean cardBody = true;
try {
cardBody = materialManagementService.updateCardBodyState(Long.valueOf(id));
}catch (Exception e){
logger.error( "卡基统计信息表ID:" + id);
logger.error("Exception 更新卡体详情状态异常", e);
}
return cardBody;
}
/**
* 查询未审核卡体详情
*/
@RequestMapping("selectCardBody")
public List<CardBodyEntity> selectCardBody(@Param("date")String date,@Param("name")String name){
return materialManagementService.selectCardBody(replaceDate(date),name);
public List<CardBodyEntity> selectCardBody(@Param("date")String date,@Param("name")String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<CardBodyEntity> cardBody = new ArrayList<>();
try {
cardBody=materialManagementService.selectCardBody(replaceDate(date), name);
}catch (Exception e){
logger.error( "审核时间:" + date + "提交人姓名:" + name);
logger.error("Exception 查询未审核卡体详情异常", e);
}
return cardBody;
}
/**
......@@ -136,18 +187,34 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("updatePlasticFilm")
public boolean updatePlasticFilm(@Param("id")String id){
return materialManagementService.updatePlasticFilm(Long.valueOf(id));
public boolean updatePlasticFilm(@Param("id")String id, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean plasticFilm = true;
try {
plasticFilm = materialManagementService.updatePlasticFilm(Long.valueOf(id));
}catch (Exception e){
logger.error( "塑料膜表流水号:" + id );
logger.error("Exception 更新膜详情状态异常", e);
}
return plasticFilm;
}
/**
* 查询未审核膜详情
*/
@RequestMapping("selectPlasticFilm")
public List<PlasticFilmEntity> selectPlasticFilm(@Param("date")String date,@Param("name")String name){
return materialManagementService.selectPlasticFilm(replaceDate(date),name);
public List<PlasticFilmEntity> selectPlasticFilm(@Param("date")String date,@Param("name")String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<PlasticFilmEntity> plasticFilm = new ArrayList <PlasticFilmEntity>();
try {
plasticFilm = materialManagementService.selectPlasticFilm(replaceDate(date), name);
}catch (Exception e){
logger.error( "审核时间:" + date + "提交人姓名:" + name);
logger.error("Exception 查询未审核膜详情异常", e);
}
return plasticFilm;
}
......@@ -161,10 +228,17 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("queryCardBodyReport")
public Map<String,Object> queryCardBodyReport(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("operateType")String operateType, @Param("name")String name, @Param("cardBodyType")String cardBodyType, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
Map<String, Object> map = materialManagementService.selectCardBodyReport(replaceDate(beginDate), replaceDate(endDate), operateType, replaceNullString(name), cardBodyType,(Long.valueOf(currPage)-1)*Long.valueOf(pageSize)+1,Long.valueOf(currPage)*Long.valueOf(pageSize));
public Map<String,Object> queryCardBodyReport(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("operateType")String operateType, @Param("name")String name, @Param("cardBodyType")String cardBodyType, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String, Object> map = null;
try {
map = materialManagementService.selectCardBodyReport(replaceDate(beginDate), replaceDate(endDate), operateType, replaceNullString(name), cardBodyType, (Long.valueOf(currPage) - 1) * Long.valueOf(pageSize) + 1, Long.valueOf(currPage) * Long.valueOf(pageSize));
}catch (Exception e){
logger.error( "起始时间:" + beginDate + "截止时间:" + endDate + "卡基类型(1出库2入库):" + operateType + "提交人姓名:" + name + "1身份卡2港澳3台湾:" + cardBodyType + "页数:" + currPage + "条数:" + pageSize);
logger.error("Exception 查询卡基报表统计数据异常", e);
}
return map;
}
/**
......@@ -177,8 +251,16 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("queryCardBodyReportCount")
public int queryCardBodyReportCount(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("operateType")String operateType, @Param("name")String name, @Param("cardBodyType")String cardBodyType){
int i = materialManagementService.selectCardBodyReportCount(replaceDate(beginDate), replaceDate(endDate), operateType, replaceNullString(name), cardBodyType);
public int queryCardBodyReportCount(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("operateType")String operateType, @Param("name")String name, @Param("cardBodyType")String cardBodyType, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
int i = 0;
try{
i = materialManagementService.selectCardBodyReportCount(replaceDate(beginDate), replaceDate(endDate), operateType, replaceNullString(name), cardBodyType);
}catch (Exception e){
logger.error( "起始时间:" + beginDate + "截止时间:" + endDate + "卡基类型(1出库2入库):" + operateType + "提交人姓名:" + name + "1身份卡2港澳3台湾:" + cardBodyType);
logger.error("Exception 查询卡基报表统计数量异常", e);
}
return i;
}
......@@ -186,10 +268,16 @@ public class MaterialManagementApi {
* 查询卡基操作人
*/
@RequestMapping("queryCardBodyOperation")
public List<Map<String,Object>> queryCardBodyOperation(){
List<Map<String, Object>> maps = materialManagementService.selectCardBodyOperation();
public List<Map<String,Object>> queryCardBodyOperation(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> maps = null;
try {
maps = materialManagementService.selectCardBodyOperation();
}catch (Exception e){
logger.error("Exception 查询卡基操作人异常", e);
}
return maps;
}
/**
......@@ -201,8 +289,16 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("queryPlasticFilmReport")
public Map<String,Object> queryPlasticFilmReport(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("operateType")String operateType,@Param("name")String name, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
Map<String, Object> map = materialManagementService.selectPlasticFilmReport(replaceDate(beginDate), replaceDate(endDate), operateType,replaceNullString(name),(Long.valueOf(currPage)-1)*Long.valueOf(pageSize)+1,Long.valueOf(currPage)*Long.valueOf(pageSize));
public Map<String,Object> queryPlasticFilmReport(@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("operateType")String operateType,@Param("name")String name, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String, Object> map = null;
try {
map = materialManagementService.selectPlasticFilmReport(replaceDate(beginDate), replaceDate(endDate), operateType,replaceNullString(name),(Long.valueOf(currPage)-1)*Long.valueOf(pageSize)+1,Long.valueOf(currPage)*Long.valueOf(pageSize));
}catch (Exception e){
logger.error( "起始时间:" + beginDate + "截止时间:" + endDate + "卡基类型(1出库2入库):" + operateType + "提交人姓名:" + name + "页数:" + currPage + "条数:" + pageSize);
logger.error("Exception 查询膜报表统计数据异常", e);
}
return map;
}
......@@ -215,20 +311,33 @@ public class MaterialManagementApi {
* @return
*/
@RequestMapping("queryPlasticFilmReportCount")
public int queryPlasticFilmReportCount(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("operateType")String operateType, @Param("name")String name){
int i = materialManagementService.selectPlasticFilmReportCount(replaceDate(beginDate), replaceDate(endDate), operateType, replaceNullString(name));
public int queryPlasticFilmReportCount(@Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("operateType")String operateType, @Param("name")String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
int i = 0;
try {
i = materialManagementService.selectPlasticFilmReportCount(replaceDate(beginDate), replaceDate(endDate), operateType, replaceNullString(name));
}catch (Exception e){
logger.error( "起始时间:" + beginDate + "截止时间:" + endDate + "卡基类型(1出库2入库):" + operateType + "提交人姓名:" + name);
logger.error("Exception 查询膜报表统计数量异常", e);
}
return i;
}
/**
* 查询膜操作人
*/
@RequestMapping("queryPlasticFilmOperation")
public List<Map<String,Object>> queryPlasticFilmOperation(){
List<Map<String, Object>> maps = materialManagementService.selectPlasticFilmOperation();
public List<Map<String,Object>> queryPlasticFilmOperation(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> maps = new ArrayList <>();
try {
maps = materialManagementService.selectPlasticFilmOperation();
}catch (Exception e){
logger.error("Exception 查询膜操作人异常", e);
}
return maps;
}
/**
......
......@@ -5,6 +5,8 @@ import com.yxproject.start.entity.PersonPostEntity;
import com.yxproject.start.service.PersonPostService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
......@@ -37,6 +39,9 @@ public class PersonPostApi {
@Autowired
PersonPostService personPostService;
Logger logger= Logger.getLogger(PersonPostApi.class);
/**
* 查询备注信息
* @param jsonStr
......@@ -44,14 +49,22 @@ public class PersonPostApi {
*/
@RequestMapping("selectNote")
@Transactional
public List<Map<String,Object>>selectNote(@RequestBody String jsonStr){
List<Map<String,Object>> resultList = new ArrayList<>();
JSONArray jsonArray = JSONArray.fromObject(jsonStr);
public List<Map<String,Object>>selectNote(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String,Object>> resultList = new ArrayList <>();
JSONArray jsonArray = new JSONArray();
try {
resultList = new ArrayList<>();
jsonArray = JSONArray.fromObject(jsonStr);
for (int i=0;i<jsonArray.size();i++){
Map<String,Object> resultMap=personPostService.selectNote((int)(jsonArray.get(i)));
resultList.add(resultMap);
}
}catch (Exception e){
logger.error("备注信息:" + jsonArray );
logger.error("Exception 查询备注信息异常", e);
}
return resultList;
}
......@@ -62,12 +75,20 @@ public class PersonPostApi {
*/
@RequestMapping("addNote")
@Transactional
public boolean addNote(@RequestBody String jsonStr){
JSONArray jsonArray = JSONArray.fromObject(jsonStr);
public boolean addNote(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonArray = new JSONArray();
try {
jsonArray = JSONArray.fromObject(jsonStr);
for (int i=0;i<jsonArray.size();i++){
Map<String,Object> noteMap = (Map<String, Object>) jsonArray.get(i);
personPostService.addNote(noteMap.get("id").toString(),noteMap.get("note").toString());
}
}catch (Exception e){
logger.error("备注信息:" + jsonArray );
logger.error("Exception 更改备注信息异常", e);
}
return true;
}
......@@ -79,8 +100,13 @@ public class PersonPostApi {
*/
@RequestMapping("findPersonalDataCount")
@Transactional
public int findPersonalDataCount(@RequestBody String jsonStr){
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
public int findPersonalDataCount(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
int count = 0;
try {
jsonObject = JSONObject.fromObject(jsonStr);
String applicantName = jsonObject.getString("applicantName");
String orderNumber = jsonObject.getString("orderNumber");
String state = jsonObject.getString("state");
......@@ -89,7 +115,11 @@ public class PersonPostApi {
String uploadDate = replaceDate(jsonObject.getString("uploadDate"));
String emailNo = jsonObject.getString("emailNo");
String notNull = jsonObject.getString("notNull");
int count = personPostService.findPersonalDataCount(applicantName,orderNumber,state,latticeMouthInformation,jsonArray,uploadDate,emailNo,notNull);
count = personPostService.findPersonalDataCount(applicantName,orderNumber,state,latticeMouthInformation,jsonArray,uploadDate,emailNo,notNull);
}catch (Exception e){
logger.error("个人邮寄信息:" + jsonObject );
logger.error("Exception 按条件查询个人邮寄信息异常", e);
}
return count;
}
......@@ -100,8 +130,13 @@ public class PersonPostApi {
*/
@RequestMapping("findPersonalData")
@Transactional
public List<PersonPostEntity> findPersonalData(@RequestBody String jsonStr){
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
public List<PersonPostEntity> findPersonalData(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
List<PersonPostEntity> list = new ArrayList <>();
try {
jsonObject = JSONObject.fromObject(jsonStr);
String applicantName = jsonObject.getString("applicantName");
String orderNumber = jsonObject.getString("orderNumber");
String state = jsonObject.getString("state");
......@@ -112,7 +147,11 @@ public class PersonPostApi {
String pageSize = jsonObject.getString("pageSize");
String emailNo = jsonObject.getString("emailNo");
int notNull = Integer.parseInt((jsonObject.getString("notNull")));
List<PersonPostEntity> list = personPostService.findPersonalData(applicantName,orderNumber,state,latticeMouthInformation,jsonArray,uploadDate,firstIndex,pageSize,emailNo,notNull);
list = personPostService.findPersonalData(applicantName,orderNumber,state,latticeMouthInformation,jsonArray,uploadDate,firstIndex,pageSize,emailNo,notNull);
}catch (Exception e){
logger.error("个人邮寄信息:" + jsonObject );
logger.error("Exception 按条件查询个人邮寄信息异常", e);
}
return list;
}
......@@ -122,8 +161,12 @@ public class PersonPostApi {
* @return
*/
@RequestMapping("deletePersonalData")
public boolean deletePersonalData(@RequestBody String jsonStr){
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
public boolean deletePersonalData(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
try {
jsonObject = JSONObject.fromObject(jsonStr);
String applicantName = jsonObject.getString("applicantName");
String orderNumber = jsonObject.getString("orderNumber");
String state = jsonObject.getString("state");
......@@ -131,6 +174,10 @@ public class PersonPostApi {
JSONArray jsonArray =(JSONArray)jsonObject.get("getToCounty");
String uploadDate = jsonObject.getString("uploadDate");
personPostService.deletePersonalData(applicantName,orderNumber,state,latticeMouthInformation,jsonArray,uploadDate);
}catch (Exception e){
logger.error("个人邮寄信息:" + jsonObject );
logger.error("Exception 按条件删除个人邮寄信息异常", e);
}
return true;
}
......@@ -140,39 +187,70 @@ public class PersonPostApi {
* @return
*/
@RequestMapping("recordsHaveNotPrinted")
public boolean deletePersonalDataByImportDate(@RequestParam("importDate")String importDate){
public boolean deletePersonalDataByImportDate(@RequestParam("importDate")String importDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
personPostService.deletePersonalDataByImportDate(replaceDate(importDate));
}catch (Exception e){
logger.error("导入日期:" + importDate );
logger.error("Exception 根据导入日期删除未打印的邮政信息异常", e);
}
return true;
}
/**
* 根据导入日期删除未打印的邮政信息数量
* @param importDate
* @return
*/
@RequestMapping("findPersonalDataCountByImportDate")
public int findPersonalDataCountByImportDate(@RequestParam("importDate")String importDate){
int count = personPostService.findPersonalDataCountByImportDate(replaceDate(importDate));
public int findPersonalDataCountByImportDate(@RequestParam("importDate")String importDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
int count = 0;
try {
count = personPostService.findPersonalDataCountByImportDate(replaceDate(importDate));
}catch (Exception e){
logger.error("导入日期:" + importDate );
logger.error("Exception 根据导入日期删除未打印的邮政信息数量异常", e);
}
return count;
}
@RequestMapping("download")
public void exportExcel(HttpServletRequest request,HttpServletResponse response,
@RequestParam("uploadDate") String uploadDate, @RequestParam("hasPrinted") String hasPrinted,
@RequestParam("djx") List<String> djx, @RequestParam("gkxx") String gkxx, @RequestParam("ddh") String ddh,
@RequestParam("sequence")String sequence, @RequestParam("sqrxm") String sqrxm,@RequestParam("emailNo") String emailNo) throws Exception {
JSONArray jsonArray = JSONArray.fromObject(djx);
String remoteAddr = request.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonArray = new JSONArray();
try {
jsonArray = JSONArray.fromObject(djx);
List<PersonPostEntity> list = personPostService.downLoadReportForm(request,response,sqrxm,ddh,hasPrinted,gkxx,jsonArray,replaceDate(uploadDate),emailNo);
exportExcel(request, response, list);
}catch (Exception e){
logger.error("上传时间:" + uploadDate +"类型普证-0,邮寄-9:" + hasPrinted +"格口信息:" + gkxx +"订单号:" + ddh +"申请人姓名:" + sqrxm +"运单号码:" + emailNo);
logger.error("Exception 下载Excel异常", e);
}
}
/**
*刷身份证查询邮寄单信息详情
*/
@RequestMapping("getPostInfo")
public List<PersonPostEntity> findPersonalData(@RequestBody ReadCardDto readCardDto){
List<PersonPostEntity> list = personPostService.getPostInfo(readCardDto);
public List<PersonPostEntity> findPersonalData(@RequestBody ReadCardDto readCardDto, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<PersonPostEntity> list = new ArrayList <PersonPostEntity>();
try {
list = personPostService.getPostInfo(readCardDto);
}catch (Exception e){
logger.error("身份证号:" + readCardDto.getIdCard() + "起始时间" + readCardDto.getStartDate() + "截止时间" + readCardDto.getEndDate());
logger.error("Exception 刷身份证查询邮寄单信息详情异常", e);
}
return list;
}
......@@ -183,13 +261,17 @@ public class PersonPostApi {
* @return
*/
@RequestMapping("updatePrintDate")
public boolean updatePrintDate(@RequestParam("id") int id, @RequestParam("printTime") String printTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
boolean flag=false;
public boolean updatePrintDate(@RequestParam("id") int id, @RequestParam("printTime") String printTime, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean flag = false;
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
flag = personPostService.printPostList(id, sdf.parse(printTime));
} catch (ParseException e) {
e.printStackTrace();
logger.error("打印机ID" + id + "打印时间" + printTime);
logger.error("更改打印状态异常", e);
}
return flag;
}
......@@ -210,94 +292,97 @@ public class PersonPostApi {
*
*/
private void exportExcel(HttpServletRequest request, HttpServletResponse response, List<PersonPostEntity> records) throws Exception {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("模板明细");
HSSFCellStyle style = wb.createCellStyle();
String remoteAddr = request.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
HSSFWorkbook wb=new HSSFWorkbook();
HSSFSheet sheet=wb.createSheet("模板明细");
HSSFCellStyle style=wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
HSSFRow firstRow = sheet.createRow(0);
String []rowTitle = {"订单号", "寄件人姓名", "寄件人电话2", "寄件人详细地址", "收件人姓名", "收件人电话2",
"收件人邮编", "邮件号", "内件性质", "重量", "长", "宽", "高", "收件人城市","收件人区县", "收件人详细地址",
HSSFRow firstRow=sheet.createRow(0);
String[] rowTitle={"订单号", "寄件人姓名", "寄件人电话2", "寄件人详细地址", "收件人姓名", "收件人电话2",
"收件人邮编", "邮件号", "内件性质", "重量", "长", "宽", "高", "收件人城市", "收件人区县", "收件人详细地址",
"回单标识", "回单运单号", "商品名称", "内件号", "内件名称"};
for (int i = 0; i < rowTitle.length; i++) {
HSSFCell cell = firstRow.createCell(i);
for (int i=0; i < rowTitle.length; i++) {
HSSFCell cell=firstRow.createCell(i);
cell.setCellValue(rowTitle[i]);
cell.setCellStyle(style);
}
sheet.setColumnWidth(0, (int)((6.67 + 0.72) * 256));
sheet.setColumnWidth(1, (int)((12.36 + 0.72) * 256));
sheet.setColumnWidth(2, (int)((12.36 + 0.72) * 256));
sheet.setColumnWidth(3, (int)((27.83 + 0.72) * 256));
sheet.setColumnWidth(4, (int)((10.55 + 0.72) * 256));
sheet.setColumnWidth(5, (int)((12.36 + 0.72) * 256));
sheet.setColumnWidth(6, (int)((10.55 + 0.72) * 256));
sheet.setColumnWidth(7, (int)((14.64 + 0.72) * 256));
sheet.setColumnWidth(8, (int)((8.55 + 0.72) * 256));
sheet.setColumnWidth(9, (int)((4.82 + 0.72) * 256));
sheet.setColumnWidth(10, (int)((2.91 + 0.72) * 256));
sheet.setColumnWidth(11, (int)((2.91 + 0.72) * 256));
sheet.setColumnWidth(12, (int)((2.91 + 0.72) * 256));
sheet.setColumnWidth(13, (int)((10.55 + 0.72) * 256));
sheet.setColumnWidth(14, (int)((10.55 + 0.72) * 256));
sheet.setColumnWidth(15, (int)((74.64 + 0.72) * 256));
sheet.setColumnWidth(16, (int)((14.09 + 0.72) * 256));
sheet.setColumnWidth(17, (int)((14.64 + 0.72) * 256));
sheet.setColumnWidth(18, (int)((8.55 + 0.72) * 256));
sheet.setColumnWidth(19, (int)((6.64 + 0.72) * 256));
sheet.setColumnWidth(20, (int)((8.55 + 0.72) * 256));
for (int i = 0; i < records.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
PersonPostEntity personPostEntity = records.get(i);
HSSFCell cell = row.createCell(0);
sheet.setColumnWidth(0, (int) ((6.67 + 0.72) * 256));
sheet.setColumnWidth(1, (int) ((12.36 + 0.72) * 256));
sheet.setColumnWidth(2, (int) ((12.36 + 0.72) * 256));
sheet.setColumnWidth(3, (int) ((27.83 + 0.72) * 256));
sheet.setColumnWidth(4, (int) ((10.55 + 0.72) * 256));
sheet.setColumnWidth(5, (int) ((12.36 + 0.72) * 256));
sheet.setColumnWidth(6, (int) ((10.55 + 0.72) * 256));
sheet.setColumnWidth(7, (int) ((14.64 + 0.72) * 256));
sheet.setColumnWidth(8, (int) ((8.55 + 0.72) * 256));
sheet.setColumnWidth(9, (int) ((4.82 + 0.72) * 256));
sheet.setColumnWidth(10, (int) ((2.91 + 0.72) * 256));
sheet.setColumnWidth(11, (int) ((2.91 + 0.72) * 256));
sheet.setColumnWidth(12, (int) ((2.91 + 0.72) * 256));
sheet.setColumnWidth(13, (int) ((10.55 + 0.72) * 256));
sheet.setColumnWidth(14, (int) ((10.55 + 0.72) * 256));
sheet.setColumnWidth(15, (int) ((74.64 + 0.72) * 256));
sheet.setColumnWidth(16, (int) ((14.09 + 0.72) * 256));
sheet.setColumnWidth(17, (int) ((14.64 + 0.72) * 256));
sheet.setColumnWidth(18, (int) ((8.55 + 0.72) * 256));
sheet.setColumnWidth(19, (int) ((6.64 + 0.72) * 256));
sheet.setColumnWidth(20, (int) ((8.55 + 0.72) * 256));
for (int i=0; i < records.size(); i++) {
HSSFRow row=sheet.createRow(i + 1);
PersonPostEntity personPostEntity=records.get(i);
HSSFCell cell=row.createCell(0);
cell.setCellValue(personPostEntity.getId());
cell = row.createCell(1);
cell=row.createCell(1);
cell.setCellValue("人口管理总队");
cell = row.createCell(2);
cell=row.createCell(2);
cell.setCellValue("010-87682315");
cell = row.createCell(3);
cell=row.createCell(3);
cell.setCellValue("北京市丰台区成寿寺路甲19号");
cell = row.createCell(4);
cell=row.createCell(4);
cell.setCellValue(personPostEntity.getRecipientName());
cell = row.createCell(5);
cell=row.createCell(5);
cell.setCellValue(personPostEntity.getRecipientPhone());
cell = row.createCell(7);
cell=row.createCell(7);
cell.setCellValue(personPostEntity.getWaybillNumber());
cell = row.createCell(8);
cell=row.createCell(8);
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(1);
cell = row.createCell(9);
cell=row.createCell(9);
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(100);
cell = row.createCell(13);
cell=row.createCell(13);
cell.setCellValue(personPostEntity.getGetToCity());
cell = row.createCell(14);
cell=row.createCell(14);
cell.setCellValue(personPostEntity.getGetToProvince());
cell = row.createCell(15);
cell=row.createCell(15);
cell.setCellValue(personPostEntity.getRecipientAddress());
cell = row.createCell(16);
cell=row.createCell(16);
cell.setCellValue("6");
cell = row.createCell(17);
cell=row.createCell(17);
cell.setCellValue(personPostEntity.getBackWaybillNumber());
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日生产导出");
String fileName = simpleDateFormat.format(new Date()) + ".xls";
String rtn = "";
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy年MM月dd日生产导出");
String fileName=simpleDateFormat.format(new Date()) + ".xls";
String rtn="";
fileName = URLEncoder.encode(fileName, "UTF8");
String userAgent = request.getHeader("User-Agent");
fileName=URLEncoder.encode(fileName, "UTF8");
String userAgent=request.getHeader("User-Agent");
/*针对IE或者以IE为内核的浏览器:*/
if (userAgent != null) {
userAgent = userAgent.toLowerCase();
if(userAgent != null){
userAgent=userAgent.toLowerCase();
/*IE浏览器,只能采用URLEncoder编码*/
if (userAgent.contains("msie")) {
rtn = "filename=\"" + fileName + "\"";
if(userAgent.contains("msie")){
rtn="filename=\"" + fileName + "\"";
}
/*Opera浏览器只能采用filename**/
else if (userAgent.contains("opera")) {
rtn = "filename*=UTF-8''" + fileName;
else if(userAgent.contains("opera")){
rtn="filename*=UTF-8''" + fileName;
}
/*Safari浏览器,只能采用ISO编码的中文输出*/
else if (userAgent.contains("safari")) {
rtn = "filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), "ISO8859-1") + "\"";
else if(userAgent.contains("safari")){
rtn="filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), "ISO8859-1") + "\"";
}
/*Chrome浏览器,只能采用MimeUtility编码或ISO编码的中文输出*/
// else if (userAgent.indexOf("applewebkit") != -1) {
......@@ -305,16 +390,20 @@ public class PersonPostApi {
// rtn = "filename=\"" + fileName + "\"";
// }
/* FireFox浏览器,可以使用MimeUtility或filename*或ISO编码的中文输出*/
else if (userAgent.contains("mozilla")) {
rtn = "filename*=UTF-8''" + fileName;
else if(userAgent.contains("mozilla")){
rtn="filename*=UTF-8''" + fileName;
}
}
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;" + rtn);
response.setCharacterEncoding("UTF-8");
OutputStream outputStream = response.getOutputStream();
OutputStream outputStream=response.getOutputStream();
wb.write(outputStream);
outputStream.flush();
outputStream.close();
}catch (Exception e){
logger.error("个人邮寄信息:" + records);
logger.error("Exception 创建报表异常", e);
}
}
}
......@@ -9,6 +9,8 @@ import com.yxproject.start.utils.YXJSONResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
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;
......@@ -40,6 +42,8 @@ public class ReadExcelApi {
@Autowired
FileNameDicService fileNameDicService;
Logger logger= Logger.getLogger(ReadExcelApi.class);
/**
* 导入个人邮寄信息表
*/
......@@ -48,6 +52,8 @@ public class ReadExcelApi {
@Produces(MediaType.APPLICATION_JSON)
@Transactional(rollbackFor = Exception.class)
public boolean ReadPersonPost(@RequestParam("formStartTime") String startDate,@RequestParam("formDeadLine") String endDate, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
YXJSONResponse yxresp = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
......@@ -80,7 +86,7 @@ public class ReadExcelApi {
// 如果fileitem中封装的是普通输入项的数据
// 如果fileitem中封装的是上传文件
// 得到上传的文件名称
filename = item.getName();
filename = item.getOriginalFilename();
try {
// 如果fileitem中封装的是普通输入项的数据
// 如果fileitem中封装的是上传文件
......@@ -92,6 +98,8 @@ public class ReadExcelApi {
item.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
logger.error("上传文件名" + filename + "起始时间" + startDate + "截止时间" + endDate);
logger.error("", e);
}
ReadExcel readExcel = new ReadExcel();
List list1 = readExcel.readExcel(file);
......@@ -142,6 +150,8 @@ public class ReadExcelApi {
personPostService.savePersonPost(entityList);
} catch (Exception e) {
e.printStackTrace();
logger.error("上传文件名" + filename + "起始时间" + startDate + "截止时间" + endDate);
logger.error("", e);
yxresp.outPutError("Exception", "上传文件时发生错误,非法XML文件:" + filename);
continue;
} finally {
......@@ -150,6 +160,8 @@ public class ReadExcelApi {
} catch (Exception e) {
e.printStackTrace();
logger.error("上传文件名" + filename + "起始时间" + startDate + "截止时间" + endDate);
logger.error("", e);
yxresp.outPutError("FileUploadException", "文件上载发生异常:" + e.getMessage());
} finally {
return true;
......@@ -158,7 +170,8 @@ public class ReadExcelApi {
}
}
}catch (Exception e){
logger.error("上传文件名" + filename + "起始时间" + startDate + "截止时间" + endDate);
logger.error("Exception 导入个人邮寄信息表异常", e);
}finally {
}
......@@ -174,10 +187,17 @@ public class ReadExcelApi {
* @return
*/
@RequestMapping("queryPersonPost")
public String queryPersonPost(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, @RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize) {
List<FileNameDicEntity> fileNameDicEntities = fileNameDicService.queryFileNameDic(replaceDate(uploadDate),replaceNullString(fileName), Long.valueOf(analysisState), Long.valueOf(currPage), Long.valueOf(pageSize));
public String queryPersonPost(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, @RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
try {
List<FileNameDicEntity> fileNameDicEntities = fileNameDicService.queryFileNameDic(replaceDate(uploadDate),replaceNullString(fileName), Long.valueOf(analysisState), Long.valueOf(currPage), Long.valueOf(pageSize));
yxjsonResponse.outPutSuccess(fileNameDicEntities);
}catch (Exception e){
logger.error("文件名:" + fileName + "是否解析1-解析,0-未解析:" + analysisState + "上传时间:" + uploadDate + "页数:" + currPage + "条数:" + pageSize);
logger.error("Exception 查询个人邮寄解析信息异常", e);
}
return yxjsonResponse.toJSONString();
}
......@@ -188,19 +208,34 @@ public class ReadExcelApi {
* @return
*/
@RequestMapping("queryPersonPostCount")
public String queryPersonPostCount(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate) {
int i = fileNameDicService.queryFileNameDicCount(replaceDate(uploadDate),replaceNullString(fileName), Long.valueOf(analysisState));
public String queryPersonPostCount(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
try {
int i = fileNameDicService.queryFileNameDicCount(replaceDate(uploadDate),replaceNullString(fileName), Long.valueOf(analysisState));
yxjsonResponse.outPutSuccess(i+"");
}catch (Exception e){
logger.error("文件名:" + fileName + "是否解析1-解析,0-未解析:" + analysisState + "上传时间:" + uploadDate);
logger.error("Exception 查询个人邮寄解析信息总数量异常", e);
}
return yxjsonResponse.toJSONString();
}
@RequestMapping("deleteByFileId")
public Map<String,String> deleteFileById(@RequestParam("fileId")String fileId){
public Map<String,String> deleteFileById(@RequestParam("fileId")String fileId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String,String> map = null;
try {
map = new HashMap<>();
fileNameDicService.deleteFileByFileId(fileId);
Map<String,String> map = new HashMap<>();
map.put("msg","删除成功");
}catch (Exception e){
logger.error("文件名:" + fileId);
logger.error("Exception 通过file_ID删除个人邮寄解析信息异常", e);
}
return map;
}
......
......@@ -9,6 +9,8 @@ import com.yxproject.start.utils.YXJSONResponse;
import com.yxproject.start.utils.YXStringUtils;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.dom4j.DocumentException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
......@@ -36,6 +38,8 @@ public class ReadXmlApi {
@Autowired
private ImportXmlService importXmlService;
Logger logger= Logger.getLogger(ReadXmlApi.class);
/**
* 导入检测XML
*
......@@ -49,6 +53,8 @@ public class ReadXmlApi {
@Produces(MediaType.APPLICATION_JSON)
@Transactional(rollbackFor = Exception.class)
public boolean getXMLToCheck(@Context HttpServletResponse resp, @Context HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
YXJSONResponse yxresp = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
String filename = "";
......@@ -89,18 +95,26 @@ public class ReadXmlApi {
idcardsFactory(idCardFactory.extractIDCard(str,date));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error("上传文件名" + filename );
logger.error("UnsupportedEncodingException 上传文件时发现文件编码错误", e);
yxresp.outPutError("UnsupportedEncodingException", "上传文件时发现文件编码错误:" + e.getMessage());
continue;
} catch (IOException e) {
e.printStackTrace();
logger.error("上传文件名" + filename );
logger.error("IOException 上传文件时发生IO错误", e);
yxresp.outPutError("IOException", "上传文件时发生IO错误:" + e.getMessage());
continue;
} catch (DocumentException e) {
e.printStackTrace();
logger.error("上传文件名" + filename );
logger.error("DocumentException 上传文件时发生IO错误", e);
yxresp.outPutError("DocumentException", "上传文件时发生IO错误:" + e.getMessage());
continue;
} catch (Exception e) {
e.printStackTrace();
logger.error("上传文件名" + filename );
logger.error("Exception 上传文件时发生错误,非法XML文件", e);
yxresp.outPutError("Exception", "上传文件时发生错误,非法XML文件:" + filename);
continue;
}
......@@ -109,6 +123,8 @@ public class ReadXmlApi {
}
} catch (Exception e) {
e.printStackTrace();
logger.error("上传文件名" + filename );
logger.error("FileUploadException 文件上传发生异常", e);
yxresp.outPutError("FileUploadException", "文件上传发生异常:" + e.getMessage());
} finally {
return true;
......@@ -128,9 +144,12 @@ public class ReadXmlApi {
* @return
*/
@RequestMapping("queryPersonXML")
public String queryPersonXMLCount(@RequestParam("importDate") String importDate,@RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize, HttpServletResponse resp) {
public String queryPersonXMLCount(@RequestParam("importDate") String importDate,@RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
try {
List<CountDataEntity> countDataEntities = importXmlService.queryPersonXml(replaceDate(importDate),Long.valueOf(currPage)*Long.valueOf(pageSize) ,(Long.valueOf(currPage)-1)*Long.valueOf(pageSize)+1);
Map<String,Object> map = new LinkedHashMap<>();
for (int i=0;i<countDataEntities.size();i++){
if(map!=null && map.containsKey(countDataEntities.get(i).getUploadDate()+"")){
......@@ -179,12 +198,12 @@ public class ReadXmlApi {
}else {
resultMap.put("mapList",mapList);
}
resultMap.put("count",mapList.size());
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(resultMap);
}catch (Exception e){
logger.error("上传时间:" + importDate + "页数:" + currPage + "条数:" + pageSize);
logger.error("Exception 查询XML解析信息异常", e);
}
return yxjsonResponse.toJSONString();
}
......@@ -195,11 +214,18 @@ public class ReadXmlApi {
* @return
*/
@RequestMapping("queryPersonXMLCount")
public String queryPersonXMLCount(@RequestParam("importDate") String importDate, HttpServletResponse resp) {
int i = importXmlService.queryPersonXmlCount(replaceDate(importDate));
public String queryPersonXMLCount(@RequestParam("importDate") String importDate, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
try {
int i = importXmlService.queryPersonXmlCount(replaceDate(importDate));
resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(i+"");
}catch (Exception e){
logger.error("上传时间:" + importDate);
logger.error("Exception 查询XML解析信息异常", e);
}
return yxjsonResponse.toJSONString();
}
......
......@@ -4,6 +4,8 @@ import com.yxproject.start.entity.DetailReceiptListEntity;
import com.yxproject.start.entity.ReceiptListEntity;
import com.yxproject.start.service.ReceiptService;
import net.sf.json.JSONArray;
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.RequestBody;
......@@ -11,6 +13,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 java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -26,6 +29,8 @@ public class ReceiptApi {
@Autowired
private ReceiptService receiptService;
Logger logger= Logger.getLogger(ReceiptApi.class);
/**
* 生成交接单 快证保存ACCEPT_NO 普通证保存GROUP_NO
* @param id 证件ID
......@@ -36,16 +41,20 @@ public class ReceiptApi {
*/
@RequestMapping("createReceiptList")
@Transactional(rollbackFor = Exception.class)
public Map<String,Object> createReceiptList(String id,String name,String beginDate,String expireDate) {
public Map<String,Object> createReceiptList(String id,String name,String beginDate,String expireDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
//判断是否是特证
if ("长期".equals(expireDate)){
expireDate="00000000";
}
Map<String,Object> map = new HashMap<>();
if (receiptService.selectSpecialCardByAcceptNo(id,replaceDate(beginDate),replaceDate(expireDate)) == 1) {
//查询这个受理号是否生成了交接单
List<Map<String, Object>> mapList = receiptService.selectCountById(id,replaceDate(beginDate),replaceDate(expireDate));
//判断是否生成了交接单
if (mapList.size() == 0) {
try {
//查询特证交接单所需数据
Map<String, Object> resultDate = receiptService.selectReceiptListDate(id,replaceDate(beginDate),replaceDate(expireDate));
ReceiptListEntity receiptListEntity = new ReceiptListEntity();
......@@ -67,7 +76,6 @@ public class ReceiptApi {
receiptListEntity.setCheckName(name);
//生成特证交接单
long S = receiptService.createReceiptList(receiptListEntity);
//查询特证详单所需数据
Map<String, Object> detailedData = receiptService.selectDetailedData2(id,replaceDate(beginDate),replaceDate(expireDate));
String uploadNo = (String) detailedData.get("UPLOAD_NO");
......@@ -79,24 +87,32 @@ public class ReceiptApi {
Long receiptId = receiptListEntity.getId();
//生成特证详单
receiptService.createDetailedList(uploadNo, acceptNo2, name2, id, gajg_dm, receiptId, sex, signGovt);
Map<String,Object> map = new HashMap<>();
map.put("show",true);
map.put("state",1);
map.put("msg","生成交接单");
map.put("id",S);
}catch (Exception e){
logger.error("证件ID:" + id + "生成人姓名:" + name + "起始有效期:" + beginDate + "截止有效期" + expireDate);
logger.error("Exception 生成交接单异常", e);
}
return map;
} else {
try {
//已经生成特证交接单,不做操作。
Map<String,Object> map = new HashMap<>();
map.put("show",false);
map.put("state",2);
map.put("msg","已生成交接单");
map.put("id",mapList.get(0).get("ID"));
map.put("checkName",mapList.get(0).get("CHECK_NAME"));
map.put("policeName",mapList.get(0).get("GAJG_MC"));
}catch (Exception e){
logger.error("证件ID:" + id + "生成人姓名:" + name + "起始有效期:" + beginDate + "截止有效期" + expireDate);
logger.error("Exception 已经生成特证交接单", e);
}
return map;
}
} else {
try {
//根据身份证号查组号
String groupNo = receiptService.selectGroupNoById(id,replaceDate(beginDate),replaceDate(expireDate));
//查询详单所需数据
......@@ -105,8 +121,13 @@ public class ReceiptApi {
for (int i = 0; i < receiptListDate.size(); i++) {
ReceiptListEntity receiptListEntity = new ReceiptListEntity();
Long card_type = Long.valueOf((BigDecimal) receiptListDate.get(i).get("CARD_TYPE") + "");
receiptListEntity.setCardTypeId(card_type);
if (card_type==9){
receiptListEntity.setPoliceCode("110001580800");
}else {
receiptListEntity.setPoliceCode(receiptListDate.get(i).get("GAJG_DM").toString());
receiptListEntity.setCardTypeId(Long.valueOf((BigDecimal) receiptListDate.get(i).get("CARD_TYPE") + ""));
}
if ("null".equals(receiptListDate.get(i).get("OLD_CARD_TYPE") + "")) {
} else {
......@@ -121,6 +142,7 @@ public class ReceiptApi {
List<Map<String, Object>> mapList = receiptService.selectByGroupNo(receiptListDate.get(i).get("GROUP_NO").toString());
//没有生成交接单
if (mapList.size() == 0) {
try {
//生成交接单
long receiptList = receiptService.createReceiptList(receiptListEntity);
for (int n = 0; n < receiptListDate.size(); n++) {
......@@ -142,28 +164,37 @@ public class ReceiptApi {
//不做操作
}
}
Map<String,Object> map = new HashMap<>();
map.put("show",true);
map.put("state",1);
map.put("id",receiptList);
}catch (Exception e){
logger.error("证件ID:" + id + "生成人姓名:" + name + "起始有效期:" + beginDate + "截止有效期" + expireDate);
logger.error("Exception 生成交接单异常", e);
}
return map;
} else {
try {
//已生成交接单
Map<String,Object> map = new HashMap<>();
map.put("show",false);
map.put("msg","已生成交接单");
map.put("state",2);
map.put("id",mapList.get(0).get("ID"));
map.put("checkName",mapList.get(0).get("CHECK_NAME"));
map.put("policeName",mapList.get(0).get("GAJG_MC"));
}catch (Exception e){
logger.error("证件ID:" + id + "生成人姓名:" + name + "起始有效期:" + beginDate + "截止有效期" + expireDate);
logger.error("Exception 已经生成特证交接单", e);
}
return map;
}
}
Map<String,Object> map = new HashMap<>();
map.put("show",false);
map.put("state",3);
map.put("msg","未查询出对应的信息");
}catch (Exception e){
logger.error("证件ID:" + id + "生成人姓名:" + name + "起始有效期:" + beginDate + "截止有效期" + expireDate);
logger.error("Exception 生成特证交接单异常", e);
}
return map;
}
}
......@@ -175,24 +206,32 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("selectRecriptData")
public List<Map<String, Object>> selectRecriptData(String name) {
public List<Map<String, Object>> selectRecriptData(String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
//返回交接单数据
List<Map<String, Object>> resultMap = receiptService.selectReceiptListOfSpecialCard(name);
for (int i = 0; i < resultMap.size(); i++) {
String groupNo = (String) resultMap.get(i).get("QR_CODE");
List<Map<String, Object>> resultMap = new ArrayList <>();
try {
resultMap=receiptService.selectReceiptListOfSpecialCard(name);
for (int i=0; i < resultMap.size(); i++) {
String groupNo=(String) resultMap.get(i).get("QR_CODE");
//判断是否是特证
if (groupNo.length() == 10) {
Map<String, Object> map = receiptService.selectCountTimeT(groupNo);
if(groupNo.length() == 10){
Map <String, Object> map=receiptService.selectCountTimeT(groupNo);
resultMap.get(i).put("download", map.get("DOWNLOAD"));
resultMap.get(i).put("checkerCount", map.get("CHECKERCOUNT"));
resultMap.get(i).put("electricCount", map.get("ELECTRICCOUNT"));
} else {
Map<String, Object> map = receiptService.selectCountTime(groupNo);
Map <String, Object> map=receiptService.selectCountTime(groupNo);
resultMap.get(i).put("download", map.get("DOWNLOAD"));
resultMap.get(i).put("checkerCount", map.get("CHECKERCOUNT"));
resultMap.get(i).put("electricCount", map.get("ELECTRICCOUNT"));
}
}
}catch (Exception e){
logger.error( "生成人姓名:" + name);
logger.error("Exception 查询交接单数据异常", e);
}
return resultMap;
}
......@@ -204,16 +243,24 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("selectDetailList")
public List<Map<String, Object>> selectDetailList( String receiptId) {
List<Map<String, Object>> resultList = receiptService.selectDetailList(receiptId);
for (int i = 0; i < resultList.size(); i++) {
String acceptNo = (String) resultList.get(i).get("ACCEPT_NO");
Map<String, Object> map = receiptService.selectTimes(acceptNo);
public List<Map<String, Object>> selectDetailList( String receiptId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> resultList = new ArrayList <>();
try {
resultList=receiptService.selectDetailList(receiptId);
for (int i=0; i < resultList.size(); i++) {
String acceptNo=(String) resultList.get(i).get("ACCEPT_NO");
Map <String, Object> map=receiptService.selectTimes(acceptNo);
resultList.get(i).put("downloadDate", map.get("DOWNLOADDATE"));
resultList.get(i).put("checkDate", map.get("CHECKDATE"));
resultList.get(i).put("electricDate", map.get("ELECTRICDATE"));
resultList.get(i).put("styleClass", "");
}
}catch (Exception e){
logger.error( "交接单ID:" + receiptId);
logger.error("Exception 根据任务单查询详细信息异常", e);
}
return resultList;
}
......@@ -224,8 +271,11 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("selectDetailListByReceiptId")
public Map<String, Object> selectDetailListByReceiptId( String receiptId) {
public Map<String, Object> selectDetailListByReceiptId( String receiptId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String,Object> mapList = new HashMap<>();
try {
List<Map<String, Object>> resultList = receiptService.selectDetailList(receiptId);
if (resultList.size()>0){
mapList.put("policeName",resultList.get(0).get("GAJG_MC"));
......@@ -234,7 +284,10 @@ public class ReceiptApi {
mapList.put("count",resultList.get(0).get("FINISH_COUNT"));
}
mapList.put("list",resultList);
}catch (Exception e){
logger.error( "交接单ID:" + receiptId);
logger.error("Exception 根据任务单查询详细信息异常", e);
}
return mapList;
}
......@@ -246,13 +299,17 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("updateReceiptList")
public boolean updateReceiptList(@RequestParam("receiptId") String receiptId, @RequestParam("checkName") String checkName) {
public boolean updateReceiptList(@RequestParam("receiptId") String receiptId, @RequestParam("checkName") String checkName, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
SimpleDateFormat dt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
try {
Date date = dt.parse(dt.format(new Date()));
receiptService.updateReceiptList(receiptId, checkName, date);
} catch (ParseException e) {
e.printStackTrace();
logger.error("交接单ID:" + receiptId + "复核人姓名:" + checkName);
logger.error("ParseException 数据核验--更改交接单状态异常", e);
}
return true;
}
......@@ -265,13 +322,22 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("selectDetailByAcceptNo")
public List<DetailReceiptListEntity> selectDetailByAcceptNo(@RequestBody String jsonStr) {
JSONArray jsonarray = JSONArray.fromObject(jsonStr);
List<DetailReceiptListEntity> resultList = new ArrayList<>();
public List<DetailReceiptListEntity> selectDetailByAcceptNo(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonarray = new JSONArray();
List<DetailReceiptListEntity> resultList = null;
try {
jsonarray = JSONArray.fromObject(jsonStr);
resultList = new ArrayList<>();
for (int i = 0; i < jsonarray.size(); i++) {
DetailReceiptListEntity detailReceiptListEntity = receiptService.selectDetailByAcceptNo((String) jsonarray.get(i));
resultList.add(detailReceiptListEntity);
}
}catch (Exception e) {
logger.error("受理号:" + jsonStr );
logger.error("Exception 根据受理号查询详单信息异常", e);
}
return resultList;
}
......@@ -282,12 +348,20 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("updateDetailNote")
public boolean updateDetailNote(@RequestBody String jsonStr) {
JSONArray jsonArray = JSONArray.fromObject(jsonStr);
public boolean updateDetailNote(@RequestBody String jsonStr, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonArray = new JSONArray();
try {
jsonArray = JSONArray.fromObject(jsonStr);
for (int i = 0; i < jsonArray.size(); i++) {
Map<String, Object> resultMap = (Map<String, Object>) jsonArray.get(i);
receiptService.updateDetail(formateAcceptNo(resultMap.get("acceptNo").toString()), resultMap.get("note").toString());
}
}catch (Exception e) {
logger.error("备注信息:" + jsonStr );
logger.error("Exception 更改备注信息异常", e);
}
return true;
}
......@@ -299,11 +373,14 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("updateReceiptDateByReceiptId")
public boolean updateReceiptDateByReceiptId(@RequestParam("receiptId") String receiptId) {
public boolean updateReceiptDateByReceiptId(@RequestParam("receiptId") String receiptId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
receiptService.updateReceiptDateByReceiptId(receiptId);
} catch (Exception e) {
e.printStackTrace();
logger.error("交接单ID:" + receiptId);
logger.error("Exception 生成交接单异常", e);
}
return true;
}
......@@ -315,8 +392,17 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("queryReceiptDateByCheckDate")
public List<Map<String, Object>> queryReceiptDateByCheckDate(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate) {
return receiptService.selectReceiptDateByCheckDate(replaceNullString(replaceDate(startDate.replaceAll(" ", "").replaceAll(":", ""))),replaceNullString(replaceDate(endDate.replaceAll(" ", "").replaceAll(":", ""))));
public List<Map<String, Object>> queryReceiptDateByCheckDate(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> receiptDate = new ArrayList <>();
try {
receiptDate = receiptService.selectReceiptDateByCheckDate(replaceNullString(replaceDate(startDate.replaceAll(" ", "").replaceAll(":", ""))),replaceNullString(replaceDate(endDate.replaceAll(" ", "").replaceAll(":", ""))));
}catch (Exception e) {
logger.error("复核起始时间:" + startDate + "复核结束时间:" + endDate);
logger.error("Exception 查询交接单异常", e);
}
return receiptDate;
}
......@@ -327,8 +413,17 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("queryReceiptDateByReceiptDate")
public List<Map<String, Object>> queryReceiptDateByReceiptDate(String startDate, String endDate) {
return receiptService.selectReceiptDateByReceiptDate(replaceDate(startDate.replaceAll(" ", "").replaceAll(":", "")),replaceDate(endDate.replaceAll(" ", "").replaceAll(":", "")));
public List<Map<String, Object>> queryReceiptDateByReceiptDate(String startDate,String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> receiptDate = new ArrayList <>();
try {
receiptDate = receiptService.selectReceiptDateByReceiptDate(replaceDate(startDate.replaceAll(" ", "").replaceAll(":", "")),replaceDate(endDate.replaceAll(" ", "").replaceAll(":", "")));
}catch (Exception e) {
logger.error("交接起始时间:" + startDate + "交接结束时间:" + endDate);
logger.error("Exception 查询历史交接单异常", e);
}
return receiptDate;
}
/**
......@@ -338,8 +433,17 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("queryPoliceName")
public List<Map<String, Object>> queryPoliceName(@RequestParam("policeCode") String policeCode) {
return receiptService.queryPoliceName(policeCode);
public List<Map<String, Object>> queryPoliceName(@RequestParam("policeCode") String policeCode, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List <Map <String, Object>> policeName = new ArrayList <>();
try {
policeName = receiptService.queryPoliceName(policeCode);
}catch (Exception e) {
logger.error("派出所代码:" + policeCode);
logger.error("Exception 查询分局名称异常", e);
}
return policeName;
}
/**
......@@ -350,8 +454,17 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("queryPoliceData")
public List<Map<String, Object>> queryPoliceData(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate) {
return receiptService.selectPoliceData(replaceDate(startDate),replaceDate(endDate));
public List<Map<String, Object>> queryPoliceData(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List <Map <String, Object>> policeData = new ArrayList <>();
try {
policeData = receiptService.selectPoliceData(replaceDate(startDate), replaceDate(endDate));
}catch (Exception e) {
logger.error("开始时间:" + startDate + "结束时间:" + endDate);
logger.error("Exception 查询公安网数据异常", e);
}
return policeData;
}
/**
......@@ -362,8 +475,17 @@ public class ReceiptApi {
* @return
*/
@RequestMapping("queryPoliceDataByDownLoadDate")
public List<Map<String, Object>> queryPoliceDataByDownLoadDate(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate) {
return receiptService.selectPoliceDataByDownLoadDate(replaceDate(startDate),replaceDate(endDate));
public List<Map<String, Object>> queryPoliceDataByDownLoadDate(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List <Map <String, Object>> policeData = new ArrayList <>();
try {
policeData = receiptService.selectPoliceDataByDownLoadDate(replaceDate(startDate), replaceDate(endDate));
}catch (Exception e) {
logger.error("开始时间:" + startDate + "结束时间:" + endDate);
logger.error("Exception 查询公安网数据(历史)异常", e);
}
return policeData;
}
......
......@@ -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,10 +26,16 @@ public class SelectApi {
@Autowired
private SelectSerialNumberService selectSerialNumberService;
Logger logger= Logger.getLogger(SelectApi.class);
@RequestMapping(value = "selectByCard")
public Map<String, Object> selectByCard(@RequestParam("id") String string) {
String id = formateAcceptNo(string);
Map<String, Object> resultMap = new HashMap<>();
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<>();
......@@ -35,7 +44,7 @@ public class SelectApi {
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>> workOrderData = selectSerialNumberService.selectByGroupNo(id);
List<Map<String, Object>> ACCdata = new ArrayList<>();
List<Map<String, Object>> PRODData = new ArrayList<>();
resultMap.put("workOrderData", workOrderData);
......@@ -44,16 +53,16 @@ public class SelectApi {
} else if (id.length() == 10 || id.length() == 18) {
//查询是否是特证,如果是,返回新的任务单信息
List<Map<String, Object>> workOrderData = selectSerialNumberService.selectByAcceptNoOrCardIdFromTaskList2(id.replace("e","E").replace("g","G"));
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.replace("e","E").replace("g","G"));
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);
......@@ -61,6 +70,10 @@ public class SelectApi {
} 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;
}
}
......@@ -4,17 +4,18 @@ import com.yxproject.start.entity.*;
import com.yxproject.start.service.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
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 javax.transaction.Transactional;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author Administrator
......@@ -34,6 +35,7 @@ public class TaskListApi {
@Autowired
private ReceiptService receiptService;
Logger logger= Logger.getLogger(TaskListApi.class);
/**
* 更改任务单状态
......@@ -45,20 +47,29 @@ public class TaskListApi {
* @return
*/
@RequestMapping("updateState")
public boolean updateState(@RequestBody String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
public boolean updateState(@RequestBody String json, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
boolean state = true;
try {
jsonObject = JSONObject.fromObject(json);
JSONArray jsonArray = (JSONArray) jsonObject.get("taskIdList");
JSONArray failedList = (JSONArray) jsonObject.get("failedList");
String process = jsonObject.get("process").toString();
String name = jsonObject.get("name").toString();
List<String> list = (List<String>) jsonArray;
if ("1".equals(process)){
if ("1".equals(process)) {
String workGroup = jsonObject.get("workGroup").toString();
return taskListService.updateState1(failedList, list, process, name,workGroup);
}else {
return taskListService.updateState(failedList, list, process, name);
state = taskListService.updateState1(failedList, list, process, name, workGroup);
} else {
state = taskListService.updateState(failedList, list, process, name);
}
}catch (Exception e){
logger.error("任务单状态:" + jsonObject);
logger.error("Exception 更改任务单状态(下发、预订位、平压、冲切、分拣)异常", e);
}
return state;
}
/**
......@@ -72,14 +83,25 @@ public class TaskListApi {
* @return
*/
@RequestMapping("updateState2")
public boolean updateState2(@RequestBody String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
JSONArray jsonArray = (JSONArray) jsonObject.get("taskIdList");
JSONArray failedList = (JSONArray) jsonObject.get("failedList");
String process = jsonObject.get("process").toString();
String name = jsonObject.get("name").toString();
List<String> list = (List<String>) jsonArray;
return taskListService.updateState2(failedList, list, process, name);
public boolean updateState2(@RequestBody String json, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
boolean state = true;
try {
jsonObject=JSONObject.fromObject(json);
JSONArray jsonArray=(JSONArray) jsonObject.get("taskIdList");
JSONArray failedList=(JSONArray) jsonObject.get("failedList");
String process=jsonObject.get("process").toString();
String name=jsonObject.get("name").toString();
// String printer = jsonObject.get("printer").toString();
List <String> list=(List <String>) jsonArray;
state = taskListService.updateState2(failedList, list, process, name);
}catch (Exception e){
logger.error("任务单状态:" + jsonObject);
logger.error("Exception 更改任务单状态(打印转出)异常", e);
}
return state;
}
/**
* 更改任务单工作组
......@@ -90,12 +112,22 @@ public class TaskListApi {
* @return
*/
@RequestMapping("updateWorkGroup")
public boolean updateWorkGroup(@RequestBody String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
JSONArray jsonArray = (JSONArray) jsonObject.get("taskIdList");
String workGroup = jsonObject.get("workGroup").toString();
List<String> list = (List<String>) jsonArray;
return taskListService.updateWorkGroup(list, workGroup);
public boolean updateWorkGroup(@RequestBody String json, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
boolean state = true;
try {
jsonObject=JSONObject.fromObject(json);
JSONArray jsonArray=(JSONArray) jsonObject.get("taskIdList");
String workGroup=jsonObject.get("workGroup").toString();
List <String> list=(List <String>) jsonArray;
state = taskListService.updateWorkGroup(list, workGroup);
}catch (Exception e){
logger.error("任务单状态:" + jsonObject);
logger.error("Exception 更改任务单状态(打印转出)异常", e);
}
return state;
}
/**
......@@ -109,10 +141,17 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryByCountyAtACCU")
public List<Object> queryByCountyAtACCU(@RequestParam("process") String process, @RequestParam("date") String date, HttpServletResponse resp) {
List<Object> objects = taskListService.selectByCountyAtACCU(replaceDate(date));
public List<Object> queryByCountyAtACCU(@RequestParam("process") String process, @RequestParam("date") String date, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Object> objects = new ArrayList<>();
try {
objects = taskListService.selectByCountyAtACCU(replaceDate(date));
}catch (Exception e){
logger.error("工序:" + process + "查询时间:" + date);
logger.error("Exception 查询任务单详情(受理库)异常", e);
}
return objects;
}
/**
......@@ -126,10 +165,17 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryByGroupNoAtACCU")
public Map<String, Object> queryByPoliceAtACCU(@RequestParam("date") String date, @RequestParam("typeCode") String typeCode, @RequestParam("countyCode") String countyCode, @RequestParam("currPage") String currPage, @RequestParam("pageSize") String pageSize, HttpServletResponse resp) {
Map<String, Object> objects = taskListService.selectByGroupNoAtACCU(replaceDate(date), typeCode, countyCode, Long.valueOf(currPage), Long.valueOf(pageSize));
public Map<String, Object> queryByPoliceAtACCU(@RequestParam("date") String date, @RequestParam("typeCode") String typeCode, @RequestParam("countyCode") String countyCode, @RequestParam("currPage") String currPage, @RequestParam("pageSize") String pageSize, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String, Object> objects = null;
try {
objects = taskListService.selectByGroupNoAtACCU(replaceDate(date), typeCode, countyCode, Long.valueOf(currPage), Long.valueOf(pageSize));
}catch (Exception e){
logger.error("查询时间:" + date + "制证类型:" + typeCode + "区县代码:" + countyCode + "页数:" + currPage + "条数:" + pageSize);
logger.error("Exception 查询组号列表详情(受理库)异常", e);
}
return objects;
}
/**
......@@ -142,8 +188,16 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryByCountyAtAuxiliary")
public List<Object> queryByCountyAtAuxiliary(@RequestParam("process") String process, HttpServletResponse resp) {
List<Object> objects = taskListService.selectByCountyAtAuxiliary(Long.valueOf(process) - 1);
public List<Object> queryByCountyAtAuxiliary(@RequestParam("process") String process, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Object> objects = new ArrayList <>();
try {
objects = taskListService.selectByCountyAtAuxiliary(Long.valueOf(process) - 1);
}catch (Exception e){
logger.error("工序:" + process);
logger.error("Exception 查询任务单详情(辅助库)(下发、数据核验、膜打印)异常", e);
}
return objects;
}
......@@ -157,8 +211,16 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryByCountyAtAuxiliaryState1")
public Map queryByCountyAtAuxiliaryState1(@RequestParam("process") String process,@RequestParam("workGroup") String workGroup, HttpServletResponse resp) {
Map map = taskListService.selectByCountyAtAuxiliary2(Long.valueOf(process),workGroup);
public Map queryByCountyAtAuxiliaryState1(@RequestParam("process") String process,@RequestParam("workGroup") String workGroup, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map map = new HashMap();
try {
map = taskListService.selectByCountyAtAuxiliary2(Long.valueOf(process),workGroup);
}catch (Exception e){
logger.error("工序:" + process + "工作组" + workGroup);
logger.error("Exception 查询任务单详情(辅助库)(预订位、平压)异常", e);
}
return map;
}
......@@ -172,8 +234,16 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryByCountyAtAuxiliaryState3")
public List<Object> queryByCountyAtAuxiliaryState3(@RequestParam("process") String process,@RequestParam("workGroup")String workGroup, HttpServletResponse resp) {
List<Object> objects = taskListService.selectByCountyAtAuxiliary3(Long.valueOf(process) - 1,workGroup);
public List<Object> queryByCountyAtAuxiliaryState3(@RequestParam("process") String process,@RequestParam("workGroup")String workGroup, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Object> objects = new ArrayList <>();
try {
objects = taskListService.selectByCountyAtAuxiliary3(Long.valueOf(process) - 1,workGroup);
}catch (Exception e){
logger.error("工序:" + process + "工作组" + workGroup);
logger.error("Exception 查询任务单详情(辅助库、制证库)(电写入)异常", e);
}
return objects;
}
......@@ -186,8 +256,16 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryByCountyAtAuxiliaryState4")
public List<Object> queryByCountyAtAuxiliaryState4(@RequestParam("process") String process) {
List<Object> objects = taskListService.selectByCountyAtAuxiliary4(Long.valueOf(process) - 1);
public List<Object> queryByCountyAtAuxiliaryState4(@RequestParam("process") String process, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Object> objects = new ArrayList <>();
try {
objects = taskListService.selectByCountyAtAuxiliary4(Long.valueOf(process) - 1);
}catch (Exception e){
logger.error("工序:" + process);
logger.error("Exception 查询任务单详情(辅助库)(下发、数据核验、膜打印)异常", e);
}
return objects;
}
......@@ -203,8 +281,16 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryHistoryTaskAtAuxiliary")
public List<Object> queryHistoryTaskAtAuxiliary(@RequestParam("process") String process, @RequestParam("date") String date,@RequestParam("workGroup") String workGroup, HttpServletResponse resp) {
List<Object> objects = taskListService.selectHistoryTaskAtAuxiliary(Long.valueOf(process), replaceDate(date),workGroup);
public List<Object> queryHistoryTaskAtAuxiliary(@RequestParam("process") String process, @RequestParam("date") String date, @RequestParam("workGroup") String workGroup, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Object> objects = new ArrayList <>();
try {
objects = taskListService.selectHistoryTaskAtAuxiliary(Long.valueOf(process), replaceDate(date), workGroup);
}catch (Exception e){
logger.error("工序:" + process + "查询时间:" + date + "工作组" + workGroup);
logger.error("Exception 查询任务单详情(历史)(辅助库)(创建、下发、膜打印、预订位、平压、冲切)异常", e);
}
return objects;
}
......@@ -217,8 +303,16 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryHistoryTaskAtAuxiliary2")
public List<Object> queryHistoryTaskAtAuxiliary2(@RequestParam("date") String date ) {
List<Object> objects = taskListService.selectHistoryTaskAtAuxiliary2(replaceDate(date));
public List<Object> queryHistoryTaskAtAuxiliary2(@RequestParam("date") String date, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Object> objects = new ArrayList <>();
try {
objects = taskListService.selectHistoryTaskAtAuxiliary2(replaceDate(date));
}catch (Exception e){
logger.error("查询时间:" + date);
logger.error("Exception 查询任务单详情(历史)(辅助库)(分拣)异常", e);
}
return objects;
}
......@@ -234,8 +328,13 @@ public class TaskListApi {
*/
@RequestMapping("createTask")
@Transactional
public Map<String, Object> queryByCountyAtACCU(@RequestBody String str, HttpServletResponse resp) {
JSONObject jsonObject = JSONObject.fromObject(str);
public Map<String, Object> queryByCountyAtACCU(@RequestBody String str, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
Map<String, Object> map = new LinkedHashMap<>();
try {
jsonObject = JSONObject.fromObject(str);
String name = jsonObject.getString("name");
JSONArray jsonGroup = jsonObject.getJSONArray("groupList");
//生成某几个组的区县任务单
......@@ -256,8 +355,11 @@ public class TaskListApi {
}
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("msg", "成功生成任务单");
}catch (Exception e){
logger.error("任务单生成参数:" + jsonObject);
logger.error("Exception 生成任务单异常", e);
}
return map;
}
......@@ -274,17 +376,22 @@ public class TaskListApi {
*/
@RequestMapping("createFastTask")
@Transactional
public Map<String, Object> createFastTask(@RequestBody String object) {
public Map<String, Object> createFastTask(@RequestBody String object, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
// 添加没有解析进去受理库情况
JSONObject jsonObject = JSONObject.fromObject(object);
JSONObject jsonObject = new JSONObject();
Map<String, Object> map = new LinkedHashMap<>();
try {
jsonObject = JSONObject.fromObject(object);
String acceptNo = jsonObject.getString("acceptNo");
String cardType = jsonObject.getString("cardType");
String countyCode = jsonObject.getString("countyCode");
String name = jsonObject.getString("name");
// 判断是否添加快证 通过受理号查询交接单详情数量
List<DetailReceiptListEntity> detailReceiptListEntityList = receiptService.queryReceipt(acceptNo);
if (detailReceiptListEntityList.size()!=0){
Map<String, Object> map = new LinkedHashMap<>();
if (detailReceiptListEntityList.size() != 0) {
map = new LinkedHashMap<>();
map.put("msg", "证件已经生成交接单,无法加入快证");
return map;
}
......@@ -311,10 +418,6 @@ public class TaskListApi {
List<GroupNoEntity> groupNoEntities = groupNoService.selectGroupNoEntityByGroupNo(acceptNo.substring(0, 8));
if (groupNoEntities.size() > 0) {
for (GroupNoEntity groupNoEntity : groupNoEntities) {
// if (groupNoEntity.getValidCount()==1){
// taskListService.deleteRedoTask(groupNoEntity.getTaskId());
// break;
// }
groupNoEntity.setSpecialCardCount(groupNoEntity.getSpecialCardCount() + 1);
groupNoService.updateGroupNoSpecialCount(groupNoEntity);
}
......@@ -339,12 +442,14 @@ public class TaskListApi {
break;
}
}
}
}
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("msg", "成功添加快证任务单");
}catch (Exception e){
logger.error("快证任务单生成参数:" + jsonObject);
logger.error("Exception 快证生成任务单异常", e);
}
return map;
}
......@@ -358,9 +463,14 @@ public class TaskListApi {
*/
@RequestMapping("createRedoTask")
@Transactional
public Map<String, Object> createRedoTask(@RequestBody String object) {
public Map<String, Object> createRedoTask(@RequestBody String object, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
// JSONObject jsonObject = JSONObject.fromObject(object);
JSONArray jsonArray = JSONArray.fromObject(object);
JSONArray jsonArray = new JSONArray();
Map<String, Object> map = new LinkedHashMap<>();
try {
jsonArray = JSONArray.fromObject(object);
for(Object o :jsonArray){
JSONObject jsonObject = JSONObject.fromObject(o);
String acceptNo = jsonObject.getString("acceptNo");
......@@ -380,9 +490,11 @@ public class TaskListApi {
groupNoEntity.setTaskId(taskEntity.getTaskId());
groupNoService.saveGroupNo(groupNoEntity);
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("msg", "成功添加重做返回证任务单");
}catch (Exception e) {
logger.error("重做返回证任务单生成参数:" + jsonArray);
logger.error("Exception 生成重做返回证任务单异常", e);
}
return map;
}
......@@ -393,10 +505,17 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryRedoTask")
public List<Map<String, Object>> queryRedoTask( @RequestParam("date")String date){
List<Map<String, Object>> maps = taskListService.selectRedoTask(replaceDate(date));
public List<Map<String, Object>> queryRedoTask( @RequestParam("date")String date, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> maps = new ArrayList <>();
try {
maps = taskListService.selectRedoTask(replaceDate(date));
}catch (Exception e){
logger.error("登记时间:" + date);
logger.error("Exception 查询重做返回登记任务单异常", e);
}
return maps;
}
/**
......@@ -405,9 +524,17 @@ public class TaskListApi {
* @return
*/
@RequestMapping("deleteRedoTask")
public boolean deleteRedoTask( @RequestParam("taskId")String taskId){
return taskListService.deleteRedoTask(Long.valueOf(taskId));
public boolean deleteRedoTask( @RequestParam("taskId")String taskId, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
boolean redoTask = true;
try {
redoTask = taskListService.deleteRedoTask(Long.valueOf(taskId));
}catch (Exception e){
logger.error("任务单ID:" + taskId);
logger.error("Exception 删除重做返回登记任务单异常", e);
}
return redoTask;
}
......@@ -421,16 +548,21 @@ public class TaskListApi {
*/
@RequestMapping("addBackCard")
@Transactional
public Map<String, Object> addBackCard(@RequestBody String object, HttpServletResponse resp) {
JSONObject jsonObject = JSONObject.fromObject(object);
public Map<String, Object> addBackCard(@RequestBody String object, HttpServletResponse resp, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
Map<String, Object> map = new LinkedHashMap <>();
JSONObject jsonObject = new JSONObject();
try {
jsonObject = JSONObject.fromObject(object);
String acceptNo = jsonObject.getString("acceptNo");
String taskId = jsonObject.getString("taskId");
String name = jsonObject.getString("name");
List<Map<String, Object>> objects = preproPersonService.selectUploadNoByAcceptNo(acceptNo);
if (objects.size() > 0) {
for (Map<String, Object> map : objects) {
for (Map<String, Object> map1 : objects) {
PreproPersonEntity preproPersonEntity = new PreproPersonEntity();
preproPersonEntity.setJmsfzslh(map.get("UPLOAD_NO").toString());
preproPersonEntity.setJmsfzslh(map1.get("UPLOAD_NO").toString());
preproPersonEntity.setIsValid(0);
preproPersonService.updatePreproPersonIsValid(preproPersonEntity);
}
......@@ -451,8 +583,11 @@ public class TaskListApi {
specialCardEntity.setTaskId(Long.valueOf(taskId));
specialCardService.saveSpecialCard(specialCardEntity);
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("msg", "成功添加退证");
}catch (Exception e){
logger.error("生成退证参数:" + jsonObject);
logger.error("Exception 生成退证异常", e);
}
return map;
}
......@@ -462,11 +597,19 @@ public class TaskListApi {
* 查询制证类型列表
*/
@RequestMapping("getTypeList")
public List<CardTypeDicEntity> getTypeList() {
List<CardTypeDicEntity> list = taskListService.getTypeList();
public List<CardTypeDicEntity> getTypeList( HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<CardTypeDicEntity> list = new ArrayList <>();
try {
list = taskListService.getTypeList();
}catch (Exception e){
logger.error("Exception 查询制证类型列表异常", e);
}
return list;
}
/**
* 查询提交人上传的余证详情
* @param date 提交日期
......@@ -474,8 +617,16 @@ public class TaskListApi {
* @return
*/
@RequestMapping("queryRemainderCardInfo")
public List<Map<String,Object>> queryRemainderCardInfo(@RequestParam("date") String date,@RequestParam("name") String name) {
List<Map<String,Object>> failedCardEntities = taskListService.selectRemainderCardInfo(replaceDate(date), name);
public List<Map<String, Object>> queryRemainderCardInfo(@RequestParam("date") String date, @RequestParam("name") String name, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> failedCardEntities = new ArrayList <>();
try {
failedCardEntities = taskListService.selectRemainderCardInfo(replaceDate(date), name);
}catch (Exception e){
logger.error("提交日期:" + date + "提交人姓名" + name);
logger.error("Exception 查询已转出数量异常", e);
}
return failedCardEntities;
}
......@@ -484,8 +635,15 @@ public class TaskListApi {
* 查询已转出数量
*/
@RequestMapping("getPrintOutCount")
public List<Map<String, Object>> getPrintOutCount() {
List<Map<String, Object>> printOutCount = taskListService.getPrintOutCount();
public List<Map<String, Object>> getPrintOutCount(HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
List<Map<String, Object>> printOutCount = new ArrayList <>();
try {
printOutCount = taskListService.getPrintOutCount();
}catch (Exception e){
logger.error("Exception 查询已转出数量异常", e);
}
return printOutCount;
}
......@@ -498,12 +656,22 @@ public class TaskListApi {
* @return
*/
@RequestMapping("updateFailedCardWorkGroup")
public boolean updateFailedCardWorkGroup(@RequestBody String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
public boolean updateFailedCardWorkGroup(@RequestBody String json, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = new JSONObject();
boolean state = true;
try {
jsonObject = JSONObject.fromObject(json);
JSONArray jsonArray = (JSONArray) jsonObject.get("taskIdList");
String workGroup = jsonObject.get("workGroup").toString();
List<String> list = (List<String>) jsonArray;
return taskListService.updateFailedCardWorkGroup(list, workGroup);
state = taskListService.updateFailedCardWorkGroup(list, workGroup);
}catch (Exception e){
logger.error("废证任务单参数:" + jsonObject);
logger.error("Exception 更改废证任务单工作组(打印转出)异常", e);
}
return state;
}
/**
......
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){
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,22 +47,34 @@ 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() {
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,14 +24,21 @@ 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){
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);
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());
......@@ -49,6 +59,10 @@ public class queryPreproPerson {
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);
}
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){
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<String,Object> map = new LinkedHashMap<>();
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<>();
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