commit
This commit is contained in:
+83
@@ -0,0 +1,83 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.service.ExecutiveCommitteeConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeConfigController
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 15:30
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/executiveCommittee/executiveCommitteeConfig")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api(tags = "执委会成员推选配置")
|
||||
public class ExecutiveCommitteeConfigController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ExecutiveCommitteeConfigService committeeConfigService;
|
||||
|
||||
|
||||
@At("/index")
|
||||
@SaCheckPermission("executiveCommittee.executiveCommitteeConfig")
|
||||
@Ok("beetl:/platform/zhgh/democratic/executiveCommittee/executiveCommitteeConfig/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("executiveCommittee.executiveCommitteeConfig")
|
||||
public Result fetchConfig(String sessionId) {
|
||||
ExecutiveCommitteeConfig config = committeeConfigService.fetch(Cnd.where("teacherMeetId", "=", sessionId));
|
||||
if(config == null) {
|
||||
config = new ExecutiveCommitteeConfig();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
dbt.id as delegationId,
|
||||
dbt.name as delegationName,
|
||||
dbt.code as delegationCode,
|
||||
(SELECT count( 1 ) FROM vw_user where unitId IN ( SELECT unitId FROM teacher_congress_delegation_unit unit WHERE unit.delegationId = dbt.id ) and member = 1) as memberCount,
|
||||
0 as quotaCount
|
||||
FROM
|
||||
teacher_congress_delegation dbt
|
||||
WHERE dbt.sessionId = @sessionId
|
||||
ORDER BY CODE ASC
|
||||
""").setParam("sessionId", sessionId);
|
||||
List<NutMap> listMap = committeeConfigService.listMap(sql);
|
||||
config.setDelegationQuotaList(listMap);
|
||||
}
|
||||
return Result.success(config);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("新增、修改预选名额分配")
|
||||
@SaCheckPermission("executiveCommittee.executiveCommitteeConfig")
|
||||
@SLog(type = "executiveCommitteeConfig", tag = "执委会推选-预选名额分配", msg ="新增、修改预选名额分配" )
|
||||
public Result onHandle(ExecutiveCommitteeConfig config) {
|
||||
committeeConfigService.insertOrUpdate(config);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeOnePush;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/25 15:18
|
||||
* @description 团长一次推选
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/executiveCommittee/delegationOnePush")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api(tags = "执委会推选-团长一次推选")
|
||||
public class ExecutiveCommitteeDelegationOnePushController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("/index")
|
||||
@SaCheckPermission("executiveCommittee.delegationOnePush")
|
||||
@Ok("beetl:/platform/zhgh/democratic/executiveCommittee/delegationOnePush/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询某个代表团的团长一次推选的委员")
|
||||
@SaCheckPermission("executiveCommittee.delegationOnePush")
|
||||
public Result pageData(PageForm pageForm,
|
||||
String teacherMeetId,
|
||||
String unionId) {
|
||||
Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class,
|
||||
Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId)
|
||||
.and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return Result.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.name AS unitName,
|
||||
t3.name unionName,
|
||||
t4.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t4.birthday,
|
||||
CURDATE()) AS age
|
||||
FROM
|
||||
`executive_committee_one_push` t1
|
||||
LEFT JOIN sys_unit t2 ON t1.unitId = t2.id
|
||||
LEFT JOIN `sys_union` t3 ON t3.id = t2.unionid
|
||||
LEFT JOIN `vw_user` t4 ON t4.id = t1.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.delegationId", "=", db.getDelegationId());
|
||||
cnd.andEX("t3.id", "=", unionId);
|
||||
cnd.andEX("t1.addType", "=", 1);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("t1.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("查询可以推选委员和已经推选的人员")
|
||||
@SaCheckPermission("executiveCommittee.delegationOnePush")
|
||||
public Result getDelegationUser(String teacherMeetId) {
|
||||
Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class,
|
||||
Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId)
|
||||
.and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return Result.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where(ExecutiveCommitteeConfig::getTeacherMeetId, "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getFirstStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return Result.error("请等待一次预选开始时间");
|
||||
}
|
||||
if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return Result.error("一次预选已结束");
|
||||
}
|
||||
List<ExecutiveCommitteeOnePush> userValue = dao.query(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 1));
|
||||
List<ExecutiveCommitteeOnePush> onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW());
|
||||
List<String> userIds = onePushList.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("db.sessionId", "=", teacherMeetId);
|
||||
cnd.andEX("db.userId", "not in", userIds);
|
||||
cnd.andEX("db.userId", "!=", SecurityUtil.getUserId());
|
||||
cnd.and("db.delegationId", "=", db.getDelegationId());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
teacher_congress_delegate db
|
||||
LEFT JOIN `vw_user` u ON db.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userData = baseService.listMap(sql);
|
||||
return Result.success(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("executiveCommittee.delegationOnePush")
|
||||
@SLog(tag = "执委会推选-团长推选委员", msg = "推选委员")
|
||||
public Result addOnePush(@Param("userValue") String[] userValue,
|
||||
String teacherMeetId) {
|
||||
try {
|
||||
Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class,
|
||||
Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId)
|
||||
.and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return Result.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getFirstStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return Result.error("请等待一次预选开始时间");
|
||||
}
|
||||
if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return Result.error("一次预选已结束");
|
||||
}
|
||||
List<NutMap> delegationQuotaList = config.getDelegationQuotaList();
|
||||
|
||||
NutMap delegationQuota = delegationQuotaList.stream().filter(v -> v.getString("delegationId").equals(db.getDelegationId())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(delegationQuota)) {
|
||||
return Result.error("请先配置代表团人数");
|
||||
}
|
||||
|
||||
int dbCount = dao.count(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("delegationId", "=", db.getDelegationId())
|
||||
.and("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 1));
|
||||
if (dbCount + userValue.length > delegationQuota.getInt("quotaCount")) {
|
||||
return Result.error("代表团人数限报" + delegationQuota.getInt("quotaCount") + "人");
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*
|
||||
FROM
|
||||
teacher_congress_delegate t1
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.sessionId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.userId", "in", userValue);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> dbList = baseService.listMap(sql);
|
||||
|
||||
|
||||
List<ExecutiveCommitteeOnePush> list = new ArrayList<>();
|
||||
for (String id : userValue) {
|
||||
NutMap jdhDb = dbList.stream().filter(v -> v.getString("userId").equals(id)).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(jdhDb)) {
|
||||
return Result.error("请选择正确的代表!");
|
||||
}
|
||||
ExecutiveCommitteeOnePush onePush = new ExecutiveCommitteeOnePush();
|
||||
onePush.setPushDate(DateUtil.date());
|
||||
onePush.setUserId(jdhDb.getString("userId"));
|
||||
onePush.setUserName(jdhDb.getString("userName"));
|
||||
onePush.setLoginName(jdhDb.getString("loginName"));
|
||||
onePush.setDelegationId(jdhDb.getString("delegationId"));
|
||||
onePush.setUnitId(jdhDb.getString("unitId"));
|
||||
onePush.setTeacherMeetId(teacherMeetId);
|
||||
String firstLetter = String.valueOf(getFirstLetter(jdhDb.getString("userName")));
|
||||
onePush.setFirstLetter(firstLetter);
|
||||
onePush.setAddType(1);
|
||||
list.add(onePush);
|
||||
}
|
||||
dao.insert(list);
|
||||
return Result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("添加失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("executiveCommittee.delegationOnePush")
|
||||
@SLog( tag = "执委会推选-团长推选委员", msg = "删除推选的人")
|
||||
public Result doDelete(String id) {
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.NEW());
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return Result.error("一次预选已结束不能删除!");
|
||||
}
|
||||
int num = dao.clear(ExecutiveCommitteeOnePush.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? Result.success() : Result.error();
|
||||
}
|
||||
|
||||
|
||||
public static char getFirstLetter(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
throw new IllegalArgumentException("字符串不能为空");
|
||||
}
|
||||
char firstChar = str.charAt(0);
|
||||
if (Validator.isChinese(String.valueOf(firstChar))) {
|
||||
return Character.toUpperCase(PinyinUtil.getPinyin(firstChar).charAt(0));
|
||||
} else if (Character.isLetter(firstChar)) {
|
||||
return Character.toUpperCase(firstChar);
|
||||
} else {
|
||||
return firstChar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeTwoPush;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/6/23 15:25
|
||||
* @description 团长二次推选
|
||||
*/
|
||||
@At("/platform/executiveCommittee/delegationTwoPush")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class ExecutiveCommitteeDelegationTwoPushController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("/index")
|
||||
@SaCheckPermission("executiveCommittee.delegationOnePush")
|
||||
@Ok("beetl:/platform/zhgh/democratic/executiveCommittee/delegationTwoPush/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("executiveCommittee.delegationTwoPush")
|
||||
public Result pageData(PageForm pageForm,
|
||||
String teacherMeetId,
|
||||
String delegationId,
|
||||
String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.loginName,
|
||||
t2.userName,
|
||||
t3.name AS unitName,
|
||||
t4.name unionName,
|
||||
t5.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t5.birthday,
|
||||
CURDATE()) AS age,
|
||||
t6.name AS delegationName
|
||||
FROM
|
||||
`executive_committee_two_push` t1
|
||||
LEFT JOIN executive_committee_one_push t2 on t2.userId=t1.userId and t2.teacherMeetId=t1.teacherMeetId
|
||||
LEFT JOIN sys_unit t3 ON t2.unitId = t3.id
|
||||
LEFT JOIN `sys_union` t4 ON t4.id = t3.unionid
|
||||
LEFT JOIN `vw_user` t5 ON t5.id = t1.userId
|
||||
LEFT JOIN teacher_congress_delegation t6 ON t6.id = t2.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.pushUserId", "=", SecurityUtil.getUserId());
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t2.delegationId", "=", delegationId);
|
||||
cnd.andEX("t4.id", "=", unionId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("t6.code").asc("t2.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("executiveCommittee.delegationTwoPush")
|
||||
@SLog(type = "执委会推选-团长二次推选", tag = "查询可以二次推选的名单", param = true, result = true)
|
||||
public Result getDelegationUser(String teacherMeetId) {
|
||||
Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class,
|
||||
Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId)
|
||||
.and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return Result.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getSecondStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return Result.error("请等待二次预选开始时间");
|
||||
}
|
||||
if (config.getSecondEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return Result.error("二次预选已结束");
|
||||
}
|
||||
List<ExecutiveCommitteeTwoPush> userValue = dao.query(ExecutiveCommitteeTwoPush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("pushUserId", "=", SecurityUtil.getUserId()));
|
||||
List<String> userIds = userValue.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.userId", "not in", userIds);
|
||||
cnd.andEX("t1.userId", "!=", SecurityUtil.getUserId());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t2.birthday,
|
||||
CURDATE()) age
|
||||
FROM
|
||||
executive_committee_one_push t1
|
||||
LEFT JOIN `vw_user` t2 ON t1.userId = t2.id
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userData = baseService.listMap(sql);
|
||||
return Result.success(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("executiveCommittee.delegationTwoPush")
|
||||
@ApiOperation("推选委员")
|
||||
@SLog(type = "executiveCommitteePreparatoryGroupPush", tag = "执委会推选-团长二次推选", msg = "推选委员")
|
||||
public Result addOnePush(@Param("userValue") String[] userValue,
|
||||
String teacherMeetId) {
|
||||
try {
|
||||
Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class,
|
||||
Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId)
|
||||
.and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (ObjectUtil.isEmpty(db)) {
|
||||
return Result.error("没有权限,只有代表团团长才能推选");
|
||||
}
|
||||
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getSecondStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return Result.error("请等待二次预选开始时间");
|
||||
}
|
||||
if (config.getSecondEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return Result.error("二次预选已结束");
|
||||
}
|
||||
int dbCount = dao.count(ExecutiveCommitteeTwoPush.class,
|
||||
Cnd.where("pushUserId", "=", SecurityUtil.getUserId())
|
||||
.and("teacherMeetId", "=", teacherMeetId));
|
||||
if (dbCount + userValue.length > config.getCommitteeQuotaCount()) {
|
||||
return Result.error("人数限报" + config.getCommitteeQuotaCount() + "人");
|
||||
}
|
||||
|
||||
List<Teacher_congress_delegate> dbList = dao.query(Teacher_congress_delegate.class,
|
||||
Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId)
|
||||
.andEX(Teacher_congress_delegate::getUserId, "in", userValue));
|
||||
List<ExecutiveCommitteeTwoPush> list = new ArrayList<>();
|
||||
for (String id : userValue) {
|
||||
Teacher_congress_delegate jdhDb = dbList.stream().filter(v -> v.getUserId().equals(id)).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(jdhDb)) {
|
||||
return Result.error("请选择正确的代表!");
|
||||
}
|
||||
ExecutiveCommitteeTwoPush twoPush = new ExecutiveCommitteeTwoPush();
|
||||
twoPush.setPushDate(DateUtil.date());
|
||||
twoPush.setUserId(id);
|
||||
twoPush.setPushDelegationId(db.getDelegationId());
|
||||
twoPush.setPushUserId(SecurityUtil.getUserId());
|
||||
twoPush.setPushUserName(SecurityUtil.getUserUsername());
|
||||
twoPush.setPushLoginName(SecurityUtil.getUserLoginname());
|
||||
twoPush.setTeacherMeetId(teacherMeetId);
|
||||
list.add(twoPush);
|
||||
}
|
||||
dao.insert(list);
|
||||
return Result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("添加失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除推选人员")
|
||||
@SaCheckPermission("executiveCommittee.delegationTwoPush")
|
||||
@SLog(type = "executiveCommitteePreparatoryGroupPush", tag = "执委会推选-团长二次推选", msg = "删除推选人员")
|
||||
public Result doDelete( String id) {
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.NEW());
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getSecondEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return Result.error("二次预选已结束不能删除!");
|
||||
}
|
||||
int num = dao.clear(ExecutiveCommitteeTwoPush.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? Result.success() : Result.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.param.ExecutiveCommitteePageForm;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.service.ExecutiveCommitteeConfigService;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.service.ExecutiveCommitteeMemberService;
|
||||
import com.budwk.app.zhgh.enrollmentRegistration.vo.EnrollmentRegistrationPageForm;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/26 08:40
|
||||
* @description 委员会名单
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/executiveCommittee/executiveCommitteeMember")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api(tags = "两委会推选-委员会名单")
|
||||
public class ExecutiveCommitteeMemberController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ExecutiveCommitteeMemberService committeeMemberService;
|
||||
|
||||
|
||||
@At("/index")
|
||||
@SaCheckPermission("executiveCommittee.executiveCommitteeMember")
|
||||
@Ok("beetl:/platform/zhgh/democratic/executiveCommittee/executiveCommitteeMember/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("executiveCommittee.executiveCommitteeMember")
|
||||
public Result pageData(ExecutiveCommitteePageForm pageForm) {
|
||||
Sql sql = committeeMemberService.getSql(pageForm);
|
||||
Pagination pagination = committeeMemberService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("查询每个人的推选人")
|
||||
@SaCheckPermission("executiveCommittee.executiveCommitteeMember")
|
||||
public Result onView(String teacherMeetId,
|
||||
String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
tp.*,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
dbt.name as delegationName
|
||||
from
|
||||
executive_committee_two_push tp
|
||||
left join vw_user u on u.id = tp.pushUserId
|
||||
left join teacher_congress_delegation dbt on dbt.id = tp.pushDelegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tp.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.and("tp.userId", "=", userId);
|
||||
cnd.desc("tp.pushDate");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = committeeMemberService.listMap(sql);
|
||||
return Result.success(listMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("executiveCommittee.executiveCommitteeMember")
|
||||
public void doExportExcel(@Param("data") ExecutiveCommitteePageForm pageForm, HttpServletResponse response) {
|
||||
|
||||
Sql sql = committeeMemberService.getSql(pageForm);
|
||||
|
||||
List<NutMap> map = committeeMemberService.listMap(sql);
|
||||
|
||||
try {
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 10));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 10));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 10));
|
||||
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
entityList.add(new ExcelExportEntity("所属单位", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("所属代表团", "delegationName", 20));
|
||||
entityList.add(new ExcelExportEntity("票数", "pushCount", 20));
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("委员会预选名单.xlsx", "UTF-8"));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, map);
|
||||
workbook.write(response.getOutputStream());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeOnePush;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/25 16:49
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/executiveCommittee/preparatoryGroupPush")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api(tags = "执委会推选-筹备组推选")
|
||||
public class ExecutiveCommitteePushController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("/index")
|
||||
@SaCheckPermission("executiveCommittee.preparatoryGroupPush")
|
||||
@Ok("beetl:/platform/zhgh/democratic/executiveCommittee/preparatoryGroupPush/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("executiveCommittee.preparatoryGroupPush")
|
||||
public Result pageData(PageForm pageForm,
|
||||
String teacherMeetId,
|
||||
String delegationId,
|
||||
String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.name AS unitName,
|
||||
t3.name unionName,
|
||||
t4.sex,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
t4.birthday,
|
||||
CURDATE()) AS age,
|
||||
t5.name AS delegationName
|
||||
FROM
|
||||
`executive_committee_one_push` t1
|
||||
LEFT JOIN sys_unit t2 ON t1.unitId = t2.id
|
||||
LEFT JOIN `sys_union` t3 ON t3.id = t2.unionid
|
||||
LEFT JOIN `vw_user` t4 ON t4.id = t1.userId
|
||||
LEFT JOIN teacher_congress_delegation t5 ON t5.id = t1.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("t1.teacherMeetId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.delegationId", "=", delegationId);
|
||||
cnd.andEX("t3.id", "=", unionId);
|
||||
cnd.andEX("t1.addType", "=", 2);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("t5.code").asc("t1.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("executiveCommittee.preparatoryGroupPush")
|
||||
@ApiOperation("查询可以推选委员和已经推选的人员")
|
||||
public Result getDelegationUser(String teacherMeetId) {
|
||||
List<ExecutiveCommitteeOnePush> userValue = dao.query(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 2));
|
||||
List<ExecutiveCommitteeOnePush> onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW());
|
||||
List<String> userIds = onePushList.stream().map(ExecutiveCommitteeOnePush::getUserId).collect(Collectors.toList());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("db.sessionId", "=", teacherMeetId);
|
||||
cnd.andEX("db.userId", "not in", userIds);
|
||||
cnd.andEX("db.userId", "!=", SecurityUtil.getUserId());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
db.*,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
teacher_congress_delegate db
|
||||
LEFT JOIN `vw_user` u ON db.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userData = baseService.listMap(sql);
|
||||
return Result.success(Map.of("userData", userData, "userValue", userValue));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("executiveCommittee.preparatoryGroupPush")
|
||||
@SLog(type = "executiveCommitteePreparatoryGroupPush", tag = "执委会推选-筹备组推选", msg = "推选委员")
|
||||
public Result addOnePush(@Param("userValue") String[] userValue,
|
||||
String teacherMeetId) {
|
||||
try {
|
||||
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
if (config.getFirstStartTime().getTime() > System.currentTimeMillis()) {
|
||||
return Result.error("请等待一次预选开始时间");
|
||||
}
|
||||
if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) {
|
||||
return Result.error("一次预选已结束");
|
||||
}
|
||||
|
||||
int dbCount = dao.count(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId)
|
||||
.and("addType", "=", 2));
|
||||
if (dbCount + userValue.length > config.getPrepareGroupQuotaCount()) {
|
||||
return Result.error("人数限报" + config.getPrepareGroupQuotaCount() + "人");
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*
|
||||
FROM
|
||||
teacher_congress_delegate t1
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.sessionId", "=", teacherMeetId);
|
||||
cnd.andEX("t1.userId", "in", userValue);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> dbList = baseService.listMap(sql);
|
||||
|
||||
List<ExecutiveCommitteeOnePush> list = new ArrayList<>();
|
||||
for (String id : userValue) {
|
||||
NutMap jdhDb = dbList.stream().filter(v -> v.getString("userId").equals(id)).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(jdhDb)) {
|
||||
return Result.error("请选择正确的代表!");
|
||||
}
|
||||
ExecutiveCommitteeOnePush onePush = new ExecutiveCommitteeOnePush();
|
||||
onePush.setPushDate(DateUtil.date());
|
||||
onePush.setUserId(jdhDb.getString("userId"));
|
||||
onePush.setUserName(jdhDb.getString("userName"));
|
||||
onePush.setLoginName(jdhDb.getString("loginName"));
|
||||
onePush.setDelegationId(jdhDb.getString("delegationId"));
|
||||
onePush.setUnitId(jdhDb.getString("unitId"));
|
||||
onePush.setTeacherMeetId(teacherMeetId);
|
||||
String firstLetter = String.valueOf(getFirstLetter(jdhDb.getString("userName")));
|
||||
onePush.setFirstLetter(firstLetter);
|
||||
onePush.setAddType(2);
|
||||
list.add(onePush);
|
||||
}
|
||||
dao.insert(list);
|
||||
return Result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("添加失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("executiveCommittee.preparatoryGroupPush")
|
||||
@SLog(type = "executiveCommitteePreparatoryGroupPush", tag = "执委会推选-筹备组推选", msg = "删除推选的人")
|
||||
public Result doDelete(String id) {
|
||||
ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.NEW());
|
||||
if (ObjectUtil.isEmpty(config)) {
|
||||
return Result.error("请先配置基础信息");
|
||||
}
|
||||
int num = dao.clear(ExecutiveCommitteeOnePush.class, Cnd.where("id", "=", id));
|
||||
return num >= 0 ? Result.success() : Result.error();
|
||||
}
|
||||
|
||||
|
||||
public static char getFirstLetter(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
throw new IllegalArgumentException("字符串不能为空");
|
||||
}
|
||||
char firstChar = str.charAt(0);
|
||||
if (Validator.isChinese(String.valueOf(firstChar))) {
|
||||
return Character.toUpperCase(PinyinUtil.getPinyin(firstChar).charAt(0));
|
||||
} else if (Character.isLetter(firstChar)) {
|
||||
return Character.toUpperCase(firstChar);
|
||||
} else {
|
||||
return firstChar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.models;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
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;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeConfig
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 15:30
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("executive_committee_config")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("执委会成员推选配置表")
|
||||
public class ExecutiveCommitteeConfig extends BaseModel implements Serializable {
|
||||
|
||||
@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 teacherMeetId;
|
||||
|
||||
@Column
|
||||
@Comment("筹备组推荐名额数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer prepareGroupQuotaCount;
|
||||
|
||||
@Column
|
||||
@Comment("委员会预选人数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer committeeQuotaCount;
|
||||
|
||||
@Column
|
||||
@Comment("代表团推荐名额总数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer delegationQuotaCount;
|
||||
|
||||
@Column
|
||||
@Comment("一次预选开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private DateTime firstStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("一次预选结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private DateTime firstEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("二次预选开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private DateTime secondStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("二次预选结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private DateTime secondEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("各代表团名额数")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> delegationQuotaList;
|
||||
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.models;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/6/20 16:16
|
||||
* @description 执委会成员推选表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("executive_committee_one_push")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("执委会成员推选表")
|
||||
public class ExecutiveCommitteeOnePush extends BaseModel implements Serializable {
|
||||
|
||||
@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("所属教代会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String teacherMeetId;
|
||||
|
||||
@Column
|
||||
@Comment("所属代表团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String delegationId;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("职称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String jobTitle;
|
||||
|
||||
@Column
|
||||
@Comment("职称级别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String jobTitleLevel;
|
||||
|
||||
@Column
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("推选时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private DateTime pushDate;
|
||||
|
||||
@Column
|
||||
@Comment("姓氏排序")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String firstLetter;
|
||||
|
||||
@Column
|
||||
@Comment("设置类型(1.团长2.筹备组加的)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer addType;
|
||||
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.models;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/6/20 17:10
|
||||
* @description 二次推选
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("executive_committee_two_push")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("执委会成员推选表")
|
||||
public class ExecutiveCommitteeTwoPush extends BaseModel implements Serializable {
|
||||
|
||||
@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("所属教代会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String teacherMeetId;
|
||||
|
||||
@Column
|
||||
@Comment("推选的代表团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String pushDelegationId;
|
||||
|
||||
@Column
|
||||
@Comment("推选人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String pushUserId;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String pushUserName;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String pushLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("推选时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private DateTime pushDate;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/26 09:27
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class ExecutiveCommitteePageForm extends PageForm {
|
||||
|
||||
private String teacherMeetId;
|
||||
private String delegationId;
|
||||
private String unionId;
|
||||
private String unitId;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.service;
|
||||
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeConfigService
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 15:31
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface ExecutiveCommitteeConfigService extends BaseService<ExecutiveCommitteeConfig> {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.param.ExecutiveCommitteePageForm;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
public interface ExecutiveCommitteeMemberService extends BaseService {
|
||||
|
||||
|
||||
|
||||
Sql getSql(ExecutiveCommitteePageForm pageForm);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.service.ExecutiveCommitteeConfigService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName ExecutiveCommitteeConfigServiceImpl
|
||||
* @Author JyuHsin
|
||||
* @Date 2025/6/20 15:31
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ExecutiveCommitteeConfigServiceImpl extends BaseServiceImpl<ExecutiveCommitteeConfig> implements ExecutiveCommitteeConfigService {
|
||||
|
||||
public ExecutiveCommitteeConfigServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.budwk.app.zhgh.democratic.executiveCommittee.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.param.ExecutiveCommitteePageForm;
|
||||
import com.budwk.app.zhgh.democratic.executiveCommittee.service.ExecutiveCommitteeMemberService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/26 09:22
|
||||
* @description
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ExecutiveCommitteeMemberServiceImpl extends BaseServiceImpl implements ExecutiveCommitteeMemberService {
|
||||
public ExecutiveCommitteeMemberServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql getSql(ExecutiveCommitteePageForm pageForm) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
op.*,
|
||||
u.sex,
|
||||
it.name unitName,
|
||||
un.name unionName,
|
||||
u.mobile,
|
||||
dbt.name as delegationName,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
u.birthday,
|
||||
CURDATE()) AS age,
|
||||
( SELECT count( 1 ) FROM executive_committee_two_push tp WHERE tp.userId = op.userId ) as pushCount
|
||||
FROM
|
||||
executive_committee_one_push op
|
||||
LEFT JOIN sys_unit it ON op.unitId = it.id
|
||||
LEFT JOIN `sys_union` un ON it.unionid = un.id
|
||||
left join vw_user u on op.userId = u.id
|
||||
left join teacher_congress_delegation dbt on dbt.id = op.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("op.teacherMeetId", "=", pageForm.getTeacherMeetId());
|
||||
cnd.andEX("op.unitId", "=", pageForm.getUnitId());
|
||||
cnd.andEX("it.unionid", "=", pageForm.getUnionId());
|
||||
cnd.andEX("op.delegationId", "=", pageForm.getDelegationId());
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.desc("pushCount");
|
||||
cnd.asc("op.firstLetter");
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.prepare.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_quota_allocation;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/26 14:11
|
||||
* @description 代表名额分配
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/teacherCongress/prepare/quotaAllocation")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "教代会届次管理")
|
||||
public class TeacherCongressQuotaAllocationController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/prepare/quotaAllocation/index.html")
|
||||
@SaCheckPermission("tc.prepare.quotaAllocation")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.prepare.quotaAllocation")
|
||||
@ApiOperation(value = "分工会列表")
|
||||
public Result pageData(String unionId, String sessionId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.NAME AS unionName,
|
||||
tcqa.allocationNum,
|
||||
tcqa.ratio,
|
||||
tcqa.seniorTeaNum,
|
||||
tcqa.ordinaryTeaNum,
|
||||
tcqa.femaleNum,
|
||||
tcqa.less45Num,
|
||||
COALESCE(u_count, 0) AS memberCount,
|
||||
COALESCE(db_count, 0) AS dbCount
|
||||
FROM
|
||||
sys_union un
|
||||
LEFT JOIN teacher_congress_quota_allocation tcqa ON tcqa.sessionId = @sessionId
|
||||
AND tcqa.unionId = un.id
|
||||
LEFT JOIN (SELECT unionId, COUNT(id) AS u_count FROM vw_user WHERE member = 1 GROUP BY unionId) u ON u.unionId = un.id
|
||||
LEFT JOIN (SELECT unionId, COUNT(id) AS db_count FROM teacher_congress_delegate WHERE sessionId = @sessionId GROUP BY unionId) db ON db.unionId = un.id
|
||||
$condition
|
||||
""").setParam("sessionId", sessionId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("un.id", "=", unionId);
|
||||
cnd.groupBy("un.id");
|
||||
cnd.asc("un.unionCode");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.prepare.quotaAllocation")
|
||||
@ApiOperation(value = "分工会列表")
|
||||
public Result getUnionLimit(String sessionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id AS unionId,
|
||||
un.`name` AS unionName,
|
||||
un.unionCode,
|
||||
COALESCE(u_count, 0) AS memberCount,
|
||||
t2.sessionId,
|
||||
t2.allocationNum,
|
||||
t2.ratio,
|
||||
t2.seniorTeaNum,
|
||||
t2.ordinaryTeaNum,
|
||||
t2.femaleNum,
|
||||
t2.less45Num
|
||||
FROM
|
||||
`sys_union` un
|
||||
LEFT JOIN (SELECT unionId, COUNT(id) AS u_count FROM vw_user WHERE member = 1 GROUP BY unionId) u ON u.unionId = un.id
|
||||
LEFT JOIN teacher_congress_quota_allocation t2 ON t2.unionId = un.id
|
||||
AND t2.sessionId = @sessionId
|
||||
ORDER BY
|
||||
un.unionCode
|
||||
""");
|
||||
sql.setParam("sessionId", sessionId);
|
||||
List<NutMap> nutMaps = baseService.listMap(sql);
|
||||
return Result.success(nutMaps);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.prepare.quotaAllocation")
|
||||
@ApiOperation("添加分配")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result doQuotaAllocation(@Param("list")Teacher_congress_quota_allocation[] list,String sessionId){
|
||||
|
||||
dao.clear(Teacher_congress_quota_allocation.class,
|
||||
Cnd.where(Teacher_congress_quota_allocation::getSessionId, "=", sessionId));
|
||||
for (Teacher_congress_quota_allocation quotaAllocation : list) {
|
||||
quotaAllocation.setSessionId(sessionId);
|
||||
}
|
||||
dao.insert(list);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.prepare.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;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/8/26 14:35
|
||||
* @description 名额分配
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("teacher_congress_quota_allocation")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("名额分配")
|
||||
public class Teacher_congress_quota_allocation 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("分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("名额分配数")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Default("0")
|
||||
private Integer allocationNum;
|
||||
|
||||
@Column
|
||||
@Comment("名额分配比例")
|
||||
@ColDefine(type = ColType.DOUBLE, width = 4)
|
||||
@Default("0")
|
||||
private Double ratio;
|
||||
|
||||
@Column
|
||||
@Comment("高级职称专任教师代表数")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Default("0")
|
||||
private Integer seniorTeaNum;
|
||||
|
||||
@Column
|
||||
@Comment("专任教师代表数")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Default("0")
|
||||
private Integer ordinaryTeaNum;
|
||||
|
||||
@Column
|
||||
@Comment("女代表数")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Default("0")
|
||||
private Integer femaleNum;
|
||||
|
||||
@Column
|
||||
@Comment("45岁以下代表数")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
@Default("0")
|
||||
private Integer less45Num;
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user