1、新加功能:建议意见讨论组
2、代表团管理:设置联络人(面向全校)
This commit is contained in:
@@ -457,7 +457,7 @@ public class SysUnionController {
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result listUnion(@Valid String unionId, @Valid String keyWord) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitName,unionName,sex from vw_user $condition");
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitName,unionName,sex,mobile from vw_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX(View_user::getUnionId, "=", unionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
|
||||
+2
-2
@@ -271,8 +271,8 @@ public class TeacherCongressDelegationController {
|
||||
public Result notHeadUser(@Valid String sessionId, @Valid String delegationId, String keyWord) {
|
||||
Sql sql = Sqls.create("select userId,loginName,userName,unitName from teacher_congress_delegate $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("delegationId", "=", delegationId);
|
||||
cnd.and("sessionId", "=", sessionId);
|
||||
cnd.andEX("delegationId", "=", delegationId);
|
||||
cnd.andEX("sessionId", "=", sessionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("loginName", keyWord);
|
||||
seg.orLike("userName", keyWord);
|
||||
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.models.Teacher_congress_discussion_group;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param.TeacherCongressDiscussionGroupInsertParam;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param.TeacherCongressDiscussionGroupPageParam;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param.TeacherCongressDiscussionGroupUpdateParam;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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.POST;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/teacherCongress/discussionGroup")
|
||||
@Ok("json:full")
|
||||
public class TeacherCongressDiscussionGroupController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/discussiongroup/index.html")
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result pageData(@Valid TeacherCongressDiscussionGroupPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tcdg.*,
|
||||
tcs.fullName AS sessionName,
|
||||
vu.mobile AS recorderUserMobile,
|
||||
su.username AS createdByName
|
||||
FROM teacher_congress_discussion_group tcdg
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = tcdg.sessionId
|
||||
LEFT JOIN vw_user vu ON vu.id = tcdg.recorderUserId
|
||||
LEFT JOIN sys_user su ON su.id = tcdg.createdBy
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tcdg.delFlag", "=", false);
|
||||
if (StrUtil.isNotBlank(pageParam.getSessionId())) {
|
||||
cnd.and("tcdg.sessionId", "=", pageParam.getSessionId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageParam.getSearchKeyword())) {
|
||||
if ("name".equals(pageParam.getSearchName())) {
|
||||
cnd.and("tcdg.name", "like", "%" + pageParam.getSearchKeyword() + "%");
|
||||
} else {
|
||||
cnd.and("tcdg.code", "like", "%" + pageParam.getSearchKeyword() + "%");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageParam.getRecorderUserName())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("tcdg.recorderUserName", pageParam.getRecorderUserName());
|
||||
seg.orLike("tcdg.recorderUserCode", pageParam.getRecorderUserName());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageParam.getDelegationCode())) {
|
||||
cnd.and("tcdg.delegationCodes", "like", "%" + pageParam.getDelegationCode() + "%");
|
||||
}
|
||||
if (StrUtil.isBlank(pageParam.getPageOrderName())) {
|
||||
cnd.desc("tcdg.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result findOne(@Valid String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tcdg.*,
|
||||
tcs.fullName AS sessionName,
|
||||
su.username AS createdByName,
|
||||
vu.id AS recorderUserId,
|
||||
vu.loginname AS recorderUserCode,
|
||||
vu.username AS recorderUserName,
|
||||
vu.mobile AS recorderUserMobile
|
||||
FROM teacher_congress_discussion_group tcdg
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = tcdg.sessionId
|
||||
LEFT JOIN sys_user su ON su.id = tcdg.createdBy
|
||||
LEFT JOIN vw_user vu ON vu.id = tcdg.recorderUserId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tcdg.id", "=", id);
|
||||
cnd.and("tcdg.delFlag", "=", false);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.record());
|
||||
dao.execute(sql);
|
||||
Record record = sql.getObject(Record.class);
|
||||
if (record == null) {
|
||||
return Result.success(null);
|
||||
}
|
||||
record.put("delegationCodeList", parseJsonArray(record.getString("delegationCodes")));
|
||||
record.put("delegationNameList", parseJsonArray(record.getString("delegationNames")));
|
||||
return Result.success(record);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result recorderOptions(String keyword) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", keyword);
|
||||
seg.orLike("loginname", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.asc("loginname");
|
||||
cnd.limit(1, 20);
|
||||
List<View_user> users = dao.query(View_user.class, cnd);
|
||||
return Result.success(users);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result delegationOptions(@Valid String sessionId, String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
code,
|
||||
name
|
||||
FROM teacher_congress_delegation
|
||||
$condition
|
||||
ORDER BY CAST(code AS UNSIGNED), code ASC
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("sessionId", "=", sessionId);
|
||||
cnd.and("delFlag", "=", false);
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("code", keyword);
|
||||
seg.orLike("name", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.limit(1, 50);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.records());
|
||||
dao.execute(sql);
|
||||
return Result.success(sql.getList(Record.class));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
@SLog(tag = "discussion group", msg = "insert")
|
||||
public Result insert(@Valid TeacherCongressDiscussionGroupInsertParam param) {
|
||||
if (hasSameCode(param.getCode(), param.getSessionId(), null)) {
|
||||
return Result.error("discussion group code already exists");
|
||||
}
|
||||
Teacher_congress_discussion_group discussionGroup = buildEntity(param, new Teacher_congress_discussion_group());
|
||||
dao.insert(discussionGroup);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
@SLog(tag = "discussion group", msg = "update")
|
||||
public Result update(@Valid TeacherCongressDiscussionGroupUpdateParam param) {
|
||||
if (hasSameCode(param.getCode(), param.getSessionId(), param.getId())) {
|
||||
return Result.error("discussion group code already exists");
|
||||
}
|
||||
Teacher_congress_discussion_group discussionGroup = dao.fetch(Teacher_congress_discussion_group.class, param.getId());
|
||||
if (discussionGroup == null) {
|
||||
return Result.error("data not found");
|
||||
}
|
||||
buildEntity(param, discussionGroup);
|
||||
dao.updateIgnoreNull(discussionGroup);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
@SLog(tag = "discussion group", msg = "delete")
|
||||
public Result delete(@Valid String id) {
|
||||
dao.delete(Teacher_congress_discussion_group.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
private boolean hasSameCode(String code, String sessionId, String excludeId) {
|
||||
Cnd cnd = Cnd.where("code", "=", code).and("sessionId", "=", sessionId).and("delFlag", "=", false);
|
||||
if (StrUtil.isNotBlank(excludeId)) {
|
||||
cnd.and("id", "<>", excludeId);
|
||||
}
|
||||
return dao.count(Teacher_congress_discussion_group.class, cnd) > 0;
|
||||
}
|
||||
|
||||
private Teacher_congress_discussion_group buildEntity(TeacherCongressDiscussionGroupInsertParam param,
|
||||
Teacher_congress_discussion_group discussionGroup) {
|
||||
discussionGroup.setSessionId(param.getSessionId());
|
||||
discussionGroup.setCode(StrUtil.trim(param.getCode()));
|
||||
discussionGroup.setName(StrUtil.trim(param.getName()));
|
||||
discussionGroup.setRecorderUserId(param.getRecorderUserId());
|
||||
discussionGroup.setRecorderUserCode(StrUtil.trim(param.getRecorderUserCode()));
|
||||
discussionGroup.setRecorderUserName(StrUtil.trim(param.getRecorderUserName()));
|
||||
discussionGroup.setDelegationCodes(param.getDelegationCodes());
|
||||
discussionGroup.setDelegationNames(param.getDelegationNames());
|
||||
return discussionGroup;
|
||||
}
|
||||
|
||||
private List<String> parseJsonArray(String json) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if (StrUtil.isBlank(json)) {
|
||||
return result;
|
||||
}
|
||||
String content = StrUtil.trim(json);
|
||||
if (content.startsWith("[")) {
|
||||
content = content.substring(1);
|
||||
}
|
||||
if (content.endsWith("]")) {
|
||||
content = content.substring(0, content.length() - 1);
|
||||
}
|
||||
if (StrUtil.isBlank(content)) {
|
||||
return result;
|
||||
}
|
||||
for (String item : content.split(",")) {
|
||||
String value = StrUtil.trim(item);
|
||||
value = StrUtil.removePrefix(value, "\"");
|
||||
value = StrUtil.removeSuffix(value, "\"");
|
||||
if (StrUtil.isNotBlank(value)) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.ColDefine;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
import org.nutz.dao.entity.annotation.Column;
|
||||
import org.nutz.dao.entity.annotation.Comment;
|
||||
import org.nutz.dao.entity.annotation.Name;
|
||||
import org.nutz.dao.entity.annotation.Table;
|
||||
import org.nutz.dao.entity.annotation.TableMeta;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("teacher_congress_discussion_group")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("教代会建议意见讨论组")
|
||||
public class Teacher_congress_discussion_group 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 sessionId;
|
||||
|
||||
@Column
|
||||
@Comment("讨论组编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("讨论组名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("记录人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String recorderUserId;
|
||||
|
||||
@Column
|
||||
@Comment("记录人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String recorderUserCode;
|
||||
|
||||
@Column
|
||||
@Comment("记录人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String recorderUserName;
|
||||
|
||||
@Column
|
||||
@Comment("代表团编码JSON")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String delegationCodes;
|
||||
|
||||
@Column
|
||||
@Comment("代表团名称JSON")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String delegationNames;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class TeacherCongressDiscussionGroupInsertParam {
|
||||
|
||||
@NotBlank(message = "届次不能为空")
|
||||
private String sessionId;
|
||||
|
||||
@NotBlank(message = "讨论组编码不能为空")
|
||||
private String code;
|
||||
|
||||
@NotBlank(message = "讨论组名称不能为空")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "记录人不能为空")
|
||||
private String recorderUserId;
|
||||
|
||||
@NotBlank(message = "记录人工号不能为空")
|
||||
private String recorderUserCode;
|
||||
|
||||
@NotBlank(message = "记录人姓名不能为空")
|
||||
private String recorderUserName;
|
||||
|
||||
@NotBlank(message = "代表团不能为空")
|
||||
private String delegationCodes;
|
||||
|
||||
@NotBlank(message = "代表团不能为空")
|
||||
private String delegationNames;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeacherCongressDiscussionGroupPageParam extends PageForm {
|
||||
|
||||
private String sessionId;
|
||||
|
||||
private String searchName;
|
||||
|
||||
private String recorderUserName;
|
||||
|
||||
private String delegationCode;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeacherCongressDiscussionGroupUpdateParam extends TeacherCongressDiscussionGroupInsertParam {
|
||||
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
}
|
||||
Reference in New Issue
Block a user