|
|
|
@ -2,7 +2,6 @@ package com.dsideal.QingLong.Collect.Model;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.YunXiao.Model.BaseModel;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.QingLong.Collect.Const.DataTypeConst;
|
|
|
|
@ -271,6 +270,20 @@ public class CollectModel {
|
|
|
|
|
return Db.find(sql, job_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:建表时有哪些字段名是保留字,不能用的
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Set<String> getBlzColumn() {
|
|
|
|
|
Set<String> set = new HashSet<>();
|
|
|
|
|
set.add("id");//主键
|
|
|
|
|
set.add("bureau_id");//发布单位
|
|
|
|
|
set.add("person_id");//发布者
|
|
|
|
|
set.add("job_id");//任务号
|
|
|
|
|
return set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:指定任务+指定SheetIndex下,是不是存在字段名称重复的情况
|
|
|
|
|
*
|
|
|
|
@ -279,11 +292,29 @@ public class CollectModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> checkColumnNameDuplicate(int job_id, int sheet_index) {
|
|
|
|
|
Set<String> blzList = getBlzColumn();//检查是不是与保留字重复
|
|
|
|
|
String sql = "select column_name,count(1) as c from t_collect_job_sheet_col where job_id=? and sheet_index=? group by column_name having count(1)>1";
|
|
|
|
|
List<Record> list = Db.find(sql, job_id, sheet_index);
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
String column_name = record.getStr("column_name");
|
|
|
|
|
int c = record.getInt("c");
|
|
|
|
|
if (blzList.contains(column_name)) record.set(column_name, c + 1);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean checkColumnNameDuplicate(String json) {
|
|
|
|
|
Set<String> blzList = getBlzColumn();//检查是不是与保留字重复
|
|
|
|
|
JSONArray ja = JSONArray.parseArray(json);
|
|
|
|
|
for (Object o : ja) {
|
|
|
|
|
JSONObject jo = (JSONObject) o;
|
|
|
|
|
String column_name = jo.getString("id");//字段名
|
|
|
|
|
if (blzList.contains(column_name)) return false;
|
|
|
|
|
blzList.add(column_name);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:是不是指定任务的所有Sheet全部都确认通过
|
|
|
|
|
*
|
|
|
|
|