commit
This commit is contained in:
+30
-3
@@ -24,6 +24,8 @@ 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 com.budwk.app.zhgh.activity.basic.template.UserTemp;
|
||||
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.commons.lang3.ArrayUtils;
|
||||
@@ -84,6 +86,9 @@ public class ActivityBasicScopeController {
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
@Inject
|
||||
private SysClubService sysClubService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/basic/userScope/index.html")
|
||||
@SaCheckPermission("activity.basic.scope")
|
||||
@@ -216,6 +221,7 @@ public class ActivityBasicScopeController {
|
||||
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_CLUB_PRESIDENT", StpUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name()));
|
||||
addv("is_sysadmin", StpUtil.hasRole(RoleConstant.SYSADMIN.name()));
|
||||
addv("unionid", SecurityUtil.getUnionId());
|
||||
}});
|
||||
@@ -347,9 +353,30 @@ public class ActivityBasicScopeController {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())){
|
||||
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
boolean isBranchUnionChairman = AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name());
|
||||
boolean isClubPresident = AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name());
|
||||
if (isBranchUnionChairman && isClubPresident) {
|
||||
// 同时具备分工会主席和社团会长身份时,未额外筛选前默认查看两类权限范围的并集。
|
||||
List<String> manageClubIdList = sysClubService.getMyManageClub().stream().map(SysClub::getId).toList();
|
||||
SqlExpressionGroup scopeGroup = new SqlExpressionGroup();
|
||||
scopeGroup.or("u.unionid", "=", SecurityUtil.getUnionId());
|
||||
if (!manageClubIdList.isEmpty()) {
|
||||
scopeGroup.or("clubuser.clubid", "in", manageClubIdList);
|
||||
}
|
||||
cnd.and(scopeGroup);
|
||||
} else if (isClubPresident) {
|
||||
// 社团会长设置活动人员范围时,只允许查看自己可管理社团下的成员。
|
||||
List<String> manageClubIdList = sysClubService.getMyManageClub().stream().map(SysClub::getId).toList();
|
||||
if (manageClubIdList.isEmpty()) {
|
||||
cnd.and("clubuser.clubid", "in", List.of("__EMPTY_CLUB_ID__"));
|
||||
} else {
|
||||
cnd.and("clubuser.clubid", "in", manageClubIdList);
|
||||
}
|
||||
} else {
|
||||
// 分工会主席等分工会侧角色,继续只允许查看本分工会人员。
|
||||
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
}
|
||||
cnd.andEX("u.unionid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnionId());
|
||||
cnd.andEX("u.unitid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnitId());
|
||||
|
||||
+12
-2
@@ -21,6 +21,7 @@ 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.json.Json;
|
||||
@@ -125,8 +126,17 @@ public class ActivityCultureApplyUserController {
|
||||
public Result queryTeammate(@Valid String keyword, Integer signUpMethod, String tissueId) {
|
||||
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));
|
||||
SqlExpressionGroup keywordGroup = new SqlExpressionGroup();
|
||||
keywordGroup.andLike("username", keyword);
|
||||
keywordGroup.orLike("loginname", keyword);
|
||||
cnd.and(keywordGroup);
|
||||
if (StrUtil.isNotBlank(tissueId)) {
|
||||
ActivityTissue tissue = dao.fetch(ActivityTissue.class, tissueId);
|
||||
// 组队/分工会报名选人时,候选人必须落在活动新建时配置的参加人员范围内。
|
||||
if (ObjectUtil.isNotNull(tissue) && ObjectUtil.isNotNull(tissue.getGroupId())) {
|
||||
cnd.and("id", "in", activityBasicScopeService.buildGroupUserIdSubSql(tissue.getGroupId()));
|
||||
}
|
||||
}
|
||||
if (signUpMethod == 3) {
|
||||
cnd.and("unionid", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
|
||||
+5
@@ -161,6 +161,11 @@ public class ActivityCultureUserStatisticsController {
|
||||
cnd.and("tissue.signUpMethod", "in", List.of(1, 2, 3));
|
||||
if (activity_type == 40002) {
|
||||
cnd.and("tissue.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("tissue.clubId", "in", clubIdList);
|
||||
}
|
||||
}
|
||||
// 只查询流程实例状态为20的数据(已完成状态)
|
||||
|
||||
+6
-5
@@ -169,34 +169,35 @@ public class ActivityPrizeListController {
|
||||
Map fourMap = NutMap.NEW();
|
||||
Map fiveMap = NutMap.NEW();
|
||||
|
||||
// 部分历史数据可能未配置竞赛类别,分组汇总时需要做空值保护,避免筛选时空指针
|
||||
//甲组
|
||||
List<NutMap> oneList = allList.stream().filter(a -> a.getString("bszbName").equals("甲组")).collect(toList());
|
||||
List<NutMap> oneList = allList.stream().filter(a -> Objects.equals("甲组", a.getString("bszbName"))).collect(toList());
|
||||
if (Lang.isNotEmpty(oneList)) {
|
||||
oneMap = oneList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
//乙组
|
||||
List<NutMap> twoList = allList.stream().filter(a -> a.getString("bszbName").equals("乙组")).collect(toList());
|
||||
List<NutMap> twoList = allList.stream().filter(a -> Objects.equals("乙组", a.getString("bszbName"))).collect(toList());
|
||||
if (Lang.isNotEmpty(twoList)) {
|
||||
twoMap = twoList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
|
||||
//丙组
|
||||
List<NutMap> threeList = allList.stream().filter(a -> a.getString("bszbName").equals("丙组")).collect(toList());
|
||||
List<NutMap> threeList = allList.stream().filter(a -> Objects.equals("丙组", a.getString("bszbName"))).collect(toList());
|
||||
if (Lang.isNotEmpty(threeList)) {
|
||||
threeMap = threeList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
|
||||
//丁组
|
||||
List<NutMap> fourList = allList.stream().filter(a -> a.getString("bszbName").equals("丁组")).collect(toList());
|
||||
List<NutMap> fourList = allList.stream().filter(a -> Objects.equals("丁组", a.getString("bszbName"))).collect(toList());
|
||||
if (Lang.isNotEmpty(fourList)) {
|
||||
fourMap = fourList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
//团体
|
||||
List<NutMap> fiveList = allList.stream().filter(a -> a.getString("bszbName").equals("团体")).collect(toList());
|
||||
List<NutMap> fiveList = allList.stream().filter(a -> Objects.equals("团体", a.getString("bszbName"))).collect(toList());
|
||||
if (Lang.isNotEmpty(fiveList)) {
|
||||
fiveMap = fiveList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
+45
@@ -2,6 +2,7 @@ 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.exception.BaseException;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
@@ -9,6 +10,8 @@ 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.service.ActivitySportsApplyUserService;
|
||||
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -19,7 +22,12 @@ 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 org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -45,6 +53,10 @@ public class ActivitySportsReadingController {
|
||||
public Dao dao;
|
||||
@Inject
|
||||
public BaseService baseService;
|
||||
@Inject
|
||||
private ActivitySportsService activitySportsService;
|
||||
@Inject
|
||||
private ActivitySportsApplyUserService activitySportsApplyUserService;
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.reading")
|
||||
@@ -150,5 +162,38 @@ public class ActivitySportsReadingController {
|
||||
return Result.success(apply);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.reading")
|
||||
public void downloadImportTemplate(HttpServletResponse response) {
|
||||
checkManageRole();
|
||||
activitySportsApplyUserService.downloadImportTemplate(response);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.reading")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Result importUserActivitys(@Param("file") TempFile file, @Param("businessId") String activityId) {
|
||||
checkManageRole();
|
||||
return Result.success(activitySportsApplyUserService.importUserActivitys(file, activityId));
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.reading")
|
||||
public void doExportByEnroll(String id, String unionId, HttpServletResponse response) {
|
||||
checkManageRole();
|
||||
activitySportsService.exportXlsx(id, unionId, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参考原项目,导入和整表导出只开放给校工会管理员和系统管理员,避免普通阅览权限误操作。
|
||||
*/
|
||||
private void checkManageRole() {
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
throw new BaseException("您没有操作权限");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+18
@@ -6,7 +6,9 @@ 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 org.nutz.mvc.upload.TempFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivitySportsApplyUserService extends BaseService<ActivitySchoolApply> {
|
||||
@@ -31,4 +33,20 @@ public interface ActivitySportsApplyUserService extends BaseService<ActivityScho
|
||||
|
||||
List<NutMap> getUserUnion(String query);
|
||||
|
||||
/**
|
||||
* 下载报名人员导入模板。
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
void downloadImportTemplate(HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入报名人员并返回错误明细,全部成功时返回 null。
|
||||
*
|
||||
* @param file 导入文件
|
||||
* @param activityId 活动ID
|
||||
* @return 导入错误统计
|
||||
*/
|
||||
NutMap importUserActivitys(TempFile file, String activityId);
|
||||
|
||||
}
|
||||
|
||||
+234
-1
@@ -1,22 +1,33 @@
|
||||
package com.budwk.app.zhgh.activity.sports.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityEvent;
|
||||
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.service.ActivityBasicScopeService;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityBasicUnion;
|
||||
import com.budwk.app.zhgh.activity.basic.service.ActivityBasicScopeService;
|
||||
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.ActivitySchoolEvent;
|
||||
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 com.budwk.app.zhgh.activity.sports.template.ActivitySportsApplyImportTemp;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -31,7 +42,9 @@ 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.upload.TempFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -487,4 +500,224 @@ public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl<Activity
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadImportTemplate(HttpServletResponse response) {
|
||||
try {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ActivitySportsApplyImportTemp.class, new ArrayList<>());
|
||||
CommonDownloadUtil.download("报名人员导入模板.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
throw new BaseException("下载导入模板失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public NutMap importUserActivitys(TempFile file, String activityId) {
|
||||
if (file == null) {
|
||||
throw new BaseException("请选择导入文件");
|
||||
}
|
||||
if (StrUtil.isBlank(activityId)) {
|
||||
throw new BaseException("请先选择活动名称");
|
||||
}
|
||||
ActivitySchool activitySchool = dao().fetch(ActivitySchool.class, activityId);
|
||||
if (activitySchool == null) {
|
||||
throw new BaseException("活动不存在");
|
||||
}
|
||||
try {
|
||||
List<ActivitySportsApplyImportTemp> importList = ExcelImportUtil.importExcel(file.getFile(), ActivitySportsApplyImportTemp.class, new ImportParams());
|
||||
if (Lang.isEmpty(importList)) {
|
||||
return null;
|
||||
}
|
||||
List<ActivitySportsApplyImportTemp> errorList = new ArrayList<>();
|
||||
int totalCount = 0;
|
||||
int successCount = 0;
|
||||
String currentUnionId = getUnionId();
|
||||
for (ActivitySportsApplyImportTemp importTemp : importList) {
|
||||
totalCount++;
|
||||
String loginName = normalizeLoginName(importTemp.getLoginName());
|
||||
if (StrUtil.isBlank(loginName)) {
|
||||
importTemp.setNotes("工号不能为空");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
Sys_user sysUser = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName));
|
||||
if (sysUser == null) {
|
||||
importTemp.setNotes("此用户不存在,请检查工号");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
ActivityBasicUnit basicUnit = dao().fetch(ActivityBasicUnit.class, Cnd.where("id", "=", sysUser.getUnitId()));
|
||||
if (basicUnit == null) {
|
||||
importTemp.setNotes("请检查该人员活动单位是否配置正确");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
ActivityBasicUnion basicUnion = dao().fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionId()));
|
||||
if (basicUnion == null) {
|
||||
importTemp.setNotes("请检查该人员所属活动工会是否配置正确");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
if (!hasImportAuth() && !basicUnion.getId().equals(currentUnionId)) {
|
||||
importTemp.setNotes("此用户不是当前工会人员");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
String identityName = normalizeIdentityName(importTemp.getIdentity());
|
||||
String projectCode = normalizeText(importTemp.getProjectCode());
|
||||
if (StrUtil.isBlank(projectCode) && StrUtil.isBlank(identityName)) {
|
||||
importTemp.setNotes("项目编号和身份不能同时为空");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
|
||||
ActivitySchoolApply activitySchoolApply = buildBaseApply(activityId, sysUser, basicUnit, basicUnion);
|
||||
if (StrUtil.isNotBlank(identityName)) {
|
||||
fillIdentityInfo(activitySchoolApply, identityName);
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(projectCode) && StrUtil.isNotBlank(identityName)) {
|
||||
replaceUnionRoleUser(activitySchoolApply, identityName);
|
||||
insert(activitySchoolApply);
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
ActivityEvent activityEvent = dao().fetch(ActivityEvent.class, Cnd.where("projectCode", "=", projectCode));
|
||||
if (activityEvent == null) {
|
||||
importTemp.setNotes("项目编号不存在,请检查后重试");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
ActivitySchoolEvent schoolEvent = dao().fetch(ActivitySchoolEvent.class, Cnd.where("activityId", "=", activityId).and("eventId", "=", activityEvent.getId()));
|
||||
if (schoolEvent == null) {
|
||||
importTemp.setNotes("该项目不属于当前活动,请检查项目编号");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
|
||||
activitySchoolApply.setEventId(schoolEvent.getEventId());
|
||||
activitySchoolApply.setAwardsMode(activityEvent.getProjectType());
|
||||
if ("2".equals(activityEvent.getProjectType())) {
|
||||
ActivitySchoolTeam schoolTeam = dao().fetch(ActivitySchoolTeam.class, Cnd.where("activityId", "=", activityId).and("eventId", "=", schoolEvent.getEventId()).asc("location"));
|
||||
if (schoolTeam == null) {
|
||||
importTemp.setNotes("团体项目未配置队伍信息,请先维护小队");
|
||||
errorList.add(importTemp);
|
||||
continue;
|
||||
}
|
||||
activitySchoolApply.setTeamId(schoolTeam.getId());
|
||||
activitySchoolApply.setTeam(schoolTeam.getName());
|
||||
}
|
||||
// 兼容参考项目导入逻辑:带项目编号的记录按运动员处理。
|
||||
activitySchoolApply.setIdentity(List.of("1"));
|
||||
clear(Cnd.where("activityId", "=", activityId).and("userId", "=", sysUser.getId()).and("eventId", "=", schoolEvent.getEventId()));
|
||||
insert(activitySchoolApply);
|
||||
successCount++;
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(errorList)) {
|
||||
NutMap result = NutMap.NEW();
|
||||
result.setv("totalCount", totalCount);
|
||||
result.setv("successCount", successCount);
|
||||
result.setv("errorCount", errorList.size());
|
||||
result.setv("errorList", errorList.stream().map(v -> NutMap.NEW()
|
||||
.addv("工会", normalizeText(v.getUnionName()))
|
||||
.addv("工号", normalizeText(v.getLoginName()))
|
||||
.addv("姓名", normalizeText(v.getUserName()))
|
||||
.addv("性别", normalizeText(v.getSex()))
|
||||
.addv("项目编号", normalizeText(v.getProjectCode()))
|
||||
.addv("身份", normalizeText(v.getIdentity()))
|
||||
.addv("错误信息", normalizeText(v.getNotes()))).collect(Collectors.toList()));
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
throw new BaseException("导入报名人员失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入记录统一补齐报名基础字段,避免多入口写入时字段不一致。
|
||||
*/
|
||||
private ActivitySchoolApply buildBaseApply(String activityId, Sys_user sysUser, ActivityBasicUnit basicUnit, ActivityBasicUnion basicUnion) {
|
||||
ActivitySchoolApply activitySchoolApply = new ActivitySchoolApply();
|
||||
activitySchoolApply.setActivityId(activityId);
|
||||
activitySchoolApply.setUnitId(basicUnit.getId());
|
||||
activitySchoolApply.setUnionId(basicUnion.getId());
|
||||
activitySchoolApply.setApplyUser(SecurityUtil.getUserId());
|
||||
activitySchoolApply.setUserId(sysUser.getId());
|
||||
activitySchoolApply.setLoginname(sysUser.getLoginname());
|
||||
activitySchoolApply.setUsername(sysUser.getUsername());
|
||||
activitySchoolApply.setSex(sysUser.getSex());
|
||||
activitySchoolApply.setMobile(sysUser.getMobile());
|
||||
activitySchoolApply.setProfessionalLevel(sysUser.getProfessionalLevel());
|
||||
activitySchoolApply.setBirthday(sysUser.getBirthday() == null ? null : DateUtil.formatDate(sysUser.getBirthday()));
|
||||
activitySchoolApply.setApplyDate(DateUtil.now());
|
||||
activitySchoolApply.setStatus(2);
|
||||
activitySchoolApply.setUnitname(basicUnit.getName());
|
||||
activitySchoolApply.setActivityUnionId(basicUnion.getId());
|
||||
activitySchoolApply.setActivityUnionName(basicUnion.getName());
|
||||
return activitySchoolApply;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色类导入只保留当前活动当前工会当前人员的一条对应身份记录,防止重复导入产生脏数据。
|
||||
*/
|
||||
private void replaceUnionRoleUser(ActivitySchoolApply activitySchoolApply, String identityName) {
|
||||
Cnd cnd = Cnd.where("activityId", "=", activitySchoolApply.getActivityId())
|
||||
.and("activityUnionId", "=", activitySchoolApply.getActivityUnionId())
|
||||
.and("userId", "=", activitySchoolApply.getUserId());
|
||||
if ("教练".equals(identityName)) {
|
||||
cnd.and("unionCoach", "=", true);
|
||||
} else if ("领队".equals(identityName)) {
|
||||
cnd.and("unionLeader", "=", true);
|
||||
} else if ("团长".equals(identityName)) {
|
||||
cnd.and("unionHead", "=", true);
|
||||
} else if ("工作人员".equals(identityName)) {
|
||||
cnd.and("unionStaff", "=", true);
|
||||
}
|
||||
clear(cnd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一处理导入身份映射,保证页面展示、导出与后续查询读取到一致的身份字段。
|
||||
*/
|
||||
private void fillIdentityInfo(ActivitySchoolApply activitySchoolApply, String identityName) {
|
||||
if ("教练".equals(identityName)) {
|
||||
activitySchoolApply.setUnionCoach(true);
|
||||
activitySchoolApply.setIdentity(List.of("2"));
|
||||
} else if ("领队".equals(identityName)) {
|
||||
activitySchoolApply.setUnionLeader(true);
|
||||
activitySchoolApply.setIdentity(List.of("3"));
|
||||
} else if ("团长".equals(identityName)) {
|
||||
activitySchoolApply.setUnionHead(true);
|
||||
activitySchoolApply.setIdentity(List.of("6"));
|
||||
} else if ("工作人员".equals(identityName)) {
|
||||
activitySchoolApply.setUnionStaff(true);
|
||||
activitySchoolApply.setIdentity(List.of("7"));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasImportAuth() {
|
||||
return AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
|
||||
}
|
||||
|
||||
private String normalizeLoginName(String loginName) {
|
||||
return StrUtil.isBlank(loginName) ? "" : loginName.replaceAll("\\s+", "");
|
||||
}
|
||||
|
||||
private String normalizeText(String text) {
|
||||
return StrUtil.trimToEmpty(text);
|
||||
}
|
||||
|
||||
private String normalizeIdentityName(String identity) {
|
||||
String identityName = normalizeText(identity);
|
||||
if ("运动员".equals(identityName)) {
|
||||
return "";
|
||||
}
|
||||
return identityName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,4 +78,12 @@ public class ClubCommonController {
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result listManageClubByRole() {
|
||||
// 活动人员范围设置只允许按“可管理的社团”选择,避免把仅作为成员加入的社团也展示出来。
|
||||
List<SysClub> clubList = sysClubService.getMyManageClub();
|
||||
return Result.success(clubList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,18 @@ const businessTool = {
|
||||
}
|
||||
})
|
||||
},
|
||||
listManageClubByRole() {
|
||||
return commonUtil
|
||||
.axiosService()
|
||||
.post("/platform/club/common/listManageClubByRole", {})
|
||||
.then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
return resp.data
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取字典数据,不包含禁用
|
||||
* @param code
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
flushUnits()
|
||||
doSearch()
|
||||
"
|
||||
:clearable="is_A06 === true || is_sysadmin === true"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="所属工会"
|
||||
style="width: 100%"
|
||||
@@ -216,7 +216,7 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-select placeholder="请选择教代会" v-model="pageForm.sessionId" clearable style="width: 100%">
|
||||
<el-select @change="doSearch" @clear="doSearch" placeholder="请选择教代会" v-model="pageForm.sessionId" clearable style="width: 100%">
|
||||
<el-option v-for="item in sessionOptions" :label="item.fullName" :value="item.id"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
@@ -228,12 +228,12 @@
|
||||
</template>
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_A06===true||is_sysadmin===true||is_H02===true">
|
||||
v-if="is_A06===true||is_sysadmin===true||is_CLUB_PRESIDENT===true">
|
||||
<el-col class="query-title">社团:</el-col>
|
||||
<el-col class="query-content">
|
||||
<el-select v-model="pageForm.clubId" placeholder="请选择社团" @change="doSearch"
|
||||
<el-select v-model="pageForm.clubId" placeholder="请选择社团" @change="doSearch" @clear="doSearch"
|
||||
filterable
|
||||
:clearable="is_A06===true||is_sysadmin===true||(is_H04===true&&is_H02===true)"
|
||||
clearable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in clubOptions"
|
||||
@@ -250,6 +250,7 @@
|
||||
<el-col class="query-content">
|
||||
<el-select
|
||||
@change="doSearch()"
|
||||
@clear="doSearch()"
|
||||
placeholder="请选择活动组别范围之外的人员"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@@ -493,6 +494,9 @@ module.exports = {
|
||||
is_H02() {
|
||||
return this.roleData.is_H02
|
||||
},
|
||||
is_CLUB_PRESIDENT() {
|
||||
return this.roleData.is_CLUB_PRESIDENT
|
||||
},
|
||||
is_sysadmin() {
|
||||
return this.roleData.is_sysadmin
|
||||
},
|
||||
@@ -709,18 +713,15 @@ module.exports = {
|
||||
async created() {
|
||||
this.listSession()
|
||||
await this.getRolesAndUnion()
|
||||
this.clubOptions = await this.$businessTool.listClubByRole()
|
||||
this.clubOptions = await this.$businessTool.listManageClubByRole()
|
||||
if ((this.is_sysadmin || this.is_A06 || this.is_H02) === false && this.is_H04 === true) {
|
||||
this.unions = this.$businessTool.listUnion(this.unionid)
|
||||
this.$set(this.pageForm, "unionId", this.unions[0].id)
|
||||
this.unions = await this.$businessTool.listUnion(this.unionid)
|
||||
if (this.unions.length > 0 && this.is_CLUB_PRESIDENT !== true) {
|
||||
this.$set(this.pageForm, "unionId", this.unions[0].id)
|
||||
}
|
||||
} else {
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
}
|
||||
if (this.is_H04 === false && this.is_H02 === true) {
|
||||
if (this.clubOptions.length > 0) {
|
||||
this.$set(this.pageForm, "clubId", this.clubOptions[0].id)
|
||||
}
|
||||
}
|
||||
await this.flushUnits()
|
||||
await this.getActivityGroup()
|
||||
this.personTypeOptions = await this.$businessTool.getDictOptions("USER_PERSON_TYPE")
|
||||
|
||||
@@ -84,7 +84,12 @@ const ACTIVITY_CULTURE_AUDIT_ACTIVITY = {
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='tussueName'">
|
||||
<span v-if="row.activity_type==40002">{{row.unionname?row.unionname:'暂无'}}</span>
|
||||
<span v-if="row.activity_type==40003">{{row.clubName?row.clubName:'暂无'}}</span>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" header-align="center" label="操作"
|
||||
|
||||
@@ -23,12 +23,15 @@ const ACTIVITY_CULTURE_INFO_ACTIVITY = {
|
||||
<el-descriptions-item label="活动项目类型">
|
||||
{{ viewData.projectTypeName }}({{ viewData.projectTypeCode }})
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动类型" :span="2">
|
||||
<el-descriptions-item label="活动类型" >
|
||||
{{ viewData.activity_type === 40001 ? '校工会活动' : viewData.activity_type === 40002 ?
|
||||
'分工会活动'
|
||||
:
|
||||
'社团/社团活动' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动地点">
|
||||
{{ viewData.address }}
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="活动计划时间">-->
|
||||
<!-- {{ viewData.startPlannedDate + ' - ' + viewData.endPlannedDate }}-->
|
||||
<!-- </el-descriptions-item>-->
|
||||
@@ -38,15 +41,13 @@ const ACTIVITY_CULTURE_INFO_ACTIVITY = {
|
||||
<el-descriptions-item label="报名时间" v-if="viewData.applyStartTime">
|
||||
{{ viewData.applyStartTime + ' - ' + viewData.applyEndTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动人数">
|
||||
{{ viewData.peopleNum || '暂无' }}
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="活动人数">-->
|
||||
<!-- {{ viewData.peopleNum || '暂无' }}-->
|
||||
<!-- </el-descriptions-item>-->
|
||||
<el-descriptions-item label="活动报名范围">
|
||||
{{ viewData.groupName || '暂无' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动地点">
|
||||
{{ viewData.address }}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="报名方式">
|
||||
<span v-if="viewData.signUpMethod===1">个人报名</span>
|
||||
<span v-else-if="viewData.signUpMethod===2">组队报名</span>
|
||||
|
||||
@@ -103,8 +103,7 @@ const ACTIVITY_CULTURE_INFO_MANAGE = {
|
||||
</el-dropdown-item>
|
||||
|
||||
<el-dropdown-item :command="{type:'edit',row}"
|
||||
v-if="row.taskKey === 'startTask' || !row.instanceId"
|
||||
:disabled="row.projectTypeCode==50004">
|
||||
>
|
||||
编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item u
|
||||
@@ -113,7 +112,7 @@ const ACTIVITY_CULTURE_INFO_MANAGE = {
|
||||
</el-dropdown-item>
|
||||
|
||||
<el-dropdown-item :command="{type:'delete',row}"
|
||||
v-if="row.taskKey === 'startTask' || !row.instanceId" >
|
||||
v-if="(activity_type === 40001 && (row.taskKey === 'startTask' || !row.instanceId)) || (activity_type !== 40001 && $auth.hasRole('SYSADMIN'))" >
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'openCode',row}">
|
||||
|
||||
@@ -17,14 +17,17 @@ const singleSignUp = {
|
||||
<el-descriptions-item label="活动编号">
|
||||
{{ viewData.activityCode }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动编号">
|
||||
<el-descriptions-item label="活动项目类型">
|
||||
{{ viewData.projectTypeName }}({{ viewData.projectTypeCode }})
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动类型" :span="2">
|
||||
<el-descriptions-item label="活动类型">
|
||||
{{ viewData.activity_type === 40001 ? '校工会活动' : viewData.activity_type === 40002 ? '分工会活动'
|
||||
:
|
||||
'社团/社团活动' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动地点">
|
||||
{{ viewData.address }}
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="活动计划时间">-->
|
||||
<!-- {{ viewData.startPlannedDate + ' - ' + viewData.endPlannedDate }}-->
|
||||
<!-- </el-descriptions-item>-->
|
||||
@@ -34,12 +37,10 @@ const singleSignUp = {
|
||||
<el-descriptions-item label="报名时间" v-if="viewData.applyStartTime">
|
||||
{{ viewData.applyStartTime + ' - ' + viewData.applyEndTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动人数">
|
||||
{{ viewData.peopleNum || '暂无' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="活动地点">
|
||||
{{ viewData.address }}
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="活动人数">-->
|
||||
<!-- {{ viewData.peopleNum || '暂无' }}-->
|
||||
<!-- </el-descriptions-item>-->
|
||||
|
||||
<el-descriptions-item label="报名方式">
|
||||
<span v-if="viewData.signUpMethod===1">个人报名</span>
|
||||
<span v-else-if="viewData.signUpMethod===2">组队报名</span>
|
||||
@@ -50,7 +51,7 @@ const singleSignUp = {
|
||||
<span v-if="viewData.isEnrollSystem">活动报名</span>
|
||||
<span v-else>活动管理</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="报名人数限制" span="3" v-if="viewData.signUpMethod!=null">
|
||||
<el-descriptions-item label="报名人数限制" :span="2" v-if="viewData.signUpMethod!=null">
|
||||
<span v-if="viewData.userNumberLimit===1">总人数限制({{
|
||||
viewData.totalUserNumberLimit
|
||||
}}人)</span>
|
||||
@@ -261,6 +262,16 @@ const singleSignUp = {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 报名弹窗与查看弹窗统一使用同一套活动详情字段,避免展示口径不一致。
|
||||
parseJsonField(value, defaultValue) {
|
||||
if (value === null || value === undefined || value === "") {
|
||||
return defaultValue
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
return JSON.parse(value)
|
||||
}
|
||||
return value
|
||||
},
|
||||
onOpen(id) {
|
||||
this.dialogVisible = true
|
||||
this.id = id
|
||||
@@ -506,12 +517,21 @@ const singleSignUp = {
|
||||
|
||||
//活动信息
|
||||
activityInfo() {
|
||||
this.$axios.post("/platform/activity/culture/infoManage/activityInfo", {id: this.id}).then((res) => {
|
||||
this.$axios.post("/platform/activity/culture/infoManage/findOne", {id: this.id}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.viewData = res.data
|
||||
const data = res.data || {}
|
||||
data.billFiles = this.parseJsonField(data.billFiles, [])
|
||||
data.photoFiles = this.parseJsonField(data.photoFiles, [])
|
||||
data.otherFiles = this.parseJsonField(data.otherFiles, [])
|
||||
data.unionUserNumberLimit = this.parseJsonField(data.unionUserNumberLimit, [])
|
||||
data.location = this.parseJsonField(data.location, [])
|
||||
data.formConfig = this.parseJsonField(data.formConfig, null)
|
||||
this.viewData = data
|
||||
if (this.viewData.signUpMethod === 3) {
|
||||
const union = this.viewData.unionUserNumberLimit.find(v => v.id === this.$store.state.user.union.id)
|
||||
this.viewData.teamNum = union.limitNum
|
||||
if (union) {
|
||||
this.viewData.teamNum = union.limitNum
|
||||
}
|
||||
this.listTeamUserUnion()
|
||||
} else {
|
||||
this.listTeamUser()
|
||||
|
||||
@@ -71,6 +71,12 @@ layout("/layouts/platform.html"){
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool label="分工会列表">
|
||||
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
|
||||
<el-button @click="openImport" size="small" type="primary">导入报名人员</el-button>
|
||||
<el-button @click="doExportByEnroll" size="small" type="primary">导出报名信息</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" row-key="id" style="width: 100%">
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="{row}">
|
||||
@@ -295,11 +301,20 @@ layout("/layouts/platform.html"){
|
||||
prop="num"></el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="doExportXlsx(row)" size="mini" type="primary">导出
|
||||
<el-button v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')" @click="doExportXlsx(row)" size="mini" type="primary">导出
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-dialog title="导入报名人员" :visible.sync="importDialog" width="50%" :close-on-click-modal="false" :close-on-press-escape="false">
|
||||
<file-import
|
||||
ref="viewImport"
|
||||
temp_url="/platform/activity/reading/downloadImportTemplate"
|
||||
post_url="/platform/activity/reading/importUserActivitys"
|
||||
:business_id="pageForm.id"
|
||||
@flush="successImport"
|
||||
></file-import>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
@@ -310,6 +325,9 @@ layout("/layouts/platform.html"){
|
||||
el: "#app",
|
||||
store,
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"file-import": httpVueLoader("/components/plugins/sysImport/index.vue?v=" + new Date().getTime())
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activityList: [],
|
||||
@@ -317,6 +335,7 @@ layout("/layouts/platform.html"){
|
||||
unions: [],
|
||||
rootData: [],
|
||||
|
||||
importDialog: false,
|
||||
noneData: false,
|
||||
tabLoading: false,
|
||||
events: [],
|
||||
@@ -342,11 +361,40 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
methods: {
|
||||
doExportXlsx(row) {
|
||||
this.$downLoad("/platform/activity/sports/info/mange/exportXlsx", {
|
||||
this.$downLoad(loc() + "/doExportByEnroll", {
|
||||
id: this.pageForm.id,
|
||||
unionId: row.id
|
||||
})
|
||||
},
|
||||
doExportByEnroll() {
|
||||
if (!this.pageForm.id) {
|
||||
this.notifyWarning("请先选择活动名称")
|
||||
return
|
||||
}
|
||||
if (!this.pageForm.unionid) {
|
||||
this.notifyWarning("请选择所属工会")
|
||||
return
|
||||
}
|
||||
this.$downLoad(loc() + "/doExportByEnroll", {
|
||||
id: this.pageForm.id,
|
||||
unionId: this.pageForm.unionid
|
||||
})
|
||||
},
|
||||
openImport() {
|
||||
if (!this.pageForm.id) {
|
||||
this.notifyWarning("请先选择活动名称")
|
||||
return
|
||||
}
|
||||
this.importDialog = true
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.viewImport) {
|
||||
this.$refs.viewImport.resetImportData()
|
||||
}
|
||||
})
|
||||
},
|
||||
successImport() {
|
||||
this.pageData()
|
||||
},
|
||||
unionIdChange() {
|
||||
const tableData = clone(this.rootData)
|
||||
setTimeout(()=>{
|
||||
|
||||
Reference in New Issue
Block a user