From d6e9cf67831e341480c242c9127403d216e647bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Sat, 22 Jun 2024 08:37:41 +0800 Subject: [PATCH] 'commit' --- .../Zbdc/Controller/ZbdcController.java | 16 +++- .../QingLong/Zbdc/Model/ZbdcModel.java | 73 ++++++++++++++++++- 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/dsideal/QingLong/Zbdc/Controller/ZbdcController.java b/src/main/java/com/dsideal/QingLong/Zbdc/Controller/ZbdcController.java index 8294cf0a..4293bf52 100644 --- a/src/main/java/com/dsideal/QingLong/Zbdc/Controller/ZbdcController.java +++ b/src/main/java/com/dsideal/QingLong/Zbdc/Controller/ZbdcController.java @@ -997,5 +997,19 @@ public class ZbdcController extends Controller { renderJson(CommonUtil.renderJsonForLayUI(list)); } - //public void Check + /** + * 功能:查看审核上报详细日志 (区域) + */ + @IsLoginInterface({}) + public void CheckViewByArea(int year) { + if (year == 0) year = DateTime.now().year();//如果没有传入获取的年份,那么就是系统的默认当前年份 + //审核单位ID + String bureau_id = SessionKit.get(getRequest(), getResponse(), "bureau_id"); + //隶属区域 + String area_id = zm.getAreaByBureauId(bureau_id); + Record record = zm.CheckViewByArea(year, area_id); + Kv kv = Kv.by("success", true); + kv.set("data", record); + renderJson(kv); + } } diff --git a/src/main/java/com/dsideal/QingLong/Zbdc/Model/ZbdcModel.java b/src/main/java/com/dsideal/QingLong/Zbdc/Model/ZbdcModel.java index 7ba604dc..be9238db 100644 --- a/src/main/java/com/dsideal/QingLong/Zbdc/Model/ZbdcModel.java +++ b/src/main/java/com/dsideal/QingLong/Zbdc/Model/ZbdcModel.java @@ -2188,12 +2188,23 @@ public class ZbdcModel { if (org_type_id == 9 || org_type_id == 16) { //市直属中小学,区属中小学 report_level = 1;//是学校上报的 } + //是不是退回重新提交? + int is_tuihui_commit = 0;//默认不是退回重新提交 + sql = "select check_type_id from t_zbdc_report where year=? and b_use=1 and bureau_id=?"; + Record r = Db.findFirst(sql, year, bureau_id); + if (r != null && r.getInt("check_type_id") == -1) { + is_tuihui_commit = 1;//确认是退回重新提交的数据 + } + //以前的都修改为不是当前状态,现在是全新上报 sql = "update t_zbdc_report set b_use=0 where bureau_id=? and year=?"; Db.update(sql, bureau_id, year); + + //插入数据 - sql = "insert into t_zbdc_report(bureau_id,bureau_name,year,area_id,area_name,report_level,update_ts,b_use,check_type_id) values(?,?,?,?,?,?,now(),1,2)"; - Db.update(sql, bureau_id, bureau_name, year, area_id, area_name, report_level); + sql = "insert into t_zbdc_report(bureau_id,bureau_name,year,area_id,area_name,report_level,update_ts,b_use,check_type_id,is_tuihui_commit) values(?,?,?,?,?,?,now(),1,2,?)"; + Db.update(sql, bureau_id, bureau_name, year, area_id, area_name, report_level, is_tuihui_commit); + } /** @@ -2339,4 +2350,62 @@ public class ZbdcModel { return jo; } + /** + * 功能:根据单位ID获取区域的ID + * + * @param burea_id + * @return + */ + public String getAreaByBureauId(String burea_id) { + String sql = "select area_id from t_base_organization where org_id=?"; + return Db.findFirst(sql, burea_id).getStr("area_id"); + } + + /** + * 功能:查看审核上报详细日志 (区域) + */ + public Record CheckViewByArea(int year, String area_id) { + Record record = new Record(); + record.set("name", year + "年装备信息"); + //状态 + String sql = "select check_type_id from t_zbdc_report where year=? and area_id=? and b_use=1 and report_level=2"; + Record r = Db.findFirst(sql, year, area_id); + if (r == null) {//如果不存在上报记录 + record.set("check_type_id", 0); + record.set("check_type_name", "待上报"); + } else { + int check_type_id = r.getInt("check_type_id"); + record.set("check_type_id", check_type_id); + if (check_type_id == 1) { + record.set("check_type_name", "通过"); + } else if (check_type_id == -1) { + record.set("check_type_name", "退回"); + } else if (check_type_id == 2) { + record.set("check_type_name", "待审核"); + } + } + //应提交数量 + sql = "select count(1) as c from t_base_organization where area_id=? and org_id=bureau_id and org_type_id=16 and b_use=1"; + int c = Db.findFirst(sql, area_id).getInt("c"); + record.set("yingtijiao_count", c); + //已提交数量 + sql = "select count(1) as c from t_zbdc_report where year=? and area_id=? and report_level=1 and b_use=1 and check_type_id=2"; + c = Db.findFirst(sql, year, area_id).getInt("c"); + record.set("yitijiao_count", c); + + //退回未提交数 + sql = "select count(1) as c from t_zbdc_report where year=? and area_id=? and report_level=1 and b_use=1 and check_type_id=-1"; + c = Db.findFirst(sql, year, area_id).getInt("c"); + record.set("tuihuiweitijiao_count", c); + + //退回已提交数 + sql = "select count(1) as c from t_zbdc_report where year=? and area_id=? and report_level=1 and b_use=1 and check_type_id=2 and is_tuihui_commit=1"; + c = Db.findFirst(sql, year, area_id).getInt("c"); + record.set("tuihui_commit_count", c); + + //未提交数量 + int weitijiao_count = record.getInt("yingtijiao_count") - record.getInt("yitijiao_count") - record.getInt("tuihuiweitijiao_count"); + record.set("weitijiao_count", weitijiao_count); + return record; + } } \ No newline at end of file