|
|
|
@ -3,11 +3,13 @@ package com.dsideal.QingLong.Collect.Controller;
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.QingLong.Base.Model.BaseModel;
|
|
|
|
|
import com.dsideal.QingLong.Collect.Model.CollectModel;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.EmptyInterface;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.IsLoginInterface;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.IsNumericInterface;
|
|
|
|
|
import com.dsideal.QingLong.LoginPerson.Model.LoginPersonModel;
|
|
|
|
|
import com.dsideal.QingLong.Util.AsposeUtil;
|
|
|
|
|
import com.dsideal.QingLong.Util.CommonUtil;
|
|
|
|
|
import com.dsideal.QingLong.Util.SessionKit;
|
|
|
|
|
import com.jfinal.aop.Before;
|
|
|
|
@ -25,8 +27,10 @@ import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
@ -326,8 +330,6 @@ public class CollectController extends Controller {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:用户导入数据
|
|
|
|
|
*
|
|
|
|
|
* @param job_id
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -483,7 +485,7 @@ public class CollectController extends Controller {
|
|
|
|
|
cm.importData(upload_excel_filename, wb, i, bureau_id, person_id);
|
|
|
|
|
|
|
|
|
|
//回写完成标记
|
|
|
|
|
cm.writeJobFinish(job_id,bureau_id,upload_excel_filename_user);
|
|
|
|
|
cm.writeJobFinish(job_id, bureau_id, upload_excel_filename_user);
|
|
|
|
|
|
|
|
|
|
//关闭Excel
|
|
|
|
|
wb.close();
|
|
|
|
@ -667,4 +669,50 @@ public class CollectController extends Controller {
|
|
|
|
|
map.put("message", "保存成功!");
|
|
|
|
|
renderJson(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:查看某个单位对于某个任务的填报情况
|
|
|
|
|
*
|
|
|
|
|
* @param job_id
|
|
|
|
|
* @param bureau_id
|
|
|
|
|
* @param type_id 1:EXCEL下载 2:PDF在线查看
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsNumericInterface({"job_id", "type_id"})
|
|
|
|
|
@EmptyInterface({"bureau_id"})
|
|
|
|
|
public void viewExcelFilledJob(int job_id, String bureau_id, int type_id) throws Exception {
|
|
|
|
|
// 获取任务名称
|
|
|
|
|
String job_name = cm.getJob(job_id).getStr("job_name");
|
|
|
|
|
// 获取单位名称
|
|
|
|
|
BaseModel bm = new BaseModel();
|
|
|
|
|
String bureau_name = bm.getOrgInfoById(bureau_id).getStr("org_name");
|
|
|
|
|
|
|
|
|
|
//文件名称
|
|
|
|
|
String excel_filename = job_name + "【" + bureau_name + "】.xlsx";
|
|
|
|
|
String pdf_filename = job_name + "【" + bureau_name + "】.pdf";
|
|
|
|
|
|
|
|
|
|
//1、找到upload_excel_filename_user
|
|
|
|
|
Record record = cm.viewFilledJob(job_id, bureau_id);
|
|
|
|
|
String upload_excel_filename_user = record.getStr("upload_excel_filename_user");
|
|
|
|
|
if (StrKit.isBlank(upload_excel_filename_user)) {
|
|
|
|
|
Kv kv = Kv.by("success", false);
|
|
|
|
|
kv.set("message", "此单位还没有完成数据上报,无法展示填报情况!");
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String basePath = CommonUtil.getClassPath() + File.separator + "Excel";
|
|
|
|
|
String excelPath = basePath + File.separator + upload_excel_filename_user;
|
|
|
|
|
//2、提供EXCEL
|
|
|
|
|
if (type_id == 1) {
|
|
|
|
|
renderFile(new File(excelPath), excel_filename);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//3、提供PDF
|
|
|
|
|
if (type_id == 2) {
|
|
|
|
|
String pdfPath = excelPath.replace(".xlsx", ".pdf");
|
|
|
|
|
AsposeUtil.xls2pdf(excelPath, pdfPath);
|
|
|
|
|
renderFile(new File(excelPath), pdf_filename);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|