|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
package com.dsideal.QingLong.Collect.Controller;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.YunXiao.SortClass;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.QingLong.Base.Model.BaseModel;
|
|
|
|
|
import com.dsideal.QingLong.Collect.Const.DataType;
|
|
|
|
|
import com.dsideal.QingLong.Collect.Model.CollectModel;
|
|
|
|
|
import com.dsideal.QingLong.Handler.RepeatIntercetpor;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.EmptyInterface;
|
|
|
|
@ -38,6 +40,9 @@ import java.net.URLEncoder;
|
|
|
|
|
import java.sql.*;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
public class CollectController extends Controller {
|
|
|
|
|
CollectModel cm = new CollectModel();
|
|
|
|
@ -1954,6 +1959,65 @@ public class CollectController extends Controller {
|
|
|
|
|
public void saveFormJob(int job_id, int status_code, String json) {
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
|
|
|
|
|
//检查form表单录入的text域,是不是符合输入要求,不符合的进行提示
|
|
|
|
|
Record rJob = cm.getJob(job_id);
|
|
|
|
|
String form_jsonStr = rJob.getStr("form_json");
|
|
|
|
|
//读取原来的结构,根据原来结构的类型进行判断,获取现在需要用什么样的读取方式
|
|
|
|
|
JSONArray ja = cm.parseGridJson(form_jsonStr);
|
|
|
|
|
Map<String, Integer> _map = new HashMap<>();
|
|
|
|
|
Map<String, String> _mapLabel = new HashMap<>();
|
|
|
|
|
for (int i = 0; i < ja.size(); i++) {
|
|
|
|
|
JSONObject j2 = ja.getJSONObject(i);
|
|
|
|
|
int data_type_id = DataType.getFormDataType(j2);
|
|
|
|
|
if (j2.getString("tag").equals("input")) {
|
|
|
|
|
_map.put(j2.getString("id"), data_type_id);//哪个字段是什么类型
|
|
|
|
|
_mapLabel.put(j2.getString("id"), j2.getString("label"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//开始检查
|
|
|
|
|
JSONObject jo = JSONObject.parseObject(json);
|
|
|
|
|
for (Map.Entry<String, Object> entry : jo.entrySet()) {
|
|
|
|
|
String key = entry.getKey();
|
|
|
|
|
int data_type_id = _map.get(key);
|
|
|
|
|
String value=entry.getValue().toString();
|
|
|
|
|
switch (data_type_id) {
|
|
|
|
|
case 0:
|
|
|
|
|
continue;
|
|
|
|
|
case 1://文本
|
|
|
|
|
break;
|
|
|
|
|
case 2://数字
|
|
|
|
|
if (!CommonUtil.isNumeric(value)) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("success", false);
|
|
|
|
|
map.put("message", _mapLabel.get(key) + "中输入的数据与要求的整数格式不一致,请重新输入!");
|
|
|
|
|
renderJson(map);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3://小数
|
|
|
|
|
if(!CommonUtil.isDecimal(value)){
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("success", false);
|
|
|
|
|
map.put("message", _mapLabel.get(key) + "中输入的数据与要求的小数格式不一致,请重新输入!");
|
|
|
|
|
renderJson(map);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4: //日期
|
|
|
|
|
if(!CommonUtil.isDate(value)){
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("success", false);
|
|
|
|
|
map.put("message", _mapLabel.get(key) + "中输入的数据与要求的日期格式不一致,请重新输入!");
|
|
|
|
|
renderJson(map);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|