From afc1508d5558a6654215f1ce4ab45c9340ebd2a4 Mon Sep 17 00:00:00 2001 From: "@jyuhsin" <729757837@qq.com> Date: Wed, 28 May 2025 14:27:32 +0800 Subject: [PATCH] commit --- .../TheRapyRecuperationLineCreateMode.java | 1 - .../TheRapyRecuperationProvinceType.java | 1 - .../TheRapyRecuperationSignUpMode.java | 17 +- .../constant/TheRapyRecuperationType.java | 3 +- ...yRecuperationAnnualAnalysisController.java | 413 ++++++++++ .../TheRapyRecuperationAuditController.java | 124 ++- ...TheRapyRecuperationXghAuditController.java | 78 +- ...RapyRecuperationBaseManagerController.java | 12 +- .../TheRapyRecuperationLineController.java | 36 +- ...apyRecuperationTravelAgencyController.java | 16 +- ...cuperationEnrollCommonAuditController.java | 168 +++++ ...cuperationEnrollSchoolAuditController.java | 163 ++++ ...ecuperationEnrollUnionAuditController.java | 164 ++++ ...rationEnrollUnitLeaderAuditController.java | 172 +++++ .../TheRapyRecuperationEnrollController.java | 123 +-- ...erationEnrollJoinUserImportController.java | 2 +- ...yRecuperationLineAdjustmentController.java | 6 +- ...RapyRecuperationLineClusterController.java | 2 +- ...RecuperationLineUnionSelectController.java | 241 +++--- ...eRapyRecuperationStatisticsController.java | 9 +- ...eRapyRecuperationUnionQueryController.java | 163 ++-- ...heRapyRecuperationUserQueryController.java | 448 +---------- ...erationBranchUnionUserQueryController.java | 409 ++++++++++ ...heRapyRecuperationLineQueryController.java | 122 +++ ...erationSchoolUnionUserQueryController.java | 397 ++++++++++ ...yRecuperationLineStatisticsController.java | 98 ++- ...uperationEvaluateStatisticsController.java | 182 +++++ .../TheRapyRecuperationConfigController.java | 1 - .../TheRapyRecuperationBaseManagement.java | 1 - .../model/TheRapyRecuperationConfig.java | 16 +- .../model/TheRapyRecuperationEnroll.java | 11 +- .../model/TheRapyRecuperationEvaluate.java | 58 ++ .../model/TheRapyRecuperationLine.java | 17 +- .../TheRapyRecuperationLineUnionSelect.java | 46 +- .../TheRapyRecuperationTravelAgency.java | 11 +- .../TheRapyRecuperationAuditService.java | 1 - .../TheRapyRecuperationCommonService.java | 1 - ...cuperationEnrollJoinUserImportService.java | 1 - .../TheRapyRecuperationEnrollService.java | 19 +- ...RapyRecuperationLineAdjustmentService.java | 2 - ...TheRapyRecuperationLineClusterService.java | 1 - .../TheRapyRecuperationLineService.java | 1 - ...apyRecuperationLineUnionSelectService.java | 5 +- ...heRapyRecuperationTravelAgencyService.java | 1 - .../TheRapyRecuperationAuditServiceImpl.java | 16 +- .../TheRapyRecuperationCommonServiceImpl.java | 3 +- ...rationEnrollJoinUserImportServiceImpl.java | 3 +- .../TheRapyRecuperationEnrollServiceImpl.java | 714 ++++-------------- ...RecuperationLineAdjustmentServiceImpl.java | 8 +- ...apyRecuperationLineClusterServiceImpl.java | 8 +- .../TheRapyRecuperationLineServiceImpl.java | 73 +- ...ecuperationLineUnionSelectServiceImpl.java | 89 +-- ...pyRecuperationTravelAgencyServiceImpl.java | 8 +- .../theRapyRecuperation/Enrollinfo.vue | 38 +- .../theRapyRecuperation/XghEnrollInfo.vue | 35 +- .../therapyRecuperation/baseManagement.html | 12 +- .../mobile/therapyRecuperation/index.html | 20 +- .../mobile/therapyRecuperation/lineInfo.html | 540 ++++++++----- .../mobile/therapyRecuperation/lineList.html | 199 +++-- .../therapyRecuperation/myRecuperation.html | 214 +++++- .../analysis/annualAnalysis.html | 372 +++++++++ .../audit/TheRapyAudit.html | 24 +- .../audit/TheRapyXghAudit.html | 34 +- .../baseManage/baseManagement.html | 2 +- .../theRapyRecuperation/basicManage/line.html | 358 ++++----- .../basicManage/travelAgency.html | 75 +- .../branchUnionUserQuery/editForm.js | 198 +++++ .../branchUnionUserQuery/index.html | 454 +++++++++++ .../branchUnionUserQuery/setUpPart.js | 147 ++++ .../enrollAudit/schoolAudit.html | 393 ++++++++++ .../enrollAudit/unionAudit.html | 379 ++++++++++ .../enrollAudit/unitLeaderAudit.html | 379 ++++++++++ .../theRapyRecuperation/lineQuery/index.html | 332 ++++++++ .../process/TheRapyQuery.html | 298 ++------ .../process/TheRapyUserQuery.html | 172 +---- .../process/lineAdjustment.html | 2 +- .../process/lineCluster.html | 2 +- .../process/lineUnionSelect.html | 309 +++++--- .../schoolUnionUserQuery/editForm.js | 198 +++++ .../schoolUnionUserQuery/index.html | 463 ++++++++++++ .../schoolUnionUserQuery/setUpPart.js | 147 ++++ .../statistics/lineStatistics.html | 140 +++- .../summary/evaluateStatistics.html | 268 +++++++ .../theRapyConfig/TheRapyConfig.html | 56 +- 84 files changed, 8154 insertions(+), 2791 deletions(-) create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/analysis/TheRapyRecuperationAnnualAnalysisController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollCommonAuditController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollSchoolAuditController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnionAuditController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnitLeaderAuditController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationBranchUnionUserQueryController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationLineQueryController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationSchoolUnionUserQueryController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/summary/TherapyRecuperationEvaluateStatisticsController.java create mode 100644 src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEvaluate.java create mode 100644 src/main/resources/views/platform/theRapyRecuperation/analysis/annualAnalysis.html create mode 100644 src/main/resources/views/platform/theRapyRecuperation/branchUnionUserQuery/editForm.js create mode 100644 src/main/resources/views/platform/theRapyRecuperation/branchUnionUserQuery/index.html create mode 100644 src/main/resources/views/platform/theRapyRecuperation/branchUnionUserQuery/setUpPart.js create mode 100644 src/main/resources/views/platform/theRapyRecuperation/enrollAudit/schoolAudit.html create mode 100644 src/main/resources/views/platform/theRapyRecuperation/enrollAudit/unionAudit.html create mode 100644 src/main/resources/views/platform/theRapyRecuperation/enrollAudit/unitLeaderAudit.html create mode 100644 src/main/resources/views/platform/theRapyRecuperation/lineQuery/index.html create mode 100644 src/main/resources/views/platform/theRapyRecuperation/schoolUnionUserQuery/editForm.js create mode 100644 src/main/resources/views/platform/theRapyRecuperation/schoolUnionUserQuery/index.html create mode 100644 src/main/resources/views/platform/theRapyRecuperation/schoolUnionUserQuery/setUpPart.js create mode 100644 src/main/resources/views/platform/theRapyRecuperation/summary/evaluateStatistics.html diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java index 49fdf16..677b332 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationLineCreateMode.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; - import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java index 212e2ef..7a98e72 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationProvinceType.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; - import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java index 58d0543..5f4f822 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationSignUpMode.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; - import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; @@ -14,18 +13,20 @@ import lombok.Getter; **/ @AllArgsConstructor @Getter -@SelectEnum +@io.v.nutz.base.annontation.SelectEnum public enum TheRapyRecuperationSignUpMode { - /** - * 分工会模式 - */ - UNION(1, "分工会组织", new String[]{"H04", "A06", "sysadmin"}), - /** * 自由模式 */ - FREE(2, "校工会组织", new String[]{"A06", "sysadmin"}); + FREE(2, "校工会组织", new String[]{"SchoolUnionAdmin", "sysadmin"}), + + /** + * 分工会模式 + */ + UNION(1, "分工会组织", new String[]{"H04", "SchoolUnionAdmin", "sysadmin"}), + + PERSONAL(3, "个人组织", new String[]{"H01", "H04", "SchoolUnionAdmin", "sysadmin"}); private final int value; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java index ec1c0e2..50219ed 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/constant/TheRapyRecuperationType.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.constant; - import io.v.nutz.base.annontation.SelectEnum; import lombok.AllArgsConstructor; import lombok.Getter; @@ -32,7 +31,7 @@ public enum TheRapyRecuperationType { /** * 省内旅行社 */ - provinceInTravelAgency("自由组团", 2, TheRapyRecuperationProvinceType.provinceIn.getValue(), "/assets/mobile/img/therapyRecuperation/lxs.png"), + provinceInTravelAgency("旅行社", 2, TheRapyRecuperationProvinceType.provinceIn.getValue(), "/assets/mobile/img/therapyRecuperation/lxs.png"), /** * 酒店 diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/analysis/TheRapyRecuperationAnnualAnalysisController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/analysis/TheRapyRecuperationAnnualAnalysisController.java new file mode 100644 index 0000000..a0e2d95 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/analysis/TheRapyRecuperationAnnualAnalysisController.java @@ -0,0 +1,413 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.analysis; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.base.result.Result; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @version 1.0 + * @Author zzr + * @name:TheRapyRecuperationAnnualAnalysisController` + * @Date 2025/2/10 9:16 + * @注释 + */ +@IocBean +@At("/platform/theRapyRecuperation/annualAnalysis") +@Ok("json:full") +public class TheRapyRecuperationAnnualAnalysisController { + + @Inject + private Dao dao; + + @Inject + private TheRapyRecuperationLineService lineService; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/analysis/annualAnalysis.html") + @RequiresPermissions("theRapyRecuperation.annualAnalysis") + public void index() { + } + + + /** + * 获取年度出行人数、线路数、省内、省外、校工会组织线路数、校省内、校省外线路数 + * @param year + * @param lineType + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.annualAnalysis") + public Object getNumData(@Param(value = "year", required = false) Integer year, + @Param(value = "lineType", required = false) String lineType){ + // 对于嘉兴来说,这一坨吊用没有,直接去报名记录里边找线路 +// Cnd cnd = Cnd.NEW(); +// cnd.and("delFlag", "=", false); +// cnd.and("YEAR(selectTime)", "=", year); +// // 本年选择的所有线路 +// List selectLineList = dao.query(TheRapyRecuperationLineUnionSelect.class, cnd); + + // 获取选择线路表的id,后面发现了,报名表里有线路id不在线路表的情况,这类人员要排除掉 + 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); + + // 获取今年报名的所有人数,还要确保报名线路是属于上面选择线路的id + Sql sql = Sqls.create(""" + SELECT + takePartInLineId + FROM + `the_rapy_recuperation_enroll` + WHERE + YEAR(signingUptime) = @thisYear + AND isNormal = 1 + AND stateId = @stateId + AND takePartInLineId in (@selectIdList) + """); + sql.setParam("thisYear", year); + sql.setParam("stateId", TheRapyRecuperationState.PASS); + sql.setParam("selectIdList", selectIdList); + sql.setCallback(Sqls.callback.strList()); + dao.execute(sql); + // 今年的报名记录 + List enrollTakePartLineIdList = sql.getList(String.class); + + List takePartInLineIdList = enrollTakePartLineIdList.stream().distinct().collect(Collectors.toList()); + + // 今年报名的线路 + List selectLineList = dao.query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "in", takePartInLineIdList)); + + // 找出选择的线路详情,用于区分省内还是省外 + List lineIdList = selectLineList.stream().map(TheRapyRecuperationLineUnionSelect::getLineId).distinct().collect(Collectors.toList()); + List lineList = dao.query(TheRapyRecuperationLine.class, Cnd.where("id", "in", lineIdList)); + + // 如果不是全部,按搜索条件查询省内还是省外 + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + lineList = lineList.stream().filter(line -> line.getRegionalNature().equals(lineType)).collect(Collectors.toList()); + + List lineTypeIdList = lineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()); + + selectLineList = selectLineList.stream().filter(v-> lineTypeIdList.contains(v.getLineId())).collect(Collectors.toList()); + } + + // 省内线路 + List inLineList = lineList.stream().filter(line -> "省内".equals(line.getRegionalNature())).collect(Collectors.toList()); + Set inLineIds = inLineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toSet()); + // 选择省内的线路 + List selectInLineIds = selectLineList.stream().filter(v -> inLineIds.contains(v.getLineId())) + .map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList()); + + // 省外线路 + List outLineList = lineList.stream().filter(line -> "省外".equals(line.getRegionalNature())).collect(Collectors.toList()); + Set outLineIds = outLineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toSet()); + // 选择省外的线路 + List selectOutLineIds = selectLineList.stream().filter(v -> outLineIds.contains(v.getLineId())) + .map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList()); + +// List enrollList = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("YEAR(signingUptime)", "=", year).and("isNormal", "=", true)); +// List enrollTakePartLineIdList = enrollList.stream().map(TheRapyRecuperationEnroll::getTakePartInLineId).collect(Collectors.toList()); + + // 返回前端的数据展示 + NutMap nutMap = NutMap.NEW(); + // 总出行人数 + int allNum = enrollTakePartLineIdList.size(); + // 省内出行人数 + int provinceNum = (int) enrollTakePartLineIdList.stream().filter(selectInLineIds::contains).count(); + // 省外出行人数 + int outProvinceNum = (int) enrollTakePartLineIdList.stream().filter(selectOutLineIds::contains).count(); + nutMap.addv("allNum", allNum).addv("provinceNum", provinceNum).addv("outProvinceNum", outProvinceNum); + + // 总线路数 + int lineNum = selectLineList.size(); + // 总省内 + int inLineNum = selectInLineIds.size(); + // 总省外 + int outLineNum = selectOutLineIds.size(); + nutMap.addv("lineNum", lineNum).addv("inLineNum", inLineNum).addv("outLineNum", outLineNum); + + // 校工会组织线路 + List schoolSelectLineList = selectLineList.stream().filter(v -> v.getSignUpMode() == 2).collect(Collectors.toList()); + int schoolUnionLineNum = schoolSelectLineList.size(); + // 校省内 + int schoolInLineNum = (int) schoolSelectLineList.stream().filter(s -> inLineIds.contains(s.getLineId())).count(); + // 校省外 + int schoolOutLineNum = (int) schoolSelectLineList.stream().filter(s -> outLineIds.contains(s.getLineId())).count(); + nutMap.addv("schoolUnionLineNum", schoolUnionLineNum).addv("schoolInLineNum", schoolInLineNum).addv("schoolOutLineNum", schoolOutLineNum); + + // 分工会组织线路 + List unionSelectLineList = selectLineList.stream().filter(v -> v.getSignUpMode() == 1).collect(Collectors.toList()); + int unionLineNum = unionSelectLineList.size(); + // 分省内 + int unionInLineNum = (int) unionSelectLineList.stream().filter(s -> inLineIds.contains(s.getLineId())).count(); + // 分省外 + int unionOutLineNum = (int) unionSelectLineList.stream().filter(s -> outLineIds.contains(s.getLineId())).count(); + nutMap.addv("unionLineNum", unionLineNum).addv("unionInLineNum", unionInLineNum).addv("unionOutLineNum", unionOutLineNum); + return Result.success().addData(nutMap); + } + + + /** + * 出行时间标段统计 + * @param year + * @param lineType + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.annualAnalysis") + public Object getLotNum(@Param(value = "year", required = false) Integer year, + @Param(value = "lineType", required = false) String lineType){ + if (year == null) { + year = DateUtil.thisYear(); + } + List lotList = dao.query(TheRapyRecuperationLot.class, Cnd.NEW().asc("lotValue")); + + Sql sql = Sqls.create(""" + SELECT + enroll.*, + line.lotId AS lineLotId + FROM + 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(); + cnd.andEX("YEAR(signingUpTime)", "=", year); + cnd.and("enroll.isNormal", "=", true); + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + cnd.andEX("line.regionalNature", "=", lineType); + } + sql.setCondition(cnd); + List list = lineService.listMap(sql); + + List resultMap = new ArrayList<>(); + + lotList.forEach(item -> { + NutMap map = NutMap.NEW(); + int value = list.stream().filter(v -> item.getId().equals(v.getString("lineLotId"))).collect(Collectors.toList()).size(); + map.put("label", item.getLotName()); + map.put("value", value); + resultMap.add(map); + }); + return Result.success().addData(resultMap); + } + + + /** + * 出行年龄分布统计 + * @param year + * @param lineType + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.annualAnalysis") + public Object getAgeNum(@Param(value = "year", required = false) Integer year, + @Param(value = "lineType", required = false) String lineType){ + if (year == null) { + year = DateUtil.thisYear(); + } + Map result = new HashMap<>(); + result.put("35岁以下", 0); + result.put("35至45岁", 0); + result.put("45岁以上", 0); + + Sql sql = Sqls.create(""" + SELECT + enroll.idCard + FROM + 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(); + cnd.andEX("YEAR(signingUpTime)", "=", year); + cnd.and("enroll.isNormal", "=", true); + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); + cnd.and("enroll.idCard", "is not", null); + cnd.groupBy("enroll.idCard"); + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + cnd.andEX("line.regionalNature", "=", lineType); + } + sql.setCondition(cnd); + sql.setCallback(Sqls.callback.strList()); + dao.execute(sql); + List idCardList = sql.getList(String.class); + + for (String idCard : idCardList) { + if (StrUtil.isBlank(idCard)) { + continue; + } + int birthYear = getBirthYearFromIdCard(idCard); + + if (birthYear == 0) { + continue; + } + + int age = year - birthYear; + + if (age < 35) { + result.put("35岁以下", result.get("35岁以下") + 1); + } else if (age <= 45) { + result.put("35至45岁", result.get("35至45岁") + 1); + } else { + result.put("45岁以上", result.get("45岁以上") + 1); + } + } + + List list = new ArrayList<>(); + result.forEach((k, v) -> { + NutMap map = NutMap.NEW(); + map.put("label", k); + map.put("value", v); + list.add(map); + }); + return Result.success().addData(list); + } + + + private static int getBirthYearFromIdCard(String idCard) { + String birthYearStr; + if (idCard.length() == 18) { + // 18位身份证号,直接取第7到第10位作为出生年份 + birthYearStr = idCard.substring(6, 10); + } else if (idCard.length() == 15) { + // 15位身份证号,取第7到第8位作为出生年份的后两位 15位身份证号均为19xx年 + birthYearStr = "19" + idCard.substring(6, 8); + } else { + return 0; + } + + return Integer.parseInt(birthYearStr); + } + + + /** + * 获取线路出行人数和年龄统计数据 + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.annualAnalysis") + public Object getLineTravelAndAgeData(@Param(value = "year", required = false) Integer year, + @Param(value = "lineType", required = false) String lineType){ + Sql sql = Sqls.create(""" + SELECT + us.id, + CONCAT(line.lineName,'(',DATE_FORMAT(us.playStartTime,'%m月%d'),'至',DATE_FORMAT(us.playEndTime,'%m月%d'),')') AS lineName, + su.unionname, + lot.lotName, + COUNT(enroll.id) AS takePartInLineNum, + SUM(CASE + WHEN @year - (CASE + WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED) + WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED) + ELSE NULL + END) < 35 THEN 1 ELSE 0 END) AS underThirtyFive, + SUM(CASE + WHEN @year - (CASE + WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED) + WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED) + ELSE NULL + END) BETWEEN 35 AND 45 THEN 1 ELSE 0 END) AS thirtyFiveToFortyFive, + SUM(CASE + WHEN @year - (CASE + WHEN LENGTH(enroll.idCard) = 18 THEN CAST(SUBSTR(enroll.idCard, 7, 4) AS UNSIGNED) + WHEN LENGTH(enroll.idCard) = 15 THEN 1900 + CAST(SUBSTR(enroll.idCard, 7, 2) AS UNSIGNED) + ELSE NULL + END) > 45 THEN 1 ELSE 0 END) AS aboveFortyFive + FROM + 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); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(us.selectTime)", "=", year); + cnd.and("enroll.isNormal", "=", true); + cnd.and("us.`enable`", "=", true); + cnd.groupBy("us.id"); + if (StrUtil.isNotBlank(lineType) && !"全部".equals(lineType)) { + cnd.andEX("line.regionalNature", "=", lineType); + } + sql.setCondition(cnd); + List list = lineService.listMap(sql); + + NutMap result = NutMap.NEW(); + // 柱状图 + List uvData = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("value", v.getInt("takePartInLineNum")); + return map; + }).sorted(Comparator.comparing(v -> v.getString("lineName"))).collect(Collectors.toList()); + + // 折线图 + List underThirtyFiveList = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("count", v.getInt("underThirtyFive")); + map.put("name", "35岁以下"); + return map; + }).collect(Collectors.toList()); + + List thirtyFiveToFortyFiveList = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("count", v.getInt("thirtyFiveToFortyFive")); + map.put("name", "35至45岁"); + return map; + }).collect(Collectors.toList()); + + List aboveFortyFiveList = list.stream().map(v -> { + NutMap map = NutMap.NEW(); + map.put("lineName", v.getString("lineName")); + map.put("count", v.getInt("aboveFortyFive")); + map.put("name", "45岁以上"); + return map; + }).collect(Collectors.toList()); + + underThirtyFiveList.addAll(thirtyFiveToFortyFiveList); + underThirtyFiveList.addAll(aboveFortyFiveList); + + List collect = underThirtyFiveList.stream().sorted(Comparator.comparing(v -> v.getString("lineName"))).collect(Collectors.toList()); + result.put("uvData", uvData); + result.put("transformData", collect); + + return Result.success().addData(result); + } + + + /** + * 获取分工会出行人数和年龄统计数据 + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.annualAnalysis") + public Object getLineTravelAgeData(@Param(value = "year", required = false) Integer year, + @Param(value = "lineType", required = false) String lineType){ + return Result.success().addData(null); + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java index bd20a29..3d843a0 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationAuditController.java @@ -2,17 +2,15 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.audit; import cn.hutool.core.util.StrUtil; - import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.model.Audit; import io.v.nutz.base.model.AuditState; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.utils.MsgApi; import io.v.nutz.base.utils.Vi; +import io.v.nutz.base.query.PageForm; import io.v.nutz.sys.models.Sys_user; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; @@ -67,18 +65,19 @@ public class TheRapyRecuperationAuditController { @At @ViReturn @RequiresAuthentication - public Object getXlByUnion(Integer state, String unionId, String regionalNature, String year, String endYear, Integer signUpMode) { + public Object getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode) { - List xlByUnion = auditService.getXlByUnion(state, unionId, regionalNature, year, endYear, signUpMode); + List xlByUnion = auditService.getXlByUnion(state, unionId, regionalNature, year,endYear, signUpMode); return xlByUnion; } + @At @ViReturn @RequiresAuthentication - public Object getXlByUnionAudit(String unionId, String regionalNature, String year, Integer signUpMode) { + public Object getXlByUnionAudit(String unionId,String regionalNature, String year, Integer signUpMode) { Sql sql = Sqls.create(""" SELECT line.id, @@ -93,20 +92,21 @@ public class TheRapyRecuperationAuditController { $condition """); Cnd cnd = Cnd.NEW(); - if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { + if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")){ cnd.andEX("ts.unionId", "=", unionId); } else { cnd.and("ts.unionId", "=", vi.getUnionId()); } - cnd.andEX("YEAR(ts.selectTime)", "=", year); - cnd.andEX("line.regionalNature", "=", regionalNature); - cnd.andEX("line.signUpMode", "=", signUpMode); + cnd.andEX("YEAR(ts.selectTime)","=",year); + cnd.andEX("line.regionalNature","=",regionalNature); + cnd.andEX("line.signUpMode","=",signUpMode); cnd.groupBy("line.id"); sql.setCondition(cnd); return auditService.listMap(sql); } + @At @ViReturn @RequiresAuthentication @@ -143,7 +143,7 @@ public class TheRapyRecuperationAuditController { cnd.andEX("enroll.selfUnionId", "=", unionId); cnd.and("enroll.takePartInLineId", "is not", null); cnd.andEX("enroll.selfUnitId", "=", unitId); - cnd.andEX("lineu.lineId", "=", takePartInLineId); + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); cnd.andEX("enroll.isNormal", "=", true); cnd.andEX("lineu.signUpMode", "=", 1); cnd.andEX("lineu.id", "=", selectId); @@ -157,7 +157,7 @@ public class TheRapyRecuperationAuditController { } else if (state.equals("2")) { cnd.andEX("enroll.takePartInUnionId", "!=", Vi.getUnionId()); cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId()); - } else if (state.equals("3")) { + } else if (state.equals("3")){ cnd.andEX("enroll.selfUnionId", "!=", Vi.getUnionId()); cnd.andEX("enroll.takePartInUnionId", "=", Vi.getUnionId()); } @@ -173,14 +173,11 @@ public class TheRapyRecuperationAuditController { ((enroll.stateId = %s OR enroll.stateId=%s )AND enroll.takePartInUnionId='%s') """.formatted(TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId()))); } else { - /*cnd.and(new Static(""" + cnd.and(new Static(""" ((( enroll.stateId = %s OR enroll.stateId = %s OR enroll.stateId = %s ) AND enroll.selfUnionId = '%s' ) OR ((enroll.stateId = %s OR enroll.stateId=%s )AND enroll.takePartInUnionId='%s')) - """.formatted(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNIT, TheRapyRecuperationState.PASS, vi.getUnionId(), TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId())));*/ - cnd.and(new Static(""" - ((enroll.stateId = %s OR enroll.stateId=%s )AND enroll.takePartInUnionId='%s') - """.formatted(TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId()))); + """.formatted(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNIT, TheRapyRecuperationState.PASS, vi.getUnionId(), TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.PASS, vi.getUnionId()))); } } else { cnd.and(new Static(""" @@ -226,7 +223,7 @@ public class TheRapyRecuperationAuditController { @ViReturn @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyAudit") - public Object doAudit(String id, boolean flag, Boolean adjustment, boolean isTransferIn, String auditOpinion) { + public Object doAudit(String id, boolean flag,Boolean adjustment, boolean isTransferIn, String auditOpinion) { Trans.exec(() -> { TheRapyRecuperationEnroll enroll = auditService.dao().fetch(TheRapyRecuperationEnroll.class, id); Audit audit = new Audit(); @@ -264,10 +261,10 @@ public class TheRapyRecuperationAuditController { } auditService.updateIgnoreNull(enroll); - auditMsg(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId()); - if (adjustment) { + auditMsg(enroll.getStateId(), enroll.getLoginName(),adjustment, enroll.getTakePartInLineId()); + if (adjustment){ // enroll.setNormal(false); - auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "=", enroll.getId())); + auditService.dao().clear(TheRapyRecuperationEnroll.class,Cnd.where("id","=",enroll.getId())); } }); return null; @@ -322,7 +319,7 @@ public class TheRapyRecuperationAuditController { @RequiresAuthentication @Aop(TransAop.READ_COMMITTED) @RequiresPermissions("theRapyRecuperation.TheRapyAudit") - public Object doOnekeyAudit(String[] ids, String auditOpinion, boolean flag, Boolean adjustment) { + public Object doOnekeyAudit(String[] ids, String auditOpinion, boolean flag,Boolean adjustment) { Audit audit = new Audit(); audit.setAuditOpinion(auditOpinion); audit.setAuditor(ShiroUtil.getUserId()); @@ -346,14 +343,14 @@ public class TheRapyRecuperationAuditController { enroll.setStateId(flag ? TheRapyRecuperationState.PASS : TheRapyRecuperationState.LINEUNITFAIL); enroll.setJoinLineUnionAuditId(insert.getId()); } - if (adjustment) { + if (adjustment){ // enroll.setNormal(false); enrollIdList.add(id); } auditService.updateIgnoreNull(enroll); - auditMsg(enroll.getStateId(), enroll.getLoginName(), adjustment, enroll.getTakePartInLineId()); + auditMsg(enroll.getStateId(), enroll.getLoginName(),adjustment, enroll.getTakePartInLineId()); } - auditService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", enrollIdList)); + auditService.dao().clear(TheRapyRecuperationEnroll.class,Cnd.where("id","in",enrollIdList)); return null; } @@ -364,22 +361,20 @@ public class TheRapyRecuperationAuditController { * @param loginName * @param takePartInLineId */ - private void auditMsg(Integer stateId, String loginName, Boolean adjustment, String takePartInLineId) { + private void auditMsg(Integer stateId, String loginName,Boolean adjustment, String takePartInLineId) { Sys_user user = auditService.dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); TheRapyRecuperationLineUnionSelect unionSelect = auditService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", takePartInLineId)); TheRapyRecuperationLine theRapyRecuperationLine = auditService.dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", unionSelect.getLineId())); AuditState auditState = auditService.dao().fetch(AuditState.class, Cnd.where("stateId", "=", stateId)); String content = "【智慧工会】%s老师您好,您报名的%s线路因报名人数不足已取消,请尽快进入智慧工会重新选择线路。" - .formatted(user.getUsername(), theRapyRecuperationLine.getLineName()); + .formatted(user.getUsername(),theRapyRecuperationLine.getLineName()); - List list = List.of(Map.of("type", "User", "userId", user.getLoginname(), "name", user.getUsername())); if (stateId.equals(TheRapyRecuperationState.PASS)) { content = "【智慧工会】%s老师您好,您报名的%s线路已组团成功,请按约定出行。" .formatted(user.getUsername(), theRapyRecuperationLine.getLineName()); - } - //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); + msgApi.sendTextMsg(content,user.getLoginname()); } @@ -403,9 +398,8 @@ public class TheRapyRecuperationAuditController { Cnd cnd = Cnd.NEW(); if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) { cnd.and("takePartInLineId", "IS NOT", null); - cnd.and("takePartInLineId", "!=", ""); - cnd.and(Cnd.exps("takePartInUnionId", "=", vi.getUnionId()).or("selfUnionId", "=", vi.getUnionId())); - //cnd.and("selfUnionId", "=", vi.getUnionId()); +// cnd.and(Cnd.exps("takePartInUnionId", "=", vi.getUnionId()).or("selfUnionId", "=", vi.getUnionId())); + cnd.and("selfUnionId", "=", vi.getUnionId()); } cnd.groupBy("selfUnionId"); sql.setCondition(cnd); @@ -423,25 +417,17 @@ public class TheRapyRecuperationAuditController { @At @ViReturn @RequiresAuthentication - public Object getApplyNumAudit(String takePartInLineId, String mode, String isAudit, Integer year, String selectId) { - TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + public Object getApplyNumAudit(String takePartInLineId,String mode, String isAudit, Integer year,String selectId) { String unionId = Vi.getUnionId(); Sql sql = Sqls.create(""" SELECT COUNT(1) as signUpNum, - $val as familyNumber + IFNULL(sum(familyNumber),0) as familyNumber FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId $condition """); - String val = ""; - if (config.getFamilyInfo() == 1) { - val = "IFNULL(sum(familyNumber),0)"; - } else { - val = "IFNULL((select count(1) from the_rapy_recuperation_enroll_companion where trreId = enroll.id),0)"; - } - sql.setVar("val", val); Sql sql2 = sql; Sql sql3 = sql; Sql sql4 = sql; @@ -453,16 +439,16 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 1) - .andEX("lineu.id", "=", selectId); + .andEX("signUpMode", "=", 1); if (StrUtil.isNotBlank(mode)) { cnd1.and("stateId", "=", TheRapyRecuperationState.PASS); } + if (StrUtil.isNotBlank(selectId)) cnd1.and("lineu.id","=",selectId); sql.setCondition(cnd1); NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); - int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber", 0))); + int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber",0))); //本工会人员(其他路线) Cnd cnd2 = Cnd.NEW(); @@ -470,16 +456,16 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId", "=", takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 1) - .andEX("lineu.id", "=", selectId); + .andEX("signUpMode", "=", 1); if (StrUtil.isNotBlank(mode)) { cnd2.and("stateId", "=", TheRapyRecuperationState.PASS); } + if (StrUtil.isNotBlank(selectId)) cnd2.and("lineu.id","=",selectId); sql2.setCondition(cnd2); NutMap map2 = (NutMap) Daos.query(dao, sql2.toString(), Sqls.callback.map()); - int count2 = Integer.parseInt(String.valueOf(map2.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map2.getOrDefault("familyNumber", 0))); + int count2 = Integer.parseInt(String.valueOf(map2.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map2.getOrDefault("familyNumber",0))); //其他工会人员(选我线路) Cnd cnd3 = Cnd.NEW(); @@ -487,32 +473,32 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "!=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId","=",takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 1) - .andEX("lineu.id", "=", selectId); + .andEX("signUpMode", "=", 1); if (StrUtil.isNotBlank(mode)) { cnd3.and("stateId", "=", TheRapyRecuperationState.PASS); } + if (StrUtil.isNotBlank(selectId)) cnd3.and("lineu.id","=",selectId); sql3.setCondition(cnd3); NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map()); - int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber", 0))); + int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber",0))); //选择校工会线路人员 Cnd cnd4 = Cnd.NEW(); cnd4.and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId","=",takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) - .andEX("signUpMode", "=", 2) - .andEX("lineu.id", "=", selectId); + .andEX("signUpMode", "=", 2); if (StrUtil.isNotBlank(mode)) { cnd4.and("stateId", "=", TheRapyRecuperationState.PASS); } + if (StrUtil.isNotBlank(selectId)) cnd4.and("lineu.id","=",selectId); sql4.setCondition(cnd4); NutMap map4 = (NutMap) Daos.query(dao, sql4.toString(), Sqls.callback.map()); - int count4 = Integer.parseInt(String.valueOf(map4.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map4.getOrDefault("familyNumber", 0))); + int count4 = Integer.parseInt(String.valueOf(map4.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map4.getOrDefault("familyNumber",0))); return Map.of("count1", count1, "count2", count2, "count3", count3, "count4", count4); } @@ -524,13 +510,14 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId","=",takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", ">", TheRapyRecuperationState.UNIT) .andEX("signUpMode", "=", 1); + if (StrUtil.isNotBlank(selectId)) cnd1.and("lineu.id","=",selectId); sql.setCondition(cnd1); NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); - int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber", 0))); + int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber",0))); //本工会人员(其他路线) @@ -551,13 +538,14 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "!=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId","=",takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", ">", TheRapyRecuperationState.LINEUNIT) .andEX("signUpMode", "=", 1); + if (StrUtil.isNotBlank(selectId)) cnd3.and("lineu.id","=",selectId); sql3.setCondition(cnd3); NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map()); - int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber", 0))); + int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber",0))); // return Map.of("count1", count1, "count2", count2, "count3", count3); @@ -571,13 +559,14 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId","=",takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", "=", TheRapyRecuperationState.UNIT) .andEX("signUpMode", "=", 1); + if (StrUtil.isNotBlank(selectId)) cnd1.and("lineu.id","=",selectId); sql.setCondition(cnd1); NutMap map = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map()); - int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber", 0))); + int count1 = Integer.parseInt(String.valueOf(map.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map.getOrDefault("familyNumber",0))); //本工会人员(其他路线) @@ -598,13 +587,14 @@ public class TheRapyRecuperationAuditController { .and("selfUnionId", "!=", unionId) .and("isNormal", "=", true) .and("takePartInLineId", "is not", null) - .andEX("lineu.lineId", "=", takePartInLineId) + .andEX("takePartInLineId","=",takePartInLineId) .andEX("YEAR(signingUptime)", "=", year) .and("stateId", "=", TheRapyRecuperationState.LINEUNIT) .andEX("signUpMode", "=", 1); + if (StrUtil.isNotBlank(selectId)) cnd3.and("lineu.id","=",selectId); sql3.setCondition(cnd3); NutMap map3 = (NutMap) Daos.query(dao, sql3.toString(), Sqls.callback.map()); - int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum", 0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber", 0))); + int count3 = Integer.parseInt(String.valueOf(map3.getOrDefault("signUpNum",0))) + Integer.parseInt(String.valueOf(map3.getOrDefault("familyNumber",0))); // return Map.of("count1", count1, "count2", count2, "count3", count3); return Map.of("count1", count1, "count3", count3); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java index cc17751..fcd4851 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/audit/TheRapyRecuperationXghAuditController.java @@ -2,19 +2,15 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.audit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; - import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.model.Audit; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.BaseService; -import io.v.nutz.base.service.ViService; import io.v.nutz.base.utils.Vi; - +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.ViService; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollCompanion; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationAuditService; import org.apache.shiro.authz.annotation.RequiresAuthentication; @@ -28,18 +24,15 @@ import org.nutz.dao.util.cri.Static; import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; -import org.nutz.lang.Lang; import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; -import org.nutz.mvc.annotation.Param; import org.nutz.trans.Trans; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.stream.Collectors; @IocBean @At("/platform/theRapyRecuperation/TheRapyXghAudit") @@ -293,19 +286,37 @@ public class TheRapyRecuperationXghAuditController { @ViReturn @RequiresAuthentication @RequiresPermissions("theRapyRecuperation.TheRapyXghAudit") - public Object getXghLine() { + public Object getXghLine(Integer year,String regionalNature) { +// Sql sql = Sqls.create(""" +// SELECT +// line.*, +// un.unionname +// 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 +// where line.signUpMode='2' and line.createMode='2' +// group by line.id +// """); + Sql sql = Sqls.create(""" SELECT line.*, un.unionname FROM - `the_rapy_recuperation_enroll` enroll - LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id = enroll.takePartInLineId + the_rapy_recuperation_line_union_select lineu LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId - LEFT JOIN sys_union un ON un.id = enroll.takePartInUnionId - where line.signUpMode='2' and line.createMode='2' - group by line.id + LEFT JOIN sys_union un ON un.id = lineu.unionId + $condition """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(lineu.selectTime)","=",year); + if (StrUtil.isNotBlank(regionalNature) && !"全部".equals(regionalNature)){ + cnd.and("line.regionalNature","=",regionalNature); + } + cnd.groupBy("line.id"); + sql.setCondition(cnd); return baseService.listMap(sql); } @@ -313,48 +324,21 @@ public class TheRapyRecuperationXghAuditController { @At @ViReturn @RequiresAuthentication - public Object getLinePlayTimeByLineId(String lineId, - @Param(value = "signUpMode",required = false) Integer signUpMode, - @Param(value = "year",required = false) Integer year, - @Param(value = "startYear",required = false)Integer startYear, - @Param(value = "endYear",required = false)Integer endYear, - @Param(value = "flag",required = false) Boolean flag) { - Cnd cnd = Cnd.NEW(); - cnd.and("lineId", "=", lineId); - if (flag == null || !flag){ - cnd.andEX("signUpMode", "=", signUpMode); - cnd.and("YEAR(selectTime)", "=", year); - } else { - cnd.and("YEAR(selectTime)", ">=", startYear); - cnd.and("YEAR(selectTime)", "<=", endYear); - } - List query = dao.query(TheRapyRecuperationLineUnionSelect.class, cnd); + public Object getLinePlayTimeByLineId(String lineId, Integer signUpMode, Integer year) { + List query = dao.query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "=", lineId) + .andEX("signUpMode", "=", signUpMode).andEX("YEAR(selectTime)", "=", year)); //.and("selectUserId", "=", ShiroUtil.getUserId()).and("unionId", "=", Vi.getUnionId())); - TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); List nutMaps = new ArrayList<>(); query.forEach(v -> { String startTime = DateUtil.formatChineseDate(v.getPlayStartTime(), false, false).substring(5); String endTime = DateUtil.formatChineseDate(v.getPlayEndTime(), false, false).substring(5); NutMap map = new NutMap(); - - List enrollList = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", v.getId()) - .and("isNormal", "=", true) - .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); - - int hasSignNumber; - if (config.getFamilyInfo() == 1) { - int sum = enrollList.stream().mapToInt(TheRapyRecuperationEnroll::getFamilyNumber).sum(); - hasSignNumber = enrollList.size() + sum; - } else { - List list = enrollList.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); - List companions = dao.query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", list)); - hasSignNumber = enrollList.size() + companions.size(); - } - map.setv("times", startTime + "-" + endTime + "(报名人数:" + hasSignNumber + ",其中家属:" + (hasSignNumber - enrollList.size()) + "人)"); + map.setv("times", startTime + "-" + endTime); map.setv("selectId", v.getId()); nutMaps.add(map); }); return nutMaps; } + } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java index 3fc1b86..0a57db3 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/baseManage/TheRapyRecuperationBaseManagerController.java @@ -12,15 +12,15 @@ import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.dao.CndPlus; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.Vi; -import io.v.nutz.base.utils.ViTool; +import io.v.nutz.base.query.PageForm; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.baseManage.TheRapyRecuperationBaseManagerService; +import io.v.nutz.base.utils.ViTool; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresAuthentication; @@ -92,7 +92,7 @@ public class TheRapyRecuperationBaseManagerController { @POST @Ok("json:full") @ViReturn - @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + @RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "H04"}, logical = Logical.OR) public Object pageData(PageForm pageForm, Integer year, String lotId, String baseName, String unionId, String travelAgencyId, String regionalNature) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" @@ -114,7 +114,7 @@ public class TheRapyRecuperationBaseManagerController { tb.files, tb.baseContactPerson, tb.baseContactNumber, - tb.files AS fileId, + cast( tb.files ->> '$[0].id' AS CHAR ) AS fileId, gh.unionname createUnionName, u.username createUserName, ta.travelAgencyName, @@ -136,7 +136,7 @@ public class TheRapyRecuperationBaseManagerController { cnd.desc("tb.`year`"); cnd.asc("tb.sortNumber"); cnd.asc("tb.id"); - if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06"))) { + if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "SchoolUnionAdmin"))) { if (ShiroUtil.hasRole("H04")) { cnd.and("tb.createUnionId", "=", Vi.getUnionId()); } @@ -192,7 +192,7 @@ public class TheRapyRecuperationBaseManagerController { @POST @ViReturn @RequiresAuthentication - @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + @RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "H04"}, logical = Logical.OR) public Object doSubmit(@Param("base") TheRapyRecuperationBaseManagement baseManagement) { baseManagement.setOpBy((String) ShiroUtil.getPrincipalProperty("id")); baseManagement.setCreateUnionId((String) ShiroUtil.getPrincipalProperty("unionid")); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java index 7d9bf6f..d1cbdc5 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationLineController.java @@ -9,20 +9,19 @@ import cn.hutool.core.io.FileUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; - import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.utils.Vi; - - -import io.v.nutz.base.utils.ViTool; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.sys.models.User; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationLineCreateMode; import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyTravelLineExcelMode; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService; +import io.v.nutz.base.utils.ViTool; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.Logical; @@ -42,6 +41,7 @@ import org.nutz.mvc.upload.UploadAdaptor; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; @@ -82,28 +82,22 @@ public class TheRapyRecuperationLineController { @POST @Ok("json:full") @ViReturn - @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) - public Object pageData(PageForm pageForm, Integer startYear , Integer endYear, String keywords, String travelAgencyId, String lineName, String unionId, String lotId) { + @RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "H04", "H01"}, logical = Logical.OR) + public Object pageData(PageForm pageForm, Integer startYear, Integer endYear, Integer signUpMode, String travelAgencyId, String lineName, String unionId, String lotId) { Cnd cnd = Cnd.NEW(); cnd.andEX("line.`year`", ">=", startYear); cnd.andEX("line.`year`", "<=", endYear); cnd.andEX("line.travelAgencyId", "=", travelAgencyId); cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.signUpMode", "=", signUpMode); cnd.and(Cnd.likeEX("line.lineName", lineName)); - - /*if (StrUtil.isNotBlank(keywords)) { - SqlExpressionGroup seg = new SqlExpressionGroup(); - seg.orLike("line.lineName", keywords); - seg.orLike("line.travelAgencyName", keywords); - cnd.and(seg); - }*/ cnd.desc("year"); - if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06"))) { + if (!ShiroUtil.hasAnyRoles(List.of("sysadmin", "SchoolUnionAdmin"))) { if (ShiroUtil.hasRole("H04")) { cnd.and("line.createUnionId", "=", Vi.getUnionId()); + }else{ + cnd.and("line.opBy", "=", ShiroUtil.getUserId()); } - } else { - cnd.andEX("line.createUnionId", "=", unionId); } cnd.desc("regionalNature").asc("serialNumber").asc("line.opBy"); return lineService.pageData(pageForm, cnd); @@ -113,7 +107,7 @@ public class TheRapyRecuperationLineController { @POST @ViReturn @RequiresAuthentication - @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + @RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "H04", "H01"}, logical = Logical.OR) public Object getNo() { Object serialNumber = dao.func2(TheRapyRecuperationLine.class, "max", "serialNumber"); serialNumber = Objects.requireNonNullElse(serialNumber, 0); @@ -130,8 +124,8 @@ public class TheRapyRecuperationLineController { @POST @ViReturn @RequiresAuthentication - @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) - public Object doSubmit(TheRapyRecuperationLine line) { + @RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "H04", "H01"}, logical = Logical.OR) + public Object doSubmit(@Param("line") TheRapyRecuperationLine line) { if (StrUtil.isBlank(line.getId())) { if (lineService.count(Cnd.where("serialNumber", "=", line.getSerialNumber())) > 0) { return Result.error("编号已存在"); @@ -219,7 +213,7 @@ public class TheRapyRecuperationLineController { @ViReturn @RequiresAuthentication public Object getCreateMode() { - boolean hasSchoolAdminRole = ShiroUtil.hasAnyRoles(List.of("sysadmin", "A06")); + boolean hasSchoolAdminRole = ShiroUtil.hasAnyRoles(List.of("sysadmin", "SchoolUnionAdmin")); if (hasSchoolAdminRole) { return TheRapyRecuperationLineCreateMode.SCHOOL.getValue(); } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java index 2902182..487a640 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/basicManage/TheRapyRecuperationTravelAgencyController.java @@ -5,11 +5,9 @@ import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; - import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.utils.PageUtil; - +import io.v.nutz.base.query.PageForm; import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyTravelAgencyExcelMode; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; @@ -84,7 +82,7 @@ public class TheRapyRecuperationTravelAgencyController { if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); } else { - cnd.asc("serialNumber * 1"); + cnd.asc("serialNumber"); } return travelAgencyService.pageData(pageForm, cnd); } @@ -176,14 +174,10 @@ public class TheRapyRecuperationTravelAgencyController { @At("/selectTravelAgencyByYears") @ViReturn @RequiresAuthentication - public Object selectTravelAgencyByYears(Integer startYear, Integer endYear, Integer year) { + public Object selectTravelAgencyByYears(Integer startYear, Integer endYear) { Cnd cnd = Cnd.NEW(); - if(startYear != null && endYear != null) { - cnd.andEX("year", ">=", startYear); - cnd.andEX("year", "<=", endYear); - }else { - cnd.andEX("year", "=", year); - } + cnd.andEX("year", ">=", startYear); + cnd.andEX("year", "<=", endYear); return travelAgencyService.selectAllTravelAgencyByYear(cnd); } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollCommonAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollCommonAuditController.java new file mode 100644 index 0000000..837d7e6 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollCommonAuditController.java @@ -0,0 +1,168 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.enrollAudit; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.model.Audit; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author zhf + * @date 2025/5/21 15:02 + * @description 线路审核公用 + */ +@IocBean +@At("/platform/theRapyRecuperation/enrollAudit/commonAudit") +@Ok("json:full") +public class TheRapyRecuperationEnrollCommonAuditController { + + @Inject + private TheRapyRecuperationEnrollService enrollService; + + + /** + * + * 查询某一条选择线路的审核记录 + * @param id + * @return + */ + @At + @ViReturn + public Object findOne(String id){ + Sql sql = Sqls.create(""" + select * from the_rapy_recuperation_line_union_select where id=@id + """).setParam("id", id); + NutMap nutMap = enrollService.fetch(sql); + if (StrUtil.isNotBlank(nutMap.getString("unionAuditId"))){ + nutMap.put("unionAudit",enrollService.dao().fetch(Audit.class,nutMap.getString("unionAuditId"))); + } + if (StrUtil.isNotBlank(nutMap.getString("unitLeaderAuditId"))){ + nutMap.put("unitLeaderAudit",enrollService.dao().fetch(Audit.class,nutMap.getString("unitLeaderAuditId"))); + } + if (StrUtil.isNotBlank(nutMap.getString("schoolAuditId"))){ + nutMap.put("schoolAudit",enrollService.dao().fetch(Audit.class,nutMap.getString("schoolAuditId"))); + } + return nutMap; + } + + @At + @ViReturn + public Object getUnionSelectLine(Integer startYear, Integer endYear, Integer signUpMode) { + Sql sql = Sqls.create(""" + SELECT + rlus.id, + rlus.unionId, + rlus.lineId, + rlus.selectUserId, + DATE_FORMAT( rlus.playStartTime, '%Y-%m-%d' ) AS playStartTime, + DATE_FORMAT( rlus.playEndTime, '%Y-%m-%d' ) AS playEndTime, + rl.lineName, + rl.regionalNature, + CASE + WHEN rlus.signUpMode = 1 THEN '个人组织' + WHEN rlus.signUpMode = 2 THEN '分工会组织' + WHEN rlus.signUpMode = 3 THEN '校工会组织' + ELSE '未知' + END AS signUpMode, + lot.lotName + FROM + `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(); + if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionLxyAdmin")){ + cnd.and("rlus.unionId", "=", Vi.getUnionId()); + } + cnd.andEX("YEAR(rlus.selectTime)", ">=", startYear); + cnd.andEX("YEAR(rlus.selectTime)", "<=", endYear); + cnd.andEX("rlus.signUpMode", "=", signUpMode); + cnd.groupBy("rlus.lineId"); + cnd.desc("lot.lotValue"); + cnd.desc("rl.lineName"); + sql.setCondition(cnd); + return enrollService.listMap(sql); + } + + @At + @ViReturn + public Object getLinePlayTimeByLineId(String lineId, Integer signUpMode, Integer year) { + List query = enrollService.dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "=", lineId) + .andEX("signUpMode", "=", signUpMode).andEX("YEAR(selectTime)", "=", year)); + //.and("selectUserId", "=", ShiroUtil.getUserId()).and("unionId", "=", Vi.getUnionId())); + + List nutMaps = new ArrayList<>(); + query.forEach(v -> { + String startTime = DateUtil.formatChineseDate(v.getPlayStartTime(), false, false).substring(5); + String endTime = DateUtil.formatChineseDate(v.getPlayEndTime(), false, false).substring(5); + NutMap map = new NutMap(); + map.setv("times", startTime + "-" + endTime); + map.setv("selectId", v.getId()); + nutMaps.add(map); + }); + return nutMaps; + } + + @At + @ViReturn + public Object getUserDateByLine(PageForm pageForm, + @Param(value = "takePartLineId",required = false) String takePartLineId, + @Param(value = "searchKeyword", required = false) String searchKeyword, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId) { + Sql sql = Sqls.create(""" + SELECT + enroll.*, + line.lineName, + line.id as lineId, + line.regionalNature, + '教职工' userNature, + state.stateColor, + state.stateName, + CONCAT(DATE_FORMAT(rs.playStartTime,'%m月%d日'),'-',DATE_FORMAT(rs.playEndTime,'%m月%d日')) AS linePlayTime, + IF + ( enroll.takePartInUnionId != enroll.selfUnionId, TRUE, FALSE ) isTransferIn, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) num + FROM + `the_rapy_recuperation_enroll` enroll + LEFT JOIN `the_rapy_recuperation_line_union_select` rs ON rs.id = enroll.takePartInLineId + LEFT JOIN `the_rapy_recuperation_line` line on line.id=rs.lineId + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("enroll.takePartInLineId","=",takePartLineId); + cnd.and("enroll.stateId","=",2750); + cnd.andEX("enroll.selfUnionId", "=", unionId); + cnd.andEX("enroll.selfUnitId", "=", unitId); + cnd.and("enroll.takePartInLineId", "is not", null); + cnd.andEX("enroll.isNormal", "=", true); + if (StrUtil.isNotBlank(searchKeyword)){ + cnd.and(Cnd.exps("enroll.loginName","like","%"+searchKeyword+"%").or("enroll.userName","like","%"+searchKeyword+"%")); + } + cnd.desc("enroll.signingUptime"); + cnd.desc("enroll.unitName"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollSchoolAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollSchoolAuditController.java new file mode 100644 index 0000000..4001815 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollSchoolAuditController.java @@ -0,0 +1,163 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.enrollAudit; + +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.model.Audit; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +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 org.nutz.mvc.annotation.Param; + +import java.util.Date; + +/** + * @author zhf + * @date 2025/5/20 19:17 + * @description 校工会审核 + */ +@IocBean +@At("/platform/theRapyRecuperation/enrollAudit/schoolAudit") +@Ok("json:full") +public class TheRapyRecuperationEnrollSchoolAuditController { + + @Inject + private TheRapyRecuperationEnrollService enrollService; + @Inject + private MsgApi msgApi; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/enrollAudit/schoolAudit.html") + @RequiresPermissions("theRapyRecuperation.enrollAudit.schoolAudit") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.enrollAudit.schoolAudit") + public Object pageData(PageForm pageForm, + @Param(value = "startYear", required = false) Integer startYear, + @Param(value = "endYear", required = false) Integer endYear, + @Param("unionId") String unionId, + @Param("takePartInLineId") String takePartInLineId, + @Param(value = "lotId", required = false) String lotId, + @Param(value = "signUpMode", required = false) String signUpMode, + @Param(value = "selectId", required = false) String selectId, + @Param(value = "isAudit", required = false) Integer isAudit, + @Param(value = "regionalNature", required = false) String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + st.stateName, + u.username, + u.loginname, + line.id, + line.lineName, + line.regionalNature, + lineu.lineId, + lineu.id as lineUId, + lineu.signUpMode, + lineu.auditState, + lineu.minimumGroupSize, + lineu.estimatedFamilyNumbers, + YEAR(lineu.selectTime) as `year`, + CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, + lineu.playStartTime as playStartTime1, + lineu.playEndTime as playEndTime2, + lxs.travelAgencyName, + lxs.contact, + lxs.contactMobileNumber, + enroll.takePartInUnionId AS usUnionId, + un.unionname as unionname, + lot.lotName, + lot.lotValue, + enroll.familyNumber, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=2750 and isNormal = true $unionCnd) lineNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where stateId=2750 and takePartInLineId = lineu.id and isNormal = true $unionCnd)) as signUpUserFamilyNum + FROM + + the_rapy_recuperation_line_union_select lineu + LEFT JOIN `the_rapy_recuperation_enroll` enroll ON lineu.id=enroll.takePartInLineId + left join `user` u on u.id=lineu.selectUserId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON line.travelAgencyId = lxs.id + LEFT JOIN sys_union un ON un.id = lineu.unionId + left join audit_state st on st.stateId=lineu.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + if (isAudit != 0) { + cnd.andEX("lineu.auditState", isAudit == 1 ? ">" : "=", 7712); + }else{ + cnd.andEX("lineu.auditState", ">=", 7712); + } + cnd.andEX("groupSuccess", "=", 1); + cnd.andEX("YEAR(lineu.selectTime)", ">=", startYear); + cnd.andEX("YEAR(lineu.selectTime)", "<=", endYear); + cnd.andEX("lineu.signUpMode", "=", signUpMode); + cnd.andEX("lineu.unionId", "=", unionId); + + cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("lineu.id", "=", selectId); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.groupBy("enroll.takePartInLineId"); + cnd.asc("line.serialNumber").asc("lineu.playStartTime"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.enrollAudit.schoolAudit") + public Result doPass(String id, Audit audit) { + audit.setAuditTime(new Date()); + audit.setLoginname(ShiroUtil.getPlatformLoginname()); + audit.setUsername(ShiroUtil.getPlatformUsername()); + audit.setAuditor(ShiroUtil.getUserId()); + enrollService.insert(audit); + TheRapyRecuperationLineUnionSelect unionSelect = enrollService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, id); + unionSelect.setAuditState(7720); + unionSelect.setSchoolAuditId(audit.getId()); + enrollService.update(unionSelect); + return Result.success(); + } + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.enrollAudit.schoolAudit") + public Result doBack(String id, Audit audit) { + audit.setAuditTime(new Date()); + audit.setLoginname(ShiroUtil.getPlatformLoginname()); + audit.setUsername(ShiroUtil.getPlatformUsername()); + audit.setAuditor(ShiroUtil.getUserId()); + enrollService.insert(audit); + TheRapyRecuperationLineUnionSelect unionSelect = enrollService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, id); + unionSelect.setAuditState(7715); + unionSelect.setSchoolAuditId(audit.getId()); + enrollService.update(unionSelect); + TheRapyRecuperationLine line = enrollService.dao().fetch(TheRapyRecuperationLine.class, unionSelect.getLineId()); + Sys_user user = enrollService.dao().fetch(Sys_user.class, unionSelect.getSelectUserId()); + msgApi.sendTextMsg("您备案的疗休养【"+line.getLineName()+"】校工会退回,请修改后在提交审核!", user.getLoginname()); + return Result.success(); + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnionAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnionAuditController.java new file mode 100644 index 0000000..a4810f4 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnionAuditController.java @@ -0,0 +1,164 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.enrollAudit; + +import cn.hutool.core.date.DateUtil; +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.model.Audit; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Strings; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.Date; + +/** + * @author zhf + * @date 2025/5/20 18:42 + * @description 分工会审核 + */ +@IocBean +@At("/platform/theRapyRecuperation/enrollAudit/unionAudit") +@Ok("json:full") +public class TheRapyRecuperationEnrollUnionAuditController { + + @Inject + private TheRapyRecuperationEnrollService enrollService; + @Inject + private MsgApi msgApi; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/enrollAudit/unionAudit.html") + @RequiresPermissions("theRapyRecuperation.enrollAudit.unionAudit") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.enrollAudit.unionAudit") + public Object pageData(PageForm pageForm, + @Param(value = "startYear", required = false) Integer startYear, + @Param(value = "endYear", required = false) Integer endYear, + @Param("takePartInLineId") String takePartInLineId, + @Param(value = "lotId", required = false) String lotId, + @Param(value = "signUpMode", required = false) String signUpMode, + @Param(value = "selectId", required = false) String selectId, + @Param(value = "isAudit", required = false) Integer isAudit, + @Param(value = "regionalNature", required = false) String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + st.stateName, + u.username, + u.loginname, + line.id, + line.lineName, + line.regionalNature, + lineu.lineId, + lineu.id as lineUId, + lineu.signUpMode, + lineu.auditState, + lineu.minimumGroupSize, + lineu.estimatedFamilyNumbers, + YEAR(lineu.selectTime) as `year`, + CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, + lineu.playStartTime as playStartTime1, + lineu.playEndTime as playEndTime2, + lxs.travelAgencyName, + lxs.contact, + lxs.contactMobileNumber, + enroll.takePartInUnionId AS usUnionId, + un.unionname as unionname, + lot.lotName, + lot.lotValue, + enroll.familyNumber, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=2750 and isNormal = true $unionCnd) lineNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where stateId=2750 and takePartInLineId = lineu.id and isNormal = true $unionCnd)) as signUpUserFamilyNum + FROM + + the_rapy_recuperation_line_union_select lineu + LEFT JOIN `the_rapy_recuperation_enroll` enroll ON lineu.id=enroll.takePartInLineId + left join `user` u on u.id=lineu.selectUserId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON line.travelAgencyId = lxs.id + LEFT JOIN sys_union un ON un.id = lineu.unionId + left join audit_state st on st.stateId=lineu.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + if (isAudit != 0) { + cnd.andEX("lineu.auditState", isAudit == 1 ? ">" : "=", 7700); + } + cnd.andEX("groupSuccess", "=", 1); + cnd.andEX("YEAR(lineu.selectTime)", ">=", startYear); + cnd.andEX("YEAR(lineu.selectTime)", "<=", endYear); + cnd.andEX("lineu.signUpMode", "=", signUpMode); + cnd.and("lineu.unionId", "=", Vi.getUnionId()); + + cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("lineu.id", "=", selectId); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.groupBy("enroll.takePartInLineId"); + cnd.asc("line.serialNumber").asc("lineu.playStartTime"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.enrollAudit.unionAudit") + public Result doPass(String id, Audit audit) { + audit.setAuditTime(new Date()); + audit.setLoginname(ShiroUtil.getPlatformLoginname()); + audit.setUsername(ShiroUtil.getPlatformUsername()); + audit.setAuditor(ShiroUtil.getUserId()); + enrollService.insert(audit); + TheRapyRecuperationLineUnionSelect unionSelect = enrollService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, id); + unionSelect.setAuditState(7707); + unionSelect.setUnionAuditId(audit.getId()); + enrollService.update(unionSelect); + return Result.success(); + } + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.enrollAudit.unionAudit") + public Result doBack(String id, Audit audit) { + audit.setAuditTime(new Date()); + audit.setLoginname(ShiroUtil.getPlatformLoginname()); + audit.setUsername(ShiroUtil.getPlatformUsername()); + audit.setAuditor(ShiroUtil.getUserId()); + enrollService.insert(audit); + TheRapyRecuperationLineUnionSelect unionSelect = enrollService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, id); + unionSelect.setAuditState(7703); + unionSelect.setUnionAuditId(audit.getId()); + enrollService.update(unionSelect); + TheRapyRecuperationLine line = enrollService.dao().fetch(TheRapyRecuperationLine.class, unionSelect.getLineId()); + Sys_user user = enrollService.dao().fetch(Sys_user.class, unionSelect.getSelectUserId()); + msgApi.sendTextMsg("您备案的疗休养【"+line.getLineName()+"】分工会退回,请修改后在提交审核!", user.getLoginname()); + return Result.success(); + } + +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnitLeaderAuditController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnitLeaderAuditController.java new file mode 100644 index 0000000..176917a --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/enrollAudit/TheRapyRecuperationEnrollUnitLeaderAuditController.java @@ -0,0 +1,172 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.enrollAudit; + +import cn.wizzer.framework.base.Result; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.model.Audit; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +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 org.nutz.mvc.annotation.Param; + +import java.util.Date; +import java.util.List; + +/** + * @author zhf + * @date 2025/5/20 19:16 + * @description 单位领导审核 + */ +@IocBean +@At("/platform/theRapyRecuperation/enrollAudit/unitLeaderAudit") +@Ok("json:full") +public class TheRapyRecuperationEnrollUnitLeaderAuditController { + + @Inject + private TheRapyRecuperationEnrollService enrollService; + + @Inject + private MsgApi msgApi; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/enrollAudit/unitLeaderAudit.html") + @RequiresPermissions("theRapyRecuperation.enrollAudit.unitLeaderAudit") + public void index() { + } + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.enrollAudit.unitLeaderAudit") + public Object pageData(PageForm pageForm, + @Param(value = "startYear", required = false) Integer startYear, + @Param(value = "endYear", required = false) Integer endYear, + @Param("takePartInLineId") String takePartInLineId, + @Param(value = "lotId", required = false) String lotId, + @Param(value = "signUpMode", required = false) String signUpMode, + @Param(value = "selectId", required = false) String selectId, + @Param(value = "isAudit", required = false) Integer isAudit, + @Param(value = "regionalNature", required = false) String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + st.stateName, + u.username, + u.loginname, + line.id, + line.lineName, + line.regionalNature, + lineu.lineId, + lineu.id as lineUId, + lineu.signUpMode, + lineu.auditState, + lineu.minimumGroupSize, + lineu.estimatedFamilyNumbers, + YEAR(lineu.selectTime) as `year`, + CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, + lineu.playStartTime as playStartTime1, + lineu.playEndTime as playEndTime2, + lxs.travelAgencyName, + lxs.contact, + lxs.contactMobileNumber, + enroll.takePartInUnionId AS usUnionId, + un.unionname as unionname, + lot.lotName, + lot.lotValue, + enroll.familyNumber, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=2750 and isNormal = true $unionCnd) lineNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where stateId=2750 and takePartInLineId = lineu.id and isNormal = true $unionCnd)) as signUpUserFamilyNum + FROM + + the_rapy_recuperation_line_union_select lineu + LEFT JOIN `the_rapy_recuperation_enroll` enroll ON lineu.id=enroll.takePartInLineId + left join `user` u on u.id=lineu.selectUserId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON line.travelAgencyId = lxs.id + LEFT JOIN sys_union un ON un.id = lineu.unionId + left join audit_state st on st.stateId=lineu.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + if (isAudit != 0) { + cnd.andEX("lineu.auditState", isAudit == 1 ? ">" : "=", 7707); + }else{ + cnd.andEX("lineu.auditState", ">=", 7707); + } + cnd.andEX("groupSuccess", "=", 1); + cnd.andEX("YEAR(lineu.selectTime)", ">=", startYear); + cnd.andEX("YEAR(lineu.selectTime)", "<=", endYear); + cnd.andEX("lineu.signUpMode", "=", signUpMode); + if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,SchoolUnionLxyAdmin")){ + if (Vi.getUnion().getUnioncode().equals("01")){ + cnd.and("lineu.unionId", "in", List.of("7406938f3d6645308245eab9394943d8","fc38a500c0d64218ada03ac49b39c856","9c8639134e1547259c4b2e0f509641aa")); + }else{ + cnd.and("lineu.unionId", "=", Vi.getUnionId()); + } + } + + + + cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("lineu.id", "=", selectId); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.groupBy("enroll.takePartInLineId"); + cnd.asc("line.serialNumber").asc("lineu.playStartTime"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.enrollAudit.unitLeaderAudit") + public Result doPass(String id, Audit audit) { + audit.setAuditTime(new Date()); + audit.setLoginname(ShiroUtil.getPlatformLoginname()); + audit.setUsername(ShiroUtil.getPlatformUsername()); + audit.setAuditor(ShiroUtil.getUserId()); + enrollService.insert(audit); + TheRapyRecuperationLineUnionSelect unionSelect = enrollService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, id); + unionSelect.setAuditState(7712); + unionSelect.setUnitLeaderAuditId(audit.getId()); + enrollService.update(unionSelect); + return Result.success(); + } + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.enrollAudit.unitLeaderAudit") + public Result doBack(String id, Audit audit) { + audit.setAuditTime(new Date()); + audit.setLoginname(ShiroUtil.getPlatformLoginname()); + audit.setUsername(ShiroUtil.getPlatformUsername()); + audit.setAuditor(ShiroUtil.getUserId()); + enrollService.insert(audit); + TheRapyRecuperationLineUnionSelect unionSelect = enrollService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, id); + unionSelect.setAuditState(7710); + unionSelect.setUnitLeaderAuditId(audit.getId()); + enrollService.update(unionSelect); + TheRapyRecuperationLine line = enrollService.dao().fetch(TheRapyRecuperationLine.class, unionSelect.getLineId()); + Sys_user user = enrollService.dao().fetch(Sys_user.class, unionSelect.getSelectUserId()); + msgApi.sendTextMsg("您备案的疗休养【"+line.getLineName()+"】单位领导退回,请修改后在提交审核!", user.getLoginname()); + return Result.success(); + } + +} 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 ac437e4..19d7c0a 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 @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; -import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; @@ -8,18 +7,15 @@ import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.query.PageForm; import io.v.nutz.sys.models.Sys_config; -import io.v.nutz.sys.models.Sys_user; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; -import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.model.*; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationCommonService; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; +import io.v.nutz.web.commons.slog.annotation.SLog; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.nutz.dao.Chain; import org.nutz.dao.Cnd; @@ -35,7 +31,7 @@ import java.util.*; import java.util.stream.Collectors; /** - * @FileName io.v.nutz.therapyRecuperation.controller.process.TheRapyRecuperationEnroll + * @FileName io.v.nutz.zhgh.therapyRecuperation.controller.process.TheRapyRecuperationEnroll * @Description: 疗休养报名报名 * @Author zxc * @Date 2022/5/31:16:58 @@ -83,7 +79,7 @@ public class TheRapyRecuperationEnrollController { * @param unionId 选择的工会id * @param theRapyRecuperationType 线路类型 见下枚举类 * @return {@link Object} - * @see TheRapyRecuperationType + * @see io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType */ @At @POST @@ -94,27 +90,40 @@ public class TheRapyRecuperationEnrollController { } @At - @POST @ViReturn - @RequiresAuthentication - public Object getSelectLineById(String lineId, String unionId, int theRapyRecuperationType, Integer lineUnionType) { - return enrollService.getSelectLineById(lineId, unionId, theRapyRecuperationType, lineUnionType); + @SLog(type = "lxy", tag = "我的疗休养", msg = "疗休养评价") + public Object doEvaluate(TheRapyRecuperationEvaluate rapyRecuperationEvaluate) { + rapyRecuperationEvaluate.setUserId(ShiroUtil.getUserId()); + rapyRecuperationEvaluate.setUserName(ShiroUtil.getPlatformUsername()); + rapyRecuperationEvaluate.setLoginName(ShiroUtil.getPlatformLoginname()); + rapyRecuperationEvaluate.setApplyDate(new Date()); + enrollService.dao().insertOrUpdate(rapyRecuperationEvaluate); + return null; + } + + @At + @ViReturn + public Object finOneEvaluate(String lineId) { + TheRapyRecuperationEvaluate fetch = enrollService.dao().fetch(TheRapyRecuperationEvaluate.class, + Cnd.where("userId", "=", ShiroUtil.getUserId()) + .and("lineId", "=", lineId)); + return fetch; } @At @POST @ViReturn @RequiresAuthentication - public Object openSignUser(String usId, String travelId, String searchKeyWord) { - return enrollService.openSignUser(usId, travelId, searchKeyWord); + public Object getSelectLineById(String lineId, String unionId, int theRapyRecuperationType, @Param(value = "lineUnionType", required = false) Integer lineUnionType) { + return enrollService.getSelectLineById(lineId, unionId, theRapyRecuperationType, lineUnionType); } //获取设置了公开线路的分工会 @At @ViReturn @RequiresAuthentication - public Object getTheRapyUnions(Integer year, int theRapyRecuperationType) { - return enrollService.getTheRapyUnions(year, theRapyRecuperationType); + public Object getTheRapyUnions(Integer year) { + return enrollService.getTheRapyUnions(year); } @@ -131,15 +140,7 @@ public class TheRapyRecuperationEnrollController { public Object doSignUpForLine(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) { //省外的线路报名需要判断 // if (lineInfo.getRegionalNature().equals(TheRapyRecuperationProvinceType.provinceOut.getValue())) { - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); - Map validResult = new HashMap<>(); - if("zjxu".equals(config.getConfigValue())) { - validResult = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else if("zjiet".equals(config.getConfigValue())) { - validResult = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else if("zjnu".equals(config.getConfigValue())) { - validResult = enrollService.validSignUpInfoForZJNU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } + Map validResult = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); if (validResult.containsKey(false)) { return Result.error(validResult.get(false)); } @@ -163,15 +164,7 @@ public class TheRapyRecuperationEnrollController { @ViReturn @RequiresAuthentication public Object doSignUpForTravelAgency(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) { - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); - Map resultMap = new HashMap<>(); - if("zjxu".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else if("zjiet".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else if("zjnu".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfoForZJNU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } + Map resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); if (resultMap.containsKey(false)) { return Result.error(resultMap.get(false)); } @@ -194,17 +187,10 @@ public class TheRapyRecuperationEnrollController { @ViReturn @RequiresAuthentication public Object doSignUpForBaseManagement(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) { - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); - Map resultMap = new HashMap<>(); - if("zjxu".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfoForZJXU((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } else { - resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); - } + Map resultMap = enrollService.validSignUpInfo((String) ShiroUtil.getPrincipalProperty("loginname"), enrollInfo); if (resultMap.containsKey(false)) { return Result.error(resultMap.get(false)); } - if (StrUtil.isBlank(enrollInfo.getId())) { enrollService.doSignUpForHotel(enrollInfo); } else { @@ -300,20 +286,10 @@ public class TheRapyRecuperationEnrollController { && StrUtil.isBlank(enrollInfo.getTakePartInLineId())) { return Result.error("线路信息不能为空"); } - if (StrUtil.isBlank(enrollInfo.getLoginName())){ enrollInfo.setLoginName(ShiroUtil.getPrincipalProperty("loginname").toString()); } - - Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion")); - Map resultMap = new HashMap<>(); - if("zjxu".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfoForZJXU(enrollInfo.getLoginName(), enrollInfo); - } else if("zjiet".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfo(enrollInfo.getLoginName(), enrollInfo); - } else if("zjnu".equals(config.getConfigValue())) { - resultMap = enrollService.validSignUpInfoForZJNU(enrollInfo.getLoginName(), enrollInfo); - } + Map resultMap = enrollService.validSignUpInfo(enrollInfo.getLoginName(), enrollInfo); if (resultMap.containsKey(false)) { return Result.error(resultMap.get(false)); } @@ -335,22 +311,6 @@ public class TheRapyRecuperationEnrollController { return null; } - - /** - * 删除我的报名信息 - * - * @param id id - * @return {@link Object} - */ - @At("/doModify/?") - @POST - @ViReturn - @RequiresAuthentication - public Object doModify(String id) { - enrollService.update(Chain.make("isNormal",false),Cnd.where("id","=",id)); - return null; - } - /** * 能取消吗 * @@ -426,8 +386,8 @@ public class TheRapyRecuperationEnrollController { Sql sql = Sqls.create(""" select - (select count(1) from the_rapy_recuperation_enroll where isNormal=true and takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode) as signUpUserNum, - (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where isNormal=true and takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode)) as signUpUserFamilyNum + (select count(1) from the_rapy_recuperation_enroll where takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode) as signUpUserNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInUnionId = @unionId AND takePartInLineId = @lineId AND stateId = @signUpSuccessCode)) as signUpUserFamilyNum """); sql.setParam("signUpSuccessCode", TheRapyRecuperationState.PASS); sql.setParam("lineId", lineId); @@ -447,25 +407,8 @@ public class TheRapyRecuperationEnrollController { @GET @ViReturn @RequiresAuthentication - public Object selectLineAllInfo(@Param("usId") String usId, - @Param("usUnionId") String usUnionId, - @Param("year") String year) { + public Object selectLineAllInfo(@Param("usId") String usId, @Param("usUnionId") String usUnionId) { Assert.notBlank(usId); - return enrollService.selectLineAllInfo(usId, usUnionId, year); - } - - @At - @ViReturn - @RequiresAuthentication - public Object getSchoolTime() { - Sys_user sysUser = dao.fetch(Sys_user.class, ShiroUtil.getUserId()); - if(StrUtil.isNotBlank(sysUser.getSchoolTime())) { - DateTime schoolDate = DateUtil.parse(sysUser.getSchoolTime()); - DateTime time = DateUtil.parse(DateUtil.thisYear() + "-07-01"); - int compareResult = DateUtil.compare(schoolDate, time); - return compareResult >= 0 ? sysUser.getSchoolTime() : null; - } else { - return null; - } + return enrollService.selectLineAllInfo(usId, usUnionId); } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java index b7a811f..7efdcf0 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationEnrollJoinUserImportController.java @@ -10,9 +10,9 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.result.Result; -import io.v.nutz.base.utils.ViTool; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollJoinUserImportService; +import io.v.nutz.base.utils.ViTool; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresPermissions; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java index 1fcbef1..a2edcb6 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineAdjustmentController.java @@ -3,8 +3,8 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; import cn.hutool.core.lang.Assert; import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.utils.MsgApi; +import io.v.nutz.base.query.PageForm; import io.v.nutz.sys.models.Sys_user; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; @@ -73,7 +73,7 @@ public class TheRapyRecuperationLineAdjustmentController { @POST @Ok("json:full") @ViReturn - @RequiresRoles(value = {"sysadmin", "A06", "H04"}, logical = Logical.OR) + @RequiresRoles(value = {"sysadmin", "SchoolUnionAdmin", "H04"}, logical = Logical.OR) public Object pageData(PageForm pageForm, Integer year, String lineId, @@ -193,7 +193,7 @@ public class TheRapyRecuperationLineAdjustmentController { String username = usernameMap.get(v); String content = "%s老师您好,您报名的%s【%s-%s】(%s至%s)线路未达到成团标准,现已解散,请您选择其他线路进行报名!" .formatted(username,lineName,lotName,regionalNature,playStartTime,playEndTime); - //msgApi.sendWxMsg(content,v); +// msgApi.sendWxMsg(content,v); }); } return Result.success(); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java index b32db49..2b5cafe 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineClusterController.java @@ -4,10 +4,10 @@ import cn.hutool.core.lang.Assert; import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.query.PageForm; -import io.v.nutz.web.commons.slog.annotation.SLog; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationClusterMember; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineClusterService; +import io.v.nutz.web.commons.slog.annotation.SLog; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java index 4156d92..65f00e5 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationLineUnionSelectController.java @@ -2,15 +2,23 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.base.Result; +import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.utils.Vi; -import io.v.nutz.web.commons.slog.annotation.SLog; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.sys.models.Sys_user; import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.zhgh.therapyRecuperation.model.*; +import io.v.nutz.zhgh.activity.models.ActivityUserScope; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationSignUpMode; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineUnionSelectService; +import io.v.nutz.web.commons.slog.annotation.SLog; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresAuthentication; @@ -23,10 +31,12 @@ import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; import org.nutz.dao.util.Daos; import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.dao.util.cri.Static; import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.POST; @@ -43,24 +53,25 @@ import java.util.stream.Collectors; * @date 2023/06/26 */ @IocBean -@At(value = {"/platform/theRapyRecuperation/lineFghSelect", "/platform/theRapyRecuperation/lineXghSelect", "/platform/theRapyRecuperation/lineUnionSelect"}) +@At(value = { + "/platform/theRapyRecuperation/lineFghSelect", + "/platform/theRapyRecuperation/lineXghSelect", + "/platform/theRapyRecuperation/linePersonalSelect", +}) @Ok("json:full") @Slf4j public class TheRapyRecuperationLineUnionSelectController { @Inject private Vi vi; - @Inject private Dao dao; - @Inject private TheRapyRecuperationLineUnionSelectService unionSelectService; @At("") @Ok("re") -// @Ok("beetl:/platform/theRapyRecuperation/process/lineUnionSelect.html") - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) public String index(@Param("mode") Integer mode) { return "beetl:/platform/theRapyRecuperation/process/lineUnionSelect.html"; } @@ -75,62 +86,64 @@ public class TheRapyRecuperationLineUnionSelectController { @At @POST @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) public Object pageData(PageForm pageForm, Integer year, String keywords, int selectStatus, String unionId, String lotId, String travelAgencyId, Integer mode, String regionalNature) { - TheRapyRecuperationConfig config = unionSelectService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + year = year == null ? DateUtil.thisYear() : year; Cnd cnd = Cnd.NEW(); cnd.andEX("line.lotId", "=", lotId); - cnd.andEX("us.travelAgencyId", "=", travelAgencyId); + cnd.andEX("line.travelAgencyId", "=", travelAgencyId); if (!"全部".equals(regionalNature)) { cnd.andEX("line.regionalNature", "=", regionalNature); } + cnd.and("line.signUpMode", "=", mode); //当前登录用户已选择的线路id - Sql hasSelectLineSql; - if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { - cnd.and(Cnd.exps("line.createUnionId", "=", Vi.getUnionId()).or("createMode", "=", 2)); + Sql hasSelectLineSql = null; + + if(mode == 1) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.or("line.openChoose", "=", true); + group.or(Cnd.exps("line.openChoose", "=", false).and("line.createUnionId", "=", Vi.getUnionId())); + cnd.and(group); + hasSelectLineSql = Sqls.createf(""" select lineId from the_rapy_recuperation_line_union_select where selectUserId = '%s' AND unionId = '%s' AND year(selectTime) = %s - """, ShiroUtil.getPrincipalProperty("id"), Vi.getUnionId(), year == null ? DateUtil.thisYear() : year); - } else { + """, ShiroUtil.getUserId(), Vi.getUnionId(), year); + } else if(mode == 2) { hasSelectLineSql = Sqls.createf(""" - select lineId from the_rapy_recuperation_line_union_select where year(selectTime) = %s - """, year == null ? DateUtil.thisYear() : year); + select lineId from the_rapy_recuperation_line_union_select where year(selectTime) = %s and signUpMode = %s + """, year, TheRapyRecuperationSignUpMode.FREE.getValue()); + } else if(mode == 3) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.or("line.openChoose", "=", true); + group.or(Cnd.exps("line.openChoose", "=", false).and("line.opBy", "=", ShiroUtil.getUserId())); + cnd.and(group); + //个人 + hasSelectLineSql = Sqls.createf(""" + select lineId from the_rapy_recuperation_line_union_select where selectUserId = '%s' and year(selectTime) = %s and signUpMode = %s + """, ShiroUtil.getUserId(), year, TheRapyRecuperationSignUpMode.PERSONAL.getValue()); } - /*hasSelectLineSql = Sqls.createf(""" - select lineId from the_rapy_recuperation_line_union_select where unionId = '%s' - """, Vi.getUnionId());*/ - switch (selectStatus) { //查询未选择的线路 case -1 -> { cnd.and("line.id", "not in", hasSelectLineSql); - cnd.and("line.year", "in", year == null ? Lang.array(config.getProvinceStartYear(), config.getProvinceStartYear() + 1) : year); + cnd.and("line.year", "in", year); } - case 0 -> { SqlExpressionGroup seg = new SqlExpressionGroup(); seg.or("us.signUpMode", "is", null); seg.or("us.signUpMode", "=", mode); cnd.and(seg); } - - /*case 0 -> { - SqlExpressionGroup seg = new SqlExpressionGroup(); - seg.or(Cnd.exps("line.id", "not in", hasSelectLineSql).and("line.createMode", "=", TheRapyRecuperationLineCreateMode.SCHOOL.getValue())); - seg.or("line.id", "in", hasSelectLineSql); - cnd.and(seg); - }*/ - //查询已选择的线路 case 1 -> { cnd.and("line.id", "in", hasSelectLineSql); cnd.and("us.signUpMode", "=", mode); - cnd.and("year(us.selectTime)", "=", year == null ? DateUtil.thisYear() : year); + cnd.and("year(us.selectTime)", "=", year); } } @@ -147,7 +160,7 @@ public class TheRapyRecuperationLineUnionSelectController { } else { cnd.asc("createUnionId").desc("year").asc("serialNumber"); } - return unionSelectService.pageData(pageForm, cnd, year); + return unionSelectService.pageData(pageForm, cnd, year, mode); } /** @@ -159,7 +172,7 @@ public class TheRapyRecuperationLineUnionSelectController { @At("/selectLine") @POST @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) public Object selectLine(TheRapyRecuperationLineUnionSelect us) { unionSelectService.selectLine(us); return null; @@ -174,15 +187,12 @@ public class TheRapyRecuperationLineUnionSelectController { @At("/selectLineTimes") @POST @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) @Aop(TransAop.READ_COMMITTED) public Object selectLineTimes(@Param("lineUnionSelects") TheRapyRecuperationLineUnionSelect[] lineUnionSelects) { if (Lang.isNotEmpty(lineUnionSelects)) { TheRapyRecuperationLineUnionSelect lineUnionSelect = lineUnionSelects[0]; - List oldUnionSelects = unionSelectService.query(Cnd.where("unionId", "=", Vi.getUnionId()).and("lineId", "=", lineUnionSelect.getUnionId())); - - //组织形式 - int signUpMode = ShiroUtil.hasRole("H04") ? 1 : 2; + List oldUnionSelects = unionSelectService.query(Cnd.where("selectUserId", "=", ShiroUtil.getUserId()).and("lineId", "=", lineUnionSelect.getLineId())); TheRapyRecuperationLineUnionSelect theRapyRecuperationLineUnionSelect = dao.fetch(TheRapyRecuperationLineUnionSelect.class, Cnd.where("id", "=", lineUnionSelect.getId())); @@ -190,16 +200,35 @@ public class TheRapyRecuperationLineUnionSelectController { unionSelect.setSelectTime(new Date()); unionSelect.setSelectUserId(ShiroUtil.getPlatformUid()); unionSelect.setUnionId(Vi.getUnionId()); - unionSelect.setIsOpen(Lang.isNotEmpty(theRapyRecuperationLineUnionSelect) ? theRapyRecuperationLineUnionSelect.getIsOpen() : true); - //unionSelect.setDelFlag(signUpMode == 2); - unionSelect.setSignUpMode(signUpMode); + unionSelect.setIsOpen(Lang.isNotEmpty(theRapyRecuperationLineUnionSelect)?theRapyRecuperationLineUnionSelect.getIsOpen():false); + unionSelect.setDelFlag(false); + + //如果是个人组织,加自己 + if(unionSelect.getSignUpMode() == 3) { + if(Lang.isEmpty(unionSelect.getChooseUserList())) { + unionSelect.setChooseUserList(new ArrayList<>()); + } + List list = unionSelect.getChooseUserList().stream().map(o -> o.getString("id")).toList(); + Sys_user currentUser = (Sys_user) ShiroUtil.getPrincipal(); + if(currentUser != null && !list.contains(ShiroUtil.getUserId())) { + NutMap map = new NutMap(); + map.put("id", currentUser.getId()); + map.put("sex", currentUser.getSex()); + map.put("mobile", currentUser.getMobile()); + map.put("unitname", currentUser.getUnit() != null ? currentUser.getUnit().getName() : ""); + map.put("username", currentUser.getUsername()); + map.put("loginname", currentUser.getLoginname()); + map.put("unionname", currentUser.getUnion() != null ? currentUser.getUnion().getUnionname() : ""); + unionSelect.getChooseUserList().add(map); + } + } } //新增或修改 dao.insertOrUpdate(lineUnionSelects); - List newIds = Arrays.stream(lineUnionSelects).map(v -> v.getId()).collect(Collectors.toList()); + List newIds = Arrays.stream(lineUnionSelects).map(TheRapyRecuperationLineUnionSelect::getId).toList(); //删除 - List deleteIds = oldUnionSelects.stream().map(v -> v.getId()).filter(v -> !newIds.contains(v)).collect(Collectors.toList()); + List deleteIds = oldUnionSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).filter(v -> !newIds.contains(v)).collect(Collectors.toList()); unionSelectService.clear(Cnd.where("id", "in", deleteIds)); } return null; @@ -208,19 +237,19 @@ public class TheRapyRecuperationLineUnionSelectController { @At @POST - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) public Object selectLineInfo(@Param("lineId") String lineId, @Param("unionId") String unionId, @Param("mode") Integer mode, @Param("year") Integer year) { try { Assert.notBlank(lineId); Assert.notNull(mode); unionId = StrUtil.emptyToNull(Vi.getUnionId()); - if (mode == 1 && !ShiroUtil.hasRole("H04")&&!ShiroUtil.hasRole("sysadmin")) { + if (mode == 1 && !ShiroUtil.hasRole("H04")) { return Result.error("您没有分工会角色权限!"); - } else if (mode == 2 && !ShiroUtil.hasRole("SchoolUnionAdmin")&&!ShiroUtil.hasRole("sysadmin")) { + } else if (mode == 2 && !ShiroUtil.hasRole("SchoolUnionAdmin")) { return Result.error("您没有校工会角色权限!"); } - return Result.success(unionSelectService.selectLineInfo(lineId, unionId, mode, year)); + return Result.success(unionSelectService.selectLineInfo(lineId, unionId,mode, year)); } catch (Exception e) { log.error(e.getMessage()); return Result.error(e.getMessage()); @@ -237,7 +266,7 @@ public class TheRapyRecuperationLineUnionSelectController { @At @POST @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) public Object findUsLineInfo(String lineId, String usUnionId) { return unionSelectService.findUsLineInfo(lineId, usUnionId); } @@ -245,7 +274,7 @@ public class TheRapyRecuperationLineUnionSelectController { @At("/deSelect") @POST @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) @SLog(tag = "疗休养", msg = "取消选择线路", param = true, result = true) @Aop(TransAop.READ_COMMITTED) public Object deSelect(@Param("lineId") String lineId, @Param("unionId") String unionId) { @@ -256,29 +285,8 @@ public class TheRapyRecuperationLineUnionSelectController { // enrollCnd.and("takePartInLineId", "=", lineId); Cnd enrollCnd = Cnd.where("unionId", "=", unionId); enrollCnd.and("lineId", "=", lineId); - - List unionSelects = unionSelectService.query(enrollCnd); - List list = unionSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList()); - - List enrolls = unionSelectService.dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "in", list)); - List enrollIdList = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); - List bedIdList = enrolls.stream().map(TheRapyRecuperationEnroll::getBedInfoId).collect(Collectors.toList()); - //同伴信息 - List companions = unionSelectService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", enrollIdList)); - List comBedIdList = companions.stream().map(TheRapyRecuperationEnrollCompanion::getBedInfoId).collect(Collectors.toList()); - - //删除报名记录 - unionSelectService.dao().clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "in", enrollIdList)); - //删除床位记录 - unionSelectService.dao().clear(TheRapyRecuperationEnrollBed.class, Cnd.where("id", "in", bedIdList)); - //删除同伴信息 - unionSelectService.dao().clear(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", enrollIdList)); - //删除变更记录 - unionSelectService.dao().clear(TheRapyRecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "in", enrollIdList)); - //删除同伴床位信息 - unionSelectService.dao().clear(TheRapyRecuperationEnrollBed.class, Cnd.where("id", "in", comBedIdList)); - unionSelectService.clear(enrollCnd); + return Result.success(); } catch (Exception e) { return Result.error(e.getMessage()); @@ -293,7 +301,7 @@ public class TheRapyRecuperationLineUnionSelectController { */ @At @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) public Object getTravelAgencyOptions() { List travelAgencies = unionSelectService.dao().query(TheRapyRecuperationTravelAgency.class, Cnd.NEW().asc("serialNumber")); return travelAgencies; @@ -321,7 +329,7 @@ public class TheRapyRecuperationLineUnionSelectController { @At("/getLineConfig/?") @POST @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) public Object getLineConfig(String id) { Sql sql = Sqls.create("select lotId from the_rapy_recuperation_line where id = @lineId"); sql.setParam("lineId", id); @@ -330,52 +338,89 @@ public class TheRapyRecuperationLineUnionSelectController { Integer cost = Optional.ofNullable(lotInfo).map(v -> v.getActivityCost()).orElse(0); TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); Integer groupNumber = Optional.ofNullable(config).map(TheRapyRecuperationConfig::getGroupNumber).orElse(0); - Integer outsideQuota = Optional.ofNullable(config).map(TheRapyRecuperationConfig::getOutsideQuota).orElse(0); - return Result.success(Map.of("cost", cost, "groupNumber", groupNumber, "outsideQuota", outsideQuota)); + return Result.success(Map.of("cost", cost, "groupNumber", groupNumber)); } /** * 一键统赋时间,针对于已选择的线路 - * - * @param lineIds 线路Id数组 + * @param lineIds 线路Id数组 * @param lineUnionSelects 出行时段 * @return {@link Object} */ @At("/setGiveLineTimes") @POST @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) @Aop(TransAop.READ_COMMITTED) - @SLog(type = "普惠疗休养", tag = "分工会/校工会选择线路", msg = "一键统赋时间,针对于已选择的线路", param = true, result = true) - public Object setGiveLineTimes(@Param("lineIds") String[] lineIds, @Param("lineUnionSelects") TheRapyRecuperationLineUnionSelect[] lineUnionSelects) { + @SLog(type = "普惠疗休养",tag = "分工会/校工会选择线路",msg = "一键统赋时间,针对于已选择的线路",param = true,result = true) + public Object setGiveLineTimes(@Param("lineIds") String[] lineIds,@Param("lineUnionSelects") TheRapyRecuperationLineUnionSelect[] lineUnionSelects, + @Param(value = "year",required = false) Integer year) { if (Lang.isNotEmpty(lineUnionSelects) && Lang.isNotEmpty(lineIds)) { TheRapyRecuperationLineUnionSelect lineUnionSelect = lineUnionSelects[0]; - Chain chain = Chain.make("enable", 1); - if (lineUnionSelect.getSignUpStartTime() != null) - chain.add("signUpStartTime", lineUnionSelect.getSignUpStartTime()); - if (lineUnionSelect.getSignUpEndTime() != null) - chain.add("signUpEndTime", lineUnionSelect.getSignUpEndTime()); - if (lineUnionSelect.getChangeEndTime() != null) - chain.add("changeEndTime", lineUnionSelect.getChangeEndTime()); - if (lineUnionSelect.getPlayStartTime() != null) - chain.add("playStartTime", lineUnionSelect.getPlayStartTime()); - if (lineUnionSelect.getPlayEndTime() != null) chain.add("playEndTime", lineUnionSelect.getPlayEndTime()); + Cnd cnd = Cnd.NEW(); + cnd.and("unionId","=",Vi.getUnionId()); + cnd.and("selectUserId","=", ShiroUtil.getUserId()); + cnd.and("YEAR(selectTime)","=",year == null ? DateUtil.thisYear() : year); + List unionSelectList = dao.query(TheRapyRecuperationLineUnionSelect.class, cnd); - dao.update(TheRapyRecuperationLineUnionSelect.class, chain, Cnd.where("id", "in", lineIds)); + List selectIdList = unionSelectList.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList()); + Chain chain = Chain.make("enable",1); + if (lineUnionSelect.getSignUpStartTime() != null) chain.add("signUpStartTime",lineUnionSelect.getSignUpStartTime()); + if (lineUnionSelect.getSignUpEndTime() != null) chain.add("signUpEndTime",lineUnionSelect.getSignUpEndTime()); + if (lineUnionSelect.getChangeEndTime() != null) chain.add("changeEndTime",lineUnionSelect.getChangeEndTime()); + if (lineUnionSelect.getPlayStartTime() != null) chain.add("playStartTime",lineUnionSelect.getPlayStartTime()); + if (lineUnionSelect.getPlayEndTime() != null) chain.add("playEndTime",lineUnionSelect.getPlayEndTime()); + + dao.update(TheRapyRecuperationLineUnionSelect.class,chain,Cnd.where("id","in",selectIdList)); } return null; } + @At + @ViReturn + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) + @SLog(type = "普惠疗休养",tag = "分工会/校工会选择线路",msg = "是否开放对外报名",param = true,result = true) + public Object doEditOpen(String id){ + dao.update(TheRapyRecuperationLineUnionSelect.class,Chain.makeSpecial("isOpen", "isOpen ^ 1"), Cnd.where("id", "=", id)); + return null; + } @At @ViReturn - @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect"}, logical = Logical.OR) - @SLog(type = "普惠疗休养", tag = "分工会/校工会选择线路", msg = "是否开放对外报名", param = true, result = true) - public Object doEditOpen(String id) { - dao.update(TheRapyRecuperationLineUnionSelect.class, Chain.makeSpecial("isOpen", "isOpen ^ 1"), Cnd.where("id", "=", id)); - return null; + @RequiresPermissions(value = {"theRapyRecuperation.lineFghSelect", "theRapyRecuperation.lineXghSelect", "theRapyRecuperation.linePersonalSelect"}, logical = Logical.OR) + public Object queryJoinUser(String keyWord){ + Sql sql = Sqls.create(""" + select + id, + username, + loginname, + sex, + mobile, + unitname, + unionname + from + user + $condition + """); + Cnd cnd = Cnd.NEW(); + if(StrUtil.isNotBlank(keyWord)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.orLike("userName", keyWord); + seg.orLike("loginName", keyWord); + cnd.and(seg); + } + + TheRapyRecuperationConfig config = dao.fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + + cnd.and(new Static("id in (select userId from activity_user_scope where groupId = '%s')".formatted(config.getActivityGroupId()))); + + cnd.groupBy("id"); + cnd.asc("loginname"); + sql.setCondition(cnd); + Pagination pagination = unionSelectService.listPageMap(1, 30, sql); + return pagination.getList(); } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java index fdb31cf..190277b 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationStatisticsController.java @@ -1,9 +1,8 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.process; - - import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.service.BaseService; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; @@ -47,7 +46,7 @@ public class TheRapyRecuperationStatisticsController { Sql sql = Sqls.create(""" SELECT line.lineName, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE isNormal=true and line.id = takePartInLineId ) AS enrollNum, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE line.id = takePartInLineId ) AS enrollNum, ( SELECT COUNT( 1 ) @@ -123,7 +122,7 @@ public class TheRapyRecuperationStatisticsController { Sql sql = Sqls.create(""" SELECT agency.travelAgencyName, - ( SELECT AVG( evaluationForTravelAgency ) FROM the_rapy_recuperation_enroll where isNormal=true and agency.id=takePartInTravelAgencyId) AS avg + ( SELECT AVG( evaluationForTravelAgency ) FROM the_rapy_recuperation_enroll where agency.id=takePartInTravelAgencyId) AS avg FROM `the_rapy_recuperation_travel_agency` agency WHERE @@ -140,7 +139,7 @@ public class TheRapyRecuperationStatisticsController { Sql sql = Sqls.create(""" SELECT line.lineName, - ( SELECT AVG( evaluationForLine ) FROM the_rapy_recuperation_enroll where isNormal=true and line.id=takePartInLineId) AS avg + ( SELECT AVG( evaluationForLine ) FROM the_rapy_recuperation_enroll where line.id=takePartInLineId) AS avg FROM `the_rapy_recuperation_line` line WHERE diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java index 3036754..6a12baa 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUnionQueryController.java @@ -7,26 +7,21 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; - import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.page.Pagination; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.EmailUtil; import io.v.nutz.base.utils.Vi; - +import io.v.nutz.base.query.PageForm; import io.v.nutz.base.utils.ViTool; import io.v.nutz.sys.models.Sys_union; import io.v.nutz.sys.models.Sys_user; - -import io.v.nutz.web.commons.base.Globals; -import io.v.nutz.web.commons.slog.annotation.SLog; - import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.zhgh.therapyRecuperation.common.TherapyRecuperationCommon; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.model.*; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; +import io.v.nutz.web.commons.base.Globals; +import io.v.nutz.web.commons.slog.annotation.SLog; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -81,22 +76,15 @@ public class TheRapyRecuperationUnionQueryController { @At @ViReturn @RequiresAuthentication - public Object getXlData(PageForm pageForm, - String year, - String unionId, - String takePartInLineId, - String regionalNature, - String lotId, - String state, - String selectId) { + public Object getXlData(PageForm pageForm, String year, String unionId, String takePartInLineId, String regionalNature, String lotId) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT - enroll.id as enrollId, - lineu.id, + line.id, line.lineName, line.regionalNature, lineu.lineId, + lineu.id AS selectId, lineu.signUpMode, YEAR(lineu.selectTime) as `year`, CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, @@ -109,15 +97,15 @@ public class TheRapyRecuperationUnionQueryController { un.unionname, lot.lotName, lot.lotValue, - enroll.familyNumber, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE isNormal=true and takePartInLineId = lineu.id and stateId=@stateId $unionCnd) lineNum, - (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where isNormal=true and stateId=2750 and takePartInLineId = lineu.id $unionCnd)) as signUpUserFamilyNum + SUM(enroll.familyNumber) AS familyNumber, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=@stateId $unionCnd) lineNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInLineId = lineu.id $unionCnd)) as signUpUserFamilyNum 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_lot lot ON lot.id = line.lotId - LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lineu.travelAgencyId = lxs.id + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON line.travelAgencyId = lxs.id LEFT JOIN sys_union un ON un.id = enroll.takePartInUnionId $condition """).setParam("stateId", TheRapyRecuperationState.PASS); @@ -128,10 +116,10 @@ public class TheRapyRecuperationUnionQueryController { if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) { // sql.setVar("unionCnd", "and (takePartInUnionId='%s' or selfUnionId='%s')".formatted(Vi.getUnionId(), Vi.getUnionId())); - String unionCndSql = StrUtil.isBlank(year) ? "and (takePartInUnionId='%s' or selfUnionId='%s')".formatted(Vi.getUnionId(), Vi.getUnionId()) : "and (takePartInUnionId='%s' or selfUnionId='%s') and YEAR(signingUptime)='%s'".formatted(Vi.getUnionId(), Vi.getUnionId(), year); + String unionCndSql = StrUtil.isBlank(year) ? "and selfUnionId='%s'".formatted(Vi.getUnionId()) : "and selfUnionId='%s' and YEAR(signingUptime)='%s'".formatted(Vi.getUnionId(), year); sql.setVar("unionCnd", unionCndSql); - cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); - //cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); +// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); /* if (Strings.isNotBlank(unionId)) { cnd.andEX("enroll.selfUnionId", "=", unionId); //cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); @@ -141,38 +129,21 @@ public class TheRapyRecuperationUnionQueryController { }*/ } else { if (Strings.isNotBlank(unionId)) { - cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); - //cnd.and("enroll.selfUnionId", "=", unionId); +// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); + cnd.and("enroll.selfUnionId", "=", unionId); } } if (Strings.isNotBlank(regionalNature)) { sql.setVar("regionalNature", "AND line.regionalNature='%s'".formatted(regionalNature)); } - if(state.equals("2")) { - cnd.and("enroll.takePartInTravelAgencyId", "is not", null) - .and("enroll.takePartInTravelAgencyId", "!=", ""); - } else { - cnd.and("enroll.takePartInLineId", "is not", null) - .and("enroll.takePartInLineId", "!=", ""); - } cnd.andEX("line.lotId", "=", lotId); - cnd.andEX("lineu.lineId", "=", takePartInLineId); - cnd.andEX("lineu.id", "=", selectId); + cnd.andEX("line.id", "=", takePartInLineId); cnd.andEX("line.regionalNature", "=", regionalNature); cnd.groupBy("enroll.takePartInLineId"); cnd.desc("un.unioncode"); sql.setCondition(cnd); - Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); - List list = pagination.getList(); - list.forEach(v -> { - List companionList = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("enrollId"))); - for (TheRapyRecuperationEnrollCompanion enrollCompanion : companionList) { - baseService.dao().fetchLinks(enrollCompanion, "bedInfo"); - } - v.setv("companionList", companionList); - }); - return pagination; + return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); } @@ -181,8 +152,7 @@ public class TheRapyRecuperationUnionQueryController { @RequiresAuthentication public Object getRyData(PageForm pageForm, String year, String unionId, String unitId, String takePartInLineId, String regionalNature, String state, - String state2, String agencyId, String takePartInBaseManagementId, - String lotId, String selectId) { + String state2, String agencyId, String takePartInBaseManagementId, String lotId) { Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" SELECT @@ -193,7 +163,6 @@ public class TheRapyRecuperationUnionQueryController { agency.travelAgencyName, ma.baseName, enroll.*, - IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lineu.lineId, lineu.playStartTime, lineu.playEndTime, @@ -226,10 +195,10 @@ public class TheRapyRecuperationUnionQueryController { cnd.and(seg); } - if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { + if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) { if (Strings.isNotBlank(unionId) && state.equals("1")) { - cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); - //cnd.and("enroll.selfUnionId", "=", unionId); +// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); + cnd.and("enroll.selfUnionId", "=", unionId); } cnd.andEX("enroll.selfUnionId", "=", unionId); } else { @@ -249,21 +218,18 @@ public class TheRapyRecuperationUnionQueryController { cnd.andEX("lineu.signUpMode", "=", 2); } } else { - cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); - //cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); +// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); } } cnd.andEX("enroll.selfUnitId", "=", unitId); - cnd.andEX("lineu.lineId", "=", takePartInLineId); - cnd.andEX("lineu.id", "=", selectId); + cnd.andEX("line.id", "=", takePartInLineId); if (state.equals("1")) { cnd.andEX("line.regionalNature", "=", regionalNature); cnd.and("enroll.takePartInLineId", "is not", null); - cnd.and("enroll.takePartInLineId", "!=", ""); sql.setVar("lotSql", ",(select lotName from the_rapy_recuperation_lot where id = line.lotId) as lotName"); } else if (state.equals("2")) { cnd.and("enroll.takePartInTravelAgencyId", "is not", null); - cnd.and("enroll.takePartInTravelAgencyId", "!=", ""); cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); } else if ("3".equals(state)) { cnd.and("enroll.takePartInBaseManagementId", "is not", null); @@ -292,7 +258,7 @@ public class TheRapyRecuperationUnionQueryController { Sql sql = Sqls.create(""" SELECT *, - files AS fileId, + cast( files ->> '$[0].id' AS CHAR ) AS fileId, ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE agency.id = takePartInTravelAgencyId and isNormal=true and stateId=@stateId $unionCnd $yearCnd) agencyNum FROM the_rapy_recuperation_travel_agency agency @@ -357,7 +323,6 @@ public class TheRapyRecuperationUnionQueryController { state.stateName, state.stateColor, enroll.*, - IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lineu.lineId, lineu.playStartTime, lineu.playEndTime, @@ -385,17 +350,17 @@ public class TheRapyRecuperationUnionQueryController { cnd.andEX("enroll.stateId", "=", TheRapyRecuperationState.PASS); cnd.andEX("enroll.selfUnitId", "=", unitId); cnd.andEX("enroll.isNormal", "=", true); - if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) { if (StrUtil.isNotBlank(unionId)) { cnd.and("enroll.selfUnionId", "=", unionId); } else { - cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); - //cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); +// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); + cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); } } else { if (StrUtil.isNotBlank(unionId)) { - cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); - //cnd.and("enroll.selfUnionId", "=", unionId); +// cnd.and(Cnd.exps("enroll.takePartInUnionId", "=", unionId).or("enroll.selfUnionId", "=", unionId)); + cnd.and("enroll.selfUnionId", "=", unionId); } } cnd.desc("enroll.stateId"); @@ -444,6 +409,9 @@ public class TheRapyRecuperationUnionQueryController { if (Strings.isNotBlank(searchKeyword) && Strings.isNotBlank(searchName)) { cnd.and(Cnd.likeEX(searchName, searchKeyword)); } + if (!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionAdmin")) { + cnd.and(Cnd.exps("takePartInUnionId", "=", Vi.getUnionId()).or("selfUnionId", "=", Vi.getUnionId())); + } cnd.and("stateId", "=", TheRapyRecuperationState.PASS); cnd.and("isNormal", "=", true); cnd.desc("unitName"); @@ -536,7 +504,7 @@ public class TheRapyRecuperationUnionQueryController { @At @ViReturn @RequiresAuthentication - public Object getApplyNum(String state, String state2, String unionId, Integer year, String regionalNature, String takePartInLineId, String selectId) { + public Object getApplyNum(String state, String state2, String unionId, Integer year, String regionalNature, String takePartInLineId) { Cnd cnd1 = Cnd.NEW(); Sql sql1 = Sqls.create(""" SELECT @@ -552,16 +520,13 @@ public class TheRapyRecuperationUnionQueryController { if (Strings.isNotBlank(state)) { if (state.equals("1")) { cnd1.andEX("line.regionalNature", "=", regionalNature); - cnd1.and("enroll.takePartInLineId", "is not", null); - cnd1.and("enroll.takePartInLineId", "!=", ""); +// cnd1.and("enroll.takePartInTravelAgencyId", "is", null); if (StrUtil.isBlank(state2)) { - cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); - //cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); +// cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else if (state.equals("2")) { - cnd1.and("enroll.takePartInTravelAgencyId", "is not", null) - .and("enroll.takePartInTravelAgencyId", "!=", "") - .and("enroll.selfUnionId", "=", Vi.getUnionId()); + cnd1.and("enroll.takePartInTravelAgencyId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); } else { cnd1.and("enroll.takePartInBaseManagementId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); } @@ -582,8 +547,8 @@ public class TheRapyRecuperationUnionQueryController { } } } else { - cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); - //cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); +// cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + cnd1.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else { if (Strings.isNotBlank(state)) { @@ -593,10 +558,8 @@ public class TheRapyRecuperationUnionQueryController { } cnd1.andEX("line.regionalNature", "=", regionalNature); cnd1.and("enroll.takePartInLineId", "is not", null); - cnd1.and("enroll.takePartInLineId", "!=", ""); } else if (state.equals("2")) { cnd1.and("enroll.takePartInTravelAgencyId", "is not", null); - cnd1.and("enroll.takePartInTravelAgencyId", "!=", ""); cnd1.andEX("enroll.selfUnionId", "=", unionId); } else if (state.equals("3")) { cnd1.and("enroll.takePartInBaseManagementId", "is not", null); @@ -605,13 +568,12 @@ public class TheRapyRecuperationUnionQueryController { } } else { if (Strings.isNotBlank(unionId)) { - cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId)); - //cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId)); +// cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId)); + cnd1.and(Cnd.exps("enroll.selfUnionId", "=", unionId)); } } } - cnd1.andEX("lineu.lineId", "=", takePartInLineId); - cnd1.andEX("lineu.id", "=", selectId); + cnd1.andEX("line.id", "=", takePartInLineId); cnd1.andEX("YEAR(enroll.signingUptime)", "= ", year); cnd1.andEX("enroll.isNormal", "= ", true); cnd1.andEX("enroll.stateId", "= ", TheRapyRecuperationState.PASS); @@ -626,13 +588,13 @@ public class TheRapyRecuperationUnionQueryController { FROM the_rapy_recuperation_enroll_companion WHERE - trreId IN ( SELECT enroll.id FROM the_rapy_recuperation_enroll enroll + trreId IN ( SELECT enroll.id 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 $condition ) """); } else { sql2 = Sqls.create(""" - SELECT sum(familyNumber) FROM the_rapy_recuperation_enroll enroll + SELECT sum(familyNumber) 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 $condition """); @@ -643,15 +605,12 @@ public class TheRapyRecuperationUnionQueryController { if (state.equals("1")) { cnd2.andEX("line.regionalNature", "=", regionalNature); cnd2.and("enroll.takePartInLineId", "is not", null); - cnd2.and("enroll.takePartInLineId", "!=", ""); if (StrUtil.isBlank(state2)) { - cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); - //cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); +// cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else if (state.equals("2")) { - cnd2.and("enroll.takePartInTravelAgencyId", "is not", null) - .and("enroll.takePartInTravelAgencyId", "!=", "") - .and("enroll.selfUnionId", "=", Vi.getUnionId()); + cnd2.and("enroll.takePartInTravelAgencyId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); } else { cnd2.and("enroll.takePartInBaseManagementId", "is not", null).and("enroll.selfUnionId", "=", Vi.getUnionId()); } @@ -671,22 +630,20 @@ public class TheRapyRecuperationUnionQueryController { } } } else { - cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); - //cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); +// cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId()).or("enroll.takePartInUnionId", "=", Vi.getUnionId())); + cnd2.and(Cnd.exps("enroll.selfUnionId", "=", Vi.getUnionId())); } } else { if (Strings.isNotBlank(state)) { if (state.equals("1")) { if (Strings.isNotBlank(unionId)) { - cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId)); - //cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId)); +// cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId).or("enroll.takePartInUnionId", "=", unionId)); + cnd2.and(Cnd.exps("enroll.selfUnionId", "=", unionId)); } cnd2.andEX("line.regionalNature", "=", regionalNature); cnd2.and("enroll.takePartInLineId", "is not", null); - cnd2.and("enroll.takePartInLineId", "!=", ""); } else if (state.equals("2")) { cnd2.and("enroll.takePartInTravelAgencyId", "is not", null); - cnd2.and("enroll.takePartInTravelAgencyId", "!=", ""); cnd2.andEX("enroll.selfUnionId", "=", unionId); } else { cnd2.and("enroll.takePartInBaseManagementId", "is not", null); @@ -695,8 +652,7 @@ public class TheRapyRecuperationUnionQueryController { cnd2.andEX("enroll.selfUnionId", "=", unionId); } } - cnd2.andEX("lineu.lineId", "=", takePartInLineId); - cnd2.andEX("lineu.id", "=", selectId); + cnd2.andEX("line.id", "=", takePartInLineId); cnd2.andEX("YEAR(enroll.signingUptime)", "=", year); cnd2.andEX("enroll.isNormal", "=", true); cnd2.andEX("enroll.stateId", "=", TheRapyRecuperationState.PASS); @@ -731,19 +687,12 @@ public class TheRapyRecuperationUnionQueryController { .and("YEAR(signingUptime)", "=", year) .and("stateId", "=", TheRapyRecuperationState.PASS)); TheRapyRecuperationTravelAgency travelAgency = baseService.dao().fetch(TheRapyRecuperationTravelAgency.class, Cnd.where("id", "=", id)); - - List sysUsers = baseService.dao().query(Sys_user.class, Cnd.NEW()); - Map userMap = sysUsers.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getSchoolTime)); - if (travelAgency != null) { enrollList.forEach(v -> { baseService.dao().fetchLinks(v, "companionList"); }); List arrayList = new ArrayList<>(); enrollList.forEach(v -> { - String schoolTime = userMap.getOrDefault(v.getLoginName(), ""); - String sTime = TherapyRecuperationCommon.getRemarkBySchoolTime(schoolTime); - arrayList.add(new NutMap() {{ addv("userName", v.getUserName()); addv("loginName", v.getLoginName()); @@ -753,7 +702,6 @@ public class TheRapyRecuperationUnionQueryController { addv("idCard", v.getIdCard()); addv("relation", "本人"); addv("bz", v.getUserName()); - addv("remark", sTime); }}); v.getCompanionList().forEach(c -> { arrayList.add(new NutMap() {{ @@ -778,7 +726,7 @@ public class TheRapyRecuperationUnionQueryController { exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 60)); exportEntities.add(new ExcelExportEntity("与本人关系", "relation", 60)); exportEntities.add(new ExcelExportEntity("备注", "bz", 20)); - exportEntities.add(new ExcelExportEntity("备注2", "remark", 30)); + File xls = new File("C:\\疗休养报名信息表.xls"); FileOutputStream fileOutputStream = null; @@ -798,6 +746,7 @@ public class TheRapyRecuperationUnionQueryController { return null; } + @At @ViReturn public Object doAttend(@Param("data") String multipleSelection) { @@ -877,7 +826,7 @@ public class TheRapyRecuperationUnionQueryController { } }); map.put("maplist", nutMaps); - map.put("unionName", ((Sys_union) io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("union")).getUnionname()); + map.put("unionName", ((Sys_union) ShiroUtil.getPrincipalProperty("union")).getUnionname()); try { response.setContentType("application/octet-stream"); ViTool.excelResponse(response, "教职工疗休养组团时间路线申报表.xlsx"); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java index d38a3f3..743314f 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/process/TheRapyRecuperationUserQueryController.java @@ -5,21 +5,15 @@ 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.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONUtil; import cn.wizzer.framework.base.Result; import io.v.nutz.base.annontation.ViReturn; -import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.Vi; -import io.v.nutz.base.utils.ViTool; -import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.zhgh.therapyRecuperation.common.TherapyRecuperationCommon; +import io.v.nutz.base.query.PageForm; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyRecuperationEnrollExcelMode; import io.v.nutz.zhgh.therapyRecuperation.model.*; @@ -28,7 +22,6 @@ import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.aop.interceptor.ioc.TransAop; -import org.nutz.dao.Chain; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; @@ -42,23 +35,17 @@ import org.nutz.lang.util.NutMap; 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 org.springframework.util.CollectionUtils; import javax.servlet.http.HttpServletResponse; -import java.io.BufferedOutputStream; import java.io.IOException; -import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; @IocBean @At("/platform/theRapyRecuperation/user/query") @@ -84,7 +71,7 @@ public class TheRapyRecuperationUserQueryController { public Object pageData(String regionalNature, Integer state, PageForm pageForm, Integer startYear, Integer endYear, String unionId, String unitId, String takePartInLineId, String agencyId, String lotId, - String takePartInBaseManagementId, String signUpMode) { + String takePartInBaseManagementId,String signUpMode) { Cnd cnd = Cnd.NEW(); if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { @@ -96,17 +83,14 @@ public class TheRapyRecuperationUserQueryController { sql = Sqls.create(""" SELECT enroll.*, - IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lxs.travelAgencyName, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId $condition """); - if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { - cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId()); - } + cnd.andEX("enroll.selfUnionId", "=", Vi.getUnionId()); cnd.andEX("lxs.`year`", ">=", startYear); cnd.andEX("lxs.`year`", "<=", endYear); cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); @@ -119,11 +103,10 @@ public class TheRapyRecuperationUserQueryController { line.lineName, ma.baseName, enroll.*, - IF(enroll.isReimbursement = 1,'已报销','未报销') AS reimbursementStatus, lineu.lineId, lineu.playStartTime, - lineu.playEndTime, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId @@ -138,7 +121,7 @@ public class TheRapyRecuperationUserQueryController { cnd.andEX("enroll.selfUnitId", "=", unitId); cnd.andEX("line.id", "=", takePartInLineId); cnd.andEX("line.regionalNature", "=", regionalNature); - cnd.andEX("lineu.signUpMode", "=", signUpMode); + cnd.andEX("lineu.signUpMode","=",signUpMode); if (state == 3) { sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = ma.lotId) as lotName"); cnd.and("enroll.takePartInBaseManagementId", "is not", null); @@ -146,7 +129,6 @@ public class TheRapyRecuperationUserQueryController { } else { sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = line.lotId) as lotName"); cnd.and("enroll.takePartInLineId", "is not", null); - cnd.and("enroll.takePartInLineId", "!=", ""); } if (StrUtil.isNotBlank(lotId)) { SqlExpressionGroup seg = new SqlExpressionGroup(); @@ -158,9 +140,9 @@ public class TheRapyRecuperationUserQueryController { if (StrUtil.isNotBlank(unionId)) { cnd.and("enroll.selfUnionId", "=", unionId); } + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); } cnd.and("enroll.isNormal", "=", true); - cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); cnd.desc("enroll.unionName"); sql.setCondition(cnd); return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); @@ -177,23 +159,19 @@ public class TheRapyRecuperationUserQueryController { } cnd.and("isNormal", "=", true); cnd.and("takePartInLineId", "is not", null); - cnd.and("takePartInLineId", "!=", ""); cnd.and("stateId", "=", TheRapyRecuperationState.PASS); cnd.andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode); int count = baseService.dao().count(TheRapyRecuperationEnroll.class, cnd); int count1 = baseService.dao().count(TheRapyRecuperationEnroll.class, Cnd.where("takePartInTravelAgencyId", "is not", null) - .and("takePartInTravelAgencyId", "!=", "") .andEX("selfUnionId", "=", unionId) .andEX("YEAR(signingUptime)", ">=", startYear) .andEX("YEAR(signingUptime)", "<=", endYear) - .andEX("stateId", "=", TheRapyRecuperationState.PASS) .andEX("isNormal", "=", true) .andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode)); int count2 = baseService.dao().count(TheRapyRecuperationEnroll.class, Cnd.where("takePartInBaseManagementId", "is not", null) .andEX("selfUnionId", "=", unionId) .andEX("YEAR(signingUptime)", ">=", startYear) .andEX("YEAR(signingUptime)", "<=", endYear) - .andEX("stateId", "=", TheRapyRecuperationState.PASS) .andEX("isNormal", "=", true) .andEX("(select signUpMode from the_rapy_recuperation_line_union_select where id = takePartInLineId)", "=", signUpMode)); return Map.of("xlCount", count, "lxsCount", count1, "jdCount", count2); @@ -292,9 +270,10 @@ public class TheRapyRecuperationUserQueryController { return null; } + @At @ViReturn - public Object getUnionSelectLine(Integer startYear, Integer endYear, Integer signUpMode, String regionalNature, Boolean flag, String disPlayUnionSelectId) { + public Object getUnionSelectLine(Integer year,Integer signUpMode){ Sql sql = Sqls.create(""" SELECT rlus.id, @@ -305,7 +284,7 @@ public class TheRapyRecuperationUserQueryController { DATE_FORMAT( rlus.playEndTime, '%Y-%m-%d' ) AS playEndTime, rl.lineName, rl.regionalNature, - if(rlus.signUpMode=2,'校工会','分工会') AS signUpMode, + if(rlus.signUpMode=1,'分工会','校工会') AS signUpMode, lot.lotName FROM `the_rapy_recuperation_line_union_select` rlus @@ -314,388 +293,30 @@ public class TheRapyRecuperationUserQueryController { $condition """); Cnd cnd = Cnd.NEW(); - if (flag == null || !flag) { - SqlExpressionGroup group = new SqlExpressionGroup(); - if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { - group.and("rlus.isOpen", "=", 1); - //cnd.and(Cnd.exps("rlus.isOpen", "=", 1)); - } else { - group.or("rlus.isOpen", "=", 1).or("rlus.unionId", "=", Vi.getUnionId()); - //cnd.and(Cnd.exps("rlus.isOpen", "=", 1).or(); - } - if(StrUtil.isNotBlank(disPlayUnionSelectId)) { - group.or("rlus.id", "=", disPlayUnionSelectId); - } - cnd.and(group); - } else { - cnd.andEX("YEAR(rlus.selectTime)", ">=", startYear); - cnd.andEX("YEAR(rlus.selectTime)", "<=", endYear); - if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { - cnd.and(Cnd.exps("rlus.selectUserId", "=", ShiroUtil.getUserId()).or("rlus.unionId", "=", Vi.getUnionId())); - } - cnd.andEX("rl.regionalNature", "=", regionalNature); - cnd.groupBy("rlus.lineId"); - } - cnd.and("YEAR(rlus.selectTime)", "in", startYear != null ? Lang.array(startYear) : Lang.array(DateUtil.thisYear())); - cnd.andEX("rlus.signUpMode", "=", signUpMode); + cnd.and(Cnd.exps("rlus.isOpen","=",1).or("rlus.unionId","=",Vi.getUnionId())); + cnd.and("YEAR(rlus.selectTime)","=",DateUtil.thisYear()); +// cnd.and("rlus.signUpMode","=",signUpMode); cnd.desc("lot.lotValue"); cnd.desc("rl.lineName"); sql.setCondition(cnd); return baseService.listMap(sql); } - @At - @Ok("void") - @ViReturn - @RequiresAuthentication - public void doExportExcel(@Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "state", required = false) Integer state, - @Param(value = "searchName", required = false) String searchName, - @Param(value = "searchKeyword", required = false) String searchKeyword, - @Param(value = "startYear", required = false) Integer startYear, - @Param(value = "endYear", required = false) Integer endYear, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "agencyId", required = false) String agencyId, - @Param(value = "lotId", required = false) String lotId, - @Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId, - @Param(value = "signUpMode", required = false) String signUpMode, - @Param(value = "types", required = false) String[] types, - @Param(value = "satisfyPeople", required = false) Boolean satisfyPeople, - HttpServletResponse response) throws IOException { - - Cnd commonCnd = Cnd.NEW(); - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - commonCnd.and(Cnd.likeEX(searchName, searchKeyword)); - } - if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { - commonCnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); - } - commonCnd.and("enroll.isNormal", "=", true); - commonCnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); - - //线路的查询 - Sql lineSql = Sqls.create(""" - SELECT - line.regionalNature, - lxs.travelAgencyName, - line.lineName, - enroll.*, - date_format( enroll.signingUptime, '%Y-%m-%d %H:%i:%s' ) signingUptimeFormat, - date_format( lineu.playStartTime, '%Y-%m-%d' ) playStartTime, - lineu.lineId, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) familyCount, - u.schoolTime - FROM - `the_rapy_recuperation_enroll` enroll - LEFT JOIN `user` u on enroll.loginName = u.loginname - 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 - $condition - """); - Cnd lineCnd = commonCnd.clone(); - lineCnd.andEX("YEAR(enroll.signingUptime)", ">=", startYear); - lineCnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear); - lineCnd.andEX("enroll.selfUnitId", "=", unitId); - lineCnd.andEX("line.id", "=", takePartInLineId); - lineCnd.andEX("line.regionalNature", "=", regionalNature); - lineCnd.andEX("lineu.signUpMode", "=", signUpMode); - lineCnd.andEX("enroll.selfUnionId", "=", unionId); - lineCnd.and("enroll.takePartInLineId", "is not", null); - lineCnd.and("enroll.takePartInLineId", "!=", ""); - if (StrUtil.isNotBlank(lotId)) { - SqlExpressionGroup seg = new SqlExpressionGroup(); - seg.or("line.lotId", "=", lotId); - seg.or("ma.lotId", "=", lotId); - lineCnd.and(seg); - } - lineCnd.asc("lineName").asc("playStartTime").asc("unionName"); - lineSql.setCondition(lineCnd); - List lineEnroll = baseService.listMap(lineSql); - lineEnroll.forEach(item -> { - String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); - item.put("remark", remark); - }); - - //自由组团的查询 - Sql travelSql = Sqls.create(""" - SELECT - enroll.*, - lxs.travelAgencyName, - u.schoolTime - FROM - `the_rapy_recuperation_enroll` enroll - LEFT JOIN `user` u on enroll.loginName = u.loginname - LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId - $condition - """); - Cnd travelCnd = commonCnd.clone(); - travelCnd.andEX("enroll.selfUnionId", "=", unionId); - travelCnd.andEX("lxs.`year`", ">=", startYear); - travelCnd.andEX("lxs.`year`", "<=", endYear); - travelCnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); - travelCnd.and("enroll.takePartInTravelAgencyId", "is not", null); - travelCnd.and("enroll.takePartInTravelAgencyId", "!=", ""); - travelCnd.asc("travelAgencyName").desc("enroll.unionName"); - travelSql.setCondition(travelCnd); - List travelEnroll = baseService.listMap(travelSql); - travelEnroll.forEach(item -> { - String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); - item.put("remark", remark); - }); - - //公共的导出表头 - ArrayList commonEntities = new ArrayList<>(); - commonEntities.add(new ExcelExportEntity("姓名", "userName", 20)); - commonEntities.add(new ExcelExportEntity("工号", "loginName", 20)); - commonEntities.add(new ExcelExportEntity("性别", "sex", 10)); - commonEntities.add(new ExcelExportEntity("所属单位", "unitName", 20)); - commonEntities.add(new ExcelExportEntity("所属工会", "unionName", 20)); - commonEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); - commonEntities.add(new ExcelExportEntity("手机号", "mobile", 15)); - ExcelExportEntity entity = new ExcelExportEntity("报名时间", "signingUptime", 15); - entity.setFormat("yyyy-MM-dd HH:mm:ss"); - commonEntities.add(entity); - - //线路表头 - ArrayList lineEntities = new ArrayList<>(commonEntities); - lineEntities.add(new ExcelExportEntity("出行时间", "playStartTime", 20)); - lineEntities.add(new ExcelExportEntity("线路名称", "lineName", 20)); - lineEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); - lineEntities.add(new ExcelExportEntity("家属人数", "familyCount", 20)); - - //自由组团表头 - ArrayList travelEntities = new ArrayList<>(commonEntities); - travelEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); - - commonEntities.add(new ExcelExportEntity("备注", "remark", 30)); - - try { - ViTool.excelResponse(response, "人员名单.xlsx"); - if(Arrays.asList(types).contains("line")) { - ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, lineEnroll); - workbook.write(response.getOutputStream()); - } - if(Arrays.asList(types).contains("travel")) { - ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, travelEntities, travelEnroll); - workbook.write(response.getOutputStream()); - } - } catch (Exception e) { - log.error(e.getMessage()); - } - } @At @Ok("void") @ViReturn @RequiresAuthentication - public void doExport(@Param(value = "regionalNature", required = false) String regionalNature, - @Param(value = "state", required = false) Integer state, - @Param(value = "searchName", required = false) String searchName, - @Param(value = "searchKeyword", required = false) String searchKeyword, - @Param(value = "startYear", required = false) Integer startYear, - @Param(value = "endYear", required = false) Integer endYear, - @Param(value = "unionId", required = false) String unionId, - @Param(value = "unitId", required = false) String unitId, - @Param(value = "takePartInLineId", required = false) String takePartInLineId, - @Param(value = "agencyId", required = false) String agencyId, - @Param(value = "lotId", required = false) String lotId, - @Param(value = "takePartInBaseManagementId", required = false) String takePartInBaseManagementId, - @Param(value = "signUpMode", required = false) String signUpMode, - @Param(value = "types", required = false) String[] types, - @Param(value = "satisfyPeople", required = false) Boolean satisfyPeople, - HttpServletResponse response) throws IOException { - - response.setContentType("application/octet-stream"); - response.setHeader("content-disposition", "attachment;filename=" - + URLEncoder.encode("疗休养报名人员名单.zip", StandardCharsets.UTF_8)); - - Cnd commonCnd = Cnd.NEW(); - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - commonCnd.and(Cnd.likeEX(searchName, searchKeyword)); - } - if (!ShiroUtil.hasAnyRoles("sysadmin, A06")) { - commonCnd.and(Cnd.exps("enroll.takePartInUnionId", "=", Vi.getUnionId()).or("enroll.selfUnionId", "=", Vi.getUnionId())); - } - commonCnd.and("enroll.isNormal", "=", true); - commonCnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); - - //线路的查询 - Sql lineSql = Sqls.create(""" - SELECT - line.regionalNature, - lxs.travelAgencyName, - line.lineName, - enroll.*, - date_format( enroll.signingUptime, '%Y-%m-%d %H:%i:%s' ) signingUptimeFormat, - date_format( lineu.playStartTime, '%Y-%m-%d' ) playStartTime, - lineu.lineId, - ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) familyCount, - u.schoolTime - FROM - `the_rapy_recuperation_enroll` enroll - LEFT JOIN `user` u on enroll.loginName = u.loginname - 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 - $condition - """); - Cnd lineCnd = commonCnd.clone(); - lineCnd.andEX("YEAR(enroll.signingUptime)", ">=", startYear); - lineCnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear); - lineCnd.andEX("enroll.selfUnitId", "=", unitId); - lineCnd.andEX("line.id", "=", takePartInLineId); - lineCnd.andEX("line.regionalNature", "=", regionalNature); - lineCnd.andEX("lineu.signUpMode", "=", signUpMode); - lineCnd.andEX("enroll.selfUnionId", "=", unionId); - lineCnd.and("enroll.takePartInLineId", "is not", null); - lineCnd.and("enroll.takePartInLineId", "!=", ""); - if (StrUtil.isNotBlank(lotId)) { - SqlExpressionGroup seg = new SqlExpressionGroup(); - seg.or("line.lotId", "=", lotId); - seg.or("ma.lotId", "=", lotId); - lineCnd.and(seg); - } - lineCnd.asc("playStartTime").asc("unionName"); - lineSql.setCondition(lineCnd); - List lineEnroll = baseService.listMap(lineSql); - - if (satisfyPeople) { - //按照选择线路id分组,便于判断是否成团 - Map> enrollGroup = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInLineId"))); - - List unionSelects = - baseService.dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("enable", "=", true)); - Map selectMap = unionSelects.stream().collect(Collectors.toMap(TheRapyRecuperationLineUnionSelect::getId, o -> o)); - - lineEnroll = enrollGroup.entrySet().stream() - .filter(entry -> selectMap.containsKey(entry.getKey()) && (entry.getValue().size() + entry.getValue().stream().mapToInt(o -> o.getInt("familyCount")).sum()) >= selectMap.get(entry.getKey()).getEstimatedFamilyNumbers()) - .flatMap(entry -> entry.getValue().stream()) - .collect(Collectors.toList()); - } - - Map> lineGroupMap = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("lineId"))); - //查询所有的线路 - List lineList = baseService.dao().query(TheRapyRecuperationLine.class, Cnd.NEW()); - Map lineMap = lineList.stream().collect(Collectors.toMap(TheRapyRecuperationLine::getId, TheRapyRecuperationLine::getLineName)); - - //自由组团的查询 - Sql travelSql = Sqls.create(""" - SELECT - enroll.*, - lxs.travelAgencyName, - u.schoolTime - FROM - `the_rapy_recuperation_enroll` enroll - LEFT JOIN `user` u on enroll.loginName = u.loginname - LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = enroll.takePartInTravelAgencyId - $condition - """); - Cnd travelCnd = commonCnd.clone(); - travelCnd.andEX("enroll.selfUnionId", "=", unionId); - travelCnd.andEX("lxs.`year`", ">=", startYear); - travelCnd.andEX("lxs.`year`", "<=", endYear); - travelCnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); - travelCnd.and("enroll.takePartInTravelAgencyId", "is not", null); - travelCnd.and("enroll.takePartInTravelAgencyId", "!=", ""); - travelCnd.desc("enroll.unionName"); - travelSql.setCondition(travelCnd); - List travelEnroll = baseService.listMap(travelSql); - Map> travelGroupMap = travelEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInTravelAgencyId"))); - //查询所有的旅行社 - List travelList = baseService.dao().query(TheRapyRecuperationTravelAgency.class, Cnd.NEW()); - Map travelMap = travelList.stream().collect(Collectors.toMap(TheRapyRecuperationTravelAgency::getId, TheRapyRecuperationTravelAgency::getTravelAgencyName)); - - //公共的导出表头 - ArrayList commonEntities = new ArrayList<>(); - commonEntities.add(new ExcelExportEntity("姓名", "userName", 20)); - commonEntities.add(new ExcelExportEntity("工号", "loginName", 20)); - commonEntities.add(new ExcelExportEntity("性别", "sex", 10)); - commonEntities.add(new ExcelExportEntity("所属单位", "unitName", 20)); - commonEntities.add(new ExcelExportEntity("所属工会", "unionName", 20)); - commonEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); - commonEntities.add(new ExcelExportEntity("手机号", "mobile", 15)); - ExcelExportEntity entity = new ExcelExportEntity("报名时间", "signingUptime", 15); - entity.setFormat("yyyy-MM-dd HH:mm:ss"); - commonEntities.add(entity); - - //线路表头 - ArrayList lineEntities = new ArrayList<>(commonEntities); - lineEntities.add(new ExcelExportEntity("出行时间", "playStartTime", 20)); - lineEntities.add(new ExcelExportEntity("线路名称", "lineName", 20)); - lineEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); - lineEntities.add(new ExcelExportEntity("家属人数", "familyCount", 20)); - - //自由组团表头 - ArrayList travelEntities = new ArrayList<>(commonEntities); - travelEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); - - commonEntities.add(new ExcelExportEntity("备注", "remark", 30)); - - ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream())); - - try { - if(Arrays.asList(types).contains("line")) { - for (String key : lineGroupMap.keySet()) { - List enrollList = lineGroupMap.get(key); - enrollList.forEach(item -> { - String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); - item.put("remark", remark); - }); - String fileName = "线路报名人员/" + lineMap.get(key) + ".xlsx"; - zipOutputStream.putNextEntry(new ZipEntry(fileName)); - ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, enrollList); - workbook.write(zipOutputStream); - zipOutputStream.closeEntry(); - response.flushBuffer(); - } - } - if(Arrays.asList(types).contains("travel")) { - for (String key : travelGroupMap.keySet()) { - List enrollList = travelGroupMap.get(key); - enrollList.forEach(item -> { - String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime")); - item.put("remark", remark); - }); - String fileName = "自由组团报名人员/" + travelMap.get(key) + ".xlsx"; - zipOutputStream.putNextEntry(new ZipEntry(fileName)); - ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, travelEntities, enrollList); - workbook.write(zipOutputStream); - zipOutputStream.closeEntry(); - response.flushBuffer(); - } - } - zipOutputStream.flush(); - zipOutputStream.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @At - @Ok("void") - @ViReturn - @RequiresAuthentication - public void doExport1(String regionalNature, Integer state, String searchName, String searchKeyword, + public void doExport(String regionalNature, Integer state,String searchName,String searchKeyword, Integer startYear, Integer endYear, String unionId, String unitId, String takePartInLineId, String agencyId, String lotId, - String takePartInBaseManagementId, String signUpMode, + String takePartInBaseManagementId,String signUpMode, HttpServletResponse response) throws IOException { Cnd cnd = Cnd.NEW(); if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - cnd.and(Cnd.likeEX(searchName, searchKeyword)); + cnd.and(Cnd.likeEX(searchName,searchKeyword)); } Sql sql; @@ -714,8 +335,6 @@ public class TheRapyRecuperationUserQueryController { cnd.andEX("lxs.`year`", ">=", startYear); cnd.andEX("lxs.`year`", "<=", endYear); cnd.andEX("enroll.takePartInTravelAgencyId", "=", agencyId); - cnd.and("enroll.takePartInTravelAgencyId", "is not", null); - cnd.and("enroll.takePartInTravelAgencyId", "!=", ""); } else { sql = Sqls.create(""" SELECT @@ -727,7 +346,7 @@ public class TheRapyRecuperationUserQueryController { enroll.*, lineu.lineId, lineu.playStartTime, - lineu.playEndTime, + lineu.playEndTime, ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id AND relation = '亲属' ) isFamily FROM `the_rapy_recuperation_enroll` enroll @@ -743,9 +362,7 @@ public class TheRapyRecuperationUserQueryController { cnd.andEX("enroll.selfUnitId", "=", unitId); cnd.andEX("line.id", "=", takePartInLineId); cnd.andEX("line.regionalNature", "=", regionalNature); - cnd.andEX("lineu.signUpMode", "=", signUpMode); - cnd.and("enroll.takePartInLineId", "is not", null); - cnd.and("enroll.takePartInLineId", "!=", ""); + cnd.andEX("lineu.signUpMode","=",signUpMode); if (state == 3) { sql.setVar("lotSql", "(select lotName from the_rapy_recuperation_lot where id = ma.lotId) as lotName"); cnd.and("enroll.takePartInBaseManagementId", "is not", null); @@ -764,9 +381,9 @@ public class TheRapyRecuperationUserQueryController { if (StrUtil.isNotBlank(unionId)) { cnd.and("enroll.selfUnionId", "=", unionId); } + cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); } cnd.and("enroll.isNormal", "=", true); - cnd.and("enroll.stateId", "=", TheRapyRecuperationState.PASS); cnd.desc("enroll.unionName"); sql.setCondition(cnd); @@ -779,10 +396,8 @@ public class TheRapyRecuperationUserQueryController { baseService.dao().fetchLinks(v, "companionList"); baseService.dao().fetchLinks(v, "bedInfo"); baseService.dao().fetchLinks(v, "managementInfo"); - if (StrUtil.isNotBlank(v.getLineId())) { - TheRapyRecuperationLine line = baseService.dao().fetch(TheRapyRecuperationLine.class, v.getLineId()); - v.setLineInfo(line); - } + TheRapyRecuperationLine line = baseService.dao().fetch(TheRapyRecuperationLine.class, v.getLineId()); + v.setLineInfo(line); }); List arrayList = new ArrayList<>(); String takePartInLineId2 = ""; @@ -792,9 +407,8 @@ public class TheRapyRecuperationUserQueryController { for (TheRapyRecuperationEnroll v : enrollList) { if (StrUtil.isNotBlank(v.getTakePartInLineId()) && !v.getTakePartInLineId().equals(takePartInLineId2)) { TheRapyRecuperationLine line = baseService.dao().fetch(TheRapyRecuperationLine.class, v.getLineId()); - TheRapyRecuperationLineUnionSelect unionSelect = baseService.dao().fetch(TheRapyRecuperationLineUnionSelect.class, v.getTakePartInLineId()); TheRapyRecuperationLot lot = baseService.dao().fetch(TheRapyRecuperationLot.class, line.getLotId()); - TheRapyRecuperationTravelAgency agency = baseService.dao().fetch(TheRapyRecuperationTravelAgency.class, unionSelect.getTravelAgencyId()); + TheRapyRecuperationTravelAgency agency = baseService.dao().fetch(TheRapyRecuperationTravelAgency.class, line.getTravelAgencyId()); agencyName = agency.getTravelAgencyName(); lotName = lot.getLotName(); } else { @@ -823,6 +437,7 @@ public class TheRapyRecuperationUserQueryController { addv("otherSleepUser", Lang.isNotEmpty(v.getBedInfo()) ? v.getBedInfo().getOtherSleepUser() : null); addv("baseName", Lang.isNotEmpty(v.getManagementInfo()) ? v.getManagementInfo().getBaseName() : v.getLineInfo().getLineName()); addv("signingUptime", DateUtil.formatDateTime(v.getSigningUptime())); + addv("cxsj", DateUtil.formatDateTime(v.getPlayStartTime()) + "至" + DateUtil.formatDateTime(v.getPlayEndTime())); addv("agencyName", finalAgencyName); addv("lotName", finalLotName); addv("bz", v.getUserName()); @@ -843,6 +458,7 @@ public class TheRapyRecuperationUserQueryController { addv("otherSleepUser", Lang.isNotEmpty(c.getBedInfo()) ? c.getBedInfo().getOtherSleepUser() : null); addv("baseName", Lang.isNotEmpty(v.getManagementInfo()) ? v.getManagementInfo().getBaseName() : v.getLineInfo().getLineName()); addv("signingUptime", DateUtil.formatDateTime(v.getSigningUptime())); + addv("cxsj", DateUtil.formatDateTime(v.getPlayStartTime()) + "至" + DateUtil.formatDateTime(v.getPlayEndTime())); addv("agencyName", finalAgencyName); addv("lotName", finalLotName); addv("bz", v.getUserName()); @@ -871,6 +487,7 @@ public class TheRapyRecuperationUserQueryController { exportEntities.add(new ExcelExportEntity("旅行社", "agencyName", 20)); exportEntities.add(new ExcelExportEntity("报名时间", "signingUptime", 20)); exportEntities.add(new ExcelExportEntity("备注", "bz", 20)); + exportEntities.add(new ExcelExportEntity("出行时间", "cxsj", 50)); try { response.setContentType("application/octet-stream"); @@ -882,17 +499,4 @@ public class TheRapyRecuperationUserQueryController { e.printStackTrace(); } } - - - @At - @ViReturn - @RequiresAuthentication - public Object doReimbursement(@Param("data") String data) { - JSONArray objects = JSONUtil.parseArray(data); - List enrollIds = objects.toList(String.class); - if (Lang.isNotEmpty(enrollIds)) { - baseService.dao().update(TheRapyRecuperationEnroll.class, Chain.make("isReimbursement", 1), Cnd.where("id", "in", enrollIds)); - } - return null; - } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationBranchUnionUserQueryController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationBranchUnionUserQueryController.java new file mode 100644 index 0000000..b2533eb --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationBranchUnionUserQueryController.java @@ -0,0 +1,409 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.query; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.annotation.ExcelEntity; +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.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import cn.wizzer.framework.base.service.BaseService; +import cn.wizzer.framework.page.Pagination; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollBed; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollCompanion; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; +import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * 分工会人员信息查询 + */ +@IocBean +@At("/platform/theRapyRecuperation/branchUnionUserQuery") +@Ok("json:full") +public class TheRapyRecuperationBranchUnionUserQueryController { + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + @Inject + private TheRapyRecuperationEnrollService enrollService; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/branchUnionUserQuery/index.html") + @RequiresPermissions("theRapyRecuperation.branchUnionUserQuery") + public void index() { + } + + /** + * 分工会人员信息查询 + * + * @param pageForm 分页 + * @param year 年度 + * @param userName 姓名 + * @param loginName 登录名 + * @param signUpMode 报名方式(1分工会 2校工会 3个人) + * @param unionId + * @param takePartInLineId 线路id + * @param lotId 标段id + * @param regionalNature 区域性质 省内 省外 + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.branchUnionUserQuery") + public Result pageData(PageForm pageForm, + Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + state.stateName, + state.stateColor, + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + 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 agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + $condition + """); + if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { + cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); + } + if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC"); + } + + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", loginName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", userName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 分工会只查本分工会的人员 + cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); + + // 报名模式 + if (StrUtil.isNotBlank(signUpMode)) { + if (signUpMode.equals("1")) { + cnd.andEX("line.signUpMode", "=", 2); + } else if (signUpMode.equals("2")) { + cnd.andEX("lineu.unionId", "=", Vi.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if (signUpMode.equals("3")) { + cnd.andEX("lineu.unionId", "!=", Vi.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if (signUpMode.equals("4")) { + cnd.andEX("line.signUpMode", "=", 3); + } + } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", TheRapyRecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + list.forEach(v -> { + List companionList = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (TheRapyRecuperationEnrollCompanion enrollCompanion : companionList) { + baseService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + return Result.success(pagination); + } + + + /** + * 设置出行人员 + * + * @return + */ + @At + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.branchUnionUserQuery") + public Result setUpParticipants(@Param("data") String data) { + List list = Json.fromJsonAsList(NutMap.class, data); + for (NutMap map : list) { + Chain chain = Chain.make("lotId", map.getString("lotId")).add("takePartInTime", map.getString("takePartInTime")).add("isTakePartIn", true); + baseService.update("the_rapy_recuperation_enroll", chain, Cnd.where("id", "=", map.getString("id"))); + } + return Result.success(); + } + + /** + * 删除报名信息 + */ + @At + public Result deleteMyEnrollInfoById(String id) { + enrollService.deleteMyEnrollInfoById(id); + return Result.success(); + } + + /** + * 编辑查询详细信息 + */ + @At + @RequiresPermissions("theRapyRecuperation.branchUnionUserQuery") + public Result findOne(String id) { + Sql sql = Sqls.create(""" + SELECT + lxs.travelAgencyName, + enroll.*, + line.lineName, + if(enroll.takePartInUnionId!=enroll.selfUnionId,true,false) isTransferIn, + (SELECT COUNT(1) FROM the_rapy_recuperation_enroll_companion WHERE trreId=enroll.id and relation='亲属') isFamily + 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 lxs ON lxs.id = line.travelAgencyId + where enroll.id=@id + """); + sql.setParam("id", id); + sql.setCallback(Sqls.callback.map()); + dao.execute(sql); + NutMap data = (NutMap) sql.getResult(); + List companionList = dao.query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); + companionList.forEach(v -> { + v.setBedInfo(dao.fetch(TheRapyRecuperationEnrollBed.class, v.getBedInfoId())); + }); + data.put("companionList", companionList); + return Result.success(data); + } + + /** + * 获取线路 + * + * @param year 年度 + * @param signUpMode 报名模式 + * @param regionalNature 区域 + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.branchUnionUserQuery") + public Result listLine(Integer year, String signUpMode, String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + t1.takePartInLineId, + t3.lineName, + t4.unionname as unionName + FROM + 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 + """); + Cnd cnd = Cnd.NEW(); + cnd.and("t1.selfUnionId", "=", Vi.getUnionId()); + cnd.andEX("YEAR(t2.selectTime)", "=", year); + cnd.andEX("t3.regionalNature", "=", regionalNature); + + if (signUpMode.equals("1")) { + cnd.andEX("t3.signUpMode", "=", 2); + } else if (signUpMode.equals("2")) { + cnd.andEX("t2.unionId", "=", Vi.getUnionId()); + cnd.and("t3.signUpMode", "=", 1); + } else if (signUpMode.equals("3")) { + cnd.andEX("t2.unionId", "!=", Vi.getUnionId()); + cnd.and("t3.signUpMode", "=", 1); + } else if (signUpMode.equals("4")) { + cnd.andEX("t3.signUpMode", "=", 3); + } + cnd.groupBy("t1.takePartInLineId"); + sql.setCondition(cnd); + List list = enrollService.listMap(sql); + return Result.success(list); + } + + @At + @Ok("void") + @RequiresPermissions("theRapyRecuperation.branchUnionUserQuery") + public void exportXlsx(Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature, + HttpServletResponse response) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + state.stateName, + state.stateColor, + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + 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 agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + $condition + """); + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", userName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", loginName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 分工会只查本分工会的人员 + cnd.and("enroll.selfUnionId", "=", Vi.getUnionId()); + + // 报名模式 + if (StrUtil.isNotBlank(signUpMode)) { + if (signUpMode.equals("1")) { + cnd.andEX("line.signUpMode", "=", 2); + } else if (signUpMode.equals("2")) { + cnd.andEX("lineu.unionId", "=", Vi.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if (signUpMode.equals("3")) { + cnd.andEX("lineu.unionId", "!=", Vi.getUnionId()); + cnd.andEX("line.signUpMode", "=", 1); + } else if (signUpMode.equals("4")) { + cnd.andEX("line.signUpMode", "=", 3); + } + } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", TheRapyRecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + List list = enrollService.listMap(sql); + list.forEach(v -> { + List companionList = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (TheRapyRecuperationEnrollCompanion enrollCompanion : companionList) { + baseService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + + // 配置 + TheRapyRecuperationConfig config = baseService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + + List excelEntities = new ArrayList<>(); + excelEntities.add(new ExcelExportEntity("姓名", "userName", 20)); + excelEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + excelEntities.add(new ExcelExportEntity("性别", "sex", 20)); + excelEntities.add(new ExcelExportEntity("单位", "unitName", 20)); + excelEntities.add(new ExcelExportEntity("工会", "unionName", 20)); + excelEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + excelEntities.add(new ExcelExportEntity("手机号", "mobile", 20)); + if (config.getFamilyInfo() == 2) { + excelEntities.add(new ExcelExportEntity("与本人关系", "relation", 10)); + excelEntities.add(new ExcelExportEntity("床型", "bedType", 10)); + excelEntities.add(new ExcelExportEntity("床位数", "bedNum", 10)); + excelEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 10)); + } else { + excelEntities.add(new ExcelExportEntity("携带家属数", "familyNumber", 10)); + + } + excelEntities.add(new ExcelExportEntity("备注", "bz", 20)); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("报名人员.xlsx").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + + + try { + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelEntities, list); + workbook.write(response.getOutputStream()); + workbook.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationLineQueryController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationLineQueryController.java new file mode 100644 index 0000000..33b5580 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationLineQueryController.java @@ -0,0 +1,122 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.query; + +import cn.hutool.core.util.StrUtil; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * @author zhf + * @date 2025/5/23 09:04 + * @description 线路查询 + */ +@IocBean +@At("/platform/theRapyRecuperation/lineQuery") +@Ok("json:full") +public class TheRapyRecuperationLineQueryController { + + @Inject + private TheRapyRecuperationEnrollService enrollService; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/lineQuery/index.html") + @RequiresPermissions("theRapyRecuperation.lineQuery") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.statistics") + public Object pageData(PageForm pageForm, + @Param(value = "startYear", required = false) Integer startYear, + @Param(value = "endYear", required = false) Integer endYear, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "takePartInLineId") String takePartInLineId, + @Param(value = "lotId", required = false) String lotId, + @Param(value = "signUpMode", required = false) String signUpMode, + @Param(value = "selectId", required = false) String selectId, + @Param(value = "travelAgencyPlace", required = false) String travelAgencyPlace, + @Param(value = "travelAgencyId", required = false) String travelAgencyId, + @Param(value = "regionalNature", required = false) String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + u.username, + st.stateName, + line.id, + line.lineName, + line.regionalNature, + line.travelAgencyPlace, + lineu.auditState, + lineu.lineId, + lineu.id as lineUId, + lineu.signUpMode, + lineu.minimumGroupSize, + lineu.estimatedFamilyNumbers, + YEAR(lineu.selectTime) as `year`, + CONCAT(DATE_FORMAT(lineu.playStartTime,'%m月%d日'),'-',DATE_FORMAT(lineu.playEndTime,'%m月%d日')) AS linePlayTime, + lineu.playStartTime as playStartTime1, + lineu.playEndTime as playEndTime2, + lxs.travelAgencyName, + lxs.contact, + lxs.contactMobileNumber, + enroll.takePartInUnionId AS usUnionId, + un.unionname as unionname, + lot.lotName, + lot.lotValue, + enroll.familyNumber, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll WHERE takePartInLineId = lineu.id and stateId=2750 and isNormal = true $unionCnd) lineNum, + (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where stateId=2750 and takePartInLineId = lineu.id and isNormal = true $unionCnd)) as signUpUserFamilyNum + FROM + the_rapy_recuperation_line_union_select lineu + LEFT JOIN `the_rapy_recuperation_enroll` enroll ON lineu.id = enroll.takePartInLineId + left join `user` u on u.id=lineu.selectUserId + LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId + LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON line.travelAgencyId = lxs.id + LEFT JOIN sys_union un ON un.id = lineu.unionId + left join audit_state st on st.stateId=lineu.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(lineu.selectTime)", ">=", startYear); + cnd.andEX("YEAR(lineu.selectTime)", "<=", endYear); + cnd.andEX("lineu.signUpMode", "=", signUpMode); + cnd.andEX("lineu.unionId", "=", unionId); + cnd.andEX("line.travelAgencyId", "=", travelAgencyId); + cnd.andEX("line.travelAgencyPlace", "=", travelAgencyPlace); + if (!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionAdmin")) { + if (ShiroUtil.hasAnyRoles("gh01")) { + cnd.andEX("lineu.unionId", "=", Vi.getUnionId()); + } else { + cnd.and("lineu.selectUserId", "=", ShiroUtil.getUserId()); + } + } + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())){ + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("u.username", pageForm.getSearchKeyword()); + group.orLike("u.loginname", pageForm.getSearchKeyword()); + cnd.and(group); + } + + cnd.andEX("line.lotId", "=", lotId); + cnd.andEX("line.id", "=", takePartInLineId); + cnd.andEX("lineu.id", "=", selectId); + cnd.andEX("line.regionalNature", "=", regionalNature); + cnd.groupBy("lineu.id"); + cnd.asc("line.serialNumber").asc("lineu.playStartTime"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationSchoolUnionUserQueryController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationSchoolUnionUserQueryController.java new file mode 100644 index 0000000..c213aec --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/query/TheRapyRecuperationSchoolUnionUserQueryController.java @@ -0,0 +1,397 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.query; + +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.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import cn.wizzer.framework.base.service.BaseService; +import cn.wizzer.framework.page.Pagination; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollBed; +import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollCompanion; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; +import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * 校工会人员信息查询 + */ +@IocBean +@At("/platform/theRapyRecuperation/schoolUnionUserQuery") +@Ok("json:full") +public class TheRapyRecuperationSchoolUnionUserQueryController { + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + @Inject + private TheRapyRecuperationEnrollService enrollService; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/schoolUnionUserQuery/index.html") + @RequiresPermissions("theRapyRecuperation.schoolUnionUserQuery") + public void index() { + } + + /** + * 校工会人员信息查询 + * + * @param pageForm 分页 + * @param year 年度 + * @param userName 姓名 + * @param loginName 登录名 + * @param signUpMode 报名方式(1分工会 2校工会 3个人) + * @param unionId 分工会id + * @param takePartInLineId 线路id + * @param lotId 标段id + * @param regionalNature 区域性质 省内 省外 + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.schoolUnionUserQuery") + public Result pageData(PageForm pageForm, + Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + state.stateName, + state.stateColor, + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + 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 agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + $condition + """); + if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) { + cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); + } + if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC"); + } + + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", userName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", loginName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 校工会可查询指定分工会 + cnd.andEX("enroll.selfUnionId", "=", unionId); + +// // 报名模式 +// if (StrUtil.isNotBlank(signUpMode)) { +// if (signUpMode.equals("1")) { +// cnd.andEX("line.signUpMode", "=", 2); +// } else if (signUpMode.equals("2")) { +// cnd.andEX("lineu.unionId", "=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("3")) { +// cnd.andEX("lineu.unionId", "!=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("4")) { +// cnd.andEX("line.signUpMode", "=", 3); +// } +// } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", TheRapyRecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + list.forEach(v -> { + List companionList = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (TheRapyRecuperationEnrollCompanion enrollCompanion : companionList) { + baseService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + return Result.success(pagination); + } + + + /** + * 设置出行人员 + * + * @return + */ + @At + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("theRapyRecuperation.schoolUnionUserQuery") + public Result setUpParticipants(@Param("data") String data) { + List list = Json.fromJsonAsList(NutMap.class, data); + for (NutMap map : list) { + Chain chain = Chain.make("lotId", map.getString("lotId")).add("takePartInTime", map.getString("takePartInTime")).add("isTakePartIn", true); + baseService.update("the_rapy_recuperation_enroll", chain, Cnd.where("id", "=", map.getString("id"))); + } + return Result.success(); + } + + /** + * 删除报名信息 + */ + @At + @RequiresPermissions("theRapyRecuperation.schoolUnionUserQuery") + public Result deleteMyEnrollInfoById(String id) { + enrollService.deleteMyEnrollInfoById(id); + return Result.success(); + } + + /** + * 编辑查询详细信息 + */ + @At + @RequiresPermissions("theRapyRecuperation.schoolUnionUserQuery") + public Result findOne(String id) { + Sql sql = Sqls.create(""" + SELECT + lxs.travelAgencyName, + enroll.*, + line.lineName, + if(enroll.takePartInUnionId!=enroll.selfUnionId,true,false) isTransferIn, + (SELECT COUNT(1) FROM the_rapy_recuperation_enroll_companion WHERE trreId=enroll.id and relation='亲属') isFamily + 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 lxs ON lxs.id = line.travelAgencyId + where enroll.id=@id + """); + sql.setParam("id", id); + sql.setCallback(Sqls.callback.map()); + dao.execute(sql); + NutMap data = (NutMap) sql.getResult(); + List companionList = dao.query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); + companionList.forEach(v -> { + v.setBedInfo(dao.fetch(TheRapyRecuperationEnrollBed.class, v.getBedInfoId())); + }); + data.put("companionList", companionList); + return Result.success(data); + } + + /** + * 获取线路 + * + * @param year 年度 + * @param signUpMode 报名模式 + * @param unionId 分工会id + * @param regionalNature 区域 + * @return + */ + @At + @RequiresPermissions("theRapyRecuperation.schoolUnionUserQuery") + public Result listLine(Integer year, String signUpMode, String unionId, String regionalNature) { + Sql sql = Sqls.create(""" + SELECT + t1.takePartInLineId, + t3.lineName, + t4.unionname as unionName + FROM + 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 + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("t1.selfUnionId", "=", unionId); + cnd.andEX("YEAR(t2.selectTime)", "=", year); + cnd.andEX("t3.regionalNature", "=", regionalNature); + cnd.groupBy("t1.takePartInLineId"); + sql.setCondition(cnd); + List list = enrollService.listMap(sql); + return Result.success(list); + } + + @At + @Ok("void") + @RequiresPermissions("theRapyRecuperation.schoolUnionUserQuery") + public void exportXlsx(Integer year, + String userName, + String loginName, + String signUpMode, + String unionId, + String takePartInLineId, + String lotId, + String regionalNature, + HttpServletResponse response) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + state.stateName, + state.stateColor, + line.regionalNature, + line.lineName, + agency.travelAgencyName, + ma.baseName, + enroll.*, + lineu.lineId, + lineu.playStartTime, + lineu.playEndTime, + ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id ) isFamily + $lotSql + 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 agency ON agency.id = enroll.takePartInTravelAgencyId + LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId + LEFT JOIN audit_state state ON state.stateId = enroll.stateId + $condition + """); + // 年度 + cnd.andEX("YEAR ( enroll.signingUptime )", "=", year); + if (StrUtil.isNotBlank(userName)) { + cnd.where().andLike("enroll.userName", userName); + } + if (StrUtil.isNotBlank(loginName)) { + cnd.where().andLike("enroll.loginName", loginName); + } + + // 线路 + cnd.andEX("enroll.takePartInLineId", "=", takePartInLineId); + + // 标段 + if (StrUtil.isNotBlank(lotId)) { + SqlExpressionGroup seg = new SqlExpressionGroup(); + seg.or("line.lotId", "=", lotId); + seg.or("ma.lotId", "=", lotId); + cnd.and(seg); + } + + // 区域 + cnd.andEX("line.regionalNature", "=", regionalNature); + + // 校工会可查询指定分工会 + cnd.andEX("enroll.selfUnionId", "=", unionId); + +// // 报名模式 +// if (StrUtil.isNotBlank(signUpMode)) { +// if (signUpMode.equals("1")) { +// cnd.andEX("line.signUpMode", "=", 2); +// } else if (signUpMode.equals("2")) { +// cnd.andEX("lineu.unionId", "=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("3")) { +// cnd.andEX("lineu.unionId", "!=", Vi.getUnionId()); +// cnd.andEX("line.signUpMode", "=", 1); +// } else if (signUpMode.equals("4")) { +// cnd.andEX("line.signUpMode", "=", 3); +// } +// } + + cnd.desc("enroll.stateId"); + cnd.andEX("enroll.stateId", "=", TheRapyRecuperationState.PASS); + cnd.andEX("enroll.isNormal", "=", true); + sql.setCondition(cnd); + + List list = enrollService.listMap(sql); + list.forEach(v -> { + List companionList = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", v.getString("id"))); + for (TheRapyRecuperationEnrollCompanion enrollCompanion : companionList) { + baseService.fetchLinks(enrollCompanion, "bedInfo"); + } + v.setv("companionList", companionList); + }); + + // 配置 + TheRapyRecuperationConfig config = baseService.dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW()); + + List excelEntities = new ArrayList<>(); + excelEntities.add(new ExcelExportEntity("姓名", "userName", 20)); + excelEntities.add(new ExcelExportEntity("工号", "loginName", 20)); + excelEntities.add(new ExcelExportEntity("性别", "sex", 20)); + excelEntities.add(new ExcelExportEntity("单位", "unitName", 20)); + excelEntities.add(new ExcelExportEntity("工会", "unionName", 20)); + excelEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); + excelEntities.add(new ExcelExportEntity("手机号", "mobile", 20)); + if (config.getFamilyInfo() == 2) { + excelEntities.add(new ExcelExportEntity("与本人关系", "relation", 10)); + excelEntities.add(new ExcelExportEntity("床型", "bedType", 10)); + excelEntities.add(new ExcelExportEntity("床位数", "bedNum", 10)); + excelEntities.add(new ExcelExportEntity("意向拼房人", "otherSleepUser", 10)); + } else { + excelEntities.add(new ExcelExportEntity("携带家属数", "familyNumber", 10)); + + } + excelEntities.add(new ExcelExportEntity("备注", "bz", 20)); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("报名人员.xlsx").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + + + try { + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, excelEntities, list); + workbook.write(response.getOutputStream()); + workbook.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/statistics/TheRapyRecuperationLineStatisticsController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/statistics/TheRapyRecuperationLineStatisticsController.java index a58a5e9..3ac86b9 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/statistics/TheRapyRecuperationLineStatisticsController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/statistics/TheRapyRecuperationLineStatisticsController.java @@ -49,10 +49,8 @@ public class TheRapyRecuperationLineStatisticsController { @Inject private TheRapyRecuperationEnrollService enrollService; - @Inject private MsgApi msgApi; - @Inject private Dao dao; @@ -69,16 +67,19 @@ public class TheRapyRecuperationLineStatisticsController { @Param(value = "startYear", required = false) Integer startYear, @Param(value = "endYear", required = false) Integer endYear, @Param(value = "unionId", required = false) String unionId, - @Param("takePartInLineId") String takePartInLineId, + @Param(value = "takePartInLineId") String takePartInLineId, @Param(value = "lotId", required = false) String lotId, @Param(value = "signUpMode", required = false) String signUpMode, @Param(value = "selectId",required = false) String selectId, @Param(value = "regionalNature", required = false) String regionalNature) { Sql sql = Sqls.create(""" SELECT + u.username, + st.stateName, line.id, line.lineName, line.regionalNature, + lineu.auditState, lineu.lineId, lineu.id as lineUId, lineu.signUpMode, @@ -92,7 +93,7 @@ public class TheRapyRecuperationLineStatisticsController { lxs.contact, lxs.contactMobileNumber, enroll.takePartInUnionId AS usUnionId, - if(lineu.signUpMode = 2, '校工会', un.unionname) as unionname, + un.unionname as unionname, lot.lotName, lot.lotValue, enroll.familyNumber, @@ -101,17 +102,19 @@ public class TheRapyRecuperationLineStatisticsController { FROM `the_rapy_recuperation_enroll` enroll LEFT JOIN the_rapy_recuperation_line_union_select lineu ON lineu.id=enroll.takePartInLineId + left join `user` u on u.id=lineu.selectUserId LEFT JOIN the_rapy_recuperation_line line ON line.id = lineu.lineId LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId - LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lineu.travelAgencyId = lxs.id + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON line.travelAgencyId = lxs.id LEFT JOIN sys_union un ON un.id = lineu.unionId + left join audit_state st on st.stateId=lineu.auditState $condition """); Cnd cnd = Cnd.NEW(); cnd.andEX("YEAR(lineu.selectTime)", ">=", startYear); cnd.andEX("YEAR(lineu.selectTime)", "<=", endYear); cnd.andEX("lineu.signUpMode","=",signUpMode); - if (!ShiroUtil.hasAnyRoles("sysadmin,H06")){ + /*if (!ShiroUtil.hasAnyRoles("sysadmin,H06")){ String unionCndSql = "and (selfUnionId='%s' or takePartInUnionId = '%s')".formatted(Vi.getUnionId(), Vi.getUnionId()); sql.setVar("unionCnd", unionCndSql); cnd.and("lineu.unionId", "=", Vi.getUnionId()); @@ -119,6 +122,9 @@ public class TheRapyRecuperationLineStatisticsController { if (Strings.isNotBlank(unionId)) { cnd.and("lineu.unionId", "=", unionId); } + }*/ + if (!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionAdmin")) { + cnd.and("lineu.selectUserId", "=", ShiroUtil.getUserId()); } cnd.andEX("line.lotId", "=", lotId); @@ -131,7 +137,6 @@ public class TheRapyRecuperationLineStatisticsController { return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); } - /** * 根据线路查询报名详情 * @param searchKeyword @@ -187,28 +192,54 @@ public class TheRapyRecuperationLineStatisticsController { @At @ViReturn @RequiresAuthentication - public Object sendSuccess(String id) { - + public Object sendSuccess(String id, Boolean type) { TheRapyRecuperationLineUnionSelect unionSelect = dao.fetch(TheRapyRecuperationLineUnionSelect.class, id); TheRapyRecuperationLine line = dao.fetch(TheRapyRecuperationLine.class, unionSelect.getLineId()); if (DateUtil.compare(new Date(), unionSelect.getSignUpEndTime()) < 0) { - return Result.error("报名还未结束,不能发送"); + return Result.error("报名还未结束"); } - //找出报名人员 - List enrolls = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", id) - .and("isNormal", "=", true).and("year(signingUptime)", "=", DateUtil.thisYear()) - .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); + + unionSelect.setGroupSuccess(true); + unionSelect.setGroupTime(DateUtil.now()); + switch (unionSelect.getSignUpMode()) { + case 1 -> unionSelect.setAuditState(7707); + case 2 -> unionSelect.setAuditState(7712); + case 3 -> unionSelect.setAuditState(7700); + } + dao.update(unionSelect); //发短信 - enrolls.forEach(item -> { - String content = "%s老师,您好!您报名的%s线路,出行时间为%s,达到成团条件,请准时参加疗休养活动。".formatted( - item.getUserName(), - line.getLineName(), - DateUtil.format(unionSelect.getPlayStartTime(), "yyyy-MM-dd") - ); - List list = List.of(Map.of("type", "User", "userId", item.getLoginName(), "name", item.getUserName())); - //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); - }); + if(type) { + //找出报名人员 + List enrolls = dao.query( + TheRapyRecuperationEnroll.class, + Cnd.where("takePartInLineId", "=", id) + .and("isNormal", "=", true).and("year(signingUptime)", "=", DateUtil.thisYear()) + .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); + enrolls.forEach(item -> { + String content = "%s老师,您好!您报名的%s线路,出行时间为%s,达到成团条件,请准时参加疗休养活动。".formatted( + item.getUserName(), + line.getLineName(), + DateUtil.format(unionSelect.getPlayStartTime(), "yyyy-MM-dd") + ); + msgApi.sendTextMsg(content, item.getLoginName()); + }); + } + return null; + } + + @At + @ViReturn + @RequiresAuthentication + @Aop(TransAop.READ_COMMITTED) + public Object deleteJoinUser(String id) { + if (StrUtil.isBlank(id)) { + return Result.error("需要的删除的信息为空"); + } + TheRapyRecuperationEnroll enroll = dao.fetch(TheRapyRecuperationEnroll.class, id); + dao.clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "=", id)); + dao.clear(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); + dao.clear(TheRapyRecuperationEnrollBed.class, Cnd.where("id", "=", enroll.getBedInfo().getId())); return null; } @@ -217,16 +248,22 @@ public class TheRapyRecuperationLineStatisticsController { @RequiresAuthentication @Aop(TransAop.READ_COMMITTED) public Object sendFail(String id, Boolean type) { - TheRapyRecuperationLineUnionSelect unionSelect = dao.fetch(TheRapyRecuperationLineUnionSelect.class, id); TheRapyRecuperationLine line = dao.fetch(TheRapyRecuperationLine.class, unionSelect.getLineId()); if (DateUtil.compare(new Date(), unionSelect.getSignUpEndTime()) < 0) { - return Result.error("报名还未结束,不能发送"); + return Result.error("报名还未结束"); } + + unionSelect.setGroupSuccess(false); + unionSelect.setGroupTime(null); + dao.update(unionSelect); + //找出报名人员 - List enrolls = dao.query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", id) - .and("isNormal", "=", true).and("year(signingUptime)", "=", DateUtil.thisYear()) - .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); + List enrolls = dao.query( + TheRapyRecuperationEnroll.class, + Cnd.where("takePartInLineId", "=", id) + .and("isNormal", "=", true).and("year(signingUptime)", "=", DateUtil.thisYear()) + .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); //发短信 enrolls.forEach(item -> { @@ -235,13 +272,12 @@ public class TheRapyRecuperationLineStatisticsController { line.getLineName(), DateUtil.format(unionSelect.getPlayStartTime(), "yyyy-MM-dd") ); - List list = List.of(Map.of("type", "User", "userId", item.getLoginName(), "name", item.getUserName())); - //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); + msgApi.sendTextMsg(content, item.getLoginName()); }); if(!type) { List enrollIds = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList()); - List bedIds = enrolls.stream().map(TheRapyRecuperationEnroll::getBedInfo).collect(Collectors.toList()); + List bedIds = enrolls.stream().map(TheRapyRecuperationEnroll::getBedInfoId).collect(Collectors.toList()); dao.clear(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", id)); dao.clear(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", enrollIds)); dao.clear(TheRapyRecuperationEnrollBed.class, Cnd.where("id", "in", bedIds)); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/summary/TherapyRecuperationEvaluateStatisticsController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/summary/TherapyRecuperationEvaluateStatisticsController.java new file mode 100644 index 0000000..06e9b2b --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/summary/TherapyRecuperationEvaluateStatisticsController.java @@ -0,0 +1,182 @@ +package io.v.nutz.zhgh.therapyRecuperation.controller.summary; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.base.annontation.ViReturn; +import io.v.nutz.base.query.PageForm; +import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; +import io.v.nutz.base.utils.ViTool; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@IocBean +@Ok("json:full") +@At("/platform/therapyRecuperation/evaluate/statistics") +public class TherapyRecuperationEvaluateStatisticsController { + + @Inject + private TheRapyRecuperationEnrollService enrollService; + + @Inject + private Dao dao; + + @At("") + @Ok("beetl:/platform/theRapyRecuperation/summary/evaluateStatistics.html") + @RequiresPermissions("theRapyRecuperation.evaluate.statistics") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.evaluate.statistics") + public Object pageData(PageForm pageForm, + String lineId, + String unionId, + String unitId, + String personType, + String userState, + String evaluateScore) { + Sql sql = Sqls.create(""" + SELECT + we.evaluateText, + we.evaluateScore, + we.userName, + we.loginName, + u.unionname, + u.unitname, + u.userState, + u.personType, + line.lineName, + us.playStartTime + FROM + `the_rapy_recuperation_evaluate` we + LEFT JOIN `user` u ON u.id = we.userId + LEFT JOIN the_rapy_recuperation_enroll en ON en.takePartInLineId = we.lineId + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = en.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId + $condition + """); + Cnd cnd = Cnd.NEW(); + if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); + } + if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equals("ascending") ? "asc" : "desc"); + } else { + cnd.desc("we.evaluateScore"); + } + if(StrUtil.isNotBlank(lineId)) { + cnd.andEX("we.lineId", "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"); + sql.setCondition(cnd); + return enrollService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + @At + @ViReturn + @RequiresPermissions("theRapyRecuperation.evaluate.statistics") + public Object lineList(Integer year) { + Sql sql = Sqls.create(""" + SELECT + GROUP_CONCAT(us.id) as id, + line.lineName, + if(us.signUpMode = 2, '校工会', un.unionname) as unionName + FROM + 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 + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("year(us.selectTime)", "=", year); + cnd.groupBy("lineId, unionid"); + sql.setCondition(cnd); + return enrollService.listMap(sql); + } + + @At + @Ok("void") + @RequiresPermissions("theRapyRecuperation.evaluate.statistics") + public void exportEvaluate(String lineId, + String unionId, + String unitId, + String evaluateScore, + String searchKeyword, + String searchName, + HttpServletResponse response) { + Sql sql = Sqls.create(""" + SELECT + we.evaluateText, + we.evaluateScore, + we.userName, + we.loginName, + u.unionname, + u.unitname, + u.userState, + u.personType, + line.lineName, + us.playStartTime + FROM + `the_rapy_recuperation_evaluate` we + LEFT JOIN `user` u ON u.id = we.userId + LEFT JOIN the_rapy_recuperation_enroll en ON en.takePartInLineId = we.lineId + LEFT JOIN the_rapy_recuperation_line_union_select us ON us.id = en.takePartInLineId + LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId + $condition + """); + Cnd cnd = Cnd.NEW(); + if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) { + cnd.and(Cnd.likeEX(searchName, searchKeyword)); + } + if(StrUtil.isNotBlank(lineId)) { + cnd.andEX("we.lineId", "in", lineId.split(",")); + } + cnd.andEX("u.unionid", "=", unionId); + cnd.andEX("u.unitid", "=", unitId); + cnd.andEX("we.evaluateScore", "=", evaluateScore); + cnd.groupBy("we.lineId"); + sql.setCondition(cnd); + + List listMap = enrollService.listMap(sql); + + List entities = new ArrayList<>(); + entities.add(new ExcelExportEntity("线路","lineName",20)); + entities.add(new ExcelExportEntity("出行时间","playStartTime",20)); + entities.add(new ExcelExportEntity("工号","loginName",20)); + entities.add(new ExcelExportEntity("姓名","userName",20)); + entities.add(new ExcelExportEntity("所属单位","unitname",20)); + entities.add(new ExcelExportEntity("所属工会","unionname",20)); + entities.add(new ExcelExportEntity("在职状态","userState",20)); + entities.add(new ExcelExportEntity("人员类型","personType",20)); + entities.add(new ExcelExportEntity("评分","evaluateScore",20)); + entities.add(new ExcelExportEntity("评价","evaluateText",40)); + + try { + ViTool.excelResponse(response, "评价人员名单.xls"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entities, listMap); + workbook.write(response.getOutputStream()); + } catch (Exception ignored) {} + } +} diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java index 1585bf3..2fa9d1a 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.theRapyConfig; - import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java index 4263695..bc8006e 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationBaseManagement.java @@ -1,7 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.model; import cn.afterturn.easypoi.excel.annotation.Excel; - import io.v.nutz.sys.models.Sys_file; import lombok.Data; import lombok.experimental.Accessors; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java index 9db3cc1..cbdf9fa 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationConfig.java @@ -1,5 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.model; +import io.v.nutz.sys.models.Sys_file; import lombok.Data; import lombok.experimental.Accessors; import org.nutz.dao.entity.annotation.*; @@ -67,21 +68,13 @@ public class TheRapyRecuperationConfig { @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("标段") @@ -109,12 +102,15 @@ public class TheRapyRecuperationConfig { @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 + @ColDefine(type = ColType.MYSQL_JSON) + @Comment("承诺书") + private List files; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java index 75057f7..cb73fc7 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnroll.java @@ -157,6 +157,10 @@ public class TheRapyRecuperationEnroll extends BaseModel { private String lineId; + private Date playStartTime; + + private Date playEndTime; + /** * 床位信息 */ @@ -199,9 +203,8 @@ public class TheRapyRecuperationEnroll extends BaseModel { private Integer familyNumber; @Column - @ColDefine(type = ColType.BOOLEAN) - @Comment("是否报销") - private Boolean isReimbursement; + @ColDefine(type = ColType.VARCHAR, width = 100) + @Comment("签字") + private String sign; - private String firstLetter; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEvaluate.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEvaluate.java new file mode 100644 index 0000000..e8a2ea5 --- /dev/null +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEvaluate.java @@ -0,0 +1,58 @@ +package io.v.nutz.zhgh.therapyRecuperation.model; + +import io.v.nutz.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; + +@Data +@EqualsAndHashCode(callSuper = true) +@Table +public class TheRapyRecuperationEvaluate extends BaseModel implements Serializable { + + @Name + @Column + @Comment("ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + @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/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java index 41e4e85..f321454 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLine.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.model; import cn.wizzer.framework.base.model.BaseModel; +import io.v.nutz.sys.models.Sys_file; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -8,6 +9,7 @@ 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.TheRapyRecuperationLine @@ -120,11 +122,11 @@ public class TheRapyRecuperationLine extends BaseModel { @Column @ColDefine(type = ColType.MYSQL_JSON) @Comment("缩略图") - private String files; + private List files; @Column @ColDefine(type = ColType.INT) - @Comment("报名模式(1.分工会 2.自由)") + @Comment("报名模式(1.分工会 2.自由 3.个人)") private Integer signUpMode; @Column @@ -147,7 +149,18 @@ public class TheRapyRecuperationLine extends BaseModel { @Comment("联系电话") private String lineContactPhone; + @Column + @ColDefine(type = ColType.VARCHAR) + @Comment("旅行社地点") + private String travelAgencyPlace; + @One(field = "travelAgencyId") private TheRapyRecuperationTravelAgency travelAgency; + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("开放选择") + @Default("0") + private boolean openChoose; + } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java index d1cd5b7..5808a1a 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java @@ -6,8 +6,10 @@ 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; /** @@ -117,7 +119,7 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel { @Column @ColDefine(type = ColType.INT) - @Comment("报名模式、组织形式(1.分工会 2.校工会)") + @Comment("报名模式、组织形式(1.分工会 2.校工会 3.个人)") private Integer signUpMode; @Column @@ -126,7 +128,43 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel { private Boolean enable; @Column - @ColDefine(type = ColType.VARCHAR, width = 32) - @Comment("旅行社id") - private String travelAgencyId; + @ColDefine(type = ColType.MYSQL_JSON) + @Comment("报名范围(1.自己选择 2.分工会 3.全校)") + private List signScope; + + @Column + @ColDefine(type = ColType.MYSQL_JSON) + @Comment("人员名单") + private List chooseUserList; + + @Column + @ColDefine(type = ColType.BOOLEAN) + @Comment("是否成团") + private Boolean groupSuccess; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("成团时间") + private String groupTime; + + @Column + @ColDefine(type = ColType.INT) + @Comment("审核状态") + private Integer auditState; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("分工会审核id") + private String unionAuditId; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("单位领导审核id") + private String unitLeaderAuditId; + + @Column + @ColDefine(type = ColType.VARCHAR,width = 32) + @Comment("校工会审核id") + private String schoolAuditId; + } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java index 433875c..f722f87 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationTravelAgency.java @@ -1,12 +1,15 @@ package io.v.nutz.zhgh.therapyRecuperation.model; import cn.wizzer.framework.base.model.BaseModel; +import io.v.nutz.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; + /** * @FileName io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency * @Description: 疗休养旅行社管理 @@ -74,10 +77,10 @@ public class TheRapyRecuperationTravelAgency extends BaseModel { @Column @ColDefine(type = ColType.MYSQL_JSON) @Comment("缩略图") - private String files; + private List files; @Column - @ColDefine(type = ColType.BOOLEAN) - @Comment("是否自由组团") - private Boolean signUpTravelAgency; + @ColDefine(type = ColType.MYSQL_JSON) + @Comment("旅行社地点") + private List travelAgencyPlaces; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java index ef24dd9..43ec741 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationAuditService.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.service; - import io.v.nutz.base.model.Audit; import io.v.nutz.base.service.ViService; import org.nutz.lang.util.NutMap; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java index 98d0172..a997664 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationCommonService.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.service; - import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java index 4e41312..2e27718 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationEnrollJoinUserImportService.java @@ -1,6 +1,5 @@ package io.v.nutz.zhgh.therapyRecuperation.service; - import io.v.nutz.base.service.ViService; import org.nutz.lang.util.NutMap; 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 3cfd8b0..33b0b21 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 @@ -1,10 +1,8 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; - import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; - import io.v.nutz.sys.models.Sys_union; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import org.nutz.dao.Cnd; @@ -33,8 +31,6 @@ public interface TheRapyRecuperationEnrollService extends ViService getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType); - Object openSignUser(String usId, String travelId, String searchKeyWord); - /** * 线路报名 * @@ -73,19 +69,8 @@ public interface TheRapyRecuperationEnrollService extends ViService - */ Map validSignUpInfo(String loginName, TheRapyRecuperationEnroll enrollInfo); - Map validSignUpInfoForZJXU(String loginName, TheRapyRecuperationEnroll enrollInfo); - - Map validSignUpInfoForZJNU(String loginName, TheRapyRecuperationEnroll enrollInfo); - /** * 我报名的页面数据 * @@ -120,7 +105,7 @@ public interface TheRapyRecuperationEnrollService extends ViService getTheRapyUnions(Integer year, int theRapyRecuperationType); + List getTheRapyUnions(Integer year); } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java index d5cbad6..f654c73 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineAdjustmentService.java @@ -1,11 +1,9 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; - import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; - import java.util.List; public interface TheRapyRecuperationLineAdjustmentService extends ViService { diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java index bde0d5b..616d652 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineClusterService.java @@ -1,7 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; - import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java index e2f45bc..764ba21 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineService.java @@ -1,7 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; - import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java index a2f937a..cec3222 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationLineUnionSelectService.java @@ -1,7 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; - import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; @@ -25,7 +24,7 @@ public interface TheRapyRecuperationLineUnionSelectService extends ViService */ - List getHasSelectLineIds(); + List getHasSelectLineIds(Integer mode); /** diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationTravelAgencyService.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationTravelAgencyService.java index f7b0207..a5ae995 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationTravelAgencyService.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/TheRapyRecuperationTravelAgencyService.java @@ -1,7 +1,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service; import cn.wizzer.framework.page.Pagination; - import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.ViService; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationAuditServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationAuditServiceImpl.java index 4fbc38e..c0e0741 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationAuditServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationAuditServiceImpl.java @@ -2,9 +2,9 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.hutool.core.util.StrUtil; import io.v.nutz.base.model.Audit; -import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.base.utils.MsgApi; import io.v.nutz.base.utils.Vi; +import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.sys.models.Sys_user; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnrollBed; @@ -22,7 +22,6 @@ import org.nutz.lang.Strings; import org.nutz.lang.util.NutMap; import java.util.List; -import java.util.Map; @IocBean(args = {"refer:dao"}) public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl implements TheRapyRecuperationAuditService { @@ -37,7 +36,7 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im public List getXlByUnion(Integer state, String unionId, String regionalNature, String year,String endYear, Integer signUpMode) { Sql sql = Sqls.create(""" - SELECT + SELECT line.*, lineu.id as selectId, un.unionname, @@ -83,7 +82,6 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im Sql sql = Sqls.create(""" SELECT lxs.travelAgencyName, - ta.travelAgencyName as joinTravelAgencyName, enroll.*, line.lineName, if(enroll.takePartInUnionId!=enroll.selfUnionId,true,false) isTransferIn, @@ -92,8 +90,7 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im `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 + LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId where enroll.id=@id """).setParam("id", id); @@ -117,7 +114,9 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im } List companionList = dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id)); companionList.forEach(v -> { - v.setBedInfo(dao().fetch(TheRapyRecuperationEnrollBed.class, v.getBedInfoId())); + if(StrUtil.isNotBlank(v.getBedInfoId())) { + v.setBedInfo(dao().fetch(TheRapyRecuperationEnrollBed.class, v.getBedInfoId())); + } }); map.addv("viewData", fetch.setv("companionList", companionList)); @@ -135,11 +134,10 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl im 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(TheRapyRecuperationState.PASS)) { content = "【智慧工会】%s老师您好,您报名的%s线路已组团成功,请按约定出行。" .formatted(user.getUsername(), theRapyRecuperationLine.getLineName()); } - //msgApi.sendMsg(content, list, "疗休养", " IntelligenceMode", MsgApi.sendMode.normal.name()); + msgApi.sendTextMsg(content,user.getLoginname()); } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java index a0a4c83..754864a 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationCommonServiceImpl.java @@ -1,8 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; -import io.v.nutz.base.model.Audit; -import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.base.utils.DateUtil; +import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationType; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java index 5bb4110..2c370db 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollJoinUserImportServiceImpl.java @@ -1,8 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; -import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.base.utils.Vi; - +import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollJoinUserImportService; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; 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 c8d04dd..4bc1495 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 @@ -1,50 +1,43 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.extra.pinyin.PinyinUtil; import cn.wizzer.framework.page.Pagination; -import io.v.nutz.base.query.PageForm; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.activity.models.ActivityUserScope; import io.v.nutz.base.service.BaseService; -import io.v.nutz.base.service.impl.ViServiceImpl; -import io.v.nutz.base.utils.EmailUtil; import io.v.nutz.base.utils.MsgApi; import io.v.nutz.base.utils.Vi; - +import io.v.nutz.base.query.PageForm; +import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.sys.models.Sys_union; import io.v.nutz.sys.models.Sys_user; import io.v.nutz.sys.models.User; -import io.v.nutz.web.commons.utils.ShiroUtil; -import io.v.nutz.zhgh.activity.models.ActivityUserScope; import io.v.nutz.zhgh.therapyRecuperation.constant.*; import io.v.nutz.zhgh.therapyRecuperation.model.*; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineService; -import org.apache.poi.ss.usermodel.Workbook; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; import org.nutz.dao.util.Daos; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.dao.util.cri.Static; import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; -import java.io.File; -import java.io.FileOutputStream; import java.time.LocalDate; import java.time.Period; import java.util.*; import java.util.stream.Collectors; /** - * @FileName io.v.nutz.therapyRecuperation.service.impl.TheRapyRecuperationEnrollServiceImpl + * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationEnrollServiceImpl * @Description: 疗休养报名service * @Author zxc * @Date 2022/6/1:18:46 @@ -59,9 +52,6 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, usgh.unionname AS usUnionName, usgh.id AS takePartInUnionId, u.username AS createUserName, @@ -105,6 +97,8 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl \"$[*].id\", '\"%s\"')".formatted(ShiroUtil.getUserId()))));//面向自己选择的 + personalGroup.and(group); + + if(lineUnionType != null) { + switch (lineUnionType) { + case 1 -> lineCnd.and(selfUnionGroup); + case 2 -> lineCnd.and(otherUnionGroup); + case 3 -> lineCnd.and(schoolUnionGroup); + case 4 -> lineCnd.and(personalGroup); + } + } else { + SqlExpressionGroup expressionGroup = new SqlExpressionGroup(); + expressionGroup.or(selfUnionGroup).or(otherUnionGroup).or(schoolUnionGroup).or(personalGroup); + lineCnd.and(expressionGroup); } lineSql.setVar("lineCnd", lineCnd); return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), lineSql); } else if (TheRapyRecuperationType.provinceInTravelAgency.getValue() == trrt) { cnd.andEX("year", "=", year != null ? year : DateUtil.thisYear()); cnd.and("isDisabled", "=", false); - cnd.and("ta.signUpTravelAgency", "=", true); Sql taSql = Sqls.create(""" select *, - files as fileId, - (select count(1) from the_rapy_recuperation_enroll where takePartInTravelAgencyId=ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as signUpUserNum, - (select count(1) from the_rapy_recuperation_enroll_companion where trreId in (select id from the_rapy_recuperation_enroll where takePartInTravelAgencyId = ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year)) as signUpUserFamilyNum, - (select ifnull(sum(familyNumber),0) from the_rapy_recuperation_enroll where takePartInTravelAgencyId=ta.id and isNormal = true and stateId not in (2715,2725,2735) and YEAR(signingUptime)=@year) as familyNumber + cast(files ->> '$[0].id' as char) as fileId from - the_rapy_recuperation_travel_agency ta $condition - """).setParam("year", DateUtil.thisYear()); + the_rapy_recuperation_travel_agency $condition + """); taSql.setCondition(cnd); return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); } else if (TheRapyRecuperationType.provinceInHotel.getValue() == trrt) { @@ -162,7 +174,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' as char) as fileId, l.lotName, t.travelAgencyName from @@ -197,7 +209,8 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, usgh.unionname AS usUnionName, usgh.id AS takePartInUnionId, u.username AS createUserName, @@ -216,6 +229,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl \"$[*].id\", '\"%s\"')".formatted(ShiroUtil.getUserId()))));//面向自己选择的 + personalGroup.and(group); + + if(lineUnionType != null) { + switch (lineUnionType) { + case 1 -> lineCnd.and(selfUnionGroup); + case 2 -> lineCnd.and(otherUnionGroup); + case 3 -> lineCnd.and(schoolUnionGroup); + case 4 -> lineCnd.and(personalGroup); + } + } else { + SqlExpressionGroup expressionGroup = new SqlExpressionGroup(); + expressionGroup.or(selfUnionGroup).or(otherUnionGroup).or(schoolUnionGroup).or(personalGroup); + lineCnd.and(expressionGroup); } lineSql.setVar("lineCnd", lineCnd); return (List) Daos.query(dao(), lineSql.toString(), Sqls.callback.maps()); } - @Override - public Object openSignUser(String usId, String travelId, String searchKeyWord) { - List enrolls = new ArrayList<>(); - if(StrUtil.isNotBlank(usId)) { - enrolls = dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "=", usId) - .and("isNormal", "=", true) - .and("stateId", "=", 2750) - .and(Cnd.likeEX("userName", searchKeyWord)) - .asc("unionName")); - } - if(StrUtil.isNotBlank(travelId)) { - enrolls = dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInTravelAgencyId", "=", travelId) - .and("isNormal", "=", true) - .and("stateId", "=", 2750) - .and(Cnd.likeEX("userName", searchKeyWord)) - .asc("unionName")); - } - enrolls.forEach(item -> { - String firstLetter = PinyinUtil.getFirstLetter(StrUtil.sub(item.getUserName(), 0, 1), ""); - item.setFirstLetter(firstLetter.toUpperCase()); - }); - - Map> listMap = enrolls.stream().collect(Collectors.groupingBy(TheRapyRecuperationEnroll::getFirstLetter)); - - // 对分组结果的键进行排序 - return listMap.entrySet().stream() - .sorted(Comparator.comparing(Map.Entry::getKey)) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, - (oldValue, newValue) -> oldValue, LinkedHashMap::new)); - } - /** * 线路报名 * @@ -334,6 +339,11 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl - */ @Override public Map validSignUpInfo(String loginName, TheRapyRecuperationEnroll enrollInfo) { @@ -477,143 +477,6 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl oneYear = this.validCountOneYear(loginName, travelFrequency); - if (oneYear != null) { - return oneYear; - } - } - - //如果报酒店 - if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId()) && StrUtil.isBlank(enrollInfo.getId())) { - Map oneYear = this.validCountOneYear(loginName, travelFrequency); - if (oneYear != null) { - return oneYear; - } - } - - Date signUpStartTime = null; - Date signUpEndTime = null; - Date changeEndTime = null; - - if (StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { - //线路信息 - TheRapyRecuperationLine lineInfo = dao().fetch(TheRapyRecuperationLine.class, enrollInfo.getTakePartInLineId()); - //如果是学校创建的线路 分工会选择模式 查询线路工会所设置的时间 - if (lineInfo.getCreateMode() == TheRapyRecuperationLineCreateMode.SCHOOL.getValue() && - lineInfo.getSignUpMode() == TheRapyRecuperationSignUpMode.UNION.getValue()) { - - TheRapyRecuperationLineUnionSelect selfUnionSelInfo = dao().fetch(TheRapyRecuperationLineUnionSelect.class, - Cnd.where("lineId", "=", enrollInfo.getTakePartInLineId()) - .and("unionId", "=", enrollInfo.getTakePartInUnionId())); - signUpStartTime = selfUnionSelInfo.getSignUpStartTime(); - signUpEndTime = selfUnionSelInfo.getSignUpEndTime(); - changeEndTime = selfUnionSelInfo.getChangeEndTime(); - } else { - signUpStartTime = lineInfo.getSignUpStartTime(); - signUpEndTime = lineInfo.getSignUpEndTime(); - changeEndTime = lineInfo.getChangeEndTime(); - } - if (DateUtil.compare(new Date(), signUpStartTime) < 0) { - return Map.of(false, "报名未开始,请耐心等待"); - } - if (DateUtil.compare(new Date(), changeEndTime) > 0) { - return Map.of(false, "报名时间已过,抱歉不能报名"); - } - TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); - if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue()) { - //省外 outsideNumber 年内是否去过 - int lineJoinCount = this.getCountByOutLine(trrt, loginName, outsideNumber); - if (lineJoinCount > 0) { - return Map.of(false, "省外线路%s年只能报名一次!".formatted(outsideNumber)); - } - //获取今年的所有省外线路 - List lineList = dao().query(TheRapyRecuperationLine.class, Cnd.where("year", "=", DateUtil.thisYear()) - .and("isDisabled", "=", false)); - List lineIds = lineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()); - //获取这些省外线路的总报名人数 - List enrollList = dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "in", lineIds) - .and("isNormal", "=", true)); - if (enrollList.size() >= allLineSignUpNumber) { - return Map.of(false, "不能报名,省外线路报名人数已达到" + allLineSignUpNumber + "人"); - } - } - } else if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId())) { - TheRapyRecuperationBaseManagement baseManagement = dao().fetch(TheRapyRecuperationBaseManagement.class, enrollInfo.getTakePartInBaseManagementId()); - signUpStartTime = baseManagement.getSignUpStartTime(); - signUpEndTime = baseManagement.getSignUpEndTime(); - changeEndTime = baseManagement.getChangeEndTime(); - if (DateUtil.compare(new Date(), signUpStartTime) < 0) { - return Map.of(false, "报名未开始,请耐心等待"); - } - if (DateUtil.compare(new Date(), signUpEndTime) > 0) { - return Map.of(false, "报名时间已过,抱歉不能报名"); - } - } - - if (StrUtil.isBlank(enrollInfo.getId())) { - Map oneYear = this.validCountOneYear(loginName, travelFrequency); - if (oneYear != null) { - return oneYear; - } - } - - //变更操作 - if (StrUtil.isNotBlank(enrollInfo.getId())) { - int changeCount = dao().count(TheRapyRecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "=", enrollInfo.getId())); - - if (changeCount >= modifyNumber) { - return Map.of(false, "只能变更" + changeCount + "次!"); - } - - if (DateUtil.compare(new Date(), changeEndTime) > 0) { - return Map.of(false, "超过变更截至时间,无法变更!"); - } else { - return Map.of(true, "验证成功"); - } - } - - return Map.of(true, "验证成功"); - } - - @Override - public Map validSignUpInfoForZJXU(String loginName, TheRapyRecuperationEnroll enrollInfo) { - - //配置信息 - TheRapyRecuperationConfig config = dao().fetch(TheRapyRecuperationConfig.class); - - Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); - //判断是否在报名范围内 - int count = dao().count("activity_user_scope", Cnd.NEW().and("groupId", "=", config.getActivityGroupId()) - .and("userId", "=", user.getId() )); - if (count == 0) { - return Map.of(false, "抱歉,您不在报名范围内!"); - } - //每年旅行频率 Integer travelFrequency = config.getTravelFrequency(); //省外几年去一次 @@ -634,7 +497,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "add"); - if(map != null) { - return map; - } - }*/ + Map oneYear = this.validCountOneYear(loginName, travelFrequency); + if (oneYear != null && oneYear.containsKey(false)) { + return oneYear; + } //获取起始年份到当前时间,是否报名 Sql sql = Sqls.create(""" @@ -675,7 +535,6 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl nowYearMapList = listMap(nowYearSql); - //两年参加省外 - Cnd twoYearOutCnd = commonCnd.clone(); - twoYearOutCnd.and("signingUptime", ">=", provinceStartYear + "-01-01"); - twoYearOutCnd.and("regionalNature", "=", "省外"); - twoYearOutCnd.and("isTakePartIn", "=", true); - twoYearOutSql.setCondition(twoYearOutCnd); - List twoYearOutMapList = listMap(twoYearOutSql); - //三年参加省外 Cnd threeYearOutCnd = commonCnd.clone(); threeYearOutCnd.and("signingUptime", ">=", (DateUtil.thisYear() - 3) + "-01-01"); @@ -716,7 +567,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl threeYearOutMapList = listMap(threeYearOutSql); //今年是否报名,不管报省内还是省外 - if (nowYearMapList.size() > 0) { + if (Lang.isNotEmpty(nowYearMapList)) { NutMap nowYearMap = nowYearMapList.get(0); //判断当前报名的线路是否和今年第一次报名的线路重复 if (nowYearMap.getString("takePartInLineId").equals(lineUnionSelect.getId())) { @@ -725,19 +576,15 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl maxCost) { - return Map.of(false, "您已报名过省内或省外线路"); + return Map.of(false, "您已报名过省内线路"); } } //省内线路判断 if (trrt.getValue() == TheRapyRecuperationType.provinceInLine.getValue()) { - if (twoYearInMapList.size() == 0 && threeYearOutMapList.size() == 0) { + if (Lang.isEmpty(twoYearInMapList)) { return Map.of(true, "验证成功"); } - //查询两年内有没有参加过省外 - if (twoYearOutMapList.size() > 0) { - return Map.of(false, "您近两年已参加过省外线路,不能报名省内线路"); - } - if (twoYearInMapList.size() > 0) { + if (Lang.isNotEmpty(twoYearInMapList)) { int hasCost = twoYearInMapList.get(0).getInt("activityCost"); if ((hasCost + currentLineCost) > maxCost) { return Map.of(false, "您已参加过省内线路"); @@ -746,237 +593,25 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl 0) { - return Map.of(false, "您近两年已参加过省内线路,不能报名省外线路"); - } //三年内有没有参加过省外 - if (threeYearOutMapList.size() > 0) { + if (Lang.isNotEmpty(threeYearOutMapList)) { return Map.of(false, "近三年内您已参加过省外线路,不能再次报名"); } - //获取今年的所有线路 - List lineList = dao().query(TheRapyRecuperationLine.class, Cnd.where("year", "=", DateUtil.thisYear()) - .and("isDisabled", "=", false)); - List lineIds = lineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()); - //获取这些线路在选择表中的选择id,因为报名表存的是选择id - List selectList = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", lineIds)); - List selectIds = selectList.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList()); - //获取这些省外线路的总报名人数 - List enrollList = dao().query(TheRapyRecuperationEnroll.class, Cnd.where("takePartInLineId", "in", selectIds) - .and("isNormal", "=", true).and("signingUptime", "=", DateUtil.thisYear()) - .and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL))); - //活动范围总人数 - List userScopes = dao().query(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId)); - int result = (int) Math.floor((double) userScopes.size() / 3); - if (enrollList.size() >= result) { - return Map.of(false, "已报人数超过三分之一,不能报名"); - } } } //变更操作 if (StrUtil.isNotBlank(enrollInfo.getId())) { - - /*if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { - Map map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "edit"); - if(map != null) { - return map; - } - }*/ - int changeCount = dao().count(TheRapyRecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "=", enrollInfo.getId())); - if (changeCount >= modifyNumber) { return Map.of(false, "只能变更" + changeCount + "次!"); } - if (DateUtil.compare(new Date(), changeEndTime) > 0) { return Map.of(false, "超过变更截至时间,无法变更!"); } else { return Map.of(true, "验证成功"); } } - - return Map.of(true, "验证成功"); - } - - @Override - public Map validSignUpInfoForZJNU(String loginName, TheRapyRecuperationEnroll enrollInfo) { - - //配置信息 - TheRapyRecuperationConfig config = dao().fetch(TheRapyRecuperationConfig.class); - - Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); - //判断是否在报名范围内 - int count = dao().count("activity_user_scope", Cnd.NEW().and("groupId", "=", config.getActivityGroupId()) - .and("userId", "=", user.getId() )); - if (count == 0) { - return Map.of(false, "抱歉,您不在报名范围内!"); - } - - //每年旅行频率 - Integer travelFrequency = config.getTravelFrequency(); - //省外几年去一次 - Integer outsideNumber = config.getOutsideNumber(); - //可以修改几次 - Integer modifyNumber = config.getModifyNumber(); - //活动范围 - Integer activityGroupId = config.getActivityGroupId(); - - //如果报旅行社 - if (StrUtil.isNotBlank(enrollInfo.getTakePartInTravelAgencyId())) { - if(StrUtil.isNotBlank(enrollInfo.getId())) { - return Map.of(true, "成功"); - } - Map oneYear = this.validCountOneYear(loginName, travelFrequency); - if (oneYear != null) { - return oneYear; - } - } - - //如果报酒店 - if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId()) && StrUtil.isBlank(enrollInfo.getId())) { - Map oneYear = this.validCountOneYear(loginName, travelFrequency); - if (oneYear != null) { - return oneYear; - } - } - - //线路信息 - TheRapyRecuperationLineUnionSelect lineUnionSelect = dao().fetch(TheRapyRecuperationLineUnionSelect.class, enrollInfo.getTakePartInLineId()); - TheRapyRecuperationLine lineInfo = dao().fetch(TheRapyRecuperationLine.class, lineUnionSelect.getLineId()); - - Date signUpStartTime = lineUnionSelect.getSignUpStartTime(); - Date signUpEndTime = lineUnionSelect.getSignUpEndTime(); - Date changeEndTime = lineUnionSelect.getChangeEndTime(); - //线路人数,省外线路最多报名数 - //Integer estimatedFamilyNumbers = config.getOutsideQuota(); - if (DateUtil.compare(new Date(), signUpStartTime) < 0) { - return Map.of(false, "报名未开始,请耐心等待"); - } - if (DateUtil.compare(new Date(), signUpEndTime) > 0) { - return Map.of(false, "报名时间已过,抱歉不能报名"); - } - - TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); - - if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { - - Map oneYear = this.validCountOneYear(loginName, travelFrequency); - if (oneYear != null) { - return oneYear; - } - - //省外线路判断报名人数 - /*if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { - Map map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "add"); - if(map != null) { - return map; - } - }*/ - - //获取起始年份到当前时间,是否报名 - Sql sql = Sqls.create(""" - SELECT - r.*, - l.regionalNature, - (select activityCost from the_rapy_recuperation_lot where id = l.lotId) as activityCost - FROM - the_rapy_recuperation_enroll r - LEFT JOIN the_rapy_recuperation_line_union_select us on us.id = r.takePartInLineId - LEFT JOIN the_rapy_recuperation_line l ON l.id = us.lineId - $condition - """); - Sql threeYearOutSql = sql; - Sql nowYearSql = sql; - - Cnd commonCnd = Cnd.NEW(); - commonCnd.and("r.takePartInLineId", "is not", null); - commonCnd.and("r.takePartInLineId", "!=", ""); - commonCnd.and("loginName", "=", ShiroUtil.getPrincipalProperty("loginname")); - commonCnd.and("r.isNormal", "=", true); - commonCnd.and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL)); - commonCnd.and("signingUptime", "<=", DateUtil.now()); - - //今年是否报名,不管省内省外 - 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() - outsideNumber) + "-01-01"); - threeYearOutCnd.and("regionalNature", "=", "省外"); - threeYearOutCnd.and("isTakePartIn", "=", true); - threeYearOutSql.setCondition(threeYearOutCnd); - List threeYearOutMapList = listMap(threeYearOutSql); - - //今年是否报名,不管报省内还是省外,还是旅行社 - if (nowYearMapList.size() >= travelFrequency) { - return Map.of(false, "您已经选择%s条线路,并审核通过,不能再次选择。".formatted(travelFrequency)); - } - //省外线路判断 - if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue()) { - //三年内有没有参加过省外 - if (threeYearOutMapList.size() > 0) { - return Map.of(false, "近%s年内您已参加过省外线路,不能再次报名".formatted(outsideNumber)); - } - - //zzr2024-04-25修改,删除下面的,取消注释上面的 - List lineList = dao().query(TheRapyRecuperationLine.class, Cnd.NEW().and("isDisabled", "=", false)); - List lineIds = lineList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList()); - //获取这些线路在选择表中的选择id,因为报名表存的是选择id - List selectList = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", lineIds)); - - List userScopes = dao().query(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId)); - List userIdList = userScopes.stream().map(ActivityUserScope::getUserId).collect(Collectors.toList()); - List userList = dao().query(User.class, Cnd.where("unionid", "=", Vi.getUnionId())); - //分工会所有人数 - List unionUserList = userList.stream().filter(v -> userIdList.contains(v.getId())).collect(Collectors.toList()); - - List outLineIdLIst = selectList.stream().filter(v -> v.getSignUpMode() == 2).map(v -> v.getId()).collect(Collectors.toList()); - - //分工会参加省外线路人数 - List selfUnionIdTakePartInUserList = dao().query(TheRapyRecuperationEnroll.class, - Cnd.where("selfUnionId", "=", Vi.getUnionId()).and("takePartInLineId", "in", outLineIdLIst) - .and("YEAR(signingUptime)", "=", DateUtil.thisYear())); - - int selfUnionTakePartNum = selfUnionIdTakePartInUserList.size(); - int selfUnionNum = unionUserList.size(); - - double bili = (double) selfUnionTakePartNum / selfUnionNum; - - /*if (bili >= 0.33) { - return Map.of(false, "本分工会已报省外线路的人数超过三分之一,不能报名"); - }*/ - } - } - - //变更操作 - if (StrUtil.isNotBlank(enrollInfo.getId())) { - - //省外线路判断报名人数 - /*if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue() && estimatedFamilyNumbers != null) { - Map map = validSignCount(enrollInfo, config, estimatedFamilyNumbers, "add"); - if(map != null) { - return map; - } - }*/ - - int changeCount = dao().count(TheRapyRecuperationEnrollChangeRecord.class, Cnd.where("enrollId", "=", enrollInfo.getId())); - - if (changeCount >= modifyNumber) { - return Map.of(false, "只能变更" + changeCount + "次!"); - } - - if (DateUtil.compare(new Date(), changeEndTime) > 0) { - return Map.of(false, "超过变更截至时间,无法变更!"); - } else { - return Map.of(true, "验证成功"); - } - } - return Map.of(true, "验证成功"); } @@ -1005,7 +640,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl estimatedFamilyNumbers) { + if (( currentSignNumber + enrolls.size()) > estimatedFamilyNumbers) { return Map.of(false, "报名人数已满"); } else { return null; @@ -1016,29 +651,25 @@ 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", unionInSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList())) + .and("takePartInLineId", "in", inList.stream().map(TheRapyRecuperationLine::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", unionOutSelects.stream().map(TheRapyRecuperationLineUnionSelect::getId).collect(Collectors.toList())) + .and("takePartInLineId", "in", outList.stream().map(TheRapyRecuperationLine::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(Cnd.exps("takePartInLineId", "is", null).or("takePartInLineId", "=", "")) - .and("isNormal", "=", true) + .and("takePartInLineId", "is", null).and("isNormal", "=", true) .and("takePartInTravelAgencyId", "is not", null) .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear())); //是否报酒店 @@ -1056,7 +687,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl 0) { str = "酒店"; } - return Map.of(false, "一年只能报" + travelFrequency + "次,您已报" + str + ",请先在我的疗休养中删除,方可报名!"); + return Map.of(false, "一年只能报" + travelFrequency + "次,您已报" + str + ",请先在我的疗休养中删除,报名!"); } return Map.of(true, "成功"); } @@ -1125,7 +756,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, gh.unionname AS signUpUnionName, ta.travelAgencyName, ta.contact, @@ -1163,18 +794,15 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId FROM the_rapy_recuperation_enroll e LEFT JOIN the_rapy_recuperation_travel_agency ta ON ta.id = e.takePartInTravelAgencyId $condition - """).setParam("year", year == null ? DateUtil.thisYear() : year); + """); cnd.and("e.takePartInTravelAgencyId", "is not", null); cnd.and("e.isNormal", "=", true); - cnd.and("YEAR(e.signingUptime)", "=", year == null ? DateUtil.thisYear() : year); + cnd.andEX("ta.year", "=", year); taSql.setCondition(cnd); return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql); } @@ -1186,7 +814,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, l.lotName, ta.regionalNature, t.travelAgencyName, @@ -1214,11 +842,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl { - fetchLinks(item, "bedInfo"); - }); - return recuperationEnroll; + return fetchLinks(enroll, "companionList|bedInfo"); } /** @@ -1230,18 +854,17 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl getTheRapyUnions(Integer year, int theRapyRecuperationType) { + public List getTheRapyUnions(Integer year) { //查询某个年份公开线路了的工会 - Sql sql = Sqls.create(""" - SELECT - rr.unionId - FROM - the_rapy_recuperation_line_union_select rr left join the_rapy_recuperation_line l on rr.lineId = l.id - $condition - """); - Cnd cnd = Cnd.NEW(); - cnd.and("rr.isOpen", "=", true); - cnd.and("year(rr.selectTime)", "=", DateUtil.thisYear()); - cnd.and("rr.unionId", "!=", Vi.getUnionId()); - cnd.and("rr.signUpMode", "=", 1); - cnd.and("l.regionalNature", "=", TheRapyRecuperationType.typeMap.get(theRapyRecuperationType)); - sql.setCondition(cnd); - List listMap = baseService.listMap(sql); - /*List openList = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("isOpen", "=", true) - .and("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear()).and("unionId", "!=", Vi.getUnionId()));*/ + List openList = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("isOpen", "=", true) + .and("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear()).and("unionId", "!=", Vi.getUnionId())); // List openList = dao().query(TheRapyRecuperationLineUnionSelect.class, // Cnd.where("signUpMode", "=", 1).and("year(selectTime)", "=", DateUtil.thisYear())); - if (Lang.isNotEmpty(listMap)) { - List unionIds = listMap.stream().map(o -> o.getString("unionId")).distinct().collect(Collectors.toList()); + if (Lang.isNotEmpty(openList)) { + List unionIds = openList.stream().map(TheRapyRecuperationLineUnionSelect::getUnionId).distinct().collect(Collectors.toList()); return dao().query(Sys_union.class, Cnd.where("id", "in", unionIds)); } return new ArrayList<>(); } - - - /** - * 自由组团取消报名,发送给旅行社 - * @param enroll - */ - private void cancelTravelSendEmail(TheRapyRecuperationEnroll enroll){ - TheRapyRecuperationTravelAgency travelAgency = dao().fetch(TheRapyRecuperationTravelAgency.class, Cnd.where("id", "=", enroll.getTakePartInTravelAgencyId())); - NutMap enrollMap = Lang.obj2nutmap(enroll); - enrollMap.setv("travelAgencyName",travelAgency.getTravelAgencyName()); - enrollMap.setv("remark","该教师自由出行取消报名本旅行社,请从出行名单中移除此教师"); - List nutMaps = new ArrayList<>(); - nutMaps.add(enrollMap); - if (StrUtil.isNotBlank(travelAgency.getEmail())){ - List entityList = new ArrayList<>(); - entityList.add(new ExcelExportEntity("姓名", "userName", 20)); - entityList.add(new ExcelExportEntity("身份证号", "idCard", 20)); - entityList.add(new ExcelExportEntity("联系电话", "mobile", 20)); - entityList.add(new ExcelExportEntity("所属工会", "unionName", 20)); - entityList.add(new ExcelExportEntity("旅行社名称", "travelAgencyName", 20)); - entityList.add(new ExcelExportEntity("备注", "remark", 50)); - - File xls = new File("C:/temp/"+travelAgency.getTravelAgencyName()+"疗休养自由组团出行人员名单.xlsx"); - FileOutputStream fileOutputStream = null; - try { - fileOutputStream = new FileOutputStream(xls); - Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, nutMaps); - workbook.write(fileOutputStream); - fileOutputStream.close(); - emailUtil.send(travelAgency.getEmail(), travelAgency.getTravelAgencyName() + "疗休养自由组团出行人员名单", false, xls); - if (xls.exists()) { - xls.delete(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java index 5b361c7..389c00f 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineAdjustmentServiceImpl.java @@ -2,10 +2,9 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.page.Pagination; +import io.v.nutz.base.utils.Vi; import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.impl.ViServiceImpl; -import io.v.nutz.base.utils.Vi; - import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationLineAdjustmentService; @@ -55,7 +54,8 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl us.id as usId, us.playStartTime, us.playEndTime, - line.files AS fileId, + line.files, + cast( line.files ->> '$[0].id' AS CHAR ) AS fileId, create_gh.unionname AS createUnionName, ta.travelAgencyName, us.unionId, @@ -81,7 +81,7 @@ public class TheRapyRecuperationLineAdjustmentServiceImpl extends ViServiceImpl cnd.and("us.playStartTime", "is not", null); //cnd.andEX("line.year", "=", year); cnd.andEX("line.id", "=", lineId); - if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { + if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) { cnd.andEX("us.unionId", "=", unionId); cnd.andEX("us.signUpMode", "=", Strings.isNotBlank(unionId) ? 1 : 2); } else { diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java index 9de9247..f4c4e01 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineClusterServiceImpl.java @@ -2,9 +2,8 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.query.PageForm; - -import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.base.utils.Vi; +import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationCluster; @@ -122,7 +121,7 @@ public class TheRapyRecuperationLineClusterServiceImpl extends ViServiceImpl> '$[0].id' AS CHAR ) AS fileId, + gh.unionname AS createUnionName, u.username AS createUserName, ta.travelAgencyName, ta.contact, @@ -209,19 +163,20 @@ public class TheRapyRecuperationLineServiceImpl extends ViServiceImpl list = pagination.getList(); diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java index bbe6b1a..ab6079b 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationLineUnionSelectServiceImpl.java @@ -3,10 +3,12 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import cn.wizzer.framework.page.Pagination; +import io.v.nutz.base.utils.Roles; +import io.v.nutz.base.utils.Vi; import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.impl.ViServiceImpl; -import io.v.nutz.base.utils.Vi; - +import io.v.nutz.sys.models.Sys_user_role; +import io.v.nutz.sys.models.User; import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll; import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLineUnionSelect; @@ -21,9 +23,11 @@ import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.util.NutMap; +import java.util.Collections; import java.util.Date; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @FileName io.v.nutz.zhgh.therapyRecuperation.service.impl.TheRapyRecuperationLineUnionSelectServiceImpl @@ -48,7 +52,7 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl * @return {@link Pagination} */ @Override - public Pagination pageData(PageForm pageForm, Cnd cnd, Integer year) { + public Pagination pageData(PageForm pageForm, Cnd cnd, Integer year, Integer mode) { Sql sql = Sqls.create(""" select line.id, @@ -60,14 +64,14 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl line.isDisabled, line.playNumberOfDays, line.createUnionId, - GROUP_CONCAT(us.playStartTime,'至',us.playEndTime,ifnull(concat('(', ta.travelAgencyName, ')'), '') order by us.playStartTime) as playTimes, + GROUP_CONCAT(us.playStartTime,'至',us.playEndTime) as playTimes, us.signUpStartTime, us.signUpEndTime, us.playStartTime, us.playEndTime, us.changeEndTime, us.isOpen, - us.signUpMode, + line.signUpMode, line.createMode, gh.unionname AS createUnionName, u.username AS createUserName, @@ -79,35 +83,27 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl us.unionId as usUnionId, us.id as usId, usUnion.unionname as belongUnionName, - (SELECT COUNT(*) FROM the_rapy_recuperation_enroll WHERE takePartInLineId=us.id and isNormal=true) applyCount + su.username as selectUserName, + (SELECT COUNT(*) FROM the_rapy_recuperation_enroll WHERE takePartInLineId=line.id AND takePartInUnionId=@unionId) applyCount 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 - LEFT JOIN the_rapy_recuperation_line_union_select us on us.lineId = line.id AND year(selectTime) = @year $us - LEFT JOIN the_rapy_recuperation_travel_agency ta on ta.id = us.travelAgencyId + LEFT JOIN the_rapy_recuperation_line_union_select us on us.lineId = line.id and year(selectTime) = @year $us LEFT JOIN sys_union usUnion on usUnion.id = us.unionId + LEFT JOIN sys_user su on us.selectUserId = su.id LEFT JOIN the_rapy_recuperation_lot lot on lot.id = line.lotId $condition """); - if(!ShiroUtil.hasAnyRoles("sysadmin, A06")) { - sql.setVar("us", "AND us.unionId = '%s' AND us.selectUserId = '%s'".formatted(Vi.getUnionId(), ShiroUtil.getPlatformUid())); - } - //sql.setParam("unionId", Vi.getUnionId()); - //sql.setParam("userId", io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("id")); + //sql.setVar("us", "AND us.selectUserId = '%s'".formatted(ShiroUtil.getPlatformUid())); sql.setParam("year", year == null ? DateUtil.thisYear() : year); - - /*SqlExpressionGroup seg = new SqlExpressionGroup(); - seg.or("line.createUnionId", "=", Vi.getUnionId()); - seg.or("line.createMode", "=", TheRapyRecuperationLineCreateMode.SCHOOL.getValue()); - cnd.and(seg);*/ - cnd.groupBy("line.id"); sql.setCondition(cnd); Pagination pagination = list(pageForm, sql); List list = pagination.getList(); - List hasSelectLineIds = getHasSelectLineIds(); + List hasSelectLineIds = getHasSelectLineIds(mode); for (NutMap m : list) { m.setv("isSelect", hasSelectLineIds.contains(m.getString("id"))); @@ -140,12 +136,26 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl * @return {@link List}<{@link String}> */ @Override - public List getHasSelectLineIds() { + public List getHasSelectLineIds(Integer mode) { Sql sql = Sqls.create(""" - select lineId from the_rapy_recuperation_line_union_select - where selectUserId = @userId + select lineId from the_rapy_recuperation_line_union_select $condition """); - sql.setParam("userId", ShiroUtil.getPrincipalProperty("id")); + Cnd cnd = Cnd.NEW(); + cnd.and("signUpMode", "=", mode); + if(mode == 1) { + cnd.and("unionId", "=", Vi.getUnionId()); + } else if(mode == 2) { + //既然你想校工会组织的线路,校工会的人都可以看,那就又根据角色查又根据部门查,可以吧 + //想得多 + List userRoles = dao().query(Sys_user_role.class, Cnd.where("roleId", "=", "9b01918f873645048f8a85a4fc06d135")); + List list = userRoles.stream().map(Sys_user_role::getUserId).distinct().toList(); + List userList = dao().query(User.class, Cnd.where("unitId", "=", "100414")); + List idListByUnit = userList.stream().map(User::getId).toList(); + cnd.and("selectUserId", "in", Stream.concat(list.stream(), idListByUnit.stream()).toList()); + } else { + cnd.and("selectUserId", "=", ShiroUtil.getUserId()); + } + sql.setCondition(cnd); List lineIdsMap = (List) Daos.query(dao(), sql.toString(), Sqls.callback.maps()); return lineIdsMap.stream().map(v -> v.getString("lineId")).collect(Collectors.toList()); } @@ -159,34 +169,16 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl @Override public Object selectLineInfo(String lineId, String unionId, Integer mode, Integer year) { Sql sql; - sql = Sqls.create(""" select - us.id, - lineId, - signUpStartTime, - signUpEndTime, - changeEndTime, - playStartTime, - playEndTime, - us.contact, - us.contactPhone, - minimumGroupSize, - trafficTools, - estimatedCost, - estimatedFamilyNumbers, - us.travelAgencyId, - signUpMode, - enable, - ta.travelAgencyName + * from - the_rapy_recuperation_line_union_select us - left join the_rapy_recuperation_travel_agency ta on ta.id = us.travelAgencyId + the_rapy_recuperation_line_union_select where unionId = @unionId - and lineId = @lineId - and signUpMode = @mode - and year(selectTime) = @year - ORDER BY signUpStartTime,playStartTime ASC + and lineId = @lineId + and signUpMode = @mode + and year(selectTime) = @year + ORDER BY signUpStartTime ASC """); sql.setParam("unionId", unionId); sql.setParam("lineId", lineId); @@ -194,7 +186,6 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl sql.setParam("year", year == null ? DateUtil.thisYear() : year); return listMap(sql); - // TheRapyRecuperationLine line = dao().fetch(TheRapyRecuperationLine.class, lineId); // if (line.getSignUpMode() == TheRapyRecuperationSignUpMode.UNION.getValue()) { // sql = Sqls.create(""" diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java index 3421057..74e33f7 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationTravelAgencyServiceImpl.java @@ -3,9 +3,6 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.query.PageForm; import io.v.nutz.base.service.impl.ViServiceImpl; -import io.v.nutz.base.utils.Vi; - - import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency; import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService; import org.nutz.dao.Chain; @@ -84,7 +81,7 @@ public class TheRapyRecuperationTravelAgencyServiceImpl extends ViServiceImpl> '$[0].id' as char) as fileId from the_rapy_recuperation_travel_agency $condition """); @@ -119,8 +116,7 @@ public class TheRapyRecuperationTravelAgencyServiceImpl extends ViServiceImpl - {{ viewData.loginName }} + {{ viewData.loginName }} {{ viewData.userName }} {{ viewData.sex }} {{ viewData.idCard }} @@ -42,19 +42,21 @@ {{ viewData.isFamily ? '携带' : '未携带' }} - {{ viewData.bedInfo.bedType }} - {{ - viewData.bedInfo.bedNum ? viewData.bedInfo.bedNum : '暂无' - }} - + -
+

同伴信息 @@ -86,7 +88,7 @@

- +

@@ -104,7 +106,7 @@

- +

@@ -147,6 +149,7 @@ module.exports = { bedInfo: {}, }, loading: false, + modifyConfig:{} } }, methods: { @@ -169,9 +172,16 @@ module.exports = { openAudit(id, activeName) { this.findOne(id) this.activeName = activeName - } + }, + async getModifyConfig() { + const res = await $.post('/platform/theRapyRecuperation/TheRapyConfig/findOne') + if (res.code === 0) { + this.modifyConfig = res.data + } + }, }, - created() { + async created() { + await this.getModifyConfig(); } } diff --git a/src/main/resources/static/components/theRapyRecuperation/XghEnrollInfo.vue b/src/main/resources/static/components/theRapyRecuperation/XghEnrollInfo.vue index 3a5d829..eb0d3a0 100644 --- a/src/main/resources/static/components/theRapyRecuperation/XghEnrollInfo.vue +++ b/src/main/resources/static/components/theRapyRecuperation/XghEnrollInfo.vue @@ -10,7 +10,7 @@

- {{ viewData.loginName }} + {{ viewData.loginName }} {{ viewData.userName }} {{ viewData.sex }} {{ viewData.idCard }} @@ -42,19 +42,22 @@ {{ viewData.isFamily ? '携带' : '未携带' }} - {{ viewData.bedInfo.bedType }} - {{ - viewData.bedInfo.bedNum ? viewData.bedInfo.bedNum : '暂无' - }} - - - {{ viewData.bedInfo.otherSleepUser ? viewData.bedInfo.otherSleepUser : '暂无' }} - +
-
+

同伴信息 @@ -129,6 +132,7 @@ module.exports = { bedInfo: {}, }, loading: false, + modifyConfig:{} } }, methods: { @@ -149,9 +153,16 @@ module.exports = { openAudit(id, activeName) { this.findOne(id) this.activeName = activeName - } + }, + async getModifyConfig() { + const res = await $.post('/platform/theRapyRecuperation/TheRapyConfig/findOne') + if (res.code === 0) { + this.modifyConfig = res.data + } + }, }, - created() { + async created() { + await this.getModifyConfig(); } } diff --git a/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html b/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html index 42f2171..089937c 100644 --- a/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html +++ b/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html @@ -279,9 +279,9 @@ layout("/mobile/platform.html"){

- - + + @@ -335,7 +335,7 @@ layout("/mobile/platform.html"){ - + @@ -346,7 +346,7 @@ layout("/mobile/platform.html"){ - - + - + - + @@ -60,20 +60,11 @@ layout("/mobile/platform.html"){
-
+
-
- - 疗休养报名 - - 我的疗休养 - - -
-
diff --git a/src/main/resources/views/mobile/therapyRecuperation/myRecuperation.html b/src/main/resources/views/mobile/therapyRecuperation/myRecuperation.html index 76628ea..34dec75 100644 --- a/src/main/resources/views/mobile/therapyRecuperation/myRecuperation.html +++ b/src/main/resources/views/mobile/therapyRecuperation/myRecuperation.html @@ -29,7 +29,6 @@ layout("/mobile/platform.html"){ .list-card > .content { padding: 16px 10px 8px; display: flex; - max-height: 100px; } .content-right { @@ -72,21 +71,28 @@ 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; + height: 30px; + font-size: 12px; border-radius: 6px; } + .evaluateVisible .van-button { + height: 30px; + font-size: 12px; + border-radius: 6px; + } + + .van-divider { + margin: 8px 0; + } + .active { background-color: #1867b0; color: white; @@ -172,11 +178,59 @@ layout("/mobile/platform.html"){ margin-left: 4px; } + .evaluateVisible { + width: 100%; + height: 80%; + } + + .title_container { + display: flex; + justify-content: flex-end; + align-items: center; + position: relative; + padding: 9px; + } + + .title { + position: absolute; + left: 0; + right: 0; + margin: auto; + text-align: center; + } + + .content { + padding: 10px 20px; + } + + .line_info { + display: flex; + align-items: center; + } + + .evaluate_item_content { + display: flex; + gap: 20px; + } + + .evaluate_item { + padding: 6px 20px; + border: 1px grey solid; + text-align: center; + border-radius: 10px; + } + + .evaluate_active { + background-color: #07C160; + color: white; + border-color: #07C160; + } +
- @@ -188,7 +242,7 @@ layout("/mobile/platform.html"){
-
+ + + +
@@ -241,7 +303,8 @@ layout("/mobile/platform.html"){ 联系方式:{{o.contactMobileNumber}}
- 随行家属:{{o.companionUserNames ? o.companionUserNames : '无'}} + 随行家属:{{o.companionUserNames ? o.companionUserNames : '无'}} + 随行家属:{{o.familyNumber}}人
审核状态:{{o.stateName}} @@ -295,6 +358,9 @@ layout("/mobile/platform.html"){
+ + 评 价 + @@ -302,21 +368,15 @@ layout("/mobile/platform.html"){ - 取 消 + 撤 销 - 满意度反馈 +
- -
@@ -352,14 +412,45 @@ layout("/mobile/platform.html"){
-
- - 疗休养报名 - - 我的疗休养 - - -
+ +
+ +
+ 您的评价让我们做的更好 +
+ +
+
为本次疗休养打分 +
+
+
满意
+
一般
+
不满意
+
+
+ + +
+
+
+
+ 提交 + +
+
+ diff --git a/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyAudit.html b/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyAudit.html index 2ae5bc9..eb3df43 100644 --- a/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyAudit.html +++ b/src/main/resources/views/platform/theRapyRecuperation/audit/TheRapyAudit.html @@ -143,9 +143,9 @@ layout("/layouts/platform.html"){ style="width: 80%" @change="lineChange(pageForm.takePartInLineId);doSearch()"> + :value="item.selectId"> @@ -259,7 +259,7 @@ layout("/layouts/platform.html"){ @@ -521,18 +485,18 @@ layout("/layouts/platform.html"){ @@ -557,7 +521,13 @@ layout("/layouts/platform.html"){ > @@ -609,7 +579,7 @@ layout("/layouts/platform.html"){ + width="80%"> 关闭 @@ -815,22 +785,22 @@ layout("/layouts/platform.html"){ - + @@ -844,7 +814,7 @@ layout("/layouts/platform.html"){ - + + " + row.userName + "】的此条报名信息吗?", '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - dangerouslyUseHTMLString: true, - type: 'warning', - callback: async (a, b) => { - if ("confirm" === a) {//确认后再执行 - const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doModify/' + row.id) - if (resp.code === 0) { - await this.doSearch() - this.$message.success('调整成功') - } - } - } - }) - }, - async doReimbursement(){ - if (this.multipleSelection && this.multipleSelection.length > 0){ - const enrollIds = this.multipleSelection.filter(v=>v.isTakePartIn).map(v=>v.id) - - let msg = '' - if(enrollIds.length == this.multipleSelection.length){ - msg='您确定要将勾选的报名信息设为已报销吗?' - } else { - msg='已为您忽略未参加的教工信息,您确定要将忽略后的数据设为已报销吗?' - } - - if (!enrollIds || enrollIds.length == 0){ - this.$message.warning('暂无已参加的老师,不能报销') - this.$refs.table.clearSelection(); - return - } - console.log(enrollIds) - this.$confirm(msg, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - dangerouslyUseHTMLString: true, - type: 'warning', - callback: async (a, b) => { - debugger - if ("confirm" === a) {//确认后再执行 - const resp = await $.post('/platform/theRapyRecuperation/user/query/doReimbursement',{data:JSON.stringify(enrollIds)}) - if (resp.code === 0) { - await this.doSearch() - this.$refs.table.clearSelection(); - if (enrollIds.length == this.multipleSelection.length){ - this.$message.success('操作成功') - } else { - this.$message.success('操作成功,已为您过滤未参加人员') - } - } else { - this.$message.warning('操作失败') - } - } - } - }) - } else { - this.$message.warning('请勾选需要报销的报名信息') - } - }, - async lineChange(val) { - this.pageForm.selectId = ''; - const data = this.takePartInLines.find(v => v.id === val) - if (!data) { - return - } - const resp = await $.get('/platform/theRapyRecuperation/TheRapyXghAudit/getLinePlayTimeByLineId', { - lineId: data.id, - year: this.pageForm.year, - signUpMode: 1, - }) - if (resp.code === 0) { - this.linePlayTimes = resp.data - } - }, async validateLine() { const resp = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo' , {enroll: JSON.stringify(this.editFormData)}) @@ -1099,12 +992,6 @@ layout("/layouts/platform.html"){ } }) }, - async doSearch() { - this.pageForm.pageNumber = 1; - this.pageData(); - await this.getApplyNumAudit() - await this.getXlByUnion() - }, async doEdit() { this.$refs['editForm'].validate().then(async () => { const confirm = await this.$confirm('您确定要修改这位老师的报名信息吗?', '提示', { @@ -1284,61 +1171,26 @@ layout("/layouts/platform.html"){ }, doExport() { const { - searchName, year, + searchName, searchKeyword, unionId, + unitId, agencyId, - specificTime, takePartInLineId, state, lotId, - linePlayTime, } = this.pageForm - let types = this.pageForm.state == 1 ? JSON.stringify(['line']) : JSON.stringify(['travel']) - window.open("/platform/theRapyRecuperation/user/query/doExport?" + - "searchName=" + searchName + - "&searchKeyword=" + searchKeyword + - "&startYear=" + year + - "&endYear=" + year + + window.open(loc() + "/doExport?year=" + year + + "&searchName=" + searchName + + "&searchKeyword" + searchKeyword + "&unionId=" + unionId + + "&unitId=" + unitId + "&agencyId=" + agencyId + - "&specificTime=" + specificTime + "&takePartInLineId=" + takePartInLineId + "&state=" + state + - "&lotId=" + lotId + - "&satisfyPeople=false" + - "&types=" + types + - "&linePlayTime=" + linePlayTime) - }, - doExportExcel() { - const { - searchName, - year, - searchKeyword, - unionId, - agencyId, - specificTime, - takePartInLineId, - state, - lotId, - linePlayTime, - } = this.pageForm - let types = this.pageForm.state == 1 ? JSON.stringify(['line']) : JSON.stringify(['travel']) - window.open("/platform/theRapyRecuperation/user/query/doExportExcel?" + - "searchName=" + searchName + - "&searchKeyword=" + searchKeyword + - "&startYear=" + year + - "&endYear=" + year + - "&unionId=" + unionId + - "&agencyId=" + agencyId + - "&specificTime=" + specificTime + - "&takePartInLineId=" + takePartInLineId + - "&state=" + state + - "&lotId=" + lotId + - "&satisfyPeople=false" + - "&types=" + types + - "&linePlayTime=" + linePlayTime) + "&lotId=" + lotId) + }, pageSizeChange(val) { this.pageForm.pageNumber = val; @@ -1380,9 +1232,10 @@ layout("/layouts/platform.html"){ }, async openApplyUser(row) { + debugger sublime.showLoadingbar(); const pageForm = clone(this.pageFormUser) - pageForm.id = row.id + pageForm.id = this.pageForm.state === '1' ? row.selectId : row.id pageForm.unionId = this.unionId let url = this.pageForm.state === '1' ? '/platform/theRapyRecuperation/line/selectLineUser' : '/platform/theRapyRecuperation/query/selectAgencyUser' $.post(url, pageForm, (data) => { @@ -1449,13 +1302,11 @@ layout("/layouts/platform.html"){ {prop: 'userName', label: '姓名'}, {prop: 'unitName', label: '单位', sortable: true}, {prop: 'unionName', label: '工会', sortable: true}, - {prop: 'lineOrMaName', label: '线路/旅行社', sortable: true}, - //{prop: 'travelAgencyName', label: '旅行社', sortable: true}, + {prop: 'lineOrMaName', label: '线路/酒店', sortable: true}, {prop: 'times', label: '出行时间'}, {prop: 'regionalNature', label: '线路类型', sortable: true}, {prop: 'isFamily', label: '是否携带家属'}, {prop: 'isTakePartIn', label: '是否参加'}, - //{prop: 'reimbursementStatus', label: '是否报销'}, // {prop: 'stateId', label: '审核状态'}, ] this.getSelfUnionUser() @@ -1478,11 +1329,11 @@ layout("/layouts/platform.html"){ this.tableColumns = [ {label: '年度', prop: 'year'}, {label: '旅行社名称', prop: 'travelAgencyName', sortable: true}, - //{label: '旅行社编号', prop: 'serialNumber', sortable: true}, + {label: '旅行社编号', prop: 'serialNumber', sortable: true}, {label: '联系人', prop: 'contact'}, {label: '联系人手机', prop: 'contactMobileNumber'}, {label: '邮箱', prop: 'email'}, - //{label: '官网', prop: 'officialWebsite'}, + {label: '官网', prop: 'officialWebsite'}, {label: '报名人数', prop: 'agencyNum', sortable: true}, ] this.getLxsData() @@ -1491,7 +1342,7 @@ layout("/layouts/platform.html"){ this.tableColumns = [ {label: '年度', prop: 'year'}, {label: '酒店名称', prop: 'baseName', sortable: true}, - //{label: '酒店编号', prop: 'serialNumber', sortable: true}, + // {label: '酒店编号', prop: 'serialNumber', sortable: true}, {label: '联系人', prop: 'baseContactPerson'}, {label: '联系人手机', prop: 'baseContactNumber'}, {label: '承担旅行社', prop: 'travelAgencyName', sortable: true}, @@ -1502,33 +1353,17 @@ layout("/layouts/platform.html"){ this.getJdData() await this.getJdList() } else { - if(this.pageForm.state == '2') { - this.tableColumns = [ - {prop: 'loginName', label: '一卡通号'}, - {prop: 'userName', label: '姓名'}, - {prop: 'unitName', label: '单位', sortable: true}, - {prop: 'unionName', label: '工会', sortable: true}, - {prop: 'travelAgencyName', label: '旅行社'}, - {prop: 'isFamily', label: '是否携带家属'}, - {prop: 'isTakePartIn', label: '是否参加'}, - {prop: 'reimbursementStatus', label: '是否报销'}, - //{prop: 'stateId', label: '审核状态'}, - ] - } else { - this.tableColumns = [ - {prop: 'loginName', label: '一卡通号'}, - {prop: 'userName', label: '姓名'}, - {prop: 'unitName', label: '单位', sortable: true}, - {prop: 'unionName', label: '工会', sortable: true}, - {prop: 'lineOrMaName', label: '线路/酒店'}, - {prop: 'times', label: '出行时间'}, - {prop: 'isFamily', label: '是否携带家属'}, - {prop: 'isTakePartIn', label: '是否参加'}, - //{prop: 'reimbursementStatus', label: '是否报销'}, - //{prop: 'stateId', label: '审核状态'}, - ] - } - + this.tableColumns = [ + {prop: 'loginName', label: '一卡通号'}, + {prop: 'userName', label: '姓名'}, + {prop: 'unitName', label: '单位', sortable: true}, + {prop: 'unionName', label: '工会', sortable: true}, + {prop: 'lineOrMaName', label: '线路/酒店'}, + {prop: 'times', label: '出行时间'}, + {prop: 'isFamily', label: '是否携带家属'}, + {prop: 'isTakePartIn', label: '是否参加'}, + // {prop: 'stateId', label: '审核状态'}, + ] await this.getRyData() } await this.getApplyNum() @@ -1550,6 +1385,11 @@ layout("/layouts/platform.html"){ year: this.pageForm.year, state: this.pageForm.state2 }) + data.forEach(v => { + if (!v.unionname) { + v.unionname = '校工会' + } + }) this.takePartInLines = data }, async getAgencyList() { @@ -1637,8 +1477,7 @@ layout("/layouts/platform.html"){ state2: this.pageForm.state2, regionalNature: this.pageForm.regionalNature, takePartInLineId: this.pageForm.takePartInLineId, - year: this.pageForm.year, - selectId: this.pageForm.selectId + year: this.pageForm.year }) this.applyNum = data }, @@ -1651,9 +1490,10 @@ layout("/layouts/platform.html"){ this.options2 = [ {label: "本工会人员(自己线路)" + data.count1 + "人", value: "1"}, {label: "本工会人员(其他路线)" + data.count2 + "人", value: "2"}, - {label: "其他工会人员(选我线路)" + data.count3 + "人", value: "3"}, + // {label: "其他工会人员(选我线路)" + data.count3 + "人", value: "3"}, {label: "选择校工会线路人员" + data.count4 + "人", value: "4"} ] + }, async getModifyConfig() { const res = await $.post('/platform/theRapyRecuperation/TheRapyConfig/findOne') @@ -1707,7 +1547,7 @@ layout("/layouts/platform.html"){ this.signUpModeList = await getEnumOptions('TheRapyRecuperationSignUpMode') this.unionOptions = await getUnions() await this.getApplyNumAudit() - if ("${@shiro.hasRole('H04')}" === 'true' && "${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}" === 'false') { + if ("${@shiro.hasRole('H04')}" === 'true' && "${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')}" === 'false') { await this.getBmUserUnion() if (this.unionOptions && this.unionOptions.length > 0) { const union = this.unionOptions.find(v => v.id === this.unionId) diff --git a/src/main/resources/views/platform/theRapyRecuperation/process/TheRapyUserQuery.html b/src/main/resources/views/platform/theRapyRecuperation/process/TheRapyUserQuery.html index a7c6316..f22da24 100644 --- a/src/main/resources/views/platform/theRapyRecuperation/process/TheRapyUserQuery.html +++ b/src/main/resources/views/platform/theRapyRecuperation/process/TheRapyUserQuery.html @@ -47,7 +47,7 @@ layout("/layouts/platform.html"){ type="year" value-format="yyyy" placeholder="选择年" - style="width: 38%" @change="getUnionSelectLine(); doSearch()"> + style="width: 38%" @change="doSearch"> + style="width: 38%" @change="doSearch"> @@ -217,23 +217,18 @@ layout("/layouts/platform.html"){ @@ -313,6 +301,7 @@ layout("/layouts/platform.html"){ + + + + - + @@ -586,8 +578,8 @@ layout("/layouts/platform.html"){ options: [ {label: "线路", value: "1"}, - {label: "旅行社", value: "2"}, - // {label: "酒店", value: "3"}, + // {label: "旅行社", value: "2"}, + {label: "酒店", value: "3"}, ], agencyLists: [], unionOptions: [], @@ -606,7 +598,6 @@ layout("/layouts/platform.html"){ {prop: 'isFamily', label: '是否携带家属'}, {prop: 'signingUptime', label: '报名时间', checked: 0}, {prop: 'isTakePartIn', label: '是否参加'}, - {prop: 'reimbursementStatus', label: '是否报销'}, {prop: 'takePartInTime', label: '参加时间', checked: 0}, ], pageForm: { @@ -618,8 +609,8 @@ layout("/layouts/platform.html"){ state: '1', regionalNature: '', signUpMode: '', - lotId: '', - takePartInLineId: '', + lotId:'', + takePartInLineId:'', }, multipleSelection: [], multipleSelection2: [], @@ -648,10 +639,7 @@ layout("/layouts/platform.html"){ labelName: '', unionSelectLines: [], lineLabelName: '', - activeNames: [], - - title:'', - dialogVisible:false, + activeNames:[] } }, components: { @@ -659,67 +647,6 @@ layout("/layouts/platform.html"){ 'line-info': httpVueLoader('/components/theRapyRecuperation/LineInfo.vue') }, methods: { - async doReimbursement(){ - if (this.multipleSelection && this.multipleSelection.length > 0){ - const enrollIds = this.multipleSelection.filter(v=>v.isTakePartIn).map(v=>v.id) - - let msg = '' - if(enrollIds.length == this.multipleSelection.length){ - msg='您确定要将勾选的报名信息设为已报销吗?' - } else { - msg='已为您忽略未参加的教工信息,您确定要将忽略后的数据设为已报销吗?' - } - - if (!enrollIds || enrollIds.length == 0){ - this.$message.warning('暂无已参加的老师,不能报销') - this.$refs.table.clearSelection(); - return - } - console.log(enrollIds) - this.$confirm(msg, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - dangerouslyUseHTMLString: true, - type: 'warning', - callback: async (a, b) => { - debugger - if ("confirm" === a) {//确认后再执行 - const resp = await $.post(loc() + '/doReimbursement',{data:JSON.stringify(enrollIds)}) - if (resp.code === 0) { - await this.doSearch() - this.$refs.table.clearSelection(); - if (enrollIds.length == this.multipleSelection.length){ - this.$message.success('操作成功') - } else { - this.$message.success('操作成功,已为您过滤未参加人员') - } - } else { - this.$message.warning('操作失败') - } - } - } - }) - } else { - this.$message.warning('请勾选需要报销的报名信息') - } - }, - doModify(row){ - this.$confirm("您确定要调整【" + row.userName + "】的此条报名信息吗?", '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - dangerouslyUseHTMLString: true, - type: 'warning', - callback: async (a, b) => { - if ("confirm" === a) {//确认后再执行 - const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doModify/' + row.id) - if (resp.code === 0) { - await this.doSearch() - this.$message.success('调整成功') - } - } - } - }) - }, doExport() { const { takePartInBaseManagementId, @@ -736,7 +663,6 @@ layout("/layouts/platform.html"){ lotId, linePlayTime, } = this.pageForm - let types = this.pageForm.state == 1 ? JSON.stringify(['line']) : JSON.stringify(['travel']) window.open(loc() + "/doExport?takePartInBaseManagementId=" + takePartInBaseManagementId + "&searchName=" + searchName + "&searchKeyword=" + searchKeyword + @@ -749,9 +675,8 @@ layout("/layouts/platform.html"){ "&takePartInLineId=" + takePartInLineId + "&state=" + state + "&lotId=" + lotId + - "&satisfyPeople=false" + - "&types=" + types + "&linePlayTime=" + linePlayTime) + }, async validateLine() { const resp = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo' @@ -785,7 +710,6 @@ layout("/layouts/platform.html"){ }) }, async openEdit(row) { - this.getUnionSelectLine(row.takePartInLineId) this.editFormData = {}; const resp = await $.get("/platform/theRapyRecuperation/TheRapyAudit/findOne", {id: row.id}) if (resp.code === 0) { @@ -940,38 +864,6 @@ layout("/layouts/platform.html"){ this.pageData() await this.getXlLxsUserCount() this.takePartInLines = await this.getXlByUnion() - - if (this.pageForm.state == '2') { - this.tableColumns = [ - {prop: 'loginName', label: '一卡通号'}, - {prop: 'userName', label: '姓名'}, - {prop: 'unitName', label: '单位', sortable: true}, - {prop: 'unionName', label: '工会', sortable: true}, - {prop: 'travelAgencyName', label: '旅行社'}, - {prop: 'isFamily', label: '是否携带家属'}, - {prop: 'signingUptime', label: '报名时间', checked: 0}, - {prop: 'isTakePartIn', label: '是否参加'}, - {prop: 'reimbursementStatus', label: '是否报销'}, - {prop: 'takePartInTime', label: '参加时间', checked: 0}, - ] - } else { - this.tableColumns = [ - {prop: 'loginName', label: '一卡通号'}, - {prop: 'userName', label: '姓名'}, - {prop: 'unitName', label: '单位', sortable: true}, - {prop: 'unionName', label: '工会', sortable: true}, - // {prop: 'travelAgencyName', label: '旅行社'}, - {prop: 'lineName', label: '线路/酒店'}, - {prop: 'playStartTime', label: '出行时间'}, - {prop: 'regionalNature', label: '线路类型'}, - {prop: 'lotName', label: '标段'}, - {prop: 'isFamily', label: '是否携带家属'}, - {prop: 'signingUptime', label: '报名时间', checked: 0}, - {prop: 'isTakePartIn', label: '是否参加'}, - {prop: 'reimbursementStatus', label: '是否报销'}, - {prop: 'takePartInTime', label: '参加时间', checked: 0}, - ] - } }, async getLines() { const {data} = await $.post("/platform/theRapyRecuperation/travelAgency/selectLineByAgencyId", { @@ -1016,7 +908,7 @@ layout("/layouts/platform.html"){ }, async flushUnits() { this.$set(this.pageForm, "unitId", "") - if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') { + if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')||@shiro.hasRole('H03')}" === 'true') { this.unitOptions = await getUnits(this.pageForm.unionId) } else { this.unionOptions = this.unionOptions.filter(v => v.id === "${@shiro.getPrincipalProperty('unit').getUnionid()}") @@ -1090,12 +982,8 @@ layout("/layouts/platform.html"){ this.importVisible = false; this.pageData(); }, - async getUnionSelectLine(disPlayUnionSelectId = null) { - const resp = await $.post('/platform/theRapyRecuperation/user/query/getUnionSelectLine', { - startYear: this.pageForm.startYear, - endYear: this.pageForm.endYear, - disPlayUnionSelectId: disPlayUnionSelectId - }) + async getUnionSelectLine() { + const resp = await $.post('/platform/theRapyRecuperation/user/query/getUnionSelectLine') if (resp.code === 0) { this.unionSelectLines = resp.data } diff --git a/src/main/resources/views/platform/theRapyRecuperation/process/lineAdjustment.html b/src/main/resources/views/platform/theRapyRecuperation/process/lineAdjustment.html index 7256b64..aa8dcf7 100644 --- a/src/main/resources/views/platform/theRapyRecuperation/process/lineAdjustment.html +++ b/src/main/resources/views/platform/theRapyRecuperation/process/lineAdjustment.html @@ -59,7 +59,7 @@ layout("/layouts/platform.html"){
-
+
分工会:
-
+
分工会:
@@ -49,7 +56,7 @@ layout("/layouts/platform.html"){ + v-for="item in travelAgencyOptions">
@@ -59,10 +66,9 @@ layout("/layouts/platform.html"){
+ border v-for="item in regionalNatureList"> {{item.label}} @@ -80,7 +86,7 @@ layout("/layouts/platform.html"){
-
+
分工会:
@@ -117,13 +123,12 @@ layout("/layouts/platform.html"){ + width="80%" top="2%">

{{formData.lineName}}

@@ -365,24 +349,6 @@ layout("/layouts/platform.html"){ - - - - - - - - + + + + @@ -316,35 +351,37 @@ layout("/layouts/platform.html"){ {prop: 'lineName', label: '线路名称', sortable: true, width: 200}, {prop: 'linePlayTime', label: '出行时间', width: 180}, {prop: 'travelAgencyName', label: '承担旅行社', sortable: true, width: 180}, - {prop: 'unionname', label: '选择线路工会', sortable: true}, + {prop: 'signUpMode', label: '组织形式', sortable: true}, {prop: 'regionalNature', label: '线路类型', sortable: true}, - {prop: 'contact', label: '联系人', sortable: true, checked: 0}, - {prop: 'contactMobileNumber', label: '联系方式', checked: 0}, + {prop: 'username', label: '发起人', sortable: true}, + {prop: 'unionname', label: '所属工会', sortable: true}, {prop: 'estimatedFamilyNumbers', label: '最少成团人数', width: 80}, {prop: 'lineNum', label: '报名人数(家属)'}, + {prop: 'stateName', label: '审核状态'}, ], modifyConfig: {}, lineList: [], unions: [], - units:[], + units: [], signUpModeOptions: [ {label: '校工会组织', value: 2}, {label: '分工会组织', value: 1}, ], - userPageForm:{ - pageNumber:1, + userPageForm: { + pageNumber: 1, pageSize: 10 }, - userData:[], - userDataTableColumns:[ + userData: [], + userDataTableColumns: [ {prop: 'loginName', label: '工号'}, {prop: 'userName', label: '姓名'}, {prop: 'unionName', label: '所属工会'}, {prop: 'unitName', label: '所属单位', sortable: true}, {prop: 'isFamily', label: '是否携带家属'}, - {prop: 'linePlayTime', label: '出行时间', sortable: true} + {prop: 'linePlayTime', label: '出行时间', sortable: true}, + {prop: 'sign', label: '签字'} ], lineUId: '', @@ -356,9 +393,25 @@ layout("/layouts/platform.html"){ }, components: { 'enroll-info': httpVueLoader('/components/theRapyRecuperation/Enrollinfo.vue?v=1.0.1'), + 'line-audit-info': httpVueLoader('/components/theRapyRecuperation/LineAuditInfo.vue?v=' + new Date().getTime()), 'line-info': httpVueLoader('/components/theRapyRecuperation/LineInfo.vue') }, methods: { + deleteJoinUser(row) { + this.$confirm('您确定要删除' + row.userName + '的报名信息吗', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + dangerouslyUseHTMLString: true + }).then(async () => { + const resp = await $.post('/platform/theRapyRecuperation/statistics/deleteJoinUser', {id: row.id}) + if (resp.code === 0) { + this.$message.success(resp.msg) + } else { + this.$message.warning(resp.msg) + } + }) + }, doExport() { const { startYear, @@ -375,6 +428,7 @@ layout("/layouts/platform.html"){ "&unionId=" + unionId + "&takePartInLineId=" + takePartInLineId + "&lotId=" + lotId + + "&state=" + 1 + "®ionalNature=" + regionalNature + "&satisfyPeople=true" + "&types=" + JSON.stringify(['line']) + @@ -404,15 +458,23 @@ layout("/layouts/platform.html"){ this.getUnionSelectLine() this.doSearch() }, - async sendSuccess(row) { - this.$confirm("确定发送成团通知吗?", '提示', { + async sendSuccess(row, type) { + let message = '确定要成团吗?' + if (type) { + message += "此操作将会发送通知,请再次确认!"; + } + this.$confirm(message, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', dangerouslyUseHTMLString: true }).then(async () => { - const resp = await $.post('/platform/theRapyRecuperation/statistics/sendSuccess', {id: row.lineUId}) + const resp = await $.post('/platform/theRapyRecuperation/statistics/sendSuccess', { + id: row.lineUId, + type: type + }) if (resp.code === 0) { + this.doSearch() this.$message.success(resp.msg) } else { this.$message.warning(resp.msg) @@ -426,7 +488,10 @@ layout("/layouts/platform.html"){ type: 'warning', dangerouslyUseHTMLString: true }).then(async () => { - const resp = await $.post('/platform/theRapyRecuperation/statistics/sendFail', {id: row.lineUId, type: type}) + const resp = await $.post('/platform/theRapyRecuperation/statistics/sendFail', { + id: row.lineUId, + type: type + }) if (resp.code === 0) { this.$message.success(resp.msg) } else { @@ -436,14 +501,15 @@ layout("/layouts/platform.html"){ }, openLine(row) { this.$refs.guava.public() - if (row.regionalNature === "省内") { + this.$refs.lineAuditViewInfo.init(row) + /*if (row.regionalNature === "省内") { this.$refs.viewLineInfo.findOne(row.lineId, null) } else { this.$refs.viewLineInfo.findOne(row.lineId, row.usUnionId) - } + }*/ }, - openUserData(row){ + openUserData(row) { this.lineUId = row.lineUId this.$refs.guava.edit(); this.getUserDataByLineId(row) @@ -468,7 +534,7 @@ layout("/layouts/platform.html"){ }, async flushUnits() { this.$set(this.userData, "unitId", "") - if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('SchoolUnionMemberAdmin')}" === 'true') { + if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')||@shiro.hasRole('SchoolUnionMemberAdmin')}" === 'true') { this.units = await getUnits(this.userData.unionId) } else { this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}") @@ -482,10 +548,10 @@ layout("/layouts/platform.html"){ this.userPageForm.pageNumber = val; this.getUserDataByLineId(); }, - async getUserDataByLineId(row){ + async getUserDataByLineId(row) { this.userPageForm.takePartLineId = this.lineUId - const resp = await $.post(loc() + '/getUserDateByLine',this.userPageForm) - if (resp.code === 0){ + const resp = await $.post(loc() + '/getUserDateByLine', this.userPageForm) + if (resp.code === 0) { this.userData = resp.data.list this.userPageForm.totalCount = resp.data.totalCount } diff --git a/src/main/resources/views/platform/theRapyRecuperation/summary/evaluateStatistics.html b/src/main/resources/views/platform/theRapyRecuperation/summary/evaluateStatistics.html new file mode 100644 index 0000000..39758e0 --- /dev/null +++ b/src/main/resources/views/platform/theRapyRecuperation/summary/evaluateStatistics.html @@ -0,0 +1,268 @@ + + +
+ + + + + + + + + {{viewData.evaluateScore}} + + + + {{viewData.evaluateText}} + + + + 关 闭 + + +
+ + + + + + diff --git a/src/main/resources/views/platform/theRapyRecuperation/theRapyConfig/TheRapyConfig.html b/src/main/resources/views/platform/theRapyRecuperation/theRapyConfig/TheRapyConfig.html index af41eb0..6073e4d 100644 --- a/src/main/resources/views/platform/theRapyRecuperation/theRapyConfig/TheRapyConfig.html +++ b/src/main/resources/views/platform/theRapyRecuperation/theRapyConfig/TheRapyConfig.html @@ -50,17 +50,17 @@ layout("/layouts/platform.html"){
- + + placeholder="请输入每条省外线路最多成团人数"> - + @@ -70,22 +70,22 @@ layout("/layouts/platform.html"){ - - + - + - - - 需要 - 不需要 - - - + + + + const vue = new Vue({ el: '#app', - data() { return { activityGroupList: [], @@ -246,7 +245,6 @@ layout("/layouts/platform.html"){ formData: { isSnLine: 0, isSwLine: 0, - travelAudit: 0, lots: [], configName: '智慧工会疗休养配置', outsideQuota: null, @@ -266,10 +264,9 @@ layout("/layouts/platform.html"){ configName: [{required: true, message: '请填写配置名称', trigger: ['blur', 'change']}], isSnLine: [{required: true, message: '请选择省内线路是否需要审核', trigger: ['blur', 'change']}], isSwLine: [{required: true, message: '请选择省外线路是否需要审核', trigger: ['blur', 'change']}], - travelAudit: [{required: true, message: '请选择旅行社是否需要审核', trigger: ['blur', 'change']}], outsideQuota: [{ required: true, - message: '省外最少成团人数(包括家属)', + message: '请输入每条省外线路最多成团人数', trigger: ['blur', 'change'] }], outsideNumber: [{ @@ -323,7 +320,7 @@ layout("/layouts/platform.html"){ } }, components: { - 'drawer-user-scope': httpVueLoader('/components/plugins/DrawerUserScope.vue'), + 'drawer-user-scope': httpVueLoader('/components/plugins/DrawerUserScope.vue?v=1.0.1'), }, methods: { async deleteLotsRow(scope) { @@ -368,6 +365,9 @@ layout("/layouts/platform.html"){ }) const cloneData = clone(this.formData) + if (this.formData.files && this.formData.files.length > 0) { + cloneData.files = JSON.stringify(this.formData.files) + } if (this.lotDeleteList && this.lotDeleteList.length > 0) { cloneData.lotDeleteList = JSON.stringify(this.lotDeleteList) } @@ -396,24 +396,11 @@ layout("/layouts/platform.html"){ data.lots = [] } this.formData = data - this.initLineContentEditor(data.notice) }, async getActivityGroup() { const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup') this.activityGroupList = data }, - initLineContentEditor(content) { - $("#lineContent").html("") - lineContentEditor = new wangEditor("#lineContent") - lineContentEditor.config.onchange = (html) => { - this.formData.notice = html.replace(/<\/p>/g, '') - } - lineContentEditor.config.uploadImgShowBase64 = true - lineContentEditor.create() - if (content) { - lineContentEditor.txt.html(content) - } - }, async closeDialog() { this.tableScopeIndex = ''; this.tableScopeId = ''; @@ -441,7 +428,6 @@ layout("/layouts/platform.html"){ }, async created() { this.findOne(); - this.initLineContentEditor(); }, watch: { 'formData.activityGroupId': {