diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalUndertakeSuggestionController.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalUndertakeSuggestionController.java new file mode 100644 index 00000000..4bfe8140 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalUndertakeSuggestionController.java @@ -0,0 +1,150 @@ +package com.budwk.app.zhgh.democratic.proposal.controller.transact; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.annotation.SaMode; +import cn.hutool.core.date.DateUtil; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.constant.RoleConstant; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.result.Result; +import com.budwk.app.web.commons.auth.utils.AuthUtil; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo; +import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake; +import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertakeSuggestion; +import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam; +import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.Static; +import org.nutz.ioc.aop.Aop; +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.Param; + +import javax.validation.Valid; +import java.util.List; +import java.util.Objects; + +/** + * @ClassName ProposalUndertakeSuggestionController + * @Author JyuHsin + * @Date 2025/10/16 16:34 + * @Version 1.0 + * @Description TODO + */ +@IocBean +@At("/platform/proposal/suggestion") +@Slf4j +@Ok("json:full") +@Api(tags = "提案-办理-承办单位提出意见") +public class ProposalUndertakeSuggestionController { + + @Inject + private ProposalCommonService proposalCommonService; + + @At("") + @Ok("beetl:/platform/zhgh/democratic/proposal/transact/suggestion/index.html") + @SaCheckPermission("proposal.suggestion") + public void index() { + } + + @At("/h5") + @Ok("beetl:/platform/zhghh5/democratic/proposal/transact/suggestion/index.html") + @SaCheckPermission("h5.proposal.suggestion") + public void h5Index() { + } + + @At + @SaCheckPermission(value = {"proposal.suggestion", "h5.proposal.suggestion"}, mode = SaMode.OR) + @ApiOperation("分页列表") + public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) { + Sql sql = Sqls.create(""" + SELECT + info.*, + type.name AS typeName, + tcs.fullName AS sessionName, + tcd.`name` AS delegationName, + ins.state instanceState, + IFNULL(GROUP_CONCAT(DISTINCT nt.displayName), '结束') curTaskName, + (select count(1) from proposal_undertake_suggestion where proposalId = info.id $unitId) as count + FROM + wf_process_task t + LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId + LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10 + LEFT JOIN proposal_info info ON info.id = ins.businessNo + LEFT JOIN proposal_type type on type.id = info.typeId + LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId + LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("t.taskState", "=", 10); + cnd.and("t.taskName", "=", "committee"); + + if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) { + // 查询当前登录用户负责的承办单位 + ProposalUndertake undertake = proposalCommonService.getSelfManageUndertake(); + cnd.and(new Static("JSON_CONTAINS(suggestUnits, JSON_QUOTE('" + undertake.getName() + "'))")); + sql.setVar("unitId", " and unitId = '%s'".formatted(undertake.getId())); + } + + ProposalSearchParam.buildSearch(cnd, pageForm); + cnd.groupBy("t.id"); + + cnd.having(Cnd.where("count", approval ? ">" : "=", 0)); + cnd.desc("t.createdAt"); + sql.setCondition(cnd); + Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + @At + @ApiOperation("承办单位提出意见") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"proposal.suggestion", "h5.proposal.suggestion"}, mode = SaMode.OR) + @SLog(tag = "提案系统-承办单位意见", msg = "提出意见") + public Result suggest(ProposalUndertakeSuggestion suggestion) { + suggestion.setUserId(SecurityUtil.getUserId()); + suggestion.setUserName(SecurityUtil.getUserUsername()); + suggestion.setTime(DateUtil.now()); + + ProposalUndertake undertake = proposalCommonService.getSelfManageUndertake(); + + suggestion.setUnitId(Objects.requireNonNullElse(undertake.getId(), "")); + suggestion.setUnitName(Objects.requireNonNullElse(undertake.getName(), "")); + proposalCommonService.dao().insert(suggestion); + return Result.success(); + } + + @At + @ApiOperation("承办单位提出意见") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"proposal.suggestion", "h5.proposal.suggestion"}, mode = SaMode.OR) + @SLog(tag = "提案系统-承办单位意见", msg = "删除意见") + public Result delete(String id) { + proposalCommonService.dao().delete(ProposalUndertakeSuggestion.class, id); + return Result.success(); + } + + @At + @ApiOperation("查询意见") + @SaCheckPermission(value = {"proposal.suggestion", "h5.proposal.suggestion"}, mode = SaMode.OR) + public Result selectSuggestion(String proposalId) { + Cnd cnd = Cnd.NEW(); + cnd.and(ProposalUndertakeSuggestion::getProposalId, "=", proposalId); + if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) { + cnd.and(ProposalUndertakeSuggestion::getUnitId, "=", proposalCommonService.getSelfManageUndertake().getId()); + } + cnd.desc(ProposalUndertakeSuggestion::getTime); + List list = proposalCommonService.dao().query(ProposalUndertakeSuggestion.class, cnd); + return Result.success(list); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/models/ProposalUndertakeSuggestion.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/models/ProposalUndertakeSuggestion.java new file mode 100644 index 00000000..3b082722 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/models/ProposalUndertakeSuggestion.java @@ -0,0 +1,68 @@ +package com.budwk.app.zhgh.democratic.proposal.models; + +import com.budwk.app.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +/** + * @ClassName ProposalUndertakeSugges + * @Author JyuHsin + * @Date 2025/10/16 16:29 + * @Version 1.0 + * @Description TODO + */ +@Table("proposal_undertake_suggestion") +@Data +@EqualsAndHashCode(callSuper = true) +@TableMeta("{'mysql-charset':'utf8mb4'}") +@Comment("提案承办单位意见") +public class ProposalUndertakeSuggestion extends BaseModel { + + @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 proposalId; + + @Column + @Comment("用户id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userId; + + @Column + @Comment("用户姓名") + @ColDefine(type = ColType.VARCHAR, width = 30) + private String userName; + + @Column + @Comment("单位id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unitId; + + @Column + @Comment("单位名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String unitName; + + @Column + @Comment("提出时间") + @ColDefine(type = ColType.VARCHAR, width = 30) + private String time; + + @Column + @Comment("提出意见") + @ColDefine(type = ColType.VARCHAR, width = 500) + private String opinion; + + @Column + @Comment("结果") + @ColDefine(type = ColType.VARCHAR, width = 30) + private String result; +} diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonService.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonService.java index fd169eb8..eb8ad319 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonService.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonService.java @@ -2,6 +2,7 @@ package com.budwk.app.zhgh.democratic.proposal.service.common; import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo; +import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake; import org.nutz.lang.util.NutMap; import javax.servlet.http.HttpServletResponse; @@ -80,6 +81,13 @@ public interface ProposalCommonService extends BaseService { List getSelfManageDelegationIds(); + /** + * 获取自管承办单位 + * + * @return + */ + ProposalUndertake getSelfManageUndertake(); + /** * 根据提案id查询并案的提案 * diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonServiceImpl.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonServiceImpl.java index 6761c507..586fab31 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/common/ProposalCommonServiceImpl.java @@ -28,6 +28,7 @@ import com.budwk.app.web.commons.base.Globals; import com.budwk.app.zhgh.democratic.proposal.models.ProposalConsolidation; import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo; import com.budwk.app.zhgh.democratic.proposal.models.ProposalMerge; +import com.budwk.app.zhgh.democratic.proposal.models.ProposalUndertake; import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; @@ -44,6 +45,7 @@ import org.nutz.dao.util.cri.Static; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; +import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; import javax.servlet.http.HttpServletResponse; @@ -434,7 +436,18 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl imp return delegationIds; } - @Override + @Override + public ProposalUndertake getSelfManageUndertake() { + Sys_role role = sysRoleService.getByCode(RoleConstant.PROPOSAL_UNIT_LEADER.name()); + Sys_user_role userRole = dao().fetch(Sys_user_role.class, Cnd.where(Sys_user_role::getRoleId, "=", role.getId()) + .and(Sys_user_role::getUserId, "=", SecurityUtil.getUserId())); + if(Lang.isEmpty(userRole)) { + throw new RuntimeException("当前登录用户不是" + role.getName()); + } + return dao().fetch(ProposalUndertake.class, Cnd.where(ProposalUndertake::getId, "=", userRole.getUnderTakeId())); + } + + @Override public List getConsolidation(String id) { ProposalConsolidation consolidation = dao().fetch(ProposalConsolidation.class, Cnd.where(new Static("JSON_CONTAINS(consolidationIds,'\"" + id + "\"')"))); if (ObjectUtil.isNotEmpty(consolidation)) { diff --git a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/suggestion/index.html b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/suggestion/index.html index 135847f8..b8d9a27b 100644 --- a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/suggestion/index.html +++ b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/suggestion/index.html @@ -98,8 +98,8 @@ layout("/layouts/platform.html"){ - 已审核 - 未审核 + 已反馈 + 未反馈 @@ -122,11 +122,17 @@ layout("/layouts/platform.html"){ + + - + @@ -136,30 +142,50 @@ layout("/layouts/platform.html"){ + + @@ -169,7 +195,7 @@ layout("/layouts/platform.html"){ new Vue({ el: "#app", store, - dicts: ["PROPOSAL_CASE_FILING_RESULT", "PROPOSAL_REPLY_IMPLEMENT"], + dicts: ["UNDERTAKE_SUGGESTION"], mixins: [initTableMixins], components: { "proposal-info": PROPOSAL_INFO @@ -182,6 +208,8 @@ layout("/layouts/platform.html"){ {label: "提案类别", prop: "typeName"}, {label: "届次", prop: "sessionName"}, {label: "代表团", prop: "delegationName"}, + {label: "建议承办单位", prop: "suggestUnits"}, + {label: "意见数", prop: "count"}, {label: "当前节点", prop: "curTaskName"}, {label: "流程状态", prop: "instanceState"} ], @@ -191,21 +219,82 @@ layout("/layouts/platform.html"){ showApprovalForm: false, formData: {}, sessionOptions: [], + + suggestionList: [], } }, methods: { + openSuggestion(row) { + this.$axios.post('/platform/proposal/suggestion/selectSuggestion', { + proposalId: row.id, + }).then(res => { + if(res.code === 0) { + this.suggestionList = res.data + if(this.suggestionList.length === 0) { + this.$message.warning('暂无意见数') + return + } + this.$refs.guava.view() + } else { + this.$message.error(res.msg) + } + }) + }, + onDelete(row) { + this.$confirm("您确定要删除吗?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + this.$axios.post('/platform/proposal/suggestion/delete', { id: row.id, }) + .then(res => { + if(res.code === 0) { + this.$message.success(res.msg) + this.$refs.guava.index() + this.pageData() + } else { + this.$message.error(res.msg) + } + }) + }) + }, openView(row) { this.$refs.guava.edit(() => { this.showApprovalForm = false this.$refs.proposalInfoRef.onOpen(row) }) }, - + openAudit(row) { + this.$refs.guava.edit(() => { + this.showApprovalForm = true + this.formData = { + proposalId: row.id, + } + this.$refs.proposalInfoRef.onOpen(row) + }) + }, + onAudit() { + this.$refs.formRef.validate(valid => { + if (!valid) return + this.$confirm("您确定要提交吗?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + this.$axios.post("/platform/proposal/suggestion/suggest", this.formData).then((res) => { + if (res.code === 0) { + this.$refs.guava.index() + this.$message.success(res.msg) + this.doSearch() + } + }) + }) + }) + }, // 教代会 async meetingChange(val) { this.doSearch() }, - // 查询开启的教代会 listOpenSession() { this.$axios.post("/platform/proposal/common/listOpenSession").then((res) => { diff --git a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/suggestion/index.html b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/suggestion/index.html new file mode 100644 index 00000000..be4d8e16 --- /dev/null +++ b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/suggestion/index.html @@ -0,0 +1,247 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + +
+
承办单位意见
+ + + + + + + +
+ 取消 + 提交 +
+
+
+ + +
+ + + {{ item.userName }} + {{ item.unitName }} + {{ item.time }} + {{ item.result }} + + + + +
+
+
+ + + +