From 564219caa1be2cec18ddf36956fb08f405f724f9 Mon Sep 17 00:00:00 2001 From: "@jyuhsin" <729757837@qq.com> Date: Fri, 12 Dec 2025 14:32:39 +0800 Subject: [PATCH] commit --- .../ghkh/controller/GhkhXghshController.java | 68 +++++--- .../ghkh/controller/GhkhXjkhzbController.java | 35 +++- .../zhgh/dayofficework/ghkh/model/kh_nr.java | 5 +- .../static/components/module/kh/KhZb.vue | 64 ++++++-- .../zhgh/dayofficework/ghkh/xghsh.html | 153 ++++++++++-------- 5 files changed, 225 insertions(+), 100 deletions(-) diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXghshController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXghshController.java index 6730299..8b353a7 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXghshController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXghshController.java @@ -5,6 +5,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission; import com.budwk.app.base.result.Result; import com.budwk.app.base.service.BaseService; import com.budwk.app.sys.models.Sys_user; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.dayofficework.ghkh.model.*; import com.budwk.app.zhgh.dayofficework.ghkh.service.KhXghshService; import com.budwk.app.zhgh.dayofficework.ghkh.service.KhZbService; @@ -15,6 +16,7 @@ import org.nutz.dao.sql.Sql; import org.nutz.dao.util.DaoUp; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; import org.nutz.lang.Strings; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @@ -132,19 +134,46 @@ public class GhkhXghshController { return null; } - int score = 0; + // 查询当前用户能够审核的指标 + List nrList = khzpService.dao().query(kh_nr.class, Cnd.where("zb_id", "=", pf[0].getZb_id()).and("auditUser", "=", SecurityUtil.getUserLoginname())); + if(Lang.isEmpty(nrList)) { + return Result.success(); + } + List contentIds = nrList.stream().map(kh_nr::getId).toList(); -// Sys_user sys_user = (Sys_user) ShiroUtil.getPrincipal(); - khXghshService.dao().clear(Kh_xghsh.class, Cnd.where("zb_id", "=", pf[0].getZb_id()).and("flatid", "=", pf[0].getFlatid())); - for (Kh_xghsh p : pf) { - khzpService.dao().insert(p); - score += p.getSchools() != null ? p.getSchools() : 0; + khXghshService.dao().clear(Kh_xghsh.class, Cnd.where("zb_id", "=", pf[0].getZb_id()).and("flatid", "=", pf[0].getFlatid()).and("nr_id", "in", contentIds)); + int score = 0; + for (Kh_xghsh p : pf) { + if(contentIds.contains(p.getNr_id())) { + khzpService.dao().insert(p); + score += p.getSchools() != null ? p.getSchools() : 0; + } } - Kh_record record = baseService.dao().fetch(Kh_record.class, Cnd.where("zb_id", "=", pf[0].getZb_id()).and("union_id", "=", pf[0].getFlatid())); + Kh_record record = baseService.dao().fetch(Kh_record.class, Cnd.where("zb_id", "=", pf[0].getZb_id()).and("union_id", "=", pf[0].getFlatid())); + if (record != null && "submit".equals(type)) { + record.setXgh_score(score); + baseService.dao().update(record); + } + return Result.success(); + } - if (record != null) { - record.setXgh_score(score); + @At + @POST + @SaCheckPermission("ghkh.xghsh") + public Result submit(String id) { + Kh_record record = khZbService.dao().fetch(Kh_record.class, id); + + if (record != null) { + + List schoolAuditList = khZbService.dao().query(Kh_xghsh.class, Cnd.where("zb_id", "=", record.getZb_id()).and("flatid", "=", record.getUnion_id())); + + Integer score = 0; + for (Kh_xghsh xghsh : schoolAuditList) { + score += xghsh.getSchools(); + } + + record.setXgh_score(score); ExamConfig config = baseService.dao().fetch(ExamConfig.class, Cnd.NEW()); if(config.getOnLine() != null) { record.setOnLineFinalScore(score * config.getOnLine() * 0.01); @@ -152,18 +181,15 @@ public class GhkhXghshController { record.setOnLineFinalScore((double) score); } record.setTotalScore(record.getOnLineFinalScore()); - if("submit".equals(type)) { - record.setState(3); + record.setState(3); + baseService.dao().update(record); + + List list = khZbService.dao().query(Kh_record.class, Cnd.where("zb_id", "=", record.getZb_id()).desc("totalScore")); + for (int i = 0; i < list.size(); i++) { + list.get(i).setSort(i + 1); } - baseService.dao().update(record); - } - - List list = khZbService.dao().query(Kh_record.class, Cnd.where("zb_id", "=", pf[0].getZb_id()).desc("totalScore")); - for (int i = 0; i < list.size(); i++) { - list.get(i).setSort(i + 1); + khZbService.dao().update(list); } - khZbService.dao().update(list); - return Result.success(); - } - + return Result.success(); + } } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXjkhzbController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXjkhzbController.java index 8b56059..ab3b928 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXjkhzbController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/controller/GhkhXjkhzbController.java @@ -1,6 +1,7 @@ package com.budwk.app.zhgh.dayofficework.ghkh.controller; +import cn.dev33.satoken.annotation.SaCheckLogin; import cn.dev33.satoken.annotation.SaCheckPermission; import com.budwk.app.base.result.Result; import com.budwk.app.web.commons.auth.utils.SecurityUtil; @@ -9,12 +10,19 @@ import com.budwk.app.zhgh.dayofficework.ghkh.model.kh_nr; import com.budwk.app.zhgh.dayofficework.ghkh.service.KhBzService; import com.budwk.app.zhgh.dayofficework.ghkh.service.KhNrService; import com.budwk.app.zhgh.dayofficework.ghkh.service.KhZbService; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.dao.util.cri.Static; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.POST; import org.nutz.mvc.annotation.Param; + +import javax.validation.Valid; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -64,6 +72,31 @@ public class GhkhXjkhzbController { @At public Result getZbList() { return Result.success(khZbService.query()); - } + + @At + @SaCheckLogin + public Result getUserByKeyWord(@Valid String keyWord) { + Sql sql = Sqls.create(""" + SELECT + t1.id, + t1.username AS userName, + t1.loginName AS loginName, + t2.NAME AS unitName, + t1.mobile, + t1.email + FROM + `sys_user` t1 + LEFT JOIN sys_unit t2 ON t2.id = t1.unitId + $condition + limit 0, 50 + """); + sql.setParam("keyWord", "%" + keyWord + "%"); + Cnd cnd = Cnd.NEW(); + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("t1.username", keyWord).orLike("t1.loginname", keyWord); + cnd.and(group); + sql.setCondition(cnd); + return Result.success(khZbService.listMap(sql)); + } } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/model/kh_nr.java b/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/model/kh_nr.java index 9d7744f..c262963 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/model/kh_nr.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/ghkh/model/kh_nr.java @@ -54,5 +54,8 @@ public class kh_nr extends BaseModel { }) private Integer location; - + @Column + @Comment("审核人") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String auditUser; } diff --git a/src/main/resources/static/components/module/kh/KhZb.vue b/src/main/resources/static/components/module/kh/KhZb.vue index 64043cb..21ee450 100644 --- a/src/main/resources/static/components/module/kh/KhZb.vue +++ b/src/main/resources/static/components/module/kh/KhZb.vue @@ -79,13 +79,25 @@ - - - - {{ idx + 1 }}  {{ nr.content }} +
+ + + + + + + + +
+ @click="formData.nrs.push({bzs:[{}], auditUser: ''})"> 添加内容 @@ -232,7 +244,8 @@ module.exports = { default: function() { return { nrs: [{ - bzs: [{}] + bzs: [{}], + auditUser: '', }], }; } @@ -265,10 +278,23 @@ module.exports = { {moduleName:'二级教代会',id:'secteameet'}, {moduleName:'慰问/补助',id:'ConandDif'}, ], - formData:{} + formData:{}, + userOptions: [], } }, methods: { + async selectUser(query) { + if (query) { + this.userOptions = [] + this.userOptions = await this.getUserList(query) + } + }, + async getUserList(query) { + const resp = await this.$axios.post("/platform/ghkh/Xjkhzb/getUserByKeyWord", { + keyWord: query, + }) + return resp.data + }, async getByZbData() { this.$axios.post('/platform/ghkh/khzb/edit', {id: this.formData.zbId}).then(res => { if (res.code === 0) { @@ -328,16 +354,17 @@ module.exports = { return sums; } }, - created() { + async created() { this.getZbList() if (!this.form_data || !Object.keys(this.form_data).length) { this.formData = { nrs: [{ - bzs: [{}] + bzs: [{}], + auditUser: '', }], } - }else{ - this.formData=this.form_data + } else { + this.formData = this.form_data // 初始化时间范围数据用于编辑 if (this.formData.startDateTime && this.formData.endDateTime) { this.$set(this.formData, 'fillTimeRange', [this.formData.startDateTime, this.formData.endDateTime]); @@ -345,6 +372,19 @@ module.exports = { if (this.formData.startApplyTime && this.formData.endApplyTime) { this.$set(this.formData, 'appealTimeRange', [this.formData.startApplyTime, this.formData.endApplyTime]); } + // 回显审核人 + if (this.formData.nrs.length > 0) { + const users = [...new Set( + this.formData.nrs + .map(o => o.auditUser) + .filter(o => o != null && o !== '') + )] + let array = [] + for (const o of users) { + array = array.concat(await this.getUserList(o)) + } + this.userOptions = array + } } } } diff --git a/src/main/resources/views/platform/zhgh/dayofficework/ghkh/xghsh.html b/src/main/resources/views/platform/zhgh/dayofficework/ghkh/xghsh.html index 1ca8a63..e53e77d 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/ghkh/xghsh.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/ghkh/xghsh.html @@ -90,11 +90,14 @@ layout("/layouts/platform.html"){ + fixed="right" width="160px"> @@ -124,80 +127,81 @@ layout("/layouts/platform.html"){ - - - - - - - - - + @@ -245,6 +249,7 @@ layout("/layouts/platform.html"){ window.vue = new Vue({ el: '#app', + store, mixins: [initTableMixins], data() { return { @@ -356,6 +361,24 @@ layout("/layouts/platform.html"){ loading.close() }) }, + doSubmit(row) { + this.$confirm('提交后不可修改,您确定要提交吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(()=>{ + this.$axios + .post("/platform/ghkh/xghsh/submit", {id: row.record_id}) + .then((resp) => { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.doSearch() + } else { + this.$message.error(resp.msg) + } + }) + }) + }, doView(nr, bz, row, index, idx) { this.dialog = true this.viewRow = row