This commit is contained in:
2026-03-09 11:15:09 +08:00
parent a811be52ee
commit 90e0a24e83
55 changed files with 862 additions and 424 deletions
@@ -15,6 +15,7 @@ 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.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@@ -51,7 +52,7 @@ public class ActivitySportsReadingController {
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("YEAR(applyStartTime)", "=", year);
cnd.and("activityLevel", "=", activityLevel);
if (!AuthUtil.hasRoleOr(RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SYSADMIN.name())) {
if (activityLevel.equals("40002")) {
@@ -73,6 +74,9 @@ public class ActivitySportsReadingController {
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);
if (Lang.isEmpty(activitySchool)) {
return Result.error("暂无活动");
}
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
@@ -18,6 +18,8 @@ import com.budwk.app.zhgh.activity.sports.param.ActivitySportsApplyUserPageParam
import com.budwk.app.zhgh.activity.sports.service.ActivitySportsApplyUserService;
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.Lang;
@@ -87,7 +89,10 @@ public class H5ActivitySportsApplyUserController {
ActivitySchoolEvent schoolEvent = dao.fetch(ActivitySchoolEvent.class, schoolEventId);
ActivityEvent activityEvent = dao.fetch(ActivityEvent.class, eventId);
ActivitySchool activitySchool = dao.fetch(ActivitySchool.class, activityId);
ActivitySchoolTeam schoolTeam = dao.fetch(ActivitySchoolTeam.class, teamId);
ActivitySchoolTeam schoolTeam = null;
if (teamId != null && !teamId.isEmpty()) {
schoolTeam = dao.fetch(ActivitySchoolTeam.class, teamId);
}
ActivityBasicUnit basicUnit = dao.fetch(ActivityBasicUnit.class, Cnd.where("id", "=", SecurityUtil.getUnitId()));
ActivityBasicUnion basicUnion = dao.fetch(ActivityBasicUnion.class, Cnd.where("id", "=", basicUnit.getUnionId()));
@@ -105,10 +110,10 @@ public class H5ActivitySportsApplyUserController {
}
//如果不等于空代表是个人项目
if (ObjectUtil.isNotEmpty(activityEvent.getIsMenWomen())) {
if (activityEvent.getIsMenWomen() == 1 && !List.of("","男性").contains(user.getSex())) {
if (activityEvent.getIsMenWomen() == 1 && !List.of("", "男性").contains(user.getSex())) {
return Result.error("当前项目只能男性能报名!");
}
if (activityEvent.getIsMenWomen() == 2 && !List.of("","女性").contains(user.getSex())) {
if (activityEvent.getIsMenWomen() == 2 && !List.of("", "女性").contains(user.getSex())) {
return Result.error("当前项目只能女性能报名!");
}
}
@@ -182,8 +187,10 @@ public class H5ActivitySportsApplyUserController {
schoolApply.setStatus(2);
}
schoolApply.setUnitname(user.getUnitName());
schoolApply.setTeamId(schoolTeam.getId());
schoolApply.setTeam(schoolTeam.getName());
if (schoolTeam != null){
schoolApply.setTeamId(schoolTeam.getId());
schoolApply.setTeam(schoolTeam.getName());
}
schoolApply.setLoginname(user.getLoginname());
schoolApply.setUsername(user.getUsername());
schoolApply.setMobile(user.getMobile());
@@ -196,10 +203,23 @@ public class H5ActivitySportsApplyUserController {
@At
@SaCheckPermission("h5.activity.sports.applyUser")
public Result cancelApply(@Valid String activityId, @Valid String eventId, @Valid String schoolEventId) {
int count = dao.count(ActivitySchoolApply.class,
Cnd.where(ActivitySchoolApply::getUserId, "=", SecurityUtil.getUserId())
.and(ActivitySchoolApply::getActivityId, "=", activityId)
.and(ActivitySchoolApply::getEventId, "=", eventId).and(ActivitySchoolApply::getStatus, "=", 2));
Sql sql = Sqls.create("""
SELECT
COUNT(*)
FROM
activity_school_apply asa
LEFT JOIN activity_school act ON act.id = asa.activityId
WHERE
asa.userId = @userId
AND asa.activityId = @activityId
AND asa.eventId = @eventId
AND STATUS = 2
AND JSON_CONTAINS(act.applyWay, '[1,2]')
""")
.setParam("userId", SecurityUtil.getUserId())
.setParam("activityId", activityId)
.setParam("eventId", eventId);
int count = activitySportsApplyUserService.count(sql);
if (count > 0) {
return Result.error("您已报名成功无法取消,请联系管理员取消!");
}
@@ -205,7 +205,7 @@ public class ActivitySchool extends BaseModel implements Serializable , SysHomeC
sysHomeActivity.setName(this.getName());
sysHomeActivity.setCover(this.getImage());
sysHomeActivity.setUrl("/platform/activity/apply");
sysHomeActivity.setH5Url(null);
sysHomeActivity.setH5Url("/platform/activity/apply/h5/index?id=" + this.getId());
sysHomeActivity.setStartDate(DateUtil.parseDate(this.getApplyStartTime()));
sysHomeActivity.setEndDate(DateUtil.parseDate(this.getApplyEndTime()));
sysHomeActivity.setAllowUserGroupId(this.getActivityGroupId());
@@ -310,7 +310,7 @@ public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl<Activity
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")));
v.setv("age", DateUtil.ageOfNow(v.getString("birthday")));
} else {
v.setv("birthday", null);
v.setv("age", 0);
@@ -344,7 +344,7 @@ public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl<Activity
list.forEach(v -> {
if (Strings.isNotBlank(v.getBirthday())) {
v.setAge(cn.hutool.core.date.DateUtil.ageOfNow(v.getBirthday()));
v.setAge(DateUtil.ageOfNow(v.getBirthday()));
}
});
@@ -393,6 +393,7 @@ public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl<Activity
dao().update(ActivitySchoolApply.class,
Chain.make("status", 2),
Cnd.where("activityId", "=", activityId)
.and("eventId", "=", eventId)
.and("activityUnionId", "=", basicUnion.getId()));
}
@@ -7,7 +7,10 @@ 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.*;
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 io.swagger.annotations.Api;
@@ -9,7 +9,6 @@ import com.budwk.app.base.result.Result;
import com.budwk.app.flow.entity.ProcessInstance;
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
import com.budwk.app.sys.models.Sys_home_activity;
import com.budwk.app.sys.models.Sys_union;
import com.budwk.app.sys.models.Sys_unit;
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
@@ -27,8 +27,6 @@ import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
@@ -6,7 +6,6 @@ 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 cn.hutool.json.JSONObject;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
@@ -24,7 +23,6 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
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;
@@ -40,15 +38,9 @@ import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
@@ -96,28 +88,28 @@ public class TrainSignUpActivityStatisticsController {
@SaCheckPermission("trainSignUp.statistics")
public Result activityList(@Param(value = "year") Integer year) {
List<TrainSignUpActivity> list = dao.query(TrainSignUpActivity.class, Cnd.NEW().andEX("year", "=", year).desc("activityStartTime"));
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
// 获取当前登录用户的工会
String unionId = SecurityUtil.getUnionId();
// 获取当前登录用户的协会
List<String> clubIds = SecurityUtil.getClubIds();
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
// 获取当前登录用户的工会
String unionId = SecurityUtil.getUnionId();
// 获取当前登录用户的协会
List<String> clubIds = SecurityUtil.getClubIds();
List<TrainSignUpActivity> result = new ArrayList<>();
for (TrainSignUpActivity activity : list) {
if(AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
if(activity.getHostUnits().contains(unionId) || activity.getHelpUnits().contains(unionId)) {
result.add(activity);
}
}
if(AuthUtil.hasRoleOr(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_OPERATOR.name())) {
if(clubIds.stream().anyMatch(activity.getHostUnits()::contains) || clubIds.stream().anyMatch(activity.getHelpUnits()::contains)) {
result.add(activity);
}
}
}
return Result.success(result);
}
return Result.success(list);
List<TrainSignUpActivity> result = new ArrayList<>();
for (TrainSignUpActivity activity : list) {
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
if (activity.getHostUnits().contains(unionId) || activity.getHelpUnits().contains(unionId)) {
result.add(activity);
}
}
if (AuthUtil.hasRoleOr(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_OPERATOR.name())) {
if (clubIds.stream().anyMatch(activity.getHostUnits()::contains) || clubIds.stream().anyMatch(activity.getHelpUnits()::contains)) {
result.add(activity);
}
}
}
return Result.success(result);
}
return Result.success(list);
}
/**
@@ -140,13 +132,13 @@ public class TrainSignUpActivityStatisticsController {
return Result.success(trainSignUpActivityStatisticsService.getTaleColumnInfo(courseId));
}
@At
@ApiOperation("获取时间信息")
@SaCheckPermission("trainSignUp.statistics")
public Result selectTimes(@Param("courseId") String courseId) {
List<TrainSignUpActivityCourse> activityCourses = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId).asc("courseStartTime"));
return Result.success(activityCourses);
}
@At
@ApiOperation("获取时间信息")
@SaCheckPermission("trainSignUp.statistics")
public Result selectTimes(@Param("courseId") String courseId) {
List<TrainSignUpActivityCourse> activityCourses = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId).asc("courseStartTime"));
return Result.success(activityCourses);
}
/**
* 培训班上课签到信息
@@ -158,8 +150,8 @@ public class TrainSignUpActivityStatisticsController {
@ApiOperation("获取签到信息")
@SaCheckPermission("trainSignUp.statistics")
public Result getSignInfo(PageForm pageForm,
@Param("courseId") String courseId,
String timeId) {
@Param("courseId") String courseId,
String timeId) {
return Result.success(trainSignUpActivityStatisticsService.getSignInfo(pageForm, courseId, timeId));
}
@@ -172,21 +164,30 @@ public class TrainSignUpActivityStatisticsController {
return Result.success();
}
@At
@ApiOperation("设置签到")
@SaCheckPermission("trainSignUp.statistics")
public Result adjustSign(@Param("id") String id) {
TrainSignUpUserCourse userCourse = dao.fetch(TrainSignUpUserCourse.class, id);
if(userCourse.isAttend()) {
userCourse.setAttend(false);
userCourse.setAttendTime(null);
} else {
userCourse.setAttend(true);
userCourse.setAttendTime(userCourse.getCourseStartTime());
}
dao.update(userCourse);
return Result.success();
}
@At
@ApiOperation("设置签到")
@SaCheckPermission("trainSignUp.statistics")
public Result adjustSign(@Param("id") String id) {
TrainSignUpUserCourse userCourse = dao.fetch(TrainSignUpUserCourse.class, id);
Date courseStartTime = userCourse.getCourseStartTime();
Date courseEndTime = userCourse.getCourseEndTime();
Date now = new Date();
if (courseStartTime == null || courseStartTime.after(now)) {
return Result.error("签到时间未开始!");
}
if (courseEndTime != null && courseEndTime.before(now)) {
return Result.error("签到已结束!");
}
if (userCourse.isAttend()) {
userCourse.setAttend(false);
userCourse.setAttendTime(null);
} else {
userCourse.setAttend(true);
userCourse.setAttendTime(userCourse.getCourseStartTime());
}
dao.update(userCourse);
return Result.success();
}
@At
@Ok("void")
@@ -236,7 +237,7 @@ public class TrainSignUpActivityStatisticsController {
for (TrainSignUpCourse c : courseList) {
String k = c.getCourseName();
List<NutMap> v = userList.stream().filter(x -> x.getString("courseName").equals(k)).collect(Collectors.toList());
List<NutMap> v = userList.stream().filter(x -> StrUtil.isNotBlank(x.getString("courseName")) && x.getString("courseName").equals(k)).collect(Collectors.toList());
ExportParams userExportParams = new ExportParams();
userExportParams.setSheetName(k);
userExportParams.setType(ExcelType.HSSF);
@@ -251,7 +252,7 @@ public class TrainSignUpActivityStatisticsController {
entity.setName(column.getColumnName());
entity.setKey(column.getColumnCode());
entity.setWidth(20);
if (column.getColumnFormType().equals("FILE")) {
if ("FILE".equals(column.getColumnFormType())) {
entity.setType(2);
entity.setExportImageType(2);
}
@@ -267,9 +268,9 @@ public class TrainSignUpActivityStatisticsController {
userSignData.put(cv.getString("columnCode"), cv.getString("columnValue"));
} else {
if (StrUtil.isNotBlank(cv.getString("columnValue"))) {
List<JSONObject> columnValue = Json.fromJsonAsList(JSONObject.class, cv.getString("columnValue"));
List<NutMap> columnValue = cv.getAsList("columnValue", NutMap.class);
if (columnValue.size() == 1) {
JSONObject sysFile = columnValue.get(0);
NutMap sysFile = columnValue.get(0);
Sys_file file = dao.fetch(Sys_file.class, Cnd.where(Sys_file::getDownloadPath, "=", sysFile.get("url")));
byte[] imageBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
if (imageBytes.length > 0) {
@@ -285,6 +286,7 @@ public class TrainSignUpActivityStatisticsController {
Map<String, Object> userExportMap = new HashMap<>();
userExportMap.put("name", k);
userExportParams.setType(ExcelType.HSSF);
userExportMap.put("title", userExportParams);
userExportMap.put("entity", currentEntities);
userExportMap.put("data", v);
@@ -297,10 +299,7 @@ public class TrainSignUpActivityStatisticsController {
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();
CommonDownloadUtil.download(activity.getActivityName() + "报名人员名单" + ".xlsx", workbook, response);
CommonDownloadUtil.download(activity.getActivityName() + "报名人员名单" + ".xls", workbook, response);
} catch (Exception e) {
e.printStackTrace();
}
@@ -5,9 +5,7 @@ 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.TrainSignUpType;
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;
@@ -7,7 +7,6 @@ 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
@@ -7,10 +7,6 @@ import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_home_activity;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.activity.family.models.FamilyActivity;
import com.budwk.app.zhgh.activity.family.models.FamilyCourse;
import com.budwk.app.zhgh.activity.family.models.FamilyType;
import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService;
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityService;
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
@@ -31,7 +27,6 @@ import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@@ -91,6 +86,24 @@ public class TrainSignUpActivityServiceImpl extends BaseServiceImpl<TrainSignUpA
if (Lang.isEmpty(courseList)) {
return;
}
Set<String> newIds = courseList.stream()
.map(TrainSignUpCourse::getId)
.filter(StrUtil::isNotBlank)
.collect(Collectors.toSet());
List<TrainSignUpCourse> oldCourses = dao().query(TrainSignUpCourse.class, Cnd.where("activityId", "=", activity.getId()));
Set<String> oldIds = oldCourses.stream()
.map(TrainSignUpCourse::getId)
.filter(StrUtil::isNotBlank)
.collect(Collectors.toSet());
Set<String> deletedIds = Sets.difference(oldIds, newIds).immutableCopy();
if(Lang.isNotEmpty(deletedIds)) {
dao().clear(TrainSignUpCourse.class, Cnd.where("id", "in", deletedIds));
}
for (TrainSignUpCourse course : courseList) {
course.setActivityId(activity.getId());
dao().insertOrUpdate(course);
@@ -4,10 +4,10 @@ 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_user;
import com.budwk.app.zhgh.activity.family.models.FamilyType;
import com.budwk.app.zhgh.activity.family.models.FamilyUser;
import com.budwk.app.zhgh.activity.trainSignUp.models.*;
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainMobileSignColumn;
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.models.TrainSignUpUser;
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpActivityStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
@@ -20,7 +20,7 @@ import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@@ -1,8 +1,10 @@
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.base.utils.PageUtil;
import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpBlackList;
import com.budwk.app.zhgh.activity.trainSignUp.service.TrainSignUpBlackListService;
import org.nutz.dao.Cnd;
@@ -42,6 +44,8 @@ public class TrainSignUpUserServiceImpl extends BaseServiceImpl<TrainSignUpBlack
tsuu.state,
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId $var) courseTotal,
( 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,
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId AND isAttend = 1 and tsuu.state!=2 AND now()> courseEndTime $var) AS signCount,
( SELECT count( 1 ) FROM train_sign_up_user_course WHERE userId = tsuu.userId and tsuu.state!=2 $var) AS totalCount,
if(tsubl.isDisabled=1,true,false) isDisabled,
group_CONCAT( tsuc.courseName ) AS courseNames
FROM
@@ -51,7 +55,6 @@ public class TrainSignUpUserServiceImpl extends BaseServiceImpl<TrainSignUpBlack
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();
@@ -61,6 +64,11 @@ public class TrainSignUpUserServiceImpl extends BaseServiceImpl<TrainSignUpBlack
if (!varCnd.where().isEmpty()) {
sql.vars().set("var", "and " + varCnd.toSql(null));
}
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.desc("tsuu.unitId");
} else {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@@ -4,9 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.ChineseDate;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
@@ -132,12 +130,14 @@ public class TeacherCongressDelegateServiceImpl extends BaseServiceImpl<Teacher_
//查询所有的团长、副团长
Sys_role tzRole = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
Sys_role ftzRole = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
Sql tzSql = Sqls.create("""
SELECT
t2.id,
t2.username,
t2.sex,
t1.tcDelegationId
t1.tcDelegationId,
t1.roleId
FROM
sys_user_role t1
LEFT JOIN sys_user t2 ON t2.id = t1.userId
@@ -146,7 +146,7 @@ public class TeacherCongressDelegateServiceImpl extends BaseServiceImpl<Teacher_
AND t1.roleId IN (@tzRoles)
""");
tzSql.setParam("sessionId", pageForm.getSessionId());
tzSql.setParam("tzRoles", List.of(tzRole.getId()));
tzSql.setParam("tzRoles", List.of(tzRole.getId(), ftzRole.getId()));
List<NutMap> tzList = listMap(tzSql);
//查询代表
@@ -155,7 +155,8 @@ public class TeacherCongressDelegateServiceImpl extends BaseServiceImpl<Teacher_
t1.*,
t2.`name` AS delegationName,
t3.`fullName` AS sessionName,
t4.`name` AS roleName
t4.`name` AS roleName,
t4.`code` AS roleCode
FROM
teacher_congress_delegate t1
LEFT JOIN teacher_congress_delegation t2 ON t2.id = t1.delegationId
@@ -167,44 +168,57 @@ public class TeacherCongressDelegateServiceImpl extends BaseServiceImpl<Teacher_
List<NutMap> delegateAllList = listMap(delegateSql);
for (NutMap delegation : delegationList) {
delegation.put("tz", tzList.stream().filter(tz -> tz.getString("tcDelegationId").equals(delegation.getString("id"))).toList());
//过滤本代表团的代表
List<NutMap> delegateList = delegateAllList.stream()
.filter(delegate -> delegation.getString("id").equals(delegate.getString("delegationId")))
.collect(Collectors.toList());
Comparator<NutMap> comparator = Comparator.comparing((NutMap map) -> {
String userName = map.getString("userName");
if (userName == null || userName.isEmpty()) {
return 0;
}
// 获取第一个字的笔画数作为主排序键
return getStrokeCount(String.valueOf(userName.charAt(0)));
}).thenComparing(map -> {
String userName = map.getString("userName");
// 如果名字长度大于 1,获取第二个字的笔画数
if (userName != null && userName.length() > 1) {
return getStrokeCount(String.valueOf(userName.charAt(1)));
}
return 0;
});
delegateList.sort(comparator);
//按5人平均分组
List<List<NutMap>> delegateGroupList = ListUtil.split(delegateList, 5);
delegation.put("tz", tzList.stream().filter(tz -> tz.getString("tcDelegationId").equals(delegation.getString("id"))
&& tz.getString("roleId").equals(tzRole.getId())).toList());
delegation.put("ftz", tzList.stream().filter(tz -> tz.getString("tcDelegationId").equals(delegation.getString("id"))
&& tz.getString("roleId").equals(ftzRole.getId())).toList());
List<NutMap> buildMaps = new ArrayList<>();
for (int i = 0; i < delegateGroupList.size(); i++) {
NutMap buildMap = NutMap.NEW();
for (int j = 0; j < delegateGroupList.get(i).size(); j++) {
delegateGroupList.get(i).get(j).put("username" + j, delegateGroupList.get(i).get(j).getString("userName"));
delegateGroupList.get(i).get(j).put("sex" + j, delegateGroupList.get(i).get(j).getString("sex"));
buildMap.put("username" + j, delegateGroupList.get(i).get(j).getString("userName"));
if(StrUtil.isNotBlank(delegateGroupList.get(i).get(j).getString("sex"))) {
buildMap.put("sex" + j, "(" + delegateGroupList.get(i).get(j).getString("sex") + ")");
}
List<Object> dbDataFormatList = List.of(RoleConstant.TEACHER_CONGRESS_DELEGATE_FORMAL, RoleConstant.TEACHER_CONGRESS_DELEGATE_ATTENDANCE);
for (Object role : dbDataFormatList) {
//过滤本代表团的代表
List<NutMap> delegateList = delegateAllList.stream()
.filter(delegate -> delegation.getString("id").equals(delegate.getString("delegationId"))
&& delegate.getString("roleCode").equals(role.toString()))
.collect(Collectors.toList());
Comparator<NutMap> comparator = Comparator.comparing((NutMap map) -> {
String userName = map.getString("userName");
if (userName == null || userName.isEmpty()) {
return 0;
}
// 获取第一个字的笔画数作为主排序键
return getStrokeCount(String.valueOf(userName.charAt(0)));
}).thenComparing(map -> {
String userName = map.getString("userName");
// 如果名字长度大于 1,获取第二个字的笔画数
if (userName != null && userName.length() > 1) {
return getStrokeCount(String.valueOf(userName.charAt(1)));
}
return 0;
});
delegateList.sort(comparator);
//按5人平均分组
List<List<NutMap>> delegateGroupList = ListUtil.split(delegateList, 5);
List<NutMap> buildMaps = new ArrayList<>();
for (int i = 0; i < delegateGroupList.size(); i++) {
NutMap buildMap = NutMap.NEW();
for (int j = 0; j < delegateGroupList.get(i).size(); j++) {
delegateGroupList.get(i).get(j).put("username" + j, delegateGroupList.get(i).get(j).getString("userName"));
delegateGroupList.get(i).get(j).put("sex" + j, delegateGroupList.get(i).get(j).getString("sex"));
buildMap.put("username" + j, delegateGroupList.get(i).get(j).getString("userName"));
if (StrUtil.isNotBlank(delegateGroupList.get(i).get(j).getString("sex"))) {
buildMap.put("sex" + j, "(" + delegateGroupList.get(i).get(j).getString("sex") + ")");
}
}
buildMaps.add(buildMap);
}
if (role.equals(RoleConstant.TEACHER_CONGRESS_DELEGATE_FORMAL)) {
delegation.put("dbs", buildMaps);
} else {
delegation.put("tyDbs", buildMaps);
}
buildMaps.add(buildMap);
}
delegation.put("dbs", buildMaps);
}
LoopRowTableRenderPolicy hackLoopTableRenderPolicy = new LoopRowTableRenderPolicy();
@@ -106,6 +106,14 @@ public class WelfareSelectionSituationController {
situationService.exportXlsx(pageForm, response);
}
@At
@SaCheckPermission("welfare.selection.situation")
@Ok("void")
@ApiOperation("导出Excel")
public void receiveXlsx(@Valid @Param("pageForm") WelfareSelectionSituationPageForm pageForm, HttpServletResponse response) {
situationService.receiveXlsx(pageForm, response);
}
@At
@SaCheckLogin
public Result getMobileByUserId(String userId) {
@@ -72,7 +72,7 @@ public class WelfareUserSelectController {
cnd.andEX("YEAR(wp.choiceTimeStart)", "in", year);
cnd.and("wp.isDisabled", "=", 0);
cnd.groupBy("wp.id");
cnd.desc("YEAR(wp.choiceTimeStart)");
cnd.desc("wp.choiceTimeStart");
sql.setCondition(cnd);
Pagination pagination = welfareProjectService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
@@ -50,6 +50,11 @@ public class WelfareUserSelection extends BaseModel implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 32)
private String selectUserId;
@Column
@Comment("选择用户")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userName;
@Column
@Comment("选择时间")
@ColDefine(type = ColType.DATETIME)
@@ -12,5 +12,6 @@ public interface WelfareSelectionSituationService extends BaseService<WelfareLis
Pagination pageData(WelfareSelectionSituationPageForm pageForm);
void exportXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response);
void receiveXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response);
}
@@ -79,7 +79,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
WHERE
wl.projectId = @welfareId
AND wpus.selectOptionId = @selectOptionId and wpus.selectNum!=0
""").setParam("welfareId", projectId).setParam("selectOptionId", optionId);
List<NutMap> mapList = listMap(sql);
@@ -345,7 +345,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
FROM
`vw_user`
$condition
""");
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("id", "not in", userIds);
cnd.and("unionCode", "is not", null);
@@ -392,7 +392,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
t2.birthday
FROM
`welfare_list` t1
LEFT JOIN sys_user t2 ON t2.id = t1.userId
LEFT JOIN `vw_user` t2 ON t2.id = t1.userId
$condition
""");
Cnd cnd = Cnd.NEW();
@@ -408,6 +408,9 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
cnd.andEX("MONTH(t2.birthday)", "in", pageForm.getBirthMonths());
}
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_ADMIN.name())) {
cnd.and("t2.unionId", "=", SecurityUtil.getUnionId());
}
cnd.andEX("t1.welfareUnitId", "in", pageForm.getUnitIds());
cnd.andEX("t1.welfareUnionId", "=", pageForm.getUnionId());
cnd.andEX("t1.personType", "in", pageForm.getPersonTypes());
@@ -467,7 +470,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
cnd.andEX("u.personType", "in", pageForm.getPersonTypes());
cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys());
cnd.andEX("u.userState", "in", pageForm.getUserStates());
cnd.andEX("u.member","=",pageForm.getIsMember());
cnd.andEX("u.member", "=", pageForm.getIsMember());
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.asc("u.unionCode");
@@ -519,7 +522,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
cnd.andEX("personType", "in", pageForm.getPersonTypes());
cnd.andEX("preparedBy", "in", pageForm.getPreparedBys());
cnd.andEX("userState", "in", pageForm.getUserStates());
cnd.andEX("member","=",pageForm.getIsMember());
cnd.andEX("member", "=", pageForm.getIsMember());
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.asc("unionCode");
@@ -20,9 +20,7 @@ import org.nutz.lang.util.NutMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -42,7 +40,7 @@ public class WelfareProjectServiceImpl extends BaseServiceImpl<WelfareProject> i
@Override
public WelfareProject projectInfo(String projectId) {
WelfareProject project = fetch(projectId);
fetchLinks(project, "options",Cnd.NEW().asc("optionSort"));
fetchLinks(project, "options", Cnd.NEW().asc("optionSort"));
return project;
}
@@ -63,9 +61,27 @@ public class WelfareProjectServiceImpl extends BaseServiceImpl<WelfareProject> i
public void updateProject(WelfareProject project) {
// 更新项目
update(project);
dao().clear(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", project.getId()));
List<WelfareProjectSubjectOption> optionList = dao().query(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", project.getId()));
List<String> dbOptionIds = optionList.stream()
.map(WelfareProjectSubjectOption::getId)
.toList();
// 2. 获取 project 中的所有选项 ID(注意 null 安全)
List<String> projectOptionIds = project.getOptions() == null ?
Collections.emptyList() :
project.getOptions().stream()
.map(WelfareProjectSubjectOption::getId)
.filter(Objects::nonNull) // 避免 null id
.toList();
// 3. 找出需要删除的 ID:在 db 中但不在 project 中
List<String> toDeleteIds = dbOptionIds.stream()
.filter(id -> !projectOptionIds.contains(id))
.collect(Collectors.toList());
// 4. 批量删除
if (!toDeleteIds.isEmpty()) {
dao().clear(WelfareProjectSubjectOption.class,
Cnd.where(WelfareProjectSubjectOption::getId, "in", toDeleteIds));
}
// 新增或更新选项
for (WelfareProjectSubjectOption option : project.getOptions()) {
option.setWelfareId(project.getId());
dao().insertOrUpdate(option);
@@ -4,30 +4,37 @@ 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.afterturn.easypoi.excel.export.ExcelExportService;
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.service.impl.BaseServiceImpl;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.sys.models.Sys_file;
import com.budwk.app.sys.services.SysFileService;
import com.budwk.app.sys.utils.SysFileMinIoUtil;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.welfare.model.WelfareList;
import com.budwk.app.zhgh.welfare.model.WelfareProject;
import com.budwk.app.zhgh.welfare.model.WelfareProjectSubjectOption;
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@IocBean(args = {"refer:dao"})
@Slf4j
@@ -36,6 +43,10 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
super(dao);
}
@Inject
private SysFileService sysFileService;
@Override
public Pagination pageData(WelfareSelectionSituationPageForm pageForm) {
Sql sql = Sqls.create("""
@@ -46,7 +57,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
t1.welfareUnionName,
t1.welfareUnitName,
t1.welfareUnitId,
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
GROUP_CONCAT(DISTINCT t3.optionName ,'',t2.selectNum,'份)') AS selectedOptions,
GROUP_CONCAT(DISTINCT t2.mobile) AS mobile,
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
t4.username AS userName,
@@ -62,7 +73,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
""");
Cnd cnd = Cnd.NEW();
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_OPERATOR.name())) {
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_ADMIN.name())) {
cnd.and("t1.welfareUnionId", "=", SecurityUtil.getUnionId());
}
@@ -105,8 +116,9 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
t1.id,
t1.welfareUnionName,
t1.welfareUnitName,
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
GROUP_CONCAT(DISTINCT t3.optionName,'',t2.selectNum,'份)') AS selectedOptions,
GROUP_CONCAT(DISTINCT t2.mobile) AS mobile,
GROUP_CONCAT(DISTINCT t2.userName) AS userName2,
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
t4.username AS userName,
t4.loginname AS loginName,
@@ -120,7 +132,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
""");
Cnd cnd = Cnd.NEW();
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_OPERATOR.name())) {
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_ADMIN.name())) {
cnd.and("t1.welfareUnionId", "=", SecurityUtil.getUnionId());
}
@@ -167,9 +179,10 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
entities.add(new ExcelExportEntity("所属单位", "welfareUnitName", 20));
entities.add(new ExcelExportEntity("所属工会", "welfareUnionName", 20));
entities.add(new ExcelExportEntity("所选福利", "selectedOptions", 20));
entities.add(new ExcelExportEntity("收货人", "userName2", 20));
entities.add(new ExcelExportEntity("联系电话", "mobile", 20));
if(project.getProvideMode() == 3){
if (project.getProvideMode() == 3) {
entities.add(new ExcelExportEntity("收货地址", "receiveAddress", 40));
}
@@ -183,4 +196,87 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
log.error("导出Excel失败", e);
}
}
@Override
public void receiveXlsx(WelfareSelectionSituationPageForm pageForm, HttpServletResponse response) {
Sql sql = Sqls.create("""
SELECT
t1.*,
t2.userSign,
t3.username userName,
t3.loginname loginName,
GROUP_CONCAT(DISTINCT t2.selectOptionId) AS selectOptionIds
FROM
welfare_list t1
LEFT JOIN welfare_project_user_selection t2 ON t2.welfareId = t1.projectId
AND t2.selectUserId = t1.userId
LEFT JOIN sys_user t3 ON t3.id = t1.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t1.projectId", "=", pageForm.getProjectId());
cnd.groupBy("t1.id");
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_ADMIN.name())) {
cnd.and("t1.welfareUnionId", "=", SecurityUtil.getUnionId());
}
cnd.asc("t1.welfareUnitId");
sql.setCondition(cnd);
List<NutMap> list = listMap(sql);
List<WelfareProjectSubjectOption> optionList = dao().query(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", pageForm.getProjectId()).asc("optionSort"));
for (NutMap map : list) {
if (map.get("selectOptionIds") != null) {
String[] selectOptionIds = map.getString("selectOptionIds").split(",");
for (WelfareProjectSubjectOption option : optionList) {
if (Arrays.asList(selectOptionIds).contains(option.getId())) {
map.put(option.getOptionName(), "");
}
}
}
if (map.get("userSign") != null) {
try {
Sys_file file = dao().fetch(Sys_file.class, Cnd.where(Sys_file::getDownloadPath, "=", map.getString("userSign")));
byte[] userSignBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
map.put("userSign", userSignBytes);
} catch (Exception e) {
e.printStackTrace();
log.error("下载图片失败", e);
}
}
}
List<Map<String, Object>> safeList = list.stream().map(nutMap -> {
Map<String, Object> map = new HashMap<>(nutMap);
return map;
}).toList();
// 分组
Map<String, List<Map<String, Object>>> listMap = safeList.stream()
.collect(Collectors.groupingBy(n -> (String) n.get("welfareUnionName")));
// 构建 Excel 列
List<ExcelExportEntity> entities = new ArrayList<>();
entities.add(new ExcelExportEntity("工号", "loginName", 20));
entities.add(new ExcelExportEntity("姓名", "userName", 20));
optionList.forEach(option -> {
entities.add(new ExcelExportEntity(option.getOptionName(), option.getOptionName(), 20));
});
ExcelExportEntity userSignEntity = new ExcelExportEntity("签字", "userSign", 20);
userSignEntity.setType(2);
userSignEntity.setExportImageType(2);
entities.add(userSignEntity);
// 导出
Workbook workbook = new HSSFWorkbook();
listMap.forEach((k, v) -> {
ExcelExportService service = new ExcelExportService();
ExportParams exportParams = new ExportParams();
exportParams.setSheetName(k);
exportParams.setType(ExcelType.HSSF);
service.createSheetForMap(workbook, exportParams, entities, v);
});
CommonDownloadUtil.download("领取表.xls", workbook, response);
}
}
@@ -7,11 +7,14 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.export.ExcelExportService;
import cn.hutool.core.bean.BeanUtil;
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.base.utils.CommonDownloadUtil;
import com.budwk.app.sys.models.Sys_union;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.welfare.model.WelfareProject;
import com.budwk.app.zhgh.welfare.model.WelfareProjectSubjectOption;
import com.budwk.app.zhgh.welfare.service.WelfareStatisticsService;
@@ -44,9 +47,15 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
@Override
public NutMap pageData(String projectId, String unionId) {
// 分工会数据
List<Sys_union> unions = dao().query(Sys_union.class, Cnd.NEW().andEX(Sys_union::getId, "=", unionId).asc(Sys_union::getUnionCode));
List<Sys_union> unions;
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_ADMIN.name())) {
unions = dao().query(Sys_union.class, Cnd.NEW().andEX(Sys_union::getId, "=", SecurityUtil.getUnionId()).asc(Sys_union::getUnionCode));
} else {
unions = dao().query(Sys_union.class, Cnd.NEW().andEX(Sys_union::getId, "=", unionId).asc(Sys_union::getUnionCode));
}
List<NutMap> mapUnions = BeanUtil.copyToList(unions, NutMap.class);
// 表格动态列数据
List<NutMap> dynamicTableColumns = new ArrayList<>() {{
add(NutMap.NEW().addv("label", "分工会").addv("prop", "name"));
@@ -97,11 +106,12 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
for (NutMap union : mapUnions) {
// 福利人数
long teacherSum = welfareSelectionList.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId", "").equals(union.getString("id"))).count();
long teacherSum = welfareSelectionList.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId", "").equals(union.getString("id"))).count();
union.put("teacherSum", teacherSum);
// 已选人数
long selectedNum = welfareSelectionList.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId", "").equals(union.getString("id")) && v.getBoolean("has_selected")).count();
long selectedNum = welfareSelectionList.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId", "").equals(union.getString("id")) && v.getBoolean("has_selected")).count();
union.put("selectedNum", selectedNum);
// 未选人数
@@ -109,8 +119,25 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
// 各选项的选择人数
for (WelfareProjectSubjectOption option : welfareOptions) {
long count = userSelections.stream().filter(v -> StrUtil.isNotBlank(v.getString("welfareUnionId")) && v.getString("welfareUnionId").equals(union.getString("id")) && StrUtil.isNotBlank(v.getString("selectOptionId")) && v.getString("selectOptionId").equals(option.getId())).map(v -> v.getString("selectUserId")).distinct().count();
union.put(option.getId(), count);
int total = userSelections.stream()
.filter(v ->
StrUtil.isNotBlank(v.getString("welfareUnionId"))
&& v.getString("welfareUnionId").equals(union.getString("id"))
&& StrUtil.isNotBlank(v.getString("selectOptionId"))
&& v.getString("selectOptionId").equals(option.getId())
&& StrUtil.isNotBlank(v.getString("selectUserId")) // 确保 userId 有效
)
.collect(Collectors.toMap(
v -> v.getString("selectUserId"),
v -> v,
(existing, replacement) -> existing // 保留第一个
// 不传第四个参数,默认用 HashMap
))
.values()
.stream()
.mapToInt(v -> v.getInt("selectNum"))
.sum();
union.put(option.getId(), total);
}
}
@@ -305,7 +332,6 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
List<ExcelExportEntity> entities = new ArrayList<>();
entities.add(new ExcelExportEntity("工号", "loginName", 20));
entities.add(new ExcelExportEntity("姓名", "userName", 20));
entities.add(new ExcelExportEntity("姓名", "userName", 20));
entities.add(new ExcelExportEntity("单位", "welfareUnitName", 20));
entities.add(new ExcelExportEntity("工会", "welfareUnionName", 20));
@@ -360,7 +386,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
exportEntities.add(new ExcelExportEntity("电话号码", "mobile", 20));
exportEntities.add(new ExcelExportEntity("所在分工会", "welfareUnionName", 20));
exportEntities.add(new ExcelExportEntity("所在单位", "welfareUnitName", 20));
exportEntities.add(new ExcelExportEntity("福利", "optionName", 50));
exportEntities.add(new ExcelExportEntity("福利", "selectOptionName", 50));
Sql sql = Sqls.create("""
SELECT
@@ -419,14 +445,22 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
List<ExcelExportEntity> entities = new ArrayList<>();
entities.add(new ExcelExportEntity("分工会", "name", 20));
entities.add(new ExcelExportEntity("本次福利会员人数", "teacherSum", 20));
entities.add(new ExcelExportEntity("已选人数", "selectedNum", 20));
entities.add(new ExcelExportEntity("未选人数", "unSelectedNum", 20));
ExcelExportEntity teacherSumEntity = new ExcelExportEntity("本次福利会员人数", "teacherSum", 20);
teacherSumEntity.setType(10);
entities.add(teacherSumEntity);
ExcelExportEntity selectedNumEntity = new ExcelExportEntity("已选人数", "selectedNum", 20);
selectedNumEntity.setType(10);
entities.add(selectedNumEntity);
ExcelExportEntity unSelectedNumEntity = new ExcelExportEntity("未选人数", "unSelectedNum", 20);
unSelectedNumEntity.setType(10);
entities.add(unSelectedNumEntity);
// 选项数据
List<WelfareProjectSubjectOption> welfareOptions = dao().query(WelfareProjectSubjectOption.class, Cnd.where(WelfareProjectSubjectOption::getWelfareId, "=", projectId));
for (WelfareProjectSubjectOption welfareOption : welfareOptions) {
entities.add(new ExcelExportEntity(welfareOption.getOptionName(), welfareOption.getId(), 20));
ExcelExportEntity entity = new ExcelExportEntity(welfareOption.getOptionName(), welfareOption.getId(), 20);
entity.setType(10);
entities.add(entity);
}
// 查询福利名单以及查询出选项数据
@@ -442,6 +476,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
""");
Cnd cnd = Cnd.NEW();
cnd.and("t1.projectId", "=", projectId);
cnd.groupBy("t1.userId");
sql.setCondition(cnd);
List<NutMap> welfareSelectionList = listMap(sql);
@@ -457,6 +492,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
""");
Cnd cnd2 = Cnd.NEW();
cnd2.and("t1.welfareId", "=", projectId);
sql2.setCondition(cnd2);
List<NutMap> userSelections = listMap(sql2);
@@ -474,8 +510,25 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
// 各选项的选择人数
for (WelfareProjectSubjectOption option : welfareOptions) {
long count = userSelections.stream().filter(v -> v.getString("welfareUnionId").equals(union.getString("id")) && v.getString("selectOptionId").equals(option.getId())).map(v -> v.getString("selectUserId")).distinct().count();
union.put(option.getId(), count);
int total = userSelections.stream()
.filter(v ->
StrUtil.isNotBlank(v.getString("welfareUnionId"))
&& v.getString("welfareUnionId").equals(union.getString("id"))
&& StrUtil.isNotBlank(v.getString("selectOptionId"))
&& v.getString("selectOptionId").equals(option.getId())
&& StrUtil.isNotBlank(v.getString("selectUserId")) // 确保 userId 有效
)
.collect(Collectors.toMap(
v -> v.getString("selectUserId"),
v -> v,
(existing, replacement) -> existing // 保留第一个
// 不传第四个参数,默认用 HashMap
))
.values()
.stream()
.mapToInt(v -> v.getInt("selectNum"))
.sum();
union.put(option.getId(), total);
}
}
@@ -101,7 +101,7 @@ layout("/layouts/platform.html"){
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include('courseList.js'){}#-->
<!--#include('../manage/info.js'){}#-->
new Vue({
@@ -111,8 +111,8 @@ const basicForm = {
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="办单位" prop="helpUnits">
<el-select multiple filterable placeholder="请选择办单位" style="width: 100%" v-model="formData.helpUnits">
<el-form-item label="办单位" prop="helpUnits">
<el-select multiple filterable placeholder="请选择办单位" style="width: 100%" v-model="formData.helpUnits">
<el-option :label="item.name" :value="item.id" :key="item.id" v-for="item in undertakeOptions"></el-option>
</el-select>
</el-form-item>
@@ -536,12 +536,6 @@ const basicForm = {
}
this.formData.isDisabled = false
await this.doHandle('提交')
} else {
if(Object.keys(errMsg).length > 0) {
this.$message.warning(errMsg[Object.keys(errMsg)[0]][0].message)
return
}
this.$message.warning("存在必填项未填写")
}
})
},
@@ -551,8 +545,8 @@ const basicForm = {
cloneData.activitySignUpEndTime = cloneData.activitySignTime !== undefined ? cloneData.activitySignTime[1] : null
cloneData.activityStartTime = cloneData.activityTime !== undefined ? cloneData.activityTime[0] : null
cloneData.activityEndTime = cloneData.activityTime !== undefined ? cloneData.activityTime[1] : null
if (cloneData.activityStartTime !== undefined && cloneData.activityStartTime !== null) {
cloneData.year = new Date(cloneData.activityStartTime).getFullYear()
if (cloneData.activitySignUpStartTime !== undefined && cloneData.activitySignUpStartTime !== null) {
cloneData.year = new Date(cloneData.activitySignUpStartTime).getFullYear()
}
cloneData.typeLimits = JSON.stringify(this.formData.typeLimits)
cloneData.courseList = JSON.stringify(cloneData.courseList)
@@ -127,7 +127,7 @@ layout("/layouts/platform.html"){
</div>
<script src="${base!}/assets/platform/plugins/jr-qrcode/jr-qrcode.js"></script>
<script>
<script nonce="${cspNonce!}">
<!--#include('info.js'){}#-->
<!--#include('basicForm.js'){}#-->
<!--#include('makeQrcode.js'){}#-->
@@ -77,7 +77,7 @@ layout("/layouts/platform.html"){
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include('info.js'){}#-->
new Vue({
el: "#app",
@@ -56,7 +56,7 @@ layout("/layouts/platform.html"){
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include('basicForm.js'){}#-->
const vue = new Vue({
el: "#app",
@@ -76,7 +76,7 @@ layout("/layouts/platform.html"){
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include('userInfo.js'){}#-->
new Vue({
el: "#app",
@@ -50,11 +50,14 @@ const userInfo = {
<el-table :data="courseList" class="mt20">
<el-table-column label="单选" width="160">
<template v-slot="{row}">
<el-radio
@change.native="getCurrentRow(row)"
:disabled="(row.courseReservedNumber + row.registerNum) >= row.coursePeopleNumber"
v-model="afterAdjustCourse"
></el-radio>
<el-radio-group v-model="afterAdjustCourse">
<el-radio
@change.native="getCurrentRow(row)"
:disabled="(row.courseReservedNumber + row.registerNum) >= row.coursePeopleNumber"
:label="row.id"
key="row.id"
> &nbsp;</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column
@@ -16,12 +16,12 @@ layout("/layouts/platform.html"){
></el-date-picker>
</search-item>
<search-item label="活动名称">
<el-select @change="activityChange" style="width: 100%" v-model="pageForm.activityId">
<el-select @change="activityChange" style="width: 100%" v-model="pageForm.activityId" filterable>
<el-option :label="item.activityName" :value="item.id" v-for="item in activityList" :key="item.id"></el-option>
</el-select>
</search-item>
<search-item :label="trainType + ''">
<el-select @change="courseChange" :placeholder="'请选择' + trainType" style="width: 100%" v-model="pageForm.courseId">
<el-select @change="courseChange" :placeholder="'请选择' + trainType" style="width: 100%" v-model="pageForm.courseId" filterable>
<el-option :label="item.courseName" :value="item.id" v-for="item in courseList" :key="item.id"></el-option>
</el-select>
</search-item>
@@ -36,7 +36,7 @@ layout("/layouts/platform.html"){
<el-button @click="exportSignPerson" type="primary" size="small">导出签到名单</el-button>
<el-button @click="exportGiftPerson" type="primary" size="small">导出领取名单</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column
:label="column.prop === 'courseNames' ? trainType : column.label"
@@ -45,8 +45,6 @@ layout("/layouts/platform.html"){
align="center"
header-align="center"
show-overflow-tooltip
v-if="(column.prop !== 'state' && column.prop !== 'absentCount') || (reserveMode === 2 && column.prop === 'state' && column.prop !== 'absentCount')
|| (column.prop === 'absentCount' && course.isMobileSign === true)"
v-for="(column,index) in tableColumns"
:key="index"
>
@@ -90,7 +88,7 @@ layout("/layouts/platform.html"){
</el-dialog>
</div>
<script>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
dicts: ["TRAIN_SIGNUP_TYPE"],
@@ -111,7 +109,9 @@ layout("/layouts/platform.html"){
{ label: "单位", prop: "unitName", sortable: true },
{ label: "分工会", prop: "unionName", sortable: true },
{ label: "课程", prop: "courseNames", sortable: true },
{ label: "缺席次数", prop: "absentCount" },
{ label: "次数", prop: "totalCount", sortable: true },
{ label: "签到次数", prop: "signCount", sortable: true },
{ label: "缺席次数", prop: "absentCount", sortable: true },
{ label: "是否黑名单", prop: "isDisabled", sortable: true }
],
trainType: "培训班",
@@ -198,7 +198,12 @@ layout("/layouts/platform.html"){
this.trainType = type?.name || "培训班"
const resp = await this.$axios.post(loc() + "/getCourseByActivityId", { activityId: val })
this.courseList = resp.data
this.pageForm.courseId = ""
if(this.courseList.length > 0) {
this.$set(this.pageForm, "courseId", this.courseList[0].id)
} else {
this.pageForm.courseId = ""
}
this.doSearch()
})
},
async handleUser(userId) {
@@ -53,7 +53,7 @@ layout("/layouts/platform.html"){
<address-dialog ref="addressDialog" @select_user_address="selectUserAddress"></address-dialog>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("addressDialog.js"){}#-->
new Vue({
el: "#app",
@@ -7,10 +7,10 @@ layout("/layouts/platform.html"){
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="活动时间">
<search-item label="年度">
<el-date-picker
:clearable="false"
placeholder="活动时间"
placeholder="请选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
@@ -88,7 +88,7 @@ layout("/layouts/platform.html"){
<select-view ref="selectViewRef"></select-view>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include('selectView.js'){}#-->
new Vue({
@@ -38,6 +38,12 @@ const selectView = {
<div class="info-item">
<div class="info-label">联系电话</div>
<div class="info-value">{{ mergedSelections[0]?.mobile || '暂无' }}</div>
</div>
<div class="info-item">
<div class="info-label">收货地址</div>
<div class="info-value">{{ mergedSelections[0]?.receiveAddress || '暂无' }}</div>
</div>
</div>
</div>
@@ -7,10 +7,10 @@ layout("/layouts/platform.html"){
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="活动时间">
<search-item label="年度">
<el-date-picker
:clearable="false"
placeholder="活动时间"
placeholder="请选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
@@ -18,8 +18,8 @@ layout("/layouts/platform.html"){
></el-date-picker>
</search-item>
<search-item label="活动时间">
<el-input clearable placeholder="请输入活动名称" v-model="pageForm.name"></el-input>
<search-item label="项目名称">
<el-input clearable placeholder="请输入项目名称" v-model="pageForm.name"></el-input>
</search-item>
</search>
</el-card>
@@ -93,13 +93,13 @@ layout("/layouts/platform.html"){
</el-form-item>
<el-row>
<el-col :span="12">
<!--<el-col :span="12">
<el-form-item label="发放节日" prop="festival">
<el-select filterable placeholder="发放节日" style="width: 100%" v-model="formData.festival">
<el-option :key="f.code" :label="f.code" :value="f.name" v-for="f in festival"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>-->
<el-col :span="12">
<el-form-item label="选择时间" prop="choiceTime">
<el-date-picker
@@ -225,17 +225,18 @@ layout("/layouts/platform.html"){
></file-upload>
</el-form-item>
</el-form>
<el-row justify="end" style="justify-content: end" type="flex">
<el-button @click="$refs.guava.index()">取消</el-button>
<el-button @click="save" type="primary" v-loading="submitLoading">提交</el-button>
</el-row>
</template>
<template #edit_footer>
<el-button @click="$refs.guava.index()">取消</el-button>
<el-button @click="save" type="primary" v-loading="submitLoading">提交</el-button>
</template>
</guava>
<filter-user ref="filterUserRef"></filter-user>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("/platform/zhgh/welfare/include/common.js"){}#-->
<!--#include("welfareOptionTable.js"){}#-->
<!--#include("welfareOption.js"){}#-->
@@ -8,11 +8,11 @@ layout("/layouts/platform.html"){
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">&emsp;&emsp;度:</div>
<div class="search-item-label">年度:</div>
<div class="search-item-option">
<el-date-picker
@change="doSearch"
placeholder="请选择"
placeholder="请选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
@@ -99,7 +99,7 @@ layout("/layouts/platform.html"){
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("optionSelect.js"){}#-->
new Vue({
el: "#app",
@@ -388,7 +388,6 @@ layout("/layouts/platform.html"){
top: 8px;
right: 8px;
z-index: 2;
padding: 4px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
@@ -1,3 +1,4 @@
<!--#include("../addressManage/addressDialog.js"){}#-->
const optionSelect = {
template: /*language=HTML*/ `
<div class="welfare-select-container" v-if="projectInfo.id">
@@ -23,9 +24,9 @@ const optionSelect = {
<i class="el-icon-info"></i>
<span>项目信息</span>
</div>
<div class="project-cover" v-if="projectInfo.cover">
<el-image :src="projectInfo.cover" fit="cover"></el-image>
</div>
<!-- <div class="project-cover" v-if="projectInfo.cover">
<el-image :src="projectInfo.cover" fit="cover"></el-image>
</div>-->
<div class="welfare-info-content">
<div class="info-item">
<div class="info-label">项目名称</div>
@@ -133,7 +134,7 @@ const optionSelect = {
<el-dialog
title="确认选择"
:visible.sync="showConfirmDialog"
width="500px"
width="60%"
append-to-body
custom-class="welfare-confirm-dialog">
<div class="confirm-content">
@@ -141,25 +142,49 @@ const optionSelect = {
<div class="confirm-mobile-section">
<div class="confirm-section-title">联系信息</div>
<el-form :model="contactForm" ref="contactForm" :rules="contactRules" label-width="80px">
<el-form-item prop="mobile" label="联系电话">
<el-input
v-model="contactForm.mobile"
placeholder="请输入手机号码"
maxlength="11"
clearable>
</el-input>
</el-form-item>
<el-form-item v-if="projectInfo.provideMode == 3" prop="receiveAddress" label="收货地址"
:rules="[{ required: true, message: '请选择收货地址', trigger: 'change' }]">
<el-select v-model="contactForm.receiveAddress" placeholder="请选择收货地址"
style="width: 100%">
<el-option v-for="item in addressOptions"
:key="item.id"
:label="item.userName + ' ' + item.tel + ' ' + item.province + ' ' + item.city + ' ' + item.county + ' ' + item.addressDetail"
:value="item.userName + ' ' + item.tel + ' ' + item.province + ' ' + item.city + ' ' + item.county + ' ' + item.addressDetail">
</el-option>
</el-select>
</el-form-item>
<el-row :gutter="10">
<el-col :span="20" v-if="projectInfo.provideMode == 3">
<el-form-item prop="receiveAddress"
label="收货地址"
:rules="[{ required: true, message: '请选择收货地址', trigger: 'change' }]">
<el-select v-model="contactForm.receiveAddress" placeholder="请选择收货地址"
style="width: 100%" @change="onAddressChange">
<el-option v-for="item in addressOptions"
:key="item.id"
:label="item.province+ item.city+ item.county+ item.addressDetail"
:value="item.province + item.city + item.county + item.addressDetail">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4" v-if="projectInfo.provideMode == 3">
<el-button @click="openAddress" type="primary" size="small">添加地址</el-button>
</el-col>
<el-col :span="24" v-if="projectInfo.provideMode == 3">
<el-form-item prop="userName" label="收货人">
<el-input
v-model="contactForm.userName"
placeholder="请输入收货人"
clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="mobile" label="联系电话">
<el-input
v-model="contactForm.mobile"
placeholder="请输入手机号码"
maxlength="11"
clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="userSign" label="签字" :required="projectInfo.signMode == 2">
<pc-signature v-model="contactForm.userSign"></pc-signature>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
@@ -217,10 +242,19 @@ const optionSelect = {
<el-button type="primary" :loading="isSubmitting" @click="doSubmit">{{ hasSubmittedBefore ? '确认修改' : '确认提交' }}</el-button>
</span>
</el-dialog>
<address-dialog ref="addressDialog" @select_user_address="getAddress"></address-dialog>
</div>
`,
store,
data() {
const validateUserSign = (rule, value, callback) => {
if (this.projectInfo.signMode === 2 && !value) {
callback(new Error("请签字"))
return
}
callback()
}
return {
projectId: null, // 项目ID
userId: null, // 用户id 代选的时候用得到
@@ -234,10 +268,15 @@ const optionSelect = {
showOptionDetailDialog: false, // 选项详情弹窗
selectedOption: null, // 当前选中的选项
contactForm: {
mobile: "", // 联系电话,
receiveAddress: ""
mobile: "", // 联系电话
receiveAddress: "",
userName: "", // 收货人
userSign: ""
},
contactRules: {
userName: [
{required: true, message: "请输入收货人", trigger: "blur"}
],
mobile: [
{required: true, message: "请输入联系电话", trigger: "blur"},
{
@@ -245,11 +284,17 @@ const optionSelect = {
message: "请输入正确的手机号码",
trigger: "blur"
}
],
userSign: [
{validator: validateUserSign, message: "请签字", trigger: "blur"}
]
},
addressOptions: []
}
},
components: {
"address-dialog": ADDRESS_DIALOG
},
computed: {
// 是否有选择
hasSelection() {
@@ -323,6 +368,25 @@ const optionSelect = {
}
},
methods: {
// 地址选择变更处理
onAddressChange(value) {
if (value) {
const selectedAddress = this.addressOptions.find(item =>
(item.province + item.city + item.county + item.addressDetail) === value
);
if (selectedAddress) {
// 自动填充收货人和电话
this.$set(this.contactForm, "userName", selectedAddress.userName)
this.$set(this.contactForm, "mobile", selectedAddress.tel)
// this.contactForm.userName = selectedAddress.userName;
// this.contactForm.mobile = selectedAddress.tel;
}
}
},
openAddress() {
this.$refs.addressDialog.dialogVisible = true
this.$refs.addressDialog.formData = {userId: this.userId}
},
// 打开选择项目弹窗 userId为null默认则是本人
onOpen(projectId, userId = null) {
this.projectId = projectId
@@ -398,6 +462,10 @@ const optionSelect = {
if (this.projectInfo.provideMode === 3) {
if (this.userSelection.length > 0 && this.userSelection[0].receiveAddress) {
this.contactForm.receiveAddress = this.userSelection[0].receiveAddress
// this.contactForm.userName = this.userSelection[0].userName;
// this.contactForm.mobile = this.userSelection[0].mobile;
this.$set(this.contactForm, "userName", this.userSelection[0].userName)
this.$set(this.contactForm, "mobile", this.userSelection[0].mobile)
}
}
@@ -448,6 +516,8 @@ const optionSelect = {
selectOptionId: this.selectedRadioId,
selectNum: 1,
mobile: this.contactForm.mobile,
userName: this.contactForm.userName,
userSign: this.contactForm.userSign,
receiveAddress: this.contactForm.receiveAddress
}
]
@@ -459,6 +529,8 @@ const optionSelect = {
selectOptionId: option.id,
selectNum: option.selectNum,
mobile: this.contactForm.mobile,
userName: this.contactForm.userName,
userSign: this.contactForm.userSign,
receiveAddress: this.contactForm.receiveAddress
}))
}
@@ -543,7 +615,7 @@ const optionSelect = {
// 获取收货地址
async getAddress() {
const resp = await this.$axios.post("/platform/welfare/addressManage/selectUserAddress")
const resp = await this.$axios.post("/platform/welfare/addressManage/selectUserAddress",{userId:this.userId})
if (resp.code === 0) {
this.addressOptions = resp.data
}
@@ -822,7 +894,6 @@ const optionSelect = {
top: 8px;
right: 8px;
z-index: 2;
padding: 4px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
@@ -6,10 +6,10 @@ layout("/layouts/platform.html"){
<guava>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="所属年份">
<search-item label="年度">
<el-date-picker
:clearable="false"
placeholder="所属年份"
placeholder="请选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
@@ -75,6 +75,10 @@ layout("/layouts/platform.html"){
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="exportXlsx">
导出选择情况表
</el-button>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="receiveXlsx">
导出领取表
</el-button>
</table-tool>
<el-table
@@ -117,7 +121,7 @@ layout("/layouts/platform.html"){
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("../select/optionSelect.js"){}#-->
new Vue({
@@ -152,12 +156,12 @@ layout("/layouts/platform.html"){
computed: {
welfareOptions() {
if (this.pageForm.projectId) {
return this.projectOptions.find((item) => item.id === this.pageForm.projectId).options
return this.projectOptions.find((item) => item.id === this.pageForm.projectId)?.options
}
return []
},
provideMode() {
return this.projectOptions.find((item) => item.id === this.pageForm.projectId).provideMode
return this.projectOptions.find((item) => item.id === this.pageForm.projectId)?.provideMode
}
},
methods: {
@@ -195,6 +199,11 @@ layout("/layouts/platform.html"){
this.$downLoad("/platform/welfare/selection/situation/exportXlsx", { pageForm: JSON.stringify(this.pageForm) })
},
// 导出选择情况表
receiveXlsx() {
this.$downLoad("/platform/welfare/selection/situation/receiveXlsx", { pageForm: JSON.stringify(this.pageForm) })
},
// 管理员待选
proxySelect(row) {
this.optionSelectVisible = true
@@ -7,11 +7,11 @@ layout("/layouts/platform.html"){
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="所属年份">
<search-item label="年度">
<el-date-picker
:clearable="false"
@change="getWelfareProjectList"
placeholder="所属年份"
placeholder="请选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
@@ -80,7 +80,7 @@ layout("/layouts/platform.html"){
<unselected-user ref="unSelectedUserRef"></unselected-user>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include('selectedUser.js'){}#-->
<!--#include('unSelectedUser.js'){}#-->
@@ -91,6 +91,7 @@ layout("/layouts/platform.html"){
"selected-user": selectedUser,
"unselected-user": unSelectedUser
},
store,
data() {
return {
pageForm: {
@@ -155,6 +156,7 @@ layout("/layouts/platform.html"){
this.welfareOptions = data.options
},
async init() {
await this.getWelfareProjectList()
if (
!this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"]) &&
this.$auth.hasRoleOr(["BRANCH_UNION_CHAIRMAN"])
@@ -166,7 +168,6 @@ layout("/layouts/platform.html"){
this.unionOptions = await this.$businessTool.listUnion()
this.clearable = true
}
await this.getWelfareProjectList()
await this.pageData()
}
},
@@ -8,11 +8,11 @@ layout("/layouts/platform.html"){
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">&emsp;&emsp;度:</div>
<div class="search-item-label">年度:</div>
<div class="search-item-option">
<el-date-picker
@change="doSearch"
placeholder="请选择"
placeholder="请选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
@@ -99,7 +99,7 @@ layout("/layouts/platform.html"){
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("chooseWelfare.js"){}#-->
new Vue({
el: "#app",
@@ -7,10 +7,10 @@ layout("/layouts/platform.html"){
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="所属年份">
<search-item label="年度">
<el-date-picker
:clearable="false"
placeholder="所属年份"
placeholder="请选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
@@ -222,7 +222,7 @@ layout("/layouts/platform.html"){
></excel-import>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("importCourierNumberDialog.js"){}#-->
<!--#include("addWelfareListBySelect.js"){}#-->
<!--#include("addUser.js"){}#-->
@@ -51,7 +51,7 @@ layout("/layouts/platform_h5.html"){
></activity_event_notification>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("eventNotification.js"){}#-->
new Vue({
el: "#app",
@@ -53,12 +53,18 @@ layout("/layouts/platform_h5.html"){
<span v-else>暂无</span>
</template>
</van-cell>
<van-cell title="已报名总人数">
<!-- <van-cell title="已报名总人数">-->
<!-- <template #right-icon>-->
<!-- <span v-if="row.successUserApply>0&&row.applyType!==3">{{ row.successUserApply }}人</span>-->
<!-- <span v-else-if="JSON.parse(row.applyWay).length===2&&row.applyWay.includes(1)">{{row.totalApplyNum}}人</span>-->
<!-- <span v-else-if="row.totalApplyNum>0&&row.applyType===3">{{ row.totalApplyNum }}人</span>-->
<!-- <span v-else>0人</span>-->
<!-- </template>-->
<!-- </van-cell>-->
<van-cell title="暂保存人数">
<template #right-icon>
<span v-if="row.successUserApply>0&&row.applyType!==3">{{ row.successUserApply }}人</span>
<span v-else-if="JSON.parse(row.applyWay).length===2&&row.applyWay.includes(1)">{{row.totalApplyNum}}人</span>
<span v-else-if="row.totalApplyNum>0&&row.applyType===3">{{ row.totalApplyNum }}人</span>
<span v-else>0人</span>
<span v-if="row.apply_num_bc>0">已保存({{row.apply_num_bc}}</span>
<span v-else>暂无已保存人数</span>
</template>
</van-cell>
<van-cell title="已报名人员" v-if="JSON.parse(row.applyWay).length===1">
@@ -103,7 +109,7 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<script>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
store,
@@ -91,7 +91,7 @@ layout("/layouts/platform_h5.html"){
</div>
<script>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: "#app",
store,
@@ -4,7 +4,8 @@ const times = {
`
<div>
<van-action-sheet v-model="visible" title="时间段" cancel-text="取消">
<div id="mapContainer" v-if="row?.isMobileSign === true && row?.signType === 3" style="width: 100%; height: 250px"></div>
<div id="mapContainer" v-if="row?.isMobileSign === true && row?.signType === 3"
style="width: 100%; height: 250px"></div>
<button v-for="(item,index) in row?.courseTimes" type="button" class="van-action-sheet__item">
<div style="display: flex; justify-content: space-between; align-items: center">
<div>
@@ -13,21 +14,28 @@ const times = {
<label>{{ $moment(item.courseDate).format('YYYY-MM-DD') }}</label>
</div>
<div class="van-action-sheet__subname">
{{$moment(item.courseStartTime).format('MM-DD HH:mm') + ' 至 ' + $moment(item.courseEndTime).format('MM-DD HH:mm')}}
{{$moment(item.courseStartTime).format('MM-DD HH:mm') + ' 至 ' +
$moment(item.courseEndTime).format('MM-DD HH:mm')}}
</div>
</div>
<div v-if="row.isSign === true && row.isMobileSign === true" class="sign_button">
<van-button v-if="item.isAttend !== true" @click.stop="onSign(item)" size="mini" type="info">签到</van-button>
<van-button v-if="item.isAttend === true" size="mini" type="info" disabled>已签到</van-button>
<van-button
v-if="item.isAttend !== true
&&
$moment(item.courseEndTime).unix()>$moment().unix()"
@click.stop="onSign(item)" size="mini" type="info">签到
</van-button>
<van-button v-if="item.isAttend === true" size="mini" type="info" disabled>已签到
</van-button>
</div>
</div>
</button>
</van-action-sheet>
<van-popup round :safe-area-inset-bottom="true"
:close-on-click-overlay="false"
v-model="signVisible"
:style="{ width: '80%', height: '66%' }"
<van-popup round :safe-area-inset-bottom="true"
:close-on-click-overlay="false"
v-model="signVisible"
:style="{ width: '80%', height: '66%' }"
get-container="#app"
@close="onSignClose"
closeable
@@ -39,7 +47,7 @@ const times = {
store,
data() {
return {
visible:false,
visible: false,
row: null,
weekdayCNMap: {0: '周日', 1: '周一', 2: '周二', 3: '周三', 4: '周四', 5: '周五', 6: '周六'},
@@ -62,8 +70,8 @@ const times = {
this.row = row
this.visible = true
this.$nextTick(() => {
if(this.row.signType === 3) {
if(this.map) this.map.destroy()
if (this.row.signType === 3) {
if (this.map) this.map.destroy()
this.initMap()
this.getLocation((coords) => {
if (coords) {
@@ -115,7 +123,8 @@ const times = {
},
getLocation(callback) {
if (typeof callback !== 'function') {
callback = () => {};
callback = () => {
};
}
if (!navigator.geolocation) {
this.$toast('当前浏览器不支持定位功能');
@@ -161,7 +170,7 @@ const times = {
);
},
initMap() {
if(!this.row.courseLocationCoordinates) {
if (!this.row.courseLocationCoordinates) {
this.$toast('未设置签到点')
return
}
@@ -210,11 +219,11 @@ const times = {
const content = jrQrcode.getQrBase64(data)
vant.ImagePreview([content])
},
onClose(){
onClose() {
this.visible = false
},
},
style: /*language=CSS*/ `
`
}
@@ -94,7 +94,7 @@ layout("/layouts/platform_h5.html"){
</div>
<script src="${base!}/assets/platform/plugins/jr-qrcode/jr-qrcode.js"></script>
<script>
<script nonce="${cspNonce!}">
<!--#include('../common/times.js'){}#-->
<!--#include('applyForm.js'){}#-->
const vue = new Vue({
@@ -78,7 +78,7 @@ layout("/layouts/platform_h5.html"){
</div>
<script>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: "#app",
store,
@@ -30,7 +30,7 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<script>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: "#app",
store,
@@ -37,7 +37,7 @@ layout("/layouts/platform_h5.html"){
</van-action-sheet>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include("/platform/zhghh5/welfare/include/areaList.js"){}#-->
const vue = new Vue({
el: "#app",
@@ -85,11 +85,11 @@ layout("/layouts/platform_h5.html"){
<div class="wf-card-heading">{{row.name}}</div>
<div class="wf-time-row">
<span class="wf-time-label">开始时间:</span>
{{row.choiceTimeStart}}
{{$moment(row.choiceTimeStart).format('YYYY-MM-DD HH:mm')}}
</div>
<div class="wf-time-row">
<span class="wf-time-label">结束时间:</span>
{{row.choiceTimeEnd}}
{{$moment(row.choiceTimeEnd).format('YYYY-MM-DD HH:mm')}}
</div>
</div>
</div>
@@ -101,7 +101,7 @@ layout("/layouts/platform_h5.html"){
<select-view ref="selectViewRef"></select-view>
</div>
<script>
<script nonce="${cspNonce!}">
<!--#include('selectView.js'){}#-->
new Vue({
@@ -1,12 +1,12 @@
const selectView = {
template: /*language=HTML*/ `
<van-action-sheet
v-model="visible"
:title="'我的福利选择'"
close-icon="close"
safe-area-inset-bottom
@close="handleClose"
:overlay-class="detailVisible ? 'no-overlay' : ''"
v-model="visible"
:title="'我的福利选择'"
close-icon="close"
safe-area-inset-bottom
@close="handleClose"
:overlay-class="detailVisible ? 'no-overlay' : ''"
>
<div class="welfare-view">
<!-- 内容区域 -->
@@ -14,37 +14,58 @@ const selectView = {
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-skeleton title :row="6" :loading="loading" animated>
<!-- 项目基本信息 -->
<div class="welfare-card">
<div class="welfare-card__header">
<i class="el-icon-s-flag"></i>
<span>项目基本信息</span>
</div>
<div class="welfare-card__content">
<div class="info-row">
<div class="info-row__label">项目名称</div>
<div class="info-row__value">{{ projectInfo.name }}</div>
</div>
<div class="info-row info-row--time">
<div class="info-row__label">选择时间</div>
<div class="info-row__value">
<div class="time-item time-item--start">{{ projectInfo.choiceTimeStart }}</div>
<div class="time-item time-item--end">{{ projectInfo.choiceTimeEnd }}</div>
<van-collapse v-model="activeNames">
<van-collapse-item name="1">
<template #title>
<div class="welfare-card__header">
<i class="el-icon-s-flag"></i>
<span>项目基本信息</span>
</div>
</template>
<div class="welfare-card__content">
<div class="info-row">
<div class="info-row__label">项目名称</div>
<div class="info-row__value">{{ projectInfo.name }}</div>
</div>
<div class="info-row info-row--time">
<div class="info-row__label">选择时间</div>
<div class="info-row__value">
<div class="time-item time-item--start">{{
$moment(projectInfo.choiceTimeStart).format('YYYY-MM-DD HH:mm')
}}
</div>
<div class="time-item time-item--end">{{
$moment(projectInfo.choiceTimeEnd).format('YYYY-MM-DD HH:mm') }}
</div>
</div>
</div>
<div class="info-row info-row--time">
<div class="info-row__label">发放时间</div>
<div class="info-row__value">
<div class="time-item time-item--start">{{
$moment(projectInfo.provideTimeStart).format('YYYY-MM-DD HH:mm')
}}
</div>
<div class="time-item time-item--end">{{
$moment(projectInfo.provideTimeEnd).format('YYYY-MM-DD HH:mm')
}}
</div>
</div>
</div>
<div class="info-row">
<div class="info-row__label">发放地点</div>
<div class="info-row__value">{{ projectInfo.provideAddress || '暂无'
}}
</div>
</div>
</div>
</div>
<div class="info-row info-row--time">
<div class="info-row__label">发放时间</div>
<div class="info-row__value">
<div class="time-item time-item--start">{{ projectInfo.provideTimeStart }}</div>
<div class="time-item time-item--end">{{ projectInfo.provideTimeEnd }}</div>
</div>
</div>
<div class="info-row">
<div class="info-row__label">发放地点</div>
<div class="info-row__value">{{ projectInfo.provideAddress || '暂无' }}</div>
</div>
</div>
</van-collapse-item>
</van-collapse>
</div>
<!-- 联系信息 -->
<div class="welfare-card">
<div class="welfare-card__header">
@@ -58,7 +79,9 @@ const selectView = {
</div>
<div class="info-row">
<div class="info-row__label">收货地址</div>
<div class="info-row__value">{{ mergedSelections[0]?.receiveAddress || '暂无' }}</div>
<div class="info-row__value">{{ mergedSelections[0]?.receiveAddress || '暂无'
}}
</div>
</div>
</div>
</div>
@@ -73,11 +96,11 @@ const selectView = {
<div v-if="mergedSelections.length > 0" class="selection-list">
<div class="selection-item"
v-for="item in mergedSelections"
:key="item.id"
@click="showOptionDetail(item)">
v-for="item in mergedSelections"
:key="item.id"
@click="showOptionDetail(item)">
<div class="selection-item__image">
<img :src="item.imgUrl"
<img :src="item.imgUrl"
alt="福利图片"
@error="handleImageError">
</div>
@@ -110,16 +133,17 @@ const selectView = {
<!-- 选项详情弹窗 -->
<van-action-sheet
v-model="detailVisible"
:title="currentOption?.optionName || '福利详情'"
close-icon="close"
safe-area-inset-bottom
@close="closeDetail"
:z-index="2001"
v-model="detailVisible"
:title="currentOption?.optionName || '福利详情'"
close-icon="close"
safe-area-inset-bottom
@close="closeDetail"
:z-index="2001"
>
<div class="welfare-detail" v-if="currentOption">
<van-skeleton title :row="10" :loading="descLoading" animated>
<div class="welfare-detail__content rich-text" v-html="currentOption.description || '暂无详细说明'"></div>
<div class="welfare-detail__content rich-text"
v-html="currentOption.description || '暂无详细说明'"></div>
</van-skeleton>
</div>
</van-action-sheet>
@@ -144,7 +168,8 @@ const selectView = {
},
selectedOptions: [],
detailVisible: false,
currentOption: null
currentOption: null,
activeNames:[]
}
},
computed: {
@@ -82,7 +82,7 @@ layout("/layouts/platform_h5.html"){
}
.welfare-info-header {
padding: 16px;
/*padding: 16px;*/
color: var(--text-primary);
font-weight: 600;
font-size: 17px;
@@ -192,7 +192,7 @@ layout("/layouts/platform_h5.html"){
}
.welfare-option-content {
padding: 12px;
padding: 6px 12px;
flex: 1;
display: flex;
flex-direction: column;
@@ -277,8 +277,8 @@ layout("/layouts/platform_h5.html"){
.welfare-tag {
position: absolute;
right: 8px;
top: 8px;
right: 41px;
top: -3px;
z-index: 2;
}
@@ -531,20 +531,31 @@ layout("/layouts/platform_h5.html"){
text-align: center;
margin-top: 6px;
}
.welfare-info-card .van-collapse-item__content {
padding: 0;
}
.welfare-info-card .welfare-cell-group .van-cell__title {
max-width: 70px;
}
.welfare-info-card .welfare-cell-group .van-cell {
padding: 8px 16px;
}
</style>
<div id="app" v-cloak>
<div class="page-container">
<van-nav-bar title="福利选择" left-text="返回" left-arrow @click-left="historyBack" fixed placeholder></van-nav-bar>
<van-nav-bar title="福利选择" left-text="返回" left-arrow @click-left="historyBack" fixed
placeholder></van-nav-bar>
<!-- 项目头部信息 -->
<div class="welfare-header" v-if="projectInfo.id">
<img :src="projectInfo.cover" class="welfare-header-img" />
<img :src="projectInfo.cover" class="welfare-header-img"/>
<div class="welfare-header-overlay">
<div class="welfare-title">{{ projectInfo.name }}</div>
<div class="welfare-subtitle">
<van-icon name="calendar-o" />
<span>{{ projectInfo.festival }} · {{ projectInfo.year }}年</span>
<van-icon name="calendar-o"/>
<span>{{ projectInfo.year }}年</span>
</div>
</div>
</div>
@@ -552,14 +563,14 @@ layout("/layouts/platform_h5.html"){
<!-- 加载中 -->
<van-empty v-if="!projectInfo.id" description="加载中...">
<template #image>
<van-loading type="spinner" color="#1989fa" />
<van-loading type="spinner" color="#1989fa"/>
</template>
</van-empty>
<div class="main-content" v-if="projectInfo.id">
<!-- 截止时间提醒 -->
<div class="welfare-deadline" v-if="isDeadlineSoon">
<van-icon name="warning-o" />
<van-icon name="warning-o"/>
<span>选择截止时间即将到期,请尽快选择!</span>
</div>
@@ -567,26 +578,37 @@ layout("/layouts/platform_h5.html"){
<div class="welfare-notice">
<van-notice-bar wrapable :scrollable="false" background="#ecf6ff" color="var(--primary-color)">
<van-icon name="info-o" style="margin-right: 5px"></van-icon>
{{ projectInfo.isCheckBox === "radio" ? "请选择一项福利" : "您可以选择多项福利,最多可选 " + (projectInfo.multiSelectNum ||
{{ projectInfo.isCheckBox === "radio" ? "请选择一项福利" : "您可以选择多项福利,最多可选 " +
(projectInfo.multiSelectNum ||
projectInfo.options.length) + " 项" }}
</van-notice-bar>
</div>
<!-- 项目信息卡片 -->
<div class="welfare-info-card">
<div class="welfare-info-header">
<div class="header-text">
<van-icon name="info-o" />
<span>项目信息</span>
</div>
</div>
<div class="welfare-cell-group">
<van-cell title="选择时间" :value="formatTimeRange(projectInfo.choiceTimeStart, projectInfo.choiceTimeEnd)"></van-cell>
<van-cell title="发放时间" :value="formatTimeRange(projectInfo.provideTimeStart, projectInfo.provideTimeEnd)"></van-cell>
<van-cell title="发放地点" :value="projectInfo.provideAddress"></van-cell>
<van-collapse v-model="activeNames">
<van-collapse-item name="1">
<template #title>
<div class="welfare-info-header">
<div class="header-text">
<van-icon name="info-o"></van-icon>
<span>项目信息</span>
</div>
</div>
</template>
<div class="welfare-cell-group">
<van-cell title="选择时间"
:value="formatTimeRange(projectInfo.choiceTimeStart, projectInfo.choiceTimeEnd)"></van-cell>
<van-cell title="发放时间"
:value="formatTimeRange(projectInfo.provideTimeStart, projectInfo.provideTimeEnd)"></van-cell>
<van-cell title="发放地点" :value="projectInfo.provideAddress"></van-cell>
</div>
</van-collapse-item>
<!-- <van-cell title="发放方式" :value="getProvideModeName(projectInfo.provideMode)"></van-cell>-->
<!-- <van-cell title="签字方式" :value="getSignModeName(projectInfo.signMode)"></van-cell>-->
</div>
</div>
<div class="section-divider"></div>
@@ -594,7 +616,7 @@ layout("/layouts/platform_h5.html"){
<!-- 福利选项标题 -->
<div class="welfare-section-title">
<div class="title-text">
<van-icon name="gift-o" />
<van-icon name="gift-o"/>
<span>福利选项</span>
<span class="title-count">共 {{ projectInfo.options.length }} 项</span>
</div>
@@ -603,15 +625,16 @@ layout("/layouts/platform_h5.html"){
<!-- 福利选项列表 -->
<div class="welfare-options-container">
<div
v-for="(option,index) in projectInfo.options"
:key="option.id"
class="welfare-option"
:class="{ selected: projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0 }"
@click="projectInfo.isCheckBox === 'radio' && !isDeadlinePassed ? selectRadioOption(option.id) : null"
v-for="(option,index) in projectInfo.options"
:key="option.id"
class="welfare-option"
:class="{ selected: projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0 }"
@click="projectInfo.isCheckBox === 'radio' && !isDeadlinePassed ? selectRadioOption(option.id) : null"
>
<div class="welfare-option-image">
<van-image :src="option.imgUrl" fit="cover" width="100%" height="100%" radius="4px"></van-image>
<div class="welfare-tag" v-if="projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0">
<div class="welfare-tag"
v-if="projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0">
<van-tag type="primary" round>已选择</van-tag>
</div>
</div>
@@ -621,34 +644,34 @@ layout("/layouts/platform_h5.html"){
<!-- 查看详情按钮 -->
<div class="welfare-detail-btn" @click.stop="showOptionDetail(option)">
<van-icon name="info-o" />
<span>查看详情</span>
<van-icon name="info-o"/>
<span style="position: relative; top: -0.5px">查看详情</span>
</div>
<!-- 单选模式使用单选按钮 -->
<div class="welfare-option-radio" v-if="projectInfo.isCheckBox === 'radio'">
<van-radio
:name="option.id"
v-model="selectedRadioId"
@click.stop="isDeadlinePassed ? $toast.fail('已过选择截止时间,无法修改') : selectRadioOption(option.id)"
:disabled="isDeadlinePassed"
:name="option.id"
v-model="selectedRadioId"
@click.stop="isDeadlinePassed ? $toast.fail('已过选择截止时间,无法修改') : selectRadioOption(option.id)"
:disabled="isDeadlinePassed"
></van-radio>
</div>
<!-- 多选模式使用步进器 -->
<div class="welfare-option-checkbox" v-else>
<van-stepper
:key="'input-number-'+index+'-'+option.selectNumKey|| 0"
v-model="option.selectNum"
integer
disable-input
:default-value="0"
:min="0"
:disabled="isDeadlinePassed"
input-width="40px"
button-size="22px"
@change="selectNumChange(index,option.selectNum)"
theme="round"
:key="'input-number-'+index+'-'+option.selectNumKey|| 0"
v-model="option.selectNum"
integer
disable-input
:default-value="0"
:min="0"
:disabled="isDeadlinePassed"
input-width="40px"
button-size="22px"
@change="selectNumChange(index,option.selectNum)"
theme="round"
></van-stepper>
</div>
</div>
@@ -658,38 +681,50 @@ layout("/layouts/platform_h5.html"){
<!-- 底部提交按钮 -->
<div class="welfare-footer" v-if="projectInfo.id">
<van-button type="primary" class="welfare-submit-btn" :disabled="submitButtonDisabled" @click="submitSelection" round>
<van-button type="primary" class="welfare-submit-btn" :disabled="submitButtonDisabled"
@click="submitSelection" round>
{{ isDeadlinePassed ? '已截止' : '确认选择' }}
</van-button>
</div>
<!-- 确认弹窗 -->
<van-action-sheet v-model="showConfirmDialog" :close-on-click-overlay="false" :round="true" :style="{ maxHeight: '90%' }">
<van-action-sheet v-model="showConfirmDialog" :close-on-click-overlay="false" :round="true"
:style="{ maxHeight: '90%' }">
<div class="confirm-action-sheet">
<div class="confirm-sheet-title">确认选择</div>
<div class="confirm-content-scroll">
<!-- 手机号输入 -->
<div class="mobile-input-section">
<van-field
v-model="formData.mobile"
label="联系电话"
placeholder="请输入手机号码"
:error="mobileError"
@focus="mobileError = false"
maxlength="11"
required
></van-field>
<!--收货地址-->
<van-field
v-if="projectInfo.provideMode == 3"
v-model="formData.receiveAddress"
label="收货地址"
placeholder="请选择收货地址"
readonly
is-link
@click="showAddressSheet = true"
required
v-if="projectInfo.provideMode == 3"
v-model="formData.receiveAddress"
label="收货地址"
rows="2"
type="textarea"
placeholder="请选择收货地址"
readonly
is-link
@click="showAddressSheet = true"
required
></van-field>
<van-field
v-model="formData.userName"
label="收货人"
placeholder="请输入收货人"
:error="userNameError"
@focus="userNameError = false"
required
></van-field>
<van-field
v-model="formData.mobile"
label="联系电话"
placeholder="请输入手机号码"
:error="mobileError"
@focus="mobileError = false"
maxlength="11"
required
></van-field>
</div>
@@ -711,9 +746,11 @@ layout("/layouts/platform_h5.html"){
<!-- 签字组件 -->
<div class="confirm-section" v-if="projectInfo.signMode === 2">
<div class="confirm-section-title">请签字确认</div>
<div class="confirm-section-title">请签字(下滑此页面打开签字版签字)</div>
<h5-signature v-model="formData.userSign" ref="signatureRef"></h5-signature>
<div class="signature-tips">{{ formData.userSign ? '您已完成签名' : '请在上方空白区域完成签名' }}</div>
<div class="signature-tips">{{ formData.userSign ? '您已完成签名' : '请在上方空白区域完成签名'
}}
</div>
<div style="text-align: right; margin-top: 8px">
<van-button size="small" type="default" @click="resetSignature">重新签名</van-button>
</div>
@@ -721,14 +758,19 @@ layout("/layouts/platform_h5.html"){
</div>
<div class="confirm-fixed-buttons">
<van-button type="default" block round class="action-sheet-cancel" @click="showConfirmDialog = false">取消</van-button>
<van-button type="primary" block round @click="doSubmit">{{ hasSubmittedBefore ? '确认修改' : '确认提交' }}</van-button>
<van-button type="default" block round class="action-sheet-cancel"
@click="showConfirmDialog = false">取消
</van-button>
<van-button type="primary" block round @click="doSubmit">
{{ hasSubmittedBefore ? '确认修改' : '确认提交'}}
</van-button>
</div>
</div>
</van-action-sheet>
<!-- 选项详情弹窗 -->
<van-popup v-model="showOptionDetailDialog" round closeable close-icon="close" position="bottom" :style="{ maxHeight: '70%' }">
<van-popup v-model="showOptionDetailDialog" round closeable close-icon="close" position="bottom"
:style="{ maxHeight: '70%' }">
<div class="welfare-detail-popup" v-if="selectedOption">
<div class="welfare-detail-title">{{ selectedOption.optionName }}</div>
<div class="welfare-detail-content" v-html="selectedOption.description"></div>
@@ -739,25 +781,29 @@ layout("/layouts/platform_h5.html"){
<van-action-sheet v-model="showAddressSheet" title="选择收货地址" :round="true">
<div style="padding: 16px 0 0">
<div
v-for="address in addressOptions"
:key="address.id"
class="address-item"
@click="selectAddress(address)"
style="padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer"
v-for="address in addressOptions"
:key="address.id"
class="address-item"
@click="selectAddress(address)"
style="padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer"
>
<div style="display: flex; justify-content: space-between; align-items: flex-start">
<div style="flex: 1">
<div style="font-size: 16px; font-weight: 500; color: #323233; margin-bottom: 4px">
{{ address.userName }} {{ address.tel }}
收货人:{{ address.userName }}{{ address.tel }}
</div>
<div style="font-size: 14px; color: #646566; line-height: 1.4">
{{ address.province }}{{ address.city }}{{ address.county }}{{ address.addressDetail }}
收货地址: {{ address.province }}{{ address.city }}{{ address.county }}
{{address.addressDetail }}
</div>
</div>
<van-tag v-if="address.isDefault" type="primary" size="mini" style="margin-left: 8px">默认</van-tag>
<van-tag v-if="address.isDefault" type="primary" size="mini" style="margin-left: 8px">默认
</van-tag>
</div>
</div>
<div v-if="addressOptions.length === 0" style="text-align: center; padding: 40px 16px; color: #969799">暂无收货地址</div>
<div v-if="addressOptions.length === 0" style="text-align: center; padding: 40px 16px; color: #969799">
暂无收货地址
</div>
</div>
<div style="padding: 16px; border-top: 1px solid #f0f0f0; background: #fafafa">
<van-button type="info" block round @click="goToAddressManage">收货地址管理</van-button>
@@ -766,12 +812,13 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<script>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
store,
data() {
return {
activeNames: [],
projectInfo: {},
userSelection: [],
welfareProvideMode: [],
@@ -784,10 +831,12 @@ layout("/layouts/platform_h5.html"){
showOptionDetailDialog: false, // 选项详情弹窗
selectedOption: null, // 当前选中的选项
mobileError: false, // 手机号错误标记
userNameError: false, // 收货人错误标记
formData: {
userSign: "", // 用户签名
mobile: "", // 手机号码
address: "" // 收货地址
address: "",// 收货地址
userName: "",//收货人
},
addressOptions: [],
@@ -879,7 +928,7 @@ layout("/layouts/platform_h5.html"){
}
},
getProjectInfo() {
this.$axios.post("/platform/welfare/common/projectInfo", { id: this.projectId }).then((res) => {
this.$axios.post("/platform/welfare/common/projectInfo", {id: this.projectId}).then((res) => {
if (res.code === 0) {
this.projectInfo = res.data
@@ -904,7 +953,7 @@ layout("/layouts/platform_h5.html"){
// 获取用户选择的数据
getUserSelection() {
this.$axios.post("/platform/welfare/userSelect/getUserSelection", { projectId: this.projectId }).then((resp) => {
this.$axios.post("/platform/welfare/userSelect/getUserSelection", {projectId: this.projectId}).then((resp) => {
if (resp.code === 0) {
this.userSelection = resp.data
this.hasSubmittedBefore = this.userSelection.length > 0
@@ -912,14 +961,17 @@ layout("/layouts/platform_h5.html"){
// 如果有用户选择数据,从中获取手机号
if (this.userSelection && this.userSelection.length > 0 && this.userSelection[0].mobile) {
this.formData.mobile = this.userSelection[0].mobile
this.formData.userName = this.userSelection[0].userName
// 获取签名信息(如果有)
if (this.userSelection[0].userSign) {
this.formData.userSign = this.userSelection[0].userSign
}
} else if (this.$store.user && this.$store.user.mobile) {
} else if (this.$store.state.user && this.$store.state.user.mobile) {
// 如果没有选择过,使用store中的默认手机号
this.formData.mobile = this.$store.user.mobile
this.formData.mobile = this.$store.state.user.mobile
}else if (this.$store.state.user && this.$store.state.user.username){
this.formData.userName = this.$store.state.user.username
}
// 地址回显
@@ -966,6 +1018,11 @@ layout("/layouts/platform_h5.html"){
return
}
// 验证收货人
if (!this.validateUserName()) {
return;
}
// 验证手机号
if (!this.validateMobile()) {
return
@@ -1001,7 +1058,8 @@ layout("/layouts/platform_h5.html"){
{
selectOptionId: this.selectedRadioId,
selectNum: 1,
mobile: this.formData.mobile
mobile: this.formData.mobile,
userName: this.formData.userName
}
]
}
@@ -1011,7 +1069,8 @@ layout("/layouts/platform_h5.html"){
selections = this.selectedOptions.map((option) => ({
selectOptionId: option.id,
selectNum: option.selectNum,
mobile: this.formData.mobile
mobile: this.formData.mobile,
userName: this.formData.userName
}))
}
@@ -1072,6 +1131,16 @@ layout("/layouts/platform_h5.html"){
return true
},
// 验证收货人
validateUserName() {
if (!this.formData.userName) {
this.userNameError = true;
this.$toast.fail("请输入收货人姓名");
return false;
}
return true;
},
// 格式化时间范围
formatTimeRange(start, end) {
if (!start || !end) return "未设置"
@@ -1169,8 +1238,10 @@ layout("/layouts/platform_h5.html"){
// 选择收货地址
selectAddress(address) {
this.formData.receiveAddress =
address.userName + " " + address.tel + " " + address.province + address.city + address.county + address.addressDetail
// "收货人:" + address.userName + ",联系电话:" + address.tel + ",收货地址:" +
this.formData.userName = address.userName
this.formData.mobile = address.tel
this.formData.receiveAddress = address.province + address.city + address.county + address.addressDetail
this.showAddressSheet = false
},
@@ -86,11 +86,11 @@ layout("/layouts/platform_h5.html"){
<div class="wf-card-heading">{{row.name}}</div>
<div class="wf-time-row">
<span class="wf-time-label">开始时间:</span>
{{row.choiceTimeStart}}
{{$moment(row.choiceTimeStart).format('YYYY-MM-DD HH:mm')}}
</div>
<div class="wf-time-row">
<span class="wf-time-label">结束时间:</span>
{{row.choiceTimeEnd}}
{{$moment(row.choiceTimeEnd).format('YYYY-MM-DD HH:mm')}}
</div>
</div>
</div>
@@ -101,7 +101,7 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<script>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
data() {
@@ -87,7 +87,7 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<script>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
data() {
@@ -269,7 +269,7 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<script>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
store,
@@ -87,7 +87,7 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<script>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
data() {