From 71f1c4162d63bf43d24bae98bd42a6b1b2ed9177 Mon Sep 17 00:00:00 2001 From: zhouhefeng Date: Thu, 10 Apr 2025 09:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=8F=E8=B4=B9=E9=A2=84=E5=AE=A1=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/preAuditManageController.java | 101 +++++++ .../controller/preAuditQueryController.java | 59 ++++ .../controller/preAuditSchoolController.java | 81 ++++++ .../models/ReimbursementPreAudit.java | 91 +++++++ .../platform/reimbursementPreAudit/audit.html | 255 +++++++++++++++++ .../platform/reimbursementPreAudit/info.js | 92 +++++++ .../reimbursementPreAudit/manage.html | 257 ++++++++++++++++++ .../platform/reimbursementPreAudit/query.html | 217 +++++++++++++++ 8 files changed, 1153 insertions(+) create mode 100644 src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditManageController.java create mode 100644 src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditQueryController.java create mode 100644 src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditSchoolController.java create mode 100644 src/main/java/io/v/nutz/reimbursementPreAudit/models/ReimbursementPreAudit.java create mode 100644 src/main/resources/views/platform/reimbursementPreAudit/audit.html create mode 100644 src/main/resources/views/platform/reimbursementPreAudit/info.js create mode 100644 src/main/resources/views/platform/reimbursementPreAudit/manage.html create mode 100644 src/main/resources/views/platform/reimbursementPreAudit/query.html diff --git a/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditManageController.java b/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditManageController.java new file mode 100644 index 0000000..8c37984 --- /dev/null +++ b/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditManageController.java @@ -0,0 +1,101 @@ +package io.v.nutz.reimbursementPreAudit.controller; + +import cn.hutool.core.util.StrUtil; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.reimbursementPreAudit.models.ReimbursementPreAudit; +import io.v.nutz.util.ShiroUtil; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * @ClassName preAuditManageController + * @Description 我的预审管理 + * @Version 1.0 + * @Author zhf + * @Date 2025/4/9 下午2:04 + */ +@At("/platform/reimbursementPreAudit/manage") +@Ok("json:full") +@IocBean +public class preAuditManageController { + + @Inject + private BaseService baseService; + + @At("") + @Ok("beetl:/platform/reimbursementPreAudit/manage.html") + @RequiresPermissions("reimbursementPreAudit.manage") + public void index() { + } + + + @At + @ViReturn + @RequiresPermissions("reimbursementPreAudit.manage") + public Object pageData(PageForm pageForm, String year, String notes) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT * FROM `reimbursement_pre_audit` $condition + """); + cnd.andEX("YEAR(applyDate)", "=", year); + cnd.andEX("userId", "=", ShiroUtil.getUserId()); + cnd.desc("applyDate").desc("opAt"); + if (StrUtil.isNotEmpty(notes)) { + cnd.andEX("notes", "like", "%" + notes + "%"); + } + if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy()); + } + sql.setCondition(cnd); + return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + @At + @ViReturn + @RequiresPermissions("reimbursementPreAudit.manage") + public Object doDelete(String id) { + baseService.dao().delete(ReimbursementPreAudit.class, id); + return null; + } + + @At + @ViReturn + @RequiresPermissions("reimbursementPreAudit.manage") + public Object doSubmit(@Param("preAudit") ReimbursementPreAudit preAudit, Boolean flag) { + preAudit.setUserId(ShiroUtil.getUserId()); + preAudit.setUnitId(ShiroUtil.getUnitId()); + preAudit.setUnionId(Vi.getUnionId()); + preAudit.setAuditState(flag ? 1 : 0); + baseService.insertOrUpdate(preAudit); + return null; + } + + + @At + @ViReturn + public Object findOne(String id) { + Sql sql = Sqls.create(""" + SELECT * FROM `reimbursement_pre_audit` WHERE id=@id + """).setParam("id", id); + sql.setCallback(Sqls.callback.map()); + baseService.dao().execute(sql); + NutMap info = (NutMap) sql.getResult(); + info.put("auditInfo", baseService.dao().fetch(Audit.class, Cnd.where("id", "=", info.getString("auditId")))); + return info; + } + + +} diff --git a/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditQueryController.java b/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditQueryController.java new file mode 100644 index 0000000..fdf2144 --- /dev/null +++ b/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditQueryController.java @@ -0,0 +1,59 @@ +package io.v.nutz.reimbursementPreAudit.controller; + +import cn.hutool.core.util.StrUtil; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +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; + +/** + * @ClassName preAuditQueryController + * @Description TODO + * @Author zhf + * @Date 2025/4/10 上午9:13 + */ +@At("/platform/reimbursementPreAudit/query") +@Ok("json:full") +@IocBean +public class preAuditQueryController { + + @Inject + private BaseService baseService; + + @At("") + @Ok("beetl:/platform/reimbursementPreAudit/query.html") + @RequiresPermissions("reimbursementPreAudit.query") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("reimbursementPreAudit.manage") + public Object pageData(PageForm pageForm, String startDate, String endDate, String notes) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT * FROM `reimbursement_pre_audit` $condition + """); + cnd.andEX("applyDate", ">=", startDate); + cnd.andEX("applyDate", "<=", endDate); + cnd.andEX("userId", "=", ShiroUtil.getUserId()); + cnd.andEX("auditState", "=", 3); + cnd.desc("applyDate").desc("opAt"); + if (StrUtil.isNotEmpty(notes)) { + cnd.andEX("notes", "like", "%" + notes + "%"); + } + if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy()); + } + sql.setCondition(cnd); + return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } +} diff --git a/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditSchoolController.java b/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditSchoolController.java new file mode 100644 index 0000000..d717cf6 --- /dev/null +++ b/src/main/java/io/v/nutz/reimbursementPreAudit/controller/preAuditSchoolController.java @@ -0,0 +1,81 @@ +package io.v.nutz.reimbursementPreAudit.controller; + +import cn.hutool.core.util.StrUtil; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.reimbursementPreAudit.models.ReimbursementPreAudit; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.web.commons.slog.annotation.SLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Chain; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +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; + +/** + * @ClassName preAuditController + * @Description TODO + * @Author zhf + * @Date 2025/4/9 下午4:46 + */ +@At("/platform/reimbursementPreAudit/audit") +@Ok("json:full") +@IocBean +public class preAuditSchoolController { + @Inject + private BaseService baseService; + + @At("") + @Ok("beetl:/platform/reimbursementPreAudit/audit.html") + @RequiresPermissions("reimbursementPreAudit.audit") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("reimbursementPreAudit.audit") + public Object pageData(PageForm pageForm, String year, String notes, Integer auditState,String unitId,String unionId) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT * FROM `reimbursement_pre_audit` $condition + """); + cnd.andEX("YEAR(applyDate)", "=", year); + cnd.andEX("unitId", "=", unitId); + cnd.andEX("unionId", "=", unionId); + if (auditState != 0) { + cnd.andEX("auditState", auditState == 1 ? ">" : "=", 1); + } else { + cnd.andEX("auditState", ">=", 1); + } + if (StrUtil.isNotEmpty(notes)) { + cnd.andEX("notes", "like", "%" + notes + "%"); + } + cnd.andEX("userId", "=", ShiroUtil.getUserId()); + cnd.desc("applyDate").desc("opAt"); + + if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy()); + } + sql.setCondition(cnd); + return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + @At + @ViReturn + @SLog(tag = "报销预审", msg = "审核一条记录", param = true, result = true) + @RequiresPermissions("reimbursementPreAudit.audit") + public Object doSubmit(Audit audit, String id, Boolean flag) { + audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString()); + baseService.insert(audit); + Chain chain = Chain.make("auditId", audit.getId()).add("auditState", flag ? 3 : 2); + baseService.dao().update(ReimbursementPreAudit.class, chain, Cnd.where("id", "=", id)); + return null; + } +} diff --git a/src/main/java/io/v/nutz/reimbursementPreAudit/models/ReimbursementPreAudit.java b/src/main/java/io/v/nutz/reimbursementPreAudit/models/ReimbursementPreAudit.java new file mode 100644 index 0000000..48632f1 --- /dev/null +++ b/src/main/java/io/v/nutz/reimbursementPreAudit/models/ReimbursementPreAudit.java @@ -0,0 +1,91 @@ +package io.v.nutz.reimbursementPreAudit.models; + +import io.v.nutz.base.model.BaseModel; +import io.v.nutz.sys.models.Sys_file; +import lombok.Data; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.util.List; + +/** + * @ClassName ReimbursementPreAudit + * @Description TODO + * @Author zhf + * @Date 2025/4/9 下午1:55 + */ +@Data +@Table +@Comment("报销预审系统") +public class ReimbursementPreAudit extends BaseModel { + + + @Column + @Name + @Comment("ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userId; + + @Column + @Comment("姓名") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userName; + + @Column + @Comment("工号") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String loginName; + + @Column + @Comment("单位") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unitName; + + @Column + @Comment("单位Id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unitId; + + @Column + @Comment("工会") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unionName; + + @Column + @Comment("工会Id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionId; + + @Column + @Comment("报销事由") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String notes; + + @Column + @Comment("申报时间") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String applyDate; + + @Column + @Comment("附件信息") + @ColDefine(type = ColType.MYSQL_JSON) + private List files; + + @Column + @Comment("审核记录id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String auditId; + + @Column + @Comment("审核状态") + @ColDefine(type = ColType.INT) + private Integer auditState; + + +} diff --git a/src/main/resources/views/platform/reimbursementPreAudit/audit.html b/src/main/resources/views/platform/reimbursementPreAudit/audit.html new file mode 100644 index 0000000..d1b45b2 --- /dev/null +++ b/src/main/resources/views/platform/reimbursementPreAudit/audit.html @@ -0,0 +1,255 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + 关 闭 + 退回修改 + 通 过 + + + + + + + 关 闭 + + +
+ + + + diff --git a/src/main/resources/views/platform/reimbursementPreAudit/info.js b/src/main/resources/views/platform/reimbursementPreAudit/info.js new file mode 100644 index 0000000..9042e0d --- /dev/null +++ b/src/main/resources/views/platform/reimbursementPreAudit/info.js @@ -0,0 +1,92 @@ +let info = { + /*language=HTML*/ + template: ` + + + + + + + {{viewData.userName}} + + + + + {{viewData.loginName}} + + + + + {{viewData.unitName}} + + + + + {{viewData.unionName}} + + + + + {{viewData.notes}} + + + + + + + + + + + + + + + {{viewData.auditInfo.username}} + + + + + {{viewData.auditInfo.auditTime}} + + + + + {{viewData.auditInfo.auditOpinion}} + + + + + + + + + + `, + data() { + return { + handle: false, + label: "审核", + loading: false, + activeName: "1", + viewData: {} + } + }, + methods: { + async openAudit(id, handle) { + this.handle = handle + await this.openView(id) + }, + async openView(id) { + this.loading = true + const resp = await $.post("/platform/reimbursementPreAudit/manage/findOne", {id}) + resp.data.files = JSON.parse(resp.data.files) + this.viewData = resp.data + this.loading = false + if (this.handle){ + this.activeName = "999" + } + } + } +} diff --git a/src/main/resources/views/platform/reimbursementPreAudit/manage.html b/src/main/resources/views/platform/reimbursementPreAudit/manage.html new file mode 100644 index 0000000..3e18337 --- /dev/null +++ b/src/main/resources/views/platform/reimbursementPreAudit/manage.html @@ -0,0 +1,257 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 关 闭 + 保 存 + 提 交 + + + + + + + 关 闭 + + +
+ + + + diff --git a/src/main/resources/views/platform/reimbursementPreAudit/query.html b/src/main/resources/views/platform/reimbursementPreAudit/query.html new file mode 100644 index 0000000..bcafc09 --- /dev/null +++ b/src/main/resources/views/platform/reimbursementPreAudit/query.html @@ -0,0 +1,217 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + 关 闭 + + +
+ + + +