Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/v4
This commit is contained in:
+150
@@ -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<ProposalUndertakeSuggestion> list = proposalCommonService.dao().query(ProposalUndertakeSuggestion.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+68
@@ -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;
|
||||
}
|
||||
+8
@@ -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<ProposalInfo> {
|
||||
List<String> getSelfManageDelegationIds();
|
||||
|
||||
|
||||
/**
|
||||
* 获取自管承办单位
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ProposalUndertake getSelfManageUndertake();
|
||||
|
||||
/**
|
||||
* 根据提案id查询并案的提案
|
||||
*
|
||||
|
||||
+14
-1
@@ -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<ProposalInfo> 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<String> getConsolidation(String id) {
|
||||
ProposalConsolidation consolidation = dao().fetch(ProposalConsolidation.class, Cnd.where(new Static("JSON_CONTAINS(consolidationIds,'\"" + id + "\"')")));
|
||||
if (ObjectUtil.isNotEmpty(consolidation)) {
|
||||
|
||||
Reference in New Issue
Block a user