Commit 7fd4b2db authored by suichenguang's avatar suichenguang

Merge remote-tracking branch 'origin/dev' into dev

parents e7da1068 7c87b287
......@@ -63,9 +63,11 @@ public class ExportExcelApi {
@RequestMapping("printReceiptExcelData")
public byte[] printReceiptExcelData(@RequestBody String list, HttpServletResponse response){
JSONObject jsonObject = JSONObject.fromObject(list);
JSONArray jsonArray = JSONArray.fromObject(jsonObject);
// List<Map<String, Object>> mapList = receiptService.;
List<Map<String, Object>> mapList = new ArrayList<>();
JSONArray jsonArray = JSONArray.fromObject(jsonObject.get("list"));
String date = jsonObject.get("date").toString();
String type = jsonObject.get("type").toString();
List<Map<String, Object>> mapList = receiptService.selectReceiptList(jsonArray,replaceDate(date),Long.valueOf(type));
// List<Map<String, Object>> mapList = new ArrayList<>();
response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8");
String dateTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd");
......
......@@ -137,6 +137,15 @@ public interface ReceiptMapper {
" where to_char(CHECK_DATE,'yyyyMMdd') = #{date}")
public List<Map<String,Object>> selectReceiptDateByCheckDate(@Param("date") String date);
@Select("select RECEIPT_LIST.id,RECEIPT_LIST.QR_CODE,RECEIPT_LIST.RECEIPT_DATE,RECEIPT_LIST.POLICE_CODE,decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID) CARD_TYPE_ID,\n" +
"RECEIPT_LIST.FINISH_COUNT,GAJG_DM.GAJG_DM,GAJG_DM.GAJG_MC,RECEIPT_LIST.CHECK_DATE,RECEIPT_LIST.CHECK_NAME\n" +
",CARD_TYPE_DIC.CARD_TYPE,COUNTY_DIC.COUNTY_CODE ,COUNTY_DIC.COUNTYNAME from RECEIPT_LIST \n" +
"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 to_char(CHECK_DATE,'yyyyMMdd') = #{date} and RECEIPT_LIST.id in (string) and CARD_TYPE_DIC.CARD_TYPE_ID=#{type} ")
public List<Map<String,Object>> selectReceiptDate(@Param("date") String date,@Param("string") String string,@Param("type") long type);
@Select("select * from DETAIL_RECEIPT_LIST where ACCEPT_NO=#{acceptNo} or card_id=#{acceptNo}")
public DetailReceiptListEntity selectDetailByAcceptNo(@Param("acceptNo") String acceptNo);
......
......@@ -62,4 +62,6 @@ public interface ReceiptService {
public boolean updateDetail(@Param("acceptNo")String accept,@Param("note")String note);
public List<Map<String,Object>> selectReceiptList(List<String> stringList,String date,long typeCode);
}
......@@ -153,6 +153,19 @@ public class ReceiptServiceImpl implements ReceiptService {
return mapList1;
}
@Override
public List<Map<String, Object>> selectReceiptList(List<String> stringList, String date, long typeCode) {
String str = null;
for (int i =0;i<stringList.size();i++){
if (i!=stringList.size()-1){
str+=stringList.get(i);
}else {
str+=stringList.get(i)+",";
}
}
return receiptMapper.selectReceiptDate(date,str,typeCode);
}
private List<Map<String, Object>> formateMap(List<Map<String, Object>> maplist) {
Map<String, Object> typeMap = new LinkedHashMap<>();
......
......@@ -120,4 +120,69 @@ public class ExportExcel {
}
/**
* 导出交接单信息
* @param mapList 交接单信息
* @return
*/
public static String exportReceiptExcelDate(List<Map<String,Object>> mapList){
//第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
HSSFSheet sheet = wb.createSheet("交接单信息表");
sheet.setColumnWidth(0, 30 * 110);
sheet.setColumnWidth(1, 30 * 110);
sheet.setColumnWidth(2, 30 * 110);
sheet.setColumnWidth(3, 30 * 110);
sheet.setColumnWidth(4, 30 * 110);
//第三步创建行row:添加表头0行
HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();//样式
style.setWrapText(true);//设置自动换行
HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 12);
style.setFont(font);
row = sheet.createRow(0); //创建下标为0的单元格
row.setHeightInPoints(Short.parseShort("20"));//设置行高
HSSFCell cell = row.createCell(0); //设定值
cell.setCellValue("序号");
cell = row.createCell(1); //设定值
cell.setCellValue("身份证受理组号");
cell = row.createCell(2); //设定值
cell.setCellValue("身份证所属派出所");
cell = row.createCell(3); //设定值
cell.setCellValue("数量");
cell = row.createCell(4); //设定值
cell.setCellValue("备注");
for (int i =0;i<mapList.size();i++){
row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值
cell.setCellValue((i+1)+"");
cell = row.createCell(1); //设定值
cell.setCellValue("null".equals(mapList.get(i).get("QR_CODE")+"")?"":mapList.get(i).get("QR_CODE")+"");
cell = row.createCell(2); //设定值
cell.setCellValue("null".equals(mapList.get(i).get("GAJG_MC")+"")?"":mapList.get(i).get("GAJG_MC")+"");
cell = row.createCell(3); //设定值
cell.setCellValue("null".equals(mapList.get(i).get("FINISH_COUNT")+"")?"":mapList.get(i).get("FINISH_COUNT")+"");
cell = row.createCell(4); //设定值
cell.setCellValue("");
}
//第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null;
try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "公安网信息表" + ".xls");
wb.write(fout);
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "交接单" + ".xls";
}
}
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