diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/common/RecuperationCommon.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/common/RecuperationCommon.java new file mode 100644 index 0000000..91aaddb --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/common/RecuperationCommon.java @@ -0,0 +1,20 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.common; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; + +public class RecuperationCommon { + + public static String getRemarkBySchoolTime(String schoolTime) { + if(StrUtil.isNotBlank(schoolTime)) { + DateTime schoolDate = DateUtil.parse(schoolTime); + DateTime time = DateUtil.parse(DateUtil.thisYear() + "-07-01"); + int compareResult = DateUtil.compare(schoolDate, time); + return compareResult >= 0 ? ("入校时间为:" + schoolTime + ",疗休养额度为1500。") : ""; + } else { + return ""; + } + } + +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/constant/RecuperationJoinUserImportExcelMode.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/constant/RecuperationJoinUserImportExcelMode.java new file mode 100644 index 0000000..d6dc2bf --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/constant/RecuperationJoinUserImportExcelMode.java @@ -0,0 +1,24 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.constant; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * @FileName com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationJoinUserImportExcelMode + * @Description: 参加人员导入excel mode + * @Author zxc + * @Date 2022/6/14:11:10 + * @Version V1.0 + **/ +@Data +public class RecuperationJoinUserImportExcelMode { + + @Excel(name = "工号") + private String loginName; + + @Excel(name = "参加时间", format = "yyyyMMdd") + private Date takePartInTime; + +} 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 index 179b194..5f5333f 100644 --- 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 @@ -59,7 +59,7 @@ public class RecuperationAnnualAnalysisController { 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"); + Sql selectIdSql = Sqls.create("select id from the_rapy_recuperation_line_union_select"); selectIdSql.setCallback(Sqls.callback.strList()); dao.execute(selectIdSql); List selectIdList = selectIdSql.getList(String.class); @@ -69,7 +69,7 @@ public class RecuperationAnnualAnalysisController { SELECT takePartInLineId FROM - `recuperation_enroll` + `the_rapy_recuperation_enroll` $condition """); Cnd cnd = Cnd.NEW(); @@ -167,9 +167,9 @@ public class RecuperationAnnualAnalysisController { 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 + the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId $condition """); Cnd cnd = Cnd.NEW(); @@ -211,9 +211,9 @@ public class RecuperationAnnualAnalysisController { 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 + the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId $condition """); Cnd cnd = Cnd.NEW(); @@ -308,10 +308,10 @@ public class RecuperationAnnualAnalysisController { 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 + the_rapy_recuperation_line_union_select us + LEFT JOIN the_rapy_recuperation_line line ON us.lineId = line.id + LEFT JOIN the_rapy_recuperation_enroll enroll ON enroll.takePartInLineId = us.id + LEFT JOIN the_rapy_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); diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationAuditController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationAuditController.java new file mode 100644 index 0000000..6fb5634 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationAuditController.java @@ -0,0 +1,77 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationAuditService; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +import javax.servlet.http.HttpServletRequest; + +/** + * 旧版通用 audit 审核入口,不接入 wf。stage 支持 branch、lineUnion、school、travel, + * pageData 的 data 为 Pagination;audit/recall 返回新版统一 Result。 + */ +@IocBean +@At("/platform/recuperation/audit") +@Ok("json:full") +public class RecuperationAuditController { + + @Inject + private RecuperationAuditService auditService; + + @At("/branch") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/audit/index.html") + @SaCheckLogin + public void branch(HttpServletRequest request) { request.setAttribute("stage", "branch"); } + + @At("/lineUnion") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/audit/index.html") + @SaCheckLogin + public void lineUnion(HttpServletRequest request) { request.setAttribute("stage", "lineUnion"); } + + @At("/school") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/audit/index.html") + @SaCheckLogin + public void school(HttpServletRequest request) { request.setAttribute("stage", "school"); } + + @At("/travel") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/audit/index.html") + @SaCheckLogin + public void travel(HttpServletRequest request) { request.setAttribute("stage", "travel"); } + + /** pageForm 为分页信息;stage 为审核环节;year 为年度;audited 表示已审/待审;keyword 为姓名或工号。 */ + @At + @SaCheckPermission("recuperation.audit") + public Result pageData(PageForm pageForm, String stage, Integer year, Boolean audited, String keyword) { + return Result.success(auditService.auditPage(pageForm, stage, year, audited, keyword)); + } + + @At + @SaCheckPermission("recuperation.audit") + public Result findOne(String id) { + return Result.success(auditService.findOne(id)); + } + + /** id 为报名记录,pass 为是否通过,auditOpinion 为意见;返回 success=true 表示 audit 和报名状态已在同一事务更新。 */ + @At + @SaCheckPermission("recuperation.audit") + public Result audit(String id, Boolean pass, String auditOpinion) { + if (StrUtil.isBlank(id) || pass == null) return Result.error("审核参数不完整"); + auditService.auditEnroll(id, pass, auditOpinion); + return Result.success(); + } + + @At + @SaCheckPermission("recuperation.audit") + public Result recall(String id) { + if (StrUtil.isBlank(id)) return Result.error("参数错误"); + auditService.recallAudit(id); + return Result.success(); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBaseManagerController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBaseManagerController.java index f0099ad..e01fa92 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBaseManagerController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBaseManagerController.java @@ -21,6 +21,7 @@ import com.budwk.app.base.result.Result; import com.budwk.app.base.utils.CommonDownloadUtil; 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.RecuperationState; import com.budwk.app.zhgh.staffbenefit.recuperation.mode.BaseManagerExcelMode; import com.budwk.app.zhgh.staffbenefit.recuperation.mode.TravelAgencyExcelMode; import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationBaseManagement; @@ -89,6 +90,7 @@ public class RecuperationBaseManagerController { public Result pageData(PageForm pageForm, @Param(value = "year") Integer year, @Param(value = "lotId") String lotId, + @Param(value = "days") String days, @Param(value = "baseName") String baseName, @Param(value = "unionId") String unionId, @Param(value = "travelAgencyId") String travelAgencyId, @@ -101,8 +103,9 @@ public class RecuperationBaseManagerController { tb.baseName, tb.regionalNature, tb.year, - tb.isDisabled, - tb.lotId, + tb.isDisabled, + tb.lotId, + tb.days, tb.createUnionId, tb.signUpStartTime, tb.signUpEndTime, @@ -110,10 +113,20 @@ public class RecuperationBaseManagerController { tb.createMode, tb.activityStartTime, tb.activityEndTime, - tb.file, - tb.baseContactPerson, - tb.baseContactNumber, - tb.file AS fileId, + tb.files, + tb.baseContactPerson, + tb.baseContactNumber, + tb.baseContactPerson2, + tb.baseContactNumber2, + tb.baseContactPerson3, + tb.baseContactNumber3, + tb.maxSignUpNumber, + (select count(distinct enroll.loginName) + from the_rapy_recuperation_enroll enroll + where enroll.takePartInBaseManagementId = tb.id + and enroll.isNormal = true + and enroll.stateId not in ($auditFailStates)) as signUpUserNum, + tb.files AS fileId, gh.name createUnionName, u.username createUserName, ta.travelAgencyName, @@ -121,20 +134,26 @@ public class RecuperationBaseManagerController { ta.contactMobileNumber, ta.officialWebsite FROM - `recuperation_base_management` tb - LEFT JOIN recuperation_travel_agency ta ON ta.id = tb.travelAgencyId + `the_rapy_recuperation_base_management` tb + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = tb.travelAgencyId LEFT JOIN sys_union gh ON gh.id = tb.createUnionid - LEFT JOIN sys_user u ON u.id = tb.createdBy + LEFT JOIN sys_user u ON u.id = tb.opBy $condition """); cnd.where().andEX("tb.`year`", "=", year); cnd.where().andEX("tb.lotId", "=", lotId); + cnd.and(Cnd.likeEX("tb.days", days)); cnd.and(Cnd.likeEX("tb.baseName", baseName)); cnd.and(Cnd.likeEX("tb.travelAgencyId", travelAgencyId)); cnd.and(Cnd.likeEX("tb.regionalNature", regionalNature)); cnd.desc("tb.`year`"); cnd.asc("tb.sortNumber"); cnd.asc("tb.id"); + sql.setVar("auditFailStates", String.join(",", Arrays.asList( + String.valueOf(RecuperationState.UNITFAIL), + String.valueOf(RecuperationState.LINEUNITFAIL), + String.valueOf(RecuperationState.SCHOOLFAIL) + ))); if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { cnd.and("tb.createUnionId", "=", SecurityUtil.getUnionId()); @@ -220,6 +239,45 @@ public class RecuperationBaseManagerController { return Result.success(nutMap); } + /** + * 查询定点可选日期。 + * + * @param id 定点 ID + * @param enrollId 编辑时排除的报名记录 ID + * @return Result.data 为日期范围、可用天数和已使用日期 + */ + @At("/getTimeArray") + @SaCheckLogin + public Result getTimeArray(@Param("id") String id, @Param("enrollId") String enrollId) { + if (StrUtil.isBlank(id)) { + return Result.error("参数错误"); + } + return Result.success(baseManagerService.selectBaseTimeArray(id, enrollId)); + } + + /** 校验定点报名名额,额度不足时返回具体原因。 */ + @At("/validBaseManagementQuota") + @SaCheckLogin + public Result validBaseManagementQuota(@Param("id") String id, @Param("enrollId") String enrollId) { + Map result = baseManagerService.validBaseManagementQuota(id, enrollId); + return result.containsKey(false) ? Result.error(result.get(false)) : Result.success(); + } + + /** 批量设置选中定点的报名时间。 */ + @At("/setGiveTimes") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission("recuperation.baseManagement") + public Result setGiveTimes(@Param("baseIds") String[] baseIds, @Param("base") RecuperationBaseManagement baseManagement) { + if (Lang.isEmpty(baseIds) || baseManagement == null) { + return Result.error("参数错误"); + } + if (baseManagement.getSignUpStartTime() == null || baseManagement.getSignUpEndTime() == null || baseManagement.getChangeEndTime() == null) { + return Result.error("请选择完整报名时间"); + } + baseManagerService.batchAssignSignUpTimes(baseIds, baseManagement.getSignUpStartTime(), baseManagement.getSignUpEndTime(), baseManagement.getChangeEndTime()); + return Result.success(); + } + @At @Ok("void") @SaCheckPermission("recuperation.baseManagement") diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBranchUnionAuditController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBranchUnionAuditController.java index 42401bb..1f1bb83 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBranchUnionAuditController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationBranchUnionAuditController.java @@ -14,6 +14,8 @@ import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; +import javax.servlet.http.HttpServletRequest; + /** * @ClassName RecuperationBranchUnionAuditController * @Author JyuHsin @@ -34,9 +36,11 @@ public class RecuperationBranchUnionAuditController { private RecuperationAuditService auditService; @At("") - @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/branchUnionAudit/index.html") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/audit/index.html") @SaCheckLogin - public void index() {} + public void index(HttpServletRequest request) { + request.setAttribute("stage", "branch"); + } @At @ApiOperation("分页查询") 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 index 4cee37d..d48c9b3 100644 --- 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 @@ -105,14 +105,14 @@ public class RecuperationBranchUnionUserQueryController { lineu.lineId, lineu.playStartTime, lineu.playEndTime, - ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + ( SELECT COUNT( 1 ) FROM the_rapy_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 + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId $condition """); if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { @@ -224,12 +224,12 @@ public class RecuperationBranchUnionUserQueryController { 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 + (SELECT COUNT(1) FROM the_rapy_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 + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId where enroll.id=@id """); sql.setParam("id", id); @@ -262,9 +262,9 @@ public class RecuperationBranchUnionUserQueryController { 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 + the_rapy_recuperation_enroll t1 + LEFT JOIN the_rapy_recuperation_line_union_select t2 ON t2.id = t1.takePartInLineId + LEFT JOIN the_rapy_recuperation_line t3 ON t3.id = t2.lineId LEFT JOIN sys_union t4 ON t4.id = t2.unionId $condition """); @@ -314,14 +314,14 @@ public class RecuperationBranchUnionUserQueryController { lineu.lineId, lineu.playStartTime, lineu.playEndTime, - ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + ( SELECT COUNT( 1 ) FROM the_rapy_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 + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId $condition """); // 年度 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 45e5c27..4f2290e 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 @@ -2,6 +2,7 @@ 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; @@ -68,8 +69,8 @@ public class RecuperationEvaluateStatisticsController { @Param(value = "evaluateScore") String evaluateScore) { Sql sql = Sqls.create(""" SELECT - we.evaluateText, - we.evaluateScore, + we.feedbackContent AS evaluateText, + we.evaluationForTravelAgency AS evaluateScore, we.userName, we.loginName, u.unionname as unionName, @@ -79,11 +80,10 @@ public class RecuperationEvaluateStatisticsController { 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 + the_rapy_recuperation_enroll we + LEFT JOIN `vw_user` u ON u.loginname = we.loginName + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = we.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId $condition """); Cnd cnd = Cnd.NEW(); @@ -96,17 +96,17 @@ public class RecuperationEvaluateStatisticsController { if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) { cnd.orderBy(pageForm.getPageOrderName(), "ascending".equals(pageForm.getPageOrderBy()) ? "asc" : "desc"); } else { - cnd.desc("we.evaluateScore"); + cnd.desc("we.evaluationForTravelAgency"); } if (StrUtil.isNotBlank(lineId)) { - cnd.andEX("we.lineId", "in", lineId.split(",")); + cnd.andEX("we.takePartInLineId", "in", lineId.split(",")); } cnd.andEX("u.unionid", "=", unionId); cnd.andEX("u.unitid", "=", unitId); cnd.andEX("u.personType", "=", personType); cnd.andEX("u.userState", "=", userState); - cnd.andEX("we.evaluateScore", "=", evaluateScore); - cnd.groupBy("we.lineId"); + cnd.andEX("we.evaluationForTravelAgency", "=", evaluateScore); + cnd.groupBy("we.id"); sql.setCondition(cnd); Pagination pagination = enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); return Result.success(pagination); @@ -122,8 +122,8 @@ public class RecuperationEvaluateStatisticsController { 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 + the_rapy_recuperation_line_union_select us + LEFT JOIN the_rapy_recuperation_line line ON us.lineId = line.id LEFT JOIN sys_union un ON un.id = us.unionId $condition """); @@ -135,6 +135,7 @@ public class RecuperationEvaluateStatisticsController { } @At + @Ok("void") @ApiOperation("导出评价统计") @SaCheckPermission("recuperation.statistics") public void exportEvaluate(String lineId, @@ -146,8 +147,8 @@ public class RecuperationEvaluateStatisticsController { HttpServletResponse response) { Sql sql = Sqls.create(""" SELECT - we.evaluateText, - we.evaluateScore, + we.feedbackContent AS evaluateText, + we.evaluationForTravelAgency AS evaluateScore, we.userName, we.loginName, u.unionname, @@ -157,11 +158,10 @@ public class RecuperationEvaluateStatisticsController { 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 + the_rapy_recuperation_enroll we + LEFT JOIN `vw_user` u ON u.loginname = we.loginName + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = we.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId $condition """); Cnd cnd = Cnd.NEW(); @@ -169,12 +169,12 @@ public class RecuperationEvaluateStatisticsController { cnd.and(Cnd.likeEX(searchName, searchKeyword)); } if (StrUtil.isNotBlank(lineId)) { - cnd.andEX("we.lineId", "in", lineId.split(",")); + cnd.andEX("we.takePartInLineId", "in", lineId.split(",")); } cnd.andEX("u.unionid", "=", unionId); cnd.andEX("u.unitid", "=", unitId); - cnd.andEX("we.evaluateScore", "=", evaluateScore); - cnd.groupBy("we.lineId"); + cnd.andEX("we.evaluationForTravelAgency", "=", evaluateScore); + cnd.groupBy("we.id"); sql.setCondition(cnd); List listMap = enrollService.listMap(sql); @@ -192,7 +192,9 @@ public class RecuperationEvaluateStatisticsController { entities.add(new ExcelExportEntity("评价", "evaluateText", 40)); try { - Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entities, listMap); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, listMap); CommonDownloadUtil.download("评价人员名单.xlsx", workbook, response); } catch (Exception ignored) { } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationH5Controller.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationH5Controller.java new file mode 100644 index 0000000..4a2c639 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationH5Controller.java @@ -0,0 +1,168 @@ +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.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.RecuperationType; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationConfig; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationBaseManagement; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationProvinceFlexibleGroup; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationTravelAgency; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationEnrollService; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +import java.util.Map; + +/** + * 旧版疗休养 H5 入口。页面仍使用旧业务分类和旧表,认证与权限切换为新版 Sa-Token。 + * 查询接口返回 Result.data;提交接口返回 success、code、msg,供 Vant 页面统一提示。 + */ +@IocBean +@At("/platform/h5/recuperation") +@Ok("json:full") +public class RecuperationH5Controller { + + @Inject + private RecuperationEnrollService enrollService; + + @At("") + @Ok("beetl:/platform/zhghh5/staffbenefit/recuperation/index.html") + @SaCheckLogin + public void index() { + } + + @At("/lineList") + @Ok("beetl:/platform/zhghh5/staffbenefit/recuperation/lineList.html") + @SaCheckLogin + public void lineList() { + } + + @At("/lineInfo") + @Ok("beetl:/platform/zhghh5/staffbenefit/recuperation/lineInfo.html") + @SaCheckLogin + public void lineInfo() { + } + + @At("/signForm") + @Ok("beetl:/platform/zhghh5/staffbenefit/recuperation/signForm.html") + @SaCheckLogin + public void signForm() { + } + + @At("/mine") + @Ok("beetl:/platform/zhghh5/staffbenefit/recuperation/mine.html") + @SaCheckLogin + public void mine() { + } + + /** + * @param pageForm 分页信息;year 为年度;type 为旧版疗休养类型值;lineUnionType 为本工会、公开或校工会线路分类 + * @return Result.data 为 Pagination,list 中保留旧版线路、旅行社或基地字段 + */ + @At + @SaCheckPermission("h5.recuperation.enroll") + public Result pageData(PageForm pageForm, Integer year, Integer type, Integer lineUnionType) { + int businessType = type == null ? RecuperationType.provinceInLine.getValue() : type; + return Result.success(enrollService.enrollPageData(pageForm, year, SecurityUtil.getUnionId(), businessType, lineUnionType)); + } + + @At + @SaCheckPermission("h5.recuperation.enroll") + public Result lineInfoData(String id, String unionId, Integer type) { + if (StrUtil.isBlank(id)) { + return Result.error("线路参数不能为空"); + } + if (type != null && type == RecuperationType.provinceInTravelAgency.getValue()) { + RecuperationProvinceFlexibleGroup flexibleGroup = enrollService.dao().fetch(RecuperationProvinceFlexibleGroup.class, id); + if (flexibleGroup == null) { + return Result.error("灵活组团信息不存在"); + } + enrollService.dao().fetchLinks(flexibleGroup, "travelAgency"); + return Result.success(flexibleGroup); + } + if (type != null && type == RecuperationType.provinceInHotel.getValue()) { + return Result.success(enrollService.dao().fetch(RecuperationBaseManagement.class, id)); + } + return Result.success(enrollService.selectLineAllInfo(id, StrUtil.blankToDefault(unionId, SecurityUtil.getUnionId()))); + } + + @At + @SaCheckPermission("h5.recuperation.enroll") + public Result fetchEnroll(String id) { + if (StrUtil.isBlank(id)) { + return Result.success(new RecuperationEnroll()); + } + return Result.success(enrollService.findSignUpInfoById(id)); + } + + /** + * @param enroll 报名表单,type 表示线路、旅行社或基地类型;id 非空时执行变更 + * @return Result,校验失败时 msg 为旧版额度、时间或次数限制原因 + */ + @At + @SaCheckPermission("h5.recuperation.enroll") + @Aop(TransAop.READ_COMMITTED) + public Result submit(RecuperationEnroll enroll, Integer type) { + if (enroll == null || type == null) { + return Result.error("报名参数不完整"); + } + boolean edit = StrUtil.isNotBlank(enroll.getId()); + // 三类报名统一先校验对应线路、旅行社或基地的年度名额,避免前端可选但提交时报数据库错误。 + Map quotaValid = enrollService.validSubmitQuota(enroll); + if (quotaValid.containsKey(false)) { + return Result.error(quotaValid.get(false)); + } + if (type == RecuperationType.provinceInLine.getValue() || type == RecuperationType.provinceOutLine.getValue()) { + Map valid = enrollService.validSignUpInfo(SecurityUtil.getUserLoginname(), enroll); + if (valid.containsKey(false)) { + return Result.error(valid.get(false)); + } + if (edit) enrollService.updateSignUpLine(enroll); else enrollService.doSignUpForLine(enroll); + } else if (type == RecuperationType.provinceInTravelAgency.getValue()) { + if (edit) enrollService.updateSignUpTravelAgency(enroll); else enrollService.doSignUpForTravelAgency(enroll); + } else if (type == RecuperationType.provinceInHotel.getValue()) { + if (edit) enrollService.updateSignUpHotel(enroll); else enrollService.doSignUpForHotel(enroll); + } else { + return Result.error("不支持的疗休养类型"); + } + return Result.success(); + } + + /** 我的报名分页;type 为旧版业务类型,year 为空时使用当前年度。 */ + @At + @SaCheckPermission("h5.recuperation.mine") + public Result minePageData(PageForm pageForm, Integer type, Integer year) { + int businessType = type == null ? RecuperationType.provinceInLine.getValue() : type; + Cnd cnd = Cnd.where("e.loginName", "=", SecurityUtil.getUserLoginname()); + return Result.success(enrollService.mySignUpPageData(pageForm, cnd, businessType, year == null ? DateUtil.thisYear() : year)); + } + + @At("/delete/?") + @SaCheckPermission("h5.recuperation.mine") + @Aop(TransAop.READ_COMMITTED) + public Result delete(String id) { + RecuperationEnroll enroll = enrollService.fetch(id); + if (enroll == null || !SecurityUtil.getUserLoginname().equals(enroll.getLoginName())) { + return Result.error("报名记录不存在或无权删除"); + } + enrollService.deleteMyEnrollInfoById(id); + return Result.success(); + } + + @At + @SaCheckLogin + public Result config() { + return Result.success(enrollService.dao().fetch(RecuperationConfig.class)); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationJoinUserImportController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationJoinUserImportController.java new file mode 100644 index 0000000..8014868 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationJoinUserImportController.java @@ -0,0 +1,83 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.result.Result; +import com.budwk.app.base.utils.CommonDownloadUtil; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationEnrollJoinUserImportService; +import org.apache.poi.ss.usermodel.Workbook; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.AdaptBy; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; +import org.nutz.mvc.upload.TempFile; +import org.nutz.mvc.upload.UploadAdaptor; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** 旧版实际参加人员导入,Excel 解析后由 Service 匹配并事务更新旧报名表。 */ +@IocBean +@At("/platform/recuperation/joinUserImport") +@Ok("json:full") +public class RecuperationJoinUserImportController { + @Inject + private RecuperationEnrollJoinUserImportService importService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/joinUserImport/index.html") + @SaCheckLogin + public void index() {} + + @At + @SaCheckPermission("recuperation.joinUserImport") + public Result options(Integer year, String keyword) { return Result.success(importService.selectLineAndTravelAgencyList(year, keyword)); } + + /** file 为 xls/xlsx,lineId 与 travelAgencyId 二选一;data 返回 excelRows 和匹配到的 matchList。 */ + @At + @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) + @SaCheckPermission("recuperation.joinUserImport") + public Result readExcel(@Param("file") TempFile tempFile, String lineId, String travelAgencyId) { + try { + if (tempFile == null || !List.of("XLS", "XLSX").contains(FileUtil.extName(tempFile.getFile()).toUpperCase())) return Result.error("请上传 Excel 文件"); + if (StrUtil.isAllBlank(lineId, travelAgencyId)) return Result.error("请选择线路或旅行社"); + List rows = ExcelImportUtil.importExcel(tempFile.getFile(), RecuperationEnroll.class, new ImportParams()); + return Result.success(Map.of("excelRows", rows, "matchList", importService.matchEnrolls(rows, lineId, travelAgencyId))); + } catch (Exception e) { + return Result.error(e.getMessage()); + } + } + + /** enrolls 为已确认匹配的报名记录数组;返回 success=true 表示实际参加状态和日期已更新。 */ + @At + @SaCheckPermission("recuperation.joinUserImport") + public Result doImport(@Param("enrolls") RecuperationEnroll[] enrolls) { + importService.markParticipated(enrolls == null ? List.of() : List.of(enrolls)); + return Result.success(); + } + + @At + @Ok("void") + @SaCheckPermission("recuperation.joinUserImport") + public void downloadTemplate(HttpServletResponse response) { + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + List examples = new ArrayList<>(); + examples.add(new RecuperationEnroll().setLoginName("2000").setUserName("张三").setTakePartInTime(new Date())); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, RecuperationEnroll.class, examples); + CommonDownloadUtil.download("参加人员.xlsx", workbook, response); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineAdjustmentController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineAdjustmentController.java new file mode 100644 index 0000000..311ba6f --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineAdjustmentController.java @@ -0,0 +1,60 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineAdjustmentService; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** 旧版报名人员调整接口。 */ +@IocBean +@At("/platform/recuperation/lineAdjustment") +@Ok("json:full") +public class RecuperationLineAdjustmentController { + + @Inject + private RecuperationLineAdjustmentService adjustmentService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/lineAdjustment/index.html") + @SaCheckLogin + public void index() { + } + + /** 接收年度、线路、工会、关键字、区域和标段条件,data 返回旧业务口径分页结果。 */ + @At + @SaCheckPermission("recuperation.lineAdjustment") + public Result pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords, + String regionalNature, String lotId) { + return Result.success(adjustmentService.pageData(pageForm, year, lineId, unionId, keywords, regionalNature, lotId)); + } + + @At + @SaCheckLogin + public Result findLineOptions(Integer year) { + return Result.success(adjustmentService.findLineOptions(year)); + } + + @At + @SaCheckPermission("recuperation.lineAdjustment") + public Result findUsers(String lineId, String unionId) { + return Result.success(adjustmentService.findUnionSignUpModeUserList(lineId, unionId)); + } + + /** lineId 为线路选择记录,loginNames 为需调入或调出的登录名数组;返回统一 Result。 */ + @At + @SaCheckPermission("recuperation.lineAdjustment") + public Result adjustmentUsers(String lineId, @Param("loginNames") String[] loginNames) { + if (StrUtil.isBlank(lineId) || loginNames == null || loginNames.length == 0) { + return Result.error("请选择需要调整的人员"); + } + adjustmentService.adjustmentUsers(lineId, loginNames); + return Result.success(); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineClusterController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineClusterController.java new file mode 100644 index 0000000..a256a6a --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineClusterController.java @@ -0,0 +1,58 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationCluster; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineClusterService; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.List; + +/** 旧版线路组团接口,业务写入统一由 Service 的事务方法完成。 */ +@IocBean +@At("/platform/recuperation/lineCluster") +@Ok("json:full") +public class RecuperationLineClusterController { + + @Inject + private RecuperationLineClusterService lineClusterService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/lineCluster/index.html") + @SaCheckLogin + public void index() { + } + + /** pageForm 为分页信息,其余参数分别为年度、工会和线路关键字;data 返回 Pagination。 */ + @At + @SaCheckPermission("recuperation.lineCluster") + public Result pageData(PageForm pageForm, Integer year, String unionId, String keywords) { + return Result.success(lineClusterService.pageData(pageForm, year, unionId, keywords)); + } + + @At + @SaCheckPermission("recuperation.lineCluster") + public Result findClusterInfo(String lineId, String usUnionId) { + return Result.success(lineClusterService.findClusterInfo(lineId, usUnionId)); + } + + /** clusters 为组团及 members 的 JSON 数组,lineId 为线路选择记录;返回统一 Result。 */ + @At + @SaCheckPermission("recuperation.lineCluster") + public Result setClusterMembers(@Param("clusters") String clusters, String lineId) { + if (StrUtil.isBlank(lineId) || StrUtil.isBlank(clusters)) { + return Result.error("组团信息不能为空"); + } + List clusterList = Json.fromJsonAsList(RecuperationCluster.class, clusters); + lineClusterService.setClusterMembers(clusterList, lineId); + return Result.success(); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineController.java index f84fa76..07a8666 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationLineController.java @@ -23,9 +23,11 @@ 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.mode.BaseManagerExcelMode; import com.budwk.app.zhgh.staffbenefit.recuperation.mode.LineExcelMode; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLine; 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.RecuperationEnrollService; import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -70,6 +72,8 @@ public class RecuperationLineController { private Dao dao; @Inject private RecuperationLineService lineService; + @Inject + private RecuperationEnrollService enrollService; @At("") @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/line/index.html") @@ -170,6 +174,38 @@ public class RecuperationLineController { return Result.success(line); } + /** + * 校验线路名额。 + * + * @param id 分工会线路选择记录 ID + * @param enrollId 编辑时排除的报名记录 ID,新增时可为空 + * @return 额度可用时返回成功,否则返回具体失败原因 + */ + @At("/validLineQuota") + @SaCheckLogin + public Result validLineQuota(@Param("id") String id, @Param("enrollId") String enrollId) { + Map result = lineService.validLineQuota(id, enrollId); + return result.containsKey(false) ? Result.error(result.get(false)) : Result.success(); + } + + /** + * 编辑报名时校验线路。enroll 为报名 JSON,loginName 为空时按当前登录人校验;返回 Result。 + */ + @At("/enroll/validSignUpInfo") + @SaCheckLogin + public Result validSignUpInfo(@Param("enroll") RecuperationEnroll enroll) { + if (enroll == null || StrUtil.isBlank(enroll.getTakePartInLineId())) { + return Result.error("线路信息不能为空"); + } + String loginName = StrUtil.blankToDefault(enroll.getLoginName(), SecurityUtil.getUserLoginname()); + Map quotaResult = enrollService.validSubmitQuota(enroll); + if (quotaResult.containsKey(false)) { + return Result.error(quotaResult.get(false)); + } + Map result = enrollService.validSignUpInfo(loginName, enroll); + return result.containsKey(false) ? Result.error(result.get(false)) : Result.success(); + } + @At @ApiOperation("根据分工会选择的线路id查询所该线路报名的人") @SaCheckPermission("recuperation.line") 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 index 99078f8..1e4f113 100644 --- 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 @@ -100,11 +100,11 @@ public class RecuperationLineSelectController { 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 + select lineId from the_rapy_recuperation_line_union_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 + select lineId from the_rapy_recuperation_line_union_select where year(selectTime) = %s """, year == null ? DateUtil.thisYear() : year); } @@ -303,7 +303,7 @@ public class RecuperationLineSelectController { @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 sql = Sqls.create("select lotId from the_rapy_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); diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationProvinceFlexibleGroupController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationProvinceFlexibleGroupController.java new file mode 100644 index 0000000..049e34e --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationProvinceFlexibleGroupController.java @@ -0,0 +1,111 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.controller; + +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.zhgh.staffbenefit.recuperation.model.RecuperationProvinceFlexibleGroup; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationProvinceFlexibleGroupService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * 旧版省内灵活组团入口。接口接收年度、组团名称、工会及旅行社筛选条件, + * 返回新版统一 Result,其中 data 为分页数据、详情或校验结果。 + */ +@IocBean +@At("/platform/recuperation/provinceFlexibleGroup") +@Ok("json:full") +@Api("疗休养省内灵活组团") +public class RecuperationProvinceFlexibleGroupController { + + @Inject + private RecuperationProvinceFlexibleGroupService flexibleGroupService; + + @At("") + @Ok("beetl:/platform/zhgh/staffbenefit/recuperation/provinceFlexibleGroup/index.html") + @SaCheckLogin + public void index() { + } + + /** + * @param pageForm 分页参数;year 为年度,days 为旧页面兼容参数,groupName 为名称,unionId 为工会,travelAgencyId 为旅行社 + * @return Result.data 为 Pagination,包含 list、pageNumber、pageSize、totalCount + */ + @At + @ApiOperation("分页查询省内灵活组团") + @SaCheckPermission("recuperation.provinceFlexibleGroup") + public Result pageData(PageForm pageForm, Integer year, String days, String groupName, String unionId, String travelAgencyId) { + Pagination page = flexibleGroupService.pageData(pageForm, year, days, groupName, unionId, travelAgencyId); + return Result.success(page); + } + + @At("/fetch/?") + @SaCheckPermission("recuperation.provinceFlexibleGroup") + public Result fetch(String id) { + return Result.success(flexibleGroupService.selectFlexibleGroupById(id)); + } + + /** 保存新增或编辑数据;返回 Result,success=true 表示旧表写入成功。 */ + @At + @SaCheckPermission("recuperation.provinceFlexibleGroup") + public Result onSubmit(RecuperationProvinceFlexibleGroup flexibleGroup) { + if (flexibleGroup == null) { + return Result.error("组团信息不能为空"); + } + flexibleGroupService.submitFlexibleGroup(flexibleGroup); + return Result.success(); + } + + @At("/toggle/?") + @SaCheckPermission("recuperation.provinceFlexibleGroup") + public Result toggle(String id) { + if (StrUtil.isBlank(id)) { + return Result.error("参数错误"); + } + flexibleGroupService.openClosedFlexibleGroup(id); + return Result.success(); + } + + @At("/delete/?") + @SaCheckPermission("recuperation.provinceFlexibleGroup") + public Result delete(String id) { + if (StrUtil.isBlank(id)) { + return Result.error("参数错误"); + } + flexibleGroupService.deleteFlexibleGroup(id); + return Result.success(); + } + + @At + @SaCheckPermission("recuperation.provinceFlexibleGroup") + public Result batchAssignSignUpTimes(@Param("ids") String[] ids, RecuperationProvinceFlexibleGroup form) { + flexibleGroupService.batchAssignSignUpTimes(ids, form.getSignUpStartTime(), form.getSignUpEndTime(), form.getChangeEndTime()); + return Result.success(); + } + + @At + @SaCheckLogin + public Result getTimeArray(String id, String enrollId) { + return Result.success(flexibleGroupService.selectFlexibleGroupTimeArray(id, enrollId)); + } + + @At + @SaCheckLogin + public Result validFlexibleGroupQuota(String id, String enrollId) { + return Result.success(flexibleGroupService.validFlexibleGroupQuota(id, enrollId)); + } + + @At + @SaCheckLogin + public Result selectFlexibleTravelAgency(Integer year) { + return Result.success(flexibleGroupService.selectFlexibleTravelAgency(year)); + } +} 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 index 4cf28bc..015ae56 100644 --- 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 @@ -111,14 +111,14 @@ public class RecuperationSchoolUnionUserQueryController { lineu.lineId, lineu.playStartTime, lineu.playEndTime, - ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + ( SELECT COUNT( 1 ) FROM the_rapy_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 + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId $condition """); if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { @@ -232,12 +232,12 @@ public class RecuperationSchoolUnionUserQueryController { 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 + (SELECT COUNT(1) FROM the_rapy_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 + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId where enroll.id=@id """); sql.setParam("id", id); @@ -271,9 +271,9 @@ public class RecuperationSchoolUnionUserQueryController { 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 + the_rapy_recuperation_enroll t1 + LEFT JOIN the_rapy_recuperation_line_union_select t2 ON t2.id = t1.takePartInLineId + LEFT JOIN the_rapy_recuperation_line t3 ON t3.id = t2.lineId LEFT JOIN sys_union t4 ON t4.id = t2.unionId $condition """); @@ -315,9 +315,9 @@ public class RecuperationSchoolUnionUserQueryController { if(rlus.signUpMode=1,'分工会','校工会') AS signUpMode, lot.lotName FROM - `recuperation_line_select` rlus - LEFT JOIN `recuperation_line` rl ON rlus.lineId = rl.id - LEFT JOIN `recuperation_lot` lot ON rl.lotId = lot.id + `the_rapy_recuperation_line_union_select` rlus + LEFT JOIN `the_rapy_recuperation_line` rl ON rlus.lineId = rl.id + LEFT JOIN `the_rapy_recuperation_lot` lot ON rl.lotId = lot.id $condition """); Cnd cnd = Cnd.NEW(); @@ -355,14 +355,14 @@ public class RecuperationSchoolUnionUserQueryController { lineu.lineId, lineu.playStartTime, lineu.playEndTime, - ( SELECT COUNT( 1 ) FROM recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + ( SELECT COUNT( 1 ) FROM the_rapy_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 + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId $condition """); cnd.and("enroll.takePartInLineId", "is not", null); @@ -470,7 +470,7 @@ public class RecuperationSchoolUnionUserQueryController { """); Cnd cnd = Cnd.NEW(); cnd.and("u.id", "in", activityBasicScopeService.buildGroupUserIdSubSql(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.and(new Static(" u.loginname not in (select loginName from the_rapy_recuperation_enroll where year(signingUptime) = '%s' and isNormal = true)".formatted(DateUtil.thisYear()))); cnd.asc("unitcode"); sql.setCondition(cnd); List listMap = enrollService.listMap(sql); diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationTravelAgencyController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationTravelAgencyController.java index 993b22f..a5a113b 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationTravelAgencyController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/controller/RecuperationTravelAgencyController.java @@ -81,6 +81,11 @@ public class RecuperationTravelAgencyController { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { SqlExpressionGroup seg = new SqlExpressionGroup(); seg.orLike("contact", pageForm.getSearchKeyword()); + seg.orLike("contact2", pageForm.getSearchKeyword()); + seg.orLike("contact3", pageForm.getSearchKeyword()); + seg.orLike("contactMobileNumber", pageForm.getSearchKeyword()); + seg.orLike("contactMobileNumber2", pageForm.getSearchKeyword()); + seg.orLike("contactMobileNumber3", pageForm.getSearchKeyword()); seg.orLike("travelAgencyName", pageForm.getSearchKeyword()); seg.orLike("serialNumber", pageForm.getSearchKeyword()); cnd.and(seg); @@ -88,7 +93,7 @@ public class RecuperationTravelAgencyController { if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); } else { - cnd.asc("serialNumber"); + cnd.asc("serialNumber * 1"); } Pagination pagination = travelAgencyService.pageData(pageForm, cnd); return Result.success(pagination); @@ -153,10 +158,14 @@ public class RecuperationTravelAgencyController { @At @ApiOperation("年度区间查询旅行社") @SaCheckPermission("recuperation") - public Result selectTravelAgencyByYears(Integer startYear, Integer endYear) { + public Result selectTravelAgencyByYears(Integer startYear, Integer endYear, Integer year) { Cnd cnd = Cnd.NEW(); - cnd.andEX("year", ">=", startYear); - cnd.andEX("year", "<=", endYear); + if (startYear != null && endYear != null) { + cnd.and("year", ">=", startYear); + cnd.and("year", "<=", endYear); + } else { + cnd.andEX("year", "=", year); + } List list = travelAgencyService.selectAllTravelAgencyByYear(cnd); return Result.success(list); } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationBaseManagement.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationBaseManagement.java index 0750be5..05c9a9d 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationBaseManagement.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationBaseManagement.java @@ -1,22 +1,27 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; import cn.afterturn.easypoi.excel.annotation.Excel; -import cn.hutool.json.JSONObject; -import com.budwk.app.base.model.BaseModel; +import com.budwk.app.sys.models.Sys_file; import lombok.Data; -import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; import java.util.Date; import java.util.List; +/** + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationBaseManagement + * @Description: TODO + * @Author zzr + * @Date 2023/6/5 + * @Version V1.0 + **/ + @Data -@EqualsAndHashCode(callSuper = true) -@Table("recuperation_base_management") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养基地") -public class RecuperationBaseManagement extends BaseModel { +@Table("the_rapy_recuperation_base_management") +@Accessors(chain = true) +public class RecuperationBaseManagement { @Name @Comment("id") @@ -59,12 +64,22 @@ public class RecuperationBaseManagement extends BaseModel { @Excel(name = "时间标段") private String lotId; + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("可选出行天数") + private String days; + @Column @ColDefine(customType = "text") @Comment("疗休养详情") @Excel(name = "详细信息") private String content; + @Column + @ColDefine(customType = "longtext") + @Comment("方案列表") + private String schemeList; + @Column @ColDefine(type = ColType.BOOLEAN) @Comment("是否禁用") @@ -115,7 +130,7 @@ public class RecuperationBaseManagement extends BaseModel { @Column @ColDefine(type = ColType.VARCHAR, width = 100) @Comment("缩略图") - private String file; + private String files; @Column @ColDefine(type = ColType.INT) @@ -123,18 +138,60 @@ public class RecuperationBaseManagement extends BaseModel { @Excel(name = "组织形式(分工会/校工会)") private int createMode; + @Column @ColDefine(type = ColType.VARCHAR, width = 50) @Comment("基地联系人") @Excel(name = "目的地联系人") private String baseContactPerson; + @Column @ColDefine(type = ColType.VARCHAR, width = 50) @Comment("基地联系人电话") @Excel(name = "联系电话") private String baseContactNumber; + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("基地联系人2") + @Excel(name = "目的地联系人2") + private String baseContactPerson2; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("基地联系人电话2") + @Excel(name = "联系电话2") + private String baseContactNumber2; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("基地联系人3") + @Excel(name = "目的地联系人3") + private String baseContactPerson3; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("基地联系人电话3") + @Excel(name = "联系电话3") + private String baseContactNumber3; + + @Column + @ColDefine(type = ColType.INT) + @Comment("最大报名数") + private Integer maxSignUpNumber; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("操作人") + private String opBy; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("操作时间") + private String opAt; + + @One(field = "travelAgencyId") private RecuperationTravelAgency travelAgency; } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationCluster.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationCluster.java new file mode 100644 index 0000000..7142c5a --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationCluster.java @@ -0,0 +1,40 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.model; + +import lombok.Data; +import lombok.experimental.Accessors; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.util.List; + +/** + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationCluster + * @Description: TODO + * @Author zxc + * @Date 2022/6/17:09:30 + * @Version V1.0 + **/ +@Data +@Table("the_rapy_recuperation_cluster") +@Accessors(chain = true) +public class RecuperationCluster { + + @Name + @Comment("id") + @PrevInsert(uu32 = true) + private String id; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("线路id") + private String lineId; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("团名") + private String clusterName; + + @Many(field = "clusterId") + private List members; + +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationClusterMember.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationClusterMember.java new file mode 100644 index 0000000..9c0a892 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationClusterMember.java @@ -0,0 +1,60 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.model; + +import lombok.Data; +import lombok.experimental.Accessors; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +/** + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationClusterMember + * @Description: TODO + * @Author zxc + * @Date 2022/6/17:09:30 + * @Version V1.0 + **/ +@Data +@Table("the_rapy_recuperation_cluster_member") +@Accessors(chain = true) +public class RecuperationClusterMember { + + @Name + @Comment("id") + @PrevInsert(uu32 = true) + private String id; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("线路id") + private String lineId; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("团Id") + private String clusterId; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 20) + @Comment("工号") + private String loginName; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 20) + @Comment("姓名") + private String userName; + + @Column + @ColDefine(type = ColType.CHAR, width = 1) + @Comment("性别") + private String sex; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("工会") + private String unionName; + + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("是否领队") + private Boolean isLeader; + +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationConfig.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationConfig.java index cea0876..0111bf5 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationConfig.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationConfig.java @@ -1,21 +1,19 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; -import com.budwk.app.base.model.BaseModel; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; import org.nutz.lang.util.NutMap; +import java.util.Date; import java.util.List; @Data -@EqualsAndHashCode(callSuper = true) -@Table("recuperation_config") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养配置") -public class RecuperationConfig extends BaseModel { +@Table("the_rapy_recuperation_config") +@Accessors(chain = true) +public class RecuperationConfig { + @Name @Comment("id") @@ -32,11 +30,26 @@ public class RecuperationConfig extends BaseModel { @Comment("参加人员范围") private Integer activityGroupId; + @Column + @ColDefine(customType = "longtext") + @Comment("提醒") + private String remindContent; + + @Column + @ColDefine(type = ColType.INT, width = 32) + @Comment("提醒可见人员范围") + private Integer remindVisibleGroupId; + @Column @ColDefine(type = ColType.INT) - @Comment("省外名额分配") + @Comment("最少成团人数(含家属)") private Integer outsideQuota; + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("省外名额分配") + private String outsideQuotaMode; + @Column @ColDefine(type = ColType.FLOAT, width = 3, precision = 2) @Comment("省外名额分配比例") @@ -67,21 +80,45 @@ public class RecuperationConfig extends BaseModel { @Comment("可以修改几次") private Integer modifyNumber; + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("报名开始时间") + private Date signUpStartTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("报名结束时间") + private Date signUpEndTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("变更截至时间") + private Date changeEndTime; + @Column @ColDefine(type = ColType.BOOLEAN) @Comment("省内线路是否审核") + @Default(value = "0") private Boolean isSnLine; @Column @ColDefine(type = ColType.BOOLEAN) @Comment("省外线路是否审核") + @Default(value = "0") private Boolean isSwLine; + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("旅行社是否审核") + @Default(value = "0") + private Boolean travelAudit; + @Column @ColDefine(type = ColType.MYSQL_JSON) @Comment("标段") private List modifyBd; + @Many(field = "configId") private List lots; @@ -97,16 +134,23 @@ public class RecuperationConfig extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("省内起始年份") + @Comment("省外起始年份") private Integer provinceStartYear; @Column @ColDefine(type = ColType.BOOLEAN) @Comment("床位信息") + @Default(value = "0") private Boolean bedInfo; @Column @ColDefine(type = ColType.INT) @Comment("家属信息") + @Default(value = "0") private Integer familyInfo; + + @Column + @Comment("分工会人数限制") + @ColDefine(type = ColType.MYSQL_JSON) + private List unionLimit; } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnroll.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnroll.java index 25e0f3d..52123df 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnroll.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnroll.java @@ -12,17 +12,16 @@ import java.util.Date; import java.util.List; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnroll + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationEnroll * @Description: 疗休养报名登记表 * @Author zxc * @Date 2022/5/31:16:58 * @Version V1.0 **/ -@Data @EqualsAndHashCode(callSuper = true) -@Table("recuperation_enroll") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养报名登记表") +@Data +@Table("the_rapy_recuperation_enroll") +@Accessors(chain = true) public class RecuperationEnroll extends BaseModel { @Name @@ -87,6 +86,26 @@ public class RecuperationEnroll extends BaseModel { @Comment("参加酒店") private String takePartInBaseManagementId; + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("灵活组团团长用户id") + private String groupLeaderUserId; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("灵活组团团长工号") + private String groupLeaderLoginName; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("灵活组团团长姓名") + private String groupLeaderUserName; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 10) + @Comment("灵活组团团长口令") + private String groupLeaderPassword; + @Column @ColDefine(type = ColType.DATETIME) @Comment("报名时间") @@ -158,10 +177,6 @@ public class RecuperationEnroll extends BaseModel { private String lineId; - private Date playStartTime; - - private Date playEndTime; - /** * 床位信息 */ @@ -184,8 +199,23 @@ public class RecuperationEnroll extends BaseModel { private String evaluationForJourney; @Column - @ColDefine(type = ColType.VARCHAR, width = 100) - @Comment("反馈内容") + @ColDefine(type = ColType.VARCHAR) + @Comment("对住宿的评价(几星)") + private String evaluationForAccommodation; + + @Column + @ColDefine(type = ColType.VARCHAR) + @Comment("对餐饮的评价(几星)") + private String evaluationForDining; + + @Column + @ColDefine(type = ColType.VARCHAR) + @Comment("对交通的评价(几星)") + private String evaluationForTransportation; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 500) + @Comment("评价建议(优化亮点、优化改进、后续期待)") private String feedbackContent; @Column @@ -203,4 +233,20 @@ public class RecuperationEnroll extends BaseModel { @Comment("家属数量") private Integer familyNumber; + @Column + @ColDefine(type = ColType.VARCHAR, width = 200) + @Comment("特殊身体情况备注") + private String remark; + + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("是否报销") + private Boolean isReimbursement; + + /** + * 灵活组团同团队员信息,仅用于手机端修改和查看回显,不落库。 + */ + private List signUserList; + + private String firstLetter; } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollBed.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollBed.java index 58c2f38..88974a3 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollBed.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollBed.java @@ -3,21 +3,21 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; import com.budwk.app.base.model.BaseModel; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollBed + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationEnrollBed * @Description: 报名拼床信息 * @Author zxc * @Date 2022/6/2:14:44 * @Version V1.0 **/ -@Data @EqualsAndHashCode(callSuper = true) -@Table("recuperation_enroll_bed") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养报名床位表") +@Data +@Table("the_rapy_recuperation_enroll_bed") +@Accessors(chain = true) public class RecuperationEnrollBed extends BaseModel { @Name 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 index 1488bc1..8764e56 100644 --- 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 @@ -1,36 +1,37 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; import lombok.Data; -import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; 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 - */ + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationEnrollChangeRecord + * @Description: 疗休养登记变更记录表 + * @Author zxc + * @Date 2022/5/31:17:10 + * @Version V1.0 + **/ @Data -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养登记变更记录表") +@Table("the_rapy_recuperation_enroll_change_record") +@Accessors(chain = true) public class RecuperationEnrollChangeRecord { - @Name - @Comment("id") - @PrevInsert(uu32 = true) - private String id; + @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.VARCHAR, width = 32) + @Comment("变更记录id") + private String enrollId; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("变更时间") + private Date changeTime; - @Column - @ColDefine(type = ColType.DATETIME) - @Comment("变更时间") - private Date changeTime; } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollCompanion.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollCompanion.java index f711d49..190a5ed 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollCompanion.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEnrollCompanion.java @@ -3,21 +3,21 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; import com.budwk.app.base.model.BaseModel; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; /** - * @FileName io.v.nutz.therapyRecuperation.model.TheRapyRecuperationEnrollFamily + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationEnrollFamily * @Description: TODO * @Author zxc * @Date 2022/5/31:17:07 * @Version V1.0 **/ -@Data @EqualsAndHashCode(callSuper = true) -@Table("recuperation_enroll_companion") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养报名床位表") +@Data +@Table("the_rapy_recuperation_enroll_companion") +@Accessors(chain = true) public class RecuperationEnrollCompanion extends BaseModel { @Name @@ -70,6 +70,11 @@ public class RecuperationEnrollCompanion extends BaseModel { @Comment("床位信息id") private String bedInfoId; + @Column + @ColDefine(type = ColType.VARCHAR, width = 200) + @Comment("特殊身体情况备注") + private String remark; + /** * 床位信息 */ 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 deleted file mode 100644 index b9d8b13..0000000 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationEvaluate.java +++ /dev/null @@ -1,61 +0,0 @@ -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/RecuperationLine.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLine.java index 8dfb917..c8029af 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLine.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLine.java @@ -1,20 +1,25 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; -import cn.hutool.json.JSONObject; import com.budwk.app.base.model.BaseModel; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; import java.util.Date; -import java.util.List; -@Data +/** + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationLine + * @Description: 疗休养线路管理 + * @Author zxc + * @Date 2022/5/31:09:13 + * @Version V1.0 + **/ @EqualsAndHashCode(callSuper = true) -@Table("recuperation_line") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养线路") +@Data +@Table("the_rapy_recuperation_line") +@Accessors(chain = true) public class RecuperationLine extends BaseModel { @Name @@ -23,9 +28,9 @@ public class RecuperationLine extends BaseModel { private String id; @Column - @ColDefine(type = ColType.VARCHAR, width = 50) + @ColDefine(type = ColType.INT) @Comment("编号") - private String serialNumber; + private Integer serialNumber; @Column @ColDefine(type = ColType.VARCHAR, width = 50) @@ -42,6 +47,11 @@ public class RecuperationLine extends BaseModel { @Comment("区域性质") private String regionalNature; + @Column + @ColDefine(type = ColType.INT) + @Comment("游玩天数") + private Integer playNumberOfDays; + @Column @ColDefine(customType = "text") @Comment("疗休养内容") @@ -49,9 +59,14 @@ public class RecuperationLine extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("最少参与教工") + @Comment("最少成团人数(含家属)") private Integer minimumGroupSize; + @Column + @ColDefine(type = ColType.INT) + @Comment("最大报名数") + private Integer maxSignUpNumber; + @Column @ColDefine(type = ColType.INT) @Comment("年度") @@ -67,6 +82,31 @@ public class RecuperationLine extends BaseModel { @Comment("哪个分工会创建的") private String createUnionId; + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("报名开始时间") + private Date signUpStartTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("报名截至时间") + private Date signUpEndTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("变更截至时间") + private Date changeEndTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("游玩开始时间") + private Date playStartTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("游玩结束时间") + private Date playEndTime; + @Column @ColDefine(type = ColType.VARCHAR, width = 50) @Comment("交通工具") @@ -79,13 +119,13 @@ public class RecuperationLine extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("成团人数包括家属") + @Comment("最少成团人数(含家属)") private Integer estimatedFamilyNumbers; @Column - @ColDefine(type = ColType.VARCHAR, width = 50) + @ColDefine(type = ColType.VARCHAR, width = 30) @Comment("缩略图") - private String file; + private String files; @Column @ColDefine(type = ColType.INT) @@ -112,6 +152,26 @@ public class RecuperationLine extends BaseModel { @Comment("联系电话") private String lineContactPhone; + @Column + @ColDefine(type = ColType.VARCHAR) + @Comment("联系人2") + private String lineContact2; + + @Column + @ColDefine(type = ColType.VARCHAR) + @Comment("联系电话2") + private String lineContactPhone2; + + @Column + @ColDefine(type = ColType.VARCHAR) + @Comment("联系人3") + private String lineContact3; + + @Column + @ColDefine(type = ColType.VARCHAR) + @Comment("联系电话3") + private String lineContactPhone3; + @One(field = "travelAgencyId") private RecuperationTravelAgency travelAgency; diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineSelect.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineSelect.java index 367f70c..4affc2b 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineSelect.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLineSelect.java @@ -3,6 +3,7 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; import com.budwk.app.base.model.BaseModel; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; @@ -15,11 +16,10 @@ import java.util.Date; * @author jug * @date 2023/06/26 */ -@Data @EqualsAndHashCode(callSuper = true) -@Table("recuperation_line_select") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养线路") +@Data +@Table("the_rapy_recuperation_line_union_select") +@Accessors(chain = true) public class RecuperationLineSelect extends BaseModel { @Name @@ -47,6 +47,7 @@ public class RecuperationLineSelect extends BaseModel { @Comment("选择用户") private String selectUserId; + @Column @ColDefine(type = ColType.DATETIME) @Comment("报名开始时间") @@ -95,9 +96,10 @@ public class RecuperationLineSelect extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("最少参与教工") + @Comment("最少成团人数(含家属)") private Integer minimumGroupSize; + @Column @ColDefine(type = ColType.VARCHAR, width = 50) @Comment("交通工具") @@ -110,7 +112,7 @@ public class RecuperationLineSelect extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("成团人数包括家属") + @Comment("最少成团人数(含家属)") private Integer estimatedFamilyNumbers; @Column @@ -123,4 +125,8 @@ public class RecuperationLineSelect extends BaseModel { @Comment("是否启用") private Boolean enable; + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("旅行社id") + private String travelAgencyId; } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLot.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLot.java index 1827175..dd95d08 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLot.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationLot.java @@ -1,18 +1,22 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; -import com.budwk.app.base.model.BaseModel; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; +/** + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationLot + * @Description: TODO + * @Author zzr + * @Date 2023/6/6 + * @Version V1.0 + **/ + +@Table("the_rapy_recuperation_lot") @Data -@EqualsAndHashCode(callSuper = true) -@Table("recuperation_lot") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养标段") -public class RecuperationLot extends BaseModel { +@Accessors(chain = true) +public class RecuperationLot { @Name @Comment("id") diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationProvinceFlexibleGroup.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationProvinceFlexibleGroup.java new file mode 100644 index 0000000..2c5db63 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationProvinceFlexibleGroup.java @@ -0,0 +1,145 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.model; + +import lombok.Data; +import lombok.experimental.Accessors; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.util.Date; + +/** + * 省内灵活组团管理 + */ +@Data +@Table("the_rapy_recuperation_province_flexible_group") +@Accessors(chain = true) +public class RecuperationProvinceFlexibleGroup { + + @Name + @Comment("id") + @PrevInsert(uu32 = true) + private String id; + + @Column + @ColDefine(type = ColType.INT) + @Comment("年度") + private Integer year; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("排序编号") + private String sortNumber; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("组团名称") + private String groupName; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("旅行社Id") + private String travelAgencyId; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("天数") + private String days; + + @Column + @ColDefine(customType = "text") + @Comment("详细信息") + private String content; + + @Column + @ColDefine(customType = "longtext") + @Comment("方案列表") + private String schemeList; + + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("是否禁用") + private Boolean isDisabled; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("创建分工会") + private String createUnionId; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("报名开始时间") + private Date signUpStartTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("报名截至时间") + private Date signUpEndTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("变更截至时间") + private Date changeEndTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("活动开始时间") + private Date activityStartTime; + + @Column + @ColDefine(type = ColType.DATETIME) + @Comment("活动结束时间") + private Date activityEndTime; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 100) + @Comment("缩略图") + private String files; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("联系人") + private String contactPerson; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("联系人电话") + private String contactNumber; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("联系人2") + private String contactPerson2; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("联系人电话2") + private String contactNumber2; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("联系人3") + private String contactPerson3; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("联系人电话3") + private String contactNumber3; + + @Column + @ColDefine(type = ColType.INT) + @Comment("最大报名数") + private Integer maxSignUpNumber; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("操作人") + private String opBy; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("操作时间") + private String opAt; + + @One(field = "travelAgencyId") + private RecuperationTravelAgency travelAgency; +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationTravelAgency.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationTravelAgency.java index 2668543..5f885d2 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationTravelAgency.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/model/RecuperationTravelAgency.java @@ -1,23 +1,26 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.model; -import cn.hutool.json.JSONObject; import com.budwk.app.base.model.BaseModel; -import com.budwk.app.sys.models.Sys_file; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; -import java.util.List; - -@Data +/** + * @FileName io.v.nutz.zhgh.therapyRecuperation.model.RecuperationTravelAgency + * @Description: 疗休养旅行社管理 + * @Author zxc + * @Date 2022/5/31:14:39 + * @Version V1.0 + **/ @EqualsAndHashCode(callSuper = true) -@Table("recuperation_travel_agency") -@TableMeta("{'mysql-charset':'utf8mb4'}") -@Comment("疗休养旅行社") +@Data +@Table("the_rapy_recuperation_travel_agency") +@Accessors(chain = true) public class RecuperationTravelAgency extends BaseModel { + @Name @Comment("id") @PrevInsert(uu32 = true) @@ -43,6 +46,26 @@ public class RecuperationTravelAgency extends BaseModel { @Comment("旅行社联系人手机") private String contactMobileNumber; + @Column + @ColDefine(type = ColType.VARCHAR, width = 20) + @Comment("旅行社联系人2") + private String contact2; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 20) + @Comment("旅行社联系人电话2") + private String contactMobileNumber2; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 20) + @Comment("旅行社联系人3") + private String contact3; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 20) + @Comment("旅行社联系人电话3") + private String contactMobileNumber3; + @Column @ColDefine(type = ColType.VARCHAR, width = 50) @Comment("旅行社邮箱") @@ -53,6 +76,11 @@ public class RecuperationTravelAgency extends BaseModel { @Comment("旅行社官网") private String officialWebsite; + @Column + @ColDefine(type = ColType.INT) + @Comment("最大报名数") + private Integer maxSignUpNumber; + @Column @ColDefine(type = ColType.VARCHAR, width = 100) @Comment("备注") @@ -71,5 +99,10 @@ public class RecuperationTravelAgency extends BaseModel { @Column @ColDefine(type = ColType.VARCHAR, width = 100) @Comment("缩略图") - private String file; + private String files; + + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("是否自由组团") + private Boolean signUpTravelAgency; } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationAuditService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationAuditService.java index bb1cf54..5c9cca8 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationAuditService.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationAuditService.java @@ -1,17 +1,51 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.service; +import com.budwk.app.base.model.Audit; +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.RecuperationEnroll; import org.nutz.lang.util.NutMap; -/** - * @ClassName RecuperationAuditService - * @Author JyuHsin - * @Date 2025/8/20 14:38 - * @Version 1.0 - * @Description TODO - */ -public interface RecuperationAuditService extends BaseService { +import java.util.List; - NutMap findOne(String id); +public interface RecuperationAuditService extends BaseService { + + + /** + * 根据分工会查询线路 + * + * @param + * @param unionId + * @param regionalNature 是否省内省外 可为空 + * @param year 可为空 + * @return + */ + List getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode); + + + /** + * + * @param id + * @return + */ + NutMap findOne(String id); + + + /** + * 校工会审核 + * @param stateId + * @param loginName + * @param adjustment + * @param takePartInLineId + */ + void schoolAudit(Integer stateId, String loginName,Boolean adjustment, String takePartInLineId); + + /** 按审核环节分页查询旧版报名记录。 */ + Pagination auditPage(PageForm pageForm, String stage, Integer year, Boolean audited, String keyword); + + /** 根据报名当前状态完成分工会、线路工会或校工会审核。 */ + void auditEnroll(String id, boolean pass, String auditOpinion); + + /** 撤回最近一次审核,将报名恢复到对应待审核状态。 */ + void recallAudit(String id); } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationBaseManagerService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationBaseManagerService.java index 896d5dc..887bac8 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationBaseManagerService.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationBaseManagerService.java @@ -4,6 +4,9 @@ import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationBaseManagement; import org.nutz.lang.util.NutMap; +import java.util.Date; +import java.util.Map; + /** * @ClassName RecuperationBaseManagerService * @Author JyuHsin @@ -14,4 +17,19 @@ import org.nutz.lang.util.NutMap; public interface RecuperationBaseManagerService extends BaseService { NutMap selectBaseAllInfo(String id); + + /** + * 查询定点活动日期。 + * + * @param id 定点 ID + * @param enrollId 编辑时排除的报名记录 ID,新增时可为空 + * @return 日历范围、可用天数和本人已使用日期 + */ + NutMap selectBaseTimeArray(String id, String enrollId); + + /** 校验定点报名名额,返回校验结果及提示信息。 */ + Map validBaseManagementQuota(String id, String enrollId); + + /** 批量设置定点报名开始、报名截止和变更截止时间。 */ + void batchAssignSignUpTimes(String[] ids, Date signUpStartTime, Date signUpEndTime, Date changeEndTime); } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationCommonService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationCommonService.java new file mode 100644 index 0000000..e492be8 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationCommonService.java @@ -0,0 +1,18 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service; + +import com.budwk.app.base.service.BaseService; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationConfig; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationType; + +public interface RecuperationCommonService extends BaseService { + + + /** + * 可以报名吗 + * + * @param loginName 用户名 + * @return boolean + */ + boolean canSignUp(String loginName, RecuperationType theRapyRecuperationType); + +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationEnrollJoinUserImportService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationEnrollJoinUserImportService.java new file mode 100644 index 0000000..1dbe80b --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationEnrollJoinUserImportService.java @@ -0,0 +1,22 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service; + +import com.budwk.app.base.service.BaseService; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import org.nutz.lang.util.NutMap; + +import java.util.List; +import java.util.Map; + +public interface RecuperationEnrollJoinUserImportService extends BaseService { + + List selectLineAndTravelAgencyList(Integer year, String keyword); + + Map> selectLineOrTravelAgency(Integer year); + + /** 将 Excel 行与指定线路或旅行社中的旧报名记录匹配。 */ + List matchEnrolls(List rows, String lineId, String travelAgencyId); + + /** 批量标记实际参加时间。 */ + void markParticipated(List enrolls); + +} 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 index fb3b0b3..fb79e2b 100644 --- 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 @@ -77,6 +77,14 @@ public interface RecuperationEnrollService extends BaseService validSignUpInfo(String loginName, RecuperationEnroll enrollInfo); + /** + * 提交前统一校验线路、灵活组团或定点名额。 + * + * @param enrollInfo 报名信息,按三种 takePartIn 字段识别报名类型 + * @return key 为校验结果,value 为对应提示 + */ + Map validSubmitQuota(RecuperationEnroll enrollInfo); + /** * 我报名的页面数据 * diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineAdjustmentService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineAdjustmentService.java new file mode 100644 index 0000000..d87d154 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineAdjustmentService.java @@ -0,0 +1,23 @@ +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.RecuperationEnroll; + +import java.util.List; + +public interface RecuperationLineAdjustmentService extends BaseService { + + + Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords, String regionalNature, String lotId); + + List findUnionSignUpModeUserList(String lineId, String unionId); + + /** 查询指定年度可进行人员调整的线路。 */ + List findLineOptions(Integer year); + + /** 切换指定线路中报名人员的正常/调出状态。 */ + void adjustmentUsers(String lineId, String[] loginNames); + +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineClusterService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineClusterService.java new file mode 100644 index 0000000..0f336f7 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineClusterService.java @@ -0,0 +1,40 @@ +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.RecuperationCluster; + +import java.util.List; + +public interface RecuperationLineClusterService extends BaseService { + + /** + * 页面数据 + * + * @param pageForm 分页参数 + * @param year 年度 + * @param unionId 工会id + * @param keywords 关键字 + * @return {@link Pagination} + */ + Pagination pageData(PageForm pageForm, Integer year, String unionId, String keywords); + + /** + * 查询组团信息 + * + * @param lineId 线路id + * @param lineId 归属工会id + * @return {@link Object} + */ + Object findClusterInfo(String lineId, String usUnionId); + + /** + * 设置组团成员 + * + * @param clusters 集群 + * @param lineId 行id + */ + void setClusterMembers(List clusters, String lineId); + +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineService.java index 41eb6a7..eb2fb30 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineService.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationLineService.java @@ -8,6 +8,7 @@ import org.nutz.dao.Cnd; import org.nutz.lang.util.NutMap; import java.util.List; +import java.util.Map; /** * @ClassName RecuperationLineService @@ -72,6 +73,15 @@ public interface RecuperationLineService extends BaseService { */ Pagination selectLineUser(PageForm pageForm, String lineId, String unionId); + /** + * 校验线路报名名额。 + * + * @param lineUnionSelectId 分工会线路选择记录 ID + * @param enrollId 编辑报名时需要排除的报名记录 ID,新增时可为空 + * @return key 为校验结果,value 为对应提示信息 + */ + Map validLineQuota(String lineUnionSelectId, String enrollId); + /** * 清除线路详细信息 * diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationProvinceFlexibleGroupService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationProvinceFlexibleGroupService.java new file mode 100644 index 0000000..a43d36b --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/RecuperationProvinceFlexibleGroupService.java @@ -0,0 +1,96 @@ +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.RecuperationProvinceFlexibleGroup; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationTravelAgency; +import org.nutz.lang.util.NutMap; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 省内灵活组团管理 + */ +public interface RecuperationProvinceFlexibleGroupService extends BaseService { + + /** + * 分页查询省内灵活组团列表。 + * + * @param pageForm 分页参数 + * @param year 年度 + * @param days 兼容旧页面参数,当前不再参与筛选 + * @param groupName 组团名称 + * @param unionId 创建工会 + * @param travelAgencyId 旅行社 + * @return 分页数据 + */ + Pagination pageData(PageForm pageForm, Integer year, String days, String groupName, String unionId, String travelAgencyId); + + /** + * 查询省内灵活组团详情,包含旅行社信息。 + * + * @param id 省内灵活组团id + * @return 省内灵活组团详情 + */ + RecuperationProvinceFlexibleGroup selectFlexibleGroupById(String id); + + /** + * 查询手机端省内灵活组团可选活动日期。 + * + * @param id 省内灵活组团id + * @param enrollId 当前编辑的报名记录id,新增报名时为空 + * @return 可选日期、已满日期和选择范围 + */ + NutMap selectFlexibleGroupTimeArray(String id, String enrollId); + + /** + * 校验手机端灵活组团介绍页点击报名时是否还有名额。 + * + * @param id 省内灵活组团id + * @param enrollId 当前编辑的报名记录id,新增报名时为空 + * @return 校验结果 + */ + Map validFlexibleGroupQuota(String id, String enrollId); + + /** + * 保存省内灵活组团信息,补齐操作人、创建工会和操作时间。 + * + * @param flexibleGroup 省内灵活组团信息 + */ + void submitFlexibleGroup(RecuperationProvinceFlexibleGroup flexibleGroup); + + /** + * 切换省内灵活组团启用状态。 + * + * @param id 省内灵活组团id + */ + void openClosedFlexibleGroup(String id); + + /** + * 删除省内灵活组团。 + * + * @param id 省内灵活组团id + */ + void deleteFlexibleGroup(String id); + + /** + * 查询允许省内灵活组团报名的旅行社。 + * + * @param year 年度 + * @return 旅行社列表 + */ + List selectFlexibleTravelAgency(Integer year); + + /** + * 批量统赋省内灵活组团报名时间。 + * + * @param ids 省内灵活组团id数组 + * @param signUpStartTime 报名开始时间 + * @param signUpEndTime 报名结束时间 + * @param changeEndTime 变更截至时间 + */ + void batchAssignSignUpTimes(String[] ids, Date signUpStartTime, Date signUpEndTime, Date changeEndTime); +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationAuditServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationAuditServiceImpl.java index 4abe0d1..3cdb27f 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationAuditServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationAuditServiceImpl.java @@ -2,80 +2,248 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.service.impl; import cn.hutool.core.util.StrUtil; import com.budwk.app.base.model.Audit; +import com.budwk.app.base.page.Pagination; +import com.budwk.app.base.param.PageForm; import com.budwk.app.base.service.impl.BaseServiceImpl; -import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; + +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.sys.models.Sys_user; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationState; 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.model.RecuperationEnroll; +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.service.RecuperationAuditService; -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.IocBean; +import org.nutz.ioc.aop.Aop; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import java.util.List; +import java.util.Map; +import java.util.Date; -/** - * @ClassName RecuperationAuditServiceImpl - * @Author JyuHsin - * @Date 2025/8/20 14:38 - * @Version 1.0 - * @Description TODO - */ -@Slf4j @IocBean(args = {"refer:dao"}) -public class RecuperationAuditServiceImpl extends BaseServiceImpl implements RecuperationAuditService { +public class RecuperationAuditServiceImpl extends BaseServiceImpl implements RecuperationAuditService { + public RecuperationAuditServiceImpl(Dao dao) { + super(dao); + } - public RecuperationAuditServiceImpl(Dao dao) { - super(dao); - } + @Override + public List getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode) { - @Override - public NutMap findOne(String id) { - Sql sql = Sqls.create(""" + Sql sql = Sqls.create(""" + SELECT + line.*, + lineu.id as selectId, + un.name as unionname, + DATE_FORMAT(lineu.playStartTime,'%Y-%m-%d') as playStartTime1 + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN sys_union un ON un.id = enroll.takePartInUnionId + $condition + """); + Cnd cnd = Cnd.NEW(); + if (Strings.isNotBlank(unionId)) { + cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); + } + if (state != null && (state == 3 || state == 1)) { + cnd.and("enroll.takePartInUnionId", "=", SecurityUtil.getUnionId()); + } + if (state != null && state == 2) { + cnd.and("enroll.selfUnionId", "=", SecurityUtil.getUnionId()); + cnd.and("enroll.takePartInUnionId", "!=", SecurityUtil.getUnionId()); + } + cnd.andEX("lineu.signUpMode", "=", signUpMode); + cnd.andEX("line.regionalNature", "=", regionalNature); + if (StrUtil.isNotBlank(endYear)){ + cnd.andEX("YEAR(enroll.signingUptime)", ">=", year); + cnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear); + } else { + cnd.andEX("YEAR(enroll.signingUptime)", "=", year); + } + cnd.and("enroll.takePartInLineId", "is not", null); + cnd.and("enroll.takePartInLineId", "!=", ""); + cnd.and("enroll.stateId", "=", RecuperationState.PASS); + cnd.groupBy("line.id"); + cnd.having(Cnd.where("playStartTime1", "is not", null)); + cnd.asc("un.name").asc("lineu.lineId").asc("lineu.playStartTime"); + sql.setCondition(cnd); + return listMap(sql); + } + + @Override + public NutMap findOne(String id) { + Sql sql = Sqls.create(""" SELECT lxs.travelAgencyName, + ta.travelAgencyName as joinTravelAgencyName, 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 + (SELECT COUNT(1) FROM the_rapy_recuperation_enroll_companion WHERE trreId=enroll.id) 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 + `the_rapy_recuperation_enroll` enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = lineu.travelAgencyId + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = enroll.takePartInTravelAgencyId where enroll.id=@id """).setParam("id", id); - sql.setCallback(Sqls.callback.map()); - this.dao().execute(sql); - NutMap fetch = sql.getObject(NutMap.class); - NutMap map = NutMap.NEW(); - if (Strings.isNotBlank(fetch.getString("selfUnionAuditId"))) { - Audit selfUnionAudit = dao().fetch(Audit.class, fetch.getString("selfUnionAuditId")); - fetch.setv("selfUnionAudit", selfUnionAudit); - } - if (Strings.isNotBlank(fetch.getString("joinLineUnionAuditId"))) { - Audit joinLineUnionAudit = dao().fetch(Audit.class, fetch.getString("joinLineUnionAuditId")); - fetch.setv("joinLineUnionAudit", joinLineUnionAudit); - } - if (Strings.isNotBlank(fetch.getString("schoolUnionAuditId"))) { - Audit schoolUnionAudit = dao().fetch(Audit.class, fetch.getString("schoolUnionAuditId")); - fetch.setv("schoolUnionAudit", schoolUnionAudit); - } - if (Strings.isNotBlank(fetch.getString("bedInfoId"))) { - RecuperationEnrollBed bedInfo = dao().fetch(RecuperationEnrollBed.class, fetch.getString("bedInfoId")); - fetch.setv("bedInfo", bedInfo); - } - List companionList = dao().query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); - companionList.forEach(v -> { - if(StrUtil.isNotBlank(v.getBedInfoId())) { - v.setBedInfo(dao().fetch(RecuperationEnrollBed.class, v.getBedInfoId())); - } - }); - map.addv("viewData", fetch.setv("companionList", companionList)); - return map; - } + + sql.setCallback(Sqls.callback.map()); + dao().execute(sql); + NutMap fetch = sql.getObject(NutMap.class); + // 导入或补录的历史报名记录可能缺少证件号、手机号,查看时用用户表数据兜底展示。 + if (fetch != null && (Strings.isBlank(fetch.getString("idCard")) || Strings.isBlank(fetch.getString("mobile")))) { + Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", fetch.getString("loginName"))); + if (user != null) { + if (Strings.isBlank(fetch.getString("idCard"))) { + fetch.setv("idCard", user.getIdCard()); + } + if (Strings.isBlank(fetch.getString("mobile"))) { + fetch.setv("mobile", user.getMobile()); + } + } + } + NutMap map = NutMap.NEW(); + if (Strings.isNotBlank(fetch.getString("selfUnionAuditId"))) { + Audit selfUnionAudit = dao().fetch(Audit.class, fetch.getString("selfUnionAuditId")); + fetch.setv("selfUnionAudit", selfUnionAudit); + } + if (Strings.isNotBlank(fetch.getString("joinLineUnionAuditId"))) { + Audit joinLineUnionAudit = dao().fetch(Audit.class, fetch.getString("joinLineUnionAuditId")); + fetch.setv("joinLineUnionAudit", joinLineUnionAudit); + } + if (Strings.isNotBlank(fetch.getString("schoolUnionAuditId"))) { + Audit schoolUnionAudit = dao().fetch(Audit.class, fetch.getString("schoolUnionAuditId")); + fetch.setv("schoolUnionAudit", schoolUnionAudit); + } + if (Strings.isNotBlank(fetch.getString("bedInfoId"))) { + RecuperationEnrollBed bedInfo = dao().fetch(RecuperationEnrollBed.class, fetch.getString("bedInfoId")); + fetch.setv("bedInfo", bedInfo); + } + List companionList = dao().query(RecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); + companionList.forEach(v -> { + v.setBedInfo(dao().fetch(RecuperationEnrollBed.class, v.getBedInfoId())); + }); + map.addv("viewData", fetch.setv("companionList", companionList)); + + + return map; + } + + + @Override + @Aop(TransAop.READ_COMMITTED) + public void schoolAudit(Integer stateId, String loginName, Boolean adjustment, String takePartInLineId) { + Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); + RecuperationLineSelect unionSelect = dao().fetch(RecuperationLineSelect.class, Cnd.where("id", "=", takePartInLineId)); + RecuperationLine theRapyRecuperationLine = dao().fetch(RecuperationLine.class, Cnd.where("id", "=", unionSelect.getLineId())); + + String content = "【智慧工会】%s老师您好,您报名的%s线路因报名人数不足已取消,请尽快进入智慧工会重新选择线路。" + .formatted(user.getUsername(),theRapyRecuperationLine.getLineName()); + + List list = List.of(Map.of("type", "User", "userId", user.getLoginname(), "name", user.getUsername())); + if (stateId.equals(RecuperationState.PASS)) { + content = "【智慧工会】%s老师您好,您报名的%s线路已组团成功,请按约定出行。" + .formatted(user.getUsername(), theRapyRecuperationLine.getLineName()); + } + //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); + } + + @Override + public Pagination auditPage(PageForm pageForm, String stage, Integer year, Boolean audited, String keyword) { + Sql sql = Sqls.create(""" + SELECT enroll.*, line.lineName, ta.travelAgencyName, + self_union.name AS selfUnionName, + join_union.name AS joinUnionName + FROM the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = COALESCE(enroll.takePartInTravelAgencyId, line.travelAgencyId) + LEFT JOIN sys_union self_union ON self_union.id = enroll.selfUnionId + LEFT JOIN sys_union join_union ON join_union.id = enroll.takePartInUnionId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(enroll.signingUptime)", "=", year); + cnd.and("enroll.isNormal", "=", true); + if (StrUtil.isNotBlank(keyword)) { + cnd.and(Cnd.exps("enroll.userName", "like", "%" + keyword + "%") + .or("enroll.loginName", "like", "%" + keyword + "%")); + } + if ("school".equals(stage) || "travel".equals(stage)) { + cnd.and("enroll.stateId", audited == null || !audited ? "=" : "in", + audited == null || !audited ? RecuperationState.SCHOOL : new Integer[]{RecuperationState.SCHOOLFAIL, RecuperationState.PASS}); + if ("travel".equals(stage)) cnd.and("enroll.takePartInTravelAgencyId", "is not", null); + } else if ("lineUnion".equals(stage)) { + cnd.and("enroll.takePartInUnionId", "=", SecurityUtil.getUnionId()); + cnd.and("enroll.stateId", audited == null || !audited ? "=" : "in", + audited == null || !audited ? RecuperationState.LINEUNIT : new Integer[]{RecuperationState.LINEUNITFAIL, RecuperationState.PASS}); + } else { + cnd.and("enroll.selfUnionId", "=", SecurityUtil.getUnionId()); + cnd.and("enroll.stateId", audited == null || !audited ? "=" : "in", + audited == null || !audited ? RecuperationState.UNIT : new Integer[]{RecuperationState.UNITFAIL, RecuperationState.LINEUNIT, RecuperationState.PASS}); + } + cnd.desc("enroll.signingUptime"); + sql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @Override + @Aop(TransAop.READ_COMMITTED) + public void auditEnroll(String id, boolean pass, String auditOpinion) { + RecuperationEnroll enroll = dao().fetch(RecuperationEnroll.class, id); + if (enroll == null) throw new IllegalArgumentException("报名记录不存在"); + Integer oldState = enroll.getStateId(); + Audit audit = new Audit(); + audit.setAuditOpinion(auditOpinion); + audit.setAuditPass(pass); + audit.setAuditTime(new Date()); + Audit saved = insert(audit); + if (RecuperationState.UNIT.equals(oldState)) { + enroll.setSelfUnionAuditId(saved.getId()); + if (!pass) enroll.setStateId(RecuperationState.UNITFAIL); + else if (StrUtil.equals(enroll.getSelfUnionId(), enroll.getTakePartInUnionId())) enroll.setStateId(RecuperationState.PASS); + else enroll.setStateId(RecuperationState.LINEUNIT); + } else if (RecuperationState.LINEUNIT.equals(oldState)) { + enroll.setJoinLineUnionAuditId(saved.getId()); + enroll.setStateId(pass ? RecuperationState.PASS : RecuperationState.LINEUNITFAIL); + } else if (RecuperationState.SCHOOL.equals(oldState)) { + enroll.setSchoolUnionAuditId(saved.getId()); + enroll.setStateId(pass ? RecuperationState.PASS : RecuperationState.SCHOOLFAIL); + } else { + throw new IllegalStateException("当前报名状态不可审核"); + } + dao().updateIgnoreNull(enroll); + } + + @Override + @Aop(TransAop.READ_COMMITTED) + public void recallAudit(String id) { + RecuperationEnroll enroll = dao().fetch(RecuperationEnroll.class, id); + if (enroll == null) throw new IllegalArgumentException("报名记录不存在"); + if (RecuperationState.UNITFAIL.equals(enroll.getStateId())) { + enroll.setStateId(RecuperationState.UNIT); + enroll.setSelfUnionAuditId(null); + } else if (RecuperationState.LINEUNITFAIL.equals(enroll.getStateId())) { + enroll.setStateId(RecuperationState.LINEUNIT); + enroll.setJoinLineUnionAuditId(null); + } else if (RecuperationState.SCHOOLFAIL.equals(enroll.getStateId())) { + enroll.setStateId(RecuperationState.SCHOOL); + enroll.setSchoolUnionAuditId(null); + } else { + throw new IllegalStateException("当前状态不可撤回"); + } + dao().update(enroll, "^stateId|selfUnionAuditId|joinLineUnionAuditId|schoolUnionAuditId$"); + } } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationBaseManagerServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationBaseManagerServiceImpl.java index 047a304..d8cd667 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationBaseManagerServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationBaseManagerServiceImpl.java @@ -1,18 +1,37 @@ 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.service.impl.BaseServiceImpl; 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.RecuperationBaseManagement; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationEnroll; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationLot; import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationBaseManagerService; 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.ioc.loader.annotation.IocBean; +import org.nutz.ioc.aop.Aop; +import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + /** * @ClassName RecuperationBaseManagerServiceImpl * @Author JyuHsin @@ -34,11 +53,14 @@ public class RecuperationBaseManagerServiceImpl extends BaseServiceImpl calendarDays = new ArrayList<>(); + while (!currentDate.isAfter(endDate)) { + calendarDays.add(currentDate.format(formatter)); + currentDate = currentDate.plusDays(1); + } + + List configuredDays = getConfiguredBaseDays(base); + List availableDays = getAvailableBaseManagementDays(SecurityUtil.getUserLoginname(), enrollId); + availableDays.removeIf(day -> !configuredDays.contains(day)); + return NutMap.NEW() + .setv("days", calendarDays) + .setv("availableDays", availableDays) + .setv("holidays", Collections.emptyList()) + .setv("fullDays", Collections.emptySet()) + .setv("usedDays", getBaseUsedDays(base.getYear(), enrollId)) + .setv("minDate", DateUtil.formatDate(base.getActivityStartTime())) + .setv("maxDate", DateUtil.formatDate(base.getActivityEndTime())); + } + + /** 返回未配置活动范围时前端可直接消费的空日期结构。 */ + private NutMap emptyTimeArray() { + return NutMap.NEW() + .setv("days", Collections.emptyList()) + .setv("availableDays", Collections.emptyList()) + .setv("holidays", Collections.emptyList()) + .setv("fullDays", Collections.emptySet()) + .setv("usedDays", Collections.emptySet()) + .setv("minDate", "") + .setv("maxDate", ""); + } + + @Override + public Map validBaseManagementQuota(String id, String enrollId) { + if (StrUtil.isBlank(id)) { + return Map.of(false, "参数错误"); + } + RecuperationBaseManagement base = dao().fetch(RecuperationBaseManagement.class, id); + if (base == null) { + return Map.of(false, "定点信息不存在"); + } + if (base.getMaxSignUpNumber() == null || base.getMaxSignUpNumber() <= 0) { + return Map.of(true, "验证成功"); + } + if (countBaseManagementSignUpUsers(id, enrollId) >= base.getMaxSignUpNumber()) { + return Map.of(false, "当前定点报名人数已满"); + } + return Map.of(true, "验证成功"); + } + + @Override + @Aop(TransAop.READ_COMMITTED) + public void batchAssignSignUpTimes(String[] ids, Date signUpStartTime, Date signUpEndTime, Date changeEndTime) { + if (Lang.isEmpty(ids)) { + return; + } + Chain chain = Chain.make("signUpStartTime", signUpStartTime) + .add("signUpEndTime", signUpEndTime) + .add("changeEndTime", changeEndTime); + dao().update(RecuperationBaseManagement.class, chain, Cnd.where("id", "in", ids)); + } + + /** 按工号统计定点有效报名人数,编辑时排除当前报名。 */ + private int countBaseManagementSignUpUsers(String id, String excludeEnrollId) { + Sql sql = Sqls.create(""" + SELECT COUNT(DISTINCT loginName) + FROM the_rapy_recuperation_enroll + WHERE takePartInBaseManagementId = @id + AND isNormal = true + AND stateId NOT IN ($auditFailStates) + $excludeEnrollCnd + """); + sql.setParam("id", id); + sql.setVar("auditFailStates", String.join(",", Arrays.asList( + String.valueOf(RecuperationState.UNITFAIL), + String.valueOf(RecuperationState.LINEUNITFAIL), + String.valueOf(RecuperationState.SCHOOLFAIL) + ))); + sql.setVar("excludeEnrollCnd", StrUtil.isBlank(excludeEnrollId) ? "" : "AND id != @excludeEnrollId"); + if (StrUtil.isNotBlank(excludeEnrollId)) { + sql.setParam("excludeEnrollId", excludeEnrollId); + } + sql.setCallback(Sqls.callback.integer()); + dao().execute(sql); + return sql.getInt(); + } + + /** 新数据读取 days,旧数据通过标段名称或值推断可选天数。 */ + private List getConfiguredBaseDays(RecuperationBaseManagement base) { + Set days = new HashSet<>(); + if (StrUtil.isNotBlank(base.getDays())) { + for (String item : base.getDays().split(",")) { + String day = normalizeDay(item); + if (StrUtil.isNotBlank(day)) { + days.add(day); + } + } + } + if (days.isEmpty() && StrUtil.isNotBlank(base.getLotId())) { + RecuperationLot lot = dao().fetch(RecuperationLot.class, base.getLotId()); + if (lot != null) { + String day = normalizeDay(StrUtil.blankToDefault(lot.getLotValue(), lot.getLotName())); + if (StrUtil.isNotBlank(day)) { + days.add(day); + } + } + } + return new ArrayList<>(days); + } + + /** 计算当前年度仍可报名的定点天数组合。 */ + private List getAvailableBaseManagementDays(String loginName, String excludeEnrollId) { + List options = List.of("两天", "三天", "五天"); + List enrolls = queryCurrentYearEnrolls(loginName, excludeEnrollId); + if (enrolls.isEmpty()) { + return new ArrayList<>(options); + } + boolean hasOtherMode = enrolls.stream().anyMatch(enroll -> StrUtil.isNotBlank(enroll.getTakePartInLineId()) + || StrUtil.isNotBlank(enroll.getTakePartInTravelAgencyId())); + if (hasOtherMode) { + return new ArrayList<>(); + } + Set signedDays = new HashSet<>(); + for (RecuperationEnroll enroll : enrolls) { + if (StrUtil.isNotBlank(enroll.getTakePartInBaseManagementId())) { + signedDays.add(resolveEnrollDay(enroll)); + } + } + if (signedDays.contains("五天") || signedDays.containsAll(List.of("两天", "三天"))) { + return new ArrayList<>(); + } + if (signedDays.contains("两天")) { + return new ArrayList<>(List.of("三天")); + } + if (signedDays.contains("三天")) { + return new ArrayList<>(List.of("两天")); + } + return new ArrayList<>(options); + } + + private List queryCurrentYearEnrolls(String loginName, String excludeEnrollId) { + if (StrUtil.isBlank(loginName)) { + return Collections.emptyList(); + } + List enrolls = dao().query(RecuperationEnroll.class, Cnd.where("loginName", "=", loginName) + .and("isNormal", "=", true) + .and("stateId", "not in", Lang.array(RecuperationState.UNITFAIL, RecuperationState.LINEUNITFAIL, RecuperationState.SCHOOLFAIL)) + .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); + enrolls.removeIf(enroll -> StrUtil.isNotBlank(excludeEnrollId) && excludeEnrollId.equals(enroll.getId())); + return enrolls; + } + + /** 查询本人定点报名覆盖日期,供移动端日历禁用冲突日期。 */ + private Set getBaseUsedDays(Integer year, String excludeEnrollId) { + List enrolls = dao().query(RecuperationEnroll.class, Cnd.where("loginName", "=", SecurityUtil.getUserLoginname()) + .and("isNormal", "=", true) + .and("takePartInBaseManagementId", "is not", null) + .and("stateId", "not in", Lang.array(RecuperationState.UNITFAIL, RecuperationState.LINEUNITFAIL, RecuperationState.SCHOOLFAIL)) + .and("YEAR(signingUptime)", "=", year == null ? DateUtil.thisYear() : year)); + Set usedDays = new HashSet<>(); + for (RecuperationEnroll enroll : enrolls) { + if ((StrUtil.isNotBlank(excludeEnrollId) && excludeEnrollId.equals(enroll.getId())) || enroll.getTakePartInTime() == null) { + continue; + } + int dayCount = dayCount(resolveEnrollDay(enroll)); + LocalDate startDate = LocalDate.parse(DateUtil.formatDate(enroll.getTakePartInTime())); + for (int i = 0; i < dayCount; i++) { + usedDays.add(startDate.plusDays(i).toString()); + } + } + return usedDays; + } + + private String resolveEnrollDay(RecuperationEnroll enroll) { + String day = normalizeDay(enroll.getLotId()); + if (StrUtil.isNotBlank(day)) { + return day; + } + RecuperationLot lot = StrUtil.isBlank(enroll.getLotId()) ? null : dao().fetch(RecuperationLot.class, enroll.getLotId()); + return lot == null ? "" : normalizeDay(StrUtil.blankToDefault(lot.getLotValue(), lot.getLotName())); + } + + private String normalizeDay(String text) { + if (StrUtil.isBlank(text)) { + return ""; + } + if (text.contains("两") || text.contains("2")) return "两天"; + if (text.contains("三") || text.contains("3")) return "三天"; + if (text.contains("五") || text.contains("5")) return "五天"; + return ""; + } + + private int dayCount(String day) { + if ("两天".equals(day)) return 2; + if ("三天".equals(day)) return 3; + if ("五天".equals(day)) return 5; + return 0; + } } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationCommonServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationCommonServiceImpl.java new file mode 100644 index 0000000..8954479 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationCommonServiceImpl.java @@ -0,0 +1,66 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service.impl; + +import com.budwk.app.base.service.impl.BaseServiceImpl; +import cn.hutool.core.date.DateUtil; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationType; +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.service.RecuperationCommonService; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.ioc.loader.annotation.IocBean; + +/** + * @FileName com.budwk.app.zhgh.staffbenefit.recuperation.service.impl.RecuperationCommonServiceImpl + * @Description: TODO + * @Author zxc + * @Date 2022/6/6:10:46 + * @Version V1.0 + **/ +@IocBean(args = {"refer:dao"}) +public class RecuperationCommonServiceImpl extends BaseServiceImpl implements RecuperationCommonService { + + public RecuperationCommonServiceImpl(Dao dao) { + super(dao); + } + + + @Override + public boolean canSignUp(String loginName, RecuperationType trrt) { + + RecuperationConfig config = dao().fetch(RecuperationConfig.class); + + //每年旅行频率 + Integer travelFrequency = config.getTravelFrequency(); + + //省外几年去一次 + Integer outsideNumber = config.getOutsideNumber(); + + //今年是否参加了? 旅游频率限制 + Cnd cnd = Cnd.NEW(); + cnd.and("loginName", "=", loginName); + cnd.and("YEAR(takePartInTime)", "=", DateUtil.thisYear()); + cnd.and("isTakePartIn", "=", 1); + int joinCount = dao().count(RecuperationEnroll.class, cnd); + + if (joinCount == travelFrequency) { + return false; + } + + + //省外 outsideNumber 年内是否去过 + if (trrt.getValue() == RecuperationType.provinceOutLine.getValue()) { + Cnd lineCnd = cnd.clone(); + lineCnd.and("takePartInLineId", "IS NOT", null); + lineCnd.and(new SqlExpressionGroup().andBetween("YEAR(takePartInTime)", DateUtil.thisYear() - 1, DateUtil.thisYear() - outsideNumber)); + int lineJoinCount = dao().count(RecuperationEnroll.class, lineCnd); + return lineJoinCount <= 0; + + } + + + return false; + + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationEnrollJoinUserImportServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationEnrollJoinUserImportServiceImpl.java new file mode 100644 index 0000000..1e95c9a --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationEnrollJoinUserImportServiceImpl.java @@ -0,0 +1,109 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service.impl; + +import com.budwk.app.base.service.impl.BaseServiceImpl; +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.service.RecuperationEnrollJoinUserImportService; +import org.nutz.dao.Dao; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.ioc.aop.Aop; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.lang.util.NutMap; + +import java.util.List; +import java.util.Map; +import java.util.ArrayList; + +/** + * @FileName com.budwk.app.zhgh.staffbenefit.recuperation.service.impl.RecuperationEnrollJoinUserImportServiceImpl + * @Description: TODO + * @Author zxc + * @Date 2022/6/14:09:57 + * @Version V1.0 + **/ +@IocBean(args = {"refer:dao"}) +public class RecuperationEnrollJoinUserImportServiceImpl extends BaseServiceImpl implements RecuperationEnrollJoinUserImportService { + public RecuperationEnrollJoinUserImportServiceImpl(Dao dao) { + super(dao); + } + + @Override + public List selectLineAndTravelAgencyList(Integer year, String keyword) { + Sql sql = Sqls.create(""" + SELECT + id, + lineName AS label, + '线路' AS `type` + FROM + the_rapy_recuperation_line + UNION ALL + SELECT + id, + travelAgencyName AS label, + '旅行社' AS `type` + FROM + the_rapy_recuperation_travel_agency + """); + return listMap(sql); + } + + + @Override + public Map> selectLineOrTravelAgency(Integer year) { + Sql lineSql = Sqls.create(""" + SELECT + id, + lineName AS label + FROM + the_rapy_recuperation_line + WHERE + `year` = @year + AND createUnionId = @unionId + UNION + SELECT + line.id, + line.lineName AS label + FROM + the_rapy_recuperation_line_union_select lus + LEFT JOIN the_rapy_recuperation_line line ON line.id = lus.lineId\s + WHERE + line.`year` = @year + AND lus.unionId = @unionId + """); + lineSql.setParam("year", year); + lineSql.setParam("unionId", SecurityUtil.getUnionId()); + + Sql travelSql = Sqls.create("SELECT id,travelAgencyName AS label FROM the_rapy_recuperation_travel_agency where year = @year"); + travelSql.setParam("year", year); + + return Map.of("lines", listMap(lineSql), "travels", listMap(travelSql)); + } + + @Override + public List matchEnrolls(List rows, String lineId, String travelAgencyId) { + List result = new ArrayList<>(); + for (RecuperationEnroll row : rows) { + Cnd cnd = Cnd.where("loginName", "=", row.getLoginName()); + cnd.andEX("takePartInLineId", "=", lineId); + cnd.andEX("takePartInTravelAgencyId", "=", travelAgencyId); + RecuperationEnroll enroll = fetch(cnd); + if (enroll != null) { + enroll.setTakePartInTime(row.getTakePartInTime()); + result.add(enroll); + } + } + return result; + } + + @Override + @Aop(TransAop.READ_COMMITTED) + public void markParticipated(List enrolls) { + for (RecuperationEnroll enroll : enrolls) { + enroll.setTakePartIn(true); + dao().updateIgnoreNull(enroll); + } + } +} 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 index f34c1ff..fdeeb55 100644 --- 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 @@ -14,6 +14,7 @@ import com.budwk.app.zhgh.activity.basic.service.ActivityBasicScopeService; 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.RecuperationBaseManagerService; import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineService; import lombok.extern.slf4j.Slf4j; import org.nutz.aop.interceptor.ioc.TransAop; @@ -31,6 +32,7 @@ import org.nutz.lang.util.NutMap; import java.time.LocalDate; import java.time.Period; +import java.text.Collator; import java.util.*; import java.util.stream.Collectors; @@ -44,10 +46,17 @@ import java.util.stream.Collectors; @Slf4j @IocBean(args = {"refer:dao"}) public class RecuperationEnrollServiceImpl extends BaseServiceImpl implements RecuperationEnrollService { + private static final ThreadLocal NATURAL_SORT_COLLATOR = ThreadLocal.withInitial(() -> { + Collator collator = Collator.getInstance(Locale.CHINA); + collator.setStrength(Collator.PRIMARY); + return collator; + }); @Inject private RecuperationLineService lineService; @Inject + private RecuperationBaseManagerService baseManagerService; + @Inject private ActivityBasicScopeService activityBasicScopeService; public RecuperationEnrollServiceImpl(Dao dao) { @@ -62,6 +71,7 @@ public class RecuperationEnrollServiceImpl extends BaseServiceImpl> list = new ArrayList<>((List>) (List) sql.getList(Map.class)); + list.sort((left, right) -> { + int nameCompare = compareNaturalName(getMapValue(left, nameKey), getMapValue(right, nameKey)); + return nameCompare != 0 ? nameCompare : compareNaturalName(getMapValue(left, idKey), getMapValue(right, idKey)); + }); + int pageNumber = pageForm.getPageNumber() == null || pageForm.getPageNumber() < 1 ? 1 : pageForm.getPageNumber(); + int pageSize = pageForm.getPageSize() == null || pageForm.getPageSize() < 1 ? 10 : pageForm.getPageSize(); + int totalCount = list.size(); + int fromIndex = Math.min((pageNumber - 1) * pageSize, totalCount); + int toIndex = Math.min(fromIndex + pageSize, totalCount); + return new Pagination(pageNumber, pageSize, totalCount, new ArrayList<>(list.subList(fromIndex, toIndex))); + } + + private String getMapValue(Map map, String key) { + Object value = map == null ? null : map.get(key); + return value == null ? "" : value.toString().trim(); + } + + private int compareNaturalName(String left, String right) { + int leftIndex = 0; + int rightIndex = 0; + while (leftIndex < left.length() && rightIndex < right.length()) { + char leftChar = left.charAt(leftIndex); + char rightChar = right.charAt(rightIndex); + if (Character.isDigit(leftChar) && Character.isDigit(rightChar)) { + String leftNumber = readPart(left, leftIndex, true); + String rightNumber = readPart(right, rightIndex, true); + int numberCompare = compareNumberPart(leftNumber, rightNumber); + if (numberCompare != 0) return numberCompare; + leftIndex += leftNumber.length(); + rightIndex += rightNumber.length(); + } else { + String leftText = readPart(left, leftIndex, false); + String rightText = readPart(right, rightIndex, false); + int textCompare = NATURAL_SORT_COLLATOR.get().compare(leftText.toLowerCase(Locale.ROOT), rightText.toLowerCase(Locale.ROOT)); + if (textCompare != 0) return textCompare; + leftIndex += leftText.length(); + rightIndex += rightText.length(); + } + } + return Integer.compare(left.length(), right.length()); + } + + private String readPart(String value, int startIndex, boolean digit) { + int endIndex = startIndex; + while (endIndex < value.length() && Character.isDigit(value.charAt(endIndex)) == digit) endIndex++; + return value.substring(startIndex, endIndex); + } + + private int compareNumberPart(String left, String right) { + String leftValue = left.replaceFirst("^0+(?!$)", ""); + String rightValue = right.replaceFirst("^0+(?!$)", ""); + if (leftValue.length() != rightValue.length()) return Integer.compare(leftValue.length(), rightValue.length()); + int compare = leftValue.compareTo(rightValue); + return compare != 0 ? compare : Integer.compare(left.length(), right.length()); + } + @Override public List getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType) { + int unionType = lineUnionType == null ? 1 : lineUnionType; Sql lineSql = Sqls.create(""" SELECT us.id as usId, @@ -179,7 +300,7 @@ public class RecuperationEnrollServiceImpl extends BaseServiceImpl 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(); + RecuperationLot currentLot = dao().fetch(RecuperationLot.class, lineInfo.getLotId()); + if (currentLot == null || currentLot.getActivityCost() == null) { + return Map.of(false, "线路标段费用配置不完整"); + } + Integer currentLineCost = currentLot.getActivityCost(); //省外线路判断报名人数 if (trrt.getValue() == RecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { @@ -488,11 +662,11 @@ public class RecuperationEnrollServiceImpl extends BaseServiceImpl validSubmitQuota(RecuperationEnroll enrollInfo) { + if (enrollInfo == null) { + return Map.of(false, "报名参数不完整"); + } + if (StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { + return lineService.validLineQuota(enrollInfo.getTakePartInLineId(), enrollInfo.getId()); + } + if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId())) { + return baseManagerService.validBaseManagementQuota(enrollInfo.getTakePartInBaseManagementId(), enrollInfo.getId()); + } + if (StrUtil.isBlank(enrollInfo.getTakePartInTravelAgencyId())) { + return Map.of(false, "报名项目不存在"); + } + RecuperationTravelAgency agency = dao().fetch(RecuperationTravelAgency.class, enrollInfo.getTakePartInTravelAgencyId()); + if (agency == null) { + return Map.of(false, "旅行社信息不存在"); + } + if (agency.getMaxSignUpNumber() == null || agency.getMaxSignUpNumber() <= 0) { + return Map.of(true, "验证成功"); + } + Sql sql = Sqls.create(""" + SELECT count(distinct enroll.loginName) + FROM the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select enrollUs ON enrollUs.id = enroll.takePartInLineId + LEFT JOIN the_rapy_recuperation_line enrollLine ON enrollLine.id = enrollUs.lineId + LEFT JOIN the_rapy_recuperation_base_management enrollBase ON enrollBase.id = enroll.takePartInBaseManagementId + WHERE (enroll.takePartInTravelAgencyId = @agencyId + OR IFNULL(NULLIF(enrollUs.travelAgencyId, ''), enrollLine.travelAgencyId) = @agencyId + OR enrollBase.travelAgencyId = @agencyId) + AND enroll.isNormal = true + AND enroll.stateId NOT IN ($auditFailStates) + AND YEAR(enroll.signingUptime) = @year + $excludeEnrollCnd + """); + sql.setParam("agencyId", agency.getId()); + sql.setParam("year", agency.getYear() == null ? DateUtil.thisYear() : agency.getYear()); + sql.setVar("auditFailStates", RecuperationState.UNITFAIL + "," + RecuperationState.LINEUNITFAIL + "," + RecuperationState.SCHOOLFAIL); + sql.setVar("excludeEnrollCnd", StrUtil.isBlank(enrollInfo.getId()) ? "" : "AND enroll.id != @excludeEnrollId"); + if (StrUtil.isNotBlank(enrollInfo.getId())) { + sql.setParam("excludeEnrollId", enrollInfo.getId()); + } + sql.setCallback(Sqls.callback.integer()); + dao().execute(sql); + return sql.getInt() >= agency.getMaxSignUpNumber() + ? Map.of(false, "当前旅行社报名人数已满") + : Map.of(true, "验证成功"); + } + public Map validSignCount(RecuperationEnroll enrollInfo, RecuperationConfig config, int estimatedFamilyNumbers, String type) { int hasSignNumber = 0;//已经报名的人数 int currentSignNumber = 1;//当前报名人数,1表示自己,下面的if是加家属人数 @@ -665,22 +888,22 @@ public class RecuperationEnrollServiceImpl extends BaseServiceImpl 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()) + int inCount = dao().count("the_rapy_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()) + int outCount = dao().count("the_rapy_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()) + int travelCount = dao().count("the_rapy_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()) + int hotelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", SecurityUtil.getUserLoginname()) .and("takePartInLineId", "is", null).and("isNormal", "=", true) .and("takePartInBaseManagementId", "is not", null) .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); @@ -706,8 +929,8 @@ public class RecuperationEnrollServiceImpl extends BaseServiceImpl implements RecuperationLineAdjustmentService { + + public RecuperationLineAdjustmentServiceImpl(Dao dao) { + super(dao); + } + + @Override + public Pagination pageData(PageForm pageForm, Integer year, String lineId, String unionId, String keywords, String regionalNature, String lotId) { + Sql sql = Sqls.create(""" + SELECT + line.id, + line.serialNumber, + line.lineName, + line.regionalNature, + COALESCE((SELECT outsideQuota FROM the_rapy_recuperation_config LIMIT 1), 0) AS minimumGroupSize, + line.`year`, + line.isDisabled, + line.playNumberOfDays, + line.createUnionId, + line.signUpStartTime, + line.signUpEndTime, + line.changeEndTime, + line.signUpMode, + line.createMode, + us.id as usId, + us.playStartTime, + us.playEndTime, + line.files AS fileId, + create_gh.name AS createUnionName, + ta.travelAgencyName, + us.unionId, + select_gh.name AS selectUnionName, + (select count(DISTINCT loginName) from the_rapy_recuperation_enroll where if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) AND takePartInLineId = us.id and isNormal=true and stateId=2750 and YEAR(signingUptime)=@year) as signUpUserNum, + IF( + COALESCE((SELECT familyInfo FROM the_rapy_recuperation_config LIMIT 1), 1) = 2, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) AND takePartInLineId = us.id and isNormal=true and stateId=2750 and YEAR(signingUptime)=@year)), + (select ifnull(sum(familyNumber),0) from the_rapy_recuperation_enroll where takePartInLineId = us.id and if(us.signUpMode = 1, takePartInUnionId = us.unionId, 1=1) and isNormal = true and stateId=2750 and YEAR(signingUptime)=@year) + ) as signUpUserFamilyNum + FROM + the_rapy_recuperation_line_union_select us + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = line.travelAgencyId + LEFT JOIN sys_union create_gh ON create_gh.id = line.createUnionid + LEFT JOIN sys_union select_gh ON select_gh.id = us.unionId + $condition + """); + sql.setParam("signUpSuccessCode", RecuperationState.PASS); + sql.setParam("year", year); + + Cnd cnd = Cnd.NEW(); + cnd.andEX("line.regionalNature","=",regionalNature); + cnd.andEX("line.lotId", "=", lotId); + //cnd.and("line.signUpMode", "=", RecuperationSignUpMode.UNION.getValue()); + cnd.and("us.playStartTime", "is not", null); + //cnd.andEX("line.year", "=", year); + cnd.andEX("line.id", "=", lineId); + if (AuthUtil.hasRoleOr("sysadmin", "A06")) { + cnd.andEX("us.unionId", "=", unionId); + cnd.andEX("us.signUpMode", "=", Strings.isNotBlank(unionId) ? 1 : 2); + } else { + cnd.and("us.unionId", "=", SecurityUtil.getUnionId()); + cnd.and("us.signUpMode", "=", 1); + } + if (StrUtil.isNotBlank(keywords)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("line.lineName", keywords); + seg.orLike("line.serialNumber", keywords); + cnd.and(seg); + } + if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy()); + } + cnd.and("year(selectTime)", "=", year); + sql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @Override + public List findUnionSignUpModeUserList(String lineId, String unionId) { + Sql sql = Sqls.create(""" + SELECT + e.id, + e.loginName, + e.userName, + e.sex, + e.unitName, + e.unionName, + e.signingUptime, + e.isNormal, + count(c.id) as companionCount, + e.familyNumber + FROM + the_rapy_recuperation_enroll e + LEFT JOIN the_rapy_recuperation_enroll_companion c ON c.trreId = e.id + left join the_rapy_recuperation_line_union_select us on e.takePartInLineId = us.id + WHERE + e.takePartInLineId = @lineId + and if(us.signUpMode = 1, e.takePartInUnionId = @unionId, 1=1) + GROUP BY e.id + """); +// AND (e.stateId = @passStateCode or e.stateId is null) + + sql.setParam("lineId", lineId); + sql.setParam("unionId", unionId); + sql.setParam("passStateCode", RecuperationState.PASS); + List list = listMap(sql); + for (NutMap rowMap : list) { + Sql companionSql = Sqls.create("select loginName,userName,sex,relation,idCard from the_rapy_recuperation_enroll_companion where trreId=@trreId"); + companionSql.setParam("trreId", rowMap.getString("id")); + List companionList = listMap(companionSql); + rowMap.setv("companionList", companionList); + } + return list; + } + + @Override + public List findLineOptions(Integer year) { + Sql sql = Sqls.create("select id,lineName from the_rapy_recuperation_line $condition"); + Cnd cnd = Cnd.NEW(); + cnd.andEX("year", "=", year); + cnd.and("isDisabled", "=", false); + cnd.asc("serialNumber"); + sql.setCondition(cnd); + return listMap(sql); + } + + @Override + @Aop(TransAop.READ_COMMITTED) + public void adjustmentUsers(String lineId, String[] loginNames) { + Cnd cnd = Cnd.where("takePartInLineId", "=", lineId).and("loginName", "in", loginNames); + dao().update(RecuperationEnroll.class, Chain.makeSpecial("isNormal", "isNormal ^ 1"), cnd); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineClusterServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineClusterServiceImpl.java new file mode 100644 index 0000000..f616af1 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationLineClusterServiceImpl.java @@ -0,0 +1,263 @@ +package com.budwk.app.zhgh.staffbenefit.recuperation.service.impl; + +import com.budwk.app.base.page.Pagination; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +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.zhgh.staffbenefit.recuperation.constant.RecuperationState; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationCluster; +import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationClusterMember; +import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationLineClusterService; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @FileName com.budwk.app.zhgh.staffbenefit.recuperation.service.impl.RecuperationLineClusterServiceImpl + * @Description: 组团 + * @Author zxc + * @Date 2022/6/17:09:04 + * @Version V1.0 + **/ +@IocBean(args = {"refer:dao"}) +public class RecuperationLineClusterServiceImpl extends BaseServiceImpl implements RecuperationLineClusterService { + public RecuperationLineClusterServiceImpl(Dao dao) { + super(dao); + } + + /** + * 页面数据 + * + * @param pageForm 分页参数 + * @param year 年度 + * @param unionId 工会id + * @param keywords 关键字 + * @return {@link Pagination} + */ + @Override + public Pagination pageData(PageForm pageForm, Integer year, String unionId, String keywords) { +// Sql sql = Sqls.create(""" +// SELECT +// line.id, +// line.serialNumber, +// line.lineName, +// line.regionalNature, +// line.minimumGroupSize, +// line.`year`, +// line.isDisabled, +// line.playNumberOfDays, +// line.createUnionId, +// line.signUpStartTime, +// line.signUpEndTime, +// line.changeEndTime, +// line.createMode, +// line.signUpMode, +// gh.unionname AS ascriptionUnionName, +// gh.id AS ascriptionUnionId, +// u.username AS createUserName, +// ta.travelAgencyName, +// ( SELECT count( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInUnionId = us.unionId AND takePartInLineId = line.id AND stateId = 2750 ) AS signUpUserNum, +// ( +// SELECT +// count( 1 )\s +// FROM +// the_rapy_recuperation_enroll_companion\s +// WHERE +// trreId IN ( SELECT id FROM the_rapy_recuperation_enroll WHERE takePartInUnionId = us.unionId AND takePartInLineId = line.id AND stateId = 2750 )) AS signUpUserFamilyNum\s +// FROM +// the_rapy_recuperation_line_union_select us +// LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId +// LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = line.travelAgencyId +// LEFT JOIN sys_union gh ON gh.id = us.unionId +// LEFT JOIN sys_user u ON u.id = line.opBy +// $usCnd +// UNION ALL +// (SELECT +// line.id, +// line.serialNumber, +// line.lineName, +// line.regionalNature, +// line.minimumGroupSize, +// line.`year`, +// line.isDisabled, +// line.playNumberOfDays, +// line.createUnionId, +// line.signUpStartTime, +// line.signUpEndTime, +// line.changeEndTime, +// line.createMode, +// line.signUpMode, +// gh.unionname AS ascriptionUnionName, +// gh.id AS ascriptionUnionId, +// u.username AS createUserName, +// ta.travelAgencyName, +// ( SELECT count( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInUnionId = line.createUnionId AND takePartInLineId = line.id AND stateId = 2750 ) AS signUpUserNum, +// ( +// SELECT +// count( 1 ) +// FROM +// the_rapy_recuperation_enroll_companion +// WHERE +// trreId IN ( SELECT id FROM the_rapy_recuperation_enroll WHERE takePartInUnionId = line.createUnionId AND takePartInLineId = line.id AND stateId = 2750 )) AS signUpUserFamilyNum +// FROM +// the_rapy_recuperation_line line +// LEFT JOIN the_rapy_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.opBy +// $lineCnd) +// """); + // Cnd lineCnd = Cnd.NEW(); +// //如果是超管 前端传工会id 就不查自由模式的线路 只查线路归属分工会的线路 +// //如果是分工会管理员 不查不查自由模式的线路 由校工会去组团 +// if (AuthUtil.hasRoleOr("sysadmin,A06")) { +// if (StrUtil.isNotBlank(unionId)) { +// sql.setVar("lineCnd", Cnd.where("1", "!=", "1")); +// } else { +// lineCnd.andEX("line.year", "=", year); +// lineCnd.andEX("line.createMode", "=", RecuperationLineCreateMode.SCHOOL.getValue()); +// lineCnd.andEX("line.signUpMode", "=", RecuperationSignUpMode.FREE.getValue()); +// lineCnd.and(Cnd.likeEX("line.lineName", keywords)); +// sql.setVar("lineCnd", lineCnd); +// } +// } else { +// sql.setVar("lineCnd", Cnd.where("1", "!=", "1")); +// } +// +// Cnd usCnd = Cnd.NEW(); +// usCnd.andEX("line.year", "=", year); +// usCnd.andEX("line.signUpMode", "=", RecuperationSignUpMode.UNION.getValue()); +// usCnd.and(Cnd.likeEX("line.lineName", keywords)); +// usCnd.andEX("us.unionId", "=", unionId); +// +// //如果只是分工会管理员 us表只查询自己选择的线路 +// if (!AuthUtil.hasRoleOr("sysadmin")) { +// usCnd.andEX("us.unionId", "=", SecurityUtil.getUnionId()); +// } +// +// sql.setVar("usCnd", usCnd); + Sql sql = Sqls.create(""" + SELECT + line.id, + line.serialNumber, + line.lineName, + line.regionalNature, + COALESCE((SELECT outsideQuota FROM the_rapy_recuperation_config LIMIT 1), 0) AS minimumGroupSize, + line.`year`, + line.isDisabled, + line.createUnionId, + us.signUpStartTime, + us.signUpEndTime, + us.changeEndTime, + us.playStartTime, + us.playEndTime, + line.createMode, + line.signUpMode, + gh.name AS ascriptionUnionName, + gh.id AS ascriptionUnionId, + u.username AS createUserName, + ta.travelAgencyName, + ( SELECT count( 1 ) FROM the_rapy_recuperation_enroll $summaryCnd ) AS signUpUserNum, + ( SELECT count( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId IN ( SELECT id FROM the_rapy_recuperation_enroll $summaryCnd )) AS signUpUserFamilyNum + FROM + the_rapy_recuperation_line_union_select us + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = line.travelAgencyId + LEFT JOIN sys_union gh ON gh.id = us.unionId + LEFT JOIN sys_user u ON u.id = line.opBy + $condition + """); + Cnd cnd = Cnd.NEW(); + Cnd summaryCnd = Cnd.NEW(); + summaryCnd.and("isNormal", "=", true); + summaryCnd.and("takePartInLineId", "=", "us.id"); + summaryCnd.and("stateId", "=", RecuperationState.PASS); + //如果是超级管理和校工会管理员,查看校工会线路 + if (AuthUtil.hasRoleOr("sysadmin,A06")) { + cnd.andEX("us.unionId", "=", unionId); + cnd.andEX("us.signUpMode", "=", Strings.isNotBlank(unionId) ? 1 : 2); + }else{ + summaryCnd.and("takePartInUnionId", "=", "us.unionId"); + cnd.andEX("us.signUpMode", "=", 1); + cnd.andEX("us.unionId", "=", SecurityUtil.getUnionId()); + } + cnd.andEX("line.year", "=", year); + cnd.and(Cnd.likeEX("line.lineName", keywords)); + sql.setVar("summaryCnd", summaryCnd); + cnd.asc("line.serialNumber"); + sql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + /** + * 查询组团信息 + * + * @param lineId 线路id + * @param lineId 归属工会id + * @return {@link Object} + */ + @Override + public Object findClusterInfo(String lineId, String usUnionId) { + NutMap resMap = NutMap.NEW(); + + Sql sql = Sqls.create(""" + select + loginName, + userName, + sex, + unionName, + (select count(*) from the_rapy_recuperation_enroll_companion c where c.trreId = e.id) as companionCount + from + the_rapy_recuperation_enroll e + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("takePartInLineId", "=", lineId); + cnd.and("takePartInUnionId", "=", usUnionId); + cnd.and("isNormal", "=", 1); + cnd.and(Cnd.exps("stateId", "is", null).or("stateId", "=", RecuperationState.PASS)); + cnd.and("loginName", "not in", Sqls.create("select loginName from the_rapy_recuperation_cluster_member where lineId = @lineId AND loginName is not null").setParam("lineId", lineId)); + sql.setCondition(cnd); + List unSelectedUsers = listMap(sql); + + + resMap.put("unSelectedUsers", Map.of("clusterName", "线路未分配人员", "members", unSelectedUsers)); + + List clusters = dao().query(RecuperationCluster.class, Cnd.where("lineId", "=", lineId)); + dao().fetchLinks(clusters, null); + + if (Lang.isNotEmpty(clusters)) { + Map clusterMap = clusters.stream().collect(Collectors.toMap(v -> v.getId(), v -> v)); + resMap.putAll(clusterMap); + } + + return resMap; + } + + /** + * 设置组团成员 + * + * @param clusters 集群 + * @param lineId 行id + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void setClusterMembers(List clusters, String lineId) { + dao().clear(RecuperationCluster.class, Cnd.where("lineId", "=", lineId)); + dao().clear(RecuperationClusterMember.class, Cnd.where("lineId", "=", lineId)); + for (RecuperationCluster cluster : clusters) { + insertWith(cluster, "members"); + } + } +} 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 index edf87f1..23e2226 100644 --- 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 @@ -79,15 +79,15 @@ public class RecuperationLineSelectServiceImpl extends BaseServiceImpl getHasSelectLineIds() { Sql sql = Sqls.create(""" - select lineId from recuperation_line_select + select lineId from the_rapy_recuperation_line_union_select where selectUserId = @userId """); sql.setParam("userId", SecurityUtil.getUserId()); @@ -176,7 +176,7 @@ public class RecuperationLineSelectServiceImpl extends BaseServiceImpl unionSelectList = dao().query(RecuperationLineSelect.class, Cnd.where("lineId", "=", lineId)); if (Lang.isNotEmpty(unionSelectList)) { @@ -61,6 +66,7 @@ public class RecuperationLineServiceImpl extends BaseServiceImpl list = pagination.getList(); @@ -161,6 +178,82 @@ public class RecuperationLineServiceImpl extends BaseServiceImpl validLineQuota(String lineUnionSelectId, String enrollId) { + if (StrUtil.isBlank(lineUnionSelectId)) { + return Map.of(false, "参数错误"); + } + RecuperationLineSelect unionSelect = dao().fetch(RecuperationLineSelect.class, lineUnionSelectId); + if (unionSelect == null || StrUtil.isBlank(unionSelect.getLineId())) { + return Map.of(false, "线路信息不存在"); + } + RecuperationLine line = fetch(unionSelect.getLineId()); + if (line == null) { + return Map.of(false, "线路信息不存在"); + } + if (line.getMaxSignUpNumber() == null || line.getMaxSignUpNumber() <= 0) { + return Map.of(true, "验证成功"); + } + String loginName = SecurityUtil.getUserLoginname(); + Integer year = line.getYear() == null ? DateUtil.thisYear() : line.getYear(); + if (StrUtil.isNotBlank(loginName) && hasCurrentUserLineSignUp(loginName, line.getId(), enrollId, year)) { + return Map.of(true, "验证成功"); + } + if (countLineSignUpUsers(line.getId(), enrollId, year) >= line.getMaxSignUpNumber()) { + return Map.of(false, "当前线路报名人数已满"); + } + return Map.of(true, "验证成功"); + } + + /** 判断当前用户是否已经占用该线路名额,编辑同一报名时不重复占用。 */ + private boolean hasCurrentUserLineSignUp(String loginName, String lineId, String excludeEnrollId, Integer year) { + Sql sql = Sqls.create(""" + SELECT count(1) + FROM the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = enroll.takePartInLineId + WHERE enroll.loginName = @loginName + AND us.lineId = @lineId + AND enroll.isNormal = true + AND enroll.stateId NOT IN ($auditFailStates) + AND YEAR(enroll.signingUptime) = @year + $excludeEnrollCnd + """); + fillLineQuotaSql(sql, lineId, excludeEnrollId, year); + sql.setParam("loginName", loginName); + sql.setCallback(Sqls.callback.integer()); + dao().execute(sql); + return sql.getInt() > 0; + } + + /** 按工号统计线路已报名人数,排除取消及审核失败记录。 */ + private int countLineSignUpUsers(String lineId, String excludeEnrollId, Integer year) { + Sql sql = Sqls.create(""" + SELECT count(distinct enroll.loginName) + FROM the_rapy_recuperation_enroll enroll + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = enroll.takePartInLineId + WHERE us.lineId = @lineId + AND enroll.isNormal = true + AND enroll.stateId NOT IN ($auditFailStates) + AND YEAR(enroll.signingUptime) = @year + $excludeEnrollCnd + """); + fillLineQuotaSql(sql, lineId, excludeEnrollId, year); + sql.setCallback(Sqls.callback.integer()); + dao().execute(sql); + return sql.getInt(); + } + + /** 统一填充线路名额统计 SQL 的状态、年度及编辑排除条件。 */ + private void fillLineQuotaSql(Sql sql, String lineId, String excludeEnrollId, Integer year) { + sql.setParam("lineId", lineId); + sql.setParam("year", year); + sql.setVar("auditFailStates", RecuperationState.UNITFAIL + "," + RecuperationState.LINEUNITFAIL + "," + RecuperationState.SCHOOLFAIL); + sql.setVar("excludeEnrollCnd", StrUtil.isBlank(excludeEnrollId) ? "" : "AND enroll.id != @excludeEnrollId"); + if (StrUtil.isNotBlank(excludeEnrollId)) { + sql.setParam("excludeEnrollId", excludeEnrollId); + } + } + @Override @CacheRemove(cacheKey = "${args[0]}_selectLineInfoById") public void deleteLineInfoCache(String lineId) { @@ -171,6 +264,7 @@ public class RecuperationLineServiceImpl extends BaseServiceImpl viewUnionSelectTimeInfo(String lineId) { Sql sql = Sqls.create(""" SELECT + us.unionId, us.signUpStartTime, us.signUpEndTime, us.changeEndTime, @@ -178,10 +272,10 @@ public class RecuperationLineServiceImpl extends BaseServiceImpl implements RecuperationProvinceFlexibleGroupService { + + public RecuperationProvinceFlexibleGroupServiceImpl(Dao dao) { + super(dao); + } + + /** + * 分页查询省内灵活组团列表,按当前登录角色限制分工会可见范围。 + * + * @param pageForm 分页参数 + * @param year 年度 + * @param days 兼容旧页面参数,当前不再参与筛选 + * @param groupName 组团名称 + * @param unionId 创建工会 + * @param travelAgencyId 旅行社 + * @return 分页数据 + */ + @Override + public Pagination pageData(PageForm pageForm, Integer year, String days, String groupName, String unionId, String travelAgencyId) { + Sql sql = Sqls.create(""" + SELECT + fg.id, + fg.sortNumber, + fg.groupName, + fg.days, + fg.year, + fg.isDisabled, + fg.createUnionId, + fg.signUpStartTime, + fg.signUpEndTime, + fg.changeEndTime, + fg.activityStartTime, + fg.activityEndTime, + fg.files, + fg.contactPerson, + fg.contactNumber, + fg.contactPerson2, + fg.contactNumber2, + fg.contactPerson3, + fg.contactNumber3, + fg.maxSignUpNumber, + (select count(distinct enroll.loginName) from the_rapy_recuperation_enroll enroll where enroll.takePartInTravelAgencyId = fg.travelAgencyId and enroll.isNormal = true and enroll.stateId not in ($auditFailStates) and YEAR(enroll.signingUptime) = fg.year) as signUpUserNum, + gh.name createUnionName, + u.username createUserName, + ta.travelAgencyName, + ta.contact, + ta.contactMobileNumber, + ta.officialWebsite + FROM + the_rapy_recuperation_province_flexible_group fg + LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = fg.travelAgencyId + LEFT JOIN sys_union gh ON gh.id = fg.createUnionId + LEFT JOIN sys_user u ON u.id = fg.opBy + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.where().andEX("fg.`year`", "=", year); + cnd.andEX("fg.travelAgencyId", "=", travelAgencyId); + cnd.and(Cnd.likeEX("fg.groupName", groupName)); + if (!AuthUtil.hasRoleOr("sysadmin", "A06")) { + if (AuthUtil.hasRoleOr("H04")) { + cnd.and("fg.createUnionId", "=", SecurityUtil.getUnionId()); + } + } else { + cnd.andEX("fg.createUnionId", "=", unionId); + } + cnd.desc("fg.`year`"); + cnd.asc("fg.sortNumber"); + cnd.asc("fg.id"); + sql.setVar("auditFailStates", String.join(",", Arrays.asList( + String.valueOf(RecuperationState.UNITFAIL), + String.valueOf(RecuperationState.LINEUNITFAIL), + String.valueOf(RecuperationState.SCHOOLFAIL) + ))); + sql.setCondition(cnd); + return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + /** + * 查询省内灵活组团详情,包含旅行社信息。 + * + * @param id 省内灵活组团id + * @return 省内灵活组团详情 + */ + @Override + public RecuperationProvinceFlexibleGroup selectFlexibleGroupById(String id) { + return fetchLinks(fetch(id), "travelAgency"); + } + + /** + * 查询手机端省内灵活组团可选择的活动日期,供报名弹窗日历使用。 + * + * @param id 省内灵活组团id + * @param enrollId 当前编辑的报名记录id,新增报名时为空 + * @return 可选日期、已满日期和活动范围 + */ + @Override + public NutMap selectFlexibleGroupTimeArray(String id, String enrollId) { + RecuperationProvinceFlexibleGroup flexibleGroup = fetchLinks(fetch(id), "travelAgency"); + if (flexibleGroup == null || flexibleGroup.getActivityStartTime() == null || flexibleGroup.getActivityEndTime() == null) { + return NutMap.NEW() + .setv("days", Collections.emptyList()) + .setv("holidays", Collections.emptyList()) + .setv("fullDays", Collections.emptySet()) + .setv("usedDays", Collections.emptySet()) + .setv("minDate", "") + .setv("maxDate", ""); + } + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate startDate = LocalDate.parse(DateUtil.formatDate(flexibleGroup.getActivityStartTime()), formatter); + LocalDate endDate = LocalDate.parse(DateUtil.formatDate(flexibleGroup.getActivityEndTime()), formatter); + LocalDate currentDate = LocalDate.now().isAfter(startDate) ? LocalDate.now() : startDate; + List resultDates = new ArrayList<>(); + while (!currentDate.isAfter(endDate)) { + resultDates.add(currentDate.format(formatter)); + currentDate = currentDate.plusDays(1); + } + + Set fullDays = getFlexibleGroupFullDays(flexibleGroup, resultDates, enrollId); + Set usedDays = getFlexibleGroupUsedDays(flexibleGroup.getYear(), enrollId); + return NutMap.NEW() + .setv("days", resultDates) + .setv("availableDays", Collections.emptyList()) + .setv("holidays", Collections.emptyList()) + .setv("fullDays", fullDays) + .setv("usedDays", usedDays) + .setv("minDate", DateUtil.formatDate(flexibleGroup.getActivityStartTime())) + .setv("maxDate", DateUtil.formatDate(flexibleGroup.getActivityEndTime())); + } + + /** + * 校验灵活组团最大报名数。最大报名数为空或小于等于0时表示不限额,同一人同年度同旅行社多条记录只占一个名额。 + */ + @Override + public Map validFlexibleGroupQuota(String id, String enrollId) { + if (StrUtil.isBlank(id)) { + return Map.of(false, "参数错误"); + } + RecuperationProvinceFlexibleGroup flexibleGroup = fetch(id); + if (flexibleGroup == null) { + return Map.of(false, "灵活组团信息不存在"); + } + if (flexibleGroup.getMaxSignUpNumber() == null || flexibleGroup.getMaxSignUpNumber() <= 0) { + return Map.of(true, "验证成功"); + } + String loginName = SecurityUtil.getUserLoginname(); + Integer year = flexibleGroup.getYear() == null ? DateUtil.thisYear() : flexibleGroup.getYear(); + if (StrUtil.isNotBlank(loginName) && hasCurrentUserTravelAgencySignUp(loginName, flexibleGroup.getTravelAgencyId(), enrollId, year)) { + return Map.of(true, "验证成功"); + } + int signUpCount = countTravelAgencySignUpUsers(flexibleGroup.getTravelAgencyId(), enrollId, year); + if (signUpCount >= flexibleGroup.getMaxSignUpNumber()) { + return Map.of(false, "当前灵活组团报名人数已满"); + } + return Map.of(true, "验证成功"); + } + + /** + * 省内灵活组团使用组团自身最大报名数,同一人在同年度同旅行社多条历史记录只占一个名额。 + */ + private Set getFlexibleGroupFullDays(RecuperationProvinceFlexibleGroup flexibleGroup, List resultDates, String excludeEnrollId) { + if (flexibleGroup.getMaxSignUpNumber() == null || flexibleGroup.getMaxSignUpNumber() <= 0) { + return Collections.emptySet(); + } + String loginName = SecurityUtil.getUserLoginname(); + Integer year = flexibleGroup.getYear() == null ? DateUtil.thisYear() : flexibleGroup.getYear(); + if (StrUtil.isNotBlank(loginName) && hasCurrentUserTravelAgencySignUp(loginName, flexibleGroup.getTravelAgencyId(), excludeEnrollId, year)) { + return Collections.emptySet(); + } + int signUpCount = countTravelAgencySignUpUsers(flexibleGroup.getTravelAgencyId(), excludeEnrollId, year); + if (signUpCount >= flexibleGroup.getMaxSignUpNumber()) { + return new HashSet<>(resultDates); + } + return Collections.emptySet(); + } + + /** + * 判断当前用户是否已在该旅行社占用名额,兼容历史同年度多条灵活组团记录不重复占用。 + */ + private boolean hasCurrentUserTravelAgencySignUp(String loginName, String travelAgencyId, String excludeEnrollId, Integer year) { + Cnd cnd = Cnd.where("loginName", "=", loginName) + .and("takePartInTravelAgencyId", "=", travelAgencyId) + .and("isNormal", "=", true) + .and("stateId", "not in", Lang.array(RecuperationState.UNITFAIL, RecuperationState.LINEUNITFAIL, RecuperationState.SCHOOLFAIL)) + .and("YEAR(signingUptime)", "=", year == null ? DateUtil.thisYear() : year); + if (StrUtil.isNotBlank(excludeEnrollId)) { + cnd.and("id", "!=", excludeEnrollId); + } + return dao().count(RecuperationEnroll.class, cnd) > 0; + } + + /** + * 统计旅行社报名人数,按工号去重,避免两条灵活组团记录重复计算同一人。 + */ + private int countTravelAgencySignUpUsers(String travelAgencyId, String excludeEnrollId, Integer year) { + Sql sql = Sqls.create(""" + SELECT + count(distinct loginName) + FROM + the_rapy_recuperation_enroll + WHERE + takePartInTravelAgencyId = @travelAgencyId + AND isNormal = true + AND stateId NOT IN ($auditFailStates) + AND YEAR(signingUptime) = @year + $excludeEnrollCnd + """); + sql.setParam("travelAgencyId", travelAgencyId); + sql.setParam("year", year == null ? DateUtil.thisYear() : year); + sql.setVar("auditFailStates", String.join(",", Arrays.asList( + String.valueOf(RecuperationState.UNITFAIL), + String.valueOf(RecuperationState.LINEUNITFAIL), + String.valueOf(RecuperationState.SCHOOLFAIL) + ))); + sql.setVar("excludeEnrollCnd", StrUtil.isBlank(excludeEnrollId) ? "" : "AND id != @excludeEnrollId"); + if (StrUtil.isNotBlank(excludeEnrollId)) { + sql.setParam("excludeEnrollId", excludeEnrollId); + } + sql.setCallback(Sqls.callback.integer()); + dao().execute(sql); + return sql.getInt(); + } + + /** + * 查询当前登录人已报名省内灵活组团覆盖到的具体日期,供手机端日历置灰。 + */ + private Set getFlexibleGroupUsedDays(Integer year, String excludeEnrollId) { + String loginName = SecurityUtil.getUserLoginname(); + if (StrUtil.isBlank(loginName)) { + return Collections.emptySet(); + } + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + Set usedDays = new HashSet<>(); + Cnd cnd = Cnd.where("loginName", "=", loginName) + .and("isNormal", "=", true) + .and("takePartInTravelAgencyId", "is not", null) + .and("stateId", "not in", Lang.array(RecuperationState.UNITFAIL, RecuperationState.LINEUNITFAIL, RecuperationState.SCHOOLFAIL)) + .and("YEAR(signingUptime)", "=", year == null ? DateUtil.thisYear() : year); + if (StrUtil.isNotBlank(excludeEnrollId)) { + cnd.and("id", "!=", excludeEnrollId); + } + List signedEnrolls = dao().query(RecuperationEnroll.class, cnd); + for (RecuperationEnroll signedEnroll : signedEnrolls) { + if (signedEnroll.getTakePartInTime() == null || StrUtil.isBlank(signedEnroll.getLotId())) { + continue; + } + int dayCount = getFlexibleGroupDayCount(signedEnroll.getLotId()); + if (dayCount <= 0) { + continue; + } + LocalDate startDate = LocalDate.parse(DateUtil.formatDate(signedEnroll.getTakePartInTime()), formatter); + for (int i = 0; i < dayCount; i++) { + usedDays.add(startDate.plusDays(i).format(formatter)); + } + } + return usedDays; + } + + /** + * 将中文天数转换为实际天数,用于计算已报名日期范围。 + */ + private int getFlexibleGroupDayCount(String dayText) { + if (StrUtil.isBlank(dayText)) { + return 0; + } + if (dayText.contains("两") || dayText.contains("2")) { + return 2; + } + if (dayText.contains("三") || dayText.contains("3")) { + return 3; + } + if (dayText.contains("五") || dayText.contains("5")) { + return 5; + } + try { + return Integer.parseInt(dayText.replace("天", "")); + } catch (NumberFormatException e) { + return 0; + } + } + + /** + * 批量统赋省内灵活组团报名时间,只更新勾选组团的三个报名时间字段。 + * + * @param ids 省内灵活组团id数组 + * @param signUpStartTime 报名开始时间 + * @param signUpEndTime 报名结束时间 + * @param changeEndTime 变更截至时间 + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void batchAssignSignUpTimes(String[] ids, Date signUpStartTime, Date signUpEndTime, Date changeEndTime) { + if (Lang.isEmpty(ids)) { + return; + } + Chain chain = Chain.make("signUpStartTime", signUpStartTime) + .add("signUpEndTime", signUpEndTime) + .add("changeEndTime", changeEndTime); + update(chain, Cnd.where("id", "in", ids)); + } + + /** + * 保存省内灵活组团信息,服务层统一补齐创建人和操作时间。 + * + * @param flexibleGroup 省内灵活组团信息 + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void submitFlexibleGroup(RecuperationProvinceFlexibleGroup flexibleGroup) { + flexibleGroup.setOpBy(SecurityUtil.getUserId()); + flexibleGroup.setCreateUnionId(SecurityUtil.getUnionId()); + flexibleGroup.setOpAt(String.valueOf(new Date().getTime())); + insertOrUpdate(flexibleGroup); + } + + /** + * 切换省内灵活组团启用状态。 + * + * @param id 省内灵活组团id + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void openClosedFlexibleGroup(String id) { + update(Chain.makeSpecial("isDisabled", "isDisabled ^ 1"), Cnd.where("id", "=", id)); + } + + /** + * 删除省内灵活组团。 + * + * @param id 省内灵活组团id + */ + @Override + @Aop(TransAop.READ_COMMITTED) + public void deleteFlexibleGroup(String id) { + delete(id); + } + + /** + * 查询旅行社编辑页中“是否灵活组团”为是且未禁用的旅行社。 + * + * @param year 年度 + * @return 旅行社列表 + */ + @Override + public List selectFlexibleTravelAgency(Integer year) { + Cnd cnd = Cnd.NEW(); + cnd.andEX("year", "=", year); + cnd.and("isDisabled", "=", false); + cnd.and("signUpTravelAgency", "=", true); + cnd.asc("serialNumber * 1"); + return dao().query(RecuperationTravelAgency.class, cnd); + } +} diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationTravelAgencyServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationTravelAgencyServiceImpl.java index 1e2917d..314228b 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationTravelAgencyServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/recuperation/service/impl/RecuperationTravelAgencyServiceImpl.java @@ -3,15 +3,19 @@ package com.budwk.app.zhgh.staffbenefit.recuperation.service.impl; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.param.PageForm; import com.budwk.app.base.service.impl.BaseServiceImpl; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.staffbenefit.recuperation.constant.RecuperationState; import com.budwk.app.zhgh.staffbenefit.recuperation.model.RecuperationTravelAgency; import com.budwk.app.zhgh.staffbenefit.recuperation.service.RecuperationTravelAgencyService; import lombok.extern.slf4j.Slf4j; import org.nutz.dao.Chain; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.ioc.aop.Aop; import java.util.List; @@ -31,21 +35,25 @@ public class RecuperationTravelAgencyServiceImpl extends BaseServiceImpl selectAllTravelAgencyByYear(Cnd cnd) { return dao().query(RecuperationTravelAgency.class, cnd); @@ -79,13 +110,14 @@ public class RecuperationTravelAgencyServiceImpl extends BaseServiceImpl \ No newline at end of file diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/audit/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/audit/index.html new file mode 100644 index 0000000..d2ee6ec --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/audit/index.html @@ -0,0 +1,11 @@ + +
+ + + {{viewData.loginName}}{{viewData.userName}}{{viewData.idCard}}{{viewData.mobile}}{{viewData.lineName}}{{viewData.travelAgencyName}} + +
+ + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/basicForm.js b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/basicForm.js index e699882..44ac1ae 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/basicForm.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/baseManagement/basicForm.js @@ -177,8 +177,8 @@ const basicForm = { @@ -188,8 +188,8 @@ const basicForm = { - - + @@ -198,7 +198,7 @@ const basicForm = { 取消 - 提交 + 提交 `, @@ -263,10 +263,11 @@ const basicForm = { callback() } return { + formLoading: false, localTravelList: [...this.travelList], localLotList: [...this.lotList], formData: { - isDisabled: true + isDisabled: false }, formRules: { sortNumber: [{required: false, message: '请输入排序编号', trigger: ['change', 'blur']}], @@ -292,13 +293,15 @@ const basicForm = { const lot = this.localLotList.find(o => o.id === this.formData.lotId) if (lot) this.$set(this.formData, 'estimatedCost', lot.estimatedCost) }, - async yearChange() { + yearChange() { this.$set(this.formData, 'travelAgencyId', null) - await this.selectTravelAgencyList() + this.selectTravelAgencyList() }, - async selectTravelAgencyList() { - const resp = await this.$axios.post('/platform/recuperation/travelAgency/selectTravelAgency', {year: this.formData.year}) - this.localTravelList = resp.data + selectTravelAgencyList() { + return this.$axios.post('/platform/recuperation/travelAgency/selectTravelAgency', {year: this.formData.year}) + .then((resp) => { + this.localTravelList = resp.data + }) }, onOpen(row) { if(row && row.id) { @@ -317,14 +320,20 @@ const basicForm = { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(async () => { - const resp = await this.$axios.post("/platform/recuperation/baseManagement/onSubmit", this.formData) - if (resp.code === 0) { - this.$message.success(resp.msg) - this.$emit('refresh') - } else { - this.$message.warning(resp.msg) - } + }).then(() => { + this.formLoading = true + this.$axios.post("/platform/recuperation/baseManagement/onSubmit", this.formData) + .then((resp) => { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.$emit('refresh') + } else { + this.$message.warning(resp.msg) + } + }) + .finally(() => { + this.formLoading = false + }) }) } }) 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 5f9f4ed..845f6e6 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 @@ -75,7 +75,7 @@ layout("/layouts/platform.html"){ 新增目的地 - + { + this.travelAgencyList = resp.data + }) }, - async getModifyBd() { - const res = await this.$axios.post('/platform/recuperation/config/fetchOne') - if (res.code === 0) { - this.modifyBdList = res.data.lots - } + getModifyBd() { + return this.$axios.post('/platform/recuperation/config/fetchOne').then((res) => { + if (res.code === 0) { + this.modifyBdList = res.data.lots + } + }) }, - async baseStatusChange(id) { - const resp = await this.$axios.post(loc() + '/openClosedBase/' + id) - if (resp.code === 0) { - this.$message.success(resp.msg) - } else { - this.$message.warning(resp.msg) - } + baseStatusChange(id) { + this.$axios.post(loc() + '/openClosedBase/' + id).then((resp) => { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.pageData() + } else { + this.$message.warning(resp.msg) + } + }) }, refresh() { this.doSearch() @@ -222,21 +227,26 @@ layout("/layouts/platform.html"){ .catch(() => {}) }, pageData() { - this.$axios.post(loc() + "/pageData", this.pageForm).then((res) => { - if (res.code === 0) { - this.tableData = res.data.list - this.pageForm.totalCount = res.data.totalCount - } - }) + this.tableLoading = true + this.$axios.post(loc() + "/pageData", this.pageForm) + .then((res) => { + if (res.code === 0) { + this.tableData = res.data.list + this.pageForm.totalCount = res.data.totalCount + } + }) + .finally(() => { + this.tableLoading = false + }) }, - async initData() { - await this.getModifyBd() - await this.selectTravelAgencyList() + initData() { + return Promise.all([this.getModifyBd(), this.selectTravelAgencyList()]) }, }, - async created() { - await this.initData() - this.pageData() + created() { + this.initData().then(() => { + this.pageData() + }) } }) diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/joinUserImport/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/joinUserImport/index.html new file mode 100644 index 0000000..501d822 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/joinUserImport/index.html @@ -0,0 +1,9 @@ + +
+ 上传参加人员 Excel下载模板 + 确认标记参加 +
+ + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/basicForm.js b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/basicForm.js index b9a3425..d6dfd72 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/basicForm.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/basicForm.js @@ -152,8 +152,8 @@ const basicForm = { @@ -163,8 +163,8 @@ const basicForm = {
- - + @@ -173,7 +173,7 @@ const basicForm = { 取消 - 提交 + 提交 `, @@ -231,13 +231,14 @@ const basicForm = { callback() } return { + formLoading: false, config: {}, regionalNatureList: [], localTravelList: [...this.travelList], localLotList: [...this.lotList], signUpModeList: [...this.signList], formData: { - isDisabled: true + isDisabled: false }, formRules: { serialNumber: [{required: true, message: '请输入排序号', trigger: ['change', 'blur']}], @@ -268,27 +269,29 @@ const basicForm = { return roles.some(r => r === 'BRANCH_UNION_ADMIN' || r === 'BRANCH_UNION_CHAIRMAN') } }, - async getConfig() { - const resp = await $.get('/platform/recuperation/config/fetchOne') - if (resp.code === 0) { - this.config = resp.data - } + getConfig() { + return $.get('/platform/recuperation/config/fetchOne') + .then((resp) => { + if (resp.code === 0) { + this.config = resp.data + } + }) }, - async yearChange() { + yearChange() { this.$set(this.formData, 'travelAgencyId', null) - await this.selectTravelAgencyList() + this.selectTravelAgencyList() }, - async selectTravelAgencyList() { - const resp = await this.$axios.post('/platform/recuperation/travelAgency/selectTravelAgency', {year: this.formData.year}) - this.localTravelList = resp.data + selectTravelAgencyList() { + return this.$axios.post('/platform/recuperation/travelAgency/selectTravelAgency', {year: this.formData.year}) + .then((resp) => { + this.localTravelList = resp.data + }) }, - async getCreateMode() { - const resp = await this.$axios.get(loc() + '/getCreateMode') - if (resp.code === 0) { - return resp.data - } + getCreateMode() { + return this.$axios.post(loc() + '/getCreateMode') + .then((resp) => resp.code === 0 ? resp.data : null) }, - async onOpen(row) { + onOpen(row) { if (row && row.id) { this.$axios.post(loc() + '/selectLineInfoById/' + row.id) .then((resp) => { @@ -297,16 +300,20 @@ const basicForm = { this.formData = {...data} }) } else { - await this.getNumber() - const createMode = await this.getCreateMode() - this.$set(this.formData, 'createMode', createMode) - if (createMode === 1) { - this.$set(this.formData, 'signUpMode', 1) - } - await this.getConfig() - if (this.config) { - this.$set(this.formData, 'minimumGroupSize', this.config.groupNumber) - } + this.getNumber() + .then(() => this.getCreateMode()) + .then((createMode) => { + this.$set(this.formData, 'createMode', createMode) + if (createMode === 1) { + this.$set(this.formData, 'signUpMode', 1) + } + return this.getConfig() + }) + .then(() => { + if (this.config) { + this.$set(this.formData, 'minimumGroupSize', this.config.groupNumber) + } + }) } }, onSubmit() { @@ -316,29 +323,40 @@ const basicForm = { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(async () => { - const resp = await this.$axios.post("/platform/recuperation/line/onSubmit", this.formData) - if (resp.code === 0) { - this.$message.success(resp.msg) - this.$emit('refresh') - } else { - this.$message.warning(resp.msg) - } + }).then(() => { + this.formLoading = true + this.$axios.post("/platform/recuperation/line/onSubmit", this.formData) + .then((resp) => { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.$emit('refresh') + } else { + this.$message.warning(resp.msg) + } + }) + .finally(() => { + this.formLoading = false + }) }) } }) }, - async getEnumOptions(enumName) { - const resp = await this.$axios.post("/open/common/dictEnumOptions", { name: enumName }) - return resp.data + getEnumOptions(enumName) { + return this.$axios.post("/open/common/dictEnumOptions", { name: enumName }) + .then((resp) => resp.data) }, - async getNumber() { - const resp = await this.$axios.post(loc() + '/getNo') - this.$set(this.formData, 'serialNumber', resp.data) + getNumber() { + return this.$axios.post(loc() + '/getNo') + .then((resp) => { + this.$set(this.formData, 'serialNumber', resp.data) + }) }, }, - async created() { - this.regionalNatureList = await this.getEnumOptions('RecuperationProvinceType') + created() { + this.getEnumOptions('RecuperationProvinceType') + .then((data) => { + this.regionalNatureList = data + }) }, style: /*language=CSS*/ ` diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/index.html index 054c28a..c5210d4 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/index.html @@ -94,7 +94,7 @@ layout("/layouts/platform.html"){ 新增线路 - + { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.pageData() + } else { + this.$message.warning(resp.msg) + } + }) }, - async getEnumOptions(enumName) { - const resp = await this.$axios.post("/open/common/dictEnumOptions", { name: enumName }) - return resp.data + getEnumOptions(enumName) { + return this.$axios.post("/open/common/dictEnumOptions", { name: enumName }).then((resp) => resp.data) }, signUpModeName(val) { const d = this.signUpModeList.find(v => v.value === val) return d ? d.label : null }, - async selectTravelAgencyList() { - const resp = await this.$axios.post('/platform/recuperation/travelAgency/selectTravelAgency', {year: this.formData.year}) - this.travelAgencyList = resp.data + selectTravelAgencyList() { + const year = this.pageForm.endYear || this.pageForm.startYear || new Date().getFullYear() + return this.$axios.post('/platform/recuperation/travelAgency/selectTravelAgency', {year: year}).then((resp) => { + this.travelAgencyList = resp.data + }) }, - async getModifyBd() { - const res = await this.$axios.post('/platform/recuperation/config/fetchOne') - if (res.code === 0) { - this.lotList = res.data?.lots - } + getModifyBd() { + return this.$axios.post('/platform/recuperation/config/fetchOne').then((res) => { + if (res.code === 0) { + this.lotList = res.data ? res.data.lots : [] + } + }) }, handleChangeYear(){ if (this.pageForm.startYear && this.pageForm.endYear){ @@ -223,13 +227,15 @@ layout("/layouts/platform.html"){ } } }, - async travelAgencyStatusChange(id) { - const resp = await $.post(loc() + '/openClosedLine/' + id) - if (resp.code === 0) { - this.$message.success(resp.msg) - } else { - this.$message.warning(resp.msg) - } + travelAgencyStatusChange(id) { + $.post(loc() + '/openClosedLine/' + id).then((resp) => { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.pageData() + } else { + this.$message.warning(resp.msg) + } + }).always(() => {}) }, refresh() { this.doSearch() @@ -267,23 +273,34 @@ layout("/layouts/platform.html"){ .catch(() => {}) }, pageData() { - this.$axios.post(loc() + "/pageData", this.pageForm).then((res) => { - if (res.code === 0) { - this.tableData = res.data.list - this.pageForm.totalCount = res.data.totalCount - } - }) + this.tableLoading = true + this.$axios.post(loc() + "/pageData", this.pageForm) + .then((res) => { + if (res.code === 0) { + this.tableData = res.data.list + this.pageForm.totalCount = res.data.totalCount + } + }) + .finally(() => { + this.tableLoading = false + }) }, - async initData() { - await this.getModifyBd() - await this.selectTravelAgencyList() - this.signUpModeList = await this.getEnumOptions('RecuperationSignUpMode') - this.unionOptions = await this.$businessTool.listUnion() + initData() { + return Promise.all([ + this.getModifyBd(), + this.selectTravelAgencyList(), + this.getEnumOptions('RecuperationSignUpMode'), + this.$businessTool.listUnion() + ]).then((values) => { + this.signUpModeList = values[2] + this.unionOptions = values[3] + }) } }, - async created() { - await this.initData() - this.pageData() + created() { + this.initData().then(() => { + this.pageData() + }) } }) diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/info.js b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/info.js index 8777d37..90fbb79 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/info.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/line/info.js @@ -53,23 +53,22 @@ const info = { } }, methods: { - async onOpen(lineId, usUnionId) { - await this.findOne(lineId, usUnionId) + onOpen(lineId, usUnionId) { + return this.findOne(lineId, usUnionId) }, - async findOne(id, unionId) { - const resp = await this.$axios.get('/platform/recuperation/line/selectLineInfoById/' + id) - if (resp.code === 0) { - this.viewData = resp.data - } + findOne(id, unionId) { + return this.$axios.get('/platform/recuperation/line/selectLineInfoById/' + id).then((resp) => { + if (resp.code === 0) { + this.viewData = resp.data + } + }) }, - async findUnionSelectLineData(lineId, unionId) { - const resp = await this.$axios.post('/platform/recuperation/lineFghSelect/selectLineInfo', { - lineId: lineId, - unionId: unionId + findUnionSelectLineData(lineId, unionId) { + return this.$axios.post('/platform/recuperation/line/viewUnionSelectTimeInfo/' + lineId).then((resp) => { + if (resp.code === 0 && resp.data) { + this.times = unionId ? resp.data.filter((item) => item.unionId === unionId) : resp.data + } }) - if (resp.code === 0 && resp.data) { - this.times = resp.data - } } }, style: /*language=CSS*/ ` diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/lineAdjustment/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/lineAdjustment/index.html new file mode 100644 index 0000000..aa6b4d3 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/lineAdjustment/index.html @@ -0,0 +1,10 @@ + +
+ + + +
+ + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/lineCluster/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/lineCluster/index.html new file mode 100644 index 0000000..1018bae --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/lineCluster/index.html @@ -0,0 +1,15 @@ + +
+ + + + + + + + +
+ + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/provinceFlexibleGroup/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/provinceFlexibleGroup/index.html new file mode 100644 index 0000000..77a2d7f --- /dev/null +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/provinceFlexibleGroup/index.html @@ -0,0 +1,90 @@ + +
+ + + + + + + + 新增组团 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/basicForm.js b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/basicForm.js index f8843d3..58fe14d 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/basicForm.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/basicForm.js @@ -15,18 +15,39 @@ const basicForm = { + + + + + + + + + + + + + + + + + + + + + - - + 取消 - 提交 + 提交 `, data() { return { + formLoading: false, formData: { - isDisabled: true + isDisabled: false, + signUpTravelAgency: false }, formRules: { serialNumber: [{required: true, message: '请输入编号', trigger: ['change', 'blur']}], travelAgencyName: [{required: true, message: '请输入旅行社名称', trigger: ['change', 'blur']}], + signUpTravelAgency: [{required: true, message: '请选择是否灵活组团', trigger: ['change', 'blur']}], contact: [{required: true, message: '请输入联系人姓名', trigger: ['change', 'blur']}], contactMobileNumber: [ {required: true, message: '请输入联系人电话', trigger: 'blur',}, @@ -98,14 +122,20 @@ const basicForm = { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(async () => { - const resp = await this.$axios.post("/platform/recuperation/travelAgency/onSubmit", this.formData) - if (resp.code === 0) { - this.$message.success(resp.msg) - this.$emit('refresh') - } else { - this.$message.warning(resp.msg) - } + }).then(() => { + this.formLoading = true + this.$axios.post("/platform/recuperation/travelAgency/onSubmit", this.formData) + .then((resp) => { + if (resp.code === 0) { + this.$message.success(resp.msg) + this.$emit('refresh') + } else { + this.$message.warning(resp.msg) + } + }) + .finally(() => { + this.formLoading = false + }) }) } }) diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/index.html index 072c660..ab9412c 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/recuperation/travelAgency/index.html @@ -39,7 +39,7 @@ layout("/layouts/platform.html"){ 新增旅行社 - +