Commit 4833f3e9 authored by dahai's avatar dahai

添加查询交接单

添加更改交接单交接日期
parent b6fa0fd3
......@@ -31,11 +31,11 @@ public class ExportExcelApi {
List<Map<String, Object>> mapList = detailReceiptListService.selectPostDetails(replaceDate(date));
response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8");
String dateTime = DateFormatUtils.format(new Date(), "yyyyMMddHH");
String dateTime = DateFormatUtils.format(new Date(), "yyyy年MM月dd日");
// //使用Servlet实现文件下载的时候,避免浏览器自动打开文件
String fout = null;
fout = ExportExcel.exportExcelDate(mapList);
String outFile = dateTime + "myExcel";
String outFile = dateTime + "公安网数据";
try {
FileInputStream fis = new FileInputStream(new File(fout));
byte[] b = new byte[fis.available()];
......
......@@ -207,4 +207,43 @@ public class ReceiptApi {
return true;
}
/**
* 生成交接单
* @param receiptId
* @return
*/
@RequestMapping("updateReceiptDateByReceiptId")
public boolean updateReceiptDateByReceiptId(@RequestParam("receiptId")String receiptId){
try {
receiptService.updateReceiptDateByReceiptId(receiptId);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
/**
* 查询交接单
* @param date 复核时间
* @return
*/
@RequestMapping("queryReceiptDateByCheckDate")
public List<Map<String,Object>> queryReceiptDateByCheckDate(@RequestParam("date")String date){
return receiptService.selectReceiptDateByCheckDate(replaceDate(date));
}
/**
* 去除字符串中中线
*
* @param str
* @return
*/
private String replaceDate(String str) {
return str.replace("-", "");
}
}
......@@ -94,9 +94,11 @@ public interface ReceiptMapper {
"where id=#{receiptId}")
public boolean updateReceiptList(@Param("receiptId") String receiptId,@Param("checkName") String checkName,@Param("date") Date date);
//根据传入的交接单ID和复核人ID插入复核人、复核时间
@Update("update receipt_list set \n" +
"RECEIPT_DATE = sysdate \n" +
"where id=#{receiptId}")
public boolean updateReceiptDateByReceiptId(@Param("receiptId") String receiptId);
//根据输入id查询交接单是否生成
@Select("select count(*) from RECEIPT_LIST where QR_CODE=(select accept_no from prod_card_t@prod_link where id_no=#{id})")
......@@ -131,7 +133,16 @@ public interface ReceiptMapper {
"prod_trace_t.ELECTRIC_WRITE_DATE as electricDate\n" +
"from prod_trace_t@PROD_LINK \n" +
"WHERE subStr(ACCEPT_NO,0,8) = #{groupNo} or ACCEPT_NO=#{groupNo}")
public Map<String,Object>selectTimes(@Param("groupNo") String groupNo);
public Map<String,Object> selectTimes(@Param("groupNo") String groupNo);
@Select("select RECEIPT_LIST.id,RECEIPT_LIST.QR_CODE,RECEIPT_LIST.RECEIPT_DATE,RECEIPT_LIST.POLICE_CODE,c1.CARD_TYPE_ID,\n" +
"c2.CARD_TYPE_ID CARD_TYPE2,RECEIPT_LIST.FINISH_COUNT,GAJG_DM.GAJG_DM,GAJG_DM.GAJG_MC,RECEIPT_LIST.CHECK_DATE,RECEIPT_LIST.CHECK_NAME\n" +
",COUNTY_DIC.COUNTY_CODE ,COUNTY_DIC.COUNTYNAME from RECEIPT_LIST left join CARD_TYPE_DIC c1 on c1.CARD_TYPE_ID = RECEIPT_LIST.CARD_TYPE_ID\n" +
"left join CARD_TYPE_DIC c2 on c2.CARD_TYPE_ID = RECEIPT_LIST.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 to_char(CHECK_DATE,'yyyyMMdd') = #{date}")
public List<Map<String,Object>> selectReceiptDateByCheckDate(@Param("date") String date);
}
......@@ -30,6 +30,10 @@ public interface ReceiptService {
public boolean updateReceiptList(String receiptId, String checkName, Date date);
public boolean updateReceiptDateByReceiptId(String receiptId);
public List<Map<String,Object>> selectReceiptDateByCheckDate(String date);
public int selectCount(String GROUP_NO);
public boolean updateFinishCount(String GROUP_NO,int count);
......
......@@ -5,9 +5,7 @@ import com.yxproject.start.service.ReceiptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service
public class ReceiptServiceImpl implements ReceiptService {
......@@ -81,6 +79,11 @@ public class ReceiptServiceImpl implements ReceiptService {
receiptMapper.updateReceiptList(receiptId, checkName, date);
return true;
}
@Override
public boolean updateReceiptDateByReceiptId(String receiptId) {
receiptMapper.updateReceiptDateByReceiptId(receiptId);
return true;
}
@Override
public int selectCount(String GROUP_NO) {
......@@ -129,4 +132,92 @@ public class ReceiptServiceImpl implements ReceiptService {
Map<String, Object> maps = receiptMapper.selectTimes(groupNo);
return maps;
}
@Override
public List<Map<String, Object>> selectReceiptDateByCheckDate(String date) {
List<Map<String, Object>> mapList = receiptMapper.selectReceiptDateByCheckDate(date);
List<Map<String, Object>> mapList1 = formateMap(mapList);
return mapList1;
}
private List<Map<String,Object>> formateMap(List<Map<String, Object>> mapList){
Map<String,Object> objectMap = new LinkedHashMap<>();
for (Map<String,Object> map :mapList){
if (objectMap!=null&&objectMap.containsKey(map.get("COUNTY_CODE")+"")){
List<Map<String,Object>> maps = (List<Map<String,Object>>) objectMap.get(map.get("COUNTY_CODE")+"");
maps.add(map);
objectMap.put(map.get("COUNTY_CODE")+"",maps);
}else {
List<Map<String,Object>> maps = new ArrayList<>();
maps.add(map);
objectMap.put(map.get("COUNTY_CODE")+"",maps);
}
}
List<Map<String,Object>> countyMapList = new ArrayList<>();
for (String countyCode:objectMap.keySet()){
Map<String,Object> countyMap = new LinkedHashMap<>();
String countyName =null;
List<Map<String,Object>> policeMapList = new ArrayList<>();
List<Map<String,Object>> maps = (List<Map<String,Object>>) objectMap.get(countyCode);
Map<String,Object> policeMap = new LinkedHashMap<>();
for (Map<String,Object> map :maps){
countyName = map.get("COUNTYNAME")+"";
if (policeMap != null&&policeMap.containsKey(map.get("POLICE_CODE")+"")){
List<Map<String,Object>> policeMapList2= (List<Map<String,Object>>) policeMap.get(map.get("POLICE_CODE")+"");
policeMapList2.add(map);
policeMap.put(map.get("POLICE_CODE")+"",policeMapList2);
}else {
List<Map<String,Object>> policeMapList2= new ArrayList<>();
policeMapList2.add(map);
policeMap.put(map.get("POLICE_CODE")+"",policeMapList2);
}
}
for (String policeCode : policeMap.keySet()){
List<Map<String,Object>> policeList= (List<Map<String,Object>>) policeMap.get(policeCode);
Map<String,Object> policemap = new LinkedHashMap<>();
String GAJG_MC = null;
String CHECK_DATE =null;
String CHECK_NAME =null;
int youSum =0;
int puSum =0;
for (Map<String,Object> map :policeList){
GAJG_MC =map.get("GAJG_MC")+"";
CHECK_DATE =map.get("CHECK_DATE")+"";
CHECK_NAME =map.get("CHECK_NAME")+"";
if ("null".equals(map.get("CARD_TYPE2"))){
if ("9".equals(map.get("CARD_TYPE_ID")+"")){
youSum+=Integer.parseInt(map.get("FINISH_COUNT")+"");
}else {
puSum+=Integer.parseInt(map.get("FINISH_COUNT")+"");
}
}else {
if ("9".equals(map.get("CARD_TYPE2")+"")){
youSum+=Integer.parseInt(map.get("FINISH_COUNT")+"");
}else {
puSum+=Integer.parseInt(map.get("FINISH_COUNT")+"");
}
}
}
policemap.put("youSum",youSum);
policemap.put("puSum",puSum);
policemap.put("checkName",CHECK_NAME);
policemap.put("checkDate",CHECK_DATE);
policemap.put("policeName",GAJG_MC);
policemap.put("policeCode",policeCode);
policeMapList.add(policemap);
}
countyMap.put("policeList",policeMapList);
countyMap.put("countyName",countyName);
countyMap.put("countyCode",countyCode);
countyMapList.add(countyMap);
}
return countyMapList;
}
}
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