|
|
|
@ -10,15 +10,13 @@ import com.dsideal.QingLong.Interceptor.IsLoginInterface;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.IsNumericInterface;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.LayUiPageInfoInterface;
|
|
|
|
|
import com.dsideal.QingLong.LoginPerson.Model.LoginPersonModel;
|
|
|
|
|
import com.dsideal.QingLong.Util.AsposeUtil;
|
|
|
|
|
import com.dsideal.QingLong.Util.CommonUtil;
|
|
|
|
|
import com.dsideal.QingLong.Util.PoiUtil;
|
|
|
|
|
import com.dsideal.QingLong.Util.SessionKit;
|
|
|
|
|
import com.dsideal.QingLong.Util.*;
|
|
|
|
|
import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
import com.jfinal.ext.interceptor.GET;
|
|
|
|
|
import com.jfinal.ext.interceptor.POST;
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
|
import com.jfinal.kit.PathKit;
|
|
|
|
|
import com.jfinal.kit.PropKit;
|
|
|
|
|
import com.jfinal.kit.StrKit;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
@ -706,7 +704,7 @@ public class CollectController extends Controller {
|
|
|
|
|
@EmptyInterface({"deadline_time"})
|
|
|
|
|
public void publishJob(int job_id, String deadline_time, int shiZhiSchool,
|
|
|
|
|
int shiZhiJiaoFu, int quXiaoJiaoYuJu, String bureauIds, String groupIds) throws ParseException {
|
|
|
|
|
cm.publishJob(job_id, deadline_time, shiZhiSchool, shiZhiJiaoFu, quXiaoJiaoYuJu, bureauIds,groupIds);
|
|
|
|
|
cm.publishJob(job_id, deadline_time, shiZhiSchool, shiZhiJiaoFu, quXiaoJiaoYuJu, bureauIds, groupIds);
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("success", true);
|
|
|
|
|
map.put("message", "保存成功!");
|
|
|
|
@ -876,6 +874,70 @@ public class CollectController extends Controller {
|
|
|
|
|
|
|
|
|
|
/***** 以下为Form表单式填报模块 *********************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:Form表单上传图片或其它附件
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
public void uploadFile() {
|
|
|
|
|
UploadFile uf = getFile();//得到文件对象
|
|
|
|
|
String fileName = uf.getFileName();
|
|
|
|
|
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1).trim();
|
|
|
|
|
if (!suffix.equals("doc") && !suffix.equals("docx")
|
|
|
|
|
&& !suffix.equals("xls") && !suffix.equals("xlsx")
|
|
|
|
|
&& !suffix.equals("pdf")
|
|
|
|
|
&& !suffix.equals("jpg") && !suffix.equals("jpeg") && !suffix.equals("png")) {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, "上传文件类型错误!系统只允许上传文档和图片格式!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//判断文件大小大于20mb则返回错误信息,并终止上传,删除上传文件
|
|
|
|
|
long size = uf.getFile().length();
|
|
|
|
|
if (size > 1024 * 1024 * 20) {
|
|
|
|
|
Kv kv = Kv.by("success", false).set("message", "文件大小大于20MB,请检查是否正确!!");
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!FileUtil.exist(basePath)) FileUtil.mkdir(basePath);
|
|
|
|
|
String file_id = UUID.randomUUID().toString().toUpperCase();
|
|
|
|
|
String filePath = basePath + file_id + "." + suffix;
|
|
|
|
|
uf.getFile().renameTo(new File(filePath));
|
|
|
|
|
//计算文件大小
|
|
|
|
|
String file_size = FileSizeUtil.getAutoFileOrFilesSize(filePath);
|
|
|
|
|
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|
String bureau_id = rs.getStr("bureau_id");
|
|
|
|
|
int job_id = getInt("job_id");
|
|
|
|
|
String input_id = get("input_id");
|
|
|
|
|
//记录到数据库
|
|
|
|
|
cm.saveUploadFile(job_id, input_id, bureau_id, person_id, fileName, file_id, suffix, file_size);
|
|
|
|
|
//返回结果
|
|
|
|
|
Kv kv = Kv.by("success", true);
|
|
|
|
|
kv.set("message", "上传成功!");
|
|
|
|
|
kv.set("url", "/Excel/" + file_id + "." + suffix);
|
|
|
|
|
kv.set("file_id", file_id);
|
|
|
|
|
kv.set("file_size", file_size);
|
|
|
|
|
kv.set("fileName", fileName);
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取指定任务,指定单位(人员)上传的附件列表
|
|
|
|
|
*
|
|
|
|
|
* @param job_id
|
|
|
|
|
* @param input_id
|
|
|
|
|
* @param bureau_id
|
|
|
|
|
* @param person_id
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getJobUploadList(String job_id, String input_id, String bureau_id, String person_id) {
|
|
|
|
|
List<Record> list = cm.getJobUploadList(job_id, input_id, bureau_id, person_id);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:增加一个表单式的新任务
|
|
|
|
|
*
|
|
|
|
@ -904,7 +966,7 @@ public class CollectController extends Controller {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//检查字段名是否重复
|
|
|
|
|
if (cm.checkColumnNameDuplicate(json)) {
|
|
|
|
|
if (!cm.checkColumnNameDuplicate(json)) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("success", false);
|
|
|
|
|
map.put("message", "表名" + table_name + "中存在重复列名或与保留字冲突,不能创建,请检查!");
|
|
|
|
|