diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java index 19d7c0a..6c7dbfd 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollController.java @@ -85,8 +85,8 @@ public class TheRapyRecuperationEnrollController { @POST @ViReturn @RequiresAuthentication - public Object pageData(PageForm pageForm, Integer year, String unionId, int theRapyRecuperationType, Integer lineUnionType) { - return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType); + public Object pageData(PageForm pageForm, Integer year, String unionId, int theRapyRecuperationType, Integer lineUnionType, String routeName, String lotId) { + return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType, routeName, lotId); } @At diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java index 33b0b21..d15f364 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollService.java @@ -27,7 +27,7 @@ public interface TheRapyRecuperationEnrollService extends ViService getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java index 4bc1495..f5b2374 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java @@ -65,7 +65,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' as char) as fileId, + b.files as fileId, l.lotName, - t.travelAgencyName + t.travelAgencyName, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE b.id = takePartInBaseManagementId and isNormal=true $yearCnd) agencyNum from the_rapy_recuperation_base_management b left join the_rapy_recuperation_lot l on l.id = b.lotId left join the_rapy_recuperation_travel_agency t on t.id = b.travelAgencyId $condition """); + if (year != null) { + taSql.setVar("yearCnd", "AND YEAR(signingUptime) = '%s' ".formatted(year)); + } cnd.asc("sortNumber"); taSql.setCondition(cnd); return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); @@ -490,39 +498,52 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl 0 && enrollInfo.isNormal()) { - return Map.of(false, "报名时间已过,抱歉不能报名"); - } - - TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); - if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { - - //获取标段中的最大费用 - List lotList = dao().query(TheRapyRecuperationLot.class, Cnd.NEW()); - //最大费用 - OptionalInt optionalInt = lotList.stream().mapToInt(TheRapyRecuperationLot::getActivityCost).max(); - int maxCost = optionalInt.isPresent() ? optionalInt.getAsInt() : 0; - //获取当前报名线路对应的标段的费用 - Integer currentLineCost = dao().fetch(TheRapyRecuperationLot.class, lineInfo.getLotId()).getActivityCost(); - + //如果报酒店 + if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId()) && StrUtil.isBlank(enrollInfo.getId()) && enrollInfo.isNormal()) { Map oneYear = this.validCountOneYear(loginName, travelFrequency); - if (oneYear != null && oneYear.containsKey(false)) { + if (oneYear != null) { return oneYear; } + } - //获取起始年份到当前时间,是否报名 - Sql sql = Sqls.create(""" + Date signUpStartTime = null; + Date signUpEndTime = null; + Date changeEndTime = null; + + if (StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { + //线路信息 + TheRapyRecuperationLineUnionSelect lineUnionSelect = dao().fetch(TheRapyRecuperationLineUnionSelect.class, enrollInfo.getTakePartInLineId()); + TheRapyRecuperationLine lineInfo = dao().fetch(TheRapyRecuperationLine.class, lineUnionSelect.getLineId()); + + signUpStartTime = lineUnionSelect.getSignUpStartTime(); + signUpEndTime = lineUnionSelect.getSignUpEndTime(); + changeEndTime = lineUnionSelect.getChangeEndTime(); + + if (DateUtil.compare(new Date(), signUpStartTime) < 0) { + return Map.of(false, "报名未开始,请耐心等待"); + } + if (DateUtil.compare(new Date(), changeEndTime) > 0 && enrollInfo.isNormal()) { + return Map.of(false, "报名时间已过,抱歉不能报名"); + } + + TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); + if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { + + //获取标段中的最大费用 + List lotList = dao().query(TheRapyRecuperationLot.class, Cnd.NEW()); + //最大费用 + OptionalInt optionalInt = lotList.stream().mapToInt(TheRapyRecuperationLot::getActivityCost).max(); + int maxCost = optionalInt.isPresent() ? optionalInt.getAsInt() : 0; + //获取当前报名线路对应的标段的费用 + Integer currentLineCost = dao().fetch(TheRapyRecuperationLot.class, lineInfo.getLotId()).getActivityCost(); + + Map oneYear = this.validCountOneYear(loginName, travelFrequency); + if (oneYear != null && oneYear.containsKey(false)) { + return oneYear; + } + + //获取起始年份到当前时间,是否报名 + Sql sql = Sqls.create(""" SELECT r.*, l.regionalNature, @@ -533,69 +554,70 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl=", provinceStartYear + "-01-01"); - twoYearInCnd.and("regionalNature", "=", "省内"); - twoYearInCnd.and("isTakePartIn", "=", true); - twoYearInSql.setCondition(twoYearInCnd); - List twoYearInMapList = listMap(twoYearInSql); + //两年参加省内 + Cnd twoYearInCnd = commonCnd.clone(); + twoYearInCnd.and("signingUptime", ">=", provinceStartYear + "-01-01"); + twoYearInCnd.and("regionalNature", "=", "省内"); + twoYearInCnd.and("isTakePartIn", "=", true); + twoYearInSql.setCondition(twoYearInCnd); + List twoYearInMapList = listMap(twoYearInSql); - //今年是否报名,不管省内省外 - Cnd nowYearCnd = commonCnd.clone(); - nowYearCnd.and("signingUptime", ">=", DateUtil.thisYear() + "-01-01"); - nowYearSql.setCondition(nowYearCnd); - List nowYearMapList = listMap(nowYearSql); + //今年是否报名,不管省内省外 + Cnd nowYearCnd = commonCnd.clone(); + nowYearCnd.and("signingUptime", ">=", DateUtil.thisYear() + "-01-01"); + nowYearSql.setCondition(nowYearCnd); + List nowYearMapList = listMap(nowYearSql); - //三年参加省外 - Cnd threeYearOutCnd = commonCnd.clone(); - threeYearOutCnd.and("signingUptime", ">=", (DateUtil.thisYear() - 3) + "-01-01"); - threeYearOutCnd.and("regionalNature", "=", "省外"); - threeYearOutCnd.and("isTakePartIn", "=", true); - threeYearOutSql.setCondition(threeYearOutCnd); - List threeYearOutMapList = listMap(threeYearOutSql); + //三年参加省外 + Cnd threeYearOutCnd = commonCnd.clone(); + threeYearOutCnd.and("signingUptime", ">=", (DateUtil.thisYear() - 3) + "-01-01"); + threeYearOutCnd.and("regionalNature", "=", "省外"); + threeYearOutCnd.and("isTakePartIn", "=", true); + threeYearOutSql.setCondition(threeYearOutCnd); + List threeYearOutMapList = listMap(threeYearOutSql); - //今年是否报名,不管报省内还是省外 - if (Lang.isNotEmpty(nowYearMapList)) { - NutMap nowYearMap = nowYearMapList.get(0); - //判断当前报名的线路是否和今年第一次报名的线路重复 - if (nowYearMap.getString("takePartInLineId").equals(lineUnionSelect.getId())) { - return Map.of(false, "您已报名过当前线路,请选择其他线路"); - } - //获取第一次报名线路对应的标段的费用 - int lastLineCost = nowYearMap.getInt("activityCost"); - if ((lastLineCost + currentLineCost) > maxCost) { - return Map.of(false, "您已报名过省内线路"); - } - } - //省内线路判断 - if (trrt.getValue() == TheRapyRecuperationType.provinceInLine.getValue()) { - if (Lang.isEmpty(twoYearInMapList)) { - return Map.of(true, "验证成功"); - } - if (Lang.isNotEmpty(twoYearInMapList)) { - int hasCost = twoYearInMapList.get(0).getInt("activityCost"); - if ((hasCost + currentLineCost) > maxCost) { - return Map.of(false, "您已参加过省内线路"); + //今年是否报名,不管报省内还是省外 + if (Lang.isNotEmpty(nowYearMapList)) { + NutMap nowYearMap = nowYearMapList.get(0); + //判断当前报名的线路是否和今年第一次报名的线路重复 + if (nowYearMap.getString("takePartInLineId").equals(lineUnionSelect.getId())) { + return Map.of(false, "您已报名过当前线路,请选择其他线路"); + } + //获取第一次报名线路对应的标段的费用 + int lastLineCost = nowYearMap.getInt("activityCost"); + if ((lastLineCost + currentLineCost) > maxCost) { + return Map.of(false, "您已报名过省内线路"); } } - } - //省外线路判断 - if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue()) { - //三年内有没有参加过省外 - if (Lang.isNotEmpty(threeYearOutMapList)) { - return Map.of(false, "近三年内您已参加过省外线路,不能再次报名"); + //省内线路判断 + if (trrt.getValue() == TheRapyRecuperationType.provinceInLine.getValue()) { + if (Lang.isEmpty(twoYearInMapList)) { + return Map.of(true, "验证成功"); + } + if (Lang.isNotEmpty(twoYearInMapList)) { + int hasCost = twoYearInMapList.get(0).getInt("activityCost"); + if ((hasCost + currentLineCost) > maxCost) { + return Map.of(false, "您已参加过省内线路"); + } + } + } + //省外线路判断 + if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue()) { + //三年内有没有参加过省外 + if (Lang.isNotEmpty(threeYearOutMapList)) { + return Map.of(false, "近三年内您已参加过省外线路,不能再次报名"); + } } } } @@ -651,29 +673,33 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl validCountOneYear(String loginName, int travelFrequency) { Cnd cnd = Cnd.NEW(); cnd.and("loginName", "=", loginName); + cnd.and("isNormal", "=", true); cnd.and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear()); int joinCount = dao().count(TheRapyRecuperationEnroll.class, cnd); if (joinCount >= travelFrequency) { List inList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省内")); + List unionInSelects = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", inList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()))); List outList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省外")); + List unionOutSelects = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", outList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()))); //是否选择省外 - int inCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")) - .and("takePartInLineId", "in", inList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList())) + int inCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("loginname")) + .and("takePartInLineId", "in", unionInSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList())) .and("isNormal", "=", true) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); //是否报省外 - int outCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")) - .and("takePartInLineId", "in", outList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList())) + int outCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("loginname")) + .and("takePartInLineId", "in", unionOutSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList())) .and("isNormal", "=", true) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); //是否报旅行社 - int travelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")) - .and("takePartInLineId", "is", null).and("isNormal", "=", true) + int travelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("loginname")) + .and(Cnd.exps("takePartInLineId", "is", null).or("takePartInLineId", "=", "")) + .and("isNormal", "=", true) .and("takePartInTravelAgencyId", "is not", null) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); //是否报酒店 - int hotelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")) + int hotelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("loginname")) .and("takePartInLineId", "is", null).and("isNormal", "=", true) .and("takePartInBaseManagementId", "is not", null) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); @@ -687,7 +713,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl 0) { str = "酒店"; } - return Map.of(false, "一年只能报" + travelFrequency + "次,您已报" + str + ",请先在我的疗休养中删除,报名!"); + return Map.of(false, "一年只能报" + travelFrequency + "次,您已报" + str + ",请先在我的疗休养中删除,方可报名!"); } return Map.of(true, "成功"); } diff --git a/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html b/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html index ed760ec..973fe1f 100644 --- a/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html +++ b/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html @@ -56,18 +56,21 @@ layout("/mobile/platform.html"){ } .footer { + background-color: white; + position: fixed; + bottom: 0; width: 100%; height: 60px; display: flex; justify-content: space-evenly; align-items: center; + left: 0; } .footer .van-button { height: 34px; border-radius: 6px; width: 90% !important; - margin: 0 10px; } .submitButton .van-button { @@ -316,10 +319,10 @@ layout("/mobile/platform.html"){ @@ -359,7 +362,7 @@ layout("/mobile/platform.html"){ -
+ - + :rules="[{ required: true }]">–>
- + --> -
+ + <!––> @@ -459,7 +462,7 @@ layout("/mobile/platform.html"){ 如有随行人出行,请添加随行人
- + -->
提交报名
@@ -533,15 +536,6 @@ layout("/mobile/platform.html"){ -
- - 疗休养报名 - - 我的疗休养 - - -
- diff --git a/src/main/resources/views/mobile/therapyRecuperation/lineList.html b/src/main/resources/views/mobile/therapyRecuperation/lineList.html index aacfd80..15d8223 100644 --- a/src/main/resources/views/mobile/therapyRecuperation/lineList.html +++ b/src/main/resources/views/mobile/therapyRecuperation/lineList.html @@ -128,12 +128,12 @@ layout("/mobile/platform.html"){ } .sign_button .van-button { - width: 74px; - height: 28px; + width: 72px; + height: 26px; color: white; background: rgb(24, 103, 176); border-color: rgb(24, 103, 176); - font-size: 12px; + font-size: 11px; border-radius: 6px; } @@ -145,7 +145,7 @@ layout("/mobile/platform.html"){
- +