Commit 91d9bf70 authored by dahai's avatar dahai

添加查询公安网数据  以及历史数据

修改下载公安网数据  并更新下载时间以及添加下载人姓名
修改添加快证 空组情况
parent 22708494
......@@ -6,12 +6,14 @@ 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.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 java.io.File;
import java.io.FileInputStream;
......@@ -33,8 +35,14 @@ public class ExportExcelApi {
* 导出公安网数据
*/
@RequestMapping("printExcelData")
public byte[] printExcelData(@RequestParam("date") String date, HttpServletResponse response) {
List<Map<String, Object>> mapList = detailReceiptListService.selectPostDetails(replaceDate(date));
public byte[] printExcelData(@RequestBody String list, HttpServletResponse response, HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONObject jsonObject = JSONObject.fromObject(list);
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, Long.valueOf(type),name);
response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8");
String dateTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd");
......@@ -93,14 +101,14 @@ public class ExportExcelApi {
}
/**
* 查询公安网数据
*/
@RequestMapping("selectExcelData")
public List<Map<String, Object>> selectExcelData(@RequestParam("date") String date) {
List<Map<String, Object>> mapList = detailReceiptListService.selectPostDetails(replaceDate(date));
return mapList;
}
// /**
// * 查询公安网数据
// */
// @RequestMapping("selectExcelData")
// public List<Map<String, Object>> selectExcelData(@RequestParam("date") String date) {
// List<Map<String, Object>> mapList = detailReceiptListService.selectPostDetails(replaceDate(date));
// return mapList;
// }
/**
......
......@@ -341,6 +341,34 @@ public class ReceiptApi {
public List<Map<String, Object>> queryPoliceName(@RequestParam("policeCode") String policeCode) {
return receiptService.queryPoliceName(policeCode);
}
/**
* 查询公安网数据
* 按交接时间
* @param startDate 开始时间
* @param endDate 结束时间
* @return
*/
@RequestMapping("queryPoliceData")
public List<Map<String, Object>> queryPoliceData(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate) {
return receiptService.selectPoliceData(replaceDate(startDate),replaceDate(endDate));
}
/**
* 查询公安网数据(历史)
* 按下载时间
* @param startDate 开始时间
* @param endDate 结束时间
* @return
*/
@RequestMapping("queryPoliceDataByDownLoadDate")
public List<Map<String, Object>> queryPoliceDataByDownLoadDate(@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate) {
return receiptService.selectPoliceDataByDownLoadDate(replaceDate(startDate),replaceDate(endDate));
}
/**
* 字符串去除空格
*
......
......@@ -311,10 +311,10 @@ 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;
}
// if (groupNoEntity.getValidCount()==1){
// taskListService.deleteRedoTask(groupNoEntity.getTaskId());
// break;
// }
groupNoEntity.setSpecialCardCount(groupNoEntity.getSpecialCardCount() + 1);
groupNoService.updateGroupNoSpecialCount(groupNoEntity);
}
......@@ -333,6 +333,13 @@ public class TaskListApi {
specialCardEntity.setGroupNo(acceptNo.substring(0, 8));
specialCardEntity.setTaskId(taskEntity.getTaskId());
specialCardService.saveSpecialCard(specialCardEntity);
for (GroupNoEntity groupNoEntity : groupNoEntities) {
if (groupNoEntity.getValidCount()==1){
taskListService.deleteRedoTask(groupNoEntity.getTaskId());
break;
}
}
}
}
}
......
package com.yxproject.start.entity;
import javax.persistence.*;
import java.sql.Time;
import java.util.Date;
import java.util.Objects;
/**
* @auther zhangyusheng
* 2019/4/9 10:39
* 2019/5/30 14:55
*/
@Entity
@Table(name = "RECEIPT_LIST", schema = "YINGXIN", catalog = "")
public class ReceiptListEntity {
private long id;
private String qrCode;
private Time receiptDate;
private Date receiptDate;
private String policeCode;
private Long finishCount;
private Time checkDate;
private Date checkDate;
private String checkName;
private long state;
private Long cardTypeId;
private Long oldCardTypeId;
private long isPrint;
private Date downloadDate;
private String downloadName;
@Id
@Column(name = "ID")
......@@ -45,11 +47,11 @@ public class ReceiptListEntity {
@Basic
@Column(name = "RECEIPT_DATE")
public Time getReceiptDate() {
public Date getReceiptDate() {
return receiptDate;
}
public void setReceiptDate(Time receiptDate) {
public void setReceiptDate(Date receiptDate) {
this.receiptDate = receiptDate;
}
......@@ -75,11 +77,11 @@ public class ReceiptListEntity {
@Basic
@Column(name = "CHECK_DATE")
public Time getCheckDate() {
public Date getCheckDate() {
return checkDate;
}
public void setCheckDate(Time checkDate) {
public void setCheckDate(Date checkDate) {
this.checkDate = checkDate;
}
......@@ -133,6 +135,25 @@ public class ReceiptListEntity {
this.isPrint = isPrint;
}
@Basic
@Column(name = "DOWNLOAD_DATE")
public Date getDownloadDate() {
return downloadDate;
}
public void setDownloadDate(Date downloadDate) {
this.downloadDate = downloadDate;
}
@Basic
@Column(name = "DOWNLOAD_NAME")
public String getDownloadName() {
return downloadName;
}
public void setDownloadName(String downloadName) {
this.downloadName = downloadName;
}
@Override
public boolean equals(Object o) {
......@@ -149,11 +170,13 @@ public class ReceiptListEntity {
Objects.equals(checkDate, that.checkDate) &&
Objects.equals(checkName, that.checkName) &&
Objects.equals(cardTypeId, that.cardTypeId) &&
Objects.equals(oldCardTypeId, that.oldCardTypeId);
Objects.equals(oldCardTypeId, that.oldCardTypeId) &&
Objects.equals(downloadDate, that.downloadDate) &&
Objects.equals(downloadName, that.downloadName);
}
@Override
public int hashCode() {
return Objects.hash(id, qrCode, receiptDate, policeCode, finishCount, checkDate, checkName, state, cardTypeId, oldCardTypeId, isPrint);
return Objects.hash(id, qrCode, receiptDate, policeCode, finishCount, checkDate, checkName, state, cardTypeId, oldCardTypeId, isPrint, downloadDate, downloadName);
}
}
......@@ -17,16 +17,28 @@ import java.util.Map;
public interface DetailReceiptListMapper {
/**
* 查询导出制证数据
* @param date
* @return
*/
@Select("select DETAIL_RECEIPT_LIST.id,DETAIL_RECEIPT_LIST.ACCEPT_NO,DETAIL_RECEIPT_LIST.NAME,DETAIL_RECEIPT_LIST.UPLOAD_NO,\n" +
"DETAIL_RECEIPT_LIST.sex,DETAIL_RECEIPT_LIST.CARD_ID,DETAIL_RECEIPT_LIST.POLICE_CODE,\n" +
"to_char(RECEIPT_LIST.CHECK_DATE,'yyyyMMdd') CHECK_DATE,RECEIPT_LIST.CHECK_NAME,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.OLD_CARD_TYPE_ID,PERSON_POST.WAYBILL_NUMBER,DETAIL_RECEIPT_LIST.note\n" +
"to_char(RECEIPT_LIST.CHECK_DATE,'yyyyMMdd') CHECK_DATE,RECEIPT_LIST.CHECK_NAME,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.OLD_CARD_TYPE_ID,PERSON_POST.WAYBILL_NUMBER,DETAIL_RECEIPT_LIST.note,RECEIPT_LIST.QR_CODE \n" +
"from DETAIL_RECEIPT_LIST left join RECEIPT_LIST on DETAIL_RECEIPT_LIST.RECEIPT_ID = RECEIPT_LIST.ID\n" +
"left join PERSON_POST on PERSON_POST.FIRST_WHITE = DETAIL_RECEIPT_LIST.UPLOAD_NO\n" +
"where to_char(RECEIPT_LIST.CHECK_DATE,'yyyyMMdd') =#{date}")
public List<Map<String,Object>> selectPostDetails(String date);
"where RECEIPT_LIST.id in (${str}) " +
" and RECEIPT_LIST.CARD_TYPE_ID = ${typeCode} order by DETAIL_RECEIPT_LIST.ACCEPT_NO " +
"")
public List<Map<String,Object>> selectPostDetails(@Param("str")String str, @Param("typeCode")long typeCode);
/**
* 更新下载公安网数据
* @return
*/
@Update("update RECEIPT_LIST set DOWNLOAD_DATE = sysdate ,DOWNLOAD_NAME = #{name}\n" +
"where RECEIPT_LIST.id in (${str}) ")
public List<Map<String,Object>> updateReceiptListEntityByCardId(@Param("str")String str, @Param("name")String name);
/**
* 查询详单信息
......
......@@ -200,7 +200,7 @@ public interface ReceiptMapper {
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID)\n" +
"left join GAJG_DM on GAJG_DM.GAJG_DM = RECEIPT_LIST.POLICE_CODE\n" +
"left join COUNTY_DIC on substr(RECEIPT_LIST.POLICE_CODE,0,6) = COUNTY_DIC.COUNTY_CODE" +
" where state =1 " +
" where is_print =0 " +
"<if test ='startDate != null'> " +
"and to_char(CHECK_DATE,'yyyyMMddhhmmss') BETWEEN ${startDate} and ${endDate} " +
"</if>" +
......@@ -256,6 +256,21 @@ public interface ReceiptMapper {
@Select("select * from DETAIL_RECEIPT_LIST where ACCEPT_NO =#{acceptNo} ")
public List<DetailReceiptListEntity> queryReceipt(String acceptNo);
@Select("select RECEIPT_LIST.id,QR_CODE,to_char(receipt_date,'yyyyMMddHH24') receipt_date ,\n" +
"POLICE_CODE,FINISH_COUNT,RECEIPT_LIST.CARD_TYPE_ID,GAJG_DM.GAJG_MC,CARD_TYPE_DIC.CARD_TYPE\n" +
"from RECEIPT_LIST \n" +
"left join GAJG_DM on GAJG_DM.GAJG_DM = RECEIPT_LIST.POLICE_CODE\n" +
"left join CARD_TYPE_DIC on RECEIPT_LIST.CARD_TYPE_ID = CARD_TYPE_DIC.CARD_TYPE_ID\n" +
"where DOWNLOAD_DATE is null and to_char(receipt_date,'yyyyMMddhh24') BETWEEN #{startDate} and #{endDate}")
public List<Map<String, Object>> selectPoliceData(@Param("startDate") String startDate,@Param("endDate") String endDate);
@Select("select RECEIPT_LIST.id,QR_CODE,to_char(DOWNLOAD_DATE,'yyyyMMddHH24') receipt_date ,\n" +
"POLICE_CODE,FINISH_COUNT,RECEIPT_LIST.CARD_TYPE_ID,GAJG_DM.GAJG_MC,CARD_TYPE_DIC.CARD_TYPE\n" +
"from RECEIPT_LIST \n" +
"left join GAJG_DM on GAJG_DM.GAJG_DM = RECEIPT_LIST.POLICE_CODE\n" +
"left join CARD_TYPE_DIC on RECEIPT_LIST.CARD_TYPE_ID = CARD_TYPE_DIC.CARD_TYPE_ID\n" +
"where to_char(DOWNLOAD_DATE,'yyyyMMddhh24') BETWEEN #{startDate} and #{endDate}")
public List<Map<String, Object>> selectPoliceDataByDownLoadDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
......
......@@ -10,7 +10,7 @@ import java.util.Map;
* 2019/3/9 14:55
*/
public interface DetailReceiptListService {
public List<Map<String,Object>> selectPostDetails(String date);
public List<Map<String,Object>> selectPostDetails(List<Integer> stringList,long typeCode,String name);
public List<DetailReceiptListEntity> selectDetailReceiptListEntityByCardId(String cardID);
......
......@@ -80,4 +80,8 @@ public interface ReceiptService {
public long saveReceiptList(ReceiptListEntity receiptListEntity);
public List<Map<String,Object>> selectPoliceData(String startDate,String endDate);
public List<Map<String,Object>> selectPoliceDataByDownLoadDate(String startDate,String endDate);
}
......@@ -19,10 +19,20 @@ public class DetailReceiptListServiceImpl implements DetailReceiptListService {
private DetailReceiptListMapper detailReceiptListMapper;
@Override
public List<Map<String, Object>> selectPostDetails(String date) {
return detailReceiptListMapper.selectPostDetails(date);
public List<Map<String, Object>> selectPostDetails(List<Integer> stringList,long typeCode,String name) {
String str ="";
for (int i =0;i<stringList.size();i++){
if (i==stringList.size()-1){
str+=stringList.get(i);
}else {
str+=stringList.get(i)+",";
}
}
// str+=")";
detailReceiptListMapper.updateReceiptListEntityByCardId(str,name);
return detailReceiptListMapper.selectPostDetails(str,typeCode);
}
@Override
public List<DetailReceiptListEntity> selectDetailReceiptListEntityByCardId(String cardID) {
return detailReceiptListMapper.selectDetailReceiptListEntityByCardId(cardID);
......
......@@ -265,6 +265,72 @@ public class ReceiptServiceImpl implements ReceiptService {
return receiptListEntity.getId();
}
@Override
public List<Map<String, Object>> selectPoliceData(String startDate, String endDate) {
List<Map<String, Object>> list = receiptMapper.selectPoliceData(startDate, endDate);
Map<String, Object> dateMap= new LinkedHashMap<>();
for (Map<String, Object> map :list){
if (dateMap.containsKey(map.get("RECEIPT_DATE")+"")){
List<Map<String,Object>> mapList = (List<Map<String,Object>>)dateMap.get(map.get("RECEIPT_DATE")+"");
mapList.add(map);
dateMap.put(map.get("RECEIPT_DATE")+"",mapList);
}else {
List<Map<String,Object>> mapList = new ArrayList<>();
mapList.add(map);
dateMap.put(map.get("RECEIPT_DATE")+"",mapList);
}
}
List<Map<String, Object>> dateList = new ArrayList<>();
for (String date :dateMap.keySet()){
List<Map<String,Object>> mapList =(List<Map<String,Object>>)dateMap.get(date);
Map<String,Object> map = new LinkedHashMap<>();
map.put("date",date);
int count = 0 ;
for (Map<String,Object> objectMap :mapList){
count+=Integer.valueOf(objectMap.get("FINISH_COUNT")+"");
}
map.put("list",mapList);
map.put("count",count);
dateList.add(map);
}
return dateList;
}
@Override
public List<Map<String, Object>> selectPoliceDataByDownLoadDate(String startDate, String endDate) {
List<Map<String, Object>> list = receiptMapper.selectPoliceDataByDownLoadDate(startDate, endDate);
Map<String, Object> dateMap= new LinkedHashMap<>();
for (Map<String, Object> map :list){
if (dateMap.containsKey(map.get("RECEIPT_DATE")+"")){
List<Map<String,Object>> mapList = (List<Map<String,Object>>)dateMap.get(map.get("RECEIPT_DATE")+"");
mapList.add(map);
dateMap.put(map.get("RECEIPT_DATE")+"",mapList);
}else {
List<Map<String,Object>> mapList = new ArrayList<>();
mapList.add(map);
dateMap.put(map.get("RECEIPT_DATE")+"",mapList);
}
}
List<Map<String, Object>> dateList = new ArrayList<>();
for (String date :dateMap.keySet()){
List<Map<String,Object>> mapList =(List<Map<String,Object>>)dateMap.get(date);
Map<String,Object> map = new LinkedHashMap<>();
map.put("date",date);
int count = 0 ;
for (Map<String,Object> objectMap :mapList){
count+=Integer.valueOf(objectMap.get("FINISH_COUNT")+"");
}
map.put("list",mapList);
map.put("count",count);
dateList.add(map);
}
return dateList;
}
private List<Map<String, Object>> formateMap(List<Map<String, Object>> maplist) {
Map<String, Object> typeMap = new LinkedHashMap<>();
for (Map o : maplist) {
......
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