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 53e7d52..0a024b6 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 @@ -21,6 +21,7 @@ import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.service.BaseService; 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.web.commons.utils.ShiroUtil; import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState; import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyRecuperationEnrollExcelMode; @@ -337,10 +338,6 @@ public class TheRapyRecuperationUserQueryController { @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)); @@ -359,8 +356,10 @@ public class TheRapyRecuperationUserQueryController { line.lineName, enroll.*, date_format( enroll.signingUptime, '%Y-%m-%d %H:%i:%s' ) signingUptimeFormat, - date_format( lineu.playStartTime, '%Y-%m-%d' ) playStartTime, + date_format( lineu.playStartTime, '%m-%d' ) playStartTime, + date_format( lineu.playEndTime, '%m-%d' ) playEndTime, lineu.lineId, + TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) as age, ( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) familyCount, ( SELECT @@ -399,7 +398,39 @@ public class TheRapyRecuperationUserQueryController { lineSql.setCondition(lineCnd); List lineEnroll = baseService.listMap(lineSql); - if (satisfyPeople) { + List lineResult = new ArrayList<>(); + //查家属 + List list = lineEnroll.stream().map(o -> o.getString("id")).toList(); + List companions = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", list)); + int index = 0; + for (int i = 0; i < lineEnroll.size(); i++) { + NutMap nutMap = lineEnroll.get(i); + if(i == 0) { + index = 1; + } + nutMap.put("index", index); + nutMap.put("playTime", nutMap.getString("playStartTime") + "至" + nutMap.getString("playEndTime")); + lineResult.add(nutMap); + //找这个人的家属 + List companionList = companions.stream().filter(o -> o.getTrreId().equals(nutMap.getString("id"))).toList(); + if(Lang.isNotEmpty(companionList)) { + for (int c = 1; c <= companionList.size(); c++) { + NutMap map = Lang.obj2nutmap(companionList.get(c - 1)); + map.put("index", c + index); + map.put("unionName", "家属"); + map.put("familyUserName", map.getString("userName")); + map.put("lineName", nutMap.getString("lineName")); + map.put("playTime", nutMap.getString("playTime")); + map.put("userName", ""); + lineResult.add(map); + } + index += companionList.size() + 1; + } else { + index ++; + } + } + + /*if (satisfyPeople) { //按照选择线路id分组,便于判断是否成团 Map> enrollGroup = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInLineId"))); @@ -416,7 +447,7 @@ public class TheRapyRecuperationUserQueryController { 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)); + Map lineMap = lineList.stream().collect(Collectors.toMap(TheRapyRecuperationLine::getId, TheRapyRecuperationLine::getLineName));*/ //定点的查询 Sql travelSql = Sqls.create(""" @@ -459,14 +490,21 @@ public class TheRapyRecuperationUserQueryController { commonEntities.add(entity); //线路表头 - ArrayList lineEntities = new ArrayList<>(commonEntities); - lineEntities.add(new ExcelExportEntity("出行时间", "playStartTime", 20)); + ArrayList lineEntities = new ArrayList<>(); + lineEntities.add(new ExcelExportEntity("序号", "index", 10)); + lineEntities.add(new ExcelExportEntity("二级分工会", "unionName", 30)); + lineEntities.add(new ExcelExportEntity("姓名", "userName", 10)); + lineEntities.add(new ExcelExportEntity("家属姓名", "familyUserName", 10)); + lineEntities.add(new ExcelExportEntity("手机号", "mobile", 15)); + lineEntities.add(new ExcelExportEntity("性别", "sex", 10)); + lineEntities.add(new ExcelExportEntity("身份证号码", "idCard", 30)); + lineEntities.add(new ExcelExportEntity("年龄", "age", 10)); + lineEntities.add(new ExcelExportEntity("身高(cm)", "height", 10)); lineEntities.add(new ExcelExportEntity("线路名称", "lineName", 20)); - lineEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20)); - lineEntities.add(new ExcelExportEntity("随行人数", "familyCount", 20)); - ExcelExportEntity lineEntity = new ExcelExportEntity("随行人信息", "companionInfo", 50); - lineEntity.setWrap(true); - lineEntities.add(lineEntity); + lineEntities.add(new ExcelExportEntity("行程", "playTime", 20)); + lineEntities.add(new ExcelExportEntity("房间需求数", "roomCount", 20)); + lineEntities.add(new ExcelExportEntity("用房备注", "roomRemarkName", 30)); + lineEntities.add(new ExcelExportEntity("其他", "other", 20)); //自由组团表头 ArrayList travelEntities = new ArrayList<>(commonEntities); @@ -478,23 +516,16 @@ public class TheRapyRecuperationUserQueryController { 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(); - } + ViTool.excelResponse(response, "线路报名人员.xls"); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.HSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, lineResult); + workbook.write(response.getOutputStream()); } if(Arrays.asList(types).contains("base")) { + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + + URLEncoder.encode("疗休养报名人员名单.zip", StandardCharsets.UTF_8)); for (String key : travelGroupMap.keySet()) { List enrollList = travelGroupMap.get(key); enrollList.forEach(item -> { 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 5317f3f..da02220 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 @@ -212,5 +212,30 @@ public class TheRapyRecuperationEnroll extends BaseModel { @Comment("出行时间") private String specificTime; + @Column + @ColDefine(type = ColType.DOUBLE) + @Comment("房间数量") + private Double roomCount; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("房间数量显示") + private String roomCountName; + + @Column + @ColDefine(type = ColType.INT) + @Comment("用房备注") + private Integer roomRemark; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("用房备注") + private String roomRemarkName; + + @Column + @ColDefine(type = ColType.VARCHAR, width = 50) + @Comment("拼房人") + private String roommate; + private String firstLetter; } diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java index 9d6386a..e96bda1 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationEnrollCompanion.java @@ -70,6 +70,11 @@ public class TheRapyRecuperationEnrollCompanion extends BaseModel { @Comment("床位信息id") private String bedInfoId; + @Column + @ColDefine(type = ColType.VARCHAR, width = 32) + @Comment("身高") + private String height; + /** * 床位信息 */ 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 b1608b5..c9045d7 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 @@ -841,6 +841,14 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl roomValid = validRoom(enrollInfo); + if(roomValid != null && roomValid.containsKey(false)) { + return roomValid; + } + } + TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { @@ -1051,7 +1059,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl companionList = enrollInfo.getCompanionList(); - int applyNum = 1; + int applyNum = StrUtil.isNotBlank(enrollInfo.getId()) ? 0 : 1; if (Lang.isNotEmpty(companionList)) { applyNum = applyNum + companionList.size(); } @@ -1061,7 +1069,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl validRoom(TheRapyRecuperationEnroll enrollInfo) { + + return null; + } + public Map validSignCount(TheRapyRecuperationEnroll enrollInfo, TheRapyRecuperationConfig config, int estimatedFamilyNumbers, String type) { int hasSignNumber = 0;//已经报名的人数 int currentSignNumber = 1;//当前报名人数,1表示自己,下面的if是加家属人数 diff --git a/src/main/resources/views/mobile/therapyRecuperation/lineInfo.html b/src/main/resources/views/mobile/therapyRecuperation/lineInfo.html index a7f24cd..b2fc7fd 100644 --- a/src/main/resources/views/mobile/therapyRecuperation/lineInfo.html +++ b/src/main/resources/views/mobile/therapyRecuperation/lineInfo.html @@ -96,11 +96,15 @@ layout("/mobile/platform.html"){ } .join_content { - padding: 20px; + padding: 10px 20px; height: calc(100% - 26px - 60px); overflow-y: auto; } + .join_content .van-cell { + padding: 6px 16px; + } + .join_submit { width: 90% !important; } @@ -114,7 +118,7 @@ layout("/mobile/platform.html"){ } .van-card-header { - padding: 14px 20px; + padding: 10px 20px; border-bottom: 1px solid #ebeef5; box-sizing: border-box; color: #0e78c5; @@ -218,6 +222,17 @@ layout("/mobile/platform.html"){ table { width: 100% } + .van-notice-bar { + height: 26px; + padding: 0 20px; + font-size: 13px; + } + .van-notice-bar__wrap { + font-size: 13px; + } + .van-field__label { + width: 5.2em; + } @@ -369,13 +384,15 @@ layout("/mobile/platform.html"){
删除随行人 添加随行人 + color="#1867b0">添加随行人
@@ -441,20 +451,30 @@ layout("/mobile/platform.html"){ -
- 房间信息 + 房间数量
- - + +
+
+ +
+
+
+ 用房备注 +
+
+ +
@@ -473,8 +493,18 @@ layout("/mobile/platform.html"){ + value-key="label" + @confirm="(val) => {formData.roomCountName = val.label;formData.roomCount = val.value;roomVisible=false}" + @cancel="() => {formData.roomCountName = '';formData.roomCount = '';roomVisible=false}"> + + + + @@ -514,10 +544,25 @@ layout("/mobile/platform.html"){ mixins: [mobileMixins], data() { return { + roomRemarkVisible: false, isPdf: false, isLoad: false, active: 0, - roomColumns: ['0.5间(一张床)', "1间(两张床)}", '1.5间(三张床)', '2间(四张床)'], + basicRoomColumns: [ + {label: '0.5间(一张床)', value: 0.5}, + {label: '1间(两张床)', value: 1}, + {label: '1.5间(三张床)', value: 1.5}, + {label: '2间(四张床)', value: 2}, + ], + roomColumns: [], + basicRoomRemarkColumns: [ + {label: '携带家属,包1间房', value: 1}, + {label: '已与其他老师自由组合共住1间房', value: 2}, + {label: '1人包房1间,额外支付单房差', value: 3}, + {label: '正常报名', value: 4}, + {label: '随机拼房', value: 5}, + ], + roomRemarkColumns: [], bedColumns: ['1', '2'], companionColumns: ['配偶', '子女', '亲属', '其他'], bedVisible: false, @@ -538,6 +583,7 @@ layout("/mobile/platform.html"){ takePartInUnionId: '', companionList: [], bedInfo: {}, + roomCount: null, }, self: true, btnFlag: false, @@ -552,6 +598,23 @@ layout("/mobile/platform.html"){ } }, methods: { + roomRemarkClick() { + if(!this.formData.roomCount) { + this.$toast('请先选择房间数量') + return + } + this.self = true + this.roomRemarkVisible = true + }, + needBedChange() { + this.clearContent() + }, + clearContent() { + this.$set(this.formData, 'roomCount', '') + this.$set(this.formData, 'roomCountName', '') + this.$set(this.formData, 'roomRemark', '') + this.$set(this.formData, 'roomRemarkName', '') + }, getAgeAndSex(item){ try { const value = item.idCard @@ -601,7 +664,7 @@ layout("/mobile/platform.html"){ for (let i = 0; i < cloneData.companionList.length; i++) { const companion = cloneData.companionList[i]; // 检查每个字段是否为空 - if (!companion.userName || !companion.idCard || !companion.mobile || !companion.relation) { + if (!companion.userName || !companion.idCard || !companion.mobile) { this.$toast('请填写完整随行人信息') return } @@ -614,7 +677,7 @@ layout("/mobile/platform.html"){ } else { // 判断companion.age,是不是在3到70岁之间,不是就提示 if (companion.age < 3 || companion.age > 70) { - this.$toast('随行人'+ (i+1) +'的年龄超出限制,请天添加其他联系人') + this.$toast('随行人'+ (i+1) +'的年龄超出限制,请添加其他联系人') return } } @@ -672,10 +735,16 @@ layout("/mobile/platform.html"){ // }, 1000) }, addCompanion() { + if(this.formData.companionList.length === 3) { + this.$toast("随行人最多3人") + return + } this.formData.companionList.push({userName: '', loginName: '', sex: '', relation: '', bedInfo: {}}) + this.clearContent() }, delCompanion() { this.formData.companionList.splice(this.active, 1) + this.clearContent() }, async join() { const re = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', { @@ -717,6 +786,7 @@ layout("/mobile/platform.html"){ takePartInUnionId: this.takePartInUnionId, companionList: [], bedInfo: {}, + roomCount: null, } this.$set(this.formData.bedInfo, 'bedType', '大床房') } @@ -873,6 +943,38 @@ layout("/mobile/platform.html"){ return false } }, + updateRoomRemarkColumns() { + const roomCount = this.formData.roomCount; + const companions = this.formData.companionList || []; + const needBedCount = companions.filter(o => o.age > 12 || o.needBed).length; + const strategies = { + 0.5: () => { + if (companions.length === 0) return 5; + if (needBedCount === 0) return 2; + return 2; + }, + 1: () => { + if (needBedCount + 1 === 2) return 4; + if (companions.length > 0 && needBedCount === 0) return 1; + if (companions.length === 0) return 3; + return 1; + }, + 1.5: () => 2, + 2: () => { + if (needBedCount + 1 === 4) return 4; + return 1; + } + }; + const matchedValue = strategies[roomCount]?.(); + if (matchedValue !== undefined) { + this.roomRemarkColumns = this.basicRoomRemarkColumns.filter( + o => o.value === matchedValue + ); + } else { + // 默认处理:恢复基础列 + this.roomRemarkColumns = [...this.basicRoomRemarkColumns]; + } + } }, async created() { const loading = this.$toast({ @@ -954,6 +1056,25 @@ layout("/mobile/platform.html"){ }) loading.close() }, + watch: { + 'formData.companionList': { + handler(newVal) { + //过滤需要床位的,找大人或者小孩需要床位的 + const needBed = newVal.filter(o => o.age > 12 || o.needBed === true) + const bedCount = 0.5 + (needBed.length - needBed.length * 0.5) + console.log(bedCount) + if(bedCount === 0.5) { + this.roomColumns = this.basicRoomColumns.filter(o => o.value <= 1) + } else { + this.roomColumns = this.basicRoomColumns.filter(o => Number.isInteger(bedCount) ? o.value === bedCount : o.value >= bedCount) + } + }, + deep: true + }, + 'formData.roomCount'(newVal) { + this.updateRoomRemarkColumns() + } + }, mounted() { window.addEventListener('scroll', this.scrollToTop) },