first commit
This commit is contained in:
+177
@@ -0,0 +1,177 @@
|
||||
package com.budwk.app.zhgh.activity.basic.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
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.zhgh.activity.basic.models.ActivityBasicSettings;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityEvent;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityBasicEventController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/5 14:05
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/basic/event")
|
||||
public class ActivityBasicEventController {
|
||||
|
||||
//运动类型id
|
||||
public static final String EXERCISE_TYPE = "f708d6343c9542b791d32532f860d120";
|
||||
|
||||
//比赛组别id
|
||||
public static final String COMPETITION_CATEGORY = "60f9c36cadce493494a2373cc64d216f";
|
||||
//距离id
|
||||
public static final String DISTANCE = "d6d9196e87184729abd0dca1bd5df984";
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/basic/event/index.html")
|
||||
@SaCheckPermission("activity.basic.event")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
public Result focusGroup() {
|
||||
List<ActivityBasicSettings> list = dao.query(ActivityBasicSettings.class, Cnd.where("parentId", "=", COMPETITION_CATEGORY).asc("code"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object exerciseType() {
|
||||
List<ActivityBasicSettings> list = dao.query(ActivityBasicSettings.class, Cnd.where("parentId", "=", EXERCISE_TYPE));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object focusDistance() {
|
||||
List<ActivityBasicSettings> list = dao.query(ActivityBasicSettings.class, Cnd.where("parentId", "=", DISTANCE).asc("name"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object changeExercise_typeList(String exerciseType) {
|
||||
List<ActivityBasicSettings> list = dao.query(ActivityBasicSettings.class, Cnd.where("parentId", "=", exerciseType));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.basic.event")
|
||||
public Result pageData(PageForm page,
|
||||
String group,
|
||||
String events,
|
||||
@Param(value = "isMenWomen") String[] isMenWomen,
|
||||
String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
even.*,
|
||||
ba.`name` baname,
|
||||
di.`name` diname,
|
||||
sp.`name` spname,
|
||||
exe.`name` exename
|
||||
FROM
|
||||
activity_event even
|
||||
LEFT JOIN activity_school_event ase ON ase.eventId = even.id
|
||||
LEFT JOIN activity_basic_settings ba ON even.competitionCategory = ba.id
|
||||
LEFT JOIN activity_basic_settings di ON even.distance = di.id
|
||||
LEFT JOIN activity_basic_settings sp ON even.sports = sp.id
|
||||
LEFT JOIN activity_basic_settings exe ON even.exerciseType = exe.id $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("2"))) {
|
||||
sqlExpressionGroup.and("even.isMenWomen", "=", 1);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("3"))) {
|
||||
sqlExpressionGroup.or("even.isMenWomen", "=", 2);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("4"))) {
|
||||
sqlExpressionGroup.and("even.projectType", "=", 1);
|
||||
}
|
||||
if (Arrays.stream(isMenWomen).anyMatch(a -> a.equals("5"))) {
|
||||
sqlExpressionGroup.or("even.projectType", "=", 2);
|
||||
}
|
||||
if (sqlExpressionGroup.getExps().size() > 0) {
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
cnd.groupBy("even.id");
|
||||
cnd.andEX("even.competitionCategory", "=", group);
|
||||
cnd.andEX("exe.id", "=", events);
|
||||
cnd.andEX("ase.activityId", "=", activityId);
|
||||
cnd.desc("projectCode");
|
||||
cnd.asc("projectType");
|
||||
cnd.desc("baname");
|
||||
cnd.asc("isMenWomen");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动项目管理", msg = "添加项目")
|
||||
@SaCheckPermission("activity.basic.event")
|
||||
public Object doAdd(ActivityEvent activityEvent) {
|
||||
activityEvent.setWhetherEnable(true);
|
||||
baseService.insert(activityEvent);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动项目管理", msg = "编辑项目")
|
||||
@SaCheckPermission("activity.basic.event")
|
||||
public Object doEdit(ActivityEvent activityEvent) {
|
||||
baseService.update(activityEvent);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动项目管理", msg = "删除项目")
|
||||
@SaCheckPermission("activity.basic.event")
|
||||
public Object doDelete(String id) {
|
||||
baseService.dao().delete(ActivityEvent.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动项目管理", msg = "批量设置项目年龄限制")
|
||||
@SaCheckPermission("activity.basic.event")
|
||||
public Object doAssignmentDate(@Param(value = "eventIds") @Valid String[] eventIds, String startAgeDate, String endAgeDate) {
|
||||
dao.update(ActivityEvent.class,
|
||||
Chain.make("startAgeDate", startAgeDate).add("endAgeDate", endAgeDate),
|
||||
Cnd.where("id", "in", eventIds));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.basic.event")
|
||||
public Object getProjectCodeIsExist(String projectCode) {
|
||||
ActivityEvent event = baseService.dao().fetch(ActivityEvent.class, Cnd.where("projectCode", "=", projectCode));
|
||||
return Result.success(event);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+365
@@ -0,0 +1,365 @@
|
||||
package com.budwk.app.zhgh.activity.basic.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.activity.basic.param.ActivityUserScopePageParam;
|
||||
import com.budwk.app.zhgh.activity.basic.service.ActivityBasicScopeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
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.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 org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 活动人员分组设置
|
||||
* @createTime 2022年01月04日 10:15:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/basic/scope")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class ActivityBasicScopeController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private ActivityBasicScopeService activityBasicScopeService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/basic/userScope/index.html")
|
||||
@SaCheckPermission("activity.basic.scope")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询可以设置活动的人员
|
||||
*
|
||||
* @return {@link Result}
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.basic.scope")
|
||||
public Result pageData(@Param("data") ActivityUserScopePageParam pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
DISTINCT(u.id) as id,
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
`vw_user` u
|
||||
LEFT JOIN sys_user_role sur on sur.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
try {
|
||||
Cnd cnd = getCnd(pageForm);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
} catch (NumberFormatException e) {
|
||||
return Result.error(e.getMessage() + "请输入数字类型的值");
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置活动人员
|
||||
*
|
||||
* @return Result
|
||||
*/
|
||||
@At
|
||||
@SLog(tag = "活动人员设置", msg = "设置活动人员")
|
||||
@SaCheckPermission("activity.basic.scope")
|
||||
public Object doSetActivityUser(@Param("data") ActivityUserScopePageParam activityUserScopePageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT DISTINCT
|
||||
( u.id ) AS userId
|
||||
FROM
|
||||
`vw_user` u
|
||||
LEFT JOIN sys_user_role sur ON sur.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = getCnd(activityUserScopePageParam);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.entities());
|
||||
sql.setEntity(dao.getEntity(ActivityUserScope.class));
|
||||
dao.execute(sql);
|
||||
|
||||
List<ActivityUserScope> list = sql.getList(ActivityUserScope.class);
|
||||
|
||||
String groupName = null;
|
||||
int maxCount = 0;
|
||||
|
||||
if (activityUserScopePageParam.getSetGroupType() == 1) {
|
||||
groupName = dao.execute(Sqls.fetchString("select groupName from activity_user_scope where groupId = @groupId").setParam("groupId", activityUserScopePageParam.getSetGroupId())).getString();
|
||||
} else if (activityUserScopePageParam.getSetGroupType() == 2) {
|
||||
maxCount = baseService.count(Sqls.create("select max(groupId) from activity_user_scope"));
|
||||
}
|
||||
|
||||
for (ActivityUserScope userScope : list) {
|
||||
if (activityUserScopePageParam.getSetGroupType() == 1) {
|
||||
userScope.setGroupId(activityUserScopePageParam.getSetGroupId());
|
||||
userScope.setGroupName(groupName);
|
||||
} else if (activityUserScopePageParam.getSetGroupType() == 2) {
|
||||
userScope.setGroupId(maxCount + 1);
|
||||
userScope.setGroupName(activityUserScopePageParam.getSetGroupName());
|
||||
}
|
||||
userScope.setCreator(SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
if (list.size() < 500) {
|
||||
dao.insert(list);
|
||||
return Result.success(activityUserScopePageParam.getSetGroupType() == 1 ? activityUserScopePageParam.getSetGroupId() : maxCount + 1);
|
||||
}
|
||||
//多线程插入
|
||||
activityBasicScopeService.largeDataInsert(list);
|
||||
return Result.success(activityUserScopePageParam.getSetGroupType() == 1 ? activityUserScopePageParam.getSetGroupId() : maxCount + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组别
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object getActivityUserScopeGroup() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
groupId,
|
||||
groupName
|
||||
FROM
|
||||
activity_user_scope
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!StpUtil.hasRole(RoleConstant.SYSADMIN.name()) &&
|
||||
!StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("creator", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
cnd.and("groupId", "IS NOT", null);
|
||||
cnd.and("groupName", "IS NOT", null);
|
||||
cnd.groupBy("groupId");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(baseService.listMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看该人员是否在活动范围中
|
||||
*
|
||||
* @param activityGroupId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object getScopeUser(String activityGroupId, @Param(value = "userId") String userId) {
|
||||
String userid = StrUtil.isNotBlank(userId) ? userId : SecurityUtil.getUserId();
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId).and("userId", "=", userid));
|
||||
return Result.success(count);
|
||||
}
|
||||
|
||||
@At
|
||||
public Object getRoleListByMenuId(String menuId) {
|
||||
return Result.success(dao.query(Sys_role.class, Cnd.where("system_name", "=", menuId).desc("code")));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户权限及获取工会id
|
||||
*
|
||||
* @return java.lang.Object
|
||||
* @author zhf
|
||||
* @description
|
||||
*/
|
||||
@At
|
||||
public Result getRolesAndUnion() {
|
||||
return Result.success(new NutMap() {{
|
||||
addv("is_A06", StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()));
|
||||
addv("is_H04", StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()));
|
||||
addv("is_sysadmin", StpUtil.hasRole(RoleConstant.SYSADMIN.name()));
|
||||
addv("unionid", SecurityUtil.getUnionId());
|
||||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息表列
|
||||
* 提供两种方式
|
||||
*
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
public Object getUserTableColumnInfo() {
|
||||
try {
|
||||
//2.从数据库查询
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
COLUMN_NAME,
|
||||
DATA_TYPE,
|
||||
CHARACTER_MAXIMUM_LENGTH,
|
||||
COLUMN_COMMENT
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = 'sys_user'
|
||||
AND TABLE_SCHEMA = 'budwk_v5_mini'
|
||||
""");
|
||||
List<NutMap> sqlDataList = activityBasicScopeService.listMap(sql);
|
||||
// sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE"))));
|
||||
sqlDataList.forEach(v -> v.put("DATA_TYPE", v.getString("DATA_TYPE")));
|
||||
return Result.success(sqlDataList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.basic.scope")
|
||||
public void doExportUser(@Param("data") ActivityUserScopePageParam activityUserScopePageParam, HttpServletResponse response) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
DISTINCT(u.id) as id,
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
`vw_user` u
|
||||
LEFT JOIN sys_user_role sur on sur.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
try {
|
||||
Cnd cnd = getCnd(activityUserScopePageParam);
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> map = baseService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
Map<String, String> propMap = Json.fromJson(Map.class, activityUserScopePageParam.getProps());
|
||||
propMap.forEach((k, v) -> {
|
||||
entityList.add(new ExcelExportEntity(v, k, 40));
|
||||
});
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("人员名单.xls").getBytes("utf-8"), "ISO8859-1"));
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, map);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Cnd getCnd(ActivityUserScopePageParam activityUserScopePageParam) {
|
||||
String IN_OR_NIN_OP = activityUserScopePageParam.getReverseSelection() ? "NOT IN" : "IN";
|
||||
String EQ_OR_NEQ_OP = activityUserScopePageParam.getReverseSelection() ? "!=" : "=";
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(activityUserScopePageParam.getPageOrderName()) && StrUtil.isNotBlank(activityUserScopePageParam.getPageOrderBy())) {
|
||||
cnd.orderBy(activityUserScopePageParam.getPageOrderName(), activityUserScopePageParam.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
}
|
||||
|
||||
if (activityUserScopePageParam.getActivityGroupId() != null) {
|
||||
Sql sqlx = Sqls.createf("SELECT userId FROM activity_user_scope where groupId = '%s'", activityUserScopePageParam.getActivityGroupId());
|
||||
cnd.and("u.id", activityUserScopePageParam.getReverseSelection() ? "IN" : "NOT IN", sqlx);
|
||||
}
|
||||
|
||||
cnd.andEX("u.id", IN_OR_NIN_OP, activityUserScopePageParam.getUserId());
|
||||
|
||||
if (Lang.isNotEmpty(activityUserScopePageParam.getMemberTypes())) {
|
||||
if (ArrayUtils.contains(activityUserScopePageParam.getMemberTypes(), "工会会员")) {
|
||||
cnd.and("u.member", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(activityUserScopePageParam.getMemberTypes(), "福利会员")) {
|
||||
cnd.and("u.welfareMember", EQ_OR_NEQ_OP, 1);
|
||||
}
|
||||
if (ArrayUtils.contains(activityUserScopePageParam.getMemberTypes(), "基金会员")) {
|
||||
cnd.and(new Static(" u.loginname " + IN_OR_NIN_OP + " (select loginname from sick_fund_member)"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!Lang.isEmptyArray(activityUserScopePageParam.getAge())) {
|
||||
if (!activityUserScopePageParam.getAge()[1].equals("0")) {
|
||||
if (activityUserScopePageParam.getReverseSelection()) {
|
||||
cnd.andNot("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", activityUserScopePageParam.getAge());
|
||||
} else {
|
||||
cnd.and("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", activityUserScopePageParam.getAge());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
|
||||
cnd.andEX("u.unionid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnionId());
|
||||
cnd.andEX("u.unitid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnitId());
|
||||
cnd.andEX("u.personType", IN_OR_NIN_OP, activityUserScopePageParam.getPersonTypes());
|
||||
cnd.andEX("u.userState", IN_OR_NIN_OP, activityUserScopePageParam.getUserStates());
|
||||
cnd.andEX("u.sex", IN_OR_NIN_OP, activityUserScopePageParam.getSexTypes());
|
||||
cnd.andEX("sur.jdhid", EQ_OR_NEQ_OP, activityUserScopePageParam.getTeacherMeetingId());
|
||||
cnd.andEX("sur.roleid", IN_OR_NIN_OP, activityUserScopePageParam.getRoleIds());
|
||||
cnd.andEX("clubuser.clubid", EQ_OR_NEQ_OP, activityUserScopePageParam.getClubId());
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return cnd;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
package com.budwk.app.zhgh.activity.basic.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.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.activity.basic.models.ActivityUserScope;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityBasicScopeUserDataController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/6 10:34
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/basic/user")
|
||||
@Ok("json:full")
|
||||
public class ActivityBasicScopeUserDataController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/basic/userScopeData/index.html")
|
||||
@SaCheckPermission("activity.basic.user")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.basic.user")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "personType") String personType,
|
||||
@Param(value = "userState") String userState,
|
||||
@Param(value = "groupId") Integer groupId) {
|
||||
/* Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
aus.id,
|
||||
u.username AS userName,
|
||||
u.loginname AS loginName,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
aus.groupId,
|
||||
aus.groupName,
|
||||
actun.unionname AS activityUnionName
|
||||
FROM
|
||||
activity_user_scope aus
|
||||
LEFT JOIN `vw_user` u ON u.id = aus.userId
|
||||
LEFT JOIN activity_basic_unit actit ON actit.id=u.unitid
|
||||
LEFT JOIN activity_basic_union actun ON actit.unionid=actun.id
|
||||
$condition
|
||||
""");*/
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
aus.id,
|
||||
u.username AS userName,
|
||||
u.loginname AS loginName,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
aus.groupId,
|
||||
aus.groupName
|
||||
FROM
|
||||
activity_user_scope aus
|
||||
LEFT JOIN `vw_user` u ON u.id = aus.userId
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
}
|
||||
cnd.andEX("aus.groupId", "=", groupId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
if (!StpUtil.hasRole(RoleConstant.SYSADMIN.name()) &&
|
||||
!StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("aus.creator", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除一条记录
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SLog(tag = "活动人员查询", msg = "删除活动人员")
|
||||
@SaCheckPermission("activity.basic.user")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result doDelete(@Param(value = "id") String id,
|
||||
@Param(value = "groupId") Integer groupId,
|
||||
@Param(value = "searchKeyword") String searchKeyword,
|
||||
@Param(value = "searchName") String searchName,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "personType") String personType,
|
||||
@Param(value = "userState") String userState) {
|
||||
Sql sql = Sqls.create("select id from `vw_user` u $condition");
|
||||
Cnd userCnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) {
|
||||
userCnd.and(Cnd.likeEX(searchName, searchKeyword));
|
||||
}
|
||||
userCnd.andEX("u.unionid", "=", unionId);
|
||||
userCnd.andEX("u.unitid", "=", unitId);
|
||||
userCnd.andEX("u.personType", "=", personType);
|
||||
userCnd.andEX("u.userState", "=", userState);
|
||||
userCnd.andEX("u.id", "=", id);
|
||||
sql.setCondition(userCnd);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("groupId", "=", groupId);
|
||||
if (!StpUtil.hasRole(RoleConstant.SYSADMIN.name()) &&
|
||||
!StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("creator", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
cnd.and("id", "=", id);
|
||||
} else {
|
||||
cnd.and(new Static("userId in (" + sql + ")"));
|
||||
}
|
||||
baseService.dao().clear(ActivityUserScope.class, cnd);
|
||||
baseService.dao().clear(ActivityUserScope.class, Cnd.where(ActivityUserScope::getUserId, "not in", Sqls.create("select id from sys_user")));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
package com.budwk.app.zhgh.activity.basic.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.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicSettings;
|
||||
import org.nutz.dao.Chain;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityBasicSettings
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/5 11:32
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/basic/settings")
|
||||
public class ActivityBasicSettingsController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/basic/settings/index.html")
|
||||
@SaCheckPermission("activity.basic.settings")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Result tree() {
|
||||
List list = new ArrayList();
|
||||
ActivityBasicSettings parentId = dao.fetch(ActivityBasicSettings.class, Cnd.where("parentId", "=", "0"));
|
||||
if (parentId != null) {
|
||||
parentId.setChild(child(parentId.getId()));
|
||||
list.add(parentId);
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
private List<ActivityBasicSettings> child(String parentId) {
|
||||
List<ActivityBasicSettings> basicSettings = dao.query(ActivityBasicSettings.class, Cnd.where("parentId", "=", parentId).asc("code"));
|
||||
basicSettings.forEach(v -> {
|
||||
v.setChild(child(v.getId()));
|
||||
});
|
||||
return basicSettings;
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.basic.settings")
|
||||
public Result pageData(String parentId, PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isBlank(parentId)) {
|
||||
ActivityBasicSettings rootSetting = dao.fetch(ActivityBasicSettings.class, Cnd.where("parentId", "=", 0));
|
||||
cnd.and("parentId", "=", rootSetting.getId());
|
||||
} else {
|
||||
cnd.and("parentId", "=", parentId);
|
||||
}
|
||||
Sql sql = Sqls.create("select * from activity_basic_settings $condition");
|
||||
cnd.asc("code");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "活动基础工具设置", msg = "新增信息")
|
||||
@SaCheckPermission("activity.basic.settings")
|
||||
public Result doAdd(ActivityBasicSettings activityBasicSettings) {
|
||||
if (dao.count(ActivityBasicSettings.class, Cnd.where("code", "=", activityBasicSettings.getCode())) > 0) {
|
||||
return Result.error("代码已存在");
|
||||
}
|
||||
dao.update(ActivityBasicSettings.class, Chain.make("hasChildren", true), Cnd.where("id", "=", activityBasicSettings.getParentId()));
|
||||
dao.insert(activityBasicSettings);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "活动基础工具设置", msg = "删除信息")
|
||||
@SaCheckPermission("activity.basic.settings")
|
||||
public Result doDelete(String id) {
|
||||
dao.delete(ActivityBasicSettings.class, id);
|
||||
dao.clear(ActivityBasicSettings.class, Cnd.where("parentId", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "活动基础工具设置", msg = "编辑信息")
|
||||
@SaCheckPermission("activity.basic.settings")
|
||||
public Result doEditType(ActivityBasicSettings activityBasicSettings) {
|
||||
dao.updateIgnoreNull(activityBasicSettings);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
public Result getActivityTwoLevelType(String code) {
|
||||
ActivityBasicSettings fetch = dao.fetch(ActivityBasicSettings.class, Cnd.where("code", "=", code));
|
||||
List<ActivityBasicSettings> query = dao.query(ActivityBasicSettings.class, Cnd.where("parentId", "=", fetch.getId()).asc("code"));
|
||||
return Result.success(query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
package com.budwk.app.zhgh.activity.basic.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnion;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnit;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
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.Lang;
|
||||
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.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityBasicUnionController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/6 11:47
|
||||
*/
|
||||
@IocBean
|
||||
@At({"/platform/activity/basic/union", "/platform/activity/basic/union2"})
|
||||
@Ok("json:full")
|
||||
public class ActivityBasicUnionController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/basic/union/index.html")
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public Result tree() {
|
||||
List<Tree<String>> treeList = null;
|
||||
try {
|
||||
boolean schoolUnionAdmin = StpUtil.hasRole("SchoolUnionAdmin");
|
||||
schoolUnionAdmin = true;
|
||||
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
|
||||
nodeList.add(new TreeNode<>("工会委员会", "0", "工会委员会", 1000));
|
||||
|
||||
if (schoolUnionAdmin) {
|
||||
List<ActivityBasicUnion> list = dao.query(ActivityBasicUnion.class, Cnd.NEW().asc("unionCode"));
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
nodeList.add(new TreeNode<>(list.get(i).getId(), "工会委员会", list.get(i).getName(), i));
|
||||
}
|
||||
}
|
||||
treeList = TreeUtil.build(nodeList, "0");
|
||||
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
ActivityBasicUnit basicUnit = dao.fetch(ActivityBasicUnit.class, Cnd.where("id", "=", SecurityUtil.getUnitId()));
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX("un.name", pageForm.getSearchKeyword()));
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.*,
|
||||
(SELECT COUNT(*) FROM activity_basic_unit WHERE unionId=un.id) unitnum,
|
||||
GROUP_CONCAT( us.username, '(', us.loginname, ')' ) userNames
|
||||
FROM
|
||||
activity_basic_union un
|
||||
LEFT JOIN sys_user_role sur ON un.id = sur.unionId
|
||||
LEFT JOIN sys_role sr ON sr.id=sur.roleId AND sr.code=@roleCode
|
||||
LEFT JOIN sys_user us ON us.id = sur.userId
|
||||
$condition
|
||||
""").setParam("roleCode", RoleConstant.BRANCH_UNION_CHAIRMAN.name());
|
||||
cnd.groupBy("un.id");
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("un.id", "=", basicUnit.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.asc("un.unionCode");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
public Result findOne(String id) {
|
||||
ActivityBasicUnion union = dao.fetch(ActivityBasicUnion.class, id);
|
||||
return Result.success(union);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public Result insert(ActivityBasicUnion union) {
|
||||
try {
|
||||
union.setSource("activity");
|
||||
dao.insert(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public Result update(ActivityBasicUnion union) {
|
||||
try {
|
||||
dao.updateIgnoreNull(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public Result doDeleteUnion(String id, Boolean flag) {
|
||||
if (flag) {
|
||||
dao.delete(ActivityBasicUnion.class, id);
|
||||
} else {
|
||||
List<ActivityBasicUnit> unitList = dao.query(ActivityBasicUnit.class, Cnd.where("unionId", "=", id));
|
||||
unitList.forEach(v -> {
|
||||
Sys_unit unit = dao.fetch(Sys_unit.class, v.getId());
|
||||
dao.update(ActivityBasicUnit.class, Chain.make("unionId", unit.getUnionId()), Cnd.where("id", "=", unit.getId()));
|
||||
});
|
||||
}
|
||||
//再清除单位对应的工会id
|
||||
dao.update(ActivityBasicUnit.class, Chain.make("unionId", ""), Cnd.where("unionId", "=", id));
|
||||
Sys_role sysRole = dao.fetch(Sys_role.class, Cnd.where("code", "=", RoleConstant.BRANCH_UNION_CHAIRMAN.name()));
|
||||
dao.clear("sys_user_role", Cnd.where("unionId", "=", id).and("roleId", "=", sysRole.getId()));
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public Result getUnionAdminAndUser(String id) {
|
||||
|
||||
Sql sqlUser = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
CONCAT( u.username, '(', u.loginname, ')', '-', u.unitname ) `name`
|
||||
FROM
|
||||
`vw_user` u
|
||||
LEFT JOIN activity_basic_unit un ON u.unitid = un.id
|
||||
WHERE
|
||||
un.unionid = @id
|
||||
""").setParam("id", id);
|
||||
|
||||
List<NutMap> userDataMap = baseService.listMap(sqlUser);
|
||||
|
||||
Sql sqlAdmin = Sqls.create("""
|
||||
SELECT
|
||||
userid AS id
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_role sr ON sr.id = sur.roleId
|
||||
WHERE
|
||||
sr.`code` = 'BRANCH_UNION_CHAIRMAN' and sur.unionid =@id
|
||||
""").setParam("id", id);
|
||||
List<NutMap> userAdminDataMap = baseService.listMap(sqlAdmin);
|
||||
List<String> userAdminIds = userAdminDataMap.stream().map(u -> u.getString("id")).collect(Collectors.toList());
|
||||
|
||||
return Result.success(NutMap.NEW().addv("userData", userDataMap).addv("userAdminIds", userAdminIds));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission(value = {"activity.basic.union", "activity.basic.union2"}, mode = SaMode.OR)
|
||||
public Result doSubmitAdmin(String unionId, @Param(value = "userIds") String[] userIds) {
|
||||
|
||||
Sys_role sysRole = dao.fetch(Sys_role.class, Cnd.where("code", "=", RoleConstant.BRANCH_UNION_CHAIRMAN.name()));
|
||||
//再删除工会负责人的权限
|
||||
baseService.clear("sys_user_role", Cnd.where("unionId", "=", unionId).and("roleid", "=", sysRole.getId()));
|
||||
for (String id : userIds) {
|
||||
baseService.insert("sys_user_role", Chain.make("roleId", sysRole.getId()).add("userId", id).add("unionId", unionId));
|
||||
}
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
public Result branchUnionPartUnitPageData(PageForm pageForm, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX("name", pageForm.getSearchKeyword()));
|
||||
}
|
||||
cnd.and("unionId", "=", unionId);
|
||||
cnd.asc("unitcode");
|
||||
List<ActivityBasicUnit> list = dao.query(ActivityBasicUnit.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
public Result branchUnionPartUnitTransferData(String unionId) {
|
||||
List<ActivityBasicUnit> units = dao.query(ActivityBasicUnit.class, Cnd.where("unitLevel", "=", 2).asc("unitcode"));
|
||||
List<String> selectUnitIds = units.stream().filter(unit -> StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId)).map(ActivityBasicUnit::getId).toList();
|
||||
NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", units);
|
||||
return Result.success(transferData);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result branchUnionPartUnitSet(String unionId, @Param("unitIds") String[] unitIds) {
|
||||
dao.update(ActivityBasicUnit.class, Chain.make("unionId", null), Cnd.where("unionId", "=", unionId));
|
||||
if (Lang.isNotEmpty(unitIds)) {
|
||||
dao.update(ActivityBasicUnit.class, Chain.make("unionId", unionId), Cnd.where("id", "in", unitIds));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package com.budwk.app.zhgh.activity.basic.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnit;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityBasicUnitController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/6 11:45
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/basic/unit")
|
||||
@Ok("json:full")
|
||||
public class ActivityBasicUnitController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/basic/unit/index.html")
|
||||
@SaCheckPermission("activity.basic.unit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.basic.unit")
|
||||
public Result pageData(@Param(value = "parentId") String parentId, PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isBlank(parentId)) {
|
||||
cnd.and("parentId", "=", "1");
|
||||
} else {
|
||||
cnd.and("parentId", "=", parentId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
Sql sql = Sqls.create("select id,parentId,name,unitcode,unitLevel,unionId from activity_basic_unit $condition");
|
||||
cnd.asc("unitcode");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.basic.unit")
|
||||
public Result tree() {
|
||||
// List list = new ArrayList();
|
||||
// ActivityBasicUnit parentId = dao.fetch(ActivityBasicUnit.class, Cnd.where("id", "=", "1"));
|
||||
// if (parentId != null) {
|
||||
// parentId.setChild(child(parentId.getId()));
|
||||
// list.add(parentId);
|
||||
// return Result.success().addData(list);
|
||||
// }
|
||||
|
||||
List<ActivityBasicUnit> list = dao.query(ActivityBasicUnit.class, Cnd.NEW());
|
||||
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
nodeList.add(new TreeNode<>(list.get(i).getId(), list.get(i).getParentId(), list.get(i).getName(), i));
|
||||
}
|
||||
List<Tree<String>> treeList = TreeUtil.build(nodeList, "1");
|
||||
return Result.success(treeList);
|
||||
}
|
||||
|
||||
private List<ActivityBasicUnit> child(String parentId) {
|
||||
List<ActivityBasicUnit> units = dao.query(ActivityBasicUnit.class, Cnd.where("parentId", "=", parentId));
|
||||
units.forEach(unit -> {
|
||||
unit.setChild(child(unit.getId()));
|
||||
});
|
||||
return units;
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result doDelete(String id) {
|
||||
ActivityBasicUnit unit = dao.fetch(ActivityBasicUnit.class, id);
|
||||
int count = dao.count(ActivityBasicUnit.class, Cnd.where("parentId", "=", unit.getParentId()).and("id", "!=", id));
|
||||
dao.update(ActivityBasicUnit.class, Chain.make("hasChildren", count > 0), Cnd.where("id", "=", unit.getParentId()));
|
||||
delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
private void delete(String id) {
|
||||
Cnd cnd = Cnd.where("parentId", "=", id);
|
||||
List<ActivityBasicUnit> units = dao.query(ActivityBasicUnit.class, cnd);
|
||||
for (ActivityBasicUnit unit : units) {
|
||||
delete(unit.getId());
|
||||
}
|
||||
dao.clear(ActivityBasicUnit.class, cnd);
|
||||
dao.delete(ActivityBasicUnit.class, id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.budwk.app.zhgh.activity.basic.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/2/23 15:36
|
||||
* @description 活动基础设置
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("activity_basic_settings")
|
||||
@Comment("活动基础设置")
|
||||
public class ActivityBasicSettings extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("父级ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String parentId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("代码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("有子节点")
|
||||
@Default("0")
|
||||
private Boolean hasChildren;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM activity_basic_settings"),
|
||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM activity_basic_settings")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
private List<ActivityBasicSettings> child;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.budwk.app.zhgh.activity.basic.models;
|
||||
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/28 13:49
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table
|
||||
public class ActivityBasicUnion extends Sys_union {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true, nullEffective = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("添加来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String source;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.budwk.app.zhgh.activity.basic.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @Author zhf
|
||||
* @Date 2022/7/28 10:57
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
@Comment("活动单位")
|
||||
public class ActivityBasicUnit extends Sys_unit {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
|
||||
private List<ActivityBasicUnit> child;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.budwk.app.zhgh.activity.basic.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/2/24 14:29
|
||||
* @description 比赛组别
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("比赛项目")
|
||||
@Table("activity_event")
|
||||
public class ActivityEvent extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("比赛组别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String competitionCategory;
|
||||
|
||||
@Column
|
||||
@Comment("距离")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String distance;
|
||||
|
||||
@Column
|
||||
@Comment("运动项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String sports;
|
||||
|
||||
@Column
|
||||
@Comment("项目类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String projectType;
|
||||
|
||||
@Column
|
||||
@Comment("比赛项目编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String projectCode;
|
||||
|
||||
@Column
|
||||
@Comment("男女分组")
|
||||
@ColDefine(type = ColType.INT, width = 50)
|
||||
private Integer isMenWomen;
|
||||
|
||||
@Column
|
||||
@Comment("是否趣味")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isInterest;
|
||||
|
||||
@Column
|
||||
@Comment("属于那个运动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String exerciseType;
|
||||
|
||||
@Column
|
||||
@Comment("项目全名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String allName;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String startAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String endAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否启用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean whetherEnable;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String note;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.budwk.app.zhgh.activity.basic.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 活动人员范围设置
|
||||
* @createTime 2022年01月04日 11:36:00
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
@Comment("活动人员范围设置")
|
||||
public class ActivityUserScope extends BaseModel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -5794884307112120554L;
|
||||
|
||||
@Id
|
||||
@Comment("id")
|
||||
private Integer id;
|
||||
|
||||
@Column
|
||||
@ColDefine
|
||||
@Comment("groupId")
|
||||
private Integer groupId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
@Comment("name")
|
||||
private String groupName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("userid")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("创建人")
|
||||
private String creator;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.budwk.app.zhgh.activity.basic.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityUserScopePageParar
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/5 16:32
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class ActivityUserScopePageParam extends PageForm {
|
||||
|
||||
// 工会id
|
||||
private String unionId;
|
||||
// 单位id
|
||||
private String unitId;
|
||||
// 人类型
|
||||
private String[] personTypes;
|
||||
// 用户状态
|
||||
private String[] userStates;
|
||||
// 成员类型
|
||||
private String[] memberTypes;
|
||||
// 性类型
|
||||
private String[] sexTypes;
|
||||
// 年龄
|
||||
private String[] age;
|
||||
private Integer activityGroupId;
|
||||
private Integer setGroupType;
|
||||
private Integer setGroupId;
|
||||
private String setGroupName;
|
||||
// 教师会议id
|
||||
private String teacherMeetingId;
|
||||
// 角色id
|
||||
private String[] roleIds;
|
||||
// 用户id
|
||||
private String[] userId;
|
||||
// 俱乐部id
|
||||
private String clubId;
|
||||
// 逆向选择
|
||||
private Boolean reverseSelection;
|
||||
private String activityUserCnd;
|
||||
|
||||
private String props;
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.activity.basic.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月06日 09:02:00
|
||||
*/
|
||||
public interface ActivityBasicScopeService extends BaseService<ActivityUserScope> {
|
||||
|
||||
Sql createSql(Cnd cnd);
|
||||
|
||||
/**
|
||||
* 大量数据插入
|
||||
*/
|
||||
void largeDataInsert(List<ActivityUserScope> list) ;
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.budwk.app.zhgh.activity.basic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.DateUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.activity.basic.service.ActivityBasicScopeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.impl.NutTxDao;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年01月06日 09:03:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class ActivityBasicScopeServiceImpl extends BaseServiceImpl<ActivityUserScope> implements ActivityBasicScopeService {
|
||||
|
||||
|
||||
public ActivityBasicScopeServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql createSql(Cnd cnd) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 大量数据插入
|
||||
* 注:Future.get()可以同步等待线程执行完成,并且可以监听执行结果
|
||||
* 你也可以用countDownLatch
|
||||
*/
|
||||
@Override
|
||||
public void largeDataInsert(List<ActivityUserScope> list) {
|
||||
log.info("开始时间" + DateUtil.getDateTime());
|
||||
List<List<ActivityUserScope>> splitList = CollectionUtil.split(list, 500);
|
||||
NutTxDao nutTxDao = new NutTxDao(dao()).setDebug(true);
|
||||
nutTxDao.beginRC();
|
||||
ExecutorService executorService = Executors.newWorkStealingPool();
|
||||
|
||||
List<Callable<Object>> taskList = new ArrayList<>();
|
||||
|
||||
for (List<ActivityUserScope> everyList : splitList) {
|
||||
taskList.add(() -> nutTxDao.insert(everyList).size());
|
||||
}
|
||||
|
||||
List<Future<Object>> futureList = null;
|
||||
|
||||
AtomicInteger atomicInteger = new AtomicInteger();
|
||||
|
||||
try {
|
||||
futureList = executorService.invokeAll(taskList);
|
||||
for (Future<Object> future : futureList) {
|
||||
atomicInteger.getAndAdd((Integer) future.get());
|
||||
}
|
||||
if (atomicInteger.get() != list.size()) {
|
||||
throw new RuntimeException("插入数据与期望数据条数不符");
|
||||
}
|
||||
nutTxDao.commit();
|
||||
} catch (Exception e) {
|
||||
nutTxDao.rollback();
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
executorService.shutdown();
|
||||
}
|
||||
log.info("结束时间" + DateUtil.getDateTime());
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package com.budwk.app.zhgh.activity.culture.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureService;
|
||||
import com.budwk.app.zhgh.club.model.SysClub;
|
||||
import com.budwk.app.zhgh.club.service.SysClubService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityCultureApplyActivityController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/9 15:57
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/culture/applyActivity")
|
||||
public class ActivityCultureApplyActivityController {
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/school/applyActivity/index.html")
|
||||
@SaCheckPermission("activity.culture.applyActivity.school")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/union/applyActivity/index.html")
|
||||
@SaCheckPermission("activity.culture.applyActivity.union")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/club/applyActivity/index.html")
|
||||
@SaCheckPermission("activity.culture.applyActivity.club")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private ActivityCultureService activityCultureService;
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
|
||||
/**
|
||||
* @param activityScopeGroupId
|
||||
* @return java.util.List<org.nutz.lang.util.NutMap>
|
||||
* @author zhf
|
||||
* @description 根据活动组别查询每个工会可以报名的人数
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.applyActivity.school", "activity.culture.applyActivity.union", "activity.culture.applyActivity.club"}, mode = SaMode.OR)
|
||||
public Result getUnionData(String activityScopeGroupId) {
|
||||
List<NutMap> unionData = activityCultureService.getUnionData(activityScopeGroupId);
|
||||
return Result.success(unionData);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "文化活动", msg = "添加了一条文化活动记录", param = true, result = true)
|
||||
@SaCheckPermission(value = {"activity.culture.applyActivity.school", "activity.culture.applyActivity.union", "activity.culture.applyActivity.club"}, mode = SaMode.OR)
|
||||
public Result doAdd(@Param("tissue") @Valid ActivityTissue tissue) {
|
||||
activityCultureService.doAddActivity(tissue);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "文化活动", msg = "编辑了一条文化活动记录", param = true, result = true)
|
||||
@SaCheckPermission(value = {"activity.culture.applyActivity.school", "activity.culture.applyActivity.union", "activity.culture.applyActivity.club"}, mode = SaMode.OR)
|
||||
public Result doEdit(@Param("tissue") @Valid ActivityTissue tissue) {
|
||||
|
||||
activityCultureService.doEditActivity(tissue);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.applyActivity.school", "activity.culture.applyActivity.union", "activity.culture.applyActivity.club"}, mode = SaMode.OR)
|
||||
public Result findUser(String serachWord,
|
||||
Integer activity_type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT id userId,username userName,loginname loginName,sex,mobile,unitname unitName,unionname unionName FROM `vw_user`
|
||||
$condition
|
||||
limit 0,30
|
||||
""");
|
||||
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
if (activity_type == 40002) {
|
||||
cnd.and("unionId", "=", SecurityUtil.getUnionId());
|
||||
} else if (activity_type == 40003) {
|
||||
List<SysClub> myManageClub = sysClubService.getMyManageClub();
|
||||
List<String> clubIds = myManageClub.stream().map(SysClub::getId).collect(Collectors.toList());
|
||||
|
||||
List<Sys_user_role> clubList = sysClubService.dao().query(Sys_user_role.class,
|
||||
Cnd.where("roleId", "in", List.of(RoleConstant.CLUB_MEMBER.name()))
|
||||
.and("clubId", "in", clubIds));
|
||||
|
||||
List<String> clubUserIds = clubList.stream().map(Sys_user_role::getUserId).toList();
|
||||
cnd.and("id", "in", clubUserIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(serachWord)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.andLike("username", serachWord);
|
||||
group.orLike("loginname", serachWord);
|
||||
cnd.and(group);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(activityCultureService.listMap(sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.applyActivity.school", "activity.culture.applyActivity.union", "activity.culture.applyActivity.club"}, mode = SaMode.OR)
|
||||
public Result queryUserByIds(String[] ids) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitname,unionname,sex from vw_user where id in (@id)");
|
||||
sql.setParam("id", ids);
|
||||
return Result.success(activityCultureService.listMap(sql));
|
||||
}
|
||||
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
package com.budwk.app.zhgh.activity.culture.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.stream.CollectorUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
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.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
|
||||
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureApplyUserService;
|
||||
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.json.Json;
|
||||
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.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityCultureApplyUserController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/10 14:30
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/culture/applyUser")
|
||||
public class ActivityCultureApplyUserController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ActivityCultureApplyUserService activityCultureApplyUserService;
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/school/applyUser/index.html")
|
||||
@SaCheckPermission("activity.culture.applyUser.school")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/union/applyUser/index.html")
|
||||
@SaCheckPermission("activity.culture.applyUser.union")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/club/applyUser/index.html")
|
||||
@SaCheckPermission("activity.culture.applyUser.club")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.applyUser.school", "activity.culture.applyUser.union", "activity.culture.applyUser.club"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm page,
|
||||
@Valid String year,
|
||||
String name,
|
||||
boolean isEnrolled,
|
||||
Integer activity_type,
|
||||
@Valid Integer state) {
|
||||
Pagination pagination = activityCultureApplyUserService.pageData(page, year, name, activity_type, isEnrolled, state);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation(value = "报名")
|
||||
public Result signUp(@Valid String activityId, @Param("teamUserIds") String[] teamUserIds, @Param("ext") String formData, boolean isAgain) {
|
||||
JSONObject dynamicFormParam = null;
|
||||
if (StrUtil.isNotBlank(formData)) {
|
||||
dynamicFormParam = Json.fromJson(JSONObject.class, formData);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(teamUserIds)) {
|
||||
teamUserIds = new String[]{};
|
||||
}
|
||||
synchronized (this) {
|
||||
if (isAgain) {
|
||||
//重新报名删除之前的报名信息
|
||||
activityCultureApplyUserService.cancelSignUp(activityId);
|
||||
}
|
||||
activityCultureApplyUserService.signUp(activityId, Arrays.asList(teamUserIds), dynamicFormParam);
|
||||
return Result.success().addMsg("报名成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "文化活动", msg = "取消报名")
|
||||
@SaCheckPermission(value = {"activity.culture.applyUser.school", "activity.culture.applyUser.union", "activity.culture.applyUser.club"}, mode = SaMode.OR)
|
||||
public Result cancelSignUp(@Valid String activityId) {
|
||||
activityCultureApplyUserService.cancelSignUp(activityId);
|
||||
return Result.success().addMsg("取消成功!");
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation(value = "队友搜索")
|
||||
public Result queryTeammate(@Valid String keyword) {
|
||||
Sql sql = Sqls.create("select id userId,username userName,loginname loginName,sex,mobile,unitName from vw_user $condition limit 0,10");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.or(Cnd.likeEX("username", keyword));
|
||||
cnd.or(Cnd.likeEX("loginname", keyword));
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = activityCultureApplyUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation(value = "队友查询")
|
||||
public Result listTeamUser(@Valid String activityId) {
|
||||
ActivityTissuePerson tissuePerson = dao.fetch(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", activityId).and(ActivityTissuePerson::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (ObjectUtil.isNull(tissuePerson)) {
|
||||
return Result.success(Collections.emptyList());
|
||||
}
|
||||
List<ActivityTissuePerson> list = dao.query(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", activityId)
|
||||
.and(ActivityTissuePerson::getApplyUserId, "=", tissuePerson.getApplyUserId())
|
||||
);
|
||||
|
||||
//list中 applyUserId 和 userId 相同的 排在第一位
|
||||
list.sort(Comparator.comparing(u -> !u.getApplyUserId().equals(u.getUserId())));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation(value = "是否报名")
|
||||
public Result isSignUp(@Valid String activityId){
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package com.budwk.app.zhgh.activity.culture.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.model.Audit;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityCultureAuditActivityController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/12 10:48
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/culture/auditActivity")
|
||||
public class ActivityCultureAuditActivityController {
|
||||
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/union/auditActivity/index.html")
|
||||
@SaCheckPermission("activity.culture.auditActivity.union")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/club/auditActivity/index.html")
|
||||
@SaCheckPermission("activity.culture.auditActivity.club")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private ActivityCultureService activityCultureService;
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.auditActivity.union", "activity.culture.auditActivity.club"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm page, Boolean state,
|
||||
String year,
|
||||
String name,
|
||||
String unionId,
|
||||
Integer activity_type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.name unionname ,
|
||||
club.clubName,
|
||||
abs.`name` projectTypeName
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andEX("YEAR(tissue.startTime)", "=", year);
|
||||
cnd.andEX("tissue.unionId", "=", unionId);
|
||||
cnd.andEX("tissue.activity_type", "=", activity_type);
|
||||
cnd.andEX("tissue.state", state ? ">" : "=", 1);
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("tissue.name", name);
|
||||
}
|
||||
|
||||
|
||||
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("tissue.startTime");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(activityCultureService.listPageMap(page.getPageNumber(), page.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "文化活动", msg = "校工会审核了一条记录")
|
||||
@SaCheckPermission(value = {"activity.culture.auditActivity.union", "activity.culture.auditActivity.club"}, mode = SaMode.OR)
|
||||
public Result doReview(String id, boolean flag, Audit audit) {
|
||||
audit.setLoginname(SecurityUtil.getUserLoginname());
|
||||
activityCultureService.insert(audit);
|
||||
activityCultureService.dao().update(ActivityTissue.class,
|
||||
Chain.make("state", flag ? 3 : 2)
|
||||
.add("auditId", audit.getId()),
|
||||
Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package com.budwk.app.zhgh.activity.culture.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
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.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
|
||||
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityCultureInfoManageController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/10 9:12
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/culture/infoManage")
|
||||
public class ActivityCultureInfoManageController {
|
||||
|
||||
@Inject
|
||||
private ActivityCultureService activityCultureService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/school/infoManage/index.html")
|
||||
@SaCheckPermission("activity.culture.infoManage.school")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/union/infoManage/index.html")
|
||||
@SaCheckPermission("activity.culture.infoManage.union")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/club/infoManage/index.html")
|
||||
@SaCheckPermission("activity.culture.infoManage.club")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.infoManage.school", "activity.culture.infoManage.union", "activity.culture.infoManage.club"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm page, String year,
|
||||
String name,
|
||||
String unionId,
|
||||
@Valid Integer activity_type) {
|
||||
return Result.success(activityCultureService.pageData(page, year, name, unionId, activity_type));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.infoManage.school", "activity.culture.infoManage.union", "activity.culture.infoManage.club"}, mode = SaMode.OR)
|
||||
public Result activityStatusChange(@Valid String id, @Valid Boolean isUnseal) {
|
||||
activityCultureService.update(Chain.make("isUnseal", isUnseal), Cnd.where("id", "=", id));
|
||||
activityCultureService.dao().update(Sys_home_activity.class,
|
||||
Chain.make("enable", isUnseal),
|
||||
Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "文化活动", msg = "删除了一条活动")
|
||||
@SaCheckPermission(value = {"activity.culture.infoManage.school", "activity.culture.infoManage.union", "activity.culture.infoManage.club"}, mode = SaMode.OR)
|
||||
public Result doDelete(@Valid String id) {
|
||||
activityCultureService.delete(id);
|
||||
activityCultureService.dao().clear(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", id));
|
||||
activityCultureService.dao().delete(Sys_home_activity.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result findOne(@Valid String id) {
|
||||
return Result.success(activityCultureService.findOne(id));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取活动信息")
|
||||
public Result activityInfo(@Valid String id){
|
||||
ActivityTissue tissue = dao.fetch(ActivityTissue.class, id);
|
||||
String userId = tissue.getUserId();
|
||||
Sql sql = Sqls.create("select username,loginname from sys_user where id = @userId").setParam("userId", userId);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap userMap = (NutMap)sql.getResult();
|
||||
if(ObjectUtil.isNotNull(userMap)){
|
||||
tissue.setUsername(userMap.getString("username"));
|
||||
tissue.setLoginname(userMap.getString("loginname"));
|
||||
}
|
||||
return Result.success(tissue);
|
||||
}
|
||||
|
||||
}
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
package com.budwk.app.zhgh.activity.culture.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 cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
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.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.DynamicFormFieldParserUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureApplyUserService;
|
||||
import com.budwk.app.zhgh.club.model.SysClub;
|
||||
import com.budwk.app.zhgh.club.service.SysClubService;
|
||||
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.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityCultureUserStatistics
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/10 16:30
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/culture/userStatistics")
|
||||
@Slf4j
|
||||
public class ActivityCultureUserStatisticsController {
|
||||
|
||||
@Inject
|
||||
private ActivityCultureApplyUserService activityCultureApplyUserService;
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
|
||||
@At("/school")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/school/userStatistics/index.html")
|
||||
@SaCheckPermission("activity.culture.userStatistics.school")
|
||||
public void schoolIndex() {
|
||||
}
|
||||
|
||||
@At("/union")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/union/userStatistics/index.html")
|
||||
@SaCheckPermission("activity.culture.userStatistics.union")
|
||||
public void unionIndex() {
|
||||
}
|
||||
|
||||
@At("/club")
|
||||
@Ok("beetl:platform/zhgh/activity/culture/club/userStatistics/index.html")
|
||||
@SaCheckPermission("activity.culture.userStatistics.club")
|
||||
public void clubIndex() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.userStatistics.school", "activity.culture.userStatistics.union", "activity.culture.userStatistics.club"}, mode = SaMode.OR)
|
||||
public Result pageData(@Valid PageForm page,
|
||||
@Valid Integer activity_type,
|
||||
@Valid String activityId,
|
||||
String unionId) {
|
||||
ActivityTissue tissue = dao.fetch(ActivityTissue.class, activityId);
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
atp.*
|
||||
FROM
|
||||
`activity_tissue_person` atp
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("atp.tissueId", "=", activityId);
|
||||
cnd.andEX("atp.unionId", "=", unionId);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (List.of(40001, 40002).contains(activity_type)) {
|
||||
cnd.and("atp.unionId", "=", SecurityUtil.getUnionId());
|
||||
} else if (activity_type == 40003) {
|
||||
List<SysClub> myManageClub = sysClubService.getMyManageClub();
|
||||
List<String> clubIdList = myManageClub.stream().map(SysClub::getId).collect(Collectors.toList());
|
||||
cnd.and("atp.userId", "in", Sqls.create("SELECT userid FROM club_user WHERE clubId in (@clubIds)").setParam("clubIds", clubIdList));
|
||||
}
|
||||
}
|
||||
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("atp.applyDateTime");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = activityCultureApplyUserService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
for (NutMap row : list) {
|
||||
if (StrUtil.isNotBlank(row.getString("dynamicFormData"))) {
|
||||
Map<String, DynamicFormFieldParserUtil.FieldInfo> dynamicFormFieldInfo = DynamicFormFieldParserUtil.parseFormFields(tissue.getFormConfig(), row.getString("dynamicFormData"));
|
||||
row.put("dynamicFormFieldInfo", dynamicFormFieldInfo);
|
||||
}
|
||||
}
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.userStatistics.school", "activity.culture.userStatistics.union", "activity.culture.userStatistics.club"}, mode = SaMode.OR)
|
||||
public Result getActivityByYearOrType(Integer year,
|
||||
@Valid Integer activity_type) {
|
||||
Cnd cnd = Cnd.where("activity_type", "=", activity_type);
|
||||
cnd.and("projectTypeCode", "!=", 50004);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("signUpMethod", "in", List.of(1, 2, 3));
|
||||
if (activity_type == 40002) {
|
||||
cnd.and("unionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
}
|
||||
cnd.andEX("YEAR(startTime)", "=", year).desc("startTime");
|
||||
List<ActivityTissue> list = activityCultureApplyUserService.dao().query(ActivityTissue.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.userStatistics.school", "activity.culture.userStatistics.union", "activity.culture.userStatistics.club"}, mode = SaMode.OR)
|
||||
@Ok("void")
|
||||
@ApiOperation("导出报名人员")
|
||||
public void doExportUser(String id, String unionId, HttpServletResponse response) {
|
||||
try {
|
||||
ActivityTissue tissue = dao.fetch(ActivityTissue.class, id);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
atp.*
|
||||
FROM
|
||||
`activity_tissue_person` atp
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("atp.tissueId", "=", id);
|
||||
cnd.andEX("atp.unionId", "=", unionId);
|
||||
cnd.asc("atp.applyDateTime");
|
||||
cnd.desc("atp.applyUserUserName");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = activityCultureApplyUserService.listMap(sql);
|
||||
|
||||
//如果有动态表单
|
||||
if (ObjectUtil.isNotNull(tissue.getFormConfig())) {
|
||||
for (NutMap row : list) {
|
||||
Map<String, DynamicFormFieldParserUtil.FieldInfo> dynamicFormFieldInfo = DynamicFormFieldParserUtil.parseFormFields(tissue.getFormConfig(), row.getString("dynamicFormData"));
|
||||
if (ObjectUtil.isNotNull(dynamicFormFieldInfo)) {
|
||||
dynamicFormFieldInfo.forEach((k, v) -> {
|
||||
if (v.getType().equals("upload")) {
|
||||
String val = ((List<String>) v.getValue()).stream().map(x -> Globals.AppDomain + x).collect(Collectors.joining(","));
|
||||
row.put(k, val);
|
||||
} else {
|
||||
row.put(k, v.getDisplayValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
entityList.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
entityList.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
entityList.add(new ExcelExportEntity("身份证号", "idCard", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
entityList.add(new ExcelExportEntity("工会", "unionName", 20));
|
||||
if (tissue.getSignUpMethod() == 3) {
|
||||
entityList.add(new ExcelExportEntity("报名人姓名", "applyUserUserName", 20));
|
||||
}
|
||||
entityList.add(new ExcelExportEntity("报名时间", "applyDateTime", 20));
|
||||
|
||||
//如果有动态表单
|
||||
if (ObjectUtil.isNotNull(tissue.getFormConfig())) {
|
||||
List<Map<String, Object>> formFields = DynamicFormFieldParserUtil.extractFormFields(tissue.getFormConfig());
|
||||
System.out.println(formFields);
|
||||
for (Map<String, Object> formField : formFields) {
|
||||
entityList.add(new ExcelExportEntity((String) formField.get("title"), formField.get("field"), 20));
|
||||
}
|
||||
}
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, list);
|
||||
CommonDownloadUtil.download("报名人员名单.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
log.error("文化活动报名统计导出失败{}", e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission(value = {"activity.culture.userStatistics.school", "activity.culture.userStatistics.union", "activity.culture.userStatistics.club"}, mode = SaMode.OR)
|
||||
@Ok("json:full")
|
||||
@ApiOperation("动态表单字段")
|
||||
public Result dynamicTableColumns(@Valid String activityId) {
|
||||
try {
|
||||
List<NutMap> columns = new ArrayList<>();
|
||||
ActivityTissue tissue = dao.fetch(ActivityTissue.class, activityId);
|
||||
if (ObjectUtil.isNotNull(tissue.getFormConfig())) {
|
||||
List<Map<String, Object>> formFields = DynamicFormFieldParserUtil.extractFormFields(tissue.getFormConfig());
|
||||
System.out.println(formFields);
|
||||
for (Map<String, Object> formField : formFields) {
|
||||
NutMap res = NutMap.NEW()
|
||||
.addv("label", formField.get("title"))
|
||||
.addv("type", formField.get("type"))
|
||||
.addv("field", formField.get("field"));
|
||||
if (formField.get("type").equals("tableForm")) {
|
||||
res.put("prop", "dynamicFormFieldInfo." + formField.get("field") + ".tableData");
|
||||
} else {
|
||||
res.put("prop", "dynamicFormFieldInfo." + formField.get("field") + ".displayValue");
|
||||
}
|
||||
columns.add(res);
|
||||
}
|
||||
}
|
||||
return Result.success(columns);
|
||||
} catch (Exception e) {
|
||||
log.error("动态表单字段获取失败{}", e.getMessage());
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.budwk.app.zhgh.activity.culture.h5Controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
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.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
|
||||
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.dao.util.cri.Static;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName H5ActivityCultureController
|
||||
* @Description 手机端文化活动
|
||||
* @Author zhf
|
||||
* @Date 2024/8/16 16:42
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/activity/culture")
|
||||
public class H5ActivityCultureController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/applyUser")
|
||||
@Ok("beetl:platform/zhghh5/activity/culture/applyUser.html")
|
||||
@SaCheckPermission("h5.activity.culture.applyUser")
|
||||
public void applyUserIndex() {
|
||||
}
|
||||
|
||||
@At("/signUp")
|
||||
@Ok("beetl:platform/zhghh5/activity/culture/signUp.html")
|
||||
@SaCheckPermission("h5.activity.culture.applyUser")
|
||||
public void applySignUp() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.activity.culture.applyUser")
|
||||
@ApiOperation("查看活动详情")
|
||||
public Result info(@Valid String id) {
|
||||
ActivityTissue info = dao.fetch(ActivityTissue.class, id);
|
||||
return Result.success(info);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
package com.budwk.app.zhgh.activity.culture.models;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.base.model.CustomFormField;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 13:57
|
||||
* @description: 社团或分工会活动校工会活动
|
||||
**/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("文化活动表")
|
||||
@Table("activity_tissue")
|
||||
public class ActivityTissue extends BaseModel implements Serializable, SysHomeConvert {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("创建人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("举办单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String helpUnitIds;
|
||||
|
||||
@Column
|
||||
@Comment("协办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> unitId;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("活动编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String activityCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动项目类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String projectTypeCode;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startPlannedDate;
|
||||
|
||||
@Column
|
||||
@Comment("活动计划结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endPlannedDate;
|
||||
|
||||
@Column
|
||||
@Comment("报名开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("报名结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动人数")
|
||||
@ColDefine(type = ColType.INT, width = 6)
|
||||
private Integer peopleNum;
|
||||
|
||||
@Column
|
||||
@Comment("活动地点")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String address;
|
||||
|
||||
@Column
|
||||
@Comment("发票")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> billFiles;
|
||||
|
||||
@Column
|
||||
@Comment("照片")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> photoFiles;
|
||||
|
||||
@Column
|
||||
@Comment("其他")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> otherFiles;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer activity_type;
|
||||
|
||||
@Column
|
||||
@Comment("创建人所属工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("创建人所属社团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String clubId;
|
||||
|
||||
@Column
|
||||
@Comment("活动内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activityContent;
|
||||
|
||||
@Column
|
||||
@Comment("活动考核内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activityExamineContent;
|
||||
|
||||
@Column
|
||||
@Comment("报名方式(1.个人 2.分工会 null.不需要报名)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer signUpMethod;
|
||||
|
||||
@Column
|
||||
@Comment("限制方式(1.总人数限制 2.分工会人数限制 null.不限制)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer userNumberLimit;
|
||||
|
||||
@Column
|
||||
@Comment("是否需要签到")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean needSign;
|
||||
|
||||
@Column
|
||||
@Comment("签到经纬度")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> location;
|
||||
|
||||
@Column
|
||||
@Comment("签到范围")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer rangeMeter;
|
||||
|
||||
@Column
|
||||
@Comment("总人数限制")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer totalUserNumberLimit;
|
||||
|
||||
@Column
|
||||
@Comment("组队人数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer teamNum;
|
||||
|
||||
@Column
|
||||
@Comment("分工会人数限制")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> unionUserNumberLimit;
|
||||
|
||||
@Column
|
||||
@Comment("活动总结")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activitySummary;
|
||||
|
||||
@Column
|
||||
@Comment("活动分组id")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer groupId;
|
||||
|
||||
@Column
|
||||
@Comment("封面图")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@Comment("审核状态")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer state;
|
||||
|
||||
@Column
|
||||
@Comment("审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String auditId;
|
||||
|
||||
@Column
|
||||
@Comment("是否报名系统")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isEnrollSystem;
|
||||
|
||||
@Column
|
||||
@Comment("是否发送系统消息")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean xlFlag;
|
||||
|
||||
@Column
|
||||
@Comment("是否开启")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isUnseal;
|
||||
|
||||
@Column
|
||||
@Comment("物品")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> goods;
|
||||
|
||||
@Column
|
||||
@Comment("报名表单配置")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<CustomFormField> formFieldConfig;
|
||||
|
||||
@Column
|
||||
@Comment("报名表单配置")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private JSONObject formConfig;
|
||||
|
||||
@Many(field = "tissueId")
|
||||
private List<ActivityTissuePerson> tissuePersonList;
|
||||
|
||||
@Override
|
||||
public Sys_home_activity covertToSysHomeActivity() {
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(this.getId());
|
||||
sysHomeActivity.setName(this.getName());
|
||||
sysHomeActivity.setCover(this.getCover());
|
||||
if (this.getActivity_type() == 40001) {
|
||||
sysHomeActivity.setUrl("/platform/activity/culture/applyUser/school");
|
||||
} else if (this.getActivity_type() == 40002) {
|
||||
sysHomeActivity.setUrl("/platform/activity/culture/applyUser/union");
|
||||
} else if (this.getActivity_type() == 40003) {
|
||||
sysHomeActivity.setUrl("/platform/activity/culture/applyUser/club");
|
||||
}
|
||||
sysHomeActivity.setH5Url("/platform/h5/activity/culture/applyUser");
|
||||
if (StrUtil.isNotBlank(this.getApplyStartTime())) {
|
||||
sysHomeActivity.setStartDate(DateUtil.parseDate(this.getApplyStartTime()));
|
||||
sysHomeActivity.setEndDate(DateUtil.parseDate(this.getApplyEndTime()));
|
||||
}
|
||||
sysHomeActivity.setAllowUserGroupId(this.getGroupId());
|
||||
sysHomeActivity.setEnable(this.getIsUnseal());
|
||||
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
|
||||
return sysHomeActivity;
|
||||
}
|
||||
|
||||
|
||||
private String username;
|
||||
private String loginname;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.budwk.app.zhgh.activity.culture.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-03-09 14:02
|
||||
* @description: 活动人员列表
|
||||
**/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("文化活动报名表")
|
||||
@Table("activity_tissue_person")
|
||||
public class ActivityTissuePerson extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("分工会或社团活动ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String tissueId;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("报名人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUserId;
|
||||
|
||||
@Column
|
||||
@Comment("报名人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUserUserName;
|
||||
|
||||
@Column
|
||||
@Comment("签字ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String signId;
|
||||
|
||||
@Column
|
||||
@Comment("用户姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("用户工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("用户性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 2)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("用户手机号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("用户单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("用户单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("用户工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("用户工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("是否签到")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isSign;
|
||||
|
||||
@Column
|
||||
@Comment("签到时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String signTime;
|
||||
|
||||
@Column
|
||||
@Comment("报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String applyDateTime;
|
||||
|
||||
@Column
|
||||
@Comment("报名表数据")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private JSONObject dynamicFormData;
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.budwk.app.zhgh.activity.culture.service;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityCultureApplyUserService extends BaseService<ActivityTissuePerson> {
|
||||
|
||||
Pagination pageData(PageForm page,
|
||||
String year,
|
||||
String name,
|
||||
Integer activity_type,
|
||||
boolean isEnrolled,
|
||||
Integer state);
|
||||
|
||||
|
||||
/**
|
||||
* 活动报名
|
||||
*
|
||||
* @param activityId 活动id
|
||||
* @param personIds 队友
|
||||
* @param dynamicFormParam 表单数据
|
||||
*/
|
||||
void signUp(String activityId, List<String> personIds, JSONObject dynamicFormParam);
|
||||
|
||||
/**
|
||||
* 取消报名
|
||||
* @param activityId 活动id
|
||||
*/
|
||||
void cancelSignUp(String activityId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.budwk.app.zhgh.activity.culture.service;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityCultureService extends BaseService<ActivityTissue> {
|
||||
|
||||
|
||||
/**
|
||||
* @param activityScopeGroupId
|
||||
* @return java.util.List<org.nutz.lang.util.NutMap>
|
||||
* @author zhf
|
||||
* @description 根据活动组别查询每个工会可以报名的人数
|
||||
*/
|
||||
List<NutMap> getUnionData(String activityScopeGroupId);
|
||||
|
||||
void doAddActivity(ActivityTissue tissue);
|
||||
|
||||
void doEditActivity(ActivityTissue tissue);
|
||||
|
||||
Object pageData(PageForm page, String year, String name, String unionId, Integer activity_type);
|
||||
|
||||
NutMap findOne(String id);
|
||||
}
|
||||
+262
@@ -0,0 +1,262 @@
|
||||
package com.budwk.app.zhgh.activity.culture.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
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.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
|
||||
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureApplyUserService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityCultureApplyUserServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/10 14:45
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivityCultureApplyUserServiceImpl extends BaseServiceImpl<ActivityTissuePerson> implements ActivityCultureApplyUserService {
|
||||
public ActivityCultureApplyUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm page, String year, String name, Integer activity_type, boolean isEnrolled, Integer state) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.name unionname ,
|
||||
club.clubName,
|
||||
abs.`name` projectTypeName,
|
||||
atp.applyUserId,
|
||||
CASE WHEN atp.id IS NOT NULL THEN 1 ELSE 0 END AS isEnrolled
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
|
||||
LEFT JOIN activity_tissue_person atp on atp.tissueId=tissue.id AND (atp.applyUserId = @userId OR atp.userId = @userId)
|
||||
$condition
|
||||
""").setParam("userId", SecurityUtil.getUserId());
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("tissue.name", name);
|
||||
}
|
||||
cnd.andEX("YEAR(tissue.startTime)", "=", year);
|
||||
cnd.andEX("tissue.isUnseal", "=", true);
|
||||
cnd.andEX("tissue.activity_type", "=", activity_type);
|
||||
cnd.andEX("tissue.state", "=", 3);
|
||||
cnd.and("tissue.isEnrollSystem", "=", 1);
|
||||
cnd.andEX("tissue.projectTypeCode", "!=", 50004);
|
||||
cnd.andEX("tissue.signUpMethod", "in", List.of(1, 2, 3));
|
||||
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("tissue.startTime");
|
||||
}
|
||||
|
||||
if (state == 1) {
|
||||
|
||||
} else if (state == 2) {
|
||||
cnd.and("tissue.applyStartTime", "<", DateUtil.now());
|
||||
cnd.and("tissue.applyEndTime", ">", DateUtil.now());
|
||||
} else if (state == 3) {
|
||||
cnd.and("tissue.applyEndTime", "<", DateUtil.now());
|
||||
}
|
||||
|
||||
//针对活动组别内人员
|
||||
cnd.and(new Static("""
|
||||
EXISTS(
|
||||
SELECT 1
|
||||
FROM activity_user_scope
|
||||
WHERE groupId = tissue.groupId
|
||||
AND userId = '%s'
|
||||
)
|
||||
""".formatted(SecurityUtil.getUserId())));
|
||||
|
||||
//是否报名
|
||||
cnd.and("atp.id", isEnrolled ? "IS NOT" : "IS", null);
|
||||
|
||||
cnd.groupBy("tissue.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void signUp(String activityId, List<String> personIds, JSONObject dynamicFormParam) {
|
||||
ActivityTissue tissue = dao().fetch(ActivityTissue.class, activityId);
|
||||
|
||||
//通用限制
|
||||
// 判断是否有权限报名
|
||||
if (tissue.getGroupId() != null) {
|
||||
int count = dao().count(ActivityUserScope.class,
|
||||
Cnd.where(ActivityUserScope::getGroupId, "=", tissue.getGroupId())
|
||||
.and(ActivityUserScope::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (count == 0) {
|
||||
throw new BaseException("您不在本次活动参加人员范围内!");
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(tissue.getUserNumberLimit())) {
|
||||
//总人数限制
|
||||
if (tissue.getUserNumberLimit() == 1) {
|
||||
Integer totalUserNumberLimit = tissue.getTotalUserNumberLimit();
|
||||
int hasRegisterCount = count(Cnd.where(ActivityTissuePerson::getTissueId, "=", activityId));
|
||||
if (!(totalUserNumberLimit - hasRegisterCount > 0)) {
|
||||
throw new BaseException("报名名额已满!");
|
||||
}
|
||||
}
|
||||
|
||||
//分工会人数限制
|
||||
if (tissue.getUserNumberLimit() == 2) {
|
||||
int limitNumByUnion = getLimitNumByUnion(tissue.getUnionUserNumberLimit(), SecurityUtil.getUnionId());
|
||||
//获取当前该分工会已报多少人
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
activity_tissue_person atp
|
||||
LEFT JOIN `vw_user` u ON u.id = atp.userId
|
||||
WHERE
|
||||
atp.tissueId = @activityId
|
||||
AND u.unionid = @unionId
|
||||
""");
|
||||
sql.setParam("activityId", activityId).setParam("unionId", SecurityUtil.getUnionId());
|
||||
int hasRegisterCount = count(sql);
|
||||
if (!(limitNumByUnion - hasRegisterCount > 0)) {
|
||||
throw new BaseException("该分工会报名名额已满!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tissue.getSignUpMethod() == 1) {
|
||||
//个人报名独有判断
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
ActivityTissuePerson activityTissuePerson = new ActivityTissuePerson();
|
||||
activityTissuePerson.setTissueId(activityId);
|
||||
activityTissuePerson.setUserId(user.getId());
|
||||
activityTissuePerson.setUserName(user.getUsername());
|
||||
activityTissuePerson.setLoginName(user.getLoginname());
|
||||
activityTissuePerson.setSex(user.getSex());
|
||||
activityTissuePerson.setMobile(user.getMobile());
|
||||
activityTissuePerson.setUnitId(user.getUnitId());
|
||||
activityTissuePerson.setUnitName(user.getUnitName());
|
||||
activityTissuePerson.setUnionId(user.getUnionId());
|
||||
activityTissuePerson.setUnionName(user.getUnionName());
|
||||
activityTissuePerson.setApplyDateTime(DateUtil.now());
|
||||
activityTissuePerson.setApplyUserId(user.getId());
|
||||
activityTissuePerson.setApplyUserUserName(user.getUsername());
|
||||
activityTissuePerson.setDynamicFormData(dynamicFormParam);
|
||||
insert(activityTissuePerson);
|
||||
} else if (tissue.getSignUpMethod() == 2) {
|
||||
//组别报名独有判断
|
||||
//判断自己是否已被别人组别
|
||||
int count = dao().count(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", activityId)
|
||||
.and(ActivityTissuePerson::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (count > 0) {
|
||||
throw new BaseException("您已被别人组别,请先联系报名人取消!");
|
||||
}
|
||||
|
||||
//查询队友是否有已经报名了的人员
|
||||
int persons = dao().count(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", activityId)
|
||||
.and(ActivityTissuePerson::getUserId, "in", personIds));
|
||||
|
||||
if (persons > 1) {
|
||||
throw new BaseException("您的队友已被别人组别,请先联系报名人取消!");
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id AS userId,
|
||||
username AS userName,
|
||||
loginname AS loginName,
|
||||
sex,
|
||||
mobile,
|
||||
unitName,
|
||||
unionName,
|
||||
'$activityId' AS tissueId,
|
||||
'$applyUserId' AS applyUserId,
|
||||
'$applyUserUserName' AS applyUserUserName,
|
||||
'$applyDateTime' AS applyDateTime
|
||||
FROM
|
||||
`vw_user`
|
||||
$condition
|
||||
""");
|
||||
sql.setVar("activityId", activityId);
|
||||
sql.setVar("applyUserId", SecurityUtil.getUserId());
|
||||
sql.setVar("applyDateTime", DateUtil.now());
|
||||
sql.setVar("applyUserUserName", SecurityUtil.getUserUsername());
|
||||
sql.setCondition(Cnd.where("id", "in", personIds));
|
||||
List<ActivityTissuePerson> fullPersonList = listEntity(sql);
|
||||
insert(fullPersonList);
|
||||
} else if (tissue.getSignUpMethod() == 3) {
|
||||
//分工会报名独有判断
|
||||
//判断总人数限制
|
||||
//判断分工会人数限制
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
ActivityTissuePerson activityTissuePerson = new ActivityTissuePerson();
|
||||
activityTissuePerson.setTissueId(activityId);
|
||||
activityTissuePerson.setUserId(user.getId());
|
||||
activityTissuePerson.setUserName(user.getUsername());
|
||||
activityTissuePerson.setLoginName(user.getLoginname());
|
||||
activityTissuePerson.setSex(user.getSex());
|
||||
activityTissuePerson.setMobile(user.getMobile());
|
||||
activityTissuePerson.setUnitId(user.getUnitId());
|
||||
activityTissuePerson.setUnitName(user.getUnitName());
|
||||
activityTissuePerson.setUnionId(user.getUnionId());
|
||||
activityTissuePerson.setUnionName(user.getUnionName());
|
||||
activityTissuePerson.setApplyDateTime(DateUtil.now());
|
||||
activityTissuePerson.setApplyUserId(user.getId());
|
||||
activityTissuePerson.setApplyUserUserName(user.getUsername());
|
||||
activityTissuePerson.setDynamicFormData(dynamicFormParam);
|
||||
insert(activityTissuePerson);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelSignUp(String activityId) {
|
||||
dao().clear(ActivityTissuePerson.class, Cnd.where(ActivityTissuePerson::getTissueId, "=", activityId)
|
||||
.and(ActivityTissuePerson::getApplyUserId, "=", SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个分工会限制的数量
|
||||
*
|
||||
* @param unionUserNumberLimit
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
private int getLimitNumByUnion(List<NutMap> unionUserNumberLimit, String unionId) {
|
||||
Optional<NutMap> unionLimitOptional = unionUserNumberLimit.stream().filter(v -> v.getString("id").equals(unionId)).findFirst();
|
||||
return unionLimitOptional.map(map -> map.getInt("limitNum", 0)).orElse(0);
|
||||
}
|
||||
}
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
package com.budwk.app.zhgh.activity.culture.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.model.Audit;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissuePerson;
|
||||
import com.budwk.app.zhgh.activity.culture.service.ActivityCultureService;
|
||||
import com.budwk.app.zhgh.club.service.SysClubService;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ActivityCultureServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/9 17:42
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivityCultureServiceImpl extends BaseServiceImpl<ActivityTissue> implements ActivityCultureService {
|
||||
public ActivityCultureServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
@Override
|
||||
public List<NutMap> getUnionData(String activityScopeGroupId) {
|
||||
if (StrUtil.isBlank(activityScopeGroupId)) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.name unionname,
|
||||
count( u.id ) AS teacherCount
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN `vw_user` u ON u.unionid = gh.id
|
||||
GROUP BY
|
||||
gh.id
|
||||
""");
|
||||
return listMap(sql);
|
||||
} else {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.name unionname,
|
||||
( SELECT count( 1 ) FROM `user` WHERE id IN ( SELECT userid FROM activity_user_scope WHERE groupId = @activityScopeGroupId ) AND unionId = gh.id ) as teacherCount
|
||||
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN `vw_user` u ON u.unionid = gh.id
|
||||
GROUP BY
|
||||
gh.id
|
||||
""");
|
||||
sql.setParam("activityScopeGroupId", activityScopeGroupId);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAddActivity(ActivityTissue tissue) {
|
||||
tissue.setUserId(SecurityUtil.getUserId());
|
||||
tissue.setApplyTime(DateUtil.now());
|
||||
tissue.setIsUnseal(true);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
tissue.setState(1);
|
||||
} else {
|
||||
tissue.setState(3);
|
||||
}
|
||||
if (tissue.getActivity_type() == 40002) {
|
||||
tissue.setUnionId(SecurityUtil.getUnionId());
|
||||
} else if (tissue.getActivity_type() == 40003) {
|
||||
|
||||
// tissue.setClubId(vi.getClubId());
|
||||
}
|
||||
insertWith(tissue, "tissuePersonList");
|
||||
if (tissue.getIsEnrollSystem()) {
|
||||
Sys_home_activity sysHomeActivity = tissue.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEditActivity(ActivityTissue tissue) {
|
||||
update(tissue);
|
||||
if (tissue.getIsEnrollSystem()) {
|
||||
Sys_home_activity sysHomeActivity = tissue.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
} else {
|
||||
dao().delete(Sys_home_activity.class, tissue.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageData(PageForm page, String year, String name, String unionId, Integer activity_type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.name unionname ,
|
||||
club.clubName,
|
||||
abs.`name` projectTypeName
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andEX("YEAR(tissue.applyTime)", "=", year);
|
||||
cnd.andEX("tissue.projectTypeCode", "!=", "50004");
|
||||
cnd.andEX("tissue.unionId", "=", unionId);
|
||||
cnd.andEX("tissue.activity_type", "=", activity_type);
|
||||
|
||||
if (Strings.isNotBlank(name)) {
|
||||
cnd.where().andLike("tissue.name", name);
|
||||
}
|
||||
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(),
|
||||
RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("tissue.userId", "=", SecurityUtil.getUserId());
|
||||
/* if (AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("tissue.unionId", "=", SecurityUtil.getUnionId());
|
||||
} else if (AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name())) {
|
||||
List<SysClub> myManageClub = sysClubService.getMyManageClub();
|
||||
List<String> clubIds = myManageClub.stream().map(SysClub::getId).collect(Collectors.toList());
|
||||
cnd.and("tissue.clubId", "in", clubIds);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(page.getPageOrderName()) && StrUtil.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), page.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
} else {
|
||||
cnd.desc("tissue.startTime");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return this.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap findOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tissue.*,
|
||||
uni.name unionname,
|
||||
club.clubName,
|
||||
u.username,
|
||||
u.loginname,
|
||||
abs.`name` projectTypeName
|
||||
FROM
|
||||
activity_tissue tissue
|
||||
LEFT JOIN sys_union uni ON uni.id = tissue.unionId
|
||||
LEFT JOIN sys_club club ON club.id = tissue.clubId
|
||||
LEFT JOIN `vw_user` u ON u.id=tissue.userId
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code`=tissue.projectTypeCode
|
||||
WHERE
|
||||
tissue.id = @id
|
||||
""").setParam("id", id);
|
||||
NutMap nutMap = (NutMap) dao().execute(sql.setCallback(Sqls.callback.map())).getResult();
|
||||
|
||||
List<ActivityTissuePerson> personList = dao().query(ActivityTissuePerson.class,
|
||||
Cnd.where("tissueId", "=", nutMap.getString("id")));
|
||||
nutMap.setv("tissuePersonList", personList);
|
||||
if (Strings.isNotBlank(nutMap.getString("auditId"))) {
|
||||
nutMap.setv("audit", dao().fetch(Audit.class, nutMap.getString("auditId")));
|
||||
}
|
||||
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvOption;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvActivityService;
|
||||
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.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.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/qsv/activity")
|
||||
@Ok("json:full")
|
||||
public class QsvActivityController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private QsvActivityService qsvActivityService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/activity/qsv/activity/index.html")
|
||||
@SaCheckPermission("qsv.activity")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("分页查询")
|
||||
public Result pageData(@Valid PageForm pageForm, Integer year,String title) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(startTime)", "=", year);
|
||||
cnd.and(Cnd.likeEX("title",title));
|
||||
Pagination pagination = qsvActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("保存问卷基础信息")
|
||||
public Result save(QsvActivity qsvActivity) {
|
||||
if (qsvActivity.getCategory().equals("QUIZ")) {
|
||||
if (qsvActivity.getMode().equals("SCHEDULED")) {
|
||||
qsvActivity.setRepeatMode("DAILY");
|
||||
} else if (qsvActivity.getMode().equals("REGULAR")) {
|
||||
qsvActivity.setRepeatMode("TOTAL");
|
||||
}
|
||||
}
|
||||
dao.insertOrUpdate(qsvActivity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
public Result findOne(@Valid String id) {
|
||||
QsvActivity activity = dao.fetch(QsvActivity.class, id);
|
||||
return Result.success(activity);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("删除问卷")
|
||||
public Result delete(@Valid String id) {
|
||||
dao.delete(QsvActivity.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("保存问卷题目")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result saveSubjects(@Param("activityId") @Valid String activityId, @Param("subjects") QsvSubject[] qsvSubjects) {
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
List<String> subjectIds = subjects.stream().map(QsvSubject::getId).toList();
|
||||
|
||||
//新题目
|
||||
List<String> newSubjectIds = Arrays.stream(qsvSubjects).map(QsvSubject::getId).toList();
|
||||
|
||||
//过滤出需要删除的题目
|
||||
List<String> deleteSubjectIds = subjectIds.stream().filter(id -> !newSubjectIds.contains(id)).toList();
|
||||
dao.clear(QsvSubject.class, Cnd.where("id", "in", deleteSubjectIds));
|
||||
|
||||
for (int i = 0; i < qsvSubjects.length; i++) {
|
||||
QsvSubject qsvSubject = qsvSubjects[i];
|
||||
qsvSubject.setSortNum(i + 1);
|
||||
qsvSubject.setActivityId(activityId);
|
||||
//更新或添加题目
|
||||
dao.insertOrUpdate(qsvSubject);
|
||||
|
||||
|
||||
//更新或添加选项
|
||||
List<QsvOption> newOptions = qsvSubject.getOptions();
|
||||
List<String> optionIds = newOptions.stream().map(QsvOption::getId).toList();
|
||||
|
||||
List<QsvOption> oldOptions = dao.query(QsvOption.class, Cnd.where(QsvOption::getSubjectId, "=", qsvSubject.getId()));
|
||||
List<String> oldOptionIds = oldOptions.stream().map(QsvOption::getId).toList();
|
||||
|
||||
|
||||
List<String> deleteOptionIds = oldOptionIds.stream().filter(id -> !optionIds.contains(id)).toList();
|
||||
dao.clear(QsvOption.class, Cnd.where("id", "in", deleteOptionIds));
|
||||
|
||||
if (qsvSubject.getType().equals("radio") || qsvSubject.getType().equals("checkbox")) {
|
||||
for (int i1 = 0; i1 < newOptions.size(); i1++) {
|
||||
newOptions.get(i1).setSortNum(i1 + 1);
|
||||
newOptions.get(i1).setSubjectId(qsvSubject.getId());
|
||||
}
|
||||
dao.insertOrUpdate(newOptions);
|
||||
List<String> correctOptionIds = newOptions.stream().filter(QsvOption::getIsCorrect).map(QsvOption::getId).toList();
|
||||
qsvSubject.setCorrectAnswer(correctOptionIds);
|
||||
} else {
|
||||
dao.clear(QsvOption.class, Cnd.where(QsvOption::getSubjectId, "=", qsvSubject.getId()));
|
||||
}
|
||||
dao.update(qsvSubject);
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("查询问卷题目")
|
||||
public Result listSubjects(@Valid String activityId) {
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId).asc(QsvSubject::getSortNum));
|
||||
dao.fetchLinks(subjects, "options",Cnd.NEW().asc(QsvOption::getSortNum));
|
||||
return Result.success(subjects);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.controller;
|
||||
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvQuizRankPageForm;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvQuizRankService;
|
||||
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.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 javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/qsv/quizRank")
|
||||
@Ok("json:full")
|
||||
public class QsvQuizRankController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private QsvQuizRankService qsvQuizRankService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/activity/qsv/quiz/rank.html")
|
||||
@SaCheckPermission("qsv.quiz.rank")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.quiz.rank")
|
||||
@ApiOperation("根据年度查询问卷")
|
||||
public Result listQuiz(Integer year) {
|
||||
Cnd cnd = Cnd.where(QsvActivity::getCategory, "=", "QUIZ");
|
||||
cnd.andEX("YEAR(startTime)", "=", year);
|
||||
cnd.desc(QsvActivity::getCreatedAt);
|
||||
List<QsvActivity> list = dao.query(QsvActivity.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.quiz.rank")
|
||||
public Result pageData(@Valid QsvQuizRankPageForm pageForm) {
|
||||
Pagination pagination = qsvQuizRankService.pageData(pageForm);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("qsv.quiz.rank")
|
||||
public void exportXlsx(@Valid QsvQuizRankPageForm pageForm, HttpServletResponse response) {
|
||||
qsvQuizRankService.exportXlsx(pageForm, response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
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.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvQuizRankPageForm;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvActivityService;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvQuizRankService;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvSurveyService;
|
||||
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.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 javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/qsv/survey")
|
||||
@Ok("json:full")
|
||||
public class QsvSurveyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private QsvActivityService qsvActivityService;
|
||||
@Inject
|
||||
private QsvSurveyService qsvSurveyService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/activity/qsv/survey/index.html")
|
||||
@SaCheckPermission("qsv.survey")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.survey")
|
||||
public Result pageData(@Valid PageForm pageForm, Integer year) {
|
||||
Cnd cnd = Cnd.where(QsvActivity::getCategory, "=", "SURVEY");
|
||||
cnd.andEX("YEAR(startTime)", "=", year);
|
||||
cnd.desc(QsvActivity::getCreatedAt);
|
||||
Pagination pagination = qsvActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.survey")
|
||||
@ApiOperation("报告")
|
||||
public Result report(@Valid String activityId) {
|
||||
List<NutMap> report = qsvSurveyService.report(activityId);
|
||||
return Result.success(report);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.survey")
|
||||
@ApiOperation("选项选择详情")
|
||||
public Result selectOptionUsers(@Valid String activityId, @Valid String subjectId, @Valid String optionId) {
|
||||
List<QsvUserAnswerRecord> answerRecords = dao.query(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId));
|
||||
List<QsvUserAnswerRecord> selectOptionUsers = answerRecords.stream().filter(ext -> ObjectUtil.isNotNull(ext.getExtJson().get(subjectId, JSONObject.class)) && ext.getExtJson().get(subjectId, JSONObject.class).getJSONArray("optionIds").contains(optionId)).toList();
|
||||
return Result.success(selectOptionUsers);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.survey")
|
||||
@ApiOperation("用户答题")
|
||||
public Result userAnswer(@Valid String activityId) {
|
||||
NutMap map = qsvSurveyService.userAnswer(activityId);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.survey")
|
||||
@ApiOperation("删除用户答题记录")
|
||||
public Result deleteUserAnswer(@Valid String id) {
|
||||
dao.delete(QsvUserAnswerRecord.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.survey")
|
||||
@ApiOperation("导出用户答题记录xlsx")
|
||||
public void exportUserAnswerXlsx(@Valid String activityId, HttpServletResponse response) {
|
||||
qsvSurveyService.exportUserAnswerXlsx(activityId, response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel(value = "答题得分计算结果")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
public class QsvCheckAnswerResult {
|
||||
|
||||
@ApiModelProperty(value = "是否正确")
|
||||
private boolean isCorrect;
|
||||
|
||||
@ApiModelProperty(value = "得分")
|
||||
private float score;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.h5controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
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.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvActivityService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/h5/qsv")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class H5QsvController {
|
||||
|
||||
@Inject
|
||||
private QsvActivityService qsvActivityService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/activity/qsv/index.html")
|
||||
@SaCheckPermission("h5.qsv")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.qsv")
|
||||
@ApiOperation("分页查询")
|
||||
public Result pageData(@Valid PageForm pageForm, @Valid String category) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX(QsvActivity::getCategory, "=", category);
|
||||
cnd.desc(QsvActivity::getStartTime);
|
||||
Pagination pagination = qsvActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.h5controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.qsv.dto.QsvCheckAnswerResult;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvOption;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvAnswerParam;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvQuizService;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvUserAnswerRecordService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
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.validation.Valid;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/h5/qsv/quiz")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class H5QsvQuizController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private QsvUserAnswerRecordService qsvUserAnswerRecordService;
|
||||
@Inject
|
||||
private QsvQuizService qsvQuizService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/activity/qsv/quiz/index.html")
|
||||
@SaCheckLogin
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/activity/qsv/quiz/result.html")
|
||||
@SaCheckLogin
|
||||
public void result() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("题目列表")
|
||||
public Result subjects(@Valid String activityId) {
|
||||
QsvActivity activity = dao.fetch(QsvActivity.class, activityId);
|
||||
String mode = activity.getMode();
|
||||
//能否重复答题
|
||||
Boolean repeatable = activity.getRepeatable();
|
||||
//重复答题模式
|
||||
String repeatMode = activity.getRepeatMode();
|
||||
//答题最大次数
|
||||
Integer maxAttempts = activity.getMaxAttempts();
|
||||
//题目显示模式
|
||||
String displayMode = activity.getDisplayMode();
|
||||
|
||||
//最终返回的题目数据
|
||||
List<QsvSubject> resultSubjects = new ArrayList<>();
|
||||
String answerRecordId = null;
|
||||
|
||||
//查询用户的答题记录
|
||||
List<QsvUserAnswerRecord> answerRecords = dao.query(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId)
|
||||
.and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId()));
|
||||
|
||||
if (activity.getEndTime().after(new Date())) {
|
||||
//已结束 查询最新一次的答题记录
|
||||
Optional<QsvUserAnswerRecord> lastRecordOptional = answerRecords.stream().max(Comparator.comparing(QsvUserAnswerRecord::getAnswerTime));
|
||||
if (lastRecordOptional.isPresent()) {
|
||||
List<String> subjectIds = lastRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = lastRecordOptional.get().getId();
|
||||
}else{
|
||||
//没生成过 那就看全部的题目
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
QsvUserAnswerRecord answerRecord = qsvUserAnswerRecordService.insertRecord(activityId, subjects.stream().map(QsvSubject::getId).collect(Collectors.toList()));
|
||||
answerRecordId = answerRecord.getId();
|
||||
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (mode.equals("REGULAR")) {
|
||||
if (ObjectUtil.isEmpty(answerRecords)) {
|
||||
//首次进来生成答题记录
|
||||
if (displayMode.equals("ALL")) {
|
||||
resultSubjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
answerRecordId = qsvUserAnswerRecordService.insertRecord(activityId, resultSubjects.stream().map(QsvSubject::getId).collect(Collectors.toList())).getId();
|
||||
} else if (displayMode.equals("RANDOM")) {
|
||||
//单次随机抽取题目数量
|
||||
Integer randomCount = activity.getRandomCount();
|
||||
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
if (subjects.size() < randomCount) {
|
||||
throw new BaseException("题目数不够,无法生成题目");
|
||||
}
|
||||
|
||||
//从subjects里随机抽取randomCount个题目
|
||||
Collections.shuffle(subjects);
|
||||
List<QsvSubject> randomSubjects = subjects.subList(0, randomCount);
|
||||
QsvUserAnswerRecord answerRecord = qsvUserAnswerRecordService.insertRecord(activityId, randomSubjects.stream().map(QsvSubject::getId).collect(Collectors.toList()));
|
||||
answerRecordId = answerRecord.getId();
|
||||
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
}
|
||||
} else {
|
||||
if (displayMode.equals("ALL")) {
|
||||
//判断能否重复答题 如果可重复要根据次数判断是否再次生成记录 不能重复直接返回最新的一次记录
|
||||
if (repeatable) {
|
||||
//已回答次数
|
||||
if (answerRecords.size() < maxAttempts) {
|
||||
//生成答题记录
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
answerRecordId = qsvUserAnswerRecordService.insertRecord(activityId, subjects.stream().map(QsvSubject::getId).collect(Collectors.toList())).getId();
|
||||
QsvUserAnswerRecord answerRecord = dao.fetch(QsvUserAnswerRecord.class, answerRecordId);
|
||||
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
} else {
|
||||
//已达到最大次数 返回最新一次记录
|
||||
Optional<QsvUserAnswerRecord> maxAnswerRecordOptional = answerRecords.stream().max(Comparator.comparingLong(QsvUserAnswerRecord::getRandomNumber));
|
||||
if (maxAnswerRecordOptional.isPresent()) {
|
||||
List<String> subjectIds = maxAnswerRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = maxAnswerRecordOptional.get().getId();
|
||||
} else {
|
||||
throw new BaseException("业务异常");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Optional<QsvUserAnswerRecord> maxAnswerRecordOptional = answerRecords.stream().max(Comparator.comparingLong(QsvUserAnswerRecord::getRandomNumber));
|
||||
if (maxAnswerRecordOptional.isPresent()) {
|
||||
List<String> subjectIds = maxAnswerRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = maxAnswerRecordOptional.get().getId();
|
||||
} else {
|
||||
throw new BaseException("业务异常");
|
||||
}
|
||||
}
|
||||
} else if (displayMode.equals("RANDOM")) {
|
||||
//判断是否有未答完的记录
|
||||
Optional<QsvUserAnswerRecord> notFinishRecordOptional = answerRecords.stream().filter(r -> !r.getIsFinish()).findFirst();
|
||||
if (notFinishRecordOptional.isPresent()) {
|
||||
List<String> subjectIds = notFinishRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = notFinishRecordOptional.get().getId();
|
||||
} else {
|
||||
//随机抽取模式
|
||||
//单次随机抽取题目数量
|
||||
Integer randomCount = activity.getRandomCount();
|
||||
//总随机抽取次数
|
||||
Integer totalRandom = activity.getTotalRandom();
|
||||
|
||||
Date startTime = activity.getStartTime();
|
||||
Date endTime = activity.getEndTime();
|
||||
|
||||
//是否同一天
|
||||
boolean isSameDay = DateUtil.isSameDay(startTime, endTime);
|
||||
|
||||
// if(!isSameDay){
|
||||
if (answerRecords.size() < totalRandom) {
|
||||
//进行下一次抽取
|
||||
List<String> subjectIds = answerRecords.stream().map(QsvUserAnswerRecord::getSubjectIds).flatMap(Collection::stream).toList();
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId)
|
||||
.and(QsvSubject::getId, "not in", subjectIds));
|
||||
|
||||
if (subjects.size() < randomCount) {
|
||||
throw new BaseException("题目数不够,无法生成题目");
|
||||
}
|
||||
|
||||
//从subjects里随机抽取randomCount个题目
|
||||
Collections.shuffle(subjects);
|
||||
resultSubjects = subjects.subList(0, randomCount);
|
||||
answerRecordId = qsvUserAnswerRecordService.insertRecord(activityId, resultSubjects.stream().map(QsvSubject::getId).collect(Collectors.toList())).getId();
|
||||
} else {
|
||||
//返回最后一次抽取的记录
|
||||
Optional<QsvUserAnswerRecord> maxAnswerRecordOptional = answerRecords.stream().max(Comparator.comparingLong(QsvUserAnswerRecord::getRandomNumber));
|
||||
if (maxAnswerRecordOptional.isPresent()) {
|
||||
List<String> subjectIds = maxAnswerRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = maxAnswerRecordOptional.get().getId();
|
||||
} else {
|
||||
throw new BaseException("业务异常");
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mode.equals("SCHEDULED")) {
|
||||
//定时定题
|
||||
//查询今天的题目
|
||||
|
||||
List<QsvUserAnswerRecord> todayRecords = dao.query(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId)
|
||||
.and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId())
|
||||
.and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today())
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(todayRecords)) {
|
||||
//判断下每天可以答几次(题目实际上都是一样的)
|
||||
boolean todayAllFinish = todayRecords.stream().allMatch(QsvUserAnswerRecord::getIsFinish);
|
||||
//如果今天已生成的题目已答完并且还可以重复答
|
||||
if (todayAllFinish && todayRecords.size() < maxAttempts) {
|
||||
//生成今天的记录
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId)
|
||||
.and(QsvSubject::getDisplayDate, "=", DateUtil.today()));
|
||||
QsvUserAnswerRecord answerRecord = qsvUserAnswerRecordService.insertRecord(activityId, subjects.stream().map(QsvSubject::getId).collect(Collectors.toList()));
|
||||
answerRecordId = answerRecord.getId();
|
||||
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
} else {
|
||||
//今天最大那次的记录
|
||||
Optional<QsvUserAnswerRecord> maxTodayRecord = todayRecords.stream().max(Comparator.comparingLong(QsvUserAnswerRecord::getRandomNumber));
|
||||
if (maxTodayRecord.isPresent()) {
|
||||
answerRecordId = maxTodayRecord.get().getId();
|
||||
|
||||
List<String> subjectIds = maxTodayRecord.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
} else {
|
||||
throw new BaseException("业务异常");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//生成今天的记录
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId)
|
||||
.and(QsvSubject::getDisplayDate, "=", DateUtil.today()));
|
||||
QsvUserAnswerRecord answerRecord = qsvUserAnswerRecordService.insertRecord(activityId, subjects.stream().map(QsvSubject::getId).collect(Collectors.toList()));
|
||||
answerRecordId = answerRecord.getId();
|
||||
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dao.fetchLinks(resultSubjects, "options", Cnd.NEW().asc(QsvOption::getSortNum));
|
||||
|
||||
resultSubjects.forEach(v -> v.setUserSelectOptionIds(new ArrayList<>()));
|
||||
|
||||
NutMap result = NutMap.NEW().addv("subjects", resultSubjects).addv("answerRecordId", answerRecordId).addv("activity", activity);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("答题记录")
|
||||
public Result answerRecord(@Valid String answerRecordId) {
|
||||
QsvUserAnswerRecord record = dao.fetch(QsvUserAnswerRecord.class, answerRecordId);
|
||||
return Result.success(record);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("提交答题")
|
||||
public Result submitAnswer(@Valid @Param("answer") QsvAnswerParam qsvAnswerParam) {
|
||||
QsvUserAnswerRecord answerRecord = dao.fetch(QsvUserAnswerRecord.class, qsvAnswerParam.getAnswerRecordId());
|
||||
JSONObject extJson = answerRecord.getExtJson();
|
||||
|
||||
float totalScore = 0;
|
||||
|
||||
for (QsvAnswerParam.Subject subject : qsvAnswerParam.getSubjects()) {
|
||||
JSONObject entries = extJson.get(subject.getId(), JSONObject.class);
|
||||
if (ObjectUtil.isNotEmpty(entries)) {
|
||||
entries.set("optionIds", subject.getUserSelectOptionIds());
|
||||
entries.set("text", subject.getUserFillContent());
|
||||
|
||||
QsvCheckAnswerResult answerResult = qsvQuizService.calcScore(subject.getId(), subject.getUserSelectOptionIds());
|
||||
entries.set("score", answerResult.getScore());
|
||||
entries.set("isCorrect", answerResult.isCorrect());
|
||||
|
||||
if (answerResult.isCorrect()) {
|
||||
totalScore += answerResult.getScore();
|
||||
}
|
||||
}
|
||||
extJson.set(subject.getId(), entries);
|
||||
}
|
||||
|
||||
answerRecord.setTotalScore(totalScore);
|
||||
answerRecord.setAttemptDate(new Date());
|
||||
answerRecord.setSubmitTime(new Date());
|
||||
answerRecord.setAnswerTime(qsvAnswerParam.getAnswerTime());
|
||||
answerRecord.setIsFinish(true);
|
||||
dao.update(answerRecord);
|
||||
|
||||
//重新计算最高分 最新得分
|
||||
qsvUserAnswerRecordService.calcByScoreMode(qsvAnswerParam.getActivityId(), SecurityUtil.getUserId());
|
||||
|
||||
return Result.success("提交成功");
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result historyScore(@Valid String activityId) {
|
||||
List<QsvUserAnswerRecord> answerRecords = dao.query(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId()).desc(QsvUserAnswerRecord::getCreatedAt));
|
||||
return Result.success(answerRecords);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("答题记录(结果页展示)")
|
||||
public Result answerResult(@Valid String answerRecordId) {
|
||||
QsvUserAnswerRecord answerRecord = dao.fetch(QsvUserAnswerRecord.class, answerRecordId);
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
|
||||
Cnd cnd = Cnd.where(QsvSubject::getId, "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, cnd);
|
||||
dao.fetchLinks(subjects, "options", Cnd.NEW().asc(QsvOption::getSortNum));
|
||||
|
||||
subjects.forEach(v -> v.setUserSelectOptionIds(new ArrayList<>()));
|
||||
|
||||
QsvActivity activity = dao.fetch(QsvActivity.class, answerRecord.getActivityId());
|
||||
NutMap result = NutMap.NEW().addv("subjects", subjects).addv("answerRecordId", answerRecord.getId()).addv("activity", activity);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.h5controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvAnswerParam;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvUserAnswerRecordService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/h5/qsv/survey")
|
||||
@Ok("json:full")
|
||||
public class H5QsvSurveyController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private QsvUserAnswerRecordService qsvUserAnswerRecordService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/activity/qsv/survey/index.html")
|
||||
@SaCheckLogin
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result subjects(@Valid String activityId) {
|
||||
QsvActivity activity = dao.fetch(QsvActivity.class, activityId);
|
||||
String answerRecordId = null;
|
||||
|
||||
QsvUserAnswerRecord answerRecord = dao.fetch(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId())
|
||||
.and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (answerRecord == null) {
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
qsvUserAnswerRecordService.insertRecord(activityId, subjects.stream().map(QsvSubject::getId).toList());
|
||||
}
|
||||
|
||||
QsvUserAnswerRecord answerRecord2 = dao.fetch(QsvUserAnswerRecord.class,
|
||||
Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId)
|
||||
.and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId()));
|
||||
|
||||
answerRecordId = answerRecord2.getId();
|
||||
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where(QsvSubject::getId, "in", answerRecord2.getSubjectIds()));
|
||||
dao.fetchLinks(subjects, "options");
|
||||
|
||||
for (QsvSubject subject : subjects) {
|
||||
if (subject.getUserSelectOptionIds() == null) {
|
||||
subject.setUserSelectOptionIds(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
NutMap result = NutMap.NEW().addv("subjects", subjects).addv("answerRecordId", answerRecordId).addv("activity", activity);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result answerRecord(@Valid String answerRecordId) {
|
||||
QsvUserAnswerRecord record = dao.fetch(QsvUserAnswerRecord.class, answerRecordId);
|
||||
return Result.success(record);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result submitAnswer(@Valid @Param("answer") QsvAnswerParam qsvAnswerParam) {
|
||||
QsvUserAnswerRecord answerRecord = dao.fetch(QsvUserAnswerRecord.class, qsvAnswerParam.getAnswerRecordId());
|
||||
JSONObject extJson = answerRecord.getExtJson();
|
||||
|
||||
for (QsvAnswerParam.Subject subject : qsvAnswerParam.getSubjects()) {
|
||||
JSONObject entries = extJson.get(subject.getId(), JSONObject.class);
|
||||
if (ObjectUtil.isNotEmpty(entries)) {
|
||||
entries.set("optionIds", subject.getUserSelectOptionIds());
|
||||
entries.set("text", subject.getUserFillContent());
|
||||
}
|
||||
extJson.set(subject.getId(), entries);
|
||||
}
|
||||
|
||||
answerRecord.setAttemptDate(new Date());
|
||||
answerRecord.setSubmitTime(new Date());
|
||||
answerRecord.setIsFinish(true);
|
||||
dao.update(answerRecord);
|
||||
|
||||
return Result.success("提交成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("qsv_activity")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("问卷调查投票活动表")
|
||||
public class QsvActivity extends BaseModel implements Serializable, SysHomeConvert {
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动标题")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String title;
|
||||
|
||||
@Column
|
||||
@Comment("活动描述")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Comment("所属模块(quiz, survey, vote)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String category;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date startTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date endTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动分组ID")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer groupId;
|
||||
|
||||
@Column
|
||||
@Comment("模式:定时定题模式(scheduled)或常规模式(regular)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mode;
|
||||
|
||||
@Column
|
||||
@Comment("是否可重复答题")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean repeatable;
|
||||
|
||||
@Column
|
||||
@Comment("重复模式:按天(daily)或按活动总次数(total)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String repeatMode;
|
||||
|
||||
@Column
|
||||
@Comment("最大答题次数(0表示不限制)")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer maxAttempts;
|
||||
|
||||
@Column
|
||||
@Comment("显示模式:全部显示、随机抽取显示(ALL、RANDOM)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String displayMode;
|
||||
|
||||
@Column
|
||||
@Comment("单次随机抽取题目数量")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer randomCount;
|
||||
|
||||
@Column
|
||||
@Comment("总随机抽取次数")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer totalRandom;
|
||||
|
||||
@Column
|
||||
@Comment("随机打乱题目顺序")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean shuffleSubject;
|
||||
|
||||
@Column
|
||||
@Comment("答题时间限制(以分钟为单位,0表示无限制)")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer timeLimit;
|
||||
|
||||
@Column
|
||||
@Comment("答题得分统计(最高、最新)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String scoreMode;
|
||||
|
||||
@Column
|
||||
@Comment("封面图片")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String cover;
|
||||
|
||||
@Override
|
||||
public Sys_home_activity covertToSysHomeActivity() {
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(this.getId());
|
||||
sysHomeActivity.setName(this.getTitle());
|
||||
sysHomeActivity.setCover(this.getCover());
|
||||
sysHomeActivity.setH5Url("/platform/h5/qsv");
|
||||
sysHomeActivity.setStartDate(this.getStartTime());
|
||||
sysHomeActivity.setEndDate(this.getEndTime());
|
||||
sysHomeActivity.setAllowUserGroupId(this.getGroupId());
|
||||
sysHomeActivity.setEnable(true);
|
||||
return sysHomeActivity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.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;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("qsv_option")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("问卷调查投票选项表")
|
||||
public class QsvOption extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("题目表")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String subjectId;
|
||||
|
||||
@Column
|
||||
@Comment("选项内容")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String text;
|
||||
|
||||
@Column
|
||||
@Comment("是否为正确答案(仅答题模块使用)")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isCorrect;
|
||||
|
||||
@Column
|
||||
@Comment("图片地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String imgUrl;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sortNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.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;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("qsv_subject")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("问卷调查投票题目表")
|
||||
public class QsvSubject 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 activityId;
|
||||
|
||||
@Column
|
||||
@Comment("题目标题")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String title;
|
||||
|
||||
@Column
|
||||
@Comment("题目类型(single, multi, judge, fill)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("正确答案")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> correctAnswer; // 正确答案
|
||||
|
||||
@Column
|
||||
@Comment("题目分数(仅答题模块使用)")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer score; //
|
||||
|
||||
@Column
|
||||
@Comment("显示时间")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date displayDate;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer sortNum;
|
||||
|
||||
/**
|
||||
* 选项
|
||||
*/
|
||||
@Many(target = QsvOption.class, field = "subjectId")
|
||||
private List<QsvOption> options;
|
||||
|
||||
/**
|
||||
* 用户选择的选项(选择题)
|
||||
*/
|
||||
private List<String> userSelectOptionIds;
|
||||
|
||||
/**
|
||||
* 用户填写的内容(填空题)
|
||||
*/
|
||||
private String userFillContent;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
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.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("qsv_user_answer_record")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("问卷调查投票记录表")
|
||||
public class QsvUserAnswerRecord 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 userId;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("活动ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("扩展字段")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private JSONObject extJson;
|
||||
|
||||
@Column
|
||||
@Comment("题目ID")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> subjectIds;
|
||||
|
||||
@Column
|
||||
@Comment("答题得分(仅答题模块使用)")
|
||||
@ColDefine(type = ColType.FLOAT)
|
||||
private Float totalScore;
|
||||
|
||||
@Column
|
||||
@Comment("随机次数(仅答题模块使用随机抽取模式)")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer randomNumber;
|
||||
|
||||
@Column
|
||||
@Comment("答题次数(仅答题模块使用)")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer attemptNumber;
|
||||
|
||||
@Column
|
||||
@Comment("答题日期(用于统计某一天的答题次数)")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date attemptDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否为最新得分(仅答题模块使用)")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isLatestScore;
|
||||
|
||||
@Column
|
||||
@Comment("是否为最高得分(仅答题模块使用)")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isHighestScore;
|
||||
|
||||
@Column
|
||||
@Comment("是否完成")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isFinish;
|
||||
|
||||
@Column
|
||||
@Comment("提交时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date submitTime;
|
||||
|
||||
@Column
|
||||
@Comment("答题用时")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer answerTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "答题参数")
|
||||
public class QsvAnswerParam {
|
||||
|
||||
@ApiModelProperty("答题活动")
|
||||
private String activityId;
|
||||
|
||||
@ApiModelProperty("答题记录")
|
||||
private String answerRecordId;
|
||||
|
||||
@ApiModelProperty("答题题目")
|
||||
private List<Subject> subjects;
|
||||
|
||||
@ApiModelProperty("答题用时")
|
||||
private Integer answerTime;
|
||||
|
||||
@Data
|
||||
public static class Subject{
|
||||
private String id;
|
||||
private List<String> userSelectOptionIds;
|
||||
private String userFillContent;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("问卷排名得分分页查询参数")
|
||||
public class QsvQuizRankPageForm extends PageForm {
|
||||
|
||||
@ApiModelProperty("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@ApiModelProperty("分工会ID")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty("单位ID")
|
||||
private String unitId;
|
||||
|
||||
@ApiModelProperty("答题日期")
|
||||
private Date attemptDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
|
||||
public interface QsvActivityService extends BaseService<QsvActivity> {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvQuizRankPageForm;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
public interface QsvQuizRankService extends BaseService<QsvUserAnswerRecord> {
|
||||
|
||||
Pagination pageData(QsvQuizRankPageForm pageForm);
|
||||
|
||||
void exportXlsx(QsvQuizRankPageForm pageForm, HttpServletResponse response);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.qsv.dto.QsvCheckAnswerResult;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface QsvQuizService extends BaseService<QsvUserAnswerRecord> {
|
||||
|
||||
/**
|
||||
* 计算答题分数
|
||||
* @param subjectId 题目ID
|
||||
* @param userSelectOptions 用户选项
|
||||
* @return 分数
|
||||
*/
|
||||
QsvCheckAnswerResult calcScore(String subjectId, List<String> userSelectOptions);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
public interface QsvSurveyService extends BaseService<QsvUserAnswerRecord> {
|
||||
|
||||
List<NutMap> report(String activityId);
|
||||
|
||||
void exportUserAnswerXlsx(String activityId, HttpServletResponse response);
|
||||
|
||||
NutMap userAnswer(String activityId);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvAnswerParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface QsvUserAnswerRecordService extends BaseService<QsvUserAnswerRecord> {
|
||||
|
||||
QsvUserAnswerRecord insertRecord(String activityId, List<String> subjectIds);
|
||||
|
||||
/**
|
||||
* 计算得分
|
||||
*/
|
||||
float calcScore(QsvAnswerParam qsvAnswerParam);
|
||||
|
||||
void calcByScoreMode(String activityId, String userId);
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvActivityService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class QsvActivityServiceImpl extends BaseServiceImpl<QsvActivity> implements QsvActivityService {
|
||||
|
||||
public QsvActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service.impl;
|
||||
|
||||
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.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvQuizRankPageForm;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvQuizRankService;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class QsvQuizRankServiceImpl extends BaseServiceImpl<QsvUserAnswerRecord> implements QsvQuizRankService {
|
||||
|
||||
public QsvQuizRankServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(QsvQuizRankPageForm pageForm) {
|
||||
String activityId = pageForm.getActivityId();
|
||||
if(StrUtil.isBlank(activityId)){
|
||||
return new Pagination();
|
||||
}
|
||||
|
||||
QsvActivity activity = dao().fetch(QsvActivity.class, activityId);
|
||||
if (activity == null) {
|
||||
return new Pagination();
|
||||
}
|
||||
|
||||
String mode = activity.getMode();
|
||||
String scoreStatisticsMode = activity.getScoreMode();
|
||||
|
||||
Sql sql = buildQuerySql(activityId, mode, scoreStatisticsMode, pageForm);
|
||||
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportXlsx(QsvQuizRankPageForm pageForm, HttpServletResponse response) {
|
||||
String activityId = pageForm.getActivityId();
|
||||
QsvActivity activity = dao().fetch(QsvActivity.class, activityId);
|
||||
|
||||
if (activity == null) {
|
||||
throw new BaseException("活动不存在: " + activityId);
|
||||
}
|
||||
|
||||
String mode = activity.getMode();
|
||||
String scoreStatisticsMode = activity.getScoreMode();
|
||||
|
||||
Sql sql = buildQuerySql(activityId, mode, scoreStatisticsMode, pageForm);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("单位", "unitName", 30));
|
||||
exportEntities.add(new ExcelExportEntity("分工会", "unionName", 30));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 30));
|
||||
if ("SCHEDULED".equals(mode) && pageForm.getAttemptDate() != null) {
|
||||
exportEntities.add(new ExcelExportEntity("答题日期", "attemptDate", 20));
|
||||
exportEntities.add(new ExcelExportEntity("当天得分", "totalScore", 20));
|
||||
} else {
|
||||
exportEntities.add(new ExcelExportEntity("得分", "sumScore", 20));
|
||||
}
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
CommonDownloadUtil.download(activity.getTitle() + "得分名单" + ".xlsx", workbook, response);
|
||||
}
|
||||
|
||||
private Sql buildQuerySql(String activityId, String mode, String scoreStatisticsMode, QsvQuizRankPageForm pageForm) {
|
||||
StringBuilder sqlBuilder = new StringBuilder("""
|
||||
SELECT
|
||||
t1.userId,
|
||||
t1.userName,
|
||||
t1.loginName,
|
||||
t1.unitName,
|
||||
t1.unionName,
|
||||
t1.sex,
|
||||
u.mobile,
|
||||
t1.totalScore,
|
||||
t1.attemptDate,
|
||||
sum(t1.totalScore) as sumScore
|
||||
FROM
|
||||
`qsv_user_answer_record` t1
|
||||
LEFT JOIN sys_user u ON u.id = t1.userId
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t1.activityId","=",activityId);
|
||||
|
||||
if(StrUtil.isNotBlank(pageForm.getSearchKeyword())){
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("t1.loginName", pageForm.getSearchKeyword());
|
||||
seg.orLike("t1.userName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
cnd.andEX("t1.unionId","=",pageForm.getUnionId());
|
||||
cnd.andEX("t1.unitId","=",pageForm.getUnitId());
|
||||
|
||||
if ("SCHEDULED".equals(mode)) {
|
||||
if ("HIGH".equals(scoreStatisticsMode)) {
|
||||
cnd.and("t1.isHighestScore","=",1);
|
||||
} else if ("LAST".equals(scoreStatisticsMode)) {
|
||||
cnd.and("t1.isLatestScore","=",1);
|
||||
}
|
||||
} else if ("REGULAR".equals(mode)) {
|
||||
if ("HIGH".equals(scoreStatisticsMode)) {
|
||||
cnd.and("t1.isHighestScore","=",1);
|
||||
} else if ("LAST".equals(scoreStatisticsMode)) {
|
||||
cnd.and("t1.isLatestScore","=",1);
|
||||
}
|
||||
}
|
||||
|
||||
if (pageForm.getAttemptDate() != null) {
|
||||
cnd.and("t1.attemptDate","=",pageForm.getAttemptDate());
|
||||
}
|
||||
|
||||
cnd.groupBy("t1.userId");
|
||||
cnd.desc("t1.totalScore");
|
||||
|
||||
Sql sql = Sqls.create(sqlBuilder.toString());
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.qsv.dto.QsvCheckAnswerResult;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvQuizService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class QsvQuizServiceImpl extends BaseServiceImpl<QsvUserAnswerRecord> implements QsvQuizService {
|
||||
|
||||
public QsvQuizServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QsvCheckAnswerResult calcScore(String subjectId, List<String> userSelectOptions) {
|
||||
QsvSubject subject = dao().fetch(QsvSubject.class, subjectId);
|
||||
List<String> correctOptionIds = subject.getCorrectAnswer();
|
||||
|
||||
if(ObjectUtil.isEmpty(userSelectOptions)){
|
||||
userSelectOptions = new ArrayList<>();
|
||||
}
|
||||
|
||||
//比较选项是否正确 不考虑顺序
|
||||
boolean equals = new HashSet<>(userSelectOptions).equals(new HashSet<>(correctOptionIds));
|
||||
return QsvCheckAnswerResult.builder().isCorrect(equals).score(equals ? subject.getScore() : 0).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service.impl;
|
||||
|
||||
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.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvOption;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvSurveyService;
|
||||
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.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class QsvSurveyServiceImpl extends BaseServiceImpl<QsvUserAnswerRecord> implements QsvSurveyService {
|
||||
public QsvSurveyServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> report(String activityId) {
|
||||
// 检查活动ID是否为空
|
||||
if (activityId == null || activityId.isEmpty()) {
|
||||
throw new IllegalArgumentException("活动ID不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
// 查询用户答题记录
|
||||
List<QsvUserAnswerRecord> answerRecords = dao().query(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId));
|
||||
// 将答题记录的扩展JSON转换为JSONObject列表
|
||||
List<JSONObject> answerExtList = answerRecords.stream().map(QsvUserAnswerRecord::getExtJson).toList();
|
||||
|
||||
// 查询活动题目列表
|
||||
List<NutMap> subjects = querySubjects(activityId);
|
||||
// 获取题目ID列表
|
||||
List<String> subjectIds = subjects.stream().map(v -> v.getString("id")).toList();
|
||||
|
||||
// 查询题目选项列表
|
||||
List<QsvOption> options = dao().query(QsvOption.class, Cnd.where("subjectId", "in", subjectIds).asc(QsvOption::getSortNum));
|
||||
// 按题目ID分组选项
|
||||
Map<String, List<QsvOption>> optionsGroup = options.stream().collect(Collectors.groupingBy(QsvOption::getSubjectId));
|
||||
|
||||
// 处理每个题目
|
||||
for (NutMap subject : subjects) {
|
||||
// 获取当前题目的选项列表
|
||||
List<NutMap> subjectOptions = Lang.collection2list(optionsGroup.get(subject.getString("id")), NutMap.class);
|
||||
|
||||
// 获取题目类型
|
||||
String subjectType = subject.getString("type");
|
||||
|
||||
// 处理文本类型题目
|
||||
if ("text".equals(subjectType)) {
|
||||
List<String> texts = answerExtList.stream()
|
||||
.filter(ext -> ObjectUtil.isNull(ext.get(subject.getString("id"), JSONObject.class)))
|
||||
.map(ext -> ext.get(subject.getString("id"), JSONObject.class).getStr("text"))
|
||||
.toList();
|
||||
subject.put("texts", texts);
|
||||
}
|
||||
// 处理单选类型题目 处理多选类型题目
|
||||
else if ("radio".equals(subjectType) || "checkbox".equals(subjectType)) {
|
||||
subjectOptions.forEach(subjectOption -> {
|
||||
long selectCount = answerExtList.stream()
|
||||
.filter(ext ->
|
||||
{
|
||||
JSONObject jsonObject = ext.get(subject.getString("id"), JSONObject.class);
|
||||
return jsonObject != null
|
||||
&& jsonObject.getJSONArray("optionIds") != null
|
||||
&& jsonObject.getJSONArray("optionIds").contains(subjectOption.getString("id"));
|
||||
})
|
||||
.count();
|
||||
subjectOption.put("selectCount", selectCount);
|
||||
});
|
||||
|
||||
long selectTotal = answerExtList.stream()
|
||||
.filter(ext -> ext.containsKey(subject.getString("id")))
|
||||
.count();
|
||||
subject.put("selectTotal", selectTotal);
|
||||
}
|
||||
|
||||
// 添加选项到题目中
|
||||
subject.addv("options", subjectOptions);
|
||||
}
|
||||
|
||||
return subjects;
|
||||
} catch (Exception e) {
|
||||
log.error("报告生成失败", e);
|
||||
throw new BaseException("报告生成失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportUserAnswerXlsx(String activityId, HttpServletResponse response) {
|
||||
// 检查活动ID是否为空
|
||||
if (activityId == null || activityId.isEmpty()) {
|
||||
throw new IllegalArgumentException("活动ID不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
// 查询活动信息
|
||||
QsvActivity activity = dao().fetch(QsvActivity.class, activityId);
|
||||
if (activity == null) {
|
||||
throw new IllegalArgumentException("活动不存在");
|
||||
}
|
||||
|
||||
// 查询用户答题记录
|
||||
List<QsvUserAnswerRecord> answerRecords = dao().query(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId));
|
||||
// 将答题记录的扩展JSON转换为JSONObject列表
|
||||
List<JSONObject> answerExtList = answerRecords.stream().map(QsvUserAnswerRecord::getExtJson).toList();
|
||||
|
||||
// 查询活动题目列表
|
||||
List<QsvSubject> subjects = dao().query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
// 将题目列表转换为Map
|
||||
Map<String, QsvSubject> subjectMap = subjects.stream().collect(Collectors.toMap(QsvSubject::getId, v -> v));
|
||||
// 获取题目ID列表
|
||||
List<String> subjectIds = subjects.stream().map(QsvSubject::getId).toList();
|
||||
|
||||
// 查询题目选项列表
|
||||
List<QsvOption> options = dao().query(QsvOption.class, Cnd.where("subjectId", "in", subjectIds).asc(QsvOption::getSortNum));
|
||||
// 将选项列表转换为Map
|
||||
Map<String, QsvOption> optionMap = options.stream().collect(Collectors.toMap(QsvOption::getId, v -> v));
|
||||
|
||||
// 构建Excel导出实体
|
||||
List<ExcelExportEntity> excelExportEntities = buildExcelExportEntities(subjects);
|
||||
// 构建答题记录列表
|
||||
List<NutMap> list = buildAnswerRecords(answerRecords, subjectMap, options);
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
// 导出Excel并下载
|
||||
try (Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelExportEntities, list)) {
|
||||
CommonDownloadUtil.download(activity.getTitle() + "答题记录" + ".xlsx", workbook, response);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("导出Excel失败", e);
|
||||
throw new BaseException("导出Excel失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap userAnswer(String activityId) {
|
||||
// 检查活动ID是否为空
|
||||
if (activityId == null || activityId.isEmpty()) {
|
||||
throw new IllegalArgumentException("活动ID不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
// 查询用户答题记录
|
||||
List<QsvUserAnswerRecord> answerRecords = dao().query(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId));
|
||||
// 将答题记录的扩展JSON转换为JSONObject列表
|
||||
List<JSONObject> answerExtList = answerRecords.stream().map(QsvUserAnswerRecord::getExtJson).toList();
|
||||
|
||||
// 查询活动题目列表
|
||||
List<QsvSubject> subjects = dao().query(QsvSubject.class, Cnd.where(QsvSubject::getActivityId, "=", activityId));
|
||||
// 将题目列表转换为Map
|
||||
Map<String, QsvSubject> subjectMap = subjects.stream().collect(Collectors.toMap(QsvSubject::getId, v -> v));
|
||||
// 获取题目ID列表
|
||||
List<String> subjectIds = subjects.stream().map(QsvSubject::getId).toList();
|
||||
|
||||
// 查询题目选项列表
|
||||
List<QsvOption> options = dao().query(QsvOption.class, Cnd.where("subjectId", "in", subjectIds).asc(QsvOption::getSortNum));
|
||||
// 将选项列表转换为Map
|
||||
Map<String, QsvOption> optionMap = options.stream().collect(Collectors.toMap(QsvOption::getId, v -> v));
|
||||
|
||||
// 构建Excel导出实体
|
||||
List<ExcelExportEntity> excelExportEntities = buildExcelExportEntities(subjects);
|
||||
// 构建答题记录列表
|
||||
List<NutMap> list = buildAnswerRecords(answerRecords, subjectMap, options);
|
||||
|
||||
// 构建表格列信息
|
||||
List<NutMap> tableColumns = excelExportEntities.stream()
|
||||
.map(v -> NutMap.NEW().addv("prop", v.getKey()).addv("label", v.getName()))
|
||||
.toList();
|
||||
|
||||
return NutMap.NEW()
|
||||
.addv("tableColumns", tableColumns)
|
||||
.addv("tableData", list);
|
||||
} catch (Exception e) {
|
||||
throw new BaseException("获取用户答题记录失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<NutMap> querySubjects(String activityId) {
|
||||
Sql subjectSql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
type,
|
||||
sortNum
|
||||
FROM
|
||||
qsv_subject
|
||||
WHERE
|
||||
activityId = @activityId
|
||||
ORDER BY
|
||||
sortNum ASC
|
||||
""");
|
||||
subjectSql.setParam("activityId", activityId);
|
||||
return listMap(subjectSql);
|
||||
}
|
||||
|
||||
private List<ExcelExportEntity> buildExcelExportEntities(List<QsvSubject> subjects) {
|
||||
List<ExcelExportEntity> excelExportEntities = new ArrayList<>();
|
||||
excelExportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelExportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
for (QsvSubject subject : subjects) {
|
||||
excelExportEntities.add(new ExcelExportEntity(subject.getTitle(), subject.getId(), 20));
|
||||
}
|
||||
return excelExportEntities;
|
||||
}
|
||||
|
||||
private List<NutMap> buildAnswerRecords(List<QsvUserAnswerRecord> answerRecords, Map<String, QsvSubject> subjectMap, List<QsvOption> options) {
|
||||
return answerRecords.stream().map(record -> {
|
||||
NutMap map = NutMap.NEW()
|
||||
.addv("id", record.getId())
|
||||
.addv("loginName", record.getLoginName())
|
||||
.addv("userName", record.getUserName())
|
||||
.addv("unitName", record.getUnitName())
|
||||
.addv("unionName", record.getUnionName());
|
||||
JSONObject extJson = record.getExtJson();
|
||||
extJson.forEach((k, v) -> {
|
||||
JSONObject jsonVal = (JSONObject) v;
|
||||
|
||||
String type = subjectMap.get(k).getType();
|
||||
if (type.equals("text")) {
|
||||
map.addv(k, jsonVal.getStr("text"));
|
||||
} else if (type.equals("radio") || type.equals("checkbox")) {
|
||||
JSONArray optionIds = jsonVal.getJSONArray("optionIds");
|
||||
String selectOptionTexts = options.stream().filter(option -> optionIds.contains(option.getId()))
|
||||
.map(QsvOption::getText).collect(Collectors.joining(";"));
|
||||
map.addv(k, selectOptionTexts);
|
||||
}
|
||||
});
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
package com.budwk.app.zhgh.activity.qsv.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.activity.qsv.models.QsvUserAnswerRecord;
|
||||
import com.budwk.app.zhgh.activity.qsv.param.QsvAnswerParam;
|
||||
import com.budwk.app.zhgh.activity.qsv.service.QsvUserAnswerRecordService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class QsvUserAnswerRecordServiceImpl extends BaseServiceImpl<QsvUserAnswerRecord> implements QsvUserAnswerRecordService {
|
||||
public QsvUserAnswerRecordServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QsvUserAnswerRecord insertRecord(String activityId, List<String> subjectIds) {
|
||||
QsvActivity activity = dao().fetch(QsvActivity.class, activityId);
|
||||
String category = activity.getCategory();
|
||||
String mode = activity.getMode();
|
||||
String displayMode = activity.getDisplayMode();
|
||||
Boolean shuffleSubject = activity.getShuffleSubject();
|
||||
|
||||
//打乱题目顺序
|
||||
if (category.equals("QUIZ") && shuffleSubject) {
|
||||
Collections.shuffle(subjectIds);
|
||||
}
|
||||
|
||||
QsvUserAnswerRecord record = new QsvUserAnswerRecord();
|
||||
record.setActivityId(activityId);
|
||||
record.setUserId(SecurityUtil.getUserId());
|
||||
record.setSubjectIds(subjectIds);
|
||||
|
||||
JSONObject extJson = new JSONObject();
|
||||
for (String subjectId : subjectIds) {
|
||||
extJson.set(subjectId, Dict.create()
|
||||
.set("optionIds", new ArrayList<>())
|
||||
.set("text", null)
|
||||
.set("isCorrect", null)
|
||||
);
|
||||
}
|
||||
record.setExtJson(extJson);
|
||||
|
||||
View_user user = dao().fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
record.setLoginName(user.getLoginname());
|
||||
record.setUserName(user.getUsername());
|
||||
record.setUnitId(SecurityUtil.getUnitId());
|
||||
record.setUnitName(user.getUnitName());
|
||||
record.setUnionId(user.getUnionId());
|
||||
record.setUnionName(user.getUnionName());
|
||||
|
||||
//问卷模式
|
||||
if (category.equals("QUIZ")) {
|
||||
if (mode.equals("REGULAR")) {
|
||||
//常规模式 抽取随机题目
|
||||
int count = dao().count(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId)
|
||||
.and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId()));
|
||||
record.setRandomNumber(count + 1);
|
||||
} else if (mode.equals("SCHEDULED")) {
|
||||
//定时定题模式
|
||||
int count = dao().count(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId)
|
||||
.and(QsvUserAnswerRecord::getUserId, "=", SecurityUtil.getUserId())
|
||||
.and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today()));
|
||||
record.setRandomNumber(count + 1);
|
||||
record.setAttemptDate(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
dao().insert(record);
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float calcScore(QsvAnswerParam qsvAnswerParam) {
|
||||
List<String> subjectIds = qsvAnswerParam.getSubjects().stream().map(QsvAnswerParam.Subject::getId).toList();
|
||||
List<QsvSubject> subjects = dao().query(QsvSubject.class, Cnd.where(QsvSubject::getId, "in", subjectIds));
|
||||
|
||||
float score = 0;
|
||||
|
||||
for (QsvAnswerParam.Subject subject : qsvAnswerParam.getSubjects()) {
|
||||
List<String> userSelectOptionIds = subject.getUserSelectOptionIds();
|
||||
List<String> correctAnswer = subjects.stream().filter(s -> s.getId().equals(subject.getId())).findFirst().get().getCorrectAnswer();
|
||||
|
||||
String[] array1 = userSelectOptionIds.toArray(new String[0]);
|
||||
String[] array2 = correctAnswer.toArray(new String[0]);
|
||||
Arrays.sort(array1);
|
||||
Arrays.sort(array2);
|
||||
boolean isCorrect = Arrays.equals(array1, array2);
|
||||
|
||||
if (isCorrect) {
|
||||
score += subjects.stream().filter(s -> s.getId().equals(subject.getId())).findFirst().get().getScore();
|
||||
}
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(TransAop.READ_COMMITTED)
|
||||
public void calcByScoreMode(String activityId, String userId) {
|
||||
// 获取活动信息
|
||||
QsvActivity activity = dao().fetch(QsvActivity.class, activityId);
|
||||
if (activity == null) {
|
||||
throw new BaseException("活动找不到" + activityId);
|
||||
}
|
||||
|
||||
String mode = activity.getMode();
|
||||
String scoreMode = activity.getScoreMode();
|
||||
|
||||
if (mode.equals("SCHEDULED")) {
|
||||
processScoreRecords(activityId, SecurityUtil.getUserId(), true, scoreMode.equals("HIGH"));
|
||||
} else if (mode.equals("REGULAR")) {
|
||||
processScoreRecords(activityId, SecurityUtil.getUserId(), false, scoreMode.equals("HIGH"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (mode.equals("SCHEDULED")) {
|
||||
// //定时定题模式
|
||||
// if (scoreStatisticsMode.equals("HIGHEST")) {
|
||||
// //也只能取当天最高的分数
|
||||
// dao().update(QsvUserAnswerRecord.class, Chain.make("isHighestScore", 0), Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId).and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today()));
|
||||
// //找出最大的那条
|
||||
// QsvUserAnswerRecord maxScoreRecord = dao().fetch(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId).and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today()).desc(QsvUserAnswerRecord::getTotalScore));
|
||||
// if (maxScoreRecord != null) {
|
||||
// maxScoreRecord.setIsHighestScore(true);
|
||||
// dao().update(maxScoreRecord);
|
||||
// }
|
||||
// } else if (scoreStatisticsMode.equals("LAST")) {
|
||||
// //也只能取当天最新的记录
|
||||
// dao().update(QsvUserAnswerRecord.class, Chain.make("isLatestScore", 0), Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId).and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today()));
|
||||
// //找出最大的那条
|
||||
// QsvUserAnswerRecord latestScoreRecord = dao().fetch(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId).and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today()).desc(QsvUserAnswerRecord::getUpdatedAt));
|
||||
// if (latestScoreRecord != null) {
|
||||
// latestScoreRecord.setIsLatestScore(true);
|
||||
// dao().update(latestScoreRecord);
|
||||
// }
|
||||
// }
|
||||
// } else if (mode.equals("REGULAR")) {
|
||||
// if (scoreStatisticsMode.equals("HIGHEST")) {
|
||||
// dao().update(QsvUserAnswerRecord.class, Chain.make("isHighestScore", 0), Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId));
|
||||
// QsvUserAnswerRecord maxScoreRecord = dao().fetch(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId).desc(QsvUserAnswerRecord::getTotalScore));
|
||||
// if (maxScoreRecord != null) {
|
||||
// maxScoreRecord.setIsHighestScore(true);
|
||||
// dao().update(maxScoreRecord);
|
||||
// }
|
||||
// } else if (scoreStatisticsMode.equals("LAST")) {
|
||||
// dao().update(QsvUserAnswerRecord.class, Chain.make("isLatestScore", 0), Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId));
|
||||
// QsvUserAnswerRecord latestScoreRecord = dao().fetch(QsvUserAnswerRecord.class, Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId).desc(QsvUserAnswerRecord::getUpdatedAt));
|
||||
// if (latestScoreRecord != null) {
|
||||
// latestScoreRecord.setIsLatestScore(true);
|
||||
// dao().update(latestScoreRecord);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param activityId 活动id
|
||||
* @param userId 用户id
|
||||
* @param isScheduled 是否是定时定题模式
|
||||
* @param isHighest 是否是最高分模式
|
||||
*/
|
||||
private void processScoreRecords(String activityId, String userId, boolean isScheduled, boolean isHighest) {
|
||||
String flagField = isHighest ? "isHighestScore" : "isLatestScore";
|
||||
String orderByField = isHighest ? "totalScore" : "updatedAt";
|
||||
|
||||
// 更新所有记录的标志位为0
|
||||
Cnd cnd = Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId)
|
||||
.and(QsvUserAnswerRecord::getUserId, "=", userId);
|
||||
if (isScheduled) {
|
||||
cnd.and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today());
|
||||
}
|
||||
|
||||
dao().update(QsvUserAnswerRecord.class, Chain.make(flagField, 0), cnd);
|
||||
|
||||
// 找出符合条件的最大记录
|
||||
Cnd cnd2 = Cnd.where(QsvUserAnswerRecord::getActivityId, "=", activityId).and(QsvUserAnswerRecord::getUserId, "=", userId);
|
||||
if (isScheduled) {
|
||||
cnd2.and(QsvUserAnswerRecord::getAttemptDate, "=", DateUtil.today());
|
||||
}
|
||||
cnd2.desc(orderByField);
|
||||
QsvUserAnswerRecord record = dao().fetch(QsvUserAnswerRecord.class, cnd2);
|
||||
|
||||
if (record != null) {
|
||||
record.setIsHighestScore(isHighest);
|
||||
record.setIsLatestScore(!isHighest);
|
||||
dao().update(record);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
package com.budwk.app.zhgh.activity.sports.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.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolApply;
|
||||
import com.budwk.app.zhgh.activity.sports.param.ActivitySportsApplyUserPageParam;
|
||||
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsApplyUserService;
|
||||
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.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.List;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySportsApplyUserController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/7 18:04
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/apply")
|
||||
public class ActivitySportsApplyUserController {
|
||||
|
||||
|
||||
@Inject
|
||||
private ActivitySportsApplyUserService activitySportsApplyUserService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/sports/applyUser/index.html")
|
||||
@SaCheckPermission("activity.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param year
|
||||
* @param isActivity
|
||||
* @return com.budwk.app.base.result.Result
|
||||
* @author zhf
|
||||
* @description 查询所有的活动
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result activityData(Integer year, Integer isActivity, Integer applyStatus) {
|
||||
|
||||
return Result.success(activitySportsApplyUserService.activityData(year, isActivity, applyStatus));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据活动查询项目
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result getEvents(String activityId) {
|
||||
|
||||
return Result.success(activitySportsApplyUserService.getEvents(activityId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activityId
|
||||
* @return com.budwk.app.base.result.Result
|
||||
* @author zhf
|
||||
* @description 查询所报的领队教练等
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result getUnionCoachLeaderHead(String activityId, String unionId) {
|
||||
return Result.success(activitySportsApplyUserService.getUnionCoachLeaderHead(activityId, unionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pageParam
|
||||
* @return com.budwk.app.base.result.Result
|
||||
* @author zhf
|
||||
* @description 根据活动获取下面的项目并分页
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result pageData(@Param("data") ActivitySportsApplyUserPageParam pageParam) {
|
||||
|
||||
return Result.success(activitySportsApplyUserService.pageData(pageParam));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param applyUserPageParam
|
||||
* @return com.budwk.app.base.result.Result
|
||||
* @author zhf
|
||||
* @description 获取这个活动统一报名的信息
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result getUniteApplyInfo(@Param("data") ActivitySportsApplyUserPageParam applyUserPageParam, Integer isMenWomenTwo) {
|
||||
if (StrUtil.isBlank(activitySportsApplyUserService.getUnionId())) {
|
||||
return Result.error("您暂未设置活动工会");
|
||||
}
|
||||
return Result.success(activitySportsApplyUserService.getUniteApplyInfo(applyUserPageParam, isMenWomenTwo));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动", msg = "提交运动员")
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result doApplyUser(@Param(value = "data") ActivitySchoolApply[] userList,
|
||||
String eventId,
|
||||
String activityId,
|
||||
Boolean pass,
|
||||
String unionId) {
|
||||
activitySportsApplyUserService.doApplyUser(userList, eventId, activityId, pass, unionId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return com.budwk.app.base.result.Result
|
||||
* @author zhf
|
||||
* @description 查询已经报名的人员
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result applyPageData(PageForm page, String activityId, String eventId, String unionId) {
|
||||
|
||||
return Result.success(activitySportsApplyUserService.applyPageData(page, activityId, eventId, unionId));
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动", msg = "删除运动员")
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result joinMemberFamily(@Param("ids") String[] ids) {
|
||||
activitySportsApplyUserService.clear(Cnd.where("id", "in", ids));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动", msg = "添加工会教练、领队")
|
||||
@SaCheckPermission("activity.apply")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result doLeaderCoach(@Param("data") ActivitySchoolApply[] data, String activityId, String unionId) {
|
||||
activitySportsApplyUserService.doLeaderCoach(data, activityId, unionId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param query
|
||||
* @return com.budwk.app.base.result.Result
|
||||
* @author zhf
|
||||
* @description 查询这个工会下有哪些人
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result getUserUnion(String query) {
|
||||
List<NutMap> userUnion = activitySportsApplyUserService.getUserUnion(query);
|
||||
return Result.success(userUnion);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result findUserOne(String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.mobile,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
un.unionid unionId,
|
||||
un.id unitId,
|
||||
un.`name` unitname
|
||||
FROM
|
||||
`vw_user` u
|
||||
LEFT JOIN activity_basic_unit un ON u.unitid = un.id
|
||||
WHERE u.id=@id
|
||||
""").setParam("id", id);
|
||||
NutMap nutMap = (NutMap) dao.execute(sql.setCallback(Sqls.callback.map())).getResult();
|
||||
if (Strings.isNotBlank(nutMap.getString("birthday"))) {
|
||||
nutMap.setv("birthday", nutMap.getString("birthday").substring(0, 10));
|
||||
nutMap.setv("age", cn.hutool.core.date.DateUtil.ageOfNow(nutMap.getString("birthday")));
|
||||
} else {
|
||||
nutMap.setv("birthday", null);
|
||||
nutMap.setv("age", 0);
|
||||
}
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activityId
|
||||
* @return java.lang.Object
|
||||
* @author zhf
|
||||
* @description 查询这个活动报单项的有哪些人
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply")
|
||||
public Result getActivityData(@Param(value = "activityId") String activityId) {
|
||||
List<ActivitySchoolApply> applyList = activitySportsApplyUserService.query(Cnd.where("activityId", "=", activityId).and("awardsMode", "=", 1));
|
||||
return Result.success(applyList);
|
||||
}
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.budwk.app.zhgh.activity.sports.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.sports.param.ActivitySportsApplyUserPageParam;
|
||||
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsApplyUserService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySportsApplyUserListController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/11/14 16:29
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/applyList")
|
||||
public class ActivitySportsApplyUserListController {
|
||||
|
||||
@Inject
|
||||
private ActivitySportsApplyUserService activitySportsApplyUserService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/sports/applyUser/indexList.html")
|
||||
@SaCheckPermission("activity.apply.applyList")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param year
|
||||
* @param isActivity
|
||||
* @return com.budwk.app.base.result.Result
|
||||
* @author zhf
|
||||
* @description 查询所有的活动
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.apply.applyList")
|
||||
public Result activityData(Integer year, Integer isActivity, Integer applyStatus) {
|
||||
|
||||
return Result.success(activitySportsApplyUserService.activityData(year, isActivity, applyStatus));
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.apply.applyList")
|
||||
public Result pageData(@Param("data") ActivitySportsApplyUserPageParam pageParam) {
|
||||
|
||||
return Result.success(activitySportsApplyUserService.pageData(pageParam));
|
||||
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
package com.budwk.app.zhgh.activity.sports.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityEvent;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
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.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySportsCommonController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/7 10:21
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/sports/common")
|
||||
public class ActivitySportsCommonController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
private static final NutMap activityCodeMap = new NutMap() {{
|
||||
put("40002", "JC");
|
||||
put("40003", "XH");
|
||||
put("40001", "GH");
|
||||
}};
|
||||
|
||||
|
||||
/**
|
||||
* 活动编号生成
|
||||
*
|
||||
* @param activity_type
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission
|
||||
public Result generateActivityCode(String activity_type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
cnd.and("LEFT(activityCode,6)", "=", year + activityCodeMap.getString(activity_type));
|
||||
String code = String.format("%03d", dao.count(ActivityTissue.class, cnd) + 1);
|
||||
return Result.success().addData(year + activityCodeMap.getString(activity_type) + code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型获取活动项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission
|
||||
public Result getEvents(Integer type) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ae.*
|
||||
FROM
|
||||
activity_event ae
|
||||
LEFT JOIN activity_basic_settings ba ON ae.competitionCategory = ba.id
|
||||
$condition
|
||||
""");
|
||||
cnd.and("ae.whetherEnable", "=", 1);
|
||||
|
||||
if (type != null && type == 1) {
|
||||
cnd.and("ae.projectType", "=", 2);
|
||||
} else if (type != null && type == 3) {
|
||||
cnd.and("ae.projectType", "=", 1);
|
||||
}
|
||||
cnd.and(new Static("""
|
||||
1=1
|
||||
ORDER BY
|
||||
ae.isMenWomen DESC,
|
||||
CASE
|
||||
ba.`name`
|
||||
WHEN '甲组' THEN
|
||||
1
|
||||
WHEN '乙组' THEN
|
||||
2
|
||||
WHEN '丙组' THEN
|
||||
3
|
||||
WHEN '丁组' THEN
|
||||
4
|
||||
WHEN '团体' THEN
|
||||
5
|
||||
END
|
||||
"""));
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(baseService.listMap(sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
public Result getEventData(String id) {
|
||||
ActivityEvent event = dao.fetch(ActivityEvent.class, id);
|
||||
return Result.success(event);
|
||||
}
|
||||
|
||||
@At
|
||||
public Result findOne(String id) {
|
||||
|
||||
NutMap nutMap = (NutMap) dao.execute(Sqls.create("SELECT * FROM `activity_school` WHERE id = @id").setParam("id", id)
|
||||
.setCallback(Sqls.callback.map())).getResult();
|
||||
Sql eventSql = Sqls.create("""
|
||||
SELECT
|
||||
ase.*,
|
||||
ae.allName,
|
||||
ae.projectType,
|
||||
sch.applyType
|
||||
FROM
|
||||
activity_school_event ase
|
||||
LEFT JOIN activity_event ae ON ae.id = ase.eventId
|
||||
LEFT JOIN activity_school sch ON sch.id=ase.activityId
|
||||
WHERE
|
||||
activityId = @activityId
|
||||
""").setParam("activityId", id);
|
||||
|
||||
List<NutMap> eventMap = baseService.listMap(eventSql);
|
||||
nutMap.setv("events", eventMap);
|
||||
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
package com.budwk.app.zhgh.activity.sports.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.constant.RoleConstant;
|
||||
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.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolEvent;
|
||||
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySportsInfoManageController
|
||||
* @Description 活动信息管理
|
||||
* @Author zhf
|
||||
* @Date 2024/8/7 9:34
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/sports/info/mange")
|
||||
public class ActivitySportsInfoManageController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/sports/infoManage/index.html")
|
||||
@SaCheckPermission("activity.sports.info")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private ActivitySportsService activitySportsService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.sports.info")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "name") String name,
|
||||
@Param(value = "gameStyle") String gameStyle,
|
||||
@Param(value = "query") String query,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "activityLevel") String activityLevel) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.`name` unionname,
|
||||
ba.`name` activityLevelName,
|
||||
school.id,
|
||||
school.planId,
|
||||
school.name,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.unitSponsor,
|
||||
school.unitJointly,
|
||||
school.gameStyle,
|
||||
school.funding,
|
||||
school.applyWay,
|
||||
school.personType,
|
||||
school.activityLevel,
|
||||
school.isSave,
|
||||
school.activityGroupId,
|
||||
school.activityCode,
|
||||
school.foundDate,
|
||||
school.applyType,
|
||||
(SELECT COUNT(1) FROM activity_school_apply asa WHERE asa.activityId = school.id and status=2) applyNum
|
||||
FROM
|
||||
activity_school school
|
||||
LEFT JOIN activity_basic_settings ba ON ba.`code` = school.activityLevel
|
||||
LEFT JOIN sys_union un ON un.id = school.belongUnionId
|
||||
$condition
|
||||
""");
|
||||
|
||||
if ("one".equals(query)) {
|
||||
cnd.and(new Static("now() > school.applyStartTime and now() < school.applyEndTime"));
|
||||
} else if ("two".equals(query)) {
|
||||
cnd.and(new Static("now() > school.applyEndTime and now() < school.startTime"));
|
||||
} else if ("three".equals(query)) {
|
||||
cnd.and(new Static("now() > school.startTime and now() < school.endTime"));
|
||||
} else if ("four".equals(query)) {
|
||||
cnd.and(new Static("now() > school.endTime"));
|
||||
}
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (AuthUtil.hasRole("H04")) {
|
||||
cnd.and("school.belongUnionId", "=", SecurityUtil.getUnionId());
|
||||
} else {
|
||||
// cnd.and("school.belongClubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cnd.andEX("school.activityLevel", "=", activityLevel);
|
||||
cnd.andEX("school.gameStyle", "=", gameStyle);
|
||||
cnd.andEX("YEAR(school.applyStartTime)", "=", year);
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
cnd.and(Cnd.likeEX("school.name", name));
|
||||
}
|
||||
cnd.andEX("school.id", "=", activityId);
|
||||
|
||||
cnd.desc("school.startTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = activitySportsService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.sports.info")
|
||||
public Object getEventApply(@Param(value = "activityId") String activityId,
|
||||
@Param(value = "eventId") String[] eventId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ev.allName
|
||||
FROM
|
||||
activity_school_apply asa LEFT JOIN activity_event ev ON ev.id=asa.eventId
|
||||
$condition
|
||||
""");
|
||||
cnd.and("asa.activityId", "=", activityId);
|
||||
cnd.and("asa.eventId", "in", eventId);
|
||||
cnd.groupBy("ev.allName");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(activitySportsService.listMap(sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动", msg = "修改活动")
|
||||
@SaCheckPermission("activity.sports.info")
|
||||
public Result doEdit(@Param(value = "data") ActivitySchool activitySchool,
|
||||
@Param(value = "events") ActivitySchoolEvent[] events) {
|
||||
activitySportsService.doEdit(activitySchool, events);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动", msg = "添加活动")
|
||||
@SaCheckPermission("activity.sports.info")
|
||||
public Result doAdd(@Param(value = "data") ActivitySchool activitySchool,
|
||||
@Param(value = "events") ActivitySchoolEvent[] events) {
|
||||
String id = activitySportsService.doAdd(activitySchool, events);
|
||||
return Result.success().addData(id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.sports.info")
|
||||
public Result findOne(String id) {
|
||||
NutMap nutMap = (NutMap) dao.execute(Sqls.create("SELECT * FROM `activity_school` WHERE id = @id").setParam("id", id)
|
||||
.setCallback(Sqls.callback.map())).getResult();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ase.*,
|
||||
ae.projectType
|
||||
FROM
|
||||
activity_school_event ase
|
||||
LEFT JOIN activity_event ae ON ae.id = ase.eventId
|
||||
WHERE
|
||||
ase.activityId = @activityId
|
||||
""").setParam("activityId", id);
|
||||
|
||||
nutMap.setv("schoolEvents", activitySportsService.listMap(sql));
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "体育活动", msg = "删除活动")
|
||||
@SaCheckPermission("activity.sports.info")
|
||||
public Result doDelete(String id) {
|
||||
activitySportsService.doDelete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void exportXlsx(String id, String unionId, HttpServletResponse response) {
|
||||
activitySportsService.exportXlsx(id, unionId, response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.budwk.app.zhgh.activity.sports.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnion;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnit;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySportsReadingController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/9 8:54
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/reading")
|
||||
public class ActivitySportsReadingController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/sports/reading/index.html")
|
||||
@SaCheckPermission("activity.reading")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public Dao dao;
|
||||
@Inject
|
||||
public BaseService baseService;
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.reading")
|
||||
public Result getActivityByYear(Integer year, String activityLevel) {
|
||||
ActivityBasicUnit basicUnit = dao.fetch(ActivityBasicUnit.class, Cnd.where("id", "=", SecurityUtil.getUnitId()));
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("close", "!=", true);
|
||||
cnd.and("YEAR(startTime)", "=", year);
|
||||
cnd.and("activityLevel", "=", activityLevel);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SYSADMIN.name())) {
|
||||
if (activityLevel.equals("40002")) {
|
||||
cnd.and("belongUnionId", "=", basicUnit.getUnionId());
|
||||
}
|
||||
if (activityLevel.equals("40003")) {
|
||||
// cnd.and("belongClubId", "in", vi.getMangeClubStr());
|
||||
}
|
||||
}
|
||||
List<ActivitySchool> schoolList = dao.query(ActivitySchool.class, cnd.desc("applyEndTime"));
|
||||
return Result.success(schoolList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.reading")
|
||||
public Result pageData(String id, String activityLevel) {
|
||||
ActivityBasicUnit basicUnit = dao.fetch(ActivityBasicUnit.class, Cnd.where("id", "=", SecurityUtil.getUnitId()));
|
||||
ActivitySchool activitySchool = dao.fetch(ActivitySchool.class, id);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
app.*,
|
||||
school.`name` activityName,
|
||||
school.applyType applyType,
|
||||
school.belongUnionId belongUnionId,
|
||||
school.belongClubId belongClubId,
|
||||
team.`name` team,
|
||||
unit.`name` unitname,
|
||||
ev.allName,
|
||||
ev.id evid,
|
||||
ev.projectType
|
||||
FROM
|
||||
activity_school_apply app
|
||||
LEFT JOIN activity_school school ON school.id = app.activityId
|
||||
LEFT JOIN activity_school_team team ON app.teamId = team.id
|
||||
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
||||
LEFT JOIN sys_unit unit ON app.unitId = unit.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.and("app.activityId", "=", id);
|
||||
cnd.and("app.status", "=", 2);
|
||||
sql.setCondition(cnd);
|
||||
cnd.desc("ev.allName").desc("LENGTH(app.identity)").asc("ev.projectType").asc("team.`name`");
|
||||
List<NutMap> applies = baseService.listMap(sql);
|
||||
List<NutMap> apply = new ArrayList();
|
||||
Cnd unionCnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SYSADMIN.name())) {
|
||||
unionCnd.and("id", "=", basicUnit.getUnionId());
|
||||
}
|
||||
if (activityLevel.equals("40002")) {
|
||||
unionCnd.and("id", "=", activitySchool.getBelongUnionId());
|
||||
}
|
||||
// unionCnd.and("isEnable", "=", true);
|
||||
unionCnd.asc("unioncode");
|
||||
|
||||
if (!activityLevel.equals("40003")) {
|
||||
List<ActivityBasicUnion> unions = dao.query(ActivityBasicUnion.class, unionCnd);
|
||||
|
||||
for (ActivityBasicUnion union : unions) {
|
||||
String unionId = union.getId();
|
||||
NutMap map = new NutMap();
|
||||
|
||||
List<NutMap> applyList = applies.stream().filter(v -> {
|
||||
return v.getString("activityUnionId").equals(unionId);
|
||||
}).collect(Collectors.toList());
|
||||
map.setv("id", unionId);
|
||||
map.setv("unionname", union.getName());
|
||||
map.setv("unioncode", union.getName());
|
||||
map.setv("num", applyList.size());
|
||||
map.setv("apply", applyList);
|
||||
|
||||
apply.add(map);
|
||||
}
|
||||
} else {
|
||||
/* NutMap map = new NutMap();
|
||||
Sys_club sysClub = sysClubService.fetch(cnd.where("id", "=", activitySchool.getBelongClubId()));
|
||||
map.setv("id", sysClub.getId());
|
||||
map.setv("unionname", sysClub.getName());
|
||||
map.setv("unioncode", sysClub.getCode());
|
||||
map.setv("num", applies.size());
|
||||
map.setv("apply", applies);
|
||||
|
||||
apply.add(map);*/
|
||||
}
|
||||
|
||||
|
||||
return Result.success(apply);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.budwk.app.zhgh.activity.sports.h5Controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
import com.budwk.app.zhgh.activity.sports.param.ActivitySportsApplyUserPageParam;
|
||||
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsApplyUserService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ClassName H5ActivitySportsApplyUserController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/11/14 10:36
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/h5/activity/apply")
|
||||
public class H5ActivitySportsApplyUserController {
|
||||
@Inject
|
||||
private ActivitySportsApplyUserService activitySportsApplyUserService;
|
||||
|
||||
@At("/applyUser")
|
||||
@Ok("beetl:platform/zhghh5/activity/sports/applyUser.html")
|
||||
@SaCheckPermission("h5.activity.sports.applyUser")
|
||||
public void applyUserIndex() {
|
||||
}
|
||||
|
||||
@At("/eventList")
|
||||
@Ok("beetl:platform/zhghh5/activity/sports/eventList.html")
|
||||
@SaCheckPermission("h5.activity.sports.applyUser")
|
||||
public void eventListIndex() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.activity.sports.applyUser")
|
||||
public Result activityData(Integer year, Integer isActivity, Integer applyStatus) {
|
||||
return Result.success(activitySportsApplyUserService.activityData(year, isActivity, applyStatus));
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.activity.sports.applyUser")
|
||||
public Result pageData(@Param("data") ActivitySportsApplyUserPageParam pageParam) {
|
||||
|
||||
return Result.success(activitySportsApplyUserService.pageData(pageParam));
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.activity.sports.applyUser")
|
||||
public Result findOneActivity(@Valid String activityId) {
|
||||
return Result.success(activitySportsApplyUserService.dao().fetch(ActivitySchool.class, activityId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.budwk.app.zhgh.activity.sports.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/5/19 14:43
|
||||
* @description 运动会成绩
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("运动会成绩")
|
||||
@Table("activity_results")
|
||||
public class ActivityResults extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 单项活动使用
|
||||
*/
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("用户男女")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("对应的活动")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("对应的项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("名次")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer ranking;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("人数")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String numberOfPeople;
|
||||
|
||||
@Column
|
||||
@Comment("积分")
|
||||
@ColDefine(type = ColType.FLOAT, width = 5)
|
||||
private double integral;
|
||||
|
||||
@Column
|
||||
@Comment("个人1团队2")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer isTeamPersonal;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package com.budwk.app.zhgh.activity.sports.models;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 11:31
|
||||
* @description: 校级活动
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("体育活动")
|
||||
@Table("activity_school")
|
||||
public class ActivitySchool extends BaseModel implements Serializable , SysHomeConvert {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("关联计划")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String planId;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("活动地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String address;
|
||||
|
||||
@Column
|
||||
@Comment("关联活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("活动编号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String activityCode;
|
||||
|
||||
@Column
|
||||
@Comment("报名开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("报名结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String startTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String endTime;
|
||||
|
||||
@Column
|
||||
@Comment("关联主办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> unitSponsor;
|
||||
|
||||
@Column
|
||||
@Comment("关联承办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> undertakeUnit;
|
||||
|
||||
@Column
|
||||
@Comment("关联协办单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> unitJointly;
|
||||
|
||||
@Column
|
||||
@Comment("活动项目")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> eventsIds;
|
||||
|
||||
@Column
|
||||
@Comment("活动方式(1:竞赛 2:非竞赛)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer gameStyle;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型(2:综合类活动 1:单一活动)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer applyType;
|
||||
|
||||
@Column
|
||||
@Comment("可报名范围组别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("经费预算")
|
||||
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||
private Double funding;
|
||||
|
||||
@Column
|
||||
@Comment("报名方式(1:个人 2:分工会 3:小程序)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Integer> applyWay;
|
||||
|
||||
@Column
|
||||
@Comment("报名人员类型(1:会员 2:普通教职工)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer personType;
|
||||
|
||||
@Column
|
||||
@Comment("运动员资格(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String athleteQualification;
|
||||
|
||||
@Column
|
||||
@Comment("报名方法(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String registrationMethod;
|
||||
|
||||
@Column
|
||||
@Comment("竞赛方法(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String competitionMethod;
|
||||
|
||||
@Column
|
||||
@Comment("奖励方法(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String rewardMethod;
|
||||
|
||||
@Column
|
||||
@Comment("注意事项(竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String precautions;
|
||||
|
||||
@Column
|
||||
@Comment("活动通知(非竞赛)")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String eventNotification;
|
||||
|
||||
@Column
|
||||
@Comment("是否关闭")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean close;
|
||||
|
||||
@Column
|
||||
@Comment("活动级别(40001-校级、40002-分工会、40003-社团或协会)")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer activityLevel;
|
||||
|
||||
@Column
|
||||
@Comment("是否保存")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Integer isSave;
|
||||
|
||||
@Column
|
||||
@Comment("小程序活动封面")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
private String image;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<ActivitySchoolEvent> schoolEvents;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("活动所属工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String belongUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("活动所属社团")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String belongClubId;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String foundDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否发送系统消息")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean xlFlag;
|
||||
|
||||
@Override
|
||||
public Sys_home_activity covertToSysHomeActivity() {
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(this.getId());
|
||||
sysHomeActivity.setName(this.getName());
|
||||
sysHomeActivity.setCover(this.getImage());
|
||||
sysHomeActivity.setUrl("/platform/activity/apply");
|
||||
sysHomeActivity.setH5Url(null);
|
||||
sysHomeActivity.setStartDate(DateUtil.parseDate(this.getApplyStartTime()));
|
||||
sysHomeActivity.setEndDate(DateUtil.parseDate(this.getApplyEndTime()));
|
||||
sysHomeActivity.setAllowUserGroupId(this.getActivityGroupId());
|
||||
sysHomeActivity.setEnable(true);
|
||||
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
|
||||
return sysHomeActivity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.budwk.app.zhgh.activity.sports.models;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 11:31
|
||||
* @description: 校活动报名
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("校活动报名")
|
||||
@Table("activity_school_apply")
|
||||
@TableIndexes({
|
||||
@Index(name = "ASA_ACTIVITY", fields = {"activityId"}, unique = false),
|
||||
@Index(name = "ASA_UNIT", fields = {"unitId"}, unique = false)
|
||||
})
|
||||
public class ActivitySchoolApply extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("对应的活动")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("对应的项目")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("对应的是单项还是团体(1是个人2是团体)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String awardsMode;
|
||||
|
||||
@Column
|
||||
@Comment("所属队")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String teamId;
|
||||
|
||||
@Column
|
||||
@Comment("所属单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("所属工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("所属活动工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("所属活动工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("报名人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyUser;
|
||||
|
||||
@Column
|
||||
@Comment("参加人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("出生年月")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String birthday;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String applyDate;
|
||||
|
||||
@Column
|
||||
@Comment("身份(1 运动员 2 教练 3 领队4 处级领导5 替补6 团长7工作人员)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> identity;
|
||||
|
||||
@Column
|
||||
@Comment("是否处级领导")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean divisionLevelLeadership;
|
||||
|
||||
@Column
|
||||
@Comment("是否兼运动员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isAthlete;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会总领队")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionLeader;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会总教练")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionCoach;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会团长")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionHead;
|
||||
|
||||
@Column
|
||||
@Comment("是否为工会工作人员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean unionStaff;
|
||||
|
||||
@Column
|
||||
@Comment("状态(0 保存 1 待审核 2 报名成功 3 审核不通过)")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unitname;
|
||||
|
||||
|
||||
@Excel(name = "分工会", width = 30)
|
||||
private String unionname;
|
||||
|
||||
@Column
|
||||
@Comment("小队名称")
|
||||
@Excel(name = "小队名称", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String team;
|
||||
|
||||
@Excel(name = "项目名称", width = 40)
|
||||
private String allName;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@Excel(name = "工号", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@Excel(name = "姓名", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String username;
|
||||
@Column
|
||||
@Comment("电话")
|
||||
@Excel(name = "手机号码", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
|
||||
@Excel(name = "身份证号", width = 20)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@Excel(name = "性别", width = 20)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String sex;
|
||||
|
||||
@Excel(name = "在职状态", width = 20)
|
||||
private String userState;
|
||||
|
||||
@Excel(name = "身份", width = 40)
|
||||
private String sf;
|
||||
private int age;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.budwk.app.zhgh.activity.sports.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-04-06 10:05
|
||||
* @description: 校级活动活动项目关联表
|
||||
**/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("体育活动活动项目关联表")
|
||||
@Table("Activity_school_event")
|
||||
public class ActivitySchoolEvent extends BaseModel implements Serializable {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("项目ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("比赛模式(1:单项 2:团队)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private Integer awardsMode;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式(1:单项报名人数 2:团体报名人数)")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Integer> combinationMethod;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式1:最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictTotalPeople;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式1:报名方式(1-单人、2-双人)")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer registrationWays;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:最少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictMinNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictMaxNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:最大队数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictTotalTeam;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:运动员最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer athletesMaxNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:运动员最少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer athletesMinNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:领队人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer leanderNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:教练人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer coachNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:女队人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictGirlNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:男队人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer restrictBoyNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:副处长(级)以上至少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer deputyDirectorNum;
|
||||
|
||||
@Column
|
||||
@Comment("组合方式2:替补人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer substituteNum;
|
||||
|
||||
@Column
|
||||
@Comment("每人限报项目数")
|
||||
@ColDefine(type = ColType.INT, width = 2)
|
||||
private Integer restrictRegNumber;
|
||||
|
||||
@Column
|
||||
@Comment("开始年龄")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 10)
|
||||
private String startAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("截至年龄")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String endAgeDate;
|
||||
|
||||
@Column
|
||||
@Comment("是否只报领队")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isLeader;
|
||||
|
||||
@Column
|
||||
@Comment("每对运动员男女不做限制")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isManGirlNum;
|
||||
|
||||
@One(field = "activityId", key = "id")
|
||||
private ActivitySchool activitySchool;
|
||||
|
||||
@Column
|
||||
@Comment("分工会人数限制")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> unionLimit;
|
||||
|
||||
@Column
|
||||
@Comment("报名人数限制模式")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer applyUserModel;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.budwk.app.zhgh.activity.sports.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 11:31
|
||||
* @description: 校活动 队
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Comment("校活动 队")
|
||||
@Table("activity_school_team")
|
||||
@TableIndexes({
|
||||
@Index(name = "AST_ACTIVITY", fields = {"activityId"}, unique = false),
|
||||
})
|
||||
public class ActivitySchoolTeam extends BaseModel implements Serializable {
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("对应的活动")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("项目ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String eventId;
|
||||
|
||||
@Column
|
||||
@Comment("队名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("最少人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer minNum;
|
||||
|
||||
@Column
|
||||
@Comment("最多人数")
|
||||
@ColDefine(type = ColType.INT, width = 8)
|
||||
private Integer maxNum;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM Activity_School_Team"),
|
||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM Activity_School_Team")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.budwk.app.zhgh.activity.sports.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySportsApplyUserPageParam
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/7 19:17
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class ActivitySportsApplyUserPageParam extends PageForm {
|
||||
|
||||
|
||||
private String applyType;
|
||||
private String isAudit;
|
||||
private String groupName;
|
||||
private String activityId;
|
||||
private String eventId;
|
||||
private String year;
|
||||
private String unionId;
|
||||
private String[] isMenWomen;
|
||||
|
||||
private String endAgeDate;
|
||||
private String startAgeDate;
|
||||
private String schoolEventId;
|
||||
private String projectType;
|
||||
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.budwk.app.zhgh.activity.sports.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolApply;
|
||||
import com.budwk.app.zhgh.activity.sports.param.ActivitySportsApplyUserPageParam;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivitySportsApplyUserService extends BaseService<ActivitySchoolApply> {
|
||||
|
||||
String getUnionId();
|
||||
|
||||
Pagination pageData(ActivitySportsApplyUserPageParam pageParam);
|
||||
|
||||
List<NutMap> activityData(Integer year, Integer isActivity,Integer applyStatus);
|
||||
|
||||
List<NutMap> getEvents(String activityId);
|
||||
|
||||
Object getUnionCoachLeaderHead(String activityId,String unionId);
|
||||
|
||||
Object getUniteApplyInfo(ActivitySportsApplyUserPageParam applyUserPageParam, Integer isMenWomen);
|
||||
|
||||
void doApplyUser(ActivitySchoolApply[] userList, String eventId, String activityId, Boolean pass, String unionId);
|
||||
|
||||
Pagination applyPageData(PageForm page, String activityId, String eventId, String unionId);
|
||||
|
||||
void doLeaderCoach(ActivitySchoolApply[] data, String activityId, String unionId);
|
||||
|
||||
List<NutMap> getUserUnion(String query);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.budwk.app.zhgh.activity.sports.service;
|
||||
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolEvent;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author Aaron
|
||||
*/
|
||||
public interface ActivitySportsService extends BaseService<ActivitySchool> {
|
||||
|
||||
String doAdd(ActivitySchool activitySchool, ActivitySchoolEvent[] events);
|
||||
|
||||
void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events);
|
||||
|
||||
void doDelete(String id);
|
||||
|
||||
void exportXlsx(String id, String unionId, HttpServletResponse response);
|
||||
}
|
||||
+473
@@ -0,0 +1,473 @@
|
||||
package com.budwk.app.zhgh.activity.sports.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnion;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnit;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolApply;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolTeam;
|
||||
import com.budwk.app.zhgh.activity.sports.param.ActivitySportsApplyUserPageParam;
|
||||
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsApplyUserService;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName ActivitySportsApplyUserServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/8/7 19:01
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl<ActivitySchoolApply> implements ActivitySportsApplyUserService {
|
||||
public ActivitySportsApplyUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnionId() {
|
||||
ActivityBasicUnit basicUnit = dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", SecurityUtil.getUnitId()));
|
||||
ActivityBasicUnion basicUnion = dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionId()));
|
||||
|
||||
return StrUtil.isBlank(SecurityUtil.getUnitId()) ? "" : basicUnion.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(ActivitySportsApplyUserPageParam pageParam) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isBlank(pageParam.getUnionId())) {
|
||||
pageParam.setUnionId(getUnionId());
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ase.*,
|
||||
school.`name`,
|
||||
school.applyWay,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.applyType,
|
||||
school.activityGroupId,
|
||||
eve.allName,
|
||||
eve.isInterest,
|
||||
eve.projectType eveProjectType,
|
||||
eve.isMenWomen,
|
||||
apply.`status`,
|
||||
IF (sum(apply.`status`=2) IS NULL, 0, sum(apply.`status`=2)) AS successUserApply,
|
||||
count(apply.id) userApply,
|
||||
apply.applyUser,
|
||||
(SELECT ast.`name` FROM activity_school_apply app LEFT JOIN activity_school_team ast ON ast.id = app.teamId WHERE app.eventId = ase.eventId AND app.activityId = ase.activityId AND app.userId = @userId) activityTeamName,
|
||||
(select GROUP_CONCAT(username) FROM activity_school_apply WHERE status=2 and eventId = ase.eventId
|
||||
AND activityId = ase.activityId AND applyUser AND (applyUser=@userId or userId=@userId)) userApplyNames,
|
||||
(SELECT COUNT(1) FROM activity_school_apply WHERE eventId=ase.eventId AND activityId=ase.activityId and status=2) totalApplyNum,
|
||||
(SELECT COUNT(1) FROM activity_school_apply WHERE eventId=ase.eventId AND activityId=ase.activityId and status=0 and activityUnionId=@unionId) apply_num_bc,
|
||||
(SELECT COUNT(1) FROM activity_school_apply WHERE eventId=ase.eventId AND activityId=ase.activityId and status=1 and activityUnionId=@unionId) apply_num_dsh
|
||||
FROM
|
||||
activity_school_event ase
|
||||
LEFT JOIN activity_school school ON ase.activityId = school.id
|
||||
LEFT JOIN activity_event eve ON ase.eventId=eve.id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.id=eve.competitionCategory
|
||||
LEFT JOIN activity_school_apply apply ON apply.activityId=ase.activityId AND apply.eventId=ase.eventId AND (applyUser=@userId or userId=@userId)
|
||||
$condition
|
||||
""").setParam("unionId", pageParam.getUnionId()).setParam("userId", SecurityUtil.getUserId());
|
||||
|
||||
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(),
|
||||
RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
// cnd.where().andLike("school.applyWay ", "1");
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=school.activityGroupId AND userId='%s') >0".formatted(SecurityUtil.getUserId())));
|
||||
|
||||
}
|
||||
cnd.andEX("abs.`name`", "=", pageParam.getGroupName());
|
||||
if (Strings.isNotBlank(pageParam.getIsAudit())) {
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_school_apply WHERE eventId = ase.eventId AND activityId = ase.activityId AND userId='%s')%s0".formatted(SecurityUtil.getUserId(), (pageParam.getIsAudit().equals("true") ? ">" : "="))));
|
||||
}
|
||||
cnd.and("ase.activityId", "=", pageParam.getActivityId());
|
||||
cnd.andEX("ase.eventId", "=", pageParam.getEventId());
|
||||
cnd.andEX("YEAR(school.applyStartTime)", "=", pageParam.getYear());
|
||||
|
||||
cnd.groupBy("ase.id");
|
||||
cnd.asc("abs.`code`");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> activityData(Integer year, Integer isActivity, Integer applyStatus) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ba.`name` activityLevelName,
|
||||
school.id,
|
||||
school.planId,
|
||||
school.NAME,
|
||||
school.address,
|
||||
school.applyStartTime,
|
||||
school.applyEndTime,
|
||||
school.startTime,
|
||||
school.endTime,
|
||||
school.unitSponsor,
|
||||
school.unitJointly,
|
||||
school.gameStyle,
|
||||
school.funding,
|
||||
school.applyWay,
|
||||
school.personType,
|
||||
school.activityLevel,
|
||||
school.applyType,
|
||||
school.image,
|
||||
school.eventNotification,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND app.`status` = 2 ) apply_num,
|
||||
(SELECT count( 1 ) FROM activity_school_apply app WHERE app.activityId = school.id AND ( app.applyUser = @userid OR app.userId = @userid )) > 0 applyed,
|
||||
(SELECT COUNT(1) FROM activity_school_apply app WHERE app.activityId=school.id AND app.unionId=@unionId AND app.unionLeader=TRUE) LeaderCount,
|
||||
(SELECT COUNT(1) FROM activity_school_apply app WHERE app.activityId=school.id AND app.unionId=@unionId AND app.unionCoach=TRUE) CoachCount
|
||||
FROM
|
||||
activity_school school
|
||||
LEFT JOIN activity_basic_settings ba ON ba.`code` = school.activityLevel
|
||||
$condition
|
||||
""").setParam("userid", SecurityUtil.getUserId()).setParam("unionId", getUnionId());
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("school.close", "!=", true);
|
||||
|
||||
cnd.and("school.isSave", "!=", true);
|
||||
|
||||
//查询报名中
|
||||
if (isActivity == 2) {
|
||||
cnd.and(new Static("now() >applyStartTime and now() < applyEndTime"));
|
||||
}//查询已结束的
|
||||
else if (isActivity == 3) {
|
||||
cnd.and(new Static("now() > school.applyEndTime"));
|
||||
}
|
||||
|
||||
|
||||
if (Lang.isNotEmpty(applyStatus) && applyStatus == 1) {
|
||||
//查询未报名
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_school_apply WHERE activityId=school.id AND userId='%s') = 0".formatted(SecurityUtil.getUserId())));
|
||||
} else if (Lang.isNotEmpty(applyStatus) && applyStatus == 2) {
|
||||
//查询已报名
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_school_apply WHERE activityId=school.id AND userId='%s')>0".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(),
|
||||
RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
// cnd.and(new Static("JSON_CONTAINS(school.applyWay,JSON_ARRAY( 1))>0"));
|
||||
cnd.and(new Static("(SELECT COUNT(1) FROM activity_user_scope WHERE groupId=school.activityGroupId AND userId='%s') >0".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
cnd.and("YEAR(school.applyStartTime)", "=", year);
|
||||
cnd.desc("school.applyStartTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getEvents(String activityId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
act.*,
|
||||
ev.id evId,
|
||||
ev.competitionCategory,
|
||||
ev.distance,
|
||||
ev.sports,
|
||||
ev.projectType,
|
||||
ev.whetherEnable,
|
||||
ev.note,
|
||||
ev.allName,
|
||||
ev.isMenWomen,
|
||||
ev.isInterest
|
||||
FROM
|
||||
activity_school_event act
|
||||
LEFT JOIN activity_event ev ON act.eventId = ev.id $condition
|
||||
""");
|
||||
cnd.and("activityId", "=", activityId);
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUnionCoachLeaderHead(String activityId, String unionId) {
|
||||
if (StrUtil.isBlank(unionId)) {
|
||||
unionId = getUnionId();
|
||||
}
|
||||
Map result = new HashMap();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT apply.*,us.unitname FROM activity_school_apply apply LEFT JOIN `vw_user` us ON us.id=apply.userId WHERE apply.activityId=@activityId and apply.activityUnionId=@activityUnionId
|
||||
""");
|
||||
sql.setParam("activityUnionId", unionId);
|
||||
sql.setParam("activityId", activityId);
|
||||
List<NutMap> list = listMap(sql);
|
||||
NutMap unionCoach = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionCoach");
|
||||
}).findFirst().orElse(null);
|
||||
NutMap unionLeader = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionLeader");
|
||||
}).findFirst().orElse(null);
|
||||
NutMap unionHead = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionHead");
|
||||
}).findFirst().orElse(null);
|
||||
NutMap unionStaff = list.stream().filter(v -> {
|
||||
return v.getBoolean("unionStaff");
|
||||
}).findFirst().orElse(null);
|
||||
result.put("unionCoach", unionCoach);
|
||||
result.put("unionLeader", unionLeader);
|
||||
result.put("unionHead", unionHead);
|
||||
result.put("unionStaff", unionStaff);
|
||||
|
||||
List userOptions = List.of();
|
||||
|
||||
ArrayList arrayList = new ArrayList<>(userOptions);
|
||||
|
||||
if (unionCoach != null) {
|
||||
arrayList.add(dao().fetch(Sys_user.class, unionCoach.getString("userId")));
|
||||
}
|
||||
|
||||
if (unionLeader != null) {
|
||||
arrayList.add(dao().fetch(Sys_user.class, unionLeader.getString("userId")));
|
||||
}
|
||||
if (unionHead != null) {
|
||||
arrayList.add(dao().fetch(Sys_user.class, unionHead.getString("userId")));
|
||||
}
|
||||
if (unionStaff != null) {
|
||||
arrayList.add(dao().fetch(Sys_user.class, unionStaff.getString("userId")));
|
||||
}
|
||||
|
||||
|
||||
result.put("userOptions", arrayList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUniteApplyInfo(ActivitySportsApplyUserPageParam applyUserPageParam, Integer isMenWomen) {
|
||||
Map result = new HashMap();
|
||||
ActivitySchool activity = dao().fetch(ActivitySchool.class, applyUserPageParam.getActivityId());
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.unitid,
|
||||
u.unionId,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.mobile,
|
||||
un.`name` unitname
|
||||
FROM
|
||||
vw_user u
|
||||
LEFT JOIN activity_basic_unit un ON u.unitid = un.id
|
||||
LEFT JOIN activity_basic_union uni ON un.unionid=uni.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and(new Static("u.id not in (SELECT IFNULL(app.userId,'') from activity_school_apply app WHERE app.activityId = '" + applyUserPageParam.getActivityId() + "' AND app.eventId='" + applyUserPageParam.getEventId() + "')"));
|
||||
cnd.and(new Static("u.id IN (SELECT userId FROM activity_user_scope aus WHERE aus.groupId='" + activity.getActivityGroupId() + "')"));
|
||||
cnd.and("un.unionid", "=", StrUtil.isNotBlank(applyUserPageParam.getUnionId()) ? applyUserPageParam.getUnionId() : getUnionId());
|
||||
if (isMenWomen != null && isMenWomen == 1)
|
||||
cnd.and("u.sex", "=", "男");
|
||||
if (isMenWomen != null && isMenWomen == 2)
|
||||
cnd.and("u.sex", "=", "女");
|
||||
if (Strings.isNotBlank(applyUserPageParam.getStartAgeDate())) {
|
||||
cnd.and("u.birthday", ">", applyUserPageParam.getStartAgeDate());
|
||||
cnd.and("u.birthday", "<=", applyUserPageParam.getEndAgeDate());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> userList = listMap(sql);
|
||||
userList.forEach(v -> {
|
||||
if (Strings.isNotBlank(v.getString("birthday"))) {
|
||||
v.setv("birthday", v.getString("birthday").substring(0, 10));
|
||||
v.setv("age", cn.hutool.core.date.DateUtil.ageOfNow(v.getString("birthday")));
|
||||
} else {
|
||||
v.setv("birthday", null);
|
||||
v.setv("age", 0);
|
||||
}
|
||||
});
|
||||
result.put("users", userList);
|
||||
|
||||
Sql applySql = Sqls.create("""
|
||||
SELECT
|
||||
asa.*
|
||||
FROM
|
||||
activity_school_apply asa
|
||||
LEFT JOIN activity_school_team team ON asa.teamId = team.id
|
||||
LEFT JOIN sys_unit unit ON asa.unitId = unit.id
|
||||
WHERE
|
||||
asa.eventId = @eventId
|
||||
AND asa.activityId=@activityId
|
||||
AND asa.activityUnionId = @unionid
|
||||
AND asa.`status` != 3
|
||||
ORDER BY
|
||||
asa.identity DESC,
|
||||
asa.sex
|
||||
""").setParam("eventId", applyUserPageParam.getEventId())
|
||||
.setParam("unionid", applyUserPageParam.getUnionId())
|
||||
.setParam("activityId", applyUserPageParam.getActivityId());
|
||||
List<ActivitySchoolApply> list = listEntity(applySql);
|
||||
//团体人数
|
||||
List<ActivitySchoolApply> awardsModeT = list.stream().filter(v -> v.getAwardsMode().equals("2")).collect(Collectors.toList());
|
||||
//单项人数
|
||||
List<ActivitySchoolApply> awardsModeG = list.stream().filter(v -> v.getAwardsMode().equals("1")).collect(Collectors.toList());
|
||||
|
||||
list.forEach(v -> {
|
||||
if (Strings.isNotBlank(v.getBirthday())) {
|
||||
v.setAge(cn.hutool.core.date.DateUtil.ageOfNow(v.getBirthday()));
|
||||
}
|
||||
});
|
||||
|
||||
result.put("list", list);
|
||||
result.put("awardsModeT", awardsModeT);
|
||||
result.put("awardsModeG", awardsModeG);
|
||||
|
||||
result.put("team", dao().query(ActivitySchoolTeam.class,
|
||||
Cnd.where("eventId", "=", applyUserPageParam.getEventId())
|
||||
.and("activityId", "=", applyUserPageParam.getActivityId()).asc("location")));
|
||||
|
||||
result.put("activity", activity);
|
||||
List<NutMap> events = getEvents(applyUserPageParam.getActivityId());
|
||||
NutMap eve = events.stream().filter(v -> v.getString("id").equals(applyUserPageParam.getSchoolEventId())).findFirst().orElse(null);
|
||||
result.put("getEvent", eve);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doApplyUser(ActivitySchoolApply[] userList, String eventId, String activityId, Boolean pass, String unionId) {
|
||||
|
||||
ActivityBasicUnit basicUnit = dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", SecurityUtil.getUnitId()));
|
||||
ActivityBasicUnion basicUnion = dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", StrUtil.isNotBlank(unionId) ? unionId : basicUnit.getUnionId()));
|
||||
|
||||
|
||||
for (ActivitySchoolApply apply : userList) {
|
||||
apply.setApplyUser(SecurityUtil.getUserId());
|
||||
apply.setStatus(pass ? 2 : 0);
|
||||
apply.setApplyDate(DateUtil.now());
|
||||
apply.setActivityUnionId(basicUnion.getId());
|
||||
apply.setActivityUnionName(basicUnion.getName());
|
||||
}
|
||||
|
||||
|
||||
if (Lang.isNotEmpty(userList)) {
|
||||
clear(Cnd.where("activityId", "=", activityId).and("activityUnionId", "=", basicUnion.getId()).and("eventId", "=", eventId));
|
||||
insert(userList);
|
||||
} else {
|
||||
clear(Cnd.where("activityId", "=", activityId)
|
||||
.and("activityUnionId", "=", basicUnion.getId())
|
||||
.and("eventId", "=", eventId));
|
||||
}
|
||||
if (pass) {
|
||||
dao().update(ActivitySchoolApply.class,
|
||||
Chain.make("status", 2),
|
||||
Cnd.where("activityId", "=", activityId)
|
||||
.and("activityUnionId", "=", basicUnion.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination applyPageData(PageForm page, String activityId, String eventId, String unionId) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isBlank(unionId)) {
|
||||
unionId = getUnionId();
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
apply.*,team.`name`,acts.name actsname,ev.allName
|
||||
FROM
|
||||
Activity_School_Apply apply LEFT JOIN activity_school_team team ON apply.teamId=team.id
|
||||
LEFT JOIN activity_school acts ON acts.id=apply.activityId
|
||||
LEFT JOIN activity_event ev ON ev.id = apply.eventId $condition
|
||||
""");
|
||||
cnd.and("apply.activityUnionId", "=", unionId);
|
||||
cnd.and("apply.activityId", "=", activityId);
|
||||
cnd.and("apply.eventId", "=", eventId);
|
||||
cnd.asc("team.`name`");
|
||||
cnd.desc("apply.identity");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doLeaderCoach(ActivitySchoolApply[] data, String activityId, String unionId) {
|
||||
if (StrUtil.isBlank(unionId)) {
|
||||
unionId = getUnionId();
|
||||
}
|
||||
dao().clear(ActivitySchoolApply.class,
|
||||
Cnd.where("activityId", "=", activityId)
|
||||
.and("activityUnionId", "=", unionId)
|
||||
.and(Cnd.exps("unionLeader", "=", 1).or("unionCoach", "=", 1)));
|
||||
for (ActivitySchoolApply apply : data) {
|
||||
ActivityBasicUnit basicUnit = dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", apply.getUnitId()));
|
||||
ActivityBasicUnion basicUnion = dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionId()));
|
||||
apply.setApplyUser(SecurityUtil.getUserId());
|
||||
apply.setApplyDate(DateUtil.now());
|
||||
apply.setUnitname(basicUnit.getName());
|
||||
apply.setActivityUnionId(basicUnion.getId());
|
||||
apply.setActivityUnionName(basicUnion.getName());
|
||||
}
|
||||
insert(data);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getUserUnion(String query) {
|
||||
String union_id = getUnionId();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.mobile,
|
||||
u.sex,
|
||||
un.unionid unionId,
|
||||
un.id unitId
|
||||
FROM
|
||||
`vw_user` u
|
||||
LEFT JOIN activity_basic_unit un ON u.unitid = un.id
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
|
||||
if (Strings.isNotBlank(query)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("u.username", query);
|
||||
group.orLike("u.loginname", query);
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.and("un.unionid", "=", union_id);
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
+276
@@ -0,0 +1,276 @@
|
||||
package com.budwk.app.zhgh.activity.sports.service.impl;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.DateUtil;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnit;
|
||||
import com.budwk.app.zhgh.activity.culture.models.ActivityTissue;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolApply;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolEvent;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolTeam;
|
||||
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
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.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2021-02-22 15:50
|
||||
* @description: 活动信息管理 service
|
||||
**/
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ActivitySportsServiceImpl extends BaseServiceImpl<ActivitySchool> implements ActivitySportsService {
|
||||
|
||||
public ActivitySportsServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public String doAdd(ActivitySchool activitySchool, ActivitySchoolEvent[] events) {
|
||||
ActivityBasicUnit activityBasicUnit = dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
|
||||
if (activitySchool.getActivityLevel() == 40002) {
|
||||
activitySchool.setBelongUnionId(activityBasicUnit.getUnionId());
|
||||
}
|
||||
activitySchool.setFoundDate(DateUtil.getDate());
|
||||
activitySchool.setClose(false);
|
||||
ActivitySchool school = insert(activitySchool);
|
||||
addTeam(school.getId(), events);
|
||||
|
||||
ActivityTissue activityTissue = new ActivityTissue();
|
||||
activityTissue.setApplyTime(DateUtil.getDate());
|
||||
activityTissue.setActivity_type(activitySchool.getActivityLevel());
|
||||
activityTissue.setProjectTypeCode("50004");
|
||||
activityTissue.setActivityCode(activitySchool.getActivityCode());
|
||||
activityTissue.setName(activitySchool.getName());
|
||||
activityTissue.setUserId(SecurityUtil.getUserId());
|
||||
if (activitySchool.getActivityLevel() == 40002) {
|
||||
activitySchool.setBelongUnionId(activityBasicUnit.getUnionId());
|
||||
}
|
||||
activityTissue.setState(3);
|
||||
activityTissue.setClubId(activitySchool.getBelongClubId());
|
||||
activityTissue.setAddress(activitySchool.getAddress());
|
||||
activityTissue.setApplyStartTime(activitySchool.getApplyStartTime());
|
||||
activityTissue.setApplyEndTime(activitySchool.getApplyEndTime());
|
||||
activityTissue.setStartTime(activitySchool.getStartTime());
|
||||
activityTissue.setEndTime(activitySchool.getEndTime());
|
||||
activityTissue.setCover(activitySchool.getImage());
|
||||
|
||||
dao().insert(activityTissue);
|
||||
dao().update(ActivityTissue.class, Chain.make("id", activitySchool.getId()), Cnd.where("id", "=", activityTissue.getId()));
|
||||
|
||||
dao().clear(ActivitySchoolEvent.class, Cnd.where("eventId", "=", "allItems"));
|
||||
dao().clear(ActivitySchoolEvent.class, Cnd.where("eventId", "IS", null));
|
||||
|
||||
Sys_home_activity sysHomeActivity = activitySchool.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
return school.getId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doEdit(ActivitySchool activitySchool, ActivitySchoolEvent[] events) {
|
||||
ActivitySchool school = dao().fetch(ActivitySchool.class, activitySchool.getId());
|
||||
if (school.getActivityLevel() == 40002) {
|
||||
school.setBelongUnionId(SecurityUtil.getUnionId());
|
||||
}
|
||||
update(activitySchool);
|
||||
List<ActivitySchoolEvent> query = dao().query(ActivitySchoolEvent.class, Cnd.where("activityId", "=", activitySchool.getId()));
|
||||
|
||||
|
||||
List<ActivitySchoolEvent> collect = query.stream().filter(v -> {
|
||||
return !activitySchool.getEventsIds().contains(v.getEventId());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<ActivitySchoolEvent> collect1 = Lang.array2list(events).stream().filter(v -> {
|
||||
return !query.stream().map(x -> x.getEventId()).collect(Collectors.toList()).contains(v.getEventId()) && (v.getId() == null || !v.getId().equals("allItems"));
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
if (collect.size() > 0) {
|
||||
collect.forEach(v -> {
|
||||
dao().clear(ActivitySchoolApply.class,Cnd.where("activityId", "=", activitySchool.getId()).and("eventId", "=", v.getEventId()));
|
||||
dao().clear(ActivitySchoolEvent.class, Cnd.where("activityId", "=", activitySchool.getId()).and("eventId", "=", v.getEventId()));
|
||||
dao().clear(ActivitySchoolTeam.class, Cnd.where("activityId", "=", activitySchool.getId()).and("eventId", "=", v.getEventId()));
|
||||
});
|
||||
}
|
||||
if (collect1.size() > 0) {
|
||||
addTeam(activitySchool.getId(), collect1.toArray(new ActivitySchoolEvent[collect1.size()]));
|
||||
}
|
||||
for (ActivitySchoolEvent event : events) {
|
||||
update(event);
|
||||
}
|
||||
dao().delete(ActivityTissue.class, activitySchool.getId());
|
||||
ActivityTissue activityTissue = new ActivityTissue();
|
||||
activityTissue.setApplyTime(DateUtil.getDate());
|
||||
activityTissue.setActivity_type(activitySchool.getActivityLevel());
|
||||
activityTissue.setProjectTypeCode("50004");
|
||||
activityTissue.setActivityCode(activitySchool.getActivityCode());
|
||||
activityTissue.setName(activitySchool.getName());
|
||||
activityTissue.setUserId(SecurityUtil.getUserId());
|
||||
if (activitySchool.getActivityLevel() == 40002) {
|
||||
activitySchool.setBelongUnionId(SecurityUtil.getUnionId());
|
||||
}
|
||||
activityTissue.setState(3);
|
||||
activityTissue.setClubId(activitySchool.getBelongClubId());
|
||||
activityTissue.setAddress(activitySchool.getAddress());
|
||||
activityTissue.setApplyStartTime(activitySchool.getApplyStartTime());
|
||||
activityTissue.setApplyEndTime(activitySchool.getApplyEndTime());
|
||||
activityTissue.setStartTime(activitySchool.getStartTime());
|
||||
activityTissue.setEndTime(activitySchool.getEndTime());
|
||||
activityTissue.setCover(activitySchool.getImage());
|
||||
|
||||
dao().insert(activityTissue);
|
||||
dao().update(ActivityTissue.class, Chain.make("id", activitySchool.getId()), Cnd.where("id", "=", activityTissue.getId()));
|
||||
|
||||
|
||||
dao().clear(ActivitySchoolEvent.class, Cnd.where("eventId", "=", "allItems"));
|
||||
dao().clear(ActivitySchoolEvent.class, Cnd.where("eventId", "IS", null));
|
||||
Sys_home_activity sysHomeActivity = activitySchool.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
private void addTeam(String schoolId, ActivitySchoolEvent[] events) {
|
||||
if (events.length > 0) {
|
||||
Arrays.stream(events).forEach(v -> {
|
||||
v.setActivityId(schoolId);
|
||||
dao().insert(v);
|
||||
Integer totalTeam = v.getRestrictTotalTeam();
|
||||
if (totalTeam != null && totalTeam > 0) {
|
||||
for (int i = 1; i <= totalTeam; i++) {
|
||||
ActivitySchoolTeam team = new ActivitySchoolTeam();
|
||||
team.setActivityId(schoolId);
|
||||
team.setEventId(v.getEventId());
|
||||
team.setName(String.format("第%d队", i));
|
||||
team.setMinNum(v.getRestrictMinNum());
|
||||
team.setMaxNum(v.getRestrictMaxNum());
|
||||
dao().insert(team);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doDelete(String id) {
|
||||
dao().clear(ActivitySchoolApply.class,Cnd.where("activityId", "=", id));
|
||||
dao().clear(ActivitySchoolEvent.class, Cnd.where("activityId", "=", id));
|
||||
dao().clear(ActivitySchoolTeam.class, Cnd.where("activityId", "=", id));
|
||||
this.delete(id);
|
||||
dao().delete(Sys_home_activity.class, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportXlsx(String id, String unionId, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
app.username,
|
||||
app.loginname,
|
||||
app.identity,
|
||||
app.activityUnionName unionname,
|
||||
app.sex,
|
||||
app.mobile,
|
||||
u.idCard,
|
||||
u.userState,
|
||||
ev.allName,
|
||||
sc.`name` activityName,
|
||||
app.`team` team
|
||||
FROM
|
||||
`activity_school_apply` app
|
||||
LEFT JOIN `vw_user` u ON u.id = app.userId
|
||||
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
||||
LEFT JOIN activity_school sc ON sc.id=app.activityId
|
||||
WHERE
|
||||
app.activityId = @id
|
||||
and app.status = 2
|
||||
$cnd
|
||||
ORDER BY
|
||||
ev.allName DESC,
|
||||
u.unionname DESC,
|
||||
app.`team` asc
|
||||
""").setParam("id", id);
|
||||
if (Strings.isNotBlank(unionId)) {
|
||||
sql.setVar("cnd", "and u.unionid='" + unionId + "'");
|
||||
}
|
||||
List<Record> list = list(sql);
|
||||
String activityName;
|
||||
if (Lang.isNotEmpty(list)) {
|
||||
activityName = list.get(0).getString("activityName");
|
||||
} else {
|
||||
activityName = "暂无人员";
|
||||
}
|
||||
|
||||
List<ActivitySchoolApply> excels = new ArrayList<>();
|
||||
|
||||
list.forEach(z -> {
|
||||
ActivitySchoolApply schoolApply = z.toPojo(ActivitySchoolApply.class);
|
||||
String s = schoolApply.getIdentity().stream().map(personType::getName).toList().toString();
|
||||
schoolApply.setSf(s);
|
||||
excels.add(schoolApply);
|
||||
});
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ActivitySchoolApply.class, excels);
|
||||
CommonDownloadUtil.download("报名表.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class personType {
|
||||
|
||||
private static String getName(String v) {
|
||||
switch (v) {
|
||||
case "1":
|
||||
return "运动员";
|
||||
case "2":
|
||||
return "教练";
|
||||
case "3":
|
||||
return "领队";
|
||||
case "4":
|
||||
return "处级领导";
|
||||
case "5":
|
||||
return "替补";
|
||||
case "6":
|
||||
return "团长";
|
||||
case "7":
|
||||
return "工作人员";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.constant;
|
||||
|
||||
import com.budwk.app.base.annotation.DictEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/11/18
|
||||
* @Description
|
||||
*/
|
||||
@Getter
|
||||
@DictEnum(key = "ColumnFormTypeEnum", name = "控件类型")
|
||||
@AllArgsConstructor
|
||||
public enum ColumnFormTypeEnum {
|
||||
|
||||
INPUT("INPUT", "输入框"),
|
||||
SELECT("SELECT", "选择框"),//选项数组,
|
||||
//RADIO("RADIO", "单选框"),//选项数组
|
||||
FILE("FILE", "文件");//上传个数,格式
|
||||
|
||||
private String code;
|
||||
private String description;
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
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.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 新建活动
|
||||
* @createTime 2022年03月07日 10:16:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@At("/platform/trainSingUp/manage/activity")
|
||||
public class TrainSignUpActivityAddController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/add")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/add/index.html")
|
||||
public void add() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@POST
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
public Result doHandle(@Param(value = "data") String data) {
|
||||
TrainSignUpActivity activity = Json.fromJson(TrainSignUpActivity.class, data);
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
trainSignUpActivityManageService.add(activity, null);
|
||||
} else {
|
||||
trainSignUpActivityManageService.edit(activity);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
public Result getUnionLimit(@Param(value = "activityScopeId") String activityScopeId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.id,
|
||||
gh.name,
|
||||
gh.unioncode,
|
||||
(select count(1) from `vw_user` where unionid = gh.id $cnd) as teacherCount,
|
||||
NULL as ratio,
|
||||
NULL as limitCount
|
||||
FROM
|
||||
sys_union gh
|
||||
order by gh.unioncode
|
||||
""");
|
||||
if (StrUtil.isNotBlank(activityScopeId)) {
|
||||
sql.setVar("cnd", "AND id in (select userId from activity_user_scope where groupId = '" + activityScopeId + "')");
|
||||
}
|
||||
List<NutMap> list = trainSignUpActivityManageService.listMap(sql);
|
||||
return Result.success().addData(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
public Result getRegisterUserCount(@Param(value = "courseId") String courseId) {
|
||||
//已报人数
|
||||
return Result.success().addData(dao.count(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId)));
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.add")
|
||||
public Result getHistoricalActList() {
|
||||
List<TrainSignUpActivity> query = dao.query(TrainSignUpActivity.class, Cnd.NEW().desc("activityStartTime"));
|
||||
return Result.success().addData(query);
|
||||
}
|
||||
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
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.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivityCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
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;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/trainSingUp/manage/apply")
|
||||
public class TrainSignUpActivityApplyController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityService;
|
||||
|
||||
@Inject
|
||||
private SysDictService dictService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/apply/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result activityData(@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("`year`", "=", year);
|
||||
//查询报名中
|
||||
if (activityType == 2) {
|
||||
cnd.and(new Static("now() > activitySignUpStartTime and now() < activitySignUpEndTime"));
|
||||
}//查询已结束的
|
||||
else if (activityType == 3) {
|
||||
cnd.and(new Static("now() > activityEndTime"));
|
||||
}
|
||||
|
||||
if(AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
|
||||
cnd.and("activityMode", "=", 2).and("createdBy", "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
List<TrainSignUpActivity> trainSignUpActivities = trainSignUpActivityService.query(cnd);
|
||||
Map<String, String> trainSignUpTypeMap = dictService.getSubListByCode("TRAIN_SIGNUP_TYPE").stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
trainSignUpActivities.forEach(v->v.setTrainType(trainSignUpTypeMap.get(v.getTrainType())));
|
||||
return Result.success(trainSignUpActivities);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "courseTypeId") String courseTypeId,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.activityId,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocationCoordinates,
|
||||
tsuc.courseReservedNumber,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.campus,
|
||||
tsuc.unionLimit,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.signType,
|
||||
tsuc.isReceiveGift,
|
||||
tsuc.giftType,
|
||||
tsuc.reserveMode,
|
||||
type.lxname
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
LEFT JOIN train_sign_up_type type ON type.id = tsuc.courseType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("type.id","=",courseTypeId);
|
||||
cnd.and("tsuc.activityId","=",activityId);
|
||||
cnd.asc("type.code");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = trainSignUpActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, c.getString("courseType"));
|
||||
// trainSignUpActivityService.dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
//已报人数
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = trainSignUpActivityService.dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getString("id")));
|
||||
signUpUsers.forEach(item -> {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().ifPresent(nutMap -> hasRegisterNum.addAndGet(nutMap.getInt("columnValue")));
|
||||
}
|
||||
}
|
||||
});
|
||||
c.put("hasRegisterNum",hasRegisterNum.get());
|
||||
//当前用户是否报过
|
||||
c.put("isSign",trainSignUpActivityService.isSignCourseByUser(c.getString("id"), SecurityUtil.getUserId()));
|
||||
});
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.apply")
|
||||
public Result getCourseTime(String id){
|
||||
List<TrainSignUpActivityCourse> list = trainSignUpActivityService.dao().query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", id));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
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 org.nutz.trans.Trans;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名 活动管理
|
||||
* @createTime 2022年02月23日 09:57:00
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/trainSingUp/manage/activity")
|
||||
public class TrainSignUpActivityController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/manage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityName") String activityName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
cnd.and(Cnd.likeEX("activityName", activityName));
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return Result.success().addData(trainSignUpActivityManageService.pageData(pageForm, cnd));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result doDelete(String id) {
|
||||
Trans.exec(() -> {
|
||||
trainSignUpActivityManageService.delete(id);
|
||||
dao.clear(TrainSignUpCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(TrainSignUpUser.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(TrainSignUpUserCourse.class, Cnd.where("activityId", "=", id));
|
||||
dao.clear(TrainSignUpActivity.class, Cnd.where("id", "=", id));
|
||||
dao.clear(TrainSignUpTypeLimit.class, Cnd.where("activityId", "=", id));
|
||||
dao.delete(Sys_home_activity.class, id);
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result doHandle(@Param("data") String data) {
|
||||
TrainSignUpActivity activity = Json.fromJson(TrainSignUpActivity.class, data);
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
trainSignUpActivityManageService.add(activity, null);
|
||||
} else {
|
||||
trainSignUpActivityManageService.edit(activity);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result activityStatusChange(TrainSignUpActivity activity) {
|
||||
trainSignUpActivityManageService.updateActivityStatus(activity);
|
||||
dao.update(Sys_home_activity.class,
|
||||
Chain.make("enable", !activity.isDisabled()),
|
||||
Cnd.where("id", "=", activity.getId()));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity")
|
||||
public Result findOne(@Param("id") @NotNull String id) {
|
||||
NutMap dataMap = trainSignUpActivityManageService.findOne(id, null, "");
|
||||
String activityStartTime = dataMap.getString("activityStartTime");
|
||||
String activityEndTime = dataMap.getString("activityEndTime");
|
||||
if(StrUtil.isNotBlank(activityStartTime) && StrUtil.isNotBlank(activityEndTime)) {
|
||||
dataMap.put("activityTime", List.of(activityStartTime, activityEndTime));
|
||||
} else {
|
||||
dataMap.put("activityTime", new ArrayList<>());
|
||||
}
|
||||
|
||||
String activitySignUpStartTime = dataMap.getString("activitySignUpStartTime");
|
||||
String activitySignUpEndTime = dataMap.getString("activitySignUpEndTime");
|
||||
if(StrUtil.isNotBlank(activitySignUpStartTime) && StrUtil.isNotBlank(activitySignUpEndTime)) {
|
||||
dataMap.put("activitySignTime", List.of(activitySignUpStartTime, activitySignUpEndTime));
|
||||
} else {
|
||||
dataMap.put("activitySignTime", new ArrayList<>());
|
||||
}
|
||||
|
||||
List<NutMap> courseList = dataMap.getList("courseList", NutMap.class);
|
||||
|
||||
//查询所有的课程类型
|
||||
List<TrainSignUpType> trainSignUpTypeList = dao.query(TrainSignUpType.class, Cnd.NEW());
|
||||
Map<String, String> typeMap = trainSignUpTypeList.stream().collect(Collectors.toMap(TrainSignUpType::getId, TrainSignUpType::getLxname));
|
||||
|
||||
courseList.forEach(v -> {
|
||||
|
||||
List<NutMap> courseTimeList = v.getList("courseTimeList", NutMap.class);
|
||||
//选择课程日期 下拉框
|
||||
List<String> setUpCourseData = courseTimeList.stream().map(cd -> cd.getString("courseDate")).distinct().collect(Collectors.toList());
|
||||
v.put("setUpCourseData", setUpCourseData);
|
||||
|
||||
courseTimeList.forEach(ct -> {
|
||||
String courseStartTime = DateUtil.format(ct.getTime("courseStartTime"), "HH:mm");
|
||||
String courseEndTime = DateUtil.format(ct.getTime("courseEndTime"), "HH:mm");
|
||||
ct.put("courseStartTime", courseStartTime);
|
||||
ct.put("courseEndTime", courseEndTime);
|
||||
});
|
||||
|
||||
v.put("courseTypeName", typeMap.get(v.getString("courseType")));
|
||||
});
|
||||
|
||||
return Result.success().addData(dataMap);
|
||||
}
|
||||
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
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.json.Json;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/22
|
||||
* @Description
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/trainSingUp/manage/type")
|
||||
public class TrainSignUpTypeController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/type/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "lxname") String lxname) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select * from train_sign_up_type $condition
|
||||
""");
|
||||
if (Strings.isNotBlank(lxname)) {
|
||||
cnd.and("lxname", "like", "%" + lxname + "%");
|
||||
}
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.asc("xh");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.stream().forEach(item -> {
|
||||
Cnd c = Cnd.NEW();
|
||||
c.and("typeId", "=", item.getString("id"));
|
||||
c.asc("columnIndex");
|
||||
List<TrainMobileSignColumn> signColumns = dao.query(TrainMobileSignColumn.class, c);
|
||||
item.put("trainMobileSignColumnList", signColumns);
|
||||
|
||||
});
|
||||
return Result.success().addData(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Result doAdd(@Param("data") String data) throws Exception {
|
||||
TrainSignUpType type = Json.fromJson(TrainSignUpType.class, data);
|
||||
int count = dao.count(TrainSignUpType.class, Cnd.where("code", "=", type.getCode()));
|
||||
if (count > 0) {
|
||||
return Result.error("编码重复!");
|
||||
}
|
||||
int totalCount = dao.count(TrainSignUpType.class);
|
||||
type.setXh(totalCount + 1);
|
||||
dao.insertWith(type, "trainMobileSignColumnList");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Result doEdit(TrainSignUpType type) {
|
||||
int count = dao.count(TrainSignUpType.class, Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId()));
|
||||
if (count > 0) {
|
||||
return Result.error("编码重复!");
|
||||
}
|
||||
dao.update(type);
|
||||
dao.clear(TrainMobileSignColumn.class, Cnd.where("typeId", "=", type.getId()));
|
||||
dao.insertLinks(type, "trainMobileSignColumnList");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Object doDelete(@Param(value = "id") String id) {
|
||||
dao.clear(TrainSignUpType.class, Cnd.where("id", "=", id));
|
||||
dao.clear(TrainMobileSignColumn.class, Cnd.where("typeId", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Object xhChange(String id, Integer xh, boolean toDown) {
|
||||
if (toDown) {
|
||||
TrainSignUpType next = dao.fetch(TrainSignUpType.class, Cnd.where("xh", "=", xh + 1));
|
||||
next.setXh(next.getXh() - 1);
|
||||
dao.update(next);
|
||||
dao.update(TrainSignUpType.class, Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
|
||||
} else {
|
||||
TrainSignUpType pre = dao.fetch(TrainSignUpType.class, Cnd.where("xh", "=", xh - 1));
|
||||
pre.setXh(pre.getXh() + 1);
|
||||
dao.update(pre);
|
||||
dao.update(TrainSignUpType.class, Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
public Result getAllType(@Param(value = "id") String id) {
|
||||
List<TrainSignUpType> trainSignUpTypeList = dao.query(TrainSignUpType.class, Cnd.NEW().andEX("id", "=", id).asc("xh"));
|
||||
dao.fetchLinks(trainSignUpTypeList, "trainMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
|
||||
return Result.success().addData(trainSignUpTypeList);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.type")
|
||||
public Result getColumnType() {
|
||||
List<String> names = EnumUtil.getNames(ColType.class);
|
||||
names.add("JSON");
|
||||
return Result.success(names);
|
||||
}
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivityCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUserCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
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 org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/21
|
||||
* @Description 人员调整
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/trainSingUp/manage/userAdjust")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class TrainSignUpUserAdjustController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityStatisticsService trainSignUpActivityStatisticsService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/userAdjust/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动list
|
||||
*
|
||||
* @param year 年度
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<TrainSignUpActivity> activityList = dao.query(TrainSignUpActivity.class, Cnd.NEW().andEX("year", "=", year).andEX("isDisabled", "=", false).desc("activityStartTime"));
|
||||
return Result.success(activityList);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = trainSignUpActivityStatisticsService.pageData(pageForm, activityId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result getCourse(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseType,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.courseReservedNumber,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user WHERE courseId = tsuc.id ) registerNum
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
WHERE
|
||||
tsuc.activityId = @activityId
|
||||
ORDER BY courseName asc
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
return Result.success(baseService.listMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班报名人员list
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result registerUserList(@Param("courseId") String courseId,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "unitId") String unitId,
|
||||
@Param(value = "searchName") String searchName,
|
||||
@Param(value = "searchKeyword") String searchKeyword) {
|
||||
List<NutMap> list = trainSignUpActivityStatisticsService.registerUserList(courseId, unionId, unitId, searchName, searchKeyword);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result adjust(String activityId, String oldCourseId, String newCourseId, String userId) {
|
||||
|
||||
Cnd oldCnd = Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", oldCourseId).and("userId", "=", userId);
|
||||
|
||||
Cnd newCnd = Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", newCourseId).and("userId", "=", userId);
|
||||
|
||||
//旧的报名信息
|
||||
TrainSignUpUser oldTrainSignUpUser = dao.fetch(TrainSignUpUser.class, oldCnd);
|
||||
oldTrainSignUpUser.setCourseId(newCourseId);
|
||||
oldTrainSignUpUser.setSignUpTime(DateUtil.date());
|
||||
dao.update(oldTrainSignUpUser);
|
||||
|
||||
//新的课程的信息,上课时间
|
||||
List<TrainSignUpActivityCourse> activityCourseList = dao.query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", newCourseId));
|
||||
//先清楚旧的信息
|
||||
dao.clear(TrainSignUpUserCourse.class, oldCnd);
|
||||
//添加新的信息
|
||||
List<TrainSignUpUserCourse> trainSignUpUserCourseList = new ArrayList<>();
|
||||
activityCourseList.forEach(item -> {
|
||||
TrainSignUpUserCourse course = new TrainSignUpUserCourse();
|
||||
course.setActivityCourseId(activityId);
|
||||
course.setCourseId(newCourseId);
|
||||
course.setUserId(userId);
|
||||
course.setCourseStartTime(item.getCourseStartTime());
|
||||
course.setCourseEndTime(item.getCourseEndTime());
|
||||
course.setActivityCourseId(item.getId());
|
||||
trainSignUpUserCourseList.add(course);
|
||||
});
|
||||
dao.insert(trainSignUpUserCourseList);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.manage.activity.adjust")
|
||||
public Result deleteSignUser(String activityId, String courseId, String userId) {
|
||||
|
||||
//删除
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("activityId", "=", activityId);
|
||||
cnd.and("courseId", "=", courseId);
|
||||
cnd.and("userId", "=", userId);
|
||||
|
||||
dao.clear(TrainSignUpUser.class, cnd);
|
||||
dao.clear(TrainSignUpUserCourse.class, cnd);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+334
@@ -0,0 +1,334 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.manage;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.base.utils.PageUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpBlackListService;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 人员管理
|
||||
* @createTime 2022年03月07日 14:27:00
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/trainSingUp/userManage")
|
||||
public class TrainSignUpUserBlackListManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpBlackListService trainSignUpBlackListService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/userManage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId,
|
||||
@Param(value = "courseId") String courseId,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "userKeyWord") String userKeyWord) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.activityId", "=", activityId);
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
cnd.andEX("act.year", "=", year);
|
||||
if (StrUtil.isNotBlank(userKeyWord)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
cnd.and(seg.andLike("u.username", userKeyWord).orLike("u.loginname", userKeyWord));
|
||||
}
|
||||
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
|
||||
Pagination pagination = trainSignUpBlackListService.pageData(pageForm, cnd, activityId, courseId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result doHandleUser(@Param("userId") String userId) {
|
||||
trainSignUpBlackListService.doHandleUser(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result getCourseByActivityId(@Param("activityId") String activityId) {
|
||||
List<TrainSignUpCourse> list = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result attendClassRecord(String userId) {
|
||||
trainSignUpBlackListService.attendClassRecord(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result getReserveUser(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.* ,
|
||||
(select signUpTime from train_sign_up_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
|
||||
(select state from train_sign_up_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.unitName,
|
||||
u.unionName
|
||||
FROM
|
||||
train_sign_up_user_course uc LEFT JOIN `vw_user` u on uc.userId = u.id
|
||||
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 2 order by signUpTime desc
|
||||
""").setParam("courseId", courseId);
|
||||
return Result.success(trainSignUpBlackListService.listMap(sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.user.activity")
|
||||
public Result reserveSingUp(String[] ids, String courseId) {
|
||||
//先查询这个课程有多少个未签到的人员
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.* ,
|
||||
(select signUpTime from train_sign_up_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
|
||||
(select state from train_sign_up_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state
|
||||
FROM
|
||||
train_sign_up_user_course uc
|
||||
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 1 order by signUpTime desc
|
||||
""").setParam("courseId", courseId);
|
||||
List<NutMap> list = trainSignUpBlackListService.listMap(sql);
|
||||
if(ids.length > list.size()) {
|
||||
return Result.error("您选择了" + ids.length + "位,未签到人员只有" + list.size() + "位");
|
||||
}
|
||||
//ids的长度为几,就搞几个
|
||||
List<NutMap> mapList = list.subList(0, ids.length);
|
||||
List<String> idList = mapList.stream().map(o -> o.getString("userId")).collect(Collectors.toList());
|
||||
//将这几个没签到的设置为4
|
||||
dao.update(TrainSignUpUser.class, Chain.make("state", 4), Cnd.where("courseId", "=", courseId)
|
||||
.and("userId", "in", idList));
|
||||
//将补充的设置为1
|
||||
dao.update(TrainSignUpUser.class, Chain.make("state", 1), Cnd.where("courseId", "=", courseId)
|
||||
.and("userId", "in", ids));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void exportSignPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, activityId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
|
||||
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
|
||||
DATE_FORMAT(uc.attendTime, '%Y-%m-%d %H:%i:%s') as attendTimeExcel,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex
|
||||
FROM
|
||||
train_sign_up_user_course uc
|
||||
left join train_sign_up_course course on uc.courseId = course.id
|
||||
left join `vw_user` u on u.id = uc.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("uc.activityId", "=", activityId);
|
||||
cnd.and("course.isMobileSign", "=", true);
|
||||
cnd.desc("isAttend").desc("attendTime");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> userList = trainSignUpBlackListService.listMap(sql);
|
||||
|
||||
List<TrainSignUpCourse> courseList = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("是否签到", "isAttend", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("签到时间", "attendTimeExcel", 22));
|
||||
|
||||
for (TrainSignUpCourse c : courseList) {
|
||||
String courseId = c.getId();
|
||||
String courseName = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(courseName);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
|
||||
for (NutMap userSignData : v) {
|
||||
if(!userSignData.getBoolean("isAttend")) {
|
||||
userSignData.put("isAttend", "未签到");
|
||||
userSignData.put("attendTimeExcel", "未签到");
|
||||
}else {
|
||||
userSignData.put("isAttend", "已签到");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", courseName);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
try {
|
||||
String fileName = activity.getActivityName() + "签到人员名单.xls";
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
|
||||
}
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void exportGiftPerson(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) {
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, activityId);
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
uc.*,
|
||||
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
|
||||
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
|
||||
DATE_FORMAT(uc.receiveTime, '%Y-%m-%d %H:%i:%s') as receiveTimeExcel,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex
|
||||
FROM
|
||||
train_sign_up_user_course uc
|
||||
left join train_sign_up_course course on uc.courseId = course.id
|
||||
left join `vw_user` u on u.id = uc.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("uc.activityId", "=", activityId);
|
||||
cnd.and("course.isReceiveGift", "=", true).and("course.giftType" ,"=", 1);
|
||||
cnd.desc("isReceive").desc("receiveTime");
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> userList = trainSignUpBlackListService.listMap(sql);
|
||||
|
||||
List<TrainSignUpCourse> courseList = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("是否领取", "isReceive", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("领取时间", "receiveTimeExcel", 22));
|
||||
|
||||
for (TrainSignUpCourse c : courseList) {
|
||||
String courseId = c.getId();
|
||||
String courseName = c.getCourseName();
|
||||
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setSheetName(courseName);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
|
||||
for (NutMap userSignData : v) {
|
||||
if(!userSignData.getBoolean("isReceive")) {
|
||||
userSignData.put("isReceive", "未领取");
|
||||
userSignData.put("receiveTimeExcel", "未领取");
|
||||
}else {
|
||||
userSignData.put("isReceive", "已领取");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> userExportMap = new HashMap<>();
|
||||
userExportMap.put("name", courseName);
|
||||
userExportMap.put("title", userExportParams);
|
||||
userExportMap.put("entity", currentEntities);
|
||||
userExportMap.put("data", v);
|
||||
|
||||
sheetsList.add(userExportMap);
|
||||
}
|
||||
try {
|
||||
String fileName = activity.getActivityName() + "礼品领取人员名单.xls";
|
||||
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", disposition);
|
||||
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
for (Map<String, Object> map : sheetsList) {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
|
||||
}
|
||||
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.mobile;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
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.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年02月25日 13:44:00
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/mobile/trainSignUpActivity")
|
||||
public class MTrainSignUpActivityController {
|
||||
|
||||
private static final String REDIS_KEY_PREFIX = "m_train_sign_up_activity";
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
@At("/trainList")
|
||||
@Ok("beetl:/platform/zhghh5/activity/trainSignUp/trainList/index.html")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public void trainList() {
|
||||
}
|
||||
|
||||
@At("/trainInfo")
|
||||
@Ok("beetl:/platform/zhghh5/activity/trainSignUp/trainInfo/index.html")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public void trainInfo() {
|
||||
}
|
||||
|
||||
@At("/activityInfo")
|
||||
@Ok("beetl:/platform/zhghh5/activity/trainSignUp/activityInfo/index.html")
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public void activityInfo() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityStatus") int activityStatus,
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "activityType") Integer activityType) {
|
||||
Pagination pagination = trainSignUpActivityService.mPageData(pageForm, year, activityStatus, activityType);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id 活动id
|
||||
* @param tabIndex 0全部 1我的
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result findOne(@Param("id") String id,
|
||||
@Param(value = "tabIndex") Integer tabIndex,
|
||||
@Param(value = "fromMode") String fromMode) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (tabIndex > 0) {
|
||||
List<TrainSignUpUser> mySignCourseList = dao.query(TrainSignUpUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("activityId", "=", id));
|
||||
List<String> mySignCourseIdList = mySignCourseList.stream().map(TrainSignUpUser::getCourseId).collect(Collectors.toList());
|
||||
cnd.and("id", "in", mySignCourseIdList);
|
||||
}
|
||||
return Result.success(trainSignUpActivityService.findOne(id, cnd, fromMode));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result doSignUp(TrainSignUpUser trainSignUpUser) {
|
||||
try {
|
||||
lock.lock();
|
||||
boolean courseByUser = trainSignUpActivityService.isSignCourseByUser(trainSignUpUser.getCourseId(), SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error("您已报过该活动");
|
||||
}
|
||||
//判断人数
|
||||
int number = 0;
|
||||
TrainSignUpCourse course = trainSignUpActivityService.dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
|
||||
TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
if(type != null) {
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mobileColumnsValue = trainSignUpUser.getMobileColumnsValue();
|
||||
NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
number = map != null ? map.getInt("columnValue") : 0;
|
||||
}
|
||||
}
|
||||
boolean signFull = trainSignUpActivityService.isSignFull(trainSignUpUser.getCourseId(), number);
|
||||
if(signFull) {
|
||||
return Result.error("当前报名人数已满");
|
||||
}
|
||||
boolean signFullByUnionId = trainSignUpActivityService.isSignFullByUnionId(trainSignUpUser.getCourseId(), number);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额已报满");
|
||||
}
|
||||
trainSignUpActivityService.doSignUp(trainSignUpUser);
|
||||
return Result.success("报名成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.success("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result cancelSignUp(@Param("activityId") String activityId, @Param("courseId") String courseId) {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
//如果是正常报名取消了,将候补报名的按时间倒叙第一个改为正常报名
|
||||
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpType type = dao.fetch(TrainSignUpType.class, course.getCourseType());
|
||||
if(!type.getIsBringFamily() && course.getReserveMode() == 2) {
|
||||
List<TrainSignUpUser> signUpUsers = dao.query(TrainSignUpUser.class, Cnd.where("activityId", "=", activityId).and("courseId", "=", courseId)
|
||||
.and("state", "=", 2).desc("signUpTime"));
|
||||
if(!signUpUsers.isEmpty()) {
|
||||
TrainSignUpUser trainSignUpUser = signUpUsers.get(0);
|
||||
trainSignUpUser.setState(1);
|
||||
dao.update(trainSignUpUser);
|
||||
}
|
||||
}
|
||||
//删除报名记录
|
||||
dao.clear("train_sign_up_user_course", Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId));
|
||||
|
||||
dao.clear("train_sign_up_user", Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "=", courseId).and("userId", "=", userId));
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result doQd(@Param("id") String id, @Param("courseId") String courseId, @Param("point") Double[] points) {
|
||||
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
|
||||
List<Double> coursePoints = course.getCourseLocationCoordinates();
|
||||
// if (Lang.isNotEmpty(coursePoints)) {
|
||||
// //需要签到
|
||||
// if (ArrayUtil.isEmpty(points) || ArrayUtil.hasNull(points)) {
|
||||
// return Result.error().addMsg("请获取当前的坐标信息");
|
||||
// }
|
||||
// Double[] coursePointArray = coursePoints.toArray(new Double[]{});
|
||||
// float distance = AMapUtils.calculateLineDistance(new LatLng(points[0], points[1]), new LatLng(coursePointArray[0], coursePointArray[1]));
|
||||
//
|
||||
// if (distance > 500) {
|
||||
// return Result.error().addMsg("请到签到点位附近签到");
|
||||
// }
|
||||
// }
|
||||
trainSignUpActivityService.doQd(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到信息
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result getQdInfoList(@Param("activityId") String activityId) {
|
||||
List<NutMap> list = trainSignUpActivityService.qdInfoByUserId(SecurityUtil.getUserId(), activityId);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result validateSignUp(String courseId,
|
||||
@Param(value = "cndId") String cndId,
|
||||
@Param(value = "currentFamilyNumber") Integer currentFamilyNumber) {
|
||||
try {
|
||||
lock.lock();
|
||||
if(StrUtil.isBlank(courseId)) {
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
TrainSignUpCourse course = dao.fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpActivity activity = dao.fetch(TrainSignUpActivity.class, course.getActivityId());
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
|
||||
return Result.error("报名未开始");
|
||||
}
|
||||
if(DateUtil.compare(new Date(), activity.getActivitySignUpEndTime(), "yyyy-MM-dd HH:mm:ss") > 0) {
|
||||
return Result.error("报名已结束");
|
||||
}
|
||||
|
||||
boolean courseByUser = trainSignUpActivityService.isSignCourseByUser(courseId, SecurityUtil.getUserId());
|
||||
if(courseByUser) {
|
||||
return Result.error("您已报过该活动");
|
||||
}
|
||||
//判断人数
|
||||
boolean signFull = trainSignUpActivityService.isSignFull(courseId, currentFamilyNumber);
|
||||
if(signFull) {
|
||||
return Result.error("当前报名人数已满");
|
||||
}
|
||||
boolean signCourse = trainSignUpActivityService.isSignCourse(courseId, activity.getId());
|
||||
if(!signCourse) {
|
||||
if(activity.getRestrictLimit() != 3) {
|
||||
return Result.error("您选择的类型的培训班已达上限,不能再报该类型的培训班了");
|
||||
} else {
|
||||
return Result.error(activity.getActivityName() + "限制报" + activity.getLimitNum() + "个活动,已达上限");
|
||||
}
|
||||
}
|
||||
boolean signFullByUnionId = trainSignUpActivityService.isSignFullByUnionId(courseId, currentFamilyNumber);
|
||||
if(signFullByUnionId) {
|
||||
return Result.error("该活动您所在的分工会名额已报满");
|
||||
}
|
||||
if(course.getReserveMode() == 2 && currentFamilyNumber == null) {
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao.query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId)
|
||||
.and("state", "!=", 2));
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
if(hasRegisterNum > course.getCoursePeopleNumber()) {
|
||||
return Result.error(3, "您当前的报名为候补报名状态");
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("报名失败");
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("h5.trainSignUp.sign")
|
||||
public Result codeSign(String id, String codeCourseId, String clickCourseId) {
|
||||
if(StrUtil.isBlank(codeCourseId) || StrUtil.isBlank(clickCourseId)) {
|
||||
return Result.error("签到失败,没有获取到扫描信息");
|
||||
}
|
||||
if(!codeCourseId.equals(clickCourseId)) {
|
||||
return Result.error("签到失败,二维码与您当前签到信息不符");
|
||||
}
|
||||
dao.update(TrainSignUpUserCourse.class, Chain.make("isAttend", true)
|
||||
.add("attendTime", new Date()), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.mobile;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
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.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 品牌活动扫码
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/mobile/trainSignUpActivityScannerQrCode")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MTrainSignUpActivityScannerQrCodeController {
|
||||
|
||||
/*@Inject
|
||||
private WxTokenUtil;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/scannerQrCode.html")
|
||||
public void scannerQrCode() {
|
||||
|
||||
}
|
||||
|
||||
*//**
|
||||
* 微信js验证
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*//*
|
||||
@At("/auth/sign")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object wxAuthSign(String url) {
|
||||
String jsapi_ticket = wxTokenUtil.jsTicket();
|
||||
return sign(jsapi_ticket, url);
|
||||
}
|
||||
|
||||
*//**
|
||||
* 二维码信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param signId 签到记录id
|
||||
* @param activityId 活动id
|
||||
* @return
|
||||
*//*
|
||||
@At("/qrCodeInfo")
|
||||
@RequiresAuthentication
|
||||
public Object qrCodeInfo(@Param("userId") String userId, @Param("signId") String signId, @Param("activityId") String activityId) {
|
||||
if (StrUtil.isBlank(userId) || StrUtil.isBlank(signId) || StrUtil.isBlank(activityId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
// Sql activitySql = Sqls.create("select activityName,cover from train_sign_up_activity where id = @activityId");
|
||||
// activitySql.setParam("activityId",activityId);
|
||||
// NutMap activityMap = (NutMap) Daos.query(dao, activitySql.toString(), Sqls.callback.map());
|
||||
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from train_sign_up_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap attendInfo = (NutMap) Daos.query(dao, signSql.toString(), Sqls.callback.map());
|
||||
Sql userSql = Sqls.create("select id,username,loginname,unitname,unionname,sex from `user` where id = @userId");
|
||||
userSql.setParam("userId", userId);
|
||||
NutMap userMap = (NutMap) Daos.query(dao, userSql.toString(), Sqls.callback.map());
|
||||
return Result.success(Map.of("signInfo", attendInfo, "userInfo", userMap));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@At("/signInfo")
|
||||
@RequiresAuthentication
|
||||
public Object signInfo(@Param("signId") String signId) {
|
||||
if (StrUtil.isBlank(signId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime from train_sign_up_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = trainSignUpActivityService.fetch(signSql);
|
||||
return Result.success(signInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* 发放礼品
|
||||
*
|
||||
* @param signId
|
||||
* @return
|
||||
*//*
|
||||
@At("/grantGiftByQrCode")
|
||||
@RequiresAuthentication
|
||||
public Object grantGiftByQrCode(@Param("signId") String signId) {
|
||||
if (StrUtil.isBlank(signId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
Chain chain = Chain.make("isReceive", 1);
|
||||
chain.add("receiveTime", new Date());
|
||||
chain.add("giftScannerCodeUserId", ShiroUtil.getPrincipalProperty("id"));
|
||||
dao.update(TrainSignUpUserCourse.class, chain, Cnd.where("id", "=", signId));
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from train_sign_up_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = trainSignUpActivityService.fetch(signSql);
|
||||
return Result.success(signInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* 二维码扫描确认签到
|
||||
*
|
||||
* @param signId
|
||||
* @return
|
||||
*//*
|
||||
@At("/confirmSignByQrCode")
|
||||
@RequiresAuthentication
|
||||
public Object confirmSignByQrCode(@Param("signId") String signId) {
|
||||
if (StrUtil.isBlank(signId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
try {
|
||||
Chain chain = Chain.make("isAttend", 1);
|
||||
chain.add("attendTime", new Date());
|
||||
chain.add("signScannerCodeUserId", ShiroUtil.getPrincipalProperty("id"));
|
||||
dao.update(TrainSignUpUserCourse.class, chain, Cnd.where("id", "=", signId));
|
||||
|
||||
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from train_sign_up_user_course where id = @signId");
|
||||
signSql.setParam("signId", signId);
|
||||
NutMap signInfo = trainSignUpActivityService.fetch(signSql);
|
||||
return Result.success(signInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("获取信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, String> sign(String jsapi_ticket, String url) {
|
||||
Map<String, String> ret = new HashMap<String, String>();
|
||||
String nonce_str = create_nonce_str();
|
||||
String timestamp = create_timestamp();
|
||||
String string1;
|
||||
String signature = "";
|
||||
|
||||
//注意这里参数名必须全部小写,且必须有序
|
||||
string1 = "jsapi_ticket=" + jsapi_ticket +
|
||||
"&noncestr=" + nonce_str +
|
||||
"×tamp=" + timestamp +
|
||||
"&url=" + url;
|
||||
System.out.println(string1);
|
||||
|
||||
try {
|
||||
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
|
||||
crypt.reset();
|
||||
crypt.update(string1.getBytes("UTF-8"));
|
||||
signature = byteToHex(crypt.digest());
|
||||
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ret.put("url", url);
|
||||
ret.put("jsapi_ticket", jsapi_ticket);
|
||||
ret.put("nonceStr", nonce_str);
|
||||
ret.put("timestamp", timestamp);
|
||||
ret.put("signature", signature);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static String byteToHex(final byte[] hash) {
|
||||
Formatter formatter = new Formatter();
|
||||
for (byte b : hash) {
|
||||
formatter.format("%02x", b);
|
||||
}
|
||||
String result = formatter.toString();
|
||||
formatter.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String create_nonce_str() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
private static String create_timestamp() {
|
||||
return Long.toString(System.currentTimeMillis() / 1000);
|
||||
}*/
|
||||
|
||||
}
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.controller.statistics;
|
||||
|
||||
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.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.activity.trainSignUp.models.TrainMobileSignColumn;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpType;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nutz.dao.Chain;
|
||||
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.json.Json;
|
||||
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.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名 统计
|
||||
* @createTime 2022年02月23日 09:57:00
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/trainSingUp/statistics/activity")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class TrainSignUpActivityStatisticsController {
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityService trainSignUpActivityManageService;
|
||||
|
||||
@Inject
|
||||
private TrainSignUpActivityStatisticsService trainSignUpActivityStatisticsService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
@Ok("beetl:/platform/zhgh/activity/trainSingUp/statistics/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "activityId") String activityId) {
|
||||
Pagination pagination = trainSignUpActivityStatisticsService.pageData(pageForm, activityId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动list
|
||||
*
|
||||
* @param year 年度
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result activityList(@Param(value = "year") Integer year) {
|
||||
List<TrainSignUpActivity> list = dao.query(TrainSignUpActivity.class, Cnd.NEW().andEX("year", "=", year).desc("activityStartTime"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班报名人员list
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result registerUserList(@Param(value = "courseId") String courseId) {
|
||||
return Result.success(trainSignUpActivityStatisticsService.registerUserList(courseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训班上课签到信息
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result getSignInfo(@Param("courseId") String courseId) {
|
||||
return Result.success(trainSignUpActivityStatisticsService.getSignInfo(courseId));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public Result signChange(@Param("courseId") String courseId, @Param("openOtherUnion") Boolean openOtherUnion) {
|
||||
dao.update(TrainSignUpCourse.class, Chain.make("openOtherUnion", openOtherUnion)
|
||||
, Cnd.where("id", "=", courseId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("trainSingUp.statistics.activity")
|
||||
public void exportSignUser(@Param(value = "activityId") String activityId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode("报名人员.zip", StandardCharsets.UTF_8));
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ts.*,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
u.sex,
|
||||
if(ts.mobile is null, u.mobile, ts.mobile) as mobile,
|
||||
u.birthday,
|
||||
tsc.courseName,
|
||||
tsc.campus,
|
||||
ts.state
|
||||
FROM
|
||||
train_sign_up_user ts
|
||||
left join `vw_user` u on u.id = ts. userId
|
||||
left join train_sign_up_course tsc on tsc.id = ts.courseId
|
||||
WHERE
|
||||
ts.activityId = @activityId
|
||||
ORDER BY FIELD( ts.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""").setParam("activityId", activityId);
|
||||
List<NutMap> userList = trainSignUpActivityManageService.listMap(sql);
|
||||
userList.forEach(item -> {
|
||||
if (item.getInt("state") == 1) {
|
||||
item.setv("stateName", "正常报名");
|
||||
} else if (item.getInt("state") == 2) {
|
||||
item.setv("stateName", "候补报名");
|
||||
} else if (item.getInt("state") == 3) {
|
||||
item.setv("stateName", "正常报名(候补)");
|
||||
} else if (item.getInt("state") == 4) {
|
||||
item.setv("stateName", "无效报名(缺席)");
|
||||
}
|
||||
});
|
||||
|
||||
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20));
|
||||
excelCommonExportEntity.add(new ExcelExportEntity("报名状态", "stateName", 20));
|
||||
|
||||
List<TrainSignUpCourse> courseList = dao.query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
Map<String, TrainSignUpCourse> courseMap = courseList.stream().collect(Collectors.toMap(o -> o.getId(), o -> o));
|
||||
|
||||
//按校区分组
|
||||
Map<String, List<NutMap>> campus = userList.stream().collect(Collectors.groupingBy(o -> o.getString("campus")));
|
||||
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
|
||||
campus.forEach((key, value) -> {
|
||||
Map<String, List<NutMap>> userListMap = value.stream().collect(Collectors.groupingBy(v -> v.getString("courseId")));
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
userListMap.forEach((k, v) -> {
|
||||
|
||||
//查询课程
|
||||
TrainSignUpCourse course = courseMap.get(k);
|
||||
//查询课程类型
|
||||
TrainSignUpType trainSignUpType = dao.fetch(TrainSignUpType.class, Cnd.where("id", "=", course.getCourseType()));
|
||||
dao.fetchLinks(trainSignUpType, "^trainMobileSignColumnList$");
|
||||
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams userExportParams = new ExportParams();
|
||||
userExportParams.setTitle(course.getCourseName());
|
||||
userExportParams.setSheetName(course.getCourseName());
|
||||
userExportParams.setType(ExcelType.XSSF);
|
||||
|
||||
List<ExcelExportEntity> currentEntities = new ArrayList<>();
|
||||
currentEntities.addAll(excelCommonExportEntity);
|
||||
//将课程类型配置的移动端动态字段添加到excel列中
|
||||
List<TrainMobileSignColumn> trainMobileSignColumnList = trainSignUpType.getTrainMobileSignColumnList();
|
||||
if (trainMobileSignColumnList != null && trainMobileSignColumnList.size() > 0) {
|
||||
trainMobileSignColumnList.forEach(item -> {
|
||||
currentEntities.add(new ExcelExportEntity(item.getColumnName(), item.getColumnCode(), 20));
|
||||
});
|
||||
}
|
||||
|
||||
for (NutMap userSignData : v) {
|
||||
String mobileColumnsValueStr = userSignData.getString("mobileColumnsValue");
|
||||
if (StrUtil.isNotBlank(mobileColumnsValueStr)) {
|
||||
List<NutMap> mobileColumnsValue = Json.fromJsonAsList(NutMap.class, mobileColumnsValueStr);
|
||||
for (NutMap cv : mobileColumnsValue) {
|
||||
if (cv.getString("columnFormType") != null && !cv.getString("columnFormType").equals("FILE")) {
|
||||
userSignData.addv(cv.getString("columnCode"), cv.getString("columnValue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
service.createSheetForMap(workbook, userExportParams, currentEntities, v);
|
||||
});
|
||||
try {
|
||||
zipOutputStream.putNextEntry(new ZipEntry(key + "报名人员.xlsx"));
|
||||
workbook.write(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Table("train_mobile_sign_column")
|
||||
@Data
|
||||
public class TrainMobileSignColumn {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* train_sign_up_type id
|
||||
*/
|
||||
@Column
|
||||
@Comment("类型id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("字段名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnName;
|
||||
|
||||
@Column
|
||||
@Comment("字段编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnCode;
|
||||
|
||||
@Column
|
||||
@Comment("字段值")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnValue;
|
||||
|
||||
@Column
|
||||
@Comment("字段类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnType;
|
||||
|
||||
@Column
|
||||
@Comment("下拉框的值")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> selectValues;
|
||||
|
||||
@Column
|
||||
@Comment("是否必填")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isRequired;
|
||||
|
||||
@Column
|
||||
@Comment("控件类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String columnFormType;
|
||||
|
||||
@Column
|
||||
@Comment("文件个数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer fileNumber;
|
||||
|
||||
@Column
|
||||
@Comment("文件类型")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> fileType;
|
||||
|
||||
@Column
|
||||
@Comment("序号")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer columnIndex;
|
||||
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训报名活动
|
||||
* @createTime 2022年02月23日 08:57:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TrainSignUpActivity extends BaseModel implements Serializable, SysHomeConvert {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动名称")
|
||||
private String activityName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("年度")
|
||||
private Integer year;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动报名开始时间")
|
||||
private Date activitySignUpStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动报名开始时间")
|
||||
private Date activitySignUpEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动开始时间")
|
||||
private Date activityStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("活动结束时间")
|
||||
private Date activityEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
private boolean isDisabled;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "longtext")
|
||||
@Comment("活动介绍")
|
||||
private String introduce;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
@Comment("活动限制标识")
|
||||
private Integer restrictLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
@Comment("活动限制报名个数")
|
||||
private Integer limitNum;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("活动封面")
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Comment("微信群二维码")
|
||||
private String wechat;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("上课前是否通知")
|
||||
private boolean notice;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围Id")
|
||||
@ColDefine(type = ColType.INT, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String activityGroupName;
|
||||
|
||||
/**
|
||||
* 所有的培训班
|
||||
*/
|
||||
@Many(field = "activityId")
|
||||
private List<TrainSignUpCourse> courseList;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<TrainSignUpTypeLimit> typeLimits;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String trainType;
|
||||
|
||||
@Override
|
||||
public Sys_home_activity covertToSysHomeActivity() {
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(this.getId());
|
||||
sysHomeActivity.setName(this.getActivityName());
|
||||
sysHomeActivity.setCover(this.getCover());
|
||||
sysHomeActivity.setUrl("/platform/trainSingUp/manage/apply");
|
||||
sysHomeActivity.setH5Url("/platform/mobile/trainSignUpActivity/trainList");
|
||||
if (Lang.isNotEmpty(this.getActivitySignUpStartTime())) {
|
||||
sysHomeActivity.setStartDate(this.getActivitySignUpStartTime());
|
||||
sysHomeActivity.setEndDate(this.getActivitySignUpEndTime());
|
||||
}
|
||||
sysHomeActivity.setAllowUserGroupId(this.getActivityGroupId());
|
||||
sysHomeActivity.setEnable(!this.isDisabled());
|
||||
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
|
||||
return sysHomeActivity;
|
||||
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 活动下的课程
|
||||
* @createTime 2022年02月23日 09:26:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TrainSignUpActivityCourse {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程开始时间")
|
||||
private Date courseStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程结束时间")
|
||||
private Date courseEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATE)
|
||||
@Comment("课程时间")
|
||||
private Date courseDate;
|
||||
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 黑名单
|
||||
* @createTime 2022年03月07日 14:32:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
public class TrainSignUpBlackList {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否禁用")
|
||||
private Boolean isDisabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 培训班信息
|
||||
* @createTime 2022年02月23日 09:04:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TrainSignUpCourse extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("课程名称")
|
||||
private String courseName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("课程人数")
|
||||
private int coursePeopleNumber;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default(value = "0")
|
||||
@Comment("预留名额")
|
||||
private int courseReservedNumber;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("课程地点")
|
||||
private String courseLocation;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程类型")
|
||||
private String courseType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("课程地点坐标")
|
||||
private List<Double> courseLocationCoordinates;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("课程讲师")
|
||||
private String courseInstructor;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("校区")
|
||||
private String campus;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("序号")
|
||||
private int orderNum;
|
||||
|
||||
@Many(field = "courseId")
|
||||
private List<TrainSignUpActivityCourse> courseTimeList;
|
||||
|
||||
//已报人数
|
||||
private Integer hasRegisterNum;
|
||||
|
||||
//已报家属人数
|
||||
private Integer hasFmailyNum;
|
||||
|
||||
private Boolean isBringFamily;
|
||||
|
||||
private Boolean isAddFamily;
|
||||
|
||||
private Integer waitingNum;
|
||||
|
||||
//是否报过该课程
|
||||
private Boolean isSign;
|
||||
|
||||
//还能报该类型的课程吗
|
||||
private Boolean canSignThisCourseType;
|
||||
|
||||
@Column
|
||||
@Comment("分工会人数限制")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> unionLimit;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签到")
|
||||
private boolean isMobileSign;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("签到方式 1.扫描二维码签到 2.被扫 3.gps签到")
|
||||
private Integer signType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("移动端是否签收礼品")
|
||||
private boolean isReceiveGift;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("领取礼品方式 1.扫描二维码 2.线下")
|
||||
private Integer giftType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("预留名额方式 1.报名人员减少模式 2.报名人数不变模式")
|
||||
private Integer reserveMode;
|
||||
|
||||
@Column
|
||||
@Comment("承办工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String hostUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("对内报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String interTime;
|
||||
|
||||
@Column
|
||||
@Comment("是否开放给其他工会")
|
||||
@ColDefine(type = ColType.BOOLEAN, width = 4)
|
||||
private Boolean openOtherUnion;
|
||||
|
||||
@Column
|
||||
@Comment("分类标识")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String assort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author 赵欣雨
|
||||
* @date 2020/8/18 9:16
|
||||
*/
|
||||
@Table("train_sign_up_type")
|
||||
@Data
|
||||
public class TrainSignUpType extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("类型编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 80)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("类型名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 80)
|
||||
private String lxname;
|
||||
|
||||
@Column
|
||||
@Comment("序号")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer xh;
|
||||
|
||||
@Column
|
||||
@Comment("是否携带家属")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isBringFamily;
|
||||
|
||||
@Column
|
||||
@Comment("家属纳入总人数")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isAddFamily;
|
||||
|
||||
@Many(field = "typeId")
|
||||
private List<TrainMobileSignColumn> trainMobileSignColumnList;
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2022/9/22
|
||||
* @Description
|
||||
*/
|
||||
@Table("train_sign_up_type_limit")
|
||||
@Data
|
||||
public class TrainSignUpTypeLimit implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@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 activityId;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String typeId;
|
||||
|
||||
@Column
|
||||
@Comment("限制个数")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private int limitNum;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 报名人员 报名记录
|
||||
* @createTime 2022年02月23日 09:34:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableIndexes({@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSEID", fields = {"courseId"}, unique = false)})
|
||||
public class TrainSignUpUser implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("联系方式")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("报名时间")
|
||||
private Date signUpTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("手机端报名字段和值")
|
||||
private List<NutMap> mobileColumnsValue;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("用户报名状态(1.正常 2.待报名成功 3.也是正常,但是是从2变为1的 4.废弃[就是没签到的意思])")
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 用户课程表
|
||||
* @createTime 2022年02月23日 09:38:00
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSE_USERID", fields = {"userId"}, unique = false),
|
||||
@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSE_COURSEID", fields = {"courseId"}, unique = false)
|
||||
})
|
||||
public class TrainSignUpUserCourse implements Serializable {
|
||||
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("活动ID")
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("课程ID")
|
||||
private String courseId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程开始时间")
|
||||
private Date courseStartTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("课程结束时间")
|
||||
private Date courseEndTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否上课")
|
||||
private boolean isAttend;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("上课打卡时间")
|
||||
private Date attendTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否领取礼品")
|
||||
private Boolean isReceive;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@Comment("领取礼品时间")
|
||||
private Date receiveTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("签到扫码人员id(二维码模式)")
|
||||
private String signScannerCodeUserId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("礼品扫码人员id(二维码模式)")
|
||||
private String giftScannerCodeUserId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("关联train_sign_up_activity_course表的id")
|
||||
private String activityCourseId;
|
||||
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivity;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpCourse;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年02月23日 17:14:00
|
||||
*/
|
||||
public interface TrainSignUpActivityService extends BaseService<TrainSignUpActivity> {
|
||||
|
||||
/**
|
||||
* 添加活动
|
||||
*
|
||||
* @param activity 活动信息
|
||||
* @param course 培训班信息
|
||||
*/
|
||||
void add(TrainSignUpActivity activity, TrainSignUpCourse course);
|
||||
|
||||
/**
|
||||
* 编辑活动
|
||||
*
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void edit(TrainSignUpActivity activity);
|
||||
|
||||
/**
|
||||
* 更新活动状态
|
||||
*
|
||||
* @param activity 活动信息
|
||||
*/
|
||||
void updateActivityStatus(TrainSignUpActivity activity);
|
||||
|
||||
/**
|
||||
* 查询单条活动信息
|
||||
*
|
||||
* @param id 活动ID
|
||||
* @return 返回的数据与前端符合
|
||||
*/
|
||||
NutMap findOne(String id, Cnd cnd, String fromMode);
|
||||
|
||||
/**
|
||||
* pc分页查询
|
||||
*
|
||||
* @param pageForm
|
||||
* @param cnd
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd);
|
||||
|
||||
|
||||
/**
|
||||
* 手机端分页查询
|
||||
*
|
||||
* @param pageForm 分页
|
||||
* @param year 年度
|
||||
* @param activityStatus 报名状态 0全部 1进行中 2结束
|
||||
* @return
|
||||
*/
|
||||
Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType);
|
||||
|
||||
/**
|
||||
* 手机端报名
|
||||
*
|
||||
* @param trainSignUpUser 活动ID
|
||||
*/
|
||||
void doSignUp(TrainSignUpUser trainSignUpUser) throws Exception;
|
||||
|
||||
/**
|
||||
* 异步插入每个报名成功人员的课程数据
|
||||
*
|
||||
* @param activityId
|
||||
* @param courseId
|
||||
* @param userId
|
||||
*/
|
||||
void asyncInsertUserCourse(String activityId, String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignFullByUnionId(String courseId, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 该培训班是否报满
|
||||
*
|
||||
* @param courseId
|
||||
*/
|
||||
boolean isSignFull(String courseId, Integer currentFamilyNumber);
|
||||
|
||||
/**
|
||||
* 还能报该类型的培训班吗 比如书画班最多报一项 健身班两项
|
||||
*
|
||||
* @param courseId
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourse(String courseId, String activityId);
|
||||
|
||||
/**
|
||||
* 当前用户是否已报过该培训班
|
||||
*
|
||||
* @param courseId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
boolean isSignCourseByUser(String courseId, String userId);
|
||||
|
||||
/**
|
||||
* 手机端签到
|
||||
*
|
||||
* @param id 每个培训班每节课每个用户的记录ID
|
||||
*/
|
||||
void doQd(String id);
|
||||
|
||||
/**
|
||||
* 某个用户的签到信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param activityId 活动id
|
||||
*/
|
||||
List<NutMap> qdInfoByUserId(String userId, String activityId);
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description 报名统计service
|
||||
* @createTime 2022年03月03日 10:00:00
|
||||
*/
|
||||
public interface TrainSignUpActivityStatisticsService extends BaseService<TrainSignUpUser> {
|
||||
|
||||
/**
|
||||
* 统计分页
|
||||
*
|
||||
* @param pageForm
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String activityId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId);
|
||||
|
||||
/**
|
||||
* 该课程下的报名人员信息
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword);
|
||||
|
||||
/**
|
||||
* 获取每个课程的签到情况
|
||||
*
|
||||
* @param courseId
|
||||
* @return k->每个培训班每节课的上课时间 v->上课记录list
|
||||
*/
|
||||
Map<String, List<NutMap>> getSignInfo(String courseId);
|
||||
|
||||
/**
|
||||
* 报名人员list 导出
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> baoMingUserList(String activityId);
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpBlackList;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月07日 14:29:00
|
||||
*/
|
||||
public interface TrainSignUpBlackListService extends BaseService<TrainSignUpBlackList> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param pageForm 分页
|
||||
* @return Pagination
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId);
|
||||
|
||||
/**
|
||||
* 拉黑、解封用户
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void doHandleUser(String userId);
|
||||
|
||||
/**
|
||||
* 上课记录
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> attendClassRecord(String userId);
|
||||
|
||||
|
||||
}
|
||||
+536
@@ -0,0 +1,536 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.async.Async;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年02月23日 17:14:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class TrainSignUpActivityServiceImpl extends BaseServiceImpl<TrainSignUpActivity> implements TrainSignUpActivityService {
|
||||
|
||||
public TrainSignUpActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void add(TrainSignUpActivity activity, TrainSignUpCourse course) {
|
||||
|
||||
dao().insert(activity);
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
|
||||
v.setActivityId(activity.getId());
|
||||
v.setOpenOtherUnion(false);
|
||||
dao().insert(v);
|
||||
|
||||
List<TrainSignUpActivityCourse> courseTimeList = v.getCourseTimeList();
|
||||
courseTimeList.forEach(x -> {
|
||||
x.setActivityId(activity.getId());
|
||||
x.setCourseId(v.getId());
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(x.getCourseDate());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int day = calendar.get(Calendar.DATE);
|
||||
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(x.getCourseStartTime());
|
||||
startCalendar.set(year, month, day);
|
||||
x.setCourseStartTime(startCalendar.getTime());
|
||||
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(x.getCourseEndTime());
|
||||
endCalendar.set(year, month, day);
|
||||
x.setCourseEndTime(endCalendar.getTime());
|
||||
dao().insert(x);
|
||||
});
|
||||
});
|
||||
|
||||
List<TrainSignUpTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> {
|
||||
v.setActivityId(activity.getId());
|
||||
dao().insert(v);
|
||||
});
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void edit(TrainSignUpActivity activity) {
|
||||
|
||||
List<TrainSignUpCourse> oldCourseList = dao().query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
//原来的培训班id
|
||||
List<String> oldCourseIdList = oldCourseList.stream().map(TrainSignUpCourse::getId).toList();
|
||||
|
||||
//原来的上课时间
|
||||
List<TrainSignUpActivityCourse> oldActCourseTimeList = dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activity.getId()));
|
||||
|
||||
|
||||
update(activity);
|
||||
|
||||
List<TrainSignUpTypeLimit> typeLimits = activity.getTypeLimits();
|
||||
typeLimits.forEach(v -> {
|
||||
v.setActivityId(activity.getId());
|
||||
insertOrUpdate(v);
|
||||
});
|
||||
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
courseList.forEach(v -> {
|
||||
|
||||
v.setActivityId(activity.getId());
|
||||
dao().insertOrUpdate(v);
|
||||
|
||||
List<TrainSignUpActivityCourse> courseTimeList = v.getCourseTimeList();
|
||||
if(courseTimeList != null) {
|
||||
courseTimeList.forEach(x -> {
|
||||
x.setActivityId(activity.getId());
|
||||
x.setCourseId(v.getId());
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(x.getCourseDate());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int day = calendar.get(Calendar.DATE);
|
||||
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(x.getCourseStartTime());
|
||||
startCalendar.set(year, month, day);
|
||||
x.setCourseStartTime(startCalendar.getTime());
|
||||
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(x.getCourseEndTime());
|
||||
endCalendar.set(year, month, day);
|
||||
x.setCourseEndTime(endCalendar.getTime());
|
||||
|
||||
dao().insertOrUpdate(x);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//现在的上课时间
|
||||
List<String> nowCourseTimeListId = new ArrayList<>();
|
||||
activity.getCourseList().stream().forEach(v -> {
|
||||
if(v.getCourseTimeList() != null) {
|
||||
nowCourseTimeListId.addAll(v.getCourseTimeList().stream().map(x -> x.getId()).collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
|
||||
List<String> deleteCourseTimeListId = oldActCourseTimeList.stream().filter(x -> !nowCourseTimeListId.contains(x.getId())).map(x -> x.getId()).collect(Collectors.toList());
|
||||
|
||||
|
||||
List<String> courseIdList = courseList.stream().map(v -> v.getId()).collect(Collectors.toList());
|
||||
|
||||
//删除关联的培训班
|
||||
List<String> deleteIdList = oldCourseIdList.stream().filter(v -> !courseIdList.contains(v)).collect(Collectors.toList());
|
||||
dao().clear(TrainSignUpCourse.class, Cnd.where("id", "in", deleteIdList));
|
||||
|
||||
|
||||
dao().clear(TrainSignUpActivityCourse.class, Cnd.where("id", "in", deleteCourseTimeListId));
|
||||
dao().clear(TrainSignUpUser.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
dao().clear(TrainSignUpUserCourse.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
|
||||
|
||||
//修改train_sign_up_user_course的数据 如果上课时间发生变化
|
||||
|
||||
//查询修改过培训时间的记录
|
||||
Sql tsuucSql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.id,
|
||||
tsuac.courseStartTime,
|
||||
tsuac.courseEndTime
|
||||
FROM
|
||||
`train_sign_up_user_course` tsuuc
|
||||
LEFT JOIN train_sign_up_activity_course tsuac ON tsuac.id = tsuuc.activityCourseId
|
||||
where tsuuc.courseStartTime != tsuac.courseStartTime or tsuuc.courseEndTime != tsuac.courseEndTime
|
||||
""");
|
||||
List<NutMap> tsuucList = listMap(tsuucSql);
|
||||
tsuucList.forEach(v -> {
|
||||
Chain chain = Chain.make("courseStartTime", v.getTime("courseStartTime"));
|
||||
chain.add("courseEndTime", v.getTime("courseEndTime"));
|
||||
Cnd cnd = Cnd.where("id", "=", v.getString("id"));
|
||||
dao().update("train_sign_up_user_course", chain, cnd);
|
||||
});
|
||||
|
||||
if (!activity.isDisabled()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao().insertOrUpdate(sysHomeActivity);
|
||||
} else {
|
||||
dao().delete(Sys_home_activity.class, activity.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void updateActivityStatus(TrainSignUpActivity activity) {
|
||||
updateIgnoreNull(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap findOne(String id, Cnd cnd, String fromMode) {
|
||||
if (Lang.isEmpty(cnd)) {
|
||||
cnd = Cnd.NEW();
|
||||
}
|
||||
|
||||
cnd.asc("orderNum").asc("campus").desc("courseLocation").asc("courseType").asc("courseName");
|
||||
List<TrainSignUpCourse> courseArray = dao().query(TrainSignUpCourse.class, cnd.and("activityId", "=", id));
|
||||
|
||||
if(StrUtil.isNotBlank(fromMode) && "mobile".equals(fromMode)) {
|
||||
courseArray = courseArray.stream().filter(o -> {
|
||||
if(StrUtil.isBlank(o.getInterTime()) || o.getOpenOtherUnion() == null || o.getOpenOtherUnion()) {
|
||||
return true;
|
||||
} else {
|
||||
if(SecurityUtil.getUnionId().equals(o.getHostUnionId())) {
|
||||
return true;
|
||||
} else {
|
||||
int compare = cn.hutool.core.date.DateUtil.compare(cn.hutool.core.date.DateUtil.date(), cn.hutool.core.date.DateUtil.parse(o.getInterTime()), "yyyy-MM-dd HH:mm");
|
||||
if(compare >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
TrainSignUpActivity activity = fetchLinks(dao().fetch(TrainSignUpActivity.class, id), "^(conditionStructure|typeLimits)$");
|
||||
activity.setCourseList(courseArray);
|
||||
|
||||
List<TrainSignUpCourse> courseList = activity.getCourseList();
|
||||
|
||||
courseList.forEach(c -> {
|
||||
if(StrUtil.isNotBlank(c.getCourseType())) {
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, c.getCourseType());
|
||||
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
|
||||
//已报人数
|
||||
AtomicInteger hasRegisterNum = new AtomicInteger();
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getId()));
|
||||
signUpUsers.forEach(item -> {
|
||||
hasRegisterNum.getAndIncrement();
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
hasRegisterNum.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
c.setHasRegisterNum(hasRegisterNum.get());
|
||||
//候补报名人数
|
||||
int count = dao().count(TrainSignUpUser.class, Cnd.where("activityId", "=", activity.getId()).and("courseId", "=", c.getId())
|
||||
.and("state", "=", 2));
|
||||
c.setWaitingNum(count);
|
||||
//当前用户是否报过
|
||||
c.setIsSign(isSignCourseByUser(c.getId(), SecurityUtil.getUserId()));
|
||||
}
|
||||
});
|
||||
return Lang.obj2nutmap(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd) {
|
||||
Pagination pagination = listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "^(courseList)$");
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year", "=", year);
|
||||
switch (activityStatus) {
|
||||
case 2 -> {
|
||||
cnd.and(new Static("activitySignUpStartTime < now()"));
|
||||
cnd.and(new Static("activitySignUpEndTime > now()"));
|
||||
}
|
||||
case 3 -> {
|
||||
cnd.and(new Static("activityStartTime < now()"));
|
||||
cnd.and(new Static("activityEndTime > now()"));
|
||||
}
|
||||
case 4 -> cnd.and(new Static("activityEndTime < now()"));
|
||||
case 5 -> cnd.and(new Static("activityStartTime < now()"));
|
||||
case 6 -> cnd.and(new Static("activityStartTime > now()"));
|
||||
}
|
||||
if(activityType != null && activityType == 1) {
|
||||
cnd.and(new Static("id in (select activityId from train_sign_up_user where userId = '%s')".formatted(SecurityUtil.getUserId())));
|
||||
}
|
||||
cnd.and("isDisabled", "=", 0);
|
||||
cnd.orderBy("activityEndTime", "desc");
|
||||
cnd.orderBy("isDisabled", "desc");
|
||||
cnd.orderBy("createdAt", "desc");
|
||||
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void doSignUp(TrainSignUpUser trainSignUpUser) throws Exception {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
|
||||
//查询课程
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, trainSignUpUser.getCourseId());
|
||||
//如果这个课程的预留名额方式为报名人数不变
|
||||
if(course.getReserveMode() == 2) {
|
||||
//如果当前报名+已报小于这个课程限制人数
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", trainSignUpUser.getCourseId())
|
||||
.and("state", "!=", 2));
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
if(hasRegisterNum > course.getCoursePeopleNumber()) {
|
||||
trainSignUpUser.setState(2);
|
||||
} else {
|
||||
trainSignUpUser.setState(1);
|
||||
}
|
||||
} else {
|
||||
trainSignUpUser.setState(1);
|
||||
}
|
||||
|
||||
trainSignUpUser.setUserId(userId);
|
||||
trainSignUpUser.setSignUpTime(new Date());
|
||||
|
||||
dao().insert(trainSignUpUser);
|
||||
asyncInsertUserCourse(trainSignUpUser.getActivityId(), trainSignUpUser.getCourseId(), userId);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void asyncInsertUserCourse(String activityId, String courseId, String userId) {
|
||||
log.info("异步插入{}的上课信息,课程ID为{},活动ID为{}", userId, courseId, activityId);
|
||||
List<TrainSignUpActivityCourse> courseList = dao().query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
List<TrainSignUpUserCourse> list = new ArrayList<>();
|
||||
courseList.forEach(v -> {
|
||||
TrainSignUpUserCourse userCourse = new TrainSignUpUserCourse();
|
||||
userCourse.setActivityId(activityId);
|
||||
userCourse.setCourseId(courseId);
|
||||
userCourse.setUserId(userId);
|
||||
userCourse.setCourseStartTime(v.getCourseStartTime());
|
||||
userCourse.setCourseEndTime(v.getCourseEndTime());
|
||||
userCourse.setAttend(false);
|
||||
userCourse.setAttendTime(null);
|
||||
userCourse.setActivityCourseId(v.getId());
|
||||
list.add(userCourse);
|
||||
});
|
||||
dao().insert(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 该培训班每个分工会名额是否报满
|
||||
*
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isSignFullByUnionId(String courseId, Integer currentFamilyNumber) {
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpType signUpType = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
List<NutMap> unionLimit = course.getUnionLimit();
|
||||
if (Lang.isEmpty(unionLimit)) {
|
||||
return false;
|
||||
}
|
||||
String unionId = SecurityUtil.getUnionId();
|
||||
NutMap unionLimitMap = unionLimit.stream().filter(v -> v.getString("id").equals(unionId)).findAny().orElse(null);
|
||||
if (Lang.isEmpty(unionLimitMap)) {
|
||||
return true;
|
||||
}
|
||||
//分工会限制人数
|
||||
int limitCount = unionLimitMap.getInt("limitCount");
|
||||
|
||||
//查询该课程已经报了多少人
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
fu.*
|
||||
FROM
|
||||
`train_sign_up_user` fu
|
||||
LEFT JOIN `user` u ON fu.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("courseId", "=", courseId);
|
||||
sql.setCondition(cnd);
|
||||
//已经报名人数,这是教职工的
|
||||
List<NutMap> signUpUsers = listMap(sql);
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
//课程已报人数(携带的家属)
|
||||
int hasFamilyNum = 0;
|
||||
//如果携带家属,并且纳入人数,则mdzz
|
||||
if(signUpType.getIsAddFamily() && signUpType.getIsBringFamily()) {
|
||||
//如果携带家属,已报人数=教职工+每个教职工携带的家属
|
||||
AtomicInteger num = new AtomicInteger();
|
||||
signUpUsers.forEach(item -> {
|
||||
List<NutMap> mapList = item.getAsList("", NutMap.class);
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
num.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
});
|
||||
hasFamilyNum = num.get() + (currentFamilyNumber != null ? currentFamilyNumber : 0);//currentFamilyNumber是当前报名时填的家属人数
|
||||
}
|
||||
//如果已报人数+当前报名(自己)+家属 > 分工会限制人数
|
||||
return (hasRegisterNum + hasFamilyNum) > limitCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignFull(String courseId, Integer currentFamilyNumber) {
|
||||
//查询课程
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
//课程限制人数
|
||||
int coursePeopleNumber = course.getCoursePeopleNumber();
|
||||
if(coursePeopleNumber == 0) {
|
||||
return false;
|
||||
}
|
||||
//查询课程对应的类型
|
||||
TrainSignUpType type = dao().fetch(TrainSignUpType.class, course.getCourseType());
|
||||
//课程已报人数
|
||||
List<TrainSignUpUser> signUpUsers = dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId));
|
||||
int hasRegisterNum = signUpUsers.size() + 1;//+1是算自己
|
||||
//课程已报人数(携带的家属)
|
||||
int hasFamilyNum = 0;
|
||||
//如果这个类型携带家属并且计入总人数
|
||||
if(type.getIsBringFamily() && type.getIsAddFamily()) {
|
||||
AtomicInteger num = new AtomicInteger();
|
||||
signUpUsers.forEach(item -> {
|
||||
List<NutMap> mapList = item.getMobileColumnsValue();
|
||||
if(Lang.isNotEmpty(mapList)) {
|
||||
NutMap nutMap = mapList.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
|
||||
if(nutMap != null) {
|
||||
num.addAndGet(nutMap.getInt("columnValue"));
|
||||
}
|
||||
}
|
||||
});
|
||||
hasFamilyNum = num.get() + (currentFamilyNumber != null ? currentFamilyNumber : 0);//currentFamilyNumber是当前报名时填的家属人数
|
||||
}
|
||||
//如果预留名额模式是报名人数减少
|
||||
if(course.getReserveMode() == 1) {
|
||||
//如果已报人数+预留人数+当前报名(自己)+家属 > 总人数
|
||||
return (hasRegisterNum + course.getCourseReservedNumber() + hasFamilyNum) > coursePeopleNumber;
|
||||
}else {//如果预留名额模式是报名人数不变
|
||||
//如果已报人数+当前报名(自己)+家属 > 总人数+预留人数
|
||||
return (hasRegisterNum + hasFamilyNum) > (coursePeopleNumber + course.getCourseReservedNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourse(String courseId, String activityId) {
|
||||
TrainSignUpCourse course = dao().fetch(TrainSignUpCourse.class, courseId);
|
||||
TrainSignUpActivity activity = dao().fetch(TrainSignUpActivity.class, activityId);
|
||||
//培训班类型
|
||||
String courseType = course.getCourseType();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
count( tsus.id )
|
||||
FROM
|
||||
`train_sign_up_user` tsus
|
||||
LEFT JOIN train_sign_up_course tsuc ON tsuc.id = tsus.courseId
|
||||
WHERE
|
||||
tsuc.courseType = @courseType
|
||||
AND tsus.userId = @userId
|
||||
AND tsus.activityId = @activityId
|
||||
""");
|
||||
sql.setParam("courseType", courseType);
|
||||
sql.setParam("activityId", activityId);
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
int hasRegisterNum = count(sql);
|
||||
|
||||
//第一种无限制报名
|
||||
if (activity.getRestrictLimit() == null || activity.getRestrictLimit() == 1) {
|
||||
return true;
|
||||
} else if (activity.getRestrictLimit() == 2) {
|
||||
TrainSignUpTypeLimit trainSignUpTypeLimit = dao().fetch(TrainSignUpTypeLimit.class, Cnd.where("typeId", "=", courseType).and("activityId", "=", activityId));
|
||||
if(trainSignUpTypeLimit == null) {
|
||||
return true;
|
||||
}
|
||||
//此类型的班最多可报几项
|
||||
int personMaxRegisterNum = trainSignUpTypeLimit.getLimitNum();
|
||||
if (personMaxRegisterNum == 0) {
|
||||
return true;
|
||||
}
|
||||
return hasRegisterNum < personMaxRegisterNum;
|
||||
} else if (activity.getRestrictLimit() == 3) {
|
||||
//第三种,限制报几个,不跟类型挂钩
|
||||
int aCount = dao().count(TrainSignUpUser.class, Cnd.where("activityId", "=", activityId).and("userId", "=", SecurityUtil.getUserId()));
|
||||
return aCount < activity.getLimitNum();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignCourseByUser(String courseId, String userId) {
|
||||
int count = dao().count(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId));
|
||||
return dao().count(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId)) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doQd(String id) {
|
||||
NutMap updateMap = NutMap.NEW();
|
||||
updateMap.put("isAttend", true);
|
||||
updateMap.put("attendTime", new Date());
|
||||
dao().update(TrainSignUpUserCourse.class, Chain.from(updateMap), Cnd.where("id", "=", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> qdInfoByUserId(String userId, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
t.courseLocationCoordinates,
|
||||
t.isMobileSign,
|
||||
t.signType,
|
||||
t.isReceiveGift,
|
||||
t.giftType,
|
||||
(select state from train_sign_up_user su where su.activityId = c.activityId and su.courseId = c.courseId and su.userId = c.userId) as state
|
||||
FROM
|
||||
`train_sign_up_user_course` c
|
||||
LEFT JOIN train_sign_up_course t ON t.id = c.courseId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("c.activityId", "=", activityId);
|
||||
cnd.and("c.userId", "=", userId);
|
||||
cnd.asc("c.courseStartTime");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUser;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月03日 10:02:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@Slf4j
|
||||
public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImpl<TrainSignUpUser> implements TrainSignUpActivityStatisticsService {
|
||||
|
||||
public TrainSignUpActivityStatisticsServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuc.id,
|
||||
tsuc.courseName,
|
||||
tsuc.coursePeopleNumber,
|
||||
tsuc.courseReservedNumber,
|
||||
type.lxname as courseType,
|
||||
tsuc.courseLocation,
|
||||
tsuc.courseInstructor,
|
||||
tsuc.reserveMode,
|
||||
tsuc.isMobileSign,
|
||||
tsuc.hostUnionId,
|
||||
tsuc.interTime,
|
||||
tsuc.openOtherUnion,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user WHERE courseId = tsuc.id ) registerNum
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
LEFT JOIN
|
||||
train_sign_up_type type on tsuc.courseType = type.id
|
||||
WHERE
|
||||
tsuc.activityId = @activityId
|
||||
ORDER BY tsuc.orderNum
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> registerUserList(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state
|
||||
FROM
|
||||
train_sign_up_user tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuu.id,
|
||||
u.id as userId,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
tsuu.signUpTime,
|
||||
tsuu.state
|
||||
FROM
|
||||
train_sign_up_user tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("tsuu.courseId", "=", courseId);
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.andLike("username", searchKeyword).orLike("loginname", searchKeyword);
|
||||
cnd.and(group);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<NutMap>> getSignInfo(String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tsuuc.courseStartTime,
|
||||
tsuuc.courseEndTime,
|
||||
tsuuc.isAttend,
|
||||
tsuuc.attendTime,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unitname,
|
||||
u.unionname
|
||||
FROM
|
||||
`train_sign_up_user_course` tsuuc
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuuc.userId
|
||||
WHERE
|
||||
tsuuc.courseId = @courseId
|
||||
""");
|
||||
sql.setParam("courseId", courseId);
|
||||
List<NutMap> list = listMap(sql);
|
||||
|
||||
Map<String, List<NutMap>> courseTimeMap = list.stream().map(v -> {
|
||||
String courseTime = v.getString("courseStartTime") + " 至 " + v.getString("courseEndTime");
|
||||
v.put("courseTime", courseTime);
|
||||
return v;
|
||||
}).collect(Collectors.groupingBy(v -> v.getString("courseTime")));
|
||||
|
||||
// 使用Stream API进行降序排序
|
||||
Map<String, List<NutMap>> sortedDataMap = courseTimeMap.entrySet().stream()
|
||||
.sorted(Map.Entry.comparingByKey(Comparator.reverseOrder()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
|
||||
|
||||
return sortedDataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> baoMingUserList(String activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
uc.courseName,
|
||||
uc.campus
|
||||
FROM
|
||||
`train_sign_up_user` uu
|
||||
RIGHT JOIN train_sign_up_course uc ON uc.id = uu.courseId
|
||||
LEFT JOIN `vw_user` u ON u.id = uu.userId
|
||||
WHERE
|
||||
uc.activityId = @activityId
|
||||
ORDER BY u.unitCode,u.unioncode,u.sex
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.budwk.app.zhgh.activity.trainSignUp.service.impl;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpBlackList;
|
||||
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpBlackListService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Criteria;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zxy
|
||||
* @Description TODO
|
||||
* @createTime 2022年03月07日 14:29:00
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class TrainSignUpUserServiceImpl extends BaseServiceImpl<TrainSignUpBlackList> implements TrainSignUpBlackListService {
|
||||
|
||||
public TrainSignUpUserServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id AS userId,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
tsuc.courseName,
|
||||
tsuu.state,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId $var) tourseTotal,
|
||||
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId AND isAttend = 0 and tsuu.state!=2 AND now()> courseEndTime $var) AS absentCount,
|
||||
if(tsubl.isDisabled=1,true,false) isDisabled,
|
||||
group_CONCAT( tsuc.courseName ) AS courseNames
|
||||
FROM
|
||||
`train_sign_up_user` tsuu
|
||||
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
|
||||
LEFT JOIN train_sign_up_activity act on act.id = tsuu.activityId
|
||||
LEFT JOIN train_sign_up_course tsuc ON tsuc.id = tsuu.courseId
|
||||
LEFT JOIN train_sign_up_black_list tsubl on tsubl.userId = tsuu.userId
|
||||
$condition
|
||||
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 )
|
||||
""");
|
||||
cnd.groupBy("tsuu.userId");
|
||||
Criteria varCnd = Cnd.cri();
|
||||
varCnd.where().setTop(false);
|
||||
varCnd.where().andEX("activityId", "=", activityId);
|
||||
varCnd.where().andEX("courseId", "=", courseId);
|
||||
if (!varCnd.where().isEmpty()) {
|
||||
sql.vars().set("var", "and " + varCnd.toSql(null));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doHandleUser(String userId) {
|
||||
TrainSignUpBlackList blackRecord = dao().fetch(TrainSignUpBlackList.class, Cnd.where("userId", "=", userId));
|
||||
if (Lang.isEmpty(blackRecord)) {
|
||||
TrainSignUpBlackList blackList = new TrainSignUpBlackList();
|
||||
blackList.setUserId(userId);
|
||||
blackList.setIsDisabled(true);
|
||||
dao().insert(blackList);
|
||||
} else {
|
||||
// blackRecord.setIsDisabled(!blackRecord.getIsDisabled());
|
||||
// dao().update(blackRecord);
|
||||
dao().delete(blackRecord);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> attendClassRecord(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.courseName,
|
||||
uc.courseStartTime,
|
||||
courseEndTime,
|
||||
uc.isAttend,
|
||||
uc.attendTime
|
||||
FROM
|
||||
`train_sign_up_user_course` uc
|
||||
LEFT JOIN train_sign_up_course c ON c.id = uc.courseId
|
||||
WHERE
|
||||
uc.userId = @userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
return listMap(sql);
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection_upload;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_subjectType;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_worksType;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/activity/worksCollection/common")
|
||||
@Ok("json:full")
|
||||
public class ActivityWorksCollectionCommonController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
public Result listActivity(Long year) {
|
||||
Dao extDao = Daos.ext(dao, FieldFilter.create(Activity_works_collection.class, "^id|name|subjectTypes$"));
|
||||
List<Activity_works_collection> list = extDao.query(Activity_works_collection.class, Cnd.where("enable", "=", 1).andEX("year(startDateTime)", "=", year).desc("startDateTime"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
public Result getSubjectTypes(String activityId) {
|
||||
List<Activity_works_subjectType> list = dao.query(Activity_works_subjectType.class, Cnd.where("activityId", "=", activityId));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
public Result getWorksTypes(String subjectId) {
|
||||
List<Activity_works_worksType> list = dao.query(Activity_works_worksType.class, Cnd.where("subjectId", "=", subjectId));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection")
|
||||
public Result findOne(@Valid String id) {
|
||||
// Activity_works_collection_upload upload = dao.fetch(Activity_works_collection_upload.class, id);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
up.*,
|
||||
co.NAME AS activityName,
|
||||
su.typeName AS subjectName,
|
||||
wo.worksTypeName AS worksName
|
||||
FROM
|
||||
`activity_works_collection_upload` up
|
||||
LEFT JOIN activity_works_collection co ON up.activityId = co.id
|
||||
LEFT JOIN activity_works_subjecttype su ON up.subjectId = su.id
|
||||
LEFT JOIN activity_works_workstype wo ON up.worksId = wo.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("up.id", "=", id);
|
||||
sql.setCondition(cnd);
|
||||
NutMap result = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
|
||||
return Result.success(result);
|
||||
}
|
||||
}
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysMsgService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection_upload;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_subjectType;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_worksType;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
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.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动管理
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/worksCollection/manage")
|
||||
@Ok("json:full")
|
||||
public class ActivityWorksCollectionManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/activity/workscollection/manage/index.html")
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
public Result pageData(@Valid PageForm pageForm, Long year) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
wc.*,
|
||||
u.username as userName
|
||||
from
|
||||
activity_works_collection wc
|
||||
LEFT JOIN vw_user u on u.id = wc.createdBy
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("year(startDateTime)", "=", year);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike("name", pageForm.getSearchKeyword());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
public Result insert(@Param("data") @Valid Activity_works_collection worksCollection) {
|
||||
worksCollection.setIsSubmit(true);
|
||||
dao.insertWith(worksCollection, "subjectTypes");
|
||||
worksCollection.getSubjectTypes().forEach(item -> {
|
||||
dao.insertLinks(item, "worksTypes");
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
public Result save(@Param("data") @Valid Activity_works_collection worksCollection) {
|
||||
worksCollection.setIsSubmit(false);
|
||||
dao.insertWith(worksCollection, "subjectTypes");
|
||||
worksCollection.getSubjectTypes().forEach(item -> {
|
||||
dao.insertLinks(item, "worksTypes");
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result update(@Param("data") @Valid Activity_works_collection worksCollection) {
|
||||
dao.update(worksCollection);
|
||||
dao.updateLinks(worksCollection, "subjectTypes");
|
||||
dao.insertLinks(worksCollection, "subjectTypes");
|
||||
//清除页面已经删除的
|
||||
dao.clear(Activity_works_subjectType.class,
|
||||
Cnd.where(Activity_works_subjectType::getActivityId, "=", worksCollection.getId())
|
||||
.andEX("id", "not in", worksCollection.getSubjectTypes().stream().map(Activity_works_subjectType::getId).toList()));
|
||||
|
||||
worksCollection.getSubjectTypes().forEach(item -> {
|
||||
dao.updateLinks(item, "worksTypes");
|
||||
dao.insertLinks(item, "worksTypes");
|
||||
//清除页面已经删除的
|
||||
List<String> workIds = item.getWorksTypes().stream().map(Activity_works_worksType::getId).toList();
|
||||
dao.clear(Activity_works_worksType.class,
|
||||
Cnd.where(Activity_works_worksType::getId, "not in ", workIds)
|
||||
.and(Activity_works_worksType::getSubjectId,"=",item.getId()));
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result delete(@Valid String id) {
|
||||
dao.delete(Activity_works_collection.class, id);
|
||||
dao.clear(Activity_works_collection_upload.class, Cnd.where(Activity_works_collection_upload::getActivityId, "=", id));
|
||||
dao.clear(Activity_works_subjectType.class, Cnd.where(Activity_works_subjectType::getActivityId, "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
public Result findOne(@Valid String id) {
|
||||
Activity_works_collection worksCollection = dao.fetch(Activity_works_collection.class, id);
|
||||
dao.fetchLinks(worksCollection, "subjectTypes");
|
||||
worksCollection.getSubjectTypes().forEach(item -> {
|
||||
dao.fetchLinks(item, "worksTypes");
|
||||
});
|
||||
return Result.success(worksCollection);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
public Result enableChange(@Valid String id, @Valid Boolean enable) {
|
||||
dao.update(Activity_works_collection.class, Chain.make("enable", enable), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.manage")
|
||||
public Result sendNotice(@Valid String id) {
|
||||
Activity_works_collection activity = dao.fetch(Activity_works_collection.class, id);
|
||||
Integer activityGroupId = activity.getActivityGroupId();
|
||||
List<String> loginNames;
|
||||
if (activityGroupId != null) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
loginname
|
||||
FROM
|
||||
sys_user
|
||||
WHERE
|
||||
id IN (SELECT userId FROM activity_user_scope WHERE groupId = @groupId)
|
||||
""");
|
||||
sql.setParam("groupId", activityGroupId);
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(sql);
|
||||
loginNames = sql.getList(String.class);
|
||||
} else {
|
||||
loginNames = new ArrayList<>();
|
||||
}
|
||||
if (ObjectUtil.isEmpty(loginNames)) {
|
||||
return Result.error("活动没有面向对象人员,请先设置后再发送通知!");
|
||||
}
|
||||
String content = activity.getContent();
|
||||
String activityName = activity.getName();
|
||||
sysMsgService.sendMsgInSys(loginNames, activityName + "(作品征集活动)", content, SecurityUtil.getUserId());
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.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 cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.services.SysFileService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection_upload;
|
||||
import com.budwk.app.zhgh.activity.workscollection.param.ActivityWorksCollectionReadPageParam;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
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.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.ByteInputStream;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 作品阅览
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/worksCollection/read")
|
||||
@Ok("json:full")
|
||||
public class ActivityWorksCollectionReadController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private SysFileService sysFileService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/activity/workscollection/read/index.html")
|
||||
@SaCheckPermission("activity.workscollection.read")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.read")
|
||||
public Result pageData(@Valid ActivityWorksCollectionReadPageParam pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
up.*,
|
||||
co.NAME AS activityName,
|
||||
su.typeName AS subjectName,
|
||||
wo.worksTypeName AS worksName
|
||||
from
|
||||
activity_works_collection_upload up
|
||||
LEFT JOIN activity_works_collection co ON up.activityId = co.id
|
||||
LEFT JOIN activity_works_subjecttype su ON up.subjectId = su.id
|
||||
LEFT JOIN activity_works_workstype wo ON up.worksId = wo.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(co.startDateTime)","=",pageForm.getYear());
|
||||
cnd.andEX("up.activityId", "=", pageForm.getActivityId());
|
||||
cnd.andEX("up.subjectId", "=", pageForm.getSubjectId());
|
||||
cnd.andEX("up.worksId", "=", pageForm.getWorksId());
|
||||
cnd.andEX("unionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("unitId", "=", pageForm.getUnitId());
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("up.unionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.read")
|
||||
public Result delete(@Valid String id) {
|
||||
dao.delete(Activity_works_collection_upload.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.workscollection.read")
|
||||
public void exportExcel(ActivityWorksCollectionReadPageParam pageForm, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
up.*,
|
||||
co.NAME AS activityName,
|
||||
su.typeName AS subjectName,
|
||||
wo.worksTypeName AS worksName,
|
||||
u.sex
|
||||
from
|
||||
activity_works_collection_upload up
|
||||
LEFT JOIN activity_works_collection co ON up.activityId = co.id
|
||||
LEFT JOIN activity_works_subjecttype su ON up.subjectId = su.id
|
||||
LEFT JOIN activity_works_workstype wo ON up.worksId = wo.id
|
||||
LEFT JOIN `vw_user` u on u.id = up.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("up.activityId", "=", pageForm.getActivityId());
|
||||
cnd.andEX("up.subjectId", "=", pageForm.getSubjectId());
|
||||
cnd.andEX("up.worksId", "=", pageForm.getWorksId());
|
||||
cnd.andEX("unionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("unitId", "=", pageForm.getUnitId());
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("up.unionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = baseService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属单位", "unitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("活动主题", "activityName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("主题类型", "subjectName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("作品类型", "worksName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("作品名称", "name", 20));
|
||||
exportEntities.add(new ExcelExportEntity("作品描述", "description", 20));
|
||||
//exportEntities.add(new ExcelExportEntity("点赞次数", "dz_num", 20));
|
||||
|
||||
try {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, listMap);
|
||||
CommonDownloadUtil.download("作品征集参与人员.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.workscollection.read")
|
||||
public void exportWorks(ActivityWorksCollectionReadPageParam pageForm, HttpServletResponse response) throws IOException {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLUtil.encode("作品征集数据.zip"));
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("up.activityId", "=", pageForm.getActivityId());
|
||||
cnd.andEX("typeName", "=", pageForm.getTypeName());
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("loginName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
cnd.and("unionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
List<Activity_works_collection_upload> collectionUploads = dao.query(Activity_works_collection_upload.class, cnd);
|
||||
|
||||
List<Activity_works_collection> worksCollections = dao.query(Activity_works_collection.class, Cnd.NEW());
|
||||
Map<String, String> worksCollectionMap = worksCollections.stream().collect(Collectors.toMap(Activity_works_collection::getId, Activity_works_collection::getName));
|
||||
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
collectionUploads.forEach(item -> {
|
||||
try {
|
||||
String activityName = worksCollectionMap.get(item.getActivityId());
|
||||
for (JSONObject file : item.getFiles()) {
|
||||
|
||||
String fileName = file.getStr("name");
|
||||
|
||||
JSONObject entries = file.getJSONObject("response");
|
||||
String filepath = entries.getStr("data");
|
||||
|
||||
if(StrUtil.isNotBlank(filepath)){
|
||||
int indexOf = filepath.lastIndexOf("?");
|
||||
String fileId = filepath.substring(indexOf+4);
|
||||
zipOutputStream.putNextEntry(new ZipEntry(item.getUserName() + "【" + item.getName() + "】" + DateUtil.formatDateTime(new Date(item.getCreatedAt())) + "/" + fileName));
|
||||
byte[] bytes = sysFileService.download(fileId);
|
||||
ByteInputStream byteIs = new ByteInputStream(bytes);
|
||||
IOUtils.copy(byteIs, zipOutputStream);
|
||||
byteIs.close();
|
||||
}
|
||||
}
|
||||
zipOutputStream.closeEntry();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
zipOutputStream.flush();
|
||||
zipOutputStream.close();
|
||||
}
|
||||
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.controller;
|
||||
|
||||
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.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection;
|
||||
import com.budwk.app.zhgh.activity.workscollection.models.Activity_works_collection_upload;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 作品上传
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/worksCollection/upload")
|
||||
@Ok("json:full")
|
||||
public class ActivityWorksCollectionUploadController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/activity/workscollection/upload/index.html")
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pageForm 分页
|
||||
* @param activityId 活动id
|
||||
* @param subjectId 作品类型
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public Result pageData(@Valid PageForm pageForm, String activityId, String subjectId, String worksId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
up.*,
|
||||
co.NAME AS activityName,
|
||||
su.typeName AS subjectName,
|
||||
wo.worksTypeName AS worksName
|
||||
from
|
||||
activity_works_collection_upload up
|
||||
LEFT JOIN activity_works_collection co ON up.activityId = co.id
|
||||
LEFT JOIN activity_works_subjecttype su ON up.subjectId = su.id
|
||||
LEFT JOIN activity_works_workstype wo ON up.worksId = wo.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userId", "=", SecurityUtil.getUserId());
|
||||
cnd.andEX("up.activityId", "=", activityId);
|
||||
cnd.andEX("up.subjectId", "=", subjectId);
|
||||
cnd.andEX("up.worksId", "=", worksId);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传作品
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public Result insert(@Param("data") @Valid Activity_works_collection_upload upload) {
|
||||
String activityId = upload.getActivityId();
|
||||
Activity_works_collection activity = dao.fetch(Activity_works_collection.class, activityId);
|
||||
if (activity.getActivityGroupId() != null) {
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where(ActivityUserScope::getGroupId, "=", activity.getActivityGroupId())
|
||||
.and(ActivityUserScope::getUserId, "=", SecurityUtil.getUserId()));
|
||||
if (count == 0) {
|
||||
return Result.error("您没有权限参与该活动");
|
||||
}
|
||||
}
|
||||
|
||||
View_user vwUser = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
|
||||
upload.setUserId(SecurityUtil.getUserId());
|
||||
upload.setUserName(SecurityUtil.getUserUsername());
|
||||
upload.setLoginName(SecurityUtil.getUserLoginname());
|
||||
upload.setUnitId(SecurityUtil.getUnitId());
|
||||
upload.setUnitName(vwUser.getUnitName());
|
||||
upload.setUnionId(SecurityUtil.getUnionId());
|
||||
upload.setUnionName(vwUser.getUnionName());
|
||||
|
||||
dao.insert(upload);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public Result update(@Param("data") @Valid Activity_works_collection_upload upload) {
|
||||
dao.updateIgnoreNull(upload);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public Result findOne(@Valid String id) {
|
||||
Activity_works_collection_upload upload = dao.fetch(Activity_works_collection_upload.class, id);
|
||||
return Result.success(upload);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public Result delete(@Valid String id) {
|
||||
dao.delete(Activity_works_collection_upload.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
@ApiOperation("获取有权限的活动列表")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
public Result listPerMissionActivity() {
|
||||
Dao extDao = Daos.ext(dao, FieldFilter.create(Activity_works_collection.class, "id|name|"));
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(Activity_works_collection::getEnable,"=",1);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(Activity_works_collection::getActivityGroupId,"=","");
|
||||
seg.or(Activity_works_collection::getActivityGroupId,"is",null);
|
||||
seg.or(Activity_works_collection::getActivityGroupId,"in",Sqls.create("select groupId from activity_user_scope where userId = @userId").setParam("userId",SecurityUtil.getUserId()));
|
||||
cnd.and(seg);
|
||||
cnd.desc(Activity_works_collection::getStartDateTime);
|
||||
List<Activity_works_collection> list = extDao.query(Activity_works_collection.class, cnd);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.controller.h5;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* 手机端作品征集
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/h5/activity/worksCollection")
|
||||
@Ok("json:full")
|
||||
public class H5ActivityWorksCollectionController {
|
||||
|
||||
/**
|
||||
* 活动列表页面
|
||||
*/
|
||||
@At("/activity")
|
||||
@Ok("beetl:/platform/zhghh5/activity/workscollection/activity/index.html")
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public void activity() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传页面
|
||||
*/
|
||||
@At("/upload")
|
||||
@Ok("beetl:/platform/zhghh5/activity/workscollection/upload/index.html")
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public void upload() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的上传页面
|
||||
*/
|
||||
@At("/upload/mine")
|
||||
@Ok("beetl:/platform/zhghh5/activity/workscollection/upload/mine.html")
|
||||
@SaCheckPermission("activity.workscollection.upload")
|
||||
public void uploadMine() {
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.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;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("activity_works_collection")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("作品征集活动")
|
||||
public class Activity_works_collection extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@NotBlank(message = "活动名称不能为空")
|
||||
@Size(message = "活动名称最多50个字")
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("活动内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
@NotBlank(message = "活动内容不能为空")
|
||||
private String content;
|
||||
|
||||
@Column
|
||||
@Comment("活动介绍")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String introduce;
|
||||
|
||||
@Column
|
||||
@Comment("奖励方式")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String rewardMethod;
|
||||
|
||||
@Column
|
||||
@Comment("活动开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@NotNull(message = "活动开始时间不能为空")
|
||||
private Date startDateTime;
|
||||
|
||||
@Column
|
||||
@Comment("活动结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@NotNull(message = "活动结束时间不能为空")
|
||||
private Date endDateTime;
|
||||
|
||||
@Column
|
||||
@Comment("点赞开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date nbStartDateTime;
|
||||
|
||||
@Column
|
||||
@Comment("点赞结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date nbEndDateTime;
|
||||
|
||||
@Column
|
||||
@Comment("每人每日点赞次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer nbCount;
|
||||
|
||||
@Column
|
||||
@Comment("配色")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String activityColor;
|
||||
|
||||
@Column
|
||||
@Comment("封面图")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@Comment("活动状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "1")
|
||||
private Boolean enable;
|
||||
|
||||
@Column
|
||||
@Comment("活动人员参加范围Id")
|
||||
@ColDefine(type = ColType.INT, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型(教工、亲子等等)")
|
||||
@ColDefine(type = ColType.VARCHAR)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("是否提交")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "1")
|
||||
private Boolean isSubmit;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<Activity_works_subjectType> subjectTypes;
|
||||
|
||||
@Many(field = "activityId")
|
||||
private List<Activity_works_collection_upload> uploads;
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
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 javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("activity_works_collection_upload")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("作品征集上传作品")
|
||||
public class Activity_works_collection_upload extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32, notNull = true)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("上报人id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32, notNull = true)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("上报人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100, notNull = true)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("上报人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100, notNull = true)
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@Comment("上报人单位id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200, notNull = true)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("上报人单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200, notNull = true)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("上报人分工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32, notNull = true)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("上报人分工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50, notNull = true)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("主题类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32, notNull = true)
|
||||
@NotBlank(message = "主题类型不能为空")
|
||||
private String subjectId;
|
||||
|
||||
@Column
|
||||
@Comment("作品类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32, notNull = true)
|
||||
@NotBlank(message = "作品类型不能为空")
|
||||
private String worksId;
|
||||
|
||||
@Column
|
||||
@Comment("作品名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100, notNull = true)
|
||||
@NotBlank(message = "作品名称不能为空")
|
||||
@Size(max = 100, message = "作品名称最多100个字")
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("作品描述")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100, notNull = true)
|
||||
@NotBlank(message = "作品描述不能为空")
|
||||
@Size(max = 100, message = "作品描述最多100个字")
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Comment("附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@NotEmpty(message = "附件不能为空")
|
||||
private List<JSONObject> files;
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("activity_works_subjectType")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("作品征集主题类型")
|
||||
public class Activity_works_subjectType extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityId;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String typeName;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private int location;
|
||||
|
||||
@Many(field = "subjectId")
|
||||
private List<Activity_works_worksType> worksTypes;
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("activity_works_worksType")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("作品征集作品类型")
|
||||
public class Activity_works_worksType extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("主题id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String subjectId;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String worksTypeName;
|
||||
|
||||
@Column
|
||||
@Comment("作品介绍最多字数")
|
||||
@ColDefine(type = ColType.INT, width = 20)
|
||||
private Integer maxWordCount;
|
||||
|
||||
@Column
|
||||
@Comment("允许上传的文件类型")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> allowFileTypes;
|
||||
|
||||
@Column
|
||||
@Comment("允许上传的文件数量")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer allowFileNum;
|
||||
|
||||
@Column
|
||||
@Comment("单个文件大小(kb)")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer allowSingleFileSize;
|
||||
|
||||
@Column
|
||||
@Comment("总文件大小(kb)")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer allowTotalFileSize;
|
||||
|
||||
@Column
|
||||
@Comment("是否上传图片")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isUploadPhoto;
|
||||
|
||||
@Column
|
||||
@Comment("上传图片数量")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer photoNum;
|
||||
|
||||
@Column
|
||||
@Comment("上传图片格式")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> photoType;
|
||||
|
||||
@Column
|
||||
@Comment("每张图片大小")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer photoSize;
|
||||
|
||||
@Column
|
||||
@Comment("是否上传音/视频、文档")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isUploadOther;
|
||||
|
||||
@Column
|
||||
@Comment("上传音/视频、文档数量")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer otherFileNum;
|
||||
|
||||
@Column
|
||||
@Comment("上传音/视频、文档格式")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> otherType;
|
||||
|
||||
@Column
|
||||
@Comment("每个音/视频、文档大小")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer otherSize;
|
||||
|
||||
@Column
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private int location;
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.zhgh.activity.workscollection.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ActivityWorksCollectionReadPageParam extends PageForm {
|
||||
|
||||
private String activityId;
|
||||
|
||||
private String typeName;
|
||||
|
||||
private String subjectId;
|
||||
|
||||
private String worksId;
|
||||
|
||||
private String unionId;
|
||||
|
||||
private String unitId;
|
||||
|
||||
private Long year;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user