main
黄海 1 year ago
parent aacb6398cf
commit 5b967cdbdd

@ -19,16 +19,32 @@ public class TestHtml {
Document doc = Jsoup.parseBodyFragment(html);
Element body = doc.body();
Elements elements = body.getAllElements().getFirst().getElementsByTag("input");
for (int i = 0; i < elements.size(); i++) {
for (int i = 0; i < elements.size(); i += 3) {
/*
使
xx_ldjy_jsfl
xx_ldjy_js 666
xx_ldjy_jsfl_VOtzywtcmC BBB
xx_ldjy_js_VOtzywtcmC 999
* */
Element input = elements.get(i);
String input_name = input.attr("name");
if (input_name.split("_")[1].endsWith("mj")) {
System.out.print("mj ");
if (input.attr("value").trim().endsWith("其他")) {
Element input2 = elements.get(i + 1);
String v2 = input2.attr("value");
Element input3 = elements.get(i + 2);
String v3 = input3.attr("value");
System.out.println("lx_name=" + v2 + ",js=" + v3);
} else {
System.out.print("type_name ");
Element input3 = elements.get(i + 2);
String v3 = input3.attr("value");
System.out.println("lx_name=" + input.attr("value").trim() + ",js=" + v3);
}
String value = input.attr("value");
System.out.println(value);
}
return null;
}
@ -36,7 +52,7 @@ public class TestHtml {
public static void main(String[] args) {
//开始解析
String html = FileUtil.readUtf8String("C:\\Users\\Administrator\\Desktop\\Html\\创客.txt");
String html = FileUtil.readUtf8String("C:\\Users\\Administrator\\Desktop\\Html\\劳动.txt");
CkSave(html);

@ -303,7 +303,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(xx_kx)) {
//小学科学
xx_kx = Base64.decodeStr(xx_kx).replace("\n", "");
Record res = zm.JxSave(xx_kx, year, bureau_id);
Record res = zm.JxSave("xx_kx",xx_kx, year, bureau_id);
xx_kxsysshshu = res.getInt("sysshshu");
xx_kxqqrshshu = res.getInt("qqrshshu");
xx_kxzbrshshu = res.getInt("zbrshshu");
@ -317,7 +317,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(xx_yq)) {
// 小学音乐
xx_yq = Base64.decodeStr(xx_yq).replace("\n", "");
Record res = zm.JxSave(xx_yq, year, bureau_id);
Record res = zm.JxSave("xx_yq",xx_yq, year, bureau_id);
xx_yqjtrshshu = res.getInt("jtrshu");
xx_yqjtrmj = res.getFloat("jtrmj");
}
@ -327,7 +327,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(xx_ms)) {
//小学美术
xx_ms = Base64.decodeStr(xx_ms).replace("\n", "");
Record res = zm.JxSave(xx_ms, year, bureau_id);
Record res = zm.JxSave("xx_ms",xx_ms, year, bureau_id);
xx_msjtrshshu = res.getInt("jtrshu");
xx_msfsjtrshshu = res.getInt("fsjtrshu"); //普通教室,书法教室
xx_msjtrmj = res.getFloat("jtrmj");
@ -341,7 +341,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(cz_wl)) {
//初中物理
cz_wl = Base64.decodeStr(cz_wl).replace("\n", "");
Record res = zm.JxSave(cz_wl, year, bureau_id);
Record res = zm.JxSave("cz_wl",cz_wl, year, bureau_id);
cz_wllshshshu = res.getInt("sysshshu");
cz_wllyqshshu = res.getInt("qqrshshu");
cz_wllzbrshshu = res.getInt("zbrshshu");
@ -359,7 +359,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(cz_hx)) {
//初中化学
cz_hx = Base64.decodeStr(cz_hx).replace("\n", "");
Record res = zm.JxSave(cz_hx, year, bureau_id);
Record res = zm.JxSave("cz_hx",cz_hx, year, bureau_id);
cz_hxlshshshu = res.getInt("sysshshu");
cz_hxyqshshu = res.getInt("qqrshshu");
cz_hxzbrshshu = res.getInt("zbrshshu");
@ -377,7 +377,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(cz_sw)) {
//初中生物
cz_sw = Base64.decodeStr(cz_sw).replace("\n", "");
Record res = zm.JxSave(cz_sw, year, bureau_id);
Record res = zm.JxSave("cz_sw",cz_sw, year, bureau_id);
cz_swlshshshu = res.getInt("sysshshu");
cz_swyqshshu = res.getInt("qqrshshu");
cz_swzbrshshu = res.getInt("zbrshshu");
@ -393,7 +393,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(cz_yq)) {
//初中音乐
cz_yq = Base64.decodeStr(cz_yq).replace("\n", "");
Record res = zm.JxSave(cz_yq, year, bureau_id);
Record res = zm.JxSave("cz_yq",cz_yq, year, bureau_id);
cz_yqjtrshshu = res.getInt("jtrshu");
cz_yqjtrmj = res.getFloat("jtrmj");
}
@ -403,7 +403,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(cz_ms)) {
//初中美术
cz_ms = Base64.decodeStr(cz_ms).replace("\n", "");
Record res = zm.JxSave(cz_ms, year, bureau_id);
Record res = zm.JxSave("cz_ms",cz_ms, year, bureau_id);
cz_msjtrshshu = res.getInt("jtrshu");
cz_msfsjtrshshu = res.getInt("fsjtrshu"); //普通教室数量,书法教室数量
cz_msfsjtrmj = res.getFloat("jtrmj");
@ -418,7 +418,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(gz_wl)) {
//高中物理
gz_wl = Base64.decodeStr(gz_wl).replace("\n", "");
Record res = zm.JxSave(gz_wl, year, bureau_id);
Record res = zm.JxSave("gz_wl",gz_wl, year, bureau_id);
gz_wllshshshu = res.getInt("sysshshu");
gz_wllyqshshu = res.getInt("qqrshshu");
gz_wllzbrshshu = res.getInt("zbrshshu");
@ -437,7 +437,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(gz_hx)) {
//高中化学
gz_hx = Base64.decodeStr(gz_hx).replace("\n", "");
Record res = zm.JxSave(gz_hx, year, bureau_id);
Record res = zm.JxSave("gz_hx",gz_hx, year, bureau_id);
gz_hxlshshshu = res.getInt("sysshshu");
gz_hxyqshshu = res.getInt("qqrshshu");
gz_hxzbrshshu = res.getInt("zbrshshu");
@ -456,7 +456,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(gz_sw)) {
//高中生物
gz_sw = Base64.decodeStr(gz_sw).replace("\n", "");
Record res = zm.JxSave(gz_sw, year, bureau_id);
Record res = zm.JxSave("gz_sw",gz_sw, year, bureau_id);
gz_swlshshshu = res.getInt("sysshshu");
gz_swyqshshu = res.getInt("qqrshshu");
gz_swzbrshshu = res.getInt("zbrshshu");
@ -472,7 +472,7 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(gz_yq)) {
//高中音乐
gz_yq = Base64.decodeStr(gz_yq).replace("\n", "");
Record res = zm.JxSave(gz_yq, year, bureau_id);
Record res = zm.JxSave("gz_yq",gz_yq, year, bureau_id);
gz_yqjtrshshu = res.getInt("jtrshu");
gz_yqjtrmj = res.getFloat("jtrmj");
}
@ -483,33 +483,36 @@ public class ZbdcController extends Controller {
if (!StrKit.isBlank(gz_ms)) {
//高中美术
gz_ms = Base64.decodeStr(gz_ms).replace("\n", "");
Record res = zm.JxSave(gz_ms, year, bureau_id);
Record res = zm.JxSave("gz_ms",gz_ms, year, bureau_id);
gz_msjtrshshu = res.getInt("jtrshu");
gz_msjtrmj = res.getFloat("fsjtrmj");//普通教室面积,书法教室面积
}
// 保存
// 小学劳动教育
if (!StrKit.isBlank(xx_ldjy)) {
xx_ldjy = Base64.decodeStr(xx_ldjy).replace("\n", "");
zm.LdjySave("xx_ldjy",xx_ldjy, year, bureau_id);
}
// 初中劳动教育
if (!StrKit.isBlank(cz_ldjy)) {
cz_ldjy = Base64.decodeStr(cz_ldjy).replace("\n", "");
zm.LdjySave("cz_ldjy",cz_ldjy, year, bureau_id);
}
//小学创客
if (!StrKit.isBlank(xx_ck)) {
xx_ck = Base64.decodeStr(xx_ck).replace("\n", "");
zm.JxSave(xx_ck, year, bureau_id);
zm.JxSave("xx_ck",xx_ck, year, bureau_id);
}
//初中创客
if (!StrKit.isBlank(cz_ck)) {
cz_ck = Base64.decodeStr(cz_ck).replace("\n", "");
zm.JxSave(cz_ck, year, bureau_id);
zm.JxSave("cz_ck",cz_ck, year, bureau_id);
}
//高中创客
if (!StrKit.isBlank(gz_ck)) {
gz_ck = Base64.decodeStr(gz_ck).replace("\n", "");
zm.JxSave(gz_ck, year, bureau_id);
zm.JxSave("gz_ck",gz_ck, year, bureau_id);
}
zm.saveCgzb(year, stage_id, bureau_id, bureau_name, school_type_name, xx_kxsysshshu,

@ -2686,7 +2686,7 @@ public class ZbdcModel {
* @param bureau_id
* @return
*/
public Record JxSave(String html, int year, String bureau_id) {
public Record JxSave(String xdkm, String html, int year, String bureau_id) {
//类型字典
Map<String, String> map = new HashMap<>();
map.put("sys", "实验室");
@ -2701,39 +2701,29 @@ public class ZbdcModel {
map.put("lsys", "实验室");
map.put("lsysjs", "实验室");
//区县
Map<String, Record> m = getSchoolAreaName();
//县区名称
String area_name = m.get(bureau_id).getStr("area_name");
String area_id = "";
if (area_name.equals("市直")) {
area_id = "0";
} else {
String sql = "select area_id from t_base_organization where org_id=?";
area_id = Db.findFirst(sql, bureau_id).getStr("area_id");
}
//获取区域ID和区域名称
Kv areaKv = getAreaIdAndName(bureau_id);
String area_id = areaKv.getStr("area_id");
String area_name = areaKv.getStr("area_name");
//学段科目
String xdkm = null;
//实验室,仪器室,准备室,书法教室,普通教室,探究实验室
int sysshshu = 0, qqrshshu = 0, zbrshshu = 0, fsjtrshu = 0, jtrshu = 0, tgsmjshu = 0;
double sysmj = 0, qqrsmj = 0, zbrsmj = 0, fsjtrmj = 0, jtrmj = 0, tgsmjmj = 0;
Document doc = Jsoup.parseBodyFragment(html);
Element body = doc.body();
Elements elements = body.getAllElements().getFirst().getElementsByTag("input");
List<Record> writeList = new ArrayList<>();
for (int i = 0; i < elements.size(); i++) {
//先删除后插入
String sql = "delete from t_zbdc_bureau_cgzb_detail where xdkm=? and year=? and bureau_id=?";
Db.update(sql, xdkm, year, bureau_id);
for (int i = 0; i < elements.size(); i++) {
Element input = elements.get(i);
String input_name = input.attr("name");
if (StrKit.isBlank(xdkm)) {
xdkm = input_name.substring(0, 5);//学段科目
//先删除后插入
String sql = "delete from t_zbdc_bureau_cgzb_detail where xdkm=? and year=? and bureau_id=?";
Db.update(sql, xdkm, year, bureau_id);
}
//去掉多余的最后面的随机数
String[] array = input_name.split("_");
@ -2811,4 +2801,94 @@ public class ZbdcModel {
record.set("tgsmjmj", tgsmjmj);//探究实验室总面积
return record;
}
/**
*
*
* @param bureau_id
* @return
*/
public static Map<String, Kv> areaMap = new HashMap<>();
/**
* ID
*
* @param bureau_id
* @return
*/
public Kv getAreaIdAndName(String bureau_id) {
if (areaMap.containsKey(bureau_id)) {
return areaMap.get(bureau_id);
}
//区县
Map<String, Record> m = getSchoolAreaName();
//县区名称
String area_name = m.get(bureau_id).getStr("area_name");
String area_id = "";
if (area_name.equals("市直")) {
area_id = "0";
} else {
String sql = "select area_id from t_base_organization where org_id=?";
area_id = Db.findFirst(sql, bureau_id).getStr("area_id");
}
Kv kv = Kv.by("area_id", area_id);
kv.set("area_name", area_name);
areaMap.put(bureau_id, kv);
return kv;
}
/**
*
*
* @param html
* @param year
* @param bureau_id
* @return
*/
public void LdjySave(String xdkm, String html, int year, String bureau_id) {
//获取区域ID和区域名称
Kv areaKv = getAreaIdAndName(bureau_id);
String area_id = areaKv.getStr("area_id");
String area_name = areaKv.getStr("area_name");
//先删除后插入
String sql = "delete from t_zbdc_bureau_cgzb_detail where xdkm=? and year=? and bureau_id=?";
Db.update(sql, xdkm, year, bureau_id);
Document doc = Jsoup.parseBodyFragment(html);
Element body = doc.body();
Elements elements = body.getAllElements().getFirst().getElementsByTag("input");
List<Record> writeList = new ArrayList<>();
String lx_name = "";
int js;
for (int i = 0; i < elements.size(); i += 3) {
Element input = elements.get(i);
if (input.attr("value").trim().endsWith("其他")) {
Element input2 = elements.get(i + 1);
String v2 = input2.attr("value");
Element input3 = elements.get(i + 2);
String v3 = input3.attr("value");
lx_name = v2;
js = Integer.parseInt(v3);
} else {
Element input3 = elements.get(i + 2);
String v3 = input3.attr("value");
lx_name = input.attr("value").trim();
js = Integer.parseInt(v3);
}
Record r = new Record();
r.set("xdkm", xdkm);
r.set("lx_name", lx_name);
r.set("jsny", 0);
r.set("mj", 0);
r.set("js", js);
r.set("year", year);
r.set("bureau_id", bureau_id);
r.set("area_id", area_id);
r.set("area_name", area_name);
writeList.add(r);
}
Db.batchSave("t_zbdc_bureau_cgzb_detail", writeList, 100);
}
}
Loading…
Cancel
Save