diff --git a/src/main/java/com/budwk/app/zhgh/activity/family/controller/statistics/FamilyActivityStatisticsController.java b/src/main/java/com/budwk/app/zhgh/activity/family/controller/statistics/FamilyActivityStatisticsController.java index 7d3eaf4b..daaca32a 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/family/controller/statistics/FamilyActivityStatisticsController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/family/controller/statistics/FamilyActivityStatisticsController.java @@ -154,6 +154,7 @@ public class FamilyActivityStatisticsController { Sql sql = Sqls.create(""" SELECT ts.*, + CONCAT(DATE_FORMAT(ac.courseStartTime, '%H:%i:%s'),'至',DATE_FORMAT(ac.courseEndTime, '%H:%i:%s')) AS courseTime, u.username, u.loginname, u.sex, @@ -162,6 +163,7 @@ public class FamilyActivityStatisticsController { tsc.courseName FROM family_user ts + left join family_activity_course ac on ts.activityCourseId = ac.id left join `vw_user` u on u.id = ts. userId left join family_course tsc on tsc.id = ts.courseId WHERE @@ -183,7 +185,8 @@ public class FamilyActivityStatisticsController { Map.of("name", "单位", "key", "unitName"), Map.of("name", "分工会", "key", "unionName"), Map.of("name", "性别", "key", "sex"), - Map.of("name", "手机号", "key", "newMobile") + Map.of("name", "手机号", "key", "newMobile"), + Map.of("name", "报名时段", "key", "courseTime") ); List excelCommonExportEntity = basicEntity.stream().map(entity -> { diff --git a/src/main/java/com/budwk/app/zhgh/activity/family/models/FamilyUser.java b/src/main/java/com/budwk/app/zhgh/activity/family/models/FamilyUser.java index 4ff9afed..9d35a77d 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/family/models/FamilyUser.java +++ b/src/main/java/com/budwk/app/zhgh/activity/family/models/FamilyUser.java @@ -71,6 +71,11 @@ public class FamilyUser implements Serializable { @Comment("报名时间") private Date signUpTime; + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("活动课程时段id") + private String activityCourseId; + @Column @ColDefine(type = ColType.MYSQL_JSON) @Comment("手机端报名字段和值") diff --git a/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityServiceImpl.java index 5ee19e03..8e1264ba 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityServiceImpl.java @@ -13,6 +13,8 @@ import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.activity.family.models.*; import com.budwk.app.zhgh.activity.family.service.FamilyActivityService; import com.budwk.app.zhgh.activity.family.service.FamilyActivityStatisticsService; +import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpActivityCourse; +import com.budwk.app.zhgh.activity.trainSignUp.models.TrainSignUpUserCourse; import lombok.extern.slf4j.Slf4j; import org.nutz.aop.interceptor.async.Async; import org.nutz.aop.interceptor.ioc.TransAop; @@ -273,7 +275,22 @@ public class FamilyActivityServiceImpl extends BaseServiceImpl i familyUser.setSignUpTime(new Date()); dao().insert(familyUser); - asyncInsertUserCourse(familyUser.getActivityId(), familyUser.getCourseId(), userId); + + if (StrUtil.isNotBlank(familyUser.getActivityCourseId())) { + TrainSignUpActivityCourse fetch = dao().fetch(TrainSignUpActivityCourse.class, familyUser.getActivityCourseId()); + TrainSignUpUserCourse userCourse = new TrainSignUpUserCourse(); + userCourse.setActivityId(familyUser.getActivityId()); + userCourse.setCourseId(familyUser.getCourseId()); + userCourse.setUserId(familyUser.getUserId()); + userCourse.setCourseStartTime(fetch.getCourseStartTime()); + userCourse.setCourseEndTime(fetch.getCourseEndTime()); + userCourse.setAttend(false); + userCourse.setAttendTime(null); + userCourse.setActivityCourseId(fetch.getId()); + dao().insert(userCourse); + } else { + asyncInsertUserCourse(familyUser.getActivityId(), familyUser.getCourseId(), userId); + } } @Async diff --git a/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityStatisticsServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityStatisticsServiceImpl.java index 0cc0e48a..9caa05b2 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityStatisticsServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/family/service/impl/FamilyActivityStatisticsServiceImpl.java @@ -143,7 +143,7 @@ public class FamilyActivityStatisticsServiceImpl extends BaseServiceImpl impl u.id AS userId, u.username, u.loginname, - u.mobile, + ifnull(tsuu.mobile, u.mobile) as mobile, u.unitname, u.unionname, tsuc.courseName, diff --git a/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearPlanController.java b/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearPlanController.java index eb7602b8..c4317535 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearPlanController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearPlanController.java @@ -1,12 +1,17 @@ package com.budwk.app.zhgh.activity.planSummary.controller; import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.URLUtil; +import cn.hutool.json.JSONObject; import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.constant.RoleConstant; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; +import com.budwk.app.sys.models.Sys_file; import com.budwk.app.sys.models.Sys_union; +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.activity.basic.models.ActivityBasicSettings; @@ -21,13 +26,23 @@ import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * @ClassName YearPlanController @@ -139,4 +154,66 @@ public class YearPlanController { List list = dao.query(SysClub.class, cnd); return Result.success(list); } + + @At + @Ok("void") + @SaCheckPermission("planSummary.yearPlan.manage") + public void downloadFiles(PageForm pageForm, + @Param(value = "year") Integer year, + @Param(value = "tissueIdByUnion") String tissueIdByUnion, + @Param(value = "tissueIdByClub") String tissueIdByClub, + @Param(value = "planName") String planName, + HttpServletResponse response) throws IOException { + Cnd cnd = Cnd.NEW(); + + cnd.andEX("YEAR(yp.planTime)", "=", year); + cnd.andEX("yp.tissueId", "=", tissueIdByUnion); + cnd.andEX("yp.tissueId", "=", tissueIdByClub); + cnd.and(Cnd.likeEX("yp.planName", planName)); + + List listMap = yearPlanService.queryData(cnd); + + List urlList = new ArrayList<>(); + for (NutMap map : listMap) { + if(StrUtil.isNotBlank(map.getString("files"))) { + List files = Json.fromJsonAsList(JSONObject.class, map.getString("files")); + ArrayList list = files.stream().map(o -> o.getStr("url")).collect(Collectors.toCollection(ArrayList::new)); + urlList.addAll(list); + } + } + + response.setContentType("application/zip"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLUtil.encode("文件汇总.zip")); + + try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) { + for (String url : urlList) { + String fileId = extractFileId(url); + if(StrUtil.isNotBlank(fileId)) { + Sys_file file = dao.fetch(Sys_file.class, fileId); + byte[] bytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath()); + if(bytes == null || bytes.length == 0){ + continue; + } + + String entryName = file.getName(); + zos.putNextEntry(new ZipEntry(entryName)); + zos.write(bytes); + zos.closeEntry(); + } + } + } catch (Exception e) { + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "生成ZIP文件失败"); + e.printStackTrace(); + } + } + + public static String extractFileId(String url) { + if (url == null) return null; + Pattern pattern = Pattern.compile("[?&]id=([^&]*)"); + Matcher matcher = pattern.matcher(url); + if (matcher.find()) { + return matcher.group(1); + } + return null; + } } diff --git a/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearSummaryController.java b/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearSummaryController.java index 3dc22a22..29ca4263 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearSummaryController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/planSummary/controller/YearSummaryController.java @@ -2,13 +2,18 @@ package com.budwk.app.zhgh.activity.planSummary.controller; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.URLUtil; +import cn.hutool.json.JSONObject; import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.constant.RoleConstant; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; import com.budwk.app.sys.models.Sys_dict; +import com.budwk.app.sys.models.Sys_file; import com.budwk.app.sys.models.Sys_union; +import com.budwk.app.sys.utils.SysFileMinIoUtil; import com.budwk.app.sys.views.View_user; import com.budwk.app.web.commons.auth.utils.AuthUtil; import com.budwk.app.web.commons.auth.utils.SecurityUtil; @@ -26,13 +31,22 @@ import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * @ClassName YearSummaryController @@ -119,4 +133,68 @@ public class YearSummaryController { yearSummaryService.delete(id); return Result.success(); } + + @At + @Ok("void") + @SaCheckPermission("planSummary.yearPlan.manage") + public void downloadFiles(PageForm pageForm, + @Param(value = "year") Integer year, + @Param(value = "tissueIdByUnion") String tissueIdByUnion, + @Param(value = "tissueIdByClub") String tissueIdByClub, + @Param(value = "summaryType") String summaryType, + @Param(value = "summaryFrom") String summaryFrom, + HttpServletResponse response) throws IOException { + Cnd cnd = Cnd.NEW(); + + cnd.andEX("YEAR(ys.cTime)", "=", year); + cnd.andEX("ys.tissueId", "=", tissueIdByUnion); + cnd.andEX("ys.tissueId", "=", tissueIdByClub); + cnd.andEX("ys.summaryType", "=", summaryType); + cnd.andEX("ys.summaryFrom", "=", summaryFrom); + + List listMap = yearSummaryService.queryData(cnd); + + List urlList = new ArrayList<>(); + for (NutMap map : listMap) { + if(StrUtil.isNotBlank(map.getString("files"))) { + List files = Json.fromJsonAsList(JSONObject.class, map.getString("files")); + ArrayList list = files.stream().map(o -> o.getStr("url")).collect(Collectors.toCollection(ArrayList::new)); + urlList.addAll(list); + } + } + + response.setContentType("application/zip"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLUtil.encode("文件汇总.zip")); + + try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) { + for (String url : urlList) { + String fileId = extractFileId(url); + if(StrUtil.isNotBlank(fileId)) { + Sys_file file = dao.fetch(Sys_file.class, fileId); + byte[] bytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath()); + if(bytes == null || bytes.length == 0){ + continue; + } + + String entryName = file.getName(); + zos.putNextEntry(new ZipEntry(entryName)); + zos.write(bytes); + zos.closeEntry(); + } + } + } catch (Exception e) { + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "生成ZIP文件失败"); + e.printStackTrace(); + } + } + + public static String extractFileId(String url) { + if (url == null) return null; + Pattern pattern = Pattern.compile("[?&]id=([^&]*)"); + Matcher matcher = pattern.matcher(url); + if (matcher.find()) { + return matcher.group(1); + } + return null; + } } diff --git a/src/main/java/com/budwk/app/zhgh/activity/planSummary/model/YearPlan.java b/src/main/java/com/budwk/app/zhgh/activity/planSummary/model/YearPlan.java index 3dc145a3..31b18930 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/planSummary/model/YearPlan.java +++ b/src/main/java/com/budwk/app/zhgh/activity/planSummary/model/YearPlan.java @@ -1,5 +1,6 @@ package com.budwk.app.zhgh.activity.planSummary.model; +import cn.hutool.json.JSONObject; import com.budwk.app.base.model.BaseModel; import lombok.Data; import lombok.EqualsAndHashCode; @@ -7,6 +8,8 @@ import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; +import java.util.List; + /** * @ClassName Plan * @Author JyuHsin @@ -66,4 +69,9 @@ public class YearPlan extends BaseModel { @Comment("活动类型") @ColDefine(type = ColType.VARCHAR, width = 32) private String activityType; + + @Column + @Comment("附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List files; } diff --git a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearPlanService.java b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearPlanService.java index 2198591b..8c530e6c 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearPlanService.java +++ b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearPlanService.java @@ -5,6 +5,9 @@ import com.budwk.app.base.param.PageForm; import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.activity.planSummary.model.YearPlan; import org.nutz.dao.Cnd; +import org.nutz.lang.util.NutMap; + +import java.util.List; /** * @ClassName YearPlanService @@ -16,4 +19,6 @@ import org.nutz.dao.Cnd; public interface YearPlanService extends BaseService { Pagination pageData(PageForm pageForm, Cnd cnd); + + List queryData(Cnd cnd); } diff --git a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearSummaryService.java b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearSummaryService.java index 3ebf58a2..69f3a31f 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearSummaryService.java +++ b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/YearSummaryService.java @@ -5,6 +5,9 @@ import com.budwk.app.base.param.PageForm; import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.activity.planSummary.model.YearSummary; import org.nutz.dao.Cnd; +import org.nutz.lang.util.NutMap; + +import java.util.List; /** * @ClassName YearSummaryService @@ -16,4 +19,6 @@ import org.nutz.dao.Cnd; public interface YearSummaryService extends BaseService { Pagination pageData(PageForm pageForm, Cnd cnd); + + List queryData(Cnd cnd); } diff --git a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearPlanServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearPlanServiceImpl.java index 00cbd356..c7f6ea10 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearPlanServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearPlanServiceImpl.java @@ -20,6 +20,7 @@ import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; import java.util.List; @@ -43,6 +44,17 @@ public class YearPlanServiceImpl extends BaseServiceImpl implements Ye @Override public Pagination pageData(PageForm pageForm, Cnd cnd) { + Sql sql = buildSql(cnd); + return this.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @Override + public List queryData(Cnd cnd) { + Sql sql = buildSql(cnd); + return this.listMap(sql); + } + + private Sql buildSql(Cnd cnd) { Sql sql = Sqls.create(""" SELECT yp.*, @@ -68,6 +80,6 @@ public class YearPlanServiceImpl extends BaseServiceImpl implements Ye } cnd.desc("yp.planTime"); sql.setCondition(cnd); - return this.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return sql; } } diff --git a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearSummaryServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearSummaryServiceImpl.java index 8b55e363..6ad084d2 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearSummaryServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/planSummary/service/impl/YearSummaryServiceImpl.java @@ -19,6 +19,7 @@ import org.nutz.dao.sql.Sql; import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; import java.util.List; @@ -42,6 +43,17 @@ public class YearSummaryServiceImpl extends BaseServiceImpl impleme @Override public Pagination pageData(PageForm pageForm, Cnd cnd) { + Sql sql = buildSql(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @Override + public List queryData(Cnd cnd) { + Sql sql = buildSql(cnd); + return this.listMap(sql); + } + + private Sql buildSql(Cnd cnd) { Sql sql = Sqls.create(""" SELECT ys.*, @@ -66,6 +78,6 @@ public class YearSummaryServiceImpl extends BaseServiceImpl impleme } cnd.desc("ys.cTime"); sql.setCondition(cnd); - return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return sql; } } diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/mobile/MTrainSignUpActivityController.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/mobile/MTrainSignUpActivityController.java index 460611e9..57d1de8c 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/mobile/MTrainSignUpActivityController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/mobile/MTrainSignUpActivityController.java @@ -15,6 +15,7 @@ import com.budwk.app.zhgh.activity.family.models.FamilyCourse; import com.budwk.app.zhgh.activity.family.models.FamilyUser; 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; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.nutz.dao.Chain; @@ -53,6 +54,8 @@ public class MTrainSignUpActivityController { private TrainSignUpActivityService trainSignUpActivityService; @Inject private RedisService redisService; + @Inject + private TrainSignUpActivityStatisticsService statisticsService; @At("/trainList") @Ok("beetl:/platform/zhghh5/activity/trainSignUp/trainList/index.html") diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/statistics/TrainSignUpActivityStatisticsController.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/statistics/TrainSignUpActivityStatisticsController.java index 7500c37e..28314e04 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/statistics/TrainSignUpActivityStatisticsController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/statistics/TrainSignUpActivityStatisticsController.java @@ -152,16 +152,16 @@ public class TrainSignUpActivityStatisticsController { Sql sql = Sqls.create(""" SELECT ts.*, + CONCAT(DATE_FORMAT(ac.courseStartTime, '%H:%i:%s'),'至',DATE_FORMAT(ac.courseEndTime, '%H:%i:%s')) AS courseTime, u.username, u.loginname, - u.unitname, - u.unionname, u.sex, - u.mobile, + ifnull(ts.mobile, u.mobile) as mobile, u.birthday, tsc.courseName FROM - train_sign_up_user ts + train_sign_up_user ts + left join train_sign_up_activity_course ac on ts.activityCourseId = ac.id left join `vw_user` u on u.id = ts. userId left join train_sign_up_course tsc on tsc.id = ts.courseId WHERE @@ -180,11 +180,12 @@ public class TrainSignUpActivityStatisticsController { List excelCommonExportEntity = new ArrayList<>(); excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20)); excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20)); - excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitname", 20)); - excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionname", 20)); + excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20)); + excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20)); excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20)); excelCommonExportEntity.add(new ExcelExportEntity("手机号", "mobile", 20)); excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20)); + excelCommonExportEntity.add(new ExcelExportEntity("报名时段", "courseTime", 20)); for (TrainSignUpCourse c : courseList) { String k = c.getCourseName(); diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpActivity.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpActivity.java index 40e78f15..3b52b50d 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpActivity.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpActivity.java @@ -132,6 +132,5 @@ public class TrainSignUpActivity extends BaseModel implements Serializable, SysH sysHomeActivity.setEnable(!this.isDisabled()); sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName()); return sysHomeActivity; - } } diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpUser.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpUser.java index 5adb994c..d39da0c5 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpUser.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/models/TrainSignUpUser.java @@ -70,6 +70,11 @@ public class TrainSignUpUser implements Serializable { @Comment("报名时间") private Date signUpTime; + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("活动课程时段id") + private String activityCourseId; + @Column @ColDefine(type = ColType.MYSQL_JSON) @Comment("手机端报名字段和值") diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java index d965a9f3..d2e72ef6 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java @@ -278,7 +278,22 @@ public class TrainSignUpActivityServiceImpl extends BaseServiceImpl { + o.put(m.getString("columnCode"), m.getString("columnValue")); + }); + } + }); + return list; } @Override @@ -125,7 +136,7 @@ public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImplvalue v->RecuperationProvinceType.value + */ + public static Map typeMap = new HashMap<>(); + + /** + * 缓存状态map k->value v->RecuperationProvinceType + */ + public static Map objMap = new HashMap<>(); + + static { + RecuperationType[] values = RecuperationType.values(); + for (RecuperationType t : values) { + typeMap.put(t.getValue(), t.getRegionType()); + objMap.put(t.getValue(), t); + } + } + + + private final String imgUrl; + +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationAnnualAnalysisController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationAnnualAnalysisController.java new file mode 100644 index 00000000..179b1945 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationAnnualAnalysisController.java @@ -0,0 +1,372 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.result.Result; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationState; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLine; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLineSelect; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLot; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @ClassName RecuperationAnnualAnalysisController + * @Author JyuHsin + * @Date 2025/8/18 15:24 + * @Version 1.0 + * @Description TODO + */ +@Slf4j +@IocBean +@At("/platform/recuperation/annualAnalysis") +@Api("疗休养年度分析") +@Ok("json:full") +public class RecuperationAnnualAnalysisController { + + @Inject + private Dao dao; + @Inject + private RecuperationLineService lineService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/annualAnalysis/index.html") + @SaCheckLogin + public void index() { + } + + @At + @ApiOperation("获取年度出行人数、线路数、省内、省外、校工会组织线路数、校省内、校省外线路数") + @SaCheckPermission("recuperation.annualAnalysis") + public Result getNumData(@Param(value = "year") Integer year, + @Param(value = "lineType") String lineType) { + // 获取选择线路表的id,后面发现了,报名表里有线路id不在线路表的情况,这类人员要排除掉 + Sql selectIdSql = Sqls.create("select id from recuperation_line_select"); + selectIdSql.setCallback(Sqls.callback.strList()); + dao.execute(selectIdSql); + List selectIdList = selectIdSql.getList(String.class); + + // 获取今年报名的所有人数,还要确保报名线路是属于上面选择线路的id + Sql sql = Sqls.create(""" + SELECT + takePartInLineId + FROM + `recuperation_enroll` + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(signingUptime)", "=", year); + cnd.andEX("isNormal", "=", true); + cnd.andEX("stateId", "=", RecuperationState.PASS); + cnd.andEX("takePartInLineId", "in", selectIdList); + sql.setCallback(Sqls.callback.strList()); + dao.execute(sql); + // 今年的报名记录 + List enrollTakePartLineIdList = sql.getList(String.class); + + List takePartInLineIdList = enrollTakePartLineIdList.stream().distinct().collect(Collectors.toList()); + + // 今年报名的线路 + List selectLineList = dao.query(RecuperationLineSelect.class, Cnd.where("id", "in", takePartInLineIdList)); + + // 找出选择的线路详情,用于区分省内还是省外 + List lineIdList = selectLineList.stream().map(RecuperationLineSelect::getLineId).distinct().collect(Collectors.toList()); + List lineList = dao.query(RecuperationLine.class, Cnd.where("id", "in", lineIdList)); + + // 如果不是全部,按搜索条件查询省内还是省外 + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + lineList = lineList.stream().filter(line -> line.getRegionalNature().equals(lineType)).toList(); + + List lineTypeIdList = lineList.stream().map(RecuperationLine::getId).toList(); + + selectLineList = selectLineList.stream().filter(v -> lineTypeIdList.contains(v.getLineId())).toList(); + } + + // 省内线路 + List inLineList = lineList.stream().filter(line -> "省内".equals(line.getRegionalNature())).toList(); + Set inLineIds = inLineList.stream().map(RecuperationLine::getId).collect(Collectors.toSet()); + // 选择省内的线路 + List selectInLineIds = selectLineList.stream().filter(v -> inLineIds.contains(v.getLineId())) + .map(RecuperationLineSelect::getId).toList(); + + // 省外线路 + List outLineList = lineList.stream().filter(line -> "省外".equals(line.getRegionalNature())).toList(); + Set outLineIds = outLineList.stream().map(RecuperationLine::getId).collect(Collectors.toSet()); + // 选择省外的线路 + List selectOutLineIds = selectLineList.stream().filter(v -> outLineIds.contains(v.getLineId())) + .map(RecuperationLineSelect::getId).toList(); + + // 返回前端的数据展示 + NutMap nutMap = NutMap.NEW(); + // 总出行人数 + int allNum = enrollTakePartLineIdList.size(); + // 省内出行人数 + int provinceNum = (int) enrollTakePartLineIdList.stream().filter(selectInLineIds::contains).count(); + // 省外出行人数 + int outProvinceNum = (int) enrollTakePartLineIdList.stream().filter(selectOutLineIds::contains).count(); + nutMap.addv("allNum", allNum).addv("provinceNum", provinceNum).addv("outProvinceNum", outProvinceNum); + + // 总线路数 + int lineNum = selectLineList.size(); + // 总省内 + int inLineNum = selectInLineIds.size(); + // 总省外 + int outLineNum = selectOutLineIds.size(); + nutMap.addv("lineNum", lineNum).addv("inLineNum", inLineNum).addv("outLineNum", outLineNum); + + // 校工会组织线路 + List schoolSelectLineList = selectLineList.stream().filter(v -> v.getSignUpMode() == 2).toList(); + int schoolUnionLineNum = schoolSelectLineList.size(); + // 校省内 + int schoolInLineNum = (int) schoolSelectLineList.stream().filter(s -> inLineIds.contains(s.getLineId())).count(); + // 校省外 + int schoolOutLineNum = (int) schoolSelectLineList.stream().filter(s -> outLineIds.contains(s.getLineId())).count(); + nutMap.addv("schoolUnionLineNum", schoolUnionLineNum).addv("schoolInLineNum", schoolInLineNum).addv("schoolOutLineNum", schoolOutLineNum); + + // 分工会组织线路 + List unionSelectLineList = selectLineList.stream().filter(v -> v.getSignUpMode() == 1).toList(); + int unionLineNum = unionSelectLineList.size(); + // 分省内 + int unionInLineNum = (int) unionSelectLineList.stream().filter(s -> inLineIds.contains(s.getLineId())).count(); + // 分省外 + int unionOutLineNum = (int) unionSelectLineList.stream().filter(s -> outLineIds.contains(s.getLineId())).count(); + nutMap.addv("unionLineNum", unionLineNum).addv("unionInLineNum", unionInLineNum).addv("unionOutLineNum", unionOutLineNum); + return Result.success(nutMap); + } + + @At + @ApiOperation("出行时间标段统计") + @SaCheckPermission("recuperation.annualAnalysis") + public Result getLotNum(@Param(value = "year") Integer year, + @Param(value = "lineType") String lineType) { + if (year == null) { + year = DateUtil.thisYear(); + } + List lotList = dao.query(RecuperationLot.class, Cnd.NEW().asc("lotValue")); + + Sql sql = Sqls.create(""" + SELECT + enroll.*, + line.lotId AS lineLotId + FROM + recuperation_enroll enroll + LEFT JOIN recuperation_line_select us ON us.id = enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = us.lineId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(signingUpTime)", "=", year); + cnd.and("enroll.isNormal", "=", true); + cnd.and("enroll.stateId", "=", RecuperationState.PASS); + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + cnd.andEX("line.regionalNature", "=", lineType); + } + sql.setCondition(cnd); + List list = lineService.listMap(sql); + + List resultMap = new ArrayList<>(); + + lotList.forEach(item -> { + NutMap map = NutMap.NEW(); + int value = list.stream().filter(v -> item.getId().equals(v.getString("lineLotId"))).toList().size(); + map.put("label", item.getLotName()); + map.put("value", value); + resultMap.add(map); + }); + return Result.success().addData(resultMap); + } + + @At + @ApiOperation("出行年龄分布统计") + @SaCheckPermission("recuperation.annualAnalysis") + public Result getAgeNum(@Param(value = "year") Integer year, + @Param(value = "lineType") String lineType) { + if (year == null) { + year = DateUtil.thisYear(); + } + Map result = new HashMap<>(); + result.put("35岁以下", 0); + result.put("35至45岁", 0); + result.put("45岁以上", 0); + + Sql sql = Sqls.create(""" + SELECT + enroll.idCard + FROM + recuperation_enroll enroll + LEFT JOIN recuperation_line_select us ON us.id = enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = us.lineId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(signingUpTime)", "=", year); + cnd.and("enroll.isNormal", "=", true); + cnd.and("enroll.stateId", "=", RecuperationState.PASS); + cnd.and("enroll.idCard", "is not", null); + cnd.groupBy("enroll.idCard"); + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + cnd.andEX("line.regionalNature", "=", lineType); + } + sql.setCondition(cnd); + sql.setCallback(Sqls.callback.strList()); + dao.execute(sql); + List idCardList = sql.getList(String.class); + + for (String idCard : idCardList) { + if (StrUtil.isBlank(idCard)) { + continue; + } + int birthYear = getBirthYearFromIdCard(idCard); + + if (birthYear == 0) { + continue; + } + + int age = year - birthYear; + + if (age < 35) { + result.put("35岁以下", result.get("35岁以下") + 1); + } else if (age <= 45) { + result.put("35至45岁", result.get("35至45岁") + 1); + } else { + result.put("45岁以上", result.get("45岁以上") + 1); + } + } + + List list = new ArrayList<>(); + result.forEach((k, v) -> { + NutMap map = NutMap.NEW(); + map.put("label", k); + map.put("value", v); + list.add(map); + }); + return Result.success(list); + } + + + private static int getBirthYearFromIdCard(String idCard) { + String birthYearStr; + if (idCard.length() == 18) { + // 18位身份证号,直接取第7到第10位作为出生年份 + birthYearStr = idCard.substring(6, 10); + } else if (idCard.length() == 15) { + // 15位身份证号,取第7到第8位作为出生年份的后两位 15位身份证号均为19xx年 + birthYearStr = "19" + idCard.substring(6, 8); + } else { + return 0; + } + + return Integer.parseInt(birthYearStr); + } + + @At + @ApiOperation("获取线路出行人数和年龄统计数据") + @SaCheckPermission("recuperation.annualAnalysis") + public Result getLineTravelAndAgeData(@Param(value = "year") Integer year, + @Param(value = "lineType") String lineType) { + Sql sql = Sqls.create(""" + SELECT + us.id, + CONCAT(line.lineName,'(',DATE_FORMAT(us.playStartTime,'%m月%d'),'至',DATE_FORMAT(us.playEndTime,'%m月%d'),')') AS lineName, + su.name as unionName, + lot.lotName, + COUNT(enroll.id) AS takePartInLineNum, + SUM(CASE + WHEN @year - (CASE + WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED) + WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED) + ELSE NULL + END) < 35 THEN 1 ELSE 0 END) AS underThirtyFive, + SUM(CASE + WHEN @year - (CASE + WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED) + WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED) + ELSE NULL + END) BETWEEN 35 AND 45 THEN 1 ELSE 0 END) AS thirtyFiveToFortyFive, + SUM(CASE + WHEN @year - (CASE + WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED) + WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED) + ELSE NULL + END) > 45 THEN 1 ELSE 0 END) AS aboveFortyFive + FROM + recuperation_line_select us + LEFT JOIN recuperation_line line ON us.lineId = line.id + LEFT JOIN recuperation_enroll enroll ON enroll.takePartInLineId = us.id + LEFT JOIN recuperation_lot lot ON lot.id = line.lotId + LEFT JOIN sys_union su ON su.id = us.unionId + $condition + """).setParam("year", year == null ? DateUtil.thisYear() : year); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(us.selectTime)", "=", year); + cnd.and("enroll.isNormal", "=", true); + cnd.and("us.`enable`", "=", true); + cnd.groupBy("us.id"); + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + cnd.andEX("line.regionalNature", "=", lineType); + } + sql.setCondition(cnd); + List list = lineService.listMap(sql); + + NutMap result = NutMap.NEW(); + // 柱状图 + List uvData = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("value", v.getInt("takePartInLineNum")); + return map; + }).sorted(Comparator.comparing(v -> v.getString("lineName"))).collect(Collectors.toCollection(ArrayList::new)); + + // 折线图 + List underThirtyFiveList = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("count", v.getInt("underThirtyFive")); + map.put("name", "35岁以下"); + return map; + }).collect(Collectors.toCollection(ArrayList::new)); + + List thirtyFiveToFortyFiveList = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("count", v.getInt("thirtyFiveToFortyFive")); + map.put("name", "35至45岁"); + return map; + }).collect(Collectors.toCollection(ArrayList::new)); + + List aboveFortyFiveList = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("count", v.getInt("aboveFortyFive")); + map.put("name", "45岁以上"); + return map; + }).collect(Collectors.toCollection(ArrayList::new)); + + underThirtyFiveList.addAll(thirtyFiveToFortyFiveList); + underThirtyFiveList.addAll(aboveFortyFiveList); + + List collect = underThirtyFiveList.stream().sorted(Comparator.comparing(v -> v.getString("lineName"))).collect(Collectors.toList()); + result.put("uvData", uvData); + result.put("transformData", collect); + + return Result.success(result); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBranchUnionUserQueryController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBranchUnionUserQueryController.java new file mode 100644 index 00000000..d018a57e --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBranchUnionUserQueryController.java @@ -0,0 +1,416 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationState; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationConfig; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnrollBed; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnrollCompanion; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationEnrollService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; +import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName RecuperationBranchUnionUserQueryController + * @Author JyuHsin + * @Date 2025/8/19 15:24 + * @Version 1.0 + * @Description TODO + */ +@Slf4j +@IocBean +@At("/platform/recuperation/branchUnionUserQuery") +@Api("疗休养分工会查询") +@Ok("json:full") +public class RecuperationBranchUnionUserQueryController { + + @Inject + private Dao dao; + @Inject + private RecuperationEnrollService enrollService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/branchUnionUserQuery/index.html") + @SaCheckLogin + public void index() {} + + /** + * 分工会人员信息查询 + * + * @param pageForm 分页 + * @param year 年度 + * @param userName 姓名 + * @param loginName 登录名 + * @param signUpMode 报名方式(1分工会 2校工会 3个人) + * @param unionId + * @param takePartInLineId 线路id + * @param lotId 标段id + * @param regionalNature 区域性质 省内 省外 + * @return + */ + @At + @ApiOperation("分页查询") + @SaCheckPermission("recuperation.branchUnionUserQuery") + public Result pageData(PageForm pageForm, + Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + FROM + `recuperation_enroll` enroll + LEFT JOIN recuperation_line_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = lineu.lineId + LEFT JOIN recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + $condition + """); + if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { + cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); + } + if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), "ascending".equalsIgnoreCase(pageForm.getPageOrderBy()) ? "ASC" : "DESC"); + } + + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", loginName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", userName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 分工会只查本分工会的人员 + cnd.and("enroll.selfUnionId", "=", SecurityUtil.getUnionId()); + + // 报名模式 + if (StrUtil.isNotBlank(signUpMode)) { + if ("1".equals(signUpMode)) { + cnd.andEX("line.signUpMode", "=", 2); + } else if ("2".equals(signUpMode)) { + cnd.andEX("lineu.unionId", "=", SecurityUtil.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if ("3".equals(signUpMode)) { + cnd.andEX("lineu.unionId", "!=", SecurityUtil.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if ("4".equals(signUpMode)) { + cnd.andEX("line.signUpMode", "=", 3); + } + } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", RecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + Pagination pagination = enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + list.forEach(v -> { + List companionList = dao.query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (RecuperationEnrollCompanion enrollCompanion : companionList) { + enrollService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + return Result.success(pagination); + } + + /** + * 设置出行人员 + * + * @return + */ + @At + @Aop(TransAop.READ_COMMITTED) + @ApiOperation("设置出行人员") + @SaCheckPermission("recuperation.branchUnionUserQuery") + @SLog(type = "recuperation", tag = "设置出行人员", msg = "设置出行人员") + public Result setUpParticipants(@Param("data") String data) { + List list = Json.fromJsonAsList(NutMap.class, data); + for (NutMap map : list) { + Chain chain = Chain.make("lotId", map.getString("lotId")).add("takePartInTime", map.getString("takePartInTime")).add("isTakePartIn", true); + dao.update(RecuperationEnroll.class, chain, Cnd.where("id", "=", map.getString("id"))); + } + return Result.success(); + } + + /** + * 删除报名信息 + */ + @At + @ApiOperation("删除报名信息") + @SaCheckPermission("recuperation.baseManagement") + @SLog(type = "recuperation", tag = "删除报名信息", msg = "删除报名信息") + public Result deleteMyEnrollInfoById(String id) { + enrollService.deleteMyEnrollInfoById(id); + return Result.success(); + } + + /** + * 编辑查询详细信息 + */ + @At + @ApiOperation("编辑查询详细信息") + @SaCheckPermission("recuperation.branchUnionUserQuery") + public Result findOne(String id) { + Sql sql = Sqls.create(""" + SELECT + lxs.travelAgencyName, + enroll.*, + line.lineName, + if(enroll.takePartInUnionId!=enroll.selfUnionId,true,false) isTransferIn, + (SELECT COUNT(1) FROM recuperation_enroll_companion WHERE trreId=enroll.id and relation='亲属') isFamily + FROM + `recuperation_enroll` enroll + LEFT JOIN recuperation_line_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = lineu.lineId + LEFT JOIN recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId + where enroll.id=@id + """); + sql.setParam("id", id); + sql.setCallback(Sqls.callback.map()); + dao.execute(sql); + NutMap data = (NutMap) sql.getResult(); + List companionList = dao.query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); + companionList.forEach(v -> { + v.setBedInfo(dao.fetch(RecuperationEnrollBed.class, v.getBedInfoId())); + }); + data.put("companionList", companionList); + return Result.success(data); + } + + /** + * 获取线路 + * + * @param year 年度 + * @param signUpMode 报名模式 + * @param regionalNature 区域 + * @return + */ + @At + @ApiOperation("获取线路") + @SaCheckPermission("recuperation.branchUnionUserQuery") + public Result listLine(Integer year, String signUpMode, String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + t1.takePartInLineId, + t3.lineName, + t4.name as unionName + FROM + recuperation_enroll t1 + LEFT JOIN recuperation_line_select t2 ON t2.id = t1.takePartInLineId + LEFT JOIN recuperation_line t3 ON t3.id = t2.lineId + LEFT JOIN sys_union t4 ON t4.id = t2.unionId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("t1.selfUnionId", "=", SecurityUtil.getUnionId()); + cnd.andEX("YEAR(t2.selectTime)", "=", year); + cnd.andEX("t3.regionalNature", "=", regionalNature); + + if ("1".equals(signUpMode)) { + cnd.andEX("t3.signUpMode", "=", 2); + } else if ("2".equals(signUpMode)) { + cnd.andEX("t2.unionId", "=", SecurityUtil.getUnionId()); + cnd.and("t3.signUpMode", "=", 1); + } else if ("3".equals(signUpMode)) { + cnd.andEX("t2.unionId", "!=", SecurityUtil.getUnionId()); + cnd.and("t3.signUpMode", "=", 1); + } else if ("4".equals(signUpMode)) { + cnd.andEX("t3.signUpMode", "=", 3); + } + cnd.groupBy("t1.takePartInLineId"); + sql.setCondition(cnd); + List list = enrollService.listMap(sql); + return Result.success(list); + } + + @At + @Ok("void") + @ApiOperation("导出") + @SaCheckPermission("recuperation.branchUnionUserQuery") + public void exportXlsx(Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature, + HttpServletResponse response) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + FROM + `recuperation_enroll` enroll + LEFT JOIN recuperation_line_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = lineu.lineId + LEFT JOIN recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + $condition + """); + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", userName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", loginName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 分工会只查本分工会的人员 + cnd.and("enroll.selfUnionId", "=", SecurityUtil.getUnionId()); + + // 报名模式 + if (StrUtil.isNotBlank(signUpMode)) { + if ("1".equals(signUpMode)) { + cnd.andEX("line.signUpMode", "=", 2); + } else if ("2".equals(signUpMode)) { + cnd.andEX("lineu.unionId", "=", SecurityUtil.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if ("3".equals(signUpMode)) { + cnd.andEX("lineu.unionId", "!=", SecurityUtil.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if ("4".equals(signUpMode)) { + cnd.andEX("line.signUpMode", "=", 3); + } + } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", RecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + List list = enrollService.listMap(sql); + list.forEach(v -> { + List companionList = dao.query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (RecuperationEnrollCompanion enrollCompanion : companionList) { + enrollService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + + // 配置 + RecuperationConfig config = dao.fetch(RecuperationConfig.class, Cnd.NEW()); + + List excelEntities = new ArrayList<>(); + excelEntities.add(new ExcelExportEntity("姓名", "userName", 20)); + excelEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + excelEntities.add(new ExcelExportEntity("性别", "sex", 20)); + excelEntities.add(new ExcelExportEntity("单位", "unitName", 20)); + excelEntities.add(new ExcelExportEntity("工会", "unionName", 20)); + excelEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + excelEntities.add(new ExcelExportEntity("手机号", "mobile", 20)); + if (config.getFamilyInfo() == 2) { + excelEntities.add(new ExcelExportEntity("与本人关系", "relation", 10)); + excelEntities.add(new ExcelExportEntity("床型", "bedType", 10)); + excelEntities.add(new ExcelExportEntity("床位数", "bedNum", 10)); + excelEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 10)); + } else { + excelEntities.add(new ExcelExportEntity("携带家属数", "familyNumber", 10)); + + } + excelEntities.add(new ExcelExportEntity("备注", "bz", 20)); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("报名人员.xlsx").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + + try { + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelEntities, list); + workbook.write(response.getOutputStream()); + workbook.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationEvaluateStatisticsController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationEvaluateStatisticsController.java index 4e5d41d1..d4e6bc4a 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationEvaluateStatisticsController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationEvaluateStatisticsController.java @@ -1,23 +1,36 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.controller; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.dev33.satoken.annotation.SaCheckLogin; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.page.Pagination; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.result.Result; +import com.budwk.app.base.utils.CommonDownloadUtil; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationEnrollService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + /** * @ClassName RecuperationEvaluateStatisticsController * @Author JyuHsin @@ -34,11 +47,14 @@ public class RecuperationEvaluateStatisticsController { @Inject private Dao dao; + @Inject + private RecuperationEnrollService enrollService; @At("") @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/statistics/index.html") @SaCheckLogin - public void index() {} + public void index() { + } @At @ApiOperation("分页查询") @@ -51,35 +67,38 @@ public class RecuperationEvaluateStatisticsController { @Param(value = "userState") String userState, @Param(value = "evaluateScore") String evaluateScore) { Sql sql = Sqls.create(""" - SELECT - we.evaluateText, - we.evaluateScore, - we.userName, - we.loginName, - u.unionname, - u.unitname, - u.userState, - u.personType, - line.lineName, - us.playStartTime - FROM - `recuperation_evaluate` we - LEFT JOIN `vw_user` u ON u.id = we.userId - LEFT JOIN recuperation_enroll en ON en.takePartInLineId = we.lineId - LEFT JOIN recuperation_line_union_select us ON us.id = en.takePartInLineId - LEFT JOIN recuperation_line line ON line.id = us.lineId - $condition - """); + SELECT + we.evaluateText, + we.evaluateScore, + we.userName, + we.loginName, + u.unionname as unionName, + u.unitname as unitName, + u.userState, + u.personType, + line.lineName, + us.playStartTime + FROM + `recuperation_evaluate` we + LEFT JOIN `vw_user` u ON u.id = we.userId + LEFT JOIN recuperation_enroll en ON en.takePartInLineId = we.lineId + LEFT JOIN recuperation_line_select us ON us.id = en.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = us.lineId + $condition + """); Cnd cnd = Cnd.NEW(); - if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) { - cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("u.userName", pageForm.getSearchKeyword()); + seg.orLike("u.loginName", pageForm.getSearchKeyword()); + cnd.and(seg); } if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) { cnd.orderBy(pageForm.getPageOrderName(), "ascending".equals(pageForm.getPageOrderBy()) ? "asc" : "desc"); } else { cnd.desc("we.evaluateScore"); } - if(StrUtil.isNotBlank(lineId)) { + if (StrUtil.isNotBlank(lineId)) { cnd.andEX("we.lineId", "in", lineId.split(",")); } cnd.andEX("u.unionid", "=", unionId); @@ -89,7 +108,93 @@ public class RecuperationEvaluateStatisticsController { cnd.andEX("we.evaluateScore", "=", evaluateScore); cnd.groupBy("we.lineId"); sql.setCondition(cnd); - //enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); - return Result.success(); + Pagination pagination = enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + @At + @ApiOperation("获取线路列表") + @SaCheckPermission("recuperation.statistics") + public Result lineList(Integer year) { + Sql sql = Sqls.create(""" + SELECT + GROUP_CONCAT(us.id) as id, + line.lineName, + if(us.signUpMode = 2, '校工会', un.name) as unionName + FROM + recuperation_line_select us + LEFT JOIN recuperation_line line ON us.lineId = line.id + LEFT JOIN sys_union un ON un.id = us.unionId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("year(us.selectTime)", "=", year); + cnd.groupBy("lineId, unionid"); + sql.setCondition(cnd); + return Result.success(enrollService.listMap(sql)); + } + + @At + @ApiOperation("导出评价统计") + @SaCheckPermission("recuperation.statistics") + public void exportEvaluate(String lineId, + String unionId, + String unitId, + String evaluateScore, + String searchKeyword, + String searchName, + HttpServletResponse response) { + Sql sql = Sqls.create(""" + SELECT + we.evaluateText, + we.evaluateScore, + we.userName, + we.loginName, + u.unionname, + u.unitname, + u.userState, + u.personType, + line.lineName, + us.playStartTime + FROM + `recuperation_evaluate` we + LEFT JOIN `vw_user` u ON u.id = we.userId + LEFT JOIN recuperation_enroll en ON en.takePartInLineId = we.lineId + LEFT JOIN recuperation_line_select us ON us.id = en.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = us.lineId + $condition + """); + Cnd cnd = Cnd.NEW(); + if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) { + cnd.and(Cnd.likeEX(searchName, searchKeyword)); + } + if (StrUtil.isNotBlank(lineId)) { + cnd.andEX("we.lineId", "in", lineId.split(",")); + } + cnd.andEX("u.unionid", "=", unionId); + cnd.andEX("u.unitid", "=", unitId); + cnd.andEX("we.evaluateScore", "=", evaluateScore); + cnd.groupBy("we.lineId"); + sql.setCondition(cnd); + + List listMap = enrollService.listMap(sql); + + List entities = new ArrayList<>(); + entities.add(new ExcelExportEntity("线路", "lineName", 20)); + entities.add(new ExcelExportEntity("出行时间", "playStartTime", 20)); + entities.add(new ExcelExportEntity("工号", "loginName", 20)); + entities.add(new ExcelExportEntity("姓名", "userName", 20)); + entities.add(new ExcelExportEntity("所属单位", "unitname", 20)); + entities.add(new ExcelExportEntity("所属工会", "unionname", 20)); + entities.add(new ExcelExportEntity("在职状态", "userState", 20)); + entities.add(new ExcelExportEntity("人员类型", "personType", 20)); + entities.add(new ExcelExportEntity("评分", "evaluateScore", 20)); + entities.add(new ExcelExportEntity("评价", "evaluateText", 40)); + + try { + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entities, listMap); + CommonDownloadUtil.download("评价人员名单.xlsx", workbook, response); + } catch (Exception ignored) { + } } } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineSelectController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineSelectController.java new file mode 100644 index 00000000..6ddd3150 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineSelectController.java @@ -0,0 +1,357 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.annotation.SaMode; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.constant.RoleConstant; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.web.commons.auth.utils.AuthUtil; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationConfig; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLineSelect; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLot; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationTravelAgency; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineSelectService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.Daos; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @ClassName RecuperationLineSelectController + * @Author JyuHsin + * @Date 2025/8/18 15:53 + * @Version 1.0 + * @Description TODO + */ +@Slf4j +@IocBean +@At("/platform/recuperation/lineSelect") +@Api("疗休养选择线路") +@Ok("json:full") +public class RecuperationLineSelectController { + + @Inject + private Dao dao; + @Inject + private RecuperationLineSelectService lineSelectService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/lineSelect/index.html") + @SaCheckLogin + public void index() { + } + + @At + @ApiOperation("分页查询") + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + public Result pageData(PageForm pageForm, + @Param("year") Integer year, + @Param("keywords") String keywords, + @Param("selectStatus") int selectStatus, + @Param("unionId") String unionId, + @Param("lotId") String lotId, + @Param("travelAgencyId") String travelAgencyId, + @Param("mode") Integer mode, + @Param("regionalNature") String regionalNature) { + RecuperationConfig config = lineSelectService.dao().fetch(RecuperationConfig.class, Cnd.NEW()); + + Cnd cnd = Cnd.NEW(); + cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.travelAgencyId", "=", travelAgencyId); + if (!"全部".equals(regionalNature)) { + cnd.andEX("line.regionalNature", "=", regionalNature); + } + + //当前登录用户已选择的线路id + Sql hasSelectLineSql; + if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { + cnd.and(Cnd.exps("line.createUnionId", "=", SecurityUtil.getUnionId()).or("createMode", "=", 2)); + hasSelectLineSql = Sqls.createf(""" + select lineId from recuperation_line_select where selectUserId = '%s' AND unionId = '%s' AND year(selectTime) = %s + """, SecurityUtil.getUserId(), SecurityUtil.getUnionId(), year == null ? DateUtil.thisYear() : year); + } else { + hasSelectLineSql = Sqls.createf(""" + select lineId from recuperation_line_select where year(selectTime) = %s + """, year == null ? DateUtil.thisYear() : year); + } + + switch (selectStatus) { + //查询未选择的线路 + case -1 -> { + cnd.and("line.id", "not in", hasSelectLineSql); + cnd.and("line.year", "in", year == null ? Lang.array(config.getProvinceStartYear(), config.getProvinceStartYear() + 1) : year); + } + + case 0 -> { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("us.signUpMode", "is", null); + seg.or("us.signUpMode", "=", mode); + cnd.and(seg); + } + + /*case 0 -> { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or(Cnd.exps("line.id", "not in", hasSelectLineSql).and("line.createMode", "=", RecuperationLineCreateMode.SCHOOL.getValue())); + seg.or("line.id", "in", hasSelectLineSql); + cnd.and(seg); + }*/ + + //查询已选择的线路 + case 1 -> { + cnd.and("line.id", "in", hasSelectLineSql); + cnd.and("us.signUpMode", "=", mode); + cnd.and("year(us.selectTime)", "=", year == null ? DateUtil.thisYear() : year); + } + } + + cnd.and("line.isDisabled", "=", 0); + + if (StrUtil.isNotBlank(keywords)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("line.lineName", keywords); + seg.orLike("ta.travelAgencyName", keywords); + cnd.and(seg); + } + if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().replace("ending", "")); + } else { + cnd.asc("createUnionId").desc("year").asc("serialNumber"); + } + Pagination pagination = lineSelectService.pageData(pageForm, cnd, year); + return Result.success(pagination); + } + + /** + * 选择线路 + * + * @param us 选择线路信息 + * @return {@link Result} + */ + @At("/selectLine") + @ApiOperation("选择线路") + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + @SLog(type = "recuperation", tag = "选择线路", msg = "选择线路") + public Result selectLine(RecuperationLineSelect us) { + lineSelectService.selectLine(us); + return Result.success(); + } + + /** + * 选择线路时间 + * + * @param lineSelects 选择线路 + * @return {@link Object} + */ + @At("/selectLineTimes") + @ApiOperation("选择线路时间") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + @SLog(type = "recuperation", tag = "选择线路时间", msg = "选择线路时间") + public Result selectLineTimes(@Param("lineSelects") RecuperationLineSelect[] lineSelects) { + if (Lang.isNotEmpty(lineSelects)) { + RecuperationLineSelect lineUnionSelect = lineSelects[0]; + List oldUnionSelects = lineSelectService.query(Cnd.where("unionId", "=", SecurityUtil.getUnionId()).and("lineId", "=", lineUnionSelect.getUnionId())); + + //组织形式 + int signUpMode = AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name()) ? 1 : 2; + + RecuperationLineSelect recuperationLineSelect = dao.fetch(RecuperationLineSelect.class, Cnd.where("id", "=", lineUnionSelect.getId())); + + for (RecuperationLineSelect lineSelect : lineSelects) { + lineSelect.setSelectTime(new Date()); + lineSelect.setSelectUserId(SecurityUtil.getUserId()); + lineSelect.setUnionId(SecurityUtil.getUnionId()); + lineSelect.setIsOpen(Lang.isNotEmpty(recuperationLineSelect) ? recuperationLineSelect.getIsOpen() : false); + lineSelect.setDelFlag(signUpMode == 2); + lineSelect.setSignUpMode(signUpMode); + } + + //新增或修改 + dao.insertOrUpdate(lineSelects); + List newIds = Arrays.stream(lineSelects).map(RecuperationLineSelect::getId).toList(); + //删除 + List deleteIds = oldUnionSelects.stream().map(RecuperationLineSelect::getId).filter(v -> !newIds.contains(v)).toList(); + lineSelectService.clear(Cnd.where("id", "in", deleteIds)); + } + return Result.success(); + } + + @At + @ApiOperation("查询线路信息") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + public Result selectLineInfo(@Param("lineId") String lineId, @Param("unionId") String unionId, @Param("mode") Integer mode, @Param("year") Integer year) { + try { + Assert.notBlank(lineId); + Assert.notNull(mode); + unionId = StrUtil.emptyToNull(SecurityUtil.getUnionId()); + + if (mode == 1 && !AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { + return Result.error("您没有分工会角色权限!"); + } else if (mode == 2 && !AuthUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name())) { + return Result.error("您没有校工会角色权限!"); + } + return Result.success(lineSelectService.selectLineInfo(lineId, unionId, mode, year)); + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error(e.getMessage()); + } + } + + /** + * 查询某个分工会设置的线路时间信息 + * + * @param lineId 行id + * @param usUnionId 我们工会id + * @return {@link Object} + */ + @At + @ApiOperation("查询某个分工会设置的线路时间信息") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + public Result findUsLineInfo(String lineId, String usUnionId) { + RecuperationLineSelect lineSelect = lineSelectService.findUsLineInfo(lineId, usUnionId); + return Result.success(lineSelect); + } + + @At("/deSelect") + @ApiOperation("取消选择线路") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + @SLog(tag = "recuperation", msg = "取消选择线路", param = true, result = true) + public Result deSelect(@Param("lineId") String lineId, @Param("unionId") String unionId) { + try { + Assert.notBlank(lineId); + Assert.notBlank(unionId); + Cnd enrollCnd = Cnd.where("unionId", "=", unionId); + enrollCnd.and("lineId", "=", lineId); + lineSelectService.clear(enrollCnd); + return Result.success(); + } catch (Exception e) { + return Result.error(e.getMessage()); + } + } + + /** + * 旅行社 + * + * @return {@link Object} + */ + @At + @ApiOperation("查询旅行社信息") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + public Result getTravelAgencyOptions() { + List travelAgencies = lineSelectService.dao().query(RecuperationTravelAgency.class, Cnd.NEW().asc("serialNumber")); + return Result.success(travelAgencies); + } + + /** + * 是否公开分工会选择线路 + * + * @param id 分工会选择线路id + * @return {@link Object} + */ + @At("/isOpenUnionLine/?") + @ApiOperation("是否公开分工会选择线路") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + @SLog(tag = "recuperation", msg = "公开分工会选择线路", param = true, result = true) + public Result isOpenUnionLine(String id) { + if (StrUtil.isBlank(id)) { + return Result.error("参数错误"); + } + dao.update(RecuperationLineSelect.class, Chain.makeSpecial("isOpen", "isOpen ^ 1"), Cnd.where("id", "=", id)); + return Result.success(); + } + + @At("/getLineConfig/?") + @ApiOperation("获取线路配置信息") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + public Result getLineConfig(String id) { + Sql sql = Sqls.create("select lotId from recuperation_line where id = @lineId"); + sql.setParam("lineId", id); + String lotId = (String) Daos.query(dao, sql.toString(), Sqls.callback.str()); + RecuperationLot lotInfo = dao.fetch(RecuperationLot.class, lotId); + Integer cost = Optional.ofNullable(lotInfo).map(RecuperationLot::getActivityCost).orElse(0); + RecuperationConfig config = dao.fetch(RecuperationConfig.class, Cnd.NEW()); + Integer groupNumber = Optional.ofNullable(config).map(RecuperationConfig::getGroupNumber).orElse(0); + return Result.success(Map.of("cost", cost, "groupNumber", groupNumber)); + } + + /** + * 一键统赋时间,针对于已选择的线路 + * + * @param lineIds 线路Id数组 + * @param lineSelects 出行时段 + * @return {@link Object} + */ + @At("/setGiveLineTimes") + @ApiOperation("一键统赋时间,针对于已选择的线路") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + @SLog(type = "普惠疗休养", tag = "分工会/校工会选择线路", msg = "一键统赋时间,针对于已选择的线路", param = true, result = true) + public Result setGiveLineTimes(@Param("lineIds") String[] lineIds, + @Param("lineUnionSelects") RecuperationLineSelect[] lineSelects, + @Param(value = "year") Integer year) { + if (Lang.isNotEmpty(lineSelects) && Lang.isNotEmpty(lineIds)) { + RecuperationLineSelect lineUnionSelect = lineSelects[0]; + + Cnd cnd = Cnd.NEW(); + cnd.and("unionId", "=", SecurityUtil.getUnionId()); + cnd.and("selectUserId", "=", SecurityUtil.getUserId()); + cnd.and("YEAR(selectTime)", "=", year == null ? DateUtil.thisYear() : year); + List unionSelectList = dao.query(RecuperationLineSelect.class, cnd); + + List selectIdList = unionSelectList.stream().map(RecuperationLineSelect::getId).collect(Collectors.toList()); + Chain chain = Chain.make("enable", 1); + if (lineUnionSelect.getSignUpStartTime() != null) + chain.add("signUpStartTime", lineUnionSelect.getSignUpStartTime()); + if (lineUnionSelect.getSignUpEndTime() != null) + chain.add("signUpEndTime", lineUnionSelect.getSignUpEndTime()); + if (lineUnionSelect.getChangeEndTime() != null) + chain.add("changeEndTime", lineUnionSelect.getChangeEndTime()); + if (lineUnionSelect.getPlayStartTime() != null) + chain.add("playStartTime", lineUnionSelect.getPlayStartTime()); + if (lineUnionSelect.getPlayEndTime() != null) chain.add("playEndTime", lineUnionSelect.getPlayEndTime()); + + dao.update(RecuperationLineSelect.class, chain, Cnd.where("id", "in", selectIdList)); + } + return Result.success(); + } + + @At + @ApiOperation("是否开放对外报名") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission(value = {"recuperation.branchUnionSelect", "recuperation.schoolUnionSelect"}, mode = SaMode.OR) + @SLog(type = "普惠疗休养", tag = "分工会/校工会选择线路", msg = "是否开放对外报名", param = true, result = true) + public Result doEditOpen(String id) { + dao.update(RecuperationLineSelect.class, Chain.makeSpecial("isOpen", "isOpen ^ 1"), Cnd.where("id", "=", id)); + return Result.success(); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationSchoolUnionUserQueryController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationSchoolUnionUserQueryController.java new file mode 100644 index 00000000..0c2a4357 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationSchoolUnionUserQueryController.java @@ -0,0 +1,463 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationState; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationConfig; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnrollBed; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnrollCompanion; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationEnrollService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.dao.util.cri.Static; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; +import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName RecuperationSchoolUnionUserQueryController + * @Author JyuHsin + * @Date 2025/8/19 15:34 + * @Version 1.0 + * @Description TODO + */ +@Slf4j +@IocBean +@At("/platform/recuperation/schoolUnionUserQuery") +@Api("疗休养校工会查询") +@Ok("json:full") +public class RecuperationSchoolUnionUserQueryController { + + @Inject + private Dao dao; + @Inject + private RecuperationEnrollService enrollService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/schoolUnionUserQuery/index.html") + @SaCheckLogin + public void index() {} + + /** + * 校工会人员信息查询 + * + * @param pageForm 分页 + * @param year 年度 + * @param userName 姓名 + * @param loginName 登录名 + * @param signUpMode 报名方式(1分工会 2校工会 3个人) + * @param unionId 分工会id + * @param takePartInLineId 线路id + * @param lotId 标段id + * @param regionalNature 区域性质 省内 省外 + * @return + */ + @At + @ApiOperation("分页查询") + @SaCheckPermission("recuperation.schoolUnionUserQuery") + public Result pageData(PageForm pageForm, + Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + FROM + `recuperation_enroll` enroll + LEFT JOIN recuperation_line_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = lineu.lineId + LEFT JOIN recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + $condition + """); + if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { + cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); + } + if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), "ascending".equalsIgnoreCase(pageForm.getPageOrderBy()) ? "ASC" : "DESC"); + } + + cnd.and("enroll.takePartInLineId", "is not", null); + + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", userName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", loginName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 校工会可查询指定分工会 + cnd.andEX("enroll.selfUnionId", "=", unionId); + +// // 报名模式 +// if (StrUtil.isNotBlank(signUpMode)) { +// if (signUpMode.equals("1")) { +// cnd.andEX("line.signUpMode", "=", 2); +// } else if (signUpMode.equals("2")) { +// cnd.andEX("lineu.unionId", "=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("3")) { +// cnd.andEX("lineu.unionId", "!=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("4")) { +// cnd.andEX("line.signUpMode", "=", 3); +// } +// } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", RecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + Pagination pagination = enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + list.forEach(v -> { + List companionList = dao.query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (RecuperationEnrollCompanion enrollCompanion : companionList) { + enrollService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + return Result.success(pagination); + } + + + /** + * 设置出行人员 + * + * @return + */ + @At + @Aop(TransAop.READ_COMMITTED) + @ApiOperation("设置出行人员") + @SaCheckPermission("recuperation.schoolUnionUserQuery") + @SLog(type = "recuperation", tag = "设置出行人员", msg = "设置出行人员") + public Result setUpParticipants(@Param("data") String data) { + List list = Json.fromJsonAsList(NutMap.class, data); + for (NutMap map : list) { + Chain chain = Chain.make("lotId", map.getString("lotId")).add("takePartInTime", map.getString("takePartInTime")).add("isTakePartIn", true); + dao.update(RecuperationEnroll.class, chain, Cnd.where("id", "=", map.getString("id"))); + } + return Result.success(); + } + + /** + * 删除报名信息 + */ + @At + @ApiOperation("删除报名信息") + @SaCheckPermission("recuperation.schoolUnionUserQuery") + @SLog(type = "recuperation", tag = "删除报名信息", msg = "删除报名信息") + public Result deleteMyEnrollInfoById(String id) { + enrollService.deleteMyEnrollInfoById(id); + return Result.success(); + } + + /** + * 编辑查询详细信息 + */ + @At + @ApiOperation("编辑查询详细信息") + @SaCheckPermission("recuperation.schoolUnionUserQuery") + public Result findOne(String id) { + Sql sql = Sqls.create(""" + SELECT + lxs.travelAgencyName, + enroll.*, + line.lineName, + if(enroll.takePartInUnionId!=enroll.selfUnionId,true,false) isTransferIn, + (SELECT COUNT(1) FROM recuperation_enroll_companion WHERE trreId=enroll.id and relation='亲属') isFamily + FROM + `recuperation_enroll` enroll + LEFT JOIN recuperation_line_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = lineu.lineId + LEFT JOIN recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId + where enroll.id=@id + """); + sql.setParam("id", id); + sql.setCallback(Sqls.callback.map()); + dao.execute(sql); + NutMap data = (NutMap) sql.getResult(); + List companionList = dao.query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); + companionList.forEach(v -> { + v.setBedInfo(dao.fetch(RecuperationEnrollBed.class, v.getBedInfoId())); + }); + data.put("companionList", companionList); + return Result.success(data); + } + + /** + * 获取线路 + * + * @param year 年度 + * @param signUpMode 报名模式 + * @param unionId 分工会id + * @param regionalNature 区域 + * @return + */ + @At + @ApiOperation("获取线路") + @SaCheckPermission("recuperation.schoolUnionUserQuery") + public Result listLine(Integer year, String signUpMode, String unionId, String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + t1.takePartInLineId, + t3.lineName, + t4.name as unionName + FROM + recuperation_enroll t1 + LEFT JOIN recuperation_line_select t2 ON t2.id = t1.takePartInLineId + LEFT JOIN recuperation_line t3 ON t3.id = t2.lineId + LEFT JOIN sys_union t4 ON t4.id = t2.unionId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("t1.selfUnionId", "=", unionId); + cnd.andEX("YEAR(t2.selectTime)", "=", year); + cnd.andEX("t3.regionalNature", "=", regionalNature); + cnd.groupBy("t1.takePartInLineId"); + sql.setCondition(cnd); + List list = enrollService.listMap(sql); + return Result.success(list); + } + + @At + @Ok("void") + @ApiOperation("导出") + @SaCheckPermission("recuperation.schoolUnionUserQuery") + public void exportXlsx(Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature, + HttpServletResponse response) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + FROM + `recuperation_enroll` enroll + LEFT JOIN recuperation_line_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = lineu.lineId + LEFT JOIN recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + $condition + """); + cnd.and("enroll.takePartInLineId", "is not", null); + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", userName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", loginName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 校工会可查询指定分工会 + cnd.andEX("enroll.selfUnionId", "=", unionId); + +// // 报名模式 +// if (StrUtil.isNotBlank(signUpMode)) { +// if (signUpMode.equals("1")) { +// cnd.andEX("line.signUpMode", "=", 2); +// } else if (signUpMode.equals("2")) { +// cnd.andEX("lineu.unionId", "=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("3")) { +// cnd.andEX("lineu.unionId", "!=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("4")) { +// cnd.andEX("line.signUpMode", "=", 3); +// } +// } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", RecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + List list = enrollService.listMap(sql); + list.forEach(v -> { + List companionList = dao.query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (RecuperationEnrollCompanion enrollCompanion : companionList) { + enrollService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + + // 配置 + RecuperationConfig config = dao.fetch(RecuperationConfig.class, Cnd.NEW()); + + List excelEntities = new ArrayList<>(); + excelEntities.add(new ExcelExportEntity("姓名", "userName", 20)); + excelEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + excelEntities.add(new ExcelExportEntity("性别", "sex", 20)); + excelEntities.add(new ExcelExportEntity("单位", "unitName", 20)); + excelEntities.add(new ExcelExportEntity("工会", "unionName", 20)); + excelEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + excelEntities.add(new ExcelExportEntity("手机号", "mobile", 20)); + if (config.getFamilyInfo() == 2) { + excelEntities.add(new ExcelExportEntity("与本人关系", "relation", 10)); + excelEntities.add(new ExcelExportEntity("床型", "bedType", 10)); + excelEntities.add(new ExcelExportEntity("床位数", "bedNum", 10)); + excelEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 10)); + } else { + excelEntities.add(new ExcelExportEntity("携带家属数", "familyNumber", 10)); + + } + excelEntities.add(new ExcelExportEntity("备注", "bz", 20)); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("报名人员.xlsx").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + + try { + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelEntities, list); + workbook.write(response.getOutputStream()); + workbook.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @At + @Ok("void") + @ApiOperation("导出未报名人员") + @SaCheckPermission("recuperation.schoolUnionUserQuery") + public void noSignExport(HttpServletResponse response) { + RecuperationConfig config = dao.fetch(RecuperationConfig.class, Cnd.NEW()); + Sql sql = Sqls.create(""" + select + u.username as userName, + u.loginname as loginName, + u.sex, + u.mobile, + u.unitname as unitName, + u.name as unionName, + u.remark + from + activity_user_scope us + left join vw_user u on u.id = us.userId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("us.groupId", "=", config.getActivityGroupId()); + cnd.and(new Static(" u.loginname not in (select loginName from recuperation_enroll where year(signingUptime) = '%s' and isNormal = true)".formatted(DateUtil.thisYear()))); + cnd.asc("unitcode"); + sql.setCondition(cnd); + List listMap = enrollService.listMap(sql); + + for (int i = 0; i < listMap.size(); i++) { + listMap.get(i).put("index", i + 1); + } + + List excelEntities = new ArrayList<>(); + excelEntities.add(new ExcelExportEntity("序号", "index", 10)); + excelEntities.add(new ExcelExportEntity("姓名", "userName", 10)); + excelEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + excelEntities.add(new ExcelExportEntity("性别", "sex", 10)); + excelEntities.add(new ExcelExportEntity("联系方式", "mobile", 20)); + excelEntities.add(new ExcelExportEntity("所属单位", "unitName", 20)); + excelEntities.add(new ExcelExportEntity("所属工会", "unionName", 20)); + + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String((DateUtil.thisYear() + "未报名人员.xlsx").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + try { + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelEntities, listMap); + workbook.write(response.getOutputStream()); + workbook.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollChangeRecord.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollChangeRecord.java new file mode 100644 index 00000000..1488bc13 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollChangeRecord.java @@ -0,0 +1,36 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.model; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.util.Date; + +/** + * @ClassName RecuperationEnrollChangeRecord + * @Author JyuHsin + * @Date 2025/8/19 15:48 + * @Version 1.0 + * @Description TODO + */ +@Data +@TableMeta("{'mysql-charset':'utf8mb4'}") +@Comment("疗休养登记变更记录表") +public class RecuperationEnrollChangeRecord { + + @Name + @Comment("id") + @PrevInsert(uu32 = true) + private String id; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("变更记录id") + private String enrollId; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("变更时间") + private Date changeTime; +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEvaluate.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEvaluate.java new file mode 100644 index 00000000..b9d8b133 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEvaluate.java @@ -0,0 +1,61 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.model; + +import com.budwk.app.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author NINGMEI + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Table("recuperation_evaluate") +@TableMeta("{'mysql-charset':'utf8mb4'}") +@Comment("疗休养评价统计表") +public class RecuperationEvaluate extends BaseModel implements Serializable { + + @Name + @Comment("id") + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("参加线路id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String lineId; + + @Column + @Comment("用户ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userId; + + @Column + @Comment("姓名") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userName; + + @Column + @Comment("工号") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String loginName; + + @Column + @Comment("评分") + @ColDefine(type = ColType.VARCHAR, width = 20) + private String evaluateScore; + + @Column + @Comment("评价内容") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String evaluateText; + + @Column + @Comment("评价时间") + @ColDefine(type = ColType.DATETIME) + private Date applyDate; +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineUnionSelect.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineSelect.java similarity index 96% rename from src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineUnionSelect.java rename to src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineSelect.java index 1a9b640e..367f70c0 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineUnionSelect.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineSelect.java @@ -17,10 +17,10 @@ import java.util.Date; */ @Data @EqualsAndHashCode(callSuper = true) -@Table("recuperation_line_union_select") +@Table("recuperation_line_select") @TableMeta("{'mysql-charset':'utf8mb4'}") @Comment("疗休养线路") -public class RecuperationLineUnionSelect extends BaseModel { +public class RecuperationLineSelect extends BaseModel { @Name @Comment("id") diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationEnrollService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationEnrollService.java new file mode 100644 index 00000000..fb3b0b3d --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationEnrollService.java @@ -0,0 +1,114 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service; + +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.service.BaseService; +import com.budwk.app.sys.models.Sys_union; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import org.nutz.dao.Cnd; +import org.nutz.lang.util.NutMap; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName RecuperationEnrollService + * @Author JyuHsin + * @Date 2025/8/18 14:56 + * @Version 1.0 + * @Description TODO + */ +public interface RecuperationEnrollService extends BaseService { + + /** + * 报名页面数据 + * + * @param pageForm 分页参数 + * @param trrt trrt + * @return {@link Pagination} + */ + Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType); + + List getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType); + + /** + * 线路报名 + * + * @param enrollInfo 登记信息 + */ + void doSignUpForLine(RecuperationEnroll enrollInfo); + + /** + * 变更报名 + * + * @param enrollInfo 登记信息 + */ + void updateSignUpLine(RecuperationEnroll enrollInfo); + + /** + * 报名旅行社 + * + * @param enrollInfo 登记信息 + */ + void doSignUpForTravelAgency(RecuperationEnroll enrollInfo); + + /** + * 报名酒店 + * + * @param enrollInfo 登记信息 + */ + void doSignUpForHotel(RecuperationEnroll enrollInfo); + + void updateSignUpHotel(RecuperationEnroll enrollInfo); + + /** + * 变更报名旅行社 + * + * @param enrollInfo 登记信息 + */ + void updateSignUpTravelAgency(RecuperationEnroll enrollInfo); + + /** + * 验证报名登记信息 + * + * @param enrollInfo 登记信息 + * @param loginName 用户名 + * @return {@link Map}<{@link Boolean}, {@link String}> + */ + Map validSignUpInfo(String loginName, RecuperationEnroll enrollInfo); + + /** + * 我报名的页面数据 + * + * @param pageForm 分页参数 + * @param cnd cnd + * @return {@link Pagination} + */ + Pagination mySignUpPageData(PageForm pageForm, Cnd cnd, int trrt, Integer year); + + /** + * 找到报名信息通过id + * + * @param id id + * @return {@link RecuperationEnroll} + */ + RecuperationEnroll findSignUpInfoById(String id); + + /** + * 删除我的报名信息 + * + * @param id id + */ + void deleteMyEnrollInfoById(String id); + + /** + * 手机端线路介绍所有信息 + * + * @param usId usId + * @param usUnionId usUnionId + * @return {@link NutMap} + */ + NutMap selectLineAllInfo(String usId, String usUnionId); + + List getUnions(Integer year); +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineSelectService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineSelectService.java new file mode 100644 index 00000000..08cbb80c --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineSelectService.java @@ -0,0 +1,70 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service; + +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.service.BaseService; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLineSelect; +import org.nutz.dao.Cnd; +import org.nutz.lang.util.NutMap; + +import java.util.List; + +/** + * @ClassName RecuperationLineUnionSelectService + * @Author JyuHsin + * @Date 2025/8/18 15:54 + * @Version 1.0 + * @Description TODO + */ +public interface RecuperationLineSelectService extends BaseService { + + /** + * 页面数据 + * @param pageForm 分页参数 + * @param cnd cnd + * @return {@link Pagination} + */ + Pagination pageData(PageForm pageForm, Cnd cnd, Integer year); + + /** + * 选择线路 + * @param us 分工会选择线路信息 + */ + void selectLine(RecuperationLineSelect us); + + /** + * 已经选择的线路ids + * + * @return {@link List}<{@link String}> + */ + List getHasSelectLineIds(); + + /** + * 设置的活动时间信息 + * + * @param lineId 行id + * @return {@link Object} + */ + Object selectLineInfo(String lineId, String unionId,Integer mode, Integer year); + + /** + * 设置线路时间信息 + * @param lineSelect 联盟选择 + */ + void setLineInfo(RecuperationLineSelect lineSelect); + + /** + * 查询某个分工会设置的线路时间信息 + * @param lineId 行id + * @param usUnionId 我们工会id + * @return {@link NutMap} + */ + RecuperationLineSelect findUsLineInfo(String lineId, String usUnionId); + + /** + * 分工会取消选择线路 + * + * @param usId union_select 主键id + */ + void deSelect(String usId); +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationEnrollServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationEnrollServiceImpl.java new file mode 100644 index 00000000..be57a42f --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationEnrollServiceImpl.java @@ -0,0 +1,934 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.service.BaseService; +import com.budwk.app.base.service.impl.BaseServiceImpl; +import com.budwk.app.sys.models.Sys_union; +import com.budwk.app.sys.models.Sys_user; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.*; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.*; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationEnrollService; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineService; +import lombok.extern.slf4j.Slf4j; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.entity.Record; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.Daos; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.util.NutMap; + +import java.time.LocalDate; +import java.time.Period; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @ClassName RecuperationEnrollServiceImpl + * @Author JyuHsin + * @Date 2025/8/18 14:56 + * @Version 1.0 + * @Description TODO + */ +@Slf4j +@IocBean(args = {"refer:dao"}) +public class RecuperationEnrollServiceImpl extends BaseServiceImpl implements RecuperationEnrollService { + + @Inject + private RecuperationLineService lineService; + + public RecuperationEnrollServiceImpl(Dao dao) { + super(dao); + } + + static Map regionTypeLineMap = new HashMap<>() {{ + put(RecuperationType.provinceOutLine.getRegionType(), RecuperationType.provinceOutLine); + put(RecuperationType.provinceInLine.getRegionType(), RecuperationType.provinceInLine); + }}; + + @Override + public Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType) { + Cnd cnd = Cnd.NEW(); + if (List.of(RecuperationType.provinceInLine.getValue(), RecuperationType.provinceOutLine.getValue()).contains(trrt)) { + Sql lineSql = Sqls.create(""" + SELECT + us.id as usId, + line.id as lineId, + line.serialNumber, + line.lineName, + line.regionalNature, + us.minimumGroupSize, + line.`year`, + us.enable, + us.signUpStartTime, + us.signUpEndTime, + us.changeEndTime, + us.playStartTime, + us.playEndTime, + us.signUpMode, + us.estimatedFamilyNumbers, + line.file AS fileId, + usgh.name AS usUnionName, + usgh.id AS takePartInUnionId, + u.username AS createUserName, + ta.travelAgencyName, + ta.contact, + ta.contactMobileNumber, + lot.lotName, + lot.lotValue, + lot.activityCost as lotActivityCost, + count(us.id) as playCount, + (select count(1) from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as signUpUserNum, + (select count(1) from recuperation_enroll_companion where trreId in (select id from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year)) as signUpUserFamilyNum, + (select ifnull(sum(familyNumber),0) from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber + FROM + `recuperation_line_select` us + LEFT JOIN recuperation_line line ON line.id = us.lineId + LEFT JOIN recuperation_lot lot on lot.id = line.lotId + LEFT JOIN sys_union usgh ON usgh.id = us.unionId + LEFT JOIN sys_user u ON u.id = line.opBy + LEFT JOIN recuperation_travel_agency ta ON ta.id = line.travelAgencyId + $lineCnd + group by lineId + ORDER BY lotValue desc, us.lineId, playStartTime ASC + """).setParam("year", DateUtil.thisYear()); + Cnd lineCnd = Cnd.NEW(); + lineCnd.and("line.isDisabled", "=", false); + lineCnd.and("us.enable", "=", true); + lineCnd.and("line.regionalNature", "=", RecuperationType.typeMap.get(trrt)); + lineCnd.andEX("year(us.selectTime)", "=", year != null ? year : DateUtil.thisYear()); + //本公会 + if (lineUnionType == 1) { + lineCnd.and("us.signUpMode", "=", RecuperationSignUpMode.UNION.getValue()); +// lineCnd.and("us.isOpen", "=", true); + lineCnd.and("us.unionId", "=", unionId); + } else if (lineUnionType == 2) { + lineCnd.and("us.signUpMode", "=", RecuperationSignUpMode.UNION.getValue()); + lineCnd.and("us.isOpen", "=", true); + lineCnd.and("us.unionId", "=", unionId); + } else if (lineUnionType == 3) { + //校工会 + lineCnd.and("us.signUpMode", "=", RecuperationSignUpMode.FREE.getValue()); + } + lineSql.setVar("lineCnd", lineCnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), lineSql); + } else if (RecuperationType.provinceInTravelAgency.getValue() == trrt) { + cnd.andEX("year", "=", year != null ? year : DateUtil.thisYear()); + cnd.and("isDisabled", "=", false); + Sql taSql = Sqls.create(""" + select + *, + file as fileId + from + recuperation_travel_agency $condition + """); + taSql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); + } else if (RecuperationType.provinceInHotel.getValue() == trrt) { + cnd.andEX("b.year", "=", year != null ? year : DateUtil.thisYear()); + cnd.and("b.isDisabled", "=", false); + Sql taSql = Sqls.create(""" + select + b.*, + b.file as fileId, + l.lotName, + t.travelAgencyName + from + recuperation_base_management b + left join recuperation_lot l on l.id = b.lotId + left join recuperation_travel_agency t on t.id = b.travelAgencyId + $condition + """); + cnd.asc("sortNumber"); + taSql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); + } + return new Pagination(); + } + + @Override + public List getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType) { + Sql lineSql = Sqls.create(""" + SELECT + us.id as usId, + line.id as lineId, + line.serialNumber, + line.lineName, + line.regionalNature, + us.minimumGroupSize, + line.`year`, + us.enable, + us.signUpStartTime, + us.signUpEndTime, + us.changeEndTime, + us.playStartTime, + us.playEndTime, + us.signUpMode, + us.estimatedFamilyNumbers, + line.files, + line.file AS fileId, + usgh.name AS usUnionName, + usgh.id AS takePartInUnionId, + u.username AS createUserName, + ta.travelAgencyName, + us.contact, + us.contactPhone, + lot.lotName, + lot.lotValue, + lot.activityCost as lotActivityCost, + (select count(1) from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as signUpUserNum, + (select count(1) from recuperation_enroll_companion where trreId in (select id from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year)) as signUpUserFamilyNum, + (select ifnull(sum(familyNumber),0) from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber + FROM + `recuperation_line_select` us + LEFT JOIN recuperation_line line ON line.id = us.lineId + LEFT JOIN recuperation_lot lot on lot.id = line.lotId + LEFT JOIN sys_union usgh ON usgh.id = us.unionId + LEFT JOIN sys_user u ON u.id = line.opBy + LEFT JOIN recuperation_travel_agency ta ON ta.id = line.travelAgencyId + $lineCnd + ORDER BY us.lineId, playStartTime ASC + """).setParam("lineId", lineId).setParam("year", DateUtil.thisYear()); + Cnd lineCnd = Cnd.NEW(); + lineCnd.and("lineId", "=", lineId); + lineCnd.and("us.enable", "=", true); + lineCnd.and("year(us.selectTime)", "=", DateUtil.thisYear()); + lineCnd.and("line.regionalNature", "=", RecuperationType.typeMap.get(trrt)); + //本公会 + if (lineUnionType == 1) { + lineCnd.and("us.signUpMode", "=", RecuperationSignUpMode.UNION.getValue()); +// lineCnd.and("us.isOpen", "=", true); + lineCnd.and("us.unionId", "=", unionId); + } else if (lineUnionType == 2) { + lineCnd.and("us.signUpMode", "=", RecuperationSignUpMode.UNION.getValue()); + lineCnd.and("us.isOpen", "=", true); + lineCnd.and("us.unionId", "=", unionId); + } else if (lineUnionType == 3) { + //校工会 + lineCnd.and("us.signUpMode", "=", RecuperationSignUpMode.FREE.getValue()); + } + lineSql.setVar("lineCnd", lineCnd); + return (List) Daos.query(dao(), lineSql.toString(), Sqls.callback.maps()); + } + + /** + * 线路报名 + * + * @param enrollInfo 登记信息 + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void doSignUpForLine(RecuperationEnroll enrollInfo) { + RecuperationLineSelect lineUnionSelect = dao().fetch(RecuperationLineSelect.class, enrollInfo.getTakePartInLineId()); + RecuperationLine lineInfo = dao().fetch(RecuperationLine.class, lineUnionSelect.getLineId()); + + Sys_user user = dao().fetch(Sys_user.class, SecurityUtil.getUserId()); + + enrollInfo.setLoginName(user.getLoginname()); + enrollInfo.setUserName(user.getUsername()); + enrollInfo.setSex(user.getSex()); + enrollInfo.setUnitName(user.getUnit().getName()); + enrollInfo.setUnionName(SecurityUtil.getUnionId()); + enrollInfo.setSelfUnionId(user.getUnion().getId()); + enrollInfo.setSelfUnitId(SecurityUtil.getUnitId()); + enrollInfo.setSigningUptime(new Date()); + enrollInfo.setTakePartIn(false); + enrollInfo.setNormal(true); + + if (lineUnionSelect.getSignUpMode() == RecuperationSignUpMode.FREE.getValue()) { + enrollInfo.setTakePartInUnionId(null); + } + + //2023-06-07 省内外线路是否需要审核配置 根据配置来赋报名表的审核状态值☞ + RecuperationConfig recuperationConfig = dao().fetch(RecuperationConfig.class, Cnd.NEW()); + Boolean isSnLine = recuperationConfig.getIsSnLine(); + Boolean isSwLine = recuperationConfig.getIsSwLine(); + + Boolean flag = null; + if (lineInfo.getRegionalNature().equals(RecuperationProvinceType.provinceOut.getValue())) { + flag = isSwLine; + } else if (lineInfo.getRegionalNature().equals(RecuperationProvinceType.provinceIn.getValue())) { + flag = isSnLine; + } + if (Boolean.TRUE.equals(flag)) { + if (lineUnionSelect.getSignUpMode() == 1) { + if (StrUtil.isNotBlank(enrollInfo.getTakePartInUnionId()) && !enrollInfo.getTakePartInUnionId().equals(enrollInfo.getSelfUnionId())) { + enrollInfo.setStateId(RecuperationState.LINEUNIT); + } else { + enrollInfo.setStateId(RecuperationState.UNIT); + } + } else { + enrollInfo.setStateId(RecuperationState.SCHOOL); + } + } else { + enrollInfo.setStateId(RecuperationState.PASS); + } + + if (recuperationConfig.getBedInfo() || recuperationConfig.getFamilyInfo() == 2) { + for (RecuperationEnrollCompanion RecuperationEnrollCompanion : enrollInfo.getCompanionList()) { + insertLinks(RecuperationEnrollCompanion, "bedInfo"); + } + insertWith(enrollInfo, "companionList|bedInfo"); + } else { + insert(enrollInfo); + } + + //String content = "【智慧工会】%s老师您好,您已成功报名%s疗休养线路".formatted(user.getUsername(), lineInfo.getLineName()); + //msgApi.sendMsg(content, user.getMobile(), MsgApi.DING_DING_TEMPLATE_ID); + //发短信 +// RCSCloudAPI.sendTplSms("81d48e1811144270b838b321575c7199", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=报名||@3@=" + lineInfo.getLineName(), ""); + } + + /** + * 变更报名 + * + * @param enrollInfo 登记信息 + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void updateSignUpLine(RecuperationEnroll enrollInfo) { + RecuperationLineSelect lineUnionSelect = dao().fetch(RecuperationLineSelect.class, enrollInfo.getTakePartInLineId()); + + RecuperationConfig recuperationConfig = dao().fetch(RecuperationConfig.class, Cnd.NEW()); + + if (lineUnionSelect.getSignUpMode() == RecuperationSignUpMode.FREE.getValue()) { + enrollInfo.setTakePartInUnionId(null); + } + + if (recuperationConfig.getBedInfo() || recuperationConfig.getFamilyInfo() == 2) { + dao().clearLinks(enrollInfo, "companionList"); + dao().delete(RecuperationEnrollBed.class, enrollInfo.getBedInfoId()); + + dao().insertLinks(enrollInfo, "companionList|bedInfo"); + } + + update(enrollInfo); + //插入变更记录 + RecuperationEnrollChangeRecord changeRecord = new RecuperationEnrollChangeRecord(); + changeRecord.setEnrollId(enrollInfo.getId()); + changeRecord.setChangeTime(new Date()); + insert(changeRecord); + + //发短信 + //String content = "【智慧工会】%s老师您好,您的疗休养线路已成功修改为%s".formatted(user.getUsername(), lineInfo.getLineName()); + //msgApi.sendMsg(content, user.getMobile(), MsgApi.DING_DING_TEMPLATE_ID); +// RCSCloudAPI.sendTplSms("81d48e1811144270b838b321575c7199", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=修改||@3@=" + lineInfo.getLineName(), ""); + } + + /** + * 报名旅行社 + * + * @param enrollInfo 登记信息 + */ + @Override + public void doSignUpForTravelAgency(RecuperationEnroll enrollInfo) { + Sys_user user = dao().fetch(Sys_user.class, SecurityUtil.getUserId()); + enrollInfo.setLoginName(user.getLoginname()); + enrollInfo.setUserName(user.getUsername()); + enrollInfo.setSex(user.getSex()); + enrollInfo.setUnitName(user.getUnit().getName()); + enrollInfo.setUnionName(user.getUnion().getName()); + enrollInfo.setSelfUnionId(user.getUnion().getId()); + enrollInfo.setSelfUnitId(user.getUnitId()); + enrollInfo.setSigningUptime(new Date()); + enrollInfo.setTakePartIn(false); + enrollInfo.setNormal(true); + insert(enrollInfo); + } + + /** + * 报名酒店 + * + * @param enrollInfo 登记信息 + */ + @Override + public void doSignUpForHotel(RecuperationEnroll enrollInfo) { + Sys_user user = dao().fetch(Sys_user.class, SecurityUtil.getUserId()); + enrollInfo.setLoginName(user.getLoginname()); + enrollInfo.setUserName(user.getUsername()); + enrollInfo.setSex(user.getSex()); + enrollInfo.setUnitName(user.getUnit().getName()); + enrollInfo.setUnionName(user.getUnion().getName()); + enrollInfo.setSelfUnionId(user.getUnion().getId()); + enrollInfo.setSelfUnitId(user.getUnitId()); + enrollInfo.setSigningUptime(new Date()); + enrollInfo.setTakePartIn(false); + enrollInfo.setNormal(true); + enrollInfo.setStateId(RecuperationState.PASS); + + for (RecuperationEnrollCompanion RecuperationEnrollCompanion : enrollInfo.getCompanionList()) { + insertLinks(RecuperationEnrollCompanion, "bedInfo"); + } + insertWith(enrollInfo, "companionList|bedInfo"); + } + + /** + * 变更报名 + * + * @param enrollInfo 登记信息 + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void updateSignUpHotel(RecuperationEnroll enrollInfo) { + + dao().clearLinks(enrollInfo, "companionList"); + dao().delete(RecuperationEnrollBed.class, enrollInfo.getBedInfoId()); + + dao().insertLinks(enrollInfo, "companionList|bedInfo"); + + update(enrollInfo); + //插入变更记录 + RecuperationEnrollChangeRecord changeRecord = new RecuperationEnrollChangeRecord(); + changeRecord.setEnrollId(enrollInfo.getId()); + changeRecord.setChangeTime(new Date()); + insert(changeRecord); + } + + /** + * 变更报名旅行社 + * + * @param enrollInfo 登记信息 + */ + @Override + public void updateSignUpTravelAgency(RecuperationEnroll enrollInfo) { + updateIgnoreNull(enrollInfo); + } + + /** + * 验证报名登记信息 + * + * @param enrollInfo 登记信息 + * @param loginName 用户名 + * @return {@link Map}<{@link Boolean}, {@link String}> + */ + @Override + public Map validSignUpInfo(String loginName, RecuperationEnroll enrollInfo) { + + //配置信息 + RecuperationConfig config = dao().fetch(RecuperationConfig.class); + + Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); + //判断是否在报名范围内 + int count = dao().count("activity_user_scope", Cnd.NEW().and("groupId", "=", config.getActivityGroupId()) + .and("userId", "=", user.getId() )); + if (count == 0) { + return Map.of(false, "抱歉,您不在报名范围内!"); + } + + //每年旅行频率 + Integer travelFrequency = config.getTravelFrequency(); + //省外几年去一次 + Integer outsideNumber = config.getOutsideNumber(); + //可以修改几次 + Integer modifyNumber = config.getModifyNumber(); + //省外最多报名人数 + Integer allLineSignUpNumber = config.getAllLineSignUpNumber(); + //省内起始年份 + Integer provinceStartYear = config.getProvinceStartYear(); + //活动范围 + Integer activityGroupId = config.getActivityGroupId(); + + //线路信息 + RecuperationLineSelect lineUnionSelect = dao().fetch(RecuperationLineSelect.class, enrollInfo.getTakePartInLineId()); + RecuperationLine lineInfo = dao().fetch(RecuperationLine.class, lineUnionSelect.getLineId()); + + Date signUpStartTime = lineUnionSelect.getSignUpStartTime(); + Date signUpEndTime = lineUnionSelect.getSignUpEndTime(); + Date changeEndTime = lineUnionSelect.getChangeEndTime(); + //线路人数,省外线路最多报名数 +// Integer estimatedFamilyNumbers = lineUnionSelect.getEstimatedFamilyNumbers(); + Integer estimatedFamilyNumbers = config.getOutsideQuota(); + if (DateUtil.compare(new Date(), signUpStartTime) < 0) { + return Map.of(false, "报名未开始,请耐心等待"); + } + if (DateUtil.compare(new Date(), changeEndTime) > 0 && enrollInfo.isNormal()) { + return Map.of(false, "报名时间已过,抱歉不能报名"); + } + + RecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); + if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { + + //2025-05-20 临时增加的代码 + Record tempRecord = dao().fetch("recuperation_temp", Cnd.where("loginname", "=", loginName)); + if(tempRecord != null) { + if(tempRecord.getInt("flag") != trrt.getValue()) { + return Map.of(false, "您只能报名" + tempRecord.getString("type") + "线路"); + } + } + + //获取标段中的最大费用 + List lotList = dao().query(RecuperationLot.class, Cnd.NEW()); + //最大费用 + OptionalInt optionalInt = lotList.stream().mapToInt(RecuperationLot::getActivityCost).max(); + int maxCost = optionalInt.isPresent() ? optionalInt.getAsInt() : 0; + //获取当前报名线路对应的标段的费用 + Integer currentLineCost = dao().fetch(RecuperationLot.class, lineInfo.getLotId()).getActivityCost(); + + //省外线路判断报名人数 + if (trrt.getValue() == RecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { + Map map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "add"); + if(map != null) { + return map; + } + } + + //获取起始年份到当前时间,是否报名 + Sql sql = Sqls.create(""" + SELECT + r.*, + l.regionalNature, + (select activityCost from recuperation_lot where id = l.lotId) as activityCost + FROM + recuperation_enroll r + LEFT JOIN recuperation_line_select us on us.id = r.takePartInLineId + LEFT JOIN recuperation_line l ON l.id = us.lineId + $condition + """); + Sql twoYearInSql = sql; + Sql threeYearOutSql = sql; + Sql twoYearOutSql = sql; + Sql nowYearSql = sql; + + Cnd commonCnd = Cnd.NEW(); + commonCnd.and("r.takePartInLineId", "is not", null); + commonCnd.and("loginName", "=", SecurityUtil.getUserLoginname()); + commonCnd.and("r.isNormal", "=", true); + commonCnd.and("stateId", "not in", Lang.array(RecuperationState.UNITFAIL, RecuperationState.LINEUNITFAIL, RecuperationState.SCHOOLFAIL)); + commonCnd.and("signingUptime", "<=", DateUtil.now()); + + //两年参加省内 + Cnd twoYearInCnd = commonCnd.clone(); + twoYearInCnd.and("signingUptime", ">=", provinceStartYear + "-01-01"); + twoYearInCnd.and("regionalNature", "=", "省内"); + twoYearInCnd.and("isTakePartIn", "=", true); + twoYearInSql.setCondition(twoYearInCnd); + List twoYearInMapList = listMap(twoYearInSql); + + //今年是否报名,不管省内省外 + Cnd nowYearCnd = commonCnd.clone(); + nowYearCnd.and("signingUptime", ">=", DateUtil.thisYear() + "-01-01"); + nowYearSql.setCondition(nowYearCnd); + List nowYearMapList = listMap(nowYearSql); + + //两年参加省外 + Cnd twoYearOutCnd = commonCnd.clone(); + twoYearOutCnd.and("signingUptime", ">=", provinceStartYear + "-01-01"); + twoYearOutCnd.and("regionalNature", "=", "省外"); + twoYearOutCnd.and("isTakePartIn", "=", true); + twoYearOutSql.setCondition(twoYearOutCnd); + List twoYearOutMapList = listMap(twoYearOutSql); + + //三年参加省外 + Cnd threeYearOutCnd = commonCnd.clone(); + threeYearOutCnd.and("signingUptime", ">=", (DateUtil.thisYear() - 3) + "-01-01"); + threeYearOutCnd.and("regionalNature", "=", "省外"); + threeYearOutCnd.and("isTakePartIn", "=", true); + threeYearOutSql.setCondition(threeYearOutCnd); + List threeYearOutMapList = listMap(threeYearOutSql); + + //今年是否报名,不管报省内还是省外 + if (nowYearMapList.size() > 0) { + NutMap nowYearMap = nowYearMapList.get(0); + //判断当前报名的线路是否和今年第一次报名的线路重复 + if (nowYearMap.getString("takePartInLineId").equals(lineUnionSelect.getId())) { + return Map.of(false, "您已报名过当前线路,请选择其他线路"); + } + //获取第一次报名线路对应的标段的费用 + int lastLineCost = nowYearMap.getInt("activityCost"); + if ((lastLineCost + currentLineCost) > maxCost) { + return Map.of(false, "您已报名过省内或省外线路"); + } + } + //省内线路判断 + if (trrt.getValue() == RecuperationType.provinceInLine.getValue()) { + if (twoYearInMapList.size() == 0 && threeYearOutMapList.size() == 0) { + return Map.of(true, "验证成功"); + } + //查询两年内有没有参加过省外 + if (twoYearOutMapList.size() > 0) { + return Map.of(false, "您近两年已参加过省外线路,不能报名省内线路"); + } + if (twoYearInMapList.size() > 0) { + int hasCost = twoYearInMapList.get(0).getInt("activityCost"); + if ((hasCost + currentLineCost) > maxCost) { + return Map.of(false, "您已参加过省内线路"); + } + } + } + //省外线路判断 + if (trrt.getValue() == RecuperationType.provinceOutLine.getValue()) { + //两年内参加过省内 + if (twoYearInMapList.size() > 0) { + return Map.of(false, "您近两年已参加过省内线路,不能报名省外线路"); + } + //三年内有没有参加过省外 + if (threeYearOutMapList.size() > 0) { + return Map.of(false, "近三年内您已参加过省外线路,不能再次报名"); + } + //获取今年的所有线路 + List lineList = dao().query(RecuperationLine.class, Cnd.where("year", "=", DateUtil.thisYear()) + .and("isDisabled", "=", false)); + List lineIds = lineList.stream().map(RecuperationLine::getId).collect(Collectors.toList()); + //获取这些线路在选择表中的选择id,因为报名表存的是选择id + List selectList = dao().query(RecuperationLineSelect.class, Cnd.where("lineId", "in", lineIds)); + List selectIds = selectList.stream().map(RecuperationLineSelect::getId).collect(Collectors.toList()); + //获取这些省外线路的总报名人数 + List enrollList = dao().query(RecuperationEnroll.class, Cnd.where("takePartInLineId", "in", selectIds) + .and("isNormal", "=", true).and("signingUptime", "=", DateUtil.thisYear()) + .and("stateId", "not in", Lang.array(RecuperationState.UNITFAIL, RecuperationState.LINEUNITFAIL, RecuperationState.SCHOOLFAIL))); + //活动范围总人数 + List userScopes = dao().query(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId)); + int result = (int) Math.floor((double) userScopes.size() / 3); + if (enrollList.size() >= result) { + return Map.of(false, "已报人数超过三分之一,不能报名"); + } + } + } + + //变更操作 + if (StrUtil.isNotBlank(enrollInfo.getId())) { + + if (trrt.getValue() == RecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { + Map map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "edit"); + if(map != null) { + return map; + } + } + + int changeCount = dao().count(RecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "=", enrollInfo.getId())); + + if (changeCount >= modifyNumber) { + return Map.of(false, "只能变更" + changeCount + "次!"); + } + + if (DateUtil.compare(new Date(), changeEndTime) > 0) { + return Map.of(false, "超过变更截至时间,无法变更!"); + } else { + return Map.of(true, "验证成功"); + } + } + + return Map.of(true, "验证成功"); + } + + public Map validSignCount(RecuperationEnroll enrollInfo, RecuperationConfig config, int estimatedFamilyNumbers, String type) { + int hasSignNumber = 0;//已经报名的人数 + int currentSignNumber = 1;//当前报名人数,1表示自己,下面的if是加家属人数 + Cnd cnd = Cnd.where("takePartInLineId", "=", enrollInfo.getTakePartInLineId()) + .and("stateId", "in", Lang.array(RecuperationState.UNIT, RecuperationState.LINEUNIT, RecuperationState.SCHOOL, RecuperationState.PASS)) + .and("isNormal", "=", true); + //如果是修改,排除自己的报名记录 + if("edit".equals(type)) { + cnd.and("loginName", "!=", SecurityUtil.getUserLoginname()); + } + List enrolls = dao().query(RecuperationEnroll.class, cnd); + + //1表示在配置页面的家属配置的是数量,2是家属的List + /*if (config.getFamilyInfo() == 1) { + currentSignNumber += enrollInfo.getFamilyNumber() != null ? enrollInfo.getFamilyNumber() : 0; + int sum = enrolls.stream().mapToInt(RecuperationEnroll::getFamilyNumber).sum(); + hasSignNumber = enrolls.size() + sum; + } else { + currentSignNumber += enrollInfo.getCompanionList() != null ? enrollInfo.getCompanionList().size() : 0; + List list = enrolls.stream().map(RecuperationEnroll::getId).collect(Collectors.toList()); + List companions = dao().query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", list)); + hasSignNumber = enrolls.size() + companions.size(); + }*/ + //省外报名限制,不包含家属 +// hasSignNumber += currentSignNumber + enrolls.size(); + if (( currentSignNumber + enrolls.size()) > estimatedFamilyNumbers) { + return Map.of(false, "报名人数已满"); + } else { + return null; + } + } + + //判断一年报几次 + public Map validCountOneYear(String loginName, int travelFrequency) { + Cnd cnd = Cnd.NEW(); + cnd.and("loginName", "=", loginName); + cnd.and("YEAR(signingUptime)", "=", DateUtil.thisYear()); + int joinCount = dao().count(RecuperationEnroll.class, cnd); + + if (joinCount >= travelFrequency) { + List inList = dao().query(RecuperationLine.class, Cnd.where("regionalNature", "=", "省内")); + List outList = dao().query(RecuperationLine.class, Cnd.where("regionalNature", "=", "省外")); + //是否选择省外 + int inCount = dao().count("recuperation_enroll", Cnd.where("loginName", "=", SecurityUtil.getUserLoginname()) + .and("takePartInLineId", "in", inList.stream().map(RecuperationLine::getId).collect(Collectors.toList())) + .and("isNormal", "=", true) + .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); + //是否报省外 + int outCount = dao().count("recuperation_enroll", Cnd.where("loginName", "=", SecurityUtil.getUserLoginname()) + .and("takePartInLineId", "in", outList.stream().map(RecuperationLine::getId).collect(Collectors.toList())) + .and("isNormal", "=", true) + .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); + //是否报旅行社 + int travelCount = dao().count("recuperation_enroll", Cnd.where("loginName", "=", SecurityUtil.getUserLoginname()) + .and("takePartInLineId", "is", null).and("isNormal", "=", true) + .and("takePartInTravelAgencyId", "is not", null) + .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); + //是否报酒店 + int hotelCount = dao().count("recuperation_enroll", Cnd.where("loginName", "=", SecurityUtil.getUserLoginname()) + .and("takePartInLineId", "is", null).and("isNormal", "=", true) + .and("takePartInBaseManagementId", "is not", null) + .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); + String str = ""; + if (inCount > 0) { + str = "省内线路"; + } else if (outCount > 0) { + str = "省外线路"; + } else if (travelCount > 0) { + str = "旅行社"; + } else if (hotelCount > 0) { + str = "酒店"; + } + return Map.of(false, "一年只能报" + travelFrequency + "次,您已报" + str + ",请先在我的疗休养中删除,方可报名!"); + } + return Map.of(true, "成功"); + } + + public int getCountByOutLine(RecuperationType trrt, String loginName, int outsideNumber) { + //省外 outsideNumber 年内是否去过 + if (trrt.getValue() == RecuperationType.provinceOutLine.getValue()) { + Sql lineJoinSql = Sqls.create(""" + SELECT + count(*) + FROM + recuperation_enroll ren + LEFT JOIN recuperation_line rl on ren.takePartInLineId = rl.id + $condition + """); + + Cnd lineCnd = Cnd.NEW(); + lineCnd.and("loginName", "=", loginName); + lineCnd.and("isNormal", "=", true); + lineCnd.and("takePartInLineId", "IS NOT", null); + lineCnd.and("YEAR ( signingUptime )", ">=", DateUtil.thisYear() - outsideNumber); + lineCnd.and("YEAR ( signingUptime )", "<=", DateUtil.thisYear() - 1); + lineCnd.and("regionalNature", "=", RecuperationType.provinceOutLine.getValue()); + + lineJoinSql.setCondition(lineCnd); + + //lineCnd.and(new SqlExpressionGroup().andBetween("YEAR(signingUptime)", io.v.nutz.base.utils.DateUtil.getYear() - 1, io.v.nutz.base.utils.DateUtil.getYear() - outsideNumber)); + return lineService.count(lineJoinSql); + } + return 0; + } + + /** + * 我报名的页面数据 + * + * @param pageForm 分页参数 + * @param cnd cnd + * @return {@link Pagination} + */ + @Override + public Pagination mySignUpPageData(PageForm pageForm, Cnd cnd, int trrt, Integer year) { + if (List.of( + RecuperationType.provinceInLine.getValue(), + RecuperationType.provinceOutLine.getValue() + ).contains(trrt)) { + return this.getDataByInLineAndOutLine(pageForm, cnd, trrt, year); + } else if (trrt == RecuperationType.provinceInTravelAgency.getValue()) { + return this.getDataByInTravelAgency(pageForm, cnd, trrt, year); + } else if (trrt == RecuperationType.provinceInHotel.getValue()) { + return this.getDataByInHotel(pageForm, cnd, trrt, year); + } + return null; + } + + public Pagination getDataByInLineAndOutLine(PageForm pageForm, Cnd cnd, int trrt, Integer year) { + Sql lineSql = Sqls.create(""" + SELECT + e.*, + line.serialNumber, + line.lineName, + line.regionalNature, + line.YEAR, + us.signUpStartTime, + us.signUpEndTime, + us.changeEndTime, + us.playStartTime, + us.playEndTime, + us.signUpMode, + line.file AS fileId, + gh.name AS signUpUnionName, + ta.travelAgencyName, + ta.contact, + ta.contactMobileNumber, + ta.officialWebsite, + GROUP_CONCAT(ec.userName) as companionUserNames, + l.lotName + FROM + recuperation_enroll e + LEFT JOIN sys_union gh ON gh.id = e.takePartInUnionId + LEFT JOIN recuperation_line_select us on us.id = e.takePartInLineId + LEFT JOIN recuperation_line line ON line.id = us.lineId + LEFT JOIN recuperation_travel_agency ta ON ta.id = line.travelAgencyId + left join recuperation_enroll_companion ec on ec.trreId = e.id + left join recuperation_lot l on l.id = line.lotId + $condition + GROUP BY e.id + """); + cnd.and("line.regionalNature", "=", RecuperationType.typeMap.get(trrt)); + cnd.and("e.isNormal", "=", true); + cnd.andEX("year(e.signingUptime)", "=", year); + + lineSql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), lineSql); + } + + public Pagination getDataByInTravelAgency(PageForm pageForm, Cnd cnd, int trrt, Integer year) { + Sql taSql = Sqls.create(""" + SELECT + e.*, + ta.travelAgencyName, + ta.contact, + ta.contactMobileNumber, + ta.officialWebsite, + ta.file AS fileId + FROM + recuperation_enroll e + LEFT JOIN recuperation_travel_agency ta ON ta.id = e.takePartInTravelAgencyId + $condition + """); + cnd.and("e.takePartInTravelAgencyId", "is not", null); + cnd.and("e.isNormal", "=", true); + cnd.andEX("ta.year", "=", year); + taSql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); + } + + public Pagination getDataByInHotel(PageForm pageForm, Cnd cnd, int trrt, Integer year) { + Sql taSql = Sqls.create(""" + SELECT + e.*, + ta.baseName, + ta.baseContactPerson, + ta.baseContactNumber, + ta.file AS fileId, + l.lotName, + ta.regionalNature, + t.travelAgencyName, + ta.changeEndTime + FROM + recuperation_enroll e + LEFT JOIN recuperation_base_management ta ON ta.id = e.takePartInBaseManagementId + LEFT JOIN recuperation_lot l on l.id = ta.lotId + LEFT JOIN recuperation_travel_agency t on t.id = ta.travelAgencyId + $condition + """); + cnd.and("e.takePartInBaseManagementId", "is not", null); + cnd.and("e.isNormal", "=", true); + cnd.andEX("ta.year", "=", year); + taSql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); + } + + /** + * 找到报名信息通过id + * + * @param id id + * @return {@link RecuperationEnroll} + */ + @Override + public RecuperationEnroll findSignUpInfoById(String id) { + RecuperationEnroll enroll = fetch(id); + return fetchLinks(enroll, "companionList|bedInfo"); + } + + /** + * 删除我的报名信息 + * + * @param id id + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void deleteMyEnrollInfoById(String id) { + RecuperationEnroll enrollInfo = fetch(id); + RecuperationLineSelect lineUnionSelect = dao().fetch(RecuperationLineSelect.class, enrollInfo.getTakePartInLineId()); + dao().clearLinks(enrollInfo, "companionList|bedInfo"); + delete(id); + dao().clear(RecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "=", id)); + + //发短信 + //String content = "【智慧工会】%s老师您好,您报名的%s疗休养线路已取消成功".formatted(user.getUsername(), lineInfo.getLineName()); + //msgApi.sendMsg(content, user.getMobile(), MsgApi.DING_DING_TEMPLATE_ID); +// RCSCloudAPI.sendTplSms("81d48e1811144270b838b321575c7199", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=取消||@3@=" + lineInfo.getLineName(), ""); + } + + /** + * 手机端线路介绍所有信息 + * + * @param usId usId + * @param usUnionId usUnionId + * @return {@link NutMap} + */ + @Override + public NutMap selectLineAllInfo(String usId, String usUnionId) { + Sql usLineSql = Sqls.create(""" + SELECT + us.id as usId, + line.id as lineId, + line.lineName, + line.regionalNature, + us.playStartTime, + us.playEndTime, + us.signUpStartTime, + us.signUpEndTime, + us.changeEndTime, + us.minimumGroupSize, + us.estimatedFamilyNumbers, + line.content, + l.lotName, + (select COUNT(1) FROM recuperation_enroll en WHERE isNormal=true AND en.loginName=@loginname and YEAR(en.signingUptime)=@year) isNormal, + (select COUNT(1) FROM recuperation_enroll en WHERE isNormal=false AND en.loginName=@loginname and YEAR(en.signingUptime)=@year) isNormalFalse, + (select count(1) from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and YEAR(signingUptime)=@year) as signUpUserNum, + (select count(1) from recuperation_enroll_companion where trreId in (select id from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and YEAR(signingUptime)=@year)) as signUpUserFamilyNum, + (select ifnull(sum(familyNumber),0) from recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber, + ta.travelAgencyName, + ta.contactMobileNumber + FROM + `recuperation_line_select` us + LEFT JOIN recuperation_line line ON line.id = us.lineId + LEFT JOIN recuperation_travel_agency ta on ta.id = line.travelAgencyId + LEFT JOIN recuperation_lot l on l.id = line.lotId + WHERE if(us.signUpMode = 1, us.unionId = @usUnionId, 1=1) AND us.id = @id + """); + usLineSql.setParam("loginname", SecurityUtil.getUserLoginname()); + usLineSql.setParam("year", DateUtil.thisYear()); + usLineSql.setParam("usUnionId", usUnionId); + usLineSql.setParam("id", usId); + + usLineSql.setCallback(Sqls.callback.map()); + this.dao().execute(usLineSql); + return usLineSql.getObject(NutMap.class); + } + + @Override + public List getUnions(Integer year) { + //查询某个年份公开线路了的工会 + List openList = dao().query(RecuperationLineSelect.class, Cnd.where("isOpen", "=", true) + .and("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear()).and("unionId", "!=", SecurityUtil.getUnionId())); + +// List openList = dao().query(RecuperationLineSelect.class, +// Cnd.where("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear())); + + if (Lang.isNotEmpty(openList)) { + List unionIds = openList.stream().map(RecuperationLineSelect::getUnionId).distinct().collect(Collectors.toList()); + return dao().query(Sys_union.class, Cnd.where("id", "in", unionIds)); + } + return new ArrayList<>(); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineSelectServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineSelectServiceImpl.java new file mode 100644 index 00000000..edf87f11 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineSelectServiceImpl.java @@ -0,0 +1,271 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.constant.RoleConstant; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.service.impl.BaseServiceImpl; +import com.budwk.app.web.commons.auth.utils.AuthUtil; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLineSelect; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineSelectService; +import lombok.extern.slf4j.Slf4j; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.Daos; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; + +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @ClassName RecuperationLineSelectServiceImpl + * @Author JyuHsin + * @Date 2025/8/18 15:55 + * @Version 1.0 + * @Description TODO + */ +@Slf4j +@IocBean(args = {"refer:dao"}) +public class RecuperationLineSelectServiceImpl extends BaseServiceImpl implements RecuperationLineSelectService { + + public RecuperationLineSelectServiceImpl(Dao dao) { + super(dao); + } + + /** + * 页面数据 + * + * @param pageForm 分页参数 + * @param cnd cnd + * @return {@link Pagination} + */ + @Override + public Pagination pageData(PageForm pageForm, Cnd cnd, Integer year) { + Sql sql = Sqls.create(""" + select + line.id, + line.serialNumber, + line.lineName, + line.regionalNature, + line.minimumGroupSize, + line.year, + line.isDisabled, + line.createUnionId, + GROUP_CONCAT(us.playStartTime,'至',us.playEndTime) as playTimes, + us.signUpStartTime, + us.signUpEndTime, + us.playStartTime, + us.playEndTime, + us.changeEndTime, + us.isOpen, + us.signUpMode, + line.createMode, + gh.name AS createUnionName, + u.username AS createUserName, + ta.travelAgencyName, + ta.contact, + ta.contactMobileNumber, + ta.officialWebsite, + lot.lotName, + us.unionId as usUnionId, + us.id as usId, + usUnion.name as belongUnionName, + (SELECT COUNT(*) FROM recuperation_enroll WHERE takePartInLineId=line.id AND takePartInUnionId=@unionId) applyCount + from + recuperation_line line + LEFT JOIN recuperation_travel_agency ta on ta.id = line.travelAgencyId + LEFT JOIN sys_union gh ON gh.id = line.createUnionid + LEFT JOIN sys_user u ON u.id = line.createdBy + LEFT JOIN recuperation_line_select us on us.lineId = line.id and year(selectTime) = @year $us + LEFT JOIN sys_union usUnion on usUnion.id = us.unionId + LEFT JOIN recuperation_lot lot on lot.id = line.lotId + $condition + """); + if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { + sql.setVar("us", "AND us.unionId = '%s' AND us.selectUserId = '%s'".formatted(SecurityUtil.getUnionId(), SecurityUtil.getUserId())); + } + + //sql.setParam("unionId", Vi.getUnionId()); + //sql.setParam("userId", ShiroUtil.getPrincipalProperty("id")); + sql.setParam("year", year == null ? DateUtil.thisYear() : year); + + /*SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.createUnionId", "=", Vi.getUnionId()); + seg.or("line.createMode", "=", RecuperationLineCreateMode.SCHOOL.getValue()); + cnd.and(seg);*/ + + cnd.groupBy("line.id"); + sql.setCondition(cnd); + Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + + List hasSelectLineIds = getHasSelectLineIds(); + for (NutMap m : list) { + m.setv("isSelect", hasSelectLineIds.contains(m.getString("id"))); + } + return pagination; + } + + /** + * 选择线路 + * + * @param us 分工会选择线路信息 + */ + @Override + public void selectLine(RecuperationLineSelect us) { + us.setUnionId(SecurityUtil.getUnionId()); + us.setSelectTime(new Date()); + us.setSelectUserId(SecurityUtil.getUserId()); + if (StrUtil.isBlank(us.getId())) { + insert(us); + } else { + updateIgnoreNull(us); + } + insertOrUpdate(us); + } + + /** + * 已经选择的线路ids + * + * @return {@link List}<{@link String}> + */ + @Override + public List getHasSelectLineIds() { + Sql sql = Sqls.create(""" + select lineId from recuperation_line_select + where selectUserId = @userId + """); + sql.setParam("userId", SecurityUtil.getUserId()); + List lineIdsMap = (List) Daos.query(dao(), sql.toString(), Sqls.callback.maps()); + return lineIdsMap.stream().map(v -> v.getString("lineId")).collect(Collectors.toList()); + } + + /** + * 设置的活动时间信息 + * + * @param lineId 行id + * @return {@link Object} + */ + @Override + public Object selectLineInfo(String lineId, String unionId, Integer mode, Integer year) { + Sql sql; + sql = Sqls.create(""" + select + id, + lineId, + signUpStartTime, + signUpEndTime, + changeEndTime, + playStartTime, + playEndTime, + contact, + contactPhone, + minimumGroupSize, + trafficTools, + estimatedCost, + estimatedFamilyNumbers, + signUpMode, + enable + from + recuperation_line_select + where unionId = @unionId + and lineId = @lineId + and signUpMode = @mode + and year(selectTime) = @year + ORDER BY signUpStartTime ASC + """); + sql.setParam("unionId", unionId); + sql.setParam("lineId", lineId); + sql.setParam("mode", mode); + sql.setParam("year", year == null ? DateUtil.thisYear() : year); + return listMap(sql); + +// RecuperationLine line = dao().fetch(RecuperationLine.class, lineId); +// if (line.getSignUpMode() == RecuperationSignUpMode.UNION.getValue()) { +// sql = Sqls.create(""" +// select +// id, +// lineId, +// signUpStartTime, +// signUpEndTime, +// changeEndTime, +// playStartTime, +// playEndTime, +// contact, +// contactPhone +// from +// recuperation_line_select +// where unionId = @unionId +// and lineId = @lineId +// ORDER BY signUpStartTime ASC +// """); +// sql.setParam("unionId", unionId); +// sql.setParam("lineId", lineId); +// return listMap(sql); +// } else { +// sql = Sqls.create(""" +// select +// id, +// signUpStartTime, +// signUpEndTime, +// changeEndTime, +// playStartTime, +// playEndTime +// from +// recuperation_line +// where id = @lineId +// """); +// sql.setParam("lineId", lineId); +// return listMap(sql); +// } + + } + + /** + * 设置线路时间信息 + * + * @param unionSelect 联盟选择 + */ + @Override + public void setLineInfo(RecuperationLineSelect unionSelect) { + dao().updateIgnoreNull(unionSelect); + } + + /** + * 查询某个分工会设置的线路时间信息 + * + * @param lineId 行id + * @param usUnionId 我们工会id + * @return {@link NutMap} + */ + @Override + public RecuperationLineSelect findUsLineInfo(String lineId, String usUnionId) { + return dao().fetch(RecuperationLineSelect.class, + Cnd.where("lineId", "=", lineId) + .and("unionId", "=", usUnionId)); + } + + /** + * 分工会取消选择线路 + * + * @param usId union_select 主键id + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void deSelect(String usId) { + RecuperationLineSelect lineUnionSelect = fetch(usId); + Cnd enrollCnd = Cnd.where("takePartInUnionId", "=", lineUnionSelect.getUnionId()); + enrollCnd.and("takePartInLineId", "=", lineUnionSelect.getLineId()); + dao().clear(RecuperationEnroll.class, enrollCnd); + delete(usId); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineServiceImpl.java index eab2dff5..ead2faef 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineServiceImpl.java @@ -8,12 +8,11 @@ import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.web.commons.auth.utils.AuthUtil; import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationLineCreateMode; -import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationSignUpMode; import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationState; import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnrollCompanion; import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLine; -import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLineUnionSelect; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLineSelect; import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineService; import lombok.extern.slf4j.Slf4j; import org.nutz.dao.Chain; @@ -26,7 +25,6 @@ import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; import org.nutz.plugins.wkcache.annotation.CacheRemove; -import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -47,18 +45,18 @@ public class RecuperationLineServiceImpl extends BaseServiceImpl unionSelectList = dao().query(RecuperationLineUnionSelect.class, Cnd.where("lineId", "=", lineId)); + List unionSelectList = dao().query(RecuperationLineSelect.class, Cnd.where("lineId", "=", lineId)); if (Lang.isNotEmpty(unionSelectList)) { - List selectIds = unionSelectList.stream().map(RecuperationLineUnionSelect::getId).collect(Collectors.toList()); + List selectIds = unionSelectList.stream().map(RecuperationLineSelect::getId).collect(Collectors.toList()); List enrollList = dao().query(RecuperationEnroll.class, Cnd.where("takePartInLineId", "in", selectIds)); - if (Lang.isNotEmpty(enrollList)){ + if (Lang.isNotEmpty(enrollList)) { List enrollIds = enrollList.stream().map(RecuperationEnroll::getId).collect(Collectors.toList()); dao().clear(RecuperationEnrollCompanion.class, Cnd.where("trreId", "in", enrollIds)); } dao().clear(RecuperationEnroll.class, Cnd.where("takePartInLineId", "in", selectIds)); } delete(lineId); - dao().clear(RecuperationLineUnionSelect.class, Cnd.where("lineId", "=", lineId)); + dao().clear(RecuperationLineSelect.class, Cnd.where("lineId", "=", lineId)); deleteLineInfoCache(lineId); } @@ -91,33 +89,33 @@ public class RecuperationLineServiceImpl extends BaseServiceImpl viewUnionSelectTimeInfo(String lineId) { Sql sql = Sqls.create(""" - SELECT - us.signUpStartTime, - us.signUpEndTime, - us.changeEndTime, - us.playStartTime, - us.playEndTime, - gh.name AS selectUnionName - FROM - `recuperation_line_union_select` us - LEFT JOIN sys_union gh ON gh.id = us.unionId - WHERE us.lineId = @lineId - """); + SELECT + us.signUpStartTime, + us.signUpEndTime, + us.changeEndTime, + us.playStartTime, + us.playEndTime, + gh.name AS selectUnionName + FROM + `recuperation_line_select` us + LEFT JOIN sys_union gh ON gh.id = us.unionId + WHERE us.lineId = @lineId + """); return listMap(sql); } } diff --git a/src/main/resources/views/platform/zhgh/activity/family/apply/index.html b/src/main/resources/views/platform/zhgh/activity/family/apply/index.html index 4d10af6b..bfb61d87 100644 --- a/src/main/resources/views/platform/zhgh/activity/family/apply/index.html +++ b/src/main/resources/views/platform/zhgh/activity/family/apply/index.html @@ -88,7 +88,7 @@ layout("/layouts/platform.html"){ activityType: "2" }, tableColumns: [ - { label: "活动名称", prop: "activityName", width: 800}, + { label: "活动名称", prop: "activityName", width: 600}, { label: "活动性质", prop: "trainType"}, { label: "报名时间", prop: "activitySignUpStartTime"}, { label: "活动时间", prop: "activityStartTime"}, diff --git a/src/main/resources/views/platform/zhgh/activity/family/apply/signForm.js b/src/main/resources/views/platform/zhgh/activity/family/apply/signForm.js index 4b5d6533..baff2c7a 100644 --- a/src/main/resources/views/platform/zhgh/activity/family/apply/signForm.js +++ b/src/main/resources/views/platform/zhgh/activity/family/apply/signForm.js @@ -3,7 +3,7 @@ const signForm = {
- +
个人信息
diff --git a/src/main/resources/views/platform/zhgh/activity/family/manage/index.html b/src/main/resources/views/platform/zhgh/activity/family/manage/index.html index a1a8144c..c120d55d 100644 --- a/src/main/resources/views/platform/zhgh/activity/family/manage/index.html +++ b/src/main/resources/views/platform/zhgh/activity/family/manage/index.html @@ -64,9 +64,9 @@ layout("/layouts/platform.html"){ {{ $moment(createdAt).format('YYYY-MM-DD HH:mm:ss') }} @@ -135,7 +135,7 @@ layout("/layouts/platform.html"){ year: new Date().getFullYear() + '' }, tableColumns: [ - { label: "活动名称", prop: "activityName", width: 800 }, + { label: "活动名称", prop: "activityName", width: 600 }, { label: "活动时间", prop: "activityTime" }, { label: "是否开启", prop: "isDisabled", width: 100 }, { label: "创建时间", prop: "createdAt" } diff --git a/src/main/resources/views/platform/zhgh/activity/family/statistics/index.html b/src/main/resources/views/platform/zhgh/activity/family/statistics/index.html index 311a125e..3dd6345d 100644 --- a/src/main/resources/views/platform/zhgh/activity/family/statistics/index.html +++ b/src/main/resources/views/platform/zhgh/activity/family/statistics/index.html @@ -16,9 +16,10 @@ layout("/layouts/platform.html"){ diff --git a/src/main/resources/views/platform/zhgh/activity/family/userAdjust/index.html b/src/main/resources/views/platform/zhgh/activity/family/userAdjust/index.html index 2645e8e5..dfa136b4 100644 --- a/src/main/resources/views/platform/zhgh/activity/family/userAdjust/index.html +++ b/src/main/resources/views/platform/zhgh/activity/family/userAdjust/index.html @@ -12,11 +12,12 @@ layout("/layouts/platform.html"){ @@ -69,7 +70,7 @@ layout("/layouts/platform.html"){ diff --git a/src/main/resources/views/platform/zhgh/activity/family/userAdjust/userInfo.js b/src/main/resources/views/platform/zhgh/activity/family/userAdjust/userInfo.js index 442b81ed..1fa312fa 100644 --- a/src/main/resources/views/platform/zhgh/activity/family/userAdjust/userInfo.js +++ b/src/main/resources/views/platform/zhgh/activity/family/userAdjust/userInfo.js @@ -152,16 +152,16 @@ const userInfo = { background: "rgba(0, 0, 0, 0.7)" }) const resp = await this.$axios.post(loc() + "/adjust", { - activityId: this.pageForm.activityId, + activityId: this.activity.id, oldCourseId: this.registerCourse.id, newCourseId: this.afterAdjustCourse, userId: this.userInfo.userId }) if (resp.code === 0) { this.$message.success(resp.msg) - this.$refs.guava.index() this.adjustDialogVisible = false - this.doSearch() + await this.registerSearch() + this.$emit("refresh", null) } else { this.$message.warning(resp.msg) } @@ -184,7 +184,7 @@ const userInfo = { }) .then(async () => { const resp = await this.$axios.post(loc() + "/deleteSignUser", { - activityId: this.pageForm.activityId, + activityId: this.activity.id, courseId: this.registerCourse.id, userId: o.userId }) diff --git a/src/main/resources/views/platform/zhgh/activity/family/userManage/index.html b/src/main/resources/views/platform/zhgh/activity/family/userManage/index.html index 1af51038..83e266d5 100644 --- a/src/main/resources/views/platform/zhgh/activity/family/userManage/index.html +++ b/src/main/resources/views/platform/zhgh/activity/family/userManage/index.html @@ -79,8 +79,8 @@ layout("/layouts/platform.html"){ - - + + diff --git a/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/basicForm.js b/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/basicForm.js index cb16442c..83c48404 100644 --- a/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/basicForm.js +++ b/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/basicForm.js @@ -1,7 +1,7 @@ const basicForm = { template: /*language=HTML*/ `
- + @@ -68,6 +68,12 @@ const basicForm = { + + + 取消 @@ -120,6 +126,7 @@ const basicForm = { cancelButtonText: "取消", type: "warning" }).then(async () => { + this.formData.files = JSON.stringify(this.formData.files) const resp = await this.$axios.post("/platform/yearPlan/manage/onSubmit", this.formData) if (resp.code === 0) { this.$message.success(resp.msg) diff --git a/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/index.html b/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/index.html index 8270adc0..e11dfedc 100644 --- a/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/index.html +++ b/src/main/resources/views/platform/zhgh/activity/planSummary/yearPlan/index.html @@ -57,6 +57,10 @@ layout("/layouts/platform.html"){ + + + 下载全部附件 + 新增计划 @@ -133,6 +137,9 @@ layout("/layouts/platform.html"){ } }, methods: { + onDownLoad() { + this.$downLoad(loc() + '/downloadFiles', this.pageForm) + }, refresh() { this.doSearch() this.$refs.guava.index() diff --git a/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/basicForm.js b/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/basicForm.js index 78329249..3e4b09c2 100644 --- a/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/basicForm.js +++ b/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/basicForm.js @@ -1,7 +1,7 @@ const basicForm = { template: /*language=HTML*/ `
- + diff --git a/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/index.html b/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/index.html index 790a4fe7..f11ad181 100644 --- a/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/index.html +++ b/src/main/resources/views/platform/zhgh/activity/planSummary/yearSummary/index.html @@ -54,6 +54,10 @@ layout("/layouts/platform.html"){ + + + 下载全部附件 + 新增计划 @@ -129,6 +133,9 @@ layout("/layouts/platform.html"){ } }, methods: { + onDownLoad() { + this.$downLoad(loc() + '/downloadFiles', this.pageForm) + }, refresh() { this.doSearch() this.$refs.guava.index() diff --git a/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/index.html b/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/index.html index cdc8efc8..52aa6112 100644 --- a/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/index.html +++ b/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/index.html @@ -88,7 +88,7 @@ layout("/layouts/platform.html"){ activityType: "2" }, tableColumns: [ - { label: "活动名称", prop: "activityName", width: 800}, + { label: "活动名称", prop: "activityName", width: 600}, { label: "活动性质", prop: "trainType"}, { label: "报名时间", prop: "activitySignUpStartTime"}, { label: "活动时间", prop: "activityStartTime"}, diff --git a/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/signForm.js b/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/signForm.js index efffb07c..af2db641 100644 --- a/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/signForm.js +++ b/src/main/resources/views/platform/zhgh/activity/trainSingUp/apply/signForm.js @@ -2,7 +2,7 @@ const signForm = { template: /*language=HTML*/ `
- + @@ -155,7 +155,7 @@ const signForm = { this.$refs["form"].validate(async (valid) => { if (valid) { if (this.courseRow.courseIsLimitApply) { - const resp = await $.post('/platform/mobile/trainSignUpActivity/validateSourceSignUp', {activityCourseId: this.formData.activityCourseId}) + const resp = await this.$axios.post('/platform/mobile/trainSignUpActivity/validateSourceSignUp', {activityCourseId: this.formData.activityCourseId}) if (resp.code !== 0) { this.$message.warning(res.msg) return diff --git a/src/main/resources/views/platform/zhgh/activity/trainSingUp/manage/index.html b/src/main/resources/views/platform/zhgh/activity/trainSingUp/manage/index.html index b03aa676..753ceebe 100644 --- a/src/main/resources/views/platform/zhgh/activity/trainSingUp/manage/index.html +++ b/src/main/resources/views/platform/zhgh/activity/trainSingUp/manage/index.html @@ -64,9 +64,9 @@ layout("/layouts/platform.html"){ {{ $moment(createdAt).format('YYYY-MM-DD HH:mm:ss') }} @@ -135,7 +135,7 @@ layout("/layouts/platform.html"){ year: new Date().getFullYear() + '' }, tableColumns: [ - { label: "活动名称", prop: "activityName", width: 800 }, + { label: "活动名称", prop: "activityName", width: 600 }, { label: "活动时间", prop: "activityTime" }, { label: "是否开启", prop: "isDisabled", width: 100 }, { label: "创建时间", prop: "createdAt" } diff --git a/src/main/resources/views/platform/zhgh/activity/trainSingUp/statistics/index.html b/src/main/resources/views/platform/zhgh/activity/trainSingUp/statistics/index.html index d859dc3a..12f61f48 100644 --- a/src/main/resources/views/platform/zhgh/activity/trainSingUp/statistics/index.html +++ b/src/main/resources/views/platform/zhgh/activity/trainSingUp/statistics/index.html @@ -16,9 +16,10 @@ layout("/layouts/platform.html"){ diff --git a/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/index.html b/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/index.html index a83ac77d..5aa4216f 100644 --- a/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/index.html +++ b/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/index.html @@ -12,9 +12,10 @@ layout("/layouts/platform.html"){ @@ -69,7 +70,7 @@ layout("/layouts/platform.html"){ diff --git a/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/userInfo.js b/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/userInfo.js index c4b1d3d7..12a469b3 100644 --- a/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/userInfo.js +++ b/src/main/resources/views/platform/zhgh/activity/trainSingUp/userAdjust/userInfo.js @@ -152,20 +152,20 @@ const userInfo = { background: "rgba(0, 0, 0, 0.7)" }) const resp = await this.$axios.post(loc() + "/adjust", { - activityId: this.pageForm.activityId, + activityId: this.activity.id, oldCourseId: this.registerCourse.id, newCourseId: this.afterAdjustCourse, userId: this.userInfo.userId }) + loading.close() if (resp.code === 0) { this.$message.success(resp.msg) - this.$refs.guava.index() this.adjustDialogVisible = false - this.doSearch() + await this.registerSearch() + this.$emit("refresh", null) } else { this.$message.warning(resp.msg) } - loading.close() }) .catch(() => {}) }, @@ -184,14 +184,14 @@ const userInfo = { }) .then(async () => { const resp = await this.$axios.post(loc() + "/deleteSignUser", { - activityId: this.pageForm.activityId, + activityId: this.activity.id, courseId: this.registerCourse.id, userId: o.userId }) if (resp.code === 0) { this.$message.success(resp.msg) await this.registerSearch() - this.doSearch() + this.$emit("refresh", null) } else { this.$message.warning(resp.msg) } diff --git a/src/main/resources/views/platform/zhgh/activity/trainSingUp/userManage/index.html b/src/main/resources/views/platform/zhgh/activity/trainSingUp/userManage/index.html index 55664b08..7f4fb531 100644 --- a/src/main/resources/views/platform/zhgh/activity/trainSingUp/userManage/index.html +++ b/src/main/resources/views/platform/zhgh/activity/trainSingUp/userManage/index.html @@ -79,8 +79,8 @@ layout("/layouts/platform.html"){ - - + + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/legal/appointmentSet/addForm.js b/src/main/resources/views/platform/zhgh/staffbenefit/legal/appointmentSet/addForm.js index f45256fd..ed08a402 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/legal/appointmentSet/addForm.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/legal/appointmentSet/addForm.js @@ -119,6 +119,9 @@ const addForm = { }) }, }, + created() { + this.queryDoctorUser(null) + }, style: /*language=CSS*/ ` ` diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/basicForm.js b/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/basicForm.js index 5b58254c..4085021a 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/basicForm.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/basicForm.js @@ -8,6 +8,7 @@ const basicForm = { v-model="formData.userId" filterable remote + :disabled="formData.id !== '' && formData.id !== null && formData.id !== undefined" reserve-keyword placeholder="请输入关键词" :remote-method="selectQueryUser" diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/index.html index 9b9b2f6b..e38814cd 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/index.html @@ -101,7 +101,7 @@ layout("/layouts/platform.html"){ {prop: 'userName', label: '姓名'}, {prop: 'sex', label: '性别'}, {prop: 'unitName', label: '单位'}, - {prop: 'jobTitle', label: '职称'}, + {prop: 'technicalTitle', label: '职称'}, {prop: 'mobile', label: '联系电话'}, {prop: 'avatar', label: '头像'} ], diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/info.js b/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/info.js index 22cdaafe..ff182491 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/info.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/legal/doctorManage/info.js @@ -42,6 +42,10 @@ const info = { }, }, style: /*language=CSS*/ ` - + .el-descriptions-item__label { + width: 200px; + min-width: 200px; + max-width: 200px; + } ` } diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/appointmentSet/addForm.js b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/appointmentSet/addForm.js index 2b4af15a..117d08fd 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/appointmentSet/addForm.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/appointmentSet/addForm.js @@ -119,6 +119,9 @@ const addForm = { }) }, }, + created() { + this.queryDoctorUser(null) + }, style: /*language=CSS*/ ` ` diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/basicForm.js b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/basicForm.js index fbdc0548..6edc53f3 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/basicForm.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/basicForm.js @@ -8,6 +8,7 @@ const basicForm = { v-model="formData.userId" filterable remote + :disabled="formData.id !== '' && formData.id !== null && formData.id !== undefined" reserve-keyword placeholder="请输入关键词" :remote-method="selectQueryUser" diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/index.html index 587e3012..00c7e4ef 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/index.html @@ -101,7 +101,7 @@ layout("/layouts/platform.html"){ {prop: 'userName', label: '姓名'}, {prop: 'sex', label: '性别'}, {prop: 'unitName', label: '单位'}, - {prop: 'jobTitle', label: '职称'}, + {prop: 'technicalTitle', label: '职称'}, {prop: 'mobile', label: '联系电话'}, {prop: 'avatar', label: '头像'} ], diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/info.js b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/info.js index 22cdaafe..ff182491 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/info.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/psychology/doctorManage/info.js @@ -42,6 +42,10 @@ const info = { }, }, style: /*language=CSS*/ ` - + .el-descriptions-item__label { + width: 200px; + min-width: 200px; + max-width: 200px; + } ` } diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/annualAnalysis/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/annualAnalysis/index.html new file mode 100644 index 00000000..f9f290ec --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/annualAnalysis/index.html @@ -0,0 +1,353 @@ + + + + +
+ + + + + +
+ + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/index.html index 282c4191..1c106066 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/index.html @@ -90,8 +90,8 @@ layout("/layouts/platform.html"){ >