diff --git a/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyCommon.java b/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyCommon.java index ae7e4a9..ce141dd 100644 --- a/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyCommon.java +++ b/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyCommon.java @@ -100,7 +100,7 @@ public class LxyCommon { public Object getNowHdList(@Param(value = "year", required = false) Integer year) { Sql sql = Sqls.create("SELECT id,`name` FROM `lxy_hd` $condition"); Cnd cnd = Cnd.NEW(); - cnd.and(new org.nutz.dao.util.cri.Static("now() < bmjzsj")); + cnd.and(new org.nutz.dao.util.cri.Static("now() >= bmkssj AND now() < bmjzsj")); if (year != null) { cnd.and(new org.nutz.dao.util.cri.Static("YEAR(hdcjsj) = " + year)); } diff --git a/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyGhbmController.java b/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyGhbmController.java index e387b38..367f536 100644 --- a/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyGhbmController.java +++ b/src/main/java/io/v/nutz/zhgh/lxy/controller/LxyGhbmController.java @@ -120,7 +120,7 @@ public class LxyGhbmController { """); Cnd cnd = Cnd.NEW(); - cnd.and(new Static("now() < hd.bmjzsj")); + cnd.and(new Static("now() >= hd.bmkssj AND now() < hd.bmjzsj")); cnd.and("mefp.hdid", "=", hdid); cnd.andEX("un.id", "=", unionId); @@ -243,6 +243,10 @@ public class LxyGhbmController { return Result.error("未获取到报名数据,请选择人员报名"); } + if (!checkActivitySignUpTime(bmList.get(0).getHdid())) { + return Result.error("当前不在报名时间范围内"); + } + if (!checkActivityUserScope(bmList.get(0).getHdid(), bmList.stream().map(Lxy_bm::getUserid).collect(Collectors.toList()))) { return Result.error("存在不在活动人员范围内的人员,请重新选择"); } @@ -389,6 +393,9 @@ public class LxyGhbmController { try { lock.lock(); String unionId = Vi.getUnionId(); + if (!checkActivitySignUpTime(projectId)) { + return Result.error("当前不在报名时间范围内"); + } // 已经报名的,排除审核未通过 int count = dao.count(Lxy_bm.class, Cnd.where("hdid", "=", projectId).and("ghid", "=", unionId) .and(Cnd.exps("bmzt", "in", List.of("1", "3", "5", "6")).or("bmzt", "is", null))); @@ -538,6 +545,11 @@ public class LxyGhbmController { return dao.count("activity_user_scope", Cnd.where("groupId", "=", activityGroupId).and("userId", "in", ids)) == ids.size(); } + private boolean checkActivitySignUpTime(String hdid) { + return lxyHdService.count(Cnd.where("id", "=", hdid) + .and(new Static("now() >= bmkssj AND now() < bmjzsj"))) > 0; + } + private Integer getActivityGroupId(String hdid) { Lxy_hd hd = lxyHdService.fetch(hdid); return hd == null ? null : hd.getActivityGroupId(); diff --git a/src/main/resources/views/platform/zgfw/lxy/HdGhbm.html b/src/main/resources/views/platform/zgfw/lxy/HdGhbm.html index 511a387..8a738a5 100644 --- a/src/main/resources/views/platform/zgfw/lxy/HdGhbm.html +++ b/src/main/resources/views/platform/zgfw/lxy/HdGhbm.html @@ -127,8 +127,8 @@ layout("/layouts/platform.html"){ 查看报名 - 导入 - 报名 + 导入 + 报名 @@ -589,6 +589,12 @@ display: -webkit-box; "file-import": httpVueLoader("/components/plugins/FileImport.vue") }, methods: { + isSignUpTime(row) { + const now = new Date().getTime() + const bmkssj = moment(row.bmkssj.valueOf()) + const bmjzsj = moment(row.bmjzsj.valueOf()) + return bmkssj <= now && now < bmjzsj + }, openImport() { this.importDialog = true this.$nextTick(() => {