疗休养

This commit is contained in:
Paidax
2025-06-18 22:21:53 +08:00
parent 4064a88a1b
commit bc3ca19212
19 changed files with 971 additions and 684 deletions
@@ -53,7 +53,7 @@ public interface SourceData {
put("XBM", new String[]{"sex"});// 性别码
put("MZMC", new String[]{"nation"});// 民族码
put("SJ", new String[]{"mobile"}); // 手机号
put("SFZJH", new String[]{"idcard"}); // 身份证件号
// put("SFZJH", new String[]{"idcard"}); // 身份证件号
put("ZZMMM", new String[]{"political"}); // 政治面貌码
put("DQZTM", new String[]{"userState", "personalStatus"}); // 在职状态码
put("RYFLMC", new String[]{"personType"}); // 人员类型码
@@ -529,7 +529,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
// 变更记录
List<NutMap> changeList = new ArrayList<>();
for (String fieldName : allowChangeFieldNames) {
if (List.of("retireDate", "welfareStopDate").contains(fieldName)) {
if (List.of("retireDate", "welfareStopDate", "idcard").contains(fieldName)) {
continue;
}
memberCommonService.extractChange(newMap, sourceMap, fieldName, dictMap, changeList);
@@ -577,7 +577,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
NutMap sourceMap = Lang.obj2nutmap(user);
List<NutMap> changeList = new ArrayList<>();
for (String fieldName : allowChangeFieldNames) {
if (List.of("retireDate", "welfareStopDate").contains(fieldName)) {
if (List.of("retireDate", "welfareStopDate", "idcard").contains(fieldName)) {
continue;
}
memberCommonService.extractChange(newMap, sourceMap, fieldName, dictMap, changeList);
@@ -1,29 +1,47 @@
package io.v.nutz.zhgh.therapyRecuperation.controller.mobile;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationEnrollService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
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.Lang;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
import java.util.Map;
/**
* @Author JyuHsin
* @Date 2022/6/2
* @Description 疗休养页面跳转controller
*/
@IocBean
@At("/platform/mobile/theRapyRecuperation")
@Ok("json:full")
@At("/platform/mobile/theRapyRecuperation")
public class MobileTheRapyRecuperationEnrollController {
@Inject
private Dao dao;
@Inject
private TheRapyRecuperationEnrollService theRapyRecuperationEnrollService;
/**
* 手机端 首页
*/
@At("/index")
@Ok("beetl:/mobile/therapyRecuperation/index.html")
@RequiresAuthentication
public void index() {
}
public void index() {}
/**
* 手机端 线路列表页面
@@ -31,9 +49,7 @@ public class MobileTheRapyRecuperationEnrollController {
@At("/mobileLineListPage")
@Ok("beetl:/mobile/therapyRecuperation/lineList.html")
@RequiresAuthentication
public void mobileLinePage() {
}
public void mobileLinePage() {}
/**
* 手机端 线路详情页面
@@ -41,9 +57,7 @@ public class MobileTheRapyRecuperationEnrollController {
@At("/lineInfo")
@Ok("beetl:/mobile/therapyRecuperation/lineInfo.html")
@RequiresAuthentication
public void lineInfo() {
}
public void lineInfo() {}
/**
* 手机端 基地详情页面
@@ -51,9 +65,7 @@ public class MobileTheRapyRecuperationEnrollController {
@At("/baseInfo")
@Ok("beetl:/mobile/therapyRecuperation/baseManagement.html")
@RequiresAuthentication
public void baseInfo() {
}
public void baseInfo() {}
/**
* 手机端 我的疗休养页面
@@ -61,15 +73,54 @@ public class MobileTheRapyRecuperationEnrollController {
@At("/myRecuperation")
@Ok("beetl:/mobile/therapyRecuperation/myRecuperation.html")
@RequiresAuthentication
public void myRecuperation() {
}
public void myRecuperation() {}
@At("/userSignInfo")
@Ok("beetl:/mobile/therapyRecuperation/userSignInfo.html")
@RequiresAuthentication
public void userSignInfo() {
public void userSignInfo() {}
@At
@ViReturn
@RequiresAuthentication
public Object getOpenLineList(String id){
if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
}
TheRapyRecuperationConfig config = theRapyRecuperationEnrollService.getConfig();
Sql sql = Sqls.create("""
SELECT
us.id AS `value`,
CONCAT(
line.lineName,
'(',
DATE_FORMAT(us.playStartTime, '%m-%d'),
'至',
DATE_FORMAT(us.playEndTime, '%m-%d'),
')'
) AS `label`
FROM
the_rapy_recuperation_line_union_select us
LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
$condition
""").setParam("id", id);
Cnd cnd = Cnd.NEW();
cnd.and("us.`enable`", "=", true);
cnd.and("us.id", "!=", id);
if ("fixedUser".equals(config.getOutsideQuotaMode())) {
if (!config.getFixedUserList().contains(ShiroUtil.getUserId())) {
cnd.and("line.regionalNature", "=", "省内");
}
}
cnd.asc("line.serialNumber");
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.maps());
dao.execute(sql);
return sql.getResult();
}
}
@@ -18,12 +18,14 @@ import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgenc
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.web.commons.slog.annotation.SLog;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
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.Daos;
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;
@@ -87,8 +89,9 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
public Object pageData(PageForm pageForm, Integer year, String unionId, int theRapyRecuperationType, Integer lineUnionType) {
return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType);
public Object pageData(PageForm pageForm, Integer year, String unionId,
int theRapyRecuperationType, Integer lineUnionType, String editOther) {
return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType, editOther);
}
@At
@@ -149,7 +152,8 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
public Object doSignUpForLine(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) {
@Aop(TransAop.READ_COMMITTED)
public synchronized 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"));
@@ -176,17 +180,28 @@ public class TheRapyRecuperationEnrollController {
} else if (!IdcardUtil.isValidCard(companion.getIdCard())) {
return Result.error("随行人身份证信息有误");
}
if (companion.getAge() < 3 || companion.getAge() > 70) {
if (companion.getAge() < 1 || companion.getAge() > 70) {
return Result.error("随行人年龄超过限制,请上传其他随行人");
}
}
}
if (StrUtil.isBlank(enrollInfo.getId())) {
enrollService.doSignUpForLine(enrollInfo);
} else {
enrollService.updateSignUpLine(enrollInfo);
if (StrUtil.isNotBlank(enrollInfo.getEditOther())) {
dao.clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "=", enrollInfo.getEditOther()));
dao.clear(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", enrollInfo.getEditOther()));
if (StrUtil.isNotBlank(enrollInfo.getBedInfoId())) {
dao.delete(TheRapyRecuperationEnrollBed.class, enrollInfo.getBedInfoId());
}
enrollInfo.setSpecificTime(null);
enrollInfo.setTakePartInTravelAgencyId(null);
enrollInfo.setTakePartInBaseManagementId(null);
enrollService.doSignUpForLine(enrollInfo);
} else {
enrollService.updateSignUpLine(enrollInfo);
}
}
return null;
}
@@ -201,6 +216,7 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
@Aop(TransAop.READ_COMMITTED)
public Object doSignUpForTravelAgency(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) {
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion"));
Map<Boolean, String> resultMap = new HashMap<>();
@@ -230,6 +246,7 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
@Aop(TransAop.READ_COMMITTED)
public Object doSignUpForBaseManagement(@Param("enroll") TheRapyRecuperationEnroll enrollInfo) {
Sys_config config = dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "recuperationVersion"));
Map<Boolean, String> resultMap = new HashMap<>();
@@ -242,34 +259,42 @@ public class TheRapyRecuperationEnrollController {
return Result.error(resultMap.get(false));
}
// 校验随行人的身份证信息
if (Lang.isNotEmpty(enrollInfo.getCompanionList())) {
for (TheRapyRecuperationEnrollCompanion companion : enrollInfo.getCompanionList()) {
if (StrUtil.isBlank(companion.getIdCard())) {
return Result.error("随行人身份证信息不能为空");
} else if (!IdcardUtil.isValidCard(companion.getIdCard())) {
return Result.error("随行人身份证信息有误");
}
if (companion.getAge() < 3 || companion.getAge() > 70) {
return Result.error("随行人年龄超过限制,请上传其他随行人");
}
}
}
if (StrUtil.isBlank(enrollInfo.getId())) {
enrollService.doSignUpForHotel(enrollInfo);
} else {
enrollService.updateSignUpHotel(enrollInfo);
if (StrUtil.isNotBlank(enrollInfo.getEditOther())) {
dao.clear(TheRapyRecuperationEnroll.class, Cnd.where("id", "=", enrollInfo.getEditOther()));
dao.clear(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", enrollInfo.getEditOther()));
if (StrUtil.isNotBlank(enrollInfo.getBedInfoId())) {
dao.delete(TheRapyRecuperationEnrollBed.class, enrollInfo.getBedInfoId());
}
enrollInfo.setRoomCount(null);
enrollInfo.setRoomRemark(null);
enrollInfo.setRoomRemarkName(null);
enrollInfo.setRoommate(null);
enrollInfo.setRoomCountName(null);
enrollInfo.setOtherRemark(null);
enrollInfo.setTakePartInLineId(null);
enrollInfo.setTakePartInUnionId(null);
enrollInfo.setTakePartInTravelAgencyId(null);
enrollInfo.setIntentionLineId(null);
enrollInfo.setIntentionLineName(null);
enrollInfo.setCarryFamilyNum(null);
enrollService.doSignUpForHotel(enrollInfo);
} else {
enrollService.updateSignUpHotel(enrollInfo);
}
}
return null;
}
@At("/findSignUpInfoById/?")
@At
@POST
@ViReturn
@RequiresAuthentication
public Object findSignUpInfoById(String id) {
return enrollService.findSignUpInfoById(id);
public Object findSignUpInfoById(@Param(value = "id", required = false) String id,
@Param(value = "editOther", required = false) String editOther) {
return enrollService.findSignUpInfoById(id, editOther);
}
/**
@@ -119,7 +119,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 ) isFamily
FROM
`the_rapy_recuperation_enroll` enroll
@@ -128,7 +128,7 @@ public class TheRapyRecuperationUserQueryController {
LEFT JOIN the_rapy_recuperation_lot lot ON lot.id = line.lotId
LEFT JOIN the_rapy_recuperation_base_management ma on ma.id = enroll.takePartInBaseManagementId
LEFT JOIN the_rapy_recuperation_travel_agency lxs ON lxs.id = line.travelAgencyId
$condition
$condition
""");
cnd.andEX("YEAR(enroll.signingUptime)", ">=", startYear);
cnd.andEX("YEAR(enroll.signingUptime)", "<=", endYear);
@@ -504,7 +504,9 @@ public class TheRapyRecuperationUserQueryController {
lineEntities.add(new ExcelExportEntity("行程", "playTime", 20));
lineEntities.add(new ExcelExportEntity("房间需求数", "roomCount", 20));
lineEntities.add(new ExcelExportEntity("用房备注", "roomRemarkName", 30));
lineEntities.add(new ExcelExportEntity("其他", "other", 20));
lineEntities.add(new ExcelExportEntity("其他备注", "otherRemark", 20));
lineEntities.add(new ExcelExportEntity("第二意向线路", "intentionLineName", 30));
lineEntities.add(new ExcelExportEntity("意向线路携带家属数", "carryFamilyNum", 20));
//自由组团表头
ArrayList<ExcelExportEntity> travelEntities = new ArrayList<>(commonEntities);
@@ -94,6 +94,15 @@ public class TheRapyRecuperationConfigController {
dao.insertWith(config, "lots");
}
// 如果是特定人员报名,将这些人存在redis里边,方便查询
if ("fixedUser".equals(config.getOutsideQuotaMode())) {
Sql sql = Sqls.create("select userId from the_rapy_recuperation_can_apply_out_user");
sql.setCallback(Sqls.callback.strList());
dao.execute(sql);
List<String> stringList = sql.getList(String.class);
config.setFixedUserList(stringList);
}
// 将配置存储到redis里边,可以避免每次都去查一次数据库
String configCache = RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE;
redisService.del(configCache);
@@ -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.*;
@@ -116,4 +117,12 @@ public class TheRapyRecuperationConfig {
@Comment("分工会人数限制")
@ColDefine(type = ColType.MYSQL_JSON)
private List<NutMap> unionLimit;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("承诺书")
private List<Sys_file> files;
// 可以参加报名的人员
private List<String> fixedUserList;
}
@@ -237,5 +237,27 @@ public class TheRapyRecuperationEnroll extends BaseModel {
@Comment("拼房人")
private String roommate;
@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("其他备注")
private String otherRemark;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("第二意向线路Id")
private String intentionLineId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("第二意向线路名称")
private String intentionLineName;
@Column
@ColDefine(type = ColType.INT)
@Comment("携带家属人数")
private Integer carryFamilyNum;
private String firstLetter;
private String editOther;
}
@@ -4,6 +4,7 @@ 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.TheRapyRecuperationConfig;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import org.nutz.dao.Cnd;
import org.nutz.lang.util.NutMap;
@@ -27,7 +28,8 @@ public interface TheRapyRecuperationEnrollService extends ViService<TheRapyRecup
* @param trrt trrt
* @return {@link Pagination}
*/
Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType);
Pagination enrollPageData(PageForm pageForm, Integer year, String unionId,
int trrt, Integer lineUnionType, String editOther);
List<NutMap> getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType);
@@ -101,7 +103,7 @@ public interface TheRapyRecuperationEnrollService extends ViService<TheRapyRecup
* @param id id
* @return {@link TheRapyRecuperationEnroll}
*/
TheRapyRecuperationEnroll findSignUpInfoById(String id);
TheRapyRecuperationEnroll findSignUpInfoById(String id, String editOther);
/**
@@ -122,4 +124,7 @@ public interface TheRapyRecuperationEnrollService extends ViService<TheRapyRecup
NutMap selectLineAllInfo(String usId, String usUnionId);
List<Sys_union> getTheRapyUnions(Integer year);
TheRapyRecuperationConfig getConfig();
}
@@ -113,9 +113,9 @@ public class TheRapyRecuperationAuditServiceImpl extends ViServiceImpl<Audit> im
fetch.setv("bedInfo", bedInfo);
}
List<TheRapyRecuperationEnrollCompanion> companionList = dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", id));
companionList.forEach(v -> {
v.setBedInfo(dao().fetch(TheRapyRecuperationEnrollBed.class, v.getBedInfoId()));
});
// companionList.forEach(v -> {
// v.setBedInfo(dao().fetch(TheRapyRecuperationEnrollBed.class, v.getBedInfoId()));
// });
map.addv("viewData", fetch.setv("companionList", companionList));
@@ -69,7 +69,12 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
private TheRapyRecuperationLineService lineService;
@Override
public Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType) {
public Pagination enrollPageData(PageForm pageForm, Integer year, String unionId,
int trrt, Integer lineUnionType, String editOther) {
TheRapyRecuperationEnroll enroll = null;
if (StrUtil.isNotBlank(editOther)) {
enroll = dao().fetch(TheRapyRecuperationEnroll.class, editOther);
}
Cnd cnd = Cnd.NEW();
if (List.of(TheRapyRecuperationType.provinceInLine.getValue(), TheRapyRecuperationType.provinceOutLine.getValue()).contains(trrt)) {
Sql lineSql = Sqls.create("""
@@ -133,6 +138,11 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
//校工会
lineCnd.and("us.signUpMode", "=", TheRapyRecuperationSignUpMode.FREE.getValue());
}
if (Lang.isNotEmpty(enroll) && StrUtil.isNotBlank(enroll.getTakePartInLineId())) {
lineCnd.and("us.id", "!=", enroll.getTakePartInLineId());
}
lineSql.setVar("lineCnd", lineCnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), lineSql);
} else if (TheRapyRecuperationType.provinceInTravelAgency.getValue() == trrt) {
@@ -145,6 +155,9 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
from
the_rapy_recuperation_travel_agency $condition
""");
if (Lang.isNotEmpty(enroll) && StrUtil.isNotBlank(enroll.getTakePartInTravelAgencyId())) {
cnd.and("id", "!=", enroll.getTakePartInTravelAgencyId());
}
taSql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql);
} else if (TheRapyRecuperationType.provinceInHotel.getValue() == trrt) {
@@ -163,6 +176,9 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
$condition
""").setParam("year", queryYear);
cnd.asc("sortNumber");
if (Lang.isNotEmpty(enroll) && StrUtil.isNotBlank(enroll.getTakePartInBaseManagementId())) {
cnd.and("b.id", "!=", enroll.getTakePartInBaseManagementId());
}
taSql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), taSql);
}
@@ -320,10 +336,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
}
if (recuperationConfig.getBedInfo() || recuperationConfig.getFamilyInfo() == 2) {
for (TheRapyRecuperationEnrollCompanion theRapyRecuperationEnrollCompanion : enrollInfo.getCompanionList()) {
insertLinks(theRapyRecuperationEnrollCompanion, "bedInfo");
}
insertWith(enrollInfo, "companionList|bedInfo");
insertWith(enrollInfo, "companionList");
} else {
insert(enrollInfo);
}
@@ -353,9 +366,11 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
if (recuperationConfig.getBedInfo() || recuperationConfig.getFamilyInfo() == 2) {
dao().clearLinks(enrollInfo, "companionList");
dao().delete(TheRapyRecuperationEnrollBed.class, enrollInfo.getBedInfoId());
if (StrUtil.isNotBlank(enrollInfo.getBedInfoId())) {
dao().delete(TheRapyRecuperationEnrollBed.class, enrollInfo.getBedInfoId());
}
dao().insertLinks(enrollInfo, "companionList|bedInfo");
dao().insertLinks(enrollInfo, "companionList");
}
update(enrollInfo);
@@ -416,7 +431,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
for (TheRapyRecuperationEnrollCompanion theRapyRecuperationEnrollCompanion : enrollInfo.getCompanionList()) {
insertLinks(theRapyRecuperationEnrollCompanion, "bedInfo");
}
insertWith(enrollInfo, "companionList|bedInfo");
insertWith(enrollInfo, "companionList");
}
/**
@@ -429,9 +444,10 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
public void updateSignUpHotel(TheRapyRecuperationEnroll enrollInfo) {
dao().clearLinks(enrollInfo, "companionList");
dao().delete(TheRapyRecuperationEnrollBed.class, enrollInfo.getBedInfoId());
dao().insertLinks(enrollInfo, "companionList|bedInfo");
if (StrUtil.isNotBlank(enrollInfo.getBedInfoId())) {
dao().delete(TheRapyRecuperationEnrollBed.class, enrollInfo.getBedInfoId());
}
dao().insertLinks(enrollInfo, "companionList");
update(enrollInfo);
//插入变更记录
@@ -485,19 +501,18 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
//每年旅行频率
Integer travelFrequency = config.getTravelFrequency();
//省外几年去一次
Integer outsideNumber = config.getOutsideNumber();
//可以修改几次
Integer modifyNumber = config.getModifyNumber();
//省外最多报名人数
Integer allLineSignUpNumber = config.getAllLineSignUpNumber();
// 判断是不是修改报名其他线路
String editOther = enrollInfo.getEditOther();
//如果报旅行社
if (StrUtil.isNotBlank(enrollInfo.getTakePartInTravelAgencyId())) {
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency);
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency, editOther);
if (oneYear != null) {
return oneYear;
}
@@ -505,7 +520,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
//如果报酒店
if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId()) && StrUtil.isBlank(enrollInfo.getId())) {
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency);
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency, editOther);
if (oneYear != null) {
return oneYear;
}
@@ -571,7 +586,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
}
if (StrUtil.isBlank(enrollInfo.getId())) {
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency);
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency, editOther);
if (oneYear != null) {
return oneYear;
}
@@ -967,22 +982,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
@Override
public Map<Boolean, String> validSignUpInfoForHMC(String loginName, TheRapyRecuperationEnroll enrollInfo) {
//配置信息
TheRapyRecuperationConfig config;
// 丛redis里面去配置信息
String configRedis = redisService.get(RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE);
if (StrUtil.isNotBlank(configRedis)) {
try {
config = JSONUtil.toBean(configRedis, TheRapyRecuperationConfig.class);
} catch (Exception e) {
config = dao().fetch(TheRapyRecuperationConfig.class);
redisService.set(RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE, JSONUtil.toJsonStr(config));
}
} else {
config = dao().fetch(TheRapyRecuperationConfig.class);
redisService.set(RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE, JSONUtil.toJsonStr(config));
}
TheRapyRecuperationConfig config = getConfig();
Sys_user user = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName));
//判断是否在报名范围内
@@ -1002,13 +1002,15 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
Integer activityGroupId = config.getActivityGroupId();
// 省外限制模式
String outsideQuotaMode = config.getOutsideQuotaMode();
// 判断是不是修改其他线路
String editOther = enrollInfo.getEditOther();
//如果报旅行社
if (StrUtil.isNotBlank(enrollInfo.getTakePartInTravelAgencyId())) {
if(StrUtil.isNotBlank(enrollInfo.getId())) {
return Map.of(true, "成功");
}
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency);
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency, editOther);
if (oneYear != null) {
return oneYear;
}
@@ -1016,7 +1018,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
//如果报酒店
if (StrUtil.isNotBlank(enrollInfo.getTakePartInBaseManagementId()) && StrUtil.isBlank(enrollInfo.getId())) {
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency);
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency, editOther);
if (oneYear != null) {
return oneYear;
}
@@ -1076,7 +1078,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature());
if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) {
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency);
Map<Boolean, String> oneYear = this.validCountOneYear(loginName, travelFrequency, editOther);
if (oneYear != null && oneYear.containsKey(false)) {
return oneYear;
}
@@ -1111,7 +1113,9 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
commonCnd.and("r.isNormal", "=", true);
commonCnd.and("stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL));
commonCnd.and("signingUptime", "<=", DateUtil.now());
if (StrUtil.isNotBlank(editOther)) {
commonCnd.and("r.id", "!=", editOther);
}
//今年是否报名,不管省内省外
Cnd nowYearCnd = commonCnd.clone();
@@ -1127,13 +1131,11 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
twoYearOutSql.setCondition(twoYearOutCnd);
List<NutMap> twoYearOutMapList = listMap(twoYearOutSql);
//今年是否报名,不管报省内还是省外,还是旅行社
if (nowYearMapList.size() >= travelFrequency) {
return Map.of(false, "您已报名其他线路");
}
//省外线路判断
if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue()) {
//三年内有没有参加过省外
@@ -1168,6 +1170,10 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
if (enrollList.size() >= result) {
return Map.of(false, "已报人数超过" + (proportion * 100) + "%,不能报名");
}
} else if ("fixedUser".equals(outsideQuotaMode)) {
if (!config.getFixedUserList().contains(ShiroUtil.getUserId())) {
return Map.of(false, "您不在省外报名人员范围内,如有疑问请及时联系校工会");
}
} else if ("unionRatio".equals(outsideQuotaMode)) {
// 分工会名额限制
String unionId = Vi.getUnionId();
@@ -1263,66 +1269,65 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
}
//判断一年报几次
public Map<Boolean, String> validCountOneYear(String loginName, int travelFrequency) {
public Map<Boolean, String> validCountOneYear(String loginName, int travelFrequency, String editOther) {
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) {
Sql sql = Sqls.create("""
SELECT
us.id,
line.regionalNature
FROM
the_rapy_recuperation_line_union_select us
LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
WHERE
YEAR(us.signUpStartTime) = YEAR(NOW())
""");
List<NutMap> usList = listMap(sql);
List<String> unionInSelectIds = usList.stream().filter(v -> "省内".equals(v.getString("regionalNature"))).map(v -> v.getString("id")).toList();
List<String> unionOutSelectIds = usList.stream().filter(v -> "省外".equals(v.getString("regionalNature"))).map(v -> v.getString("id")).toList();
// List<TheRapyRecuperationLine> inList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省内"));
// List<TheRapyRecuperationLineUnionSelect> unionInSelects = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", inList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList())));
// List<TheRapyRecuperationLine> outList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省外"));
// List<TheRapyRecuperationLineUnionSelect> 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", unionInSelectIds)
.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", unionOutSelectIds)
.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("takePartInTravelAgencyId", "is not", null)
.and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear()));
//是否报酒店
int hotelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname"))
.and("takePartInLineId", "is", null).and("isNormal", "=", true)
.and("takePartInBaseManagementId", "is not", null)
.and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear()));
String str = "";
if (inCount > 0) {
str = "省内线路";
} else if (outCount > 0) {
str = "省外线路";
} else if (travelCount > 0) {
str = "旅行社";
} else if (hotelCount > 0) {
str = "酒店";
}
if (joinCount >= travelFrequency && StrUtil.isBlank(editOther)) {
// Sql sql = Sqls.create("""
// SELECT
// us.id,
// line.regionalNature
// FROM
// the_rapy_recuperation_line_union_select us
// LEFT JOIN the_rapy_recuperation_line line ON line.id = us.lineId
// WHERE
// YEAR(us.signUpStartTime) = YEAR(NOW())
// """);
// List<NutMap> usList = listMap(sql);
//
// List<String> unionInSelectIds = usList.stream().filter(v -> "省内".equals(v.getString("regionalNature"))).map(v -> v.getString("id")).toList();
// List<String> unionOutSelectIds = usList.stream().filter(v -> "省外".equals(v.getString("regionalNature"))).map(v -> v.getString("id")).toList();
//
//
//// List<TheRapyRecuperationLine> inList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省内"));
//// List<TheRapyRecuperationLineUnionSelect> unionInSelects = dao().query(TheRapyRecuperationLineUnionSelect.class, Cnd.where("lineId", "in", inList.stream().map(TheRapyRecuperationLine::getId).collect(Collectors.toList())));
//// List<TheRapyRecuperationLine> outList = dao().query(TheRapyRecuperationLine.class, Cnd.where("regionalNature", "=", "省外"));
//// List<TheRapyRecuperationLineUnionSelect> 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", unionInSelectIds)
// .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", unionOutSelectIds)
// .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("takePartInTravelAgencyId", "is not", null)
// .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear()));
// //是否报酒店
// int hotelCount = dao().count("the_rapy_recuperation_enroll", Cnd.where("loginName", "=", ShiroUtil.getPrincipalProperty("loginname"))
// .and("takePartInLineId", "is", null).and("isNormal", "=", true)
// .and("takePartInBaseManagementId", "is not", null)
// .and("YEAR(signingUptime)", "=", io.v.nutz.base.utils.DateUtil.getYear()));
// String str = "";
// if (inCount > 0) {
// str = "省内线路";
// } else if (outCount > 0) {
// str = "省外线路";
// } else if (travelCount > 0) {
// str = "旅行社";
// } else if (hotelCount > 0) {
// str = "酒店";
// }
return Map.of(false, "您已报过其他线路,如有疑问请联系分工会主席!");
}
return Map.of(true, "成功");
@@ -1401,7 +1406,8 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
GROUP_CONCAT(ec.userName) as companionUserNames,
l.lotName,
au.stateName,
au.stateColor
au.stateColor,
COUNT(ec.id) AS companionCount
FROM
the_rapy_recuperation_enroll e
LEFT JOIN sys_union gh ON gh.id = e.takePartInUnionId
@@ -1477,9 +1483,14 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
* @return {@link TheRapyRecuperationEnroll}
*/
@Override
public TheRapyRecuperationEnroll findSignUpInfoById(String id) {
TheRapyRecuperationEnroll enroll = fetch(id);
return fetchLinks(enroll, "companionList|bedInfo");
public TheRapyRecuperationEnroll findSignUpInfoById(String id, String editOther) {
if (StrUtil.isNotBlank(editOther)) {
TheRapyRecuperationEnroll enroll = fetch(editOther);
return fetchLinks(enroll, "companionList|bedInfo");
} else {
TheRapyRecuperationEnroll enroll = fetch(id);
return fetchLinks(enroll, "companionList|bedInfo");
}
}
/**
@@ -1571,4 +1582,41 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
}
return new ArrayList<>();
}
@Override
public TheRapyRecuperationConfig getConfig() {
//配置信息
TheRapyRecuperationConfig config;
// 丛redis里面去配置信息
String configRedis = redisService.get(RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE);
if (StrUtil.isNotBlank(configRedis)) {
try {
config = JSONUtil.toBean(configRedis, TheRapyRecuperationConfig.class);
} catch (Exception e) {
config = dao().fetch(TheRapyRecuperationConfig.class);
// 如果是特定人员报名,将这些人存在redis里边,方便查询
if ("fixedUser".equals(config.getOutsideQuotaMode())) {
Sql sql = Sqls.create("select userId from the_rapy_recuperation_can_apply_out_user");
sql.setCallback(Sqls.callback.strList());
dao().execute(sql);
List<String> stringList = sql.getList(String.class);
config.setFixedUserList(stringList);
}
redisService.set(RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE, JSONUtil.toJsonStr(config));
}
} else {
config = dao().fetch(TheRapyRecuperationConfig.class);
// 如果是特定人员报名,将这些人存在redis里边,方便查询
if ("fixedUser".equals(config.getOutsideQuotaMode())) {
Sql sql = Sqls.create("select userId from the_rapy_recuperation_can_apply_out_user");
sql.setCallback(Sqls.callback.strList());
dao().execute(sql);
List<String> stringList = sql.getList(String.class);
config.setFixedUserList(stringList);
}
redisService.set(RedisConstant.REDIS_KEY_THE_RAPY_RECU_CONFIG_CACHE, JSONUtil.toJsonStr(config));
}
return config;
}
}