This commit is contained in:
JyuHsin
2025-06-11 10:19:45 +08:00
parent 075aacde0f
commit 0120e1e494
17 changed files with 232 additions and 231 deletions
@@ -63,9 +63,9 @@ public class MsgApi {
NutMap map = new NutMap();
map.put("token", msgToken);
map.put("msgtitle", msgTitle);
map.put("msgTitle", msgTitle);
map.put("msgContent", msgContent);
map.put("msgType", msgType);
map.put("msgType", String.valueOf(msgType));
map.put("sendStatus", sendStatus);
map.put("sendChannel", sendChannel);
map.put("sendMode", "normal");
@@ -15,6 +15,7 @@ import io.v.nutz.zhgh.fitnessWalk.utils.WeAppCloudUtil;
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.integration.jedis.RedisService;
@@ -30,10 +31,9 @@ import org.nutz.mvc.annotation.Ok;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
@IocBean
@@ -42,14 +42,13 @@ import java.util.stream.Collectors;
public class FitnessWalkStepManageController {
@Inject
private BaseService baseService;
private Dao dao;
@Inject
private WeAppCloudUtil weAppCloudUtil;
private BaseService baseService;
@Inject
private RedisService redisService;
@Inject
private WeAppCloudUtil weAppCloudUtil;
@Inject
private FitnessWalkCommonService fitnessWalkCommonService;
@@ -60,97 +59,81 @@ public class FitnessWalkStepManageController {
* @param activityId 活动id
* @param userId 用户id
* @param monthSteps 步数(当天往前推30天)
* @param start_time 活动开始时间
* @param end_time 结束时间
* @return
*/
@At
@Ok("json:full")
@ViReturn
@Aop(TransAop.READ_COMMITTED)
public Object updateStepMonth(String activityId, String userId, String monthSteps, Long start_time, Long end_time) {
if (StrUtil.isBlank(userId)) {
return Result.error("上传步数失败,请重新登录后再次上传!");
public Object updateStepMonth(String activityId, String userId, String monthSteps) {
if (StrUtil.isBlank(userId) || StrUtil.isBlank(monthSteps) || StrUtil.isBlank(activityId)) {
return Result.error("必要参数未传递");
}
/*DateTime activityStartDate = DateUtil.date(start_time);
DateTime activityEndDate = DateUtil.date(end_time);*/
FitnessWalkActivity activity = fitnessWalkCommonService.getActivity(activityId);
Date startDate = DateUtil.parse(DateUtil.format(DateUtil.date(activity.getStartTime()), "yyyy-MM-dd"), "yyyy-MM-dd");
Date endDate = DateUtil.parse(DateUtil.format(DateUtil.date(activity.getEndTime()), "yyyy-MM-dd"), "yyyy-MM-dd");
// Date startDate = DateUtil.parse("2025-04-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
// Date endDate = DateUtil.parse("2025-05-06 23:59:59", "yyyy-MM-dd HH:mm:ss");
if (!DateUtil.isIn(DateUtil.date(), startDate, endDate)) {
return Result.error("已过活动时间,无法上传步数");
}
// 获取到的用户的步数数据
List<NutMap> steps = Json.fromJsonAsList(NutMap.class, monthSteps);
/*//前一个月的时间
DateTime dateTime = DateUtil.offsetMonth(new Date(), -1);
String format = DateUtil.format(dateTime, "yyyyMM");
//上一个月的步数
List<NutMap> lastMonthSteps = steps.stream().filter(v -> {
long timestamp = v.getLong("timestamp") * 1000;
String userStep = DateUtil.format(DateUtil.date(timestamp), "yyyyMM");
return userStep.equals(format);
}).collect(Collectors.toList());
List<FitnessWalkStep> lastMonthInsertWxSteps = steps.stream().map(v -> {
FitnessWalkStep step = new FitnessWalkStep();
step.setActivityId(activityId);
step.setUserId(userId);
step.setStep(v.getInt("step"));
DateTime date = DateUtil.date(v.getLong("timestamp") * 1000);
step.setApplyDate(date);
return step;
}).collect(Collectors.toList());
List<Date> applyDates = lastMonthInsertWxSteps.stream().map(v -> v.getApplyDate()).collect(Collectors.toList());
applyDates.remove(applyDates.stream().min(Date::compareTo).orElse(null));
System.out.println(lastMonthInsertWxSteps.size());
System.out.println(applyDates.size());
System.out.println(Json.toJson(applyDates));
baseService.dao().clear("fitness_walk_step_" + format, Cnd.where("activityId", "=", activityId).and("userId", "=", userId).and("applyDate", "in", applyDates));
// baseService.dao().insert("fitness_walk_step_" + format,lastMonthInsertWxSteps);
//本月步数
List<NutMap> thisMonthSteps = (List<NutMap>) CollectionUtil.subtract(steps,lastMonthSteps);*/
//判断数据是否完整 微信运动会在晚上10点多进行步数的更新 会导致31天前的步数获取变为0 所以这里去除掉第一个元素 即为31天前的数据 每次只保存最近30天的数据
if (Lang.isNotEmpty(steps) && steps.size() == 31) {
steps.remove(0);
}
//如果在活动开始之前进来了 就只保存近7天的数据 不然前台展示为空 不好看
List<FitnessWalkStep> insertWxSteps = steps.stream().map(v -> {
// 传递过来的步数数据
List<FitnessWalkStep> wxSteps = steps.stream().map(v -> {
FitnessWalkStep step = new FitnessWalkStep();
step.setActivityId(activityId);
step.setUserId(userId);
step.setStep(v.getInt("step"));
DateTime date = DateUtil.date(v.getLong("timestamp") * 1000);
DateTime date = DateUtil.parse(DateUtil.format(DateUtil.date(v.getLong("timestamp") * 1000), "yyyy-MM-dd"), "yyyy-MM-dd");
step.setApplyDate(date);
return step;
}).collect(Collectors.toList());
//.filter(v -> v.getApplyDate().compareTo(DateUtil.offsetDay(activityStartDate, -7)) >= 0 && v.getApplyDate().compareTo(activityEndDate) <= 0).collect(Collectors.toList());
//.filter(v -> (v.getApplyDate().compareTo(activityStartDate) >= 0) && (v.getApplyDate().compareTo(activityEndDate) <= 0)).collect(Collectors.toList());
List<Date> applyDates = insertWxSteps.stream().map(v -> v.getApplyDate()).collect(Collectors.toList());
}).toList();
applyDates.remove(applyDates.stream().min(Date::compareTo).orElse(null));
// 传递过来的所有日期的集合
List<Date> dateList = wxSteps.stream().map(FitnessWalkStep::getApplyDate).collect(Collectors.toList());
System.out.println(insertWxSteps.size());
System.out.println(applyDates.size());
System.out.println(Json.toJson(applyDates));
// 去数据库查询日期,这个玩意还要保证插入到数据库的单个日期只有一条,并且这个日期数据库之前有步数,传过来没步数那就要保留数据库的步数
// 上面日期集合数据库的步数
List<FitnessWalkStep> stepList = dao.query(FitnessWalkStep.class, Cnd.where("activityId", "=", activityId)
.and("userId", "=", userId).and("applyDate", "in", dateList));
baseService.dao().clear(FitnessWalkStep.class, Cnd.where("activityId", "=", activityId).and("userId", "=", userId).and("applyDate", "in", applyDates));
baseService.dao().insert(insertWxSteps);
// 这就是保留每天最大步数的集合,那这个集合里面applyDate就是唯一的了
List<FitnessWalkStep> dupStepList = new ArrayList<>(stepList.stream()
.collect(Collectors.toMap(FitnessWalkStep::getApplyDate, Function.identity(),
BinaryOperator.maxBy(Comparator.comparing(FitnessWalkStep::getStep))))
.values());
// 这是过滤的相同的applyDate的集合,这些数据要删除
List<String> delStepIds = stepList.stream()
.filter(step -> !dupStepList.contains(step))
.map(FitnessWalkStep::getId)
.collect(Collectors.toList());
// 数据库的数据 这个map就用于判断数据库的日期和传递过来日期的步数,两个是不是相等的,保留步数多的数据
Map<Date, FitnessWalkStep> dateStepMap = dupStepList.stream().collect(Collectors.toMap(FitnessWalkStep::getApplyDate, v -> v));
List<FitnessWalkStep> resultStepList = new ArrayList<>();
// 这里循环就是,循环的传递过来的数据
for (FitnessWalkStep step : wxSteps) {
// 数据库存储的步数
FitnessWalkStep walkStep = dateStepMap.get(step.getApplyDate());
// 如果数据库没有,那就要新增
if (Lang.isEmpty(walkStep)) {
resultStepList.add(step);
} else {
// 如果数据库有,那就要保留步数多的
if (walkStep.getStep() < step.getStep()) {
walkStep.setStep(step.getStep());
resultStepList.add(walkStep);
}
}
}
// 最后删除重复日期,更新步数数据
dao.clear(FitnessWalkStep.class, Cnd.where("id", "in", delStepIds));
if (Lang.isNotEmpty(resultStepList)) {
dao.insertOrUpdate(resultStepList);
}
return null;
}
@@ -78,7 +78,7 @@ public class FitnessWalkStepRankingController {
@ViReturn
@SLog(type = "校工会特色活动", tag = "健身走-计步步数排行榜", msg = "小程序接口(获取今日步数及活动范围内步数)", param = true, result = true)
public Object getUserStepRanking(String activityId, String mode, Integer pageNumber, Integer pageSize) {
if (mode.equals("day")) {
if ("day".equals(mode)) {
Sql sql = Sqls.create("""
SELECT
t.step,
@@ -90,67 +90,71 @@ public class FitnessWalkStepRankingController {
WHERE
t.activityId = @activityId
AND t.applyDate = @today
GROUP BY u.id
ORDER BY t.step DESC
""");
sql.setParam("activityId", activityId);
sql.setParam("today", DateUtil.today());
return baseService.listPageMap(pageNumber, pageSize, sql);
} else if (mode.equals("week")) {
return baseService.listPageMap(pageNumber, 50, sql);
} else if("week".equals(mode)){
Date startOfWeek = DateUtil.beginOfWeek(new Date());
Date endOfWeek = DateUtil.endOfWeek(new Date());
Sql sql = Sqls.create("""
SELECT
sum( t.step ) AS step,
u.username
FROM
`fitness_walk_step` t
LEFT JOIN sys_user u ON u.id = t.userId
WHERE
t.activityId = @activityId
AND t.applyDate >= @startTime
AND t.applyDate <= @endTime
GROUP BY
t.userId
ORDER BY
step DESC
""");
SELECT
t.userId,
sum( t.step ) AS step,
u.username
FROM
`fitness_walk_step` t
LEFT JOIN sys_user u ON u.id = t.userId
WHERE
t.activityId = @activityId
AND t.applyDate >= @startTime
AND t.applyDate <= @endTime
GROUP BY
t.userId
ORDER BY
step DESC
""");
sql.setParam("activityId", activityId);
sql.setParam("startTime", startOfWeek);
sql.setParam("endTime", endOfWeek);
return baseService.listPageMap(pageNumber, pageSize, sql);
} else if (mode.equals("month")) {
return baseService.listPageMap(pageNumber, 50, sql);
}else if("month".equals(mode)){
Date firstDayOfMonth = DateUtil.beginOfMonth(new Date());
Date lastDayOfMonth = DateUtil.endOfMonth(new Date());
Sql sql = Sqls.create("""
SELECT
sum( t.step ) AS step,
u.username
FROM
`fitness_walk_step` t
LEFT JOIN sys_user u ON u.id = t.userId
WHERE
t.activityId = @activityId
AND t.applyDate >= @startTime
AND t.applyDate <= @endTime
GROUP BY
t.userId
ORDER BY
step DESC
""");
SELECT
t.userId,
sum( t.step ) AS step,
u.username
FROM
`fitness_walk_step` t
LEFT JOIN sys_user u ON u.id = t.userId
WHERE
t.activityId = @activityId
AND t.applyDate >= @startTime
AND t.applyDate <= @endTime
GROUP BY
t.userId
ORDER BY
step DESC
""");
sql.setParam("activityId", activityId);
sql.setParam("startTime", firstDayOfMonth);
sql.setParam("endTime", lastDayOfMonth);
return baseService.listPageMap(pageNumber, pageSize, sql);
} else if (mode.equals("all")) {
return baseService.listPageMap(pageNumber, 50, sql);
} else if ("all".equals(mode)) {
FitnessWalkActivity activity = fitnessWalkCommonService.getActivity(activityId);
DateTime startTime = DateUtil.date(activity.getStartTime());
DateTime endTime = DateUtil.date(activity.getEndTime());
Sql sql = Sqls.create("""
SELECT
sub.userId,
SUM(sub.max_step) AS step,
u.username
u.loginname,
u.username
FROM (
SELECT
userId,
@@ -171,12 +175,12 @@ public class FitnessWalkStepRankingController {
GROUP BY
userId
ORDER BY
step desc
step desc
""");
sql.setParam("activityId", activityId);
sql.setParam("startTime", startTime);
sql.setParam("endTime", endTime);
return baseService.listPageMap(pageNumber, pageSize, sql);
return baseService.listPageMap(pageNumber, 50, sql);
} else {
return null;
}
@@ -32,6 +32,8 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
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.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -111,9 +113,10 @@ public class TheRapyRecuperationLineController {
@RequiresAuthentication
@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);
return Integer.parseInt(serialNumber.toString()) + 1;
Sql sql = Sqls.fetchInt("SELECT max(serialNumber * 1) FROM the_rapy_recuperation_line");
dao.execute(sql);
int serialNumber = sql.getInt();
return serialNumber + 1;
}
/**
@@ -2,13 +2,16 @@ package io.v.nutz.zhgh.therapyRecuperation.controller.basicManage;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.hutool.core.date.DateUtil;
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.utils.PageUtil;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyTravelAgencyExcelMode;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationEnroll;
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationTravelAgency;
import io.v.nutz.zhgh.therapyRecuperation.service.TheRapyRecuperationTravelAgencyService;
import lombok.extern.slf4j.Slf4j;
@@ -18,6 +21,7 @@ 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.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop;
@@ -30,6 +34,7 @@ import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -141,10 +146,20 @@ public class TheRapyRecuperationTravelAgencyController {
@ViReturn
@RequiresAuthentication
public Object deleteTravelAgency(String id) {
if (StrUtil.isBlank(id)) {
/*if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
}
travelAgencyService.deleteTravelAgency(id);
travelAgencyService.deleteTravelAgency(id);*/
List<ActivityUserScope> result = new ArrayList<>();
List<Record> records = dao.query("bbbb", Cnd.NEW());
for (Record record : records) {
ActivityUserScope scope = new ActivityUserScope();
scope.setGroupId(6);
scope.setGroupName("2025年疗休养参加人员");
scope.setUserId(record.getString("userid"));
result.add(scope);
}
dao.insert(result);
return null;
}
@@ -85,8 +85,11 @@ public class TheRapyRecuperationEnrollController {
@POST
@ViReturn
@RequiresAuthentication
public Object pageData(PageForm pageForm, Integer year, String unionId, int theRapyRecuperationType, Integer lineUnionType, String routeName, String lotId, String searchKeyword, String playStartTime, String playEndTime) {
return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType, routeName, lotId, searchKeyword, playStartTime, playEndTime);
public Object pageData(PageForm pageForm,
Integer year, String unionId, int theRapyRecuperationType, Integer lineUnionType,
String routeName, String lotId, String searchKeyword, String playStartTime, String playEndTime,
String baseName, String travelId) {
return enrollService.enrollPageData(pageForm, year, unionId, theRapyRecuperationType, lineUnionType, routeName, lotId, searchKeyword, playStartTime, playEndTime, baseName, travelId);
}
@At
@@ -27,7 +27,7 @@ public interface TheRapyRecuperationEnrollService extends ViService<TheRapyRecup
* @param trrt trrt
* @return {@link Pagination}
*/
Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType, String routeName, String lotId, String searchKeyword, String playStartTime, String playEndTime);
Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType, String routeName, String lotId, String searchKeyword, String playStartTime, String playEndTime, String baseName, String travelId);
List<NutMap> getSelectLineById(String lineId, String unionId, int trrt, Integer lineUnionType);
@@ -67,7 +67,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
private TheRapyRecuperationLineService lineService;
@Override
public Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType, String routeName, String lotId, String searchKeyword, String playStartTime, String playEndTime) {
public Pagination enrollPageData(PageForm pageForm, Integer year, String unionId, int trrt, Integer lineUnionType, String routeName, String lotId, String searchKeyword, String playStartTime, String playEndTime, String baseName, String travelId) {
Cnd cnd = Cnd.NEW();
if (List.of(TheRapyRecuperationType.provinceInLine.getValue(), TheRapyRecuperationType.provinceOutLine.getValue()).contains(trrt)) {
Sql lineSql = Sqls.create("""
@@ -192,6 +192,10 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
left join the_rapy_recuperation_travel_agency t on t.id = b.travelAgencyId
$condition
""");
if (StrUtil.isNotBlank(baseName)) {
cnd.and(Cnd.likeEX("b.baseName", baseName));
}
cnd.andEX("b.travelAgencyId", "=", travelId);
if (year != null) {
taSql.setVar("yearCnd", "AND YEAR(signingUptime) = '%s' ".formatted(year));
}
@@ -590,29 +594,30 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
TheRapyRecuperationLineUnionSelect lineUnionSelect = dao().fetch(TheRapyRecuperationLineUnionSelect.class, enrollInfo.getTakePartInLineId());
TheRapyRecuperationLine lineInfo = dao().fetch(TheRapyRecuperationLine.class, lineUnionSelect.getLineId());
//判断是否工勤线路
if (lineInfo.getSpecialLine() == true && StrUtil.isNotBlank(user.getRemark()) && !user.getRemark().contains("工勤")) {
return Map.of(false, "不能报名,此路线为工勤特定线路");
if (lineInfo.getSpecialLine()) {
//如果是工勤线路,那么只有工勤人员能报
if(StrUtil.isBlank(user.getRemark()) || !user.getRemark().contains("工勤")) {
return Map.of(false, "不能报名,此路线为工勤特定线路");
}
} else {
//如果不是工勤线路,那么工勤人员不能报
if(StrUtil.isNotBlank(user.getRemark()) && user.getRemark().contains("工勤")) {
return Map.of(false, "不能报名,您只能报名工勤特定线路");
}
}
//判断人数报满没有
Map<Boolean, String> validSignCountMap = validSignCount(enrollInfo, config, lineUnionSelect.getMaxGroupSize(), StrUtil.isBlank(enrollInfo.getId()) ? "add" : "edit");
if (validSignCountMap.containsKey(false)) {
return validSignCountMap;
if(lineUnionSelect.getMaxGroupSize() > 0) {
Map<Boolean, String> validSignCountMap = validSignCount(enrollInfo, config, lineUnionSelect.getMaxGroupSize(), StrUtil.isBlank(enrollInfo.getId()) ? "add" : "edit");
if (validSignCountMap.containsKey(false)) {
return validSignCountMap;
}
}
TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature());
if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) {
//获取标段中的最大费用
List<TheRapyRecuperationLot> lotList = dao().query(TheRapyRecuperationLot.class, Cnd.NEW());
//最大费用
OptionalInt optionalInt = lotList.stream().mapToInt(TheRapyRecuperationLot::getActivityCost).max();
int maxCost = optionalInt.isPresent() ? optionalInt.getAsInt() : 0;
//获取当前报名线路对应的标段的费用
Integer currentLineCost = dao().fetch(TheRapyRecuperationLot.class, lineInfo.getLotId()).getActivityCost();
//获取起始年份到当前时间,是否报名
Sql sql = Sqls.create("""
Sql threeYearOutSql = Sqls.create("""
SELECT
r.*,
l.regionalNature,
@@ -623,9 +628,6 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
LEFT JOIN the_rapy_recuperation_line l ON l.id = us.lineId
$condition
""");
Sql twoYearInSql = sql;
Sql threeYearOutSql = sql;
Sql nowYearSql = sql;
Cnd commonCnd = Cnd.NEW();
commonCnd.and("r.takePartInLineId", "is not", null);
@@ -634,20 +636,6 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
commonCnd.and("r.stateId", "not in", Lang.array(TheRapyRecuperationState.UNITFAIL, TheRapyRecuperationState.LINEUNITFAIL, TheRapyRecuperationState.SCHOOLFAIL));
commonCnd.and("signingUptime", "<=", DateUtil.now());
//两年参加省内
Cnd twoYearInCnd = commonCnd.clone();
twoYearInCnd.and("signingUptime", ">=", provinceStartYear + "-01-01");
twoYearInCnd.and("regionalNature", "=", "省内");
twoYearInCnd.and("isTakePartIn", "=", true);
twoYearInSql.setCondition(twoYearInCnd);
List<NutMap> twoYearInMapList = listMap(twoYearInSql);
//今年是否报名,不管省内省外
Cnd nowYearCnd = commonCnd.clone();
nowYearCnd.and("signingUptime", ">=", DateUtil.thisYear() + "-01-01");
nowYearSql.setCondition(nowYearCnd);
List<NutMap> nowYearMapList = listMap(nowYearSql);
//三年参加省外
Cnd threeYearOutCnd = commonCnd.clone();
threeYearOutCnd.and("signingUptime", ">=", (DateUtil.thisYear() - 3) + "-01-01");
@@ -656,31 +644,6 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
threeYearOutSql.setCondition(threeYearOutCnd);
List<NutMap> threeYearOutMapList = listMap(threeYearOutSql);
//今年是否报名,不管报省内还是省外
if (Lang.isNotEmpty(nowYearMapList)) {
NutMap nowYearMap = nowYearMapList.get(0);
//判断当前报名的线路是否和今年第一次报名的线路重复
if (nowYearMap.getString("takePartInLineId").equals(lineUnionSelect.getId())) {
return Map.of(false, "您已报名过当前线路,请选择其他线路");
}
//获取第一次报名线路对应的标段的费用
int lastLineCost = nowYearMap.getInt("activityCost");
if ((lastLineCost + currentLineCost) > maxCost) {
return Map.of(false, "您已报名过省内线路");
}
}
//省内线路判断
if (trrt.getValue() == TheRapyRecuperationType.provinceInLine.getValue()) {
if (Lang.isEmpty(twoYearInMapList)) {
return Map.of(true, "验证成功");
}
if (Lang.isNotEmpty(twoYearInMapList)) {
int hasCost = twoYearInMapList.get(0).getInt("activityCost");
if ((hasCost + currentLineCost) > maxCost) {
return Map.of(false, "您已参加过省内线路");
}
}
}
//省外线路判断
if (trrt.getValue() == TheRapyRecuperationType.provinceOutLine.getValue()) {
//三年内有没有参加过省外
@@ -725,16 +688,17 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
List<TheRapyRecuperationEnroll> enrolls = dao().query(TheRapyRecuperationEnroll.class, cnd);
//1表示在配置页面的家属配置的是数量,2是家属的List
if (config.getFamilyInfo() == 1) {
/*if (config.getFamilyInfo() == 1) {
currentSignNumber += enrollInfo.getFamilyNumber() != null ? enrollInfo.getFamilyNumber() : 0;
int sum = enrolls.stream().mapToInt(TheRapyRecuperationEnroll::getFamilyNumber).sum();
hasSignNumber = enrolls.size() + sum;
} else {
currentSignNumber += enrollInfo.getCompanionList() != null ? enrollInfo.getCompanionList().size() : 0;
List<String> list = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList());
List<TheRapyRecuperationEnrollCompanion> companions = dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", list));
List<TheRapyRecuperationEnrollCompanion> companions = dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", list));
hasSignNumber = enrolls.size() + companions.size();
}
}*/
hasSignNumber = enrolls.size();
//省外报名限制,不包含家属
if ((hasSignNumber + currentSignNumber) > maxGroupSize) {
return Map.of(false, "报名人数已满");
@@ -898,6 +862,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
us.playStartTime,
us.playEndTime,
us.signUpMode,
us.estimatedCost,
line.files AS fileId,
gh.unionname AS signUpUnionName,
ta.travelAgencyName,
@@ -195,16 +195,17 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl
from
the_rapy_recuperation_line_union_select us
left join the_rapy_recuperation_travel_agency ta on ta.id = us.travelAgencyId
where unionId = @unionId
and lineId = @lineId
and signUpMode = @mode
and year(selectTime) = @year
ORDER BY signUpStartTime,playStartTime ASC
$condition
""");
sql.setParam("unionId", unionId);
sql.setParam("lineId", lineId);
sql.setParam("mode", mode);
sql.setParam("year", year == null ? DateUtil.thisYear() : year);
Cnd cnd = Cnd.NEW();
if(!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionAdmin")) {
cnd.and("unionId", "=", unionId);
}
cnd.and("lineId", "=", lineId);
cnd.and("signUpMode", "=", mode);
cnd.and("year(selectTime)", "=", year == null ? DateUtil.thisYear() : year);
cnd.asc("signUpStartTime").asc("playStartTime");
sql.setCondition(cnd);
return listMap(sql);
// TheRapyRecuperationLine line = dao().fetch(TheRapyRecuperationLine.class, lineId);
@@ -12,7 +12,7 @@ layout("/mobile/platform.html"){
}
.header {
padding: 20px;
padding: 10px 20px 0;
}
.content {
@@ -16,7 +16,7 @@ layout("/mobile/platform.html"){
}
.header {
padding: 20px;
padding: 10px 20px 0;
}
.content {
@@ -26,12 +26,12 @@ layout("/mobile/platform.html"){
.pdf_div {
padding-bottom: 70px;
height: calc(100vh - 46px - 60px - 151px - 170px);
height: calc(100vh - 46px - 60px - 151px - 160px);
overflow-y: auto;
}
.backTop {
/*.backTop {
display: none !important;
}
}*/
.title {
font-weight: bold;
@@ -23,7 +23,7 @@ layout("/mobile/platform.html"){
.list-card {
position: relative;
margin: 10px;
margin: 0 10px 10px;
background-color: #fff;
border-radius: 6px;
box-shadow: 0 8px 12px #ebedf0;
@@ -108,7 +108,7 @@ layout("/mobile/platform.html"){
}
.van-list {
height: calc(100vh - 43px - 116px - 20px);
height: calc(100vh - 43px - 116px - 100px);
overflow-y: auto;
}
@@ -248,9 +248,6 @@ layout("/mobile/platform.html"){
<div>
<van-tag color="#1867b0">{{o.groupType === 1 ? '常规团' : '精品团'}}</van-tag>
<van-tag color="#1867b0">{{o.travelAgencyPlace}}</van-tag>
<van-tag v-if="o.signUpMode === 1" color="#1867b0">{{o.usUnionName}}</van-tag>
<van-tag v-if="o.signUpMode === 2" color="#1867b0">{{'校工会'}}</van-tag>
<van-tag v-if="o.signUpMode === 3" color="#1867b0">{{o.selectUserName}}</van-tag>
</div>
</div>
<div class="desc_info">
@@ -260,8 +257,11 @@ layout("/mobile/platform.html"){
</div>
<div class="concat">
<span>出行时段</span>
{{moment(o.playStartTime).format('MM-DD') + ' 至 ' + moment(o.playEndTime).format('MM-DD')}}
<span>组织发起</span>
<!--{{moment(o.playStartTime).format('MM-DD') + ' 至 ' + moment(o.playEndTime).format('MM-DD')}}-->
<span v-if="o.signUpMode === 1">{{o.usUnionName}}</span>
<span v-if="o.signUpMode === 2">{{'校工会'}}</span>
<span v-if="o.signUpMode === 3">{{o.selectUserName}}</span>
</div>
<!--<div class="concat" v-if="modifyConfig.familyInfo == 2">
@@ -403,6 +403,8 @@ layout("/mobile/platform.html"){
<div style="background: #FFFFFF;height: 46px;display: flex;align-items: center;justify-content: center;font-weight: bold">
筛选条件
</div>
<van-field v-model="pageForm.baseName" label="酒店名称" placeholder="请输入酒店名称"></van-field>
<van-field v-model="pageForm.travelName" label="旅行社名称" placeholder="请点击选择旅行社" is-link readonly @click="travelPicker=true"></van-field>
<van-field v-model="pageForm.searchKeyword" label="报名人员" placeholder="请输入姓名查询"></van-field>
<van-field v-model="pageForm.playStartTime" label="出行开始时间" placeholder="请点击选择出行开始时间" is-link readonly @click="playStartPicker=true"></van-field>
<van-field v-model="pageForm.playEndTime" label="出行结束时间" placeholder="请点击选择出行结束时间" is-link readonly @click="playEndPicker=true"></van-field>
@@ -430,6 +432,15 @@ layout("/mobile/platform.html"){
@cancel="playEndPicker = false"
></van-datetime-picker>
</van-popup>
<van-popup v-model="travelPicker" position="bottom">
<van-picker
show-toolbar
value-key="travelAgencyName"
:columns="travelOptions"
@cancel="travelPicker = false"
@confirm="(value, index) => {pageForm.travelName=value.travelAgencyName;pageForm.travelId=value.id;travelPicker=false}"
></van-picker>
</van-popup>
<div>
<van-tabbar v-model="tarBarActive">
@@ -445,6 +456,8 @@ layout("/mobile/platform.html"){
mixins: [mobileMixins],
data() {
return {
travelOptions: [],
travelPicker: false,
playStartPicker: false,
playEndPicker: false,
searchPopup: false,
@@ -475,6 +488,8 @@ layout("/mobile/platform.html"){
this.doSearch()
},
reset() {
this.$set(this.pageForm, 'baseName', null)
this.$set(this.pageForm, 'travelId', null)
this.$set(this.pageForm, 'searchKeyword', null)
this.$set(this.pageForm, 'playStartTime', null)
this.$set(this.pageForm, 'playEndTime', null)
@@ -623,6 +638,10 @@ layout("/mobile/platform.html"){
this.modifyConfig = res.data
}
},
async getTravelAgencyOptions() {
const {data} = await $.get('/platform/theRapyRecuperation/line/getTravelAgencyOptions')
this.travelOptions = data
},
},
mounted() {
if (localStorage.getItem('clickIndex') !== null) {
@@ -636,6 +655,7 @@ layout("/mobile/platform.html"){
this.chooseButton = await getEnumOptions('TheRapyRecuperationType')
this.chooseButton = this.chooseButton.filter(o => o.value !== 2)
const unions = await this.getTheRapyUnions()
await this.getTravelAgencyOptions()
unions.forEach(item => {
this.unionColumns.push({text: item.unionname, value: item.id})
})
@@ -309,20 +309,24 @@ layout("/mobile/platform.html"){
<div>
<van-tag color="#1867b0">{{o.groupType === 1 ? '常规团' : '精品团'}}</van-tag>
<van-tag color="#1867b0">{{o.travelAgencyPlace}}</van-tag>
<van-tag v-if="o.signUpMode === 1" color="#1867b0">{{o.usUnionName}}</van-tag>
<van-tag v-if="o.signUpMode === 2" color="#1867b0">{{'校工会'}}</van-tag>
<van-tag v-if="o.signUpMode === 3" color="#1867b0">{{o.selectUserName}}</van-tag>
</div>
</div>
<div class="desc_info">
<div class="concat">
<span>&ensp;&ensp;人:</span>{{o.contact}}
<span>预计费用:</span>
{{o.estimatedCost}}元
</div>
<div class="concat">
<span>组织发起:</span>
<!--{{moment(o.playStartTime).format('MM-DD') + ' 至 ' + moment(o.playEndTime).format('MM-DD')}}-->
<span v-if="o.signUpMode === 1">{{o.usUnionName}}</span>
<span v-if="o.signUpMode === 2">{{'校工会'}}</span>
<span v-if="o.signUpMode === 3">{{o.selectUserName}}</span>
</div>
<div class="mobile">
<span>联系方式:</span>{{o.contactMobileNumber}}
</div>
<div class="mobile">
<span>&ensp;&ensp;社:</span>{{o.travelAgencyName}}
<span>&ensp;&ensp;社:</span>
{{o.travelAgencyName}}
</div>
</div>
</div>
@@ -177,11 +177,12 @@ layout("/layouts/platform.html"){
<el-table-column label="操作" width="250px">
<template scope="{row}">
<el-button @click="openView(row.id)" size="mini" type="primary">查看</el-button>
<el-button v-if="[1,2].includes(row.stateId)" @click="openEdit(row.id)" size="mini" type="primary">编辑</el-button>
<template v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')}">
<el-button @click="openEdit(row.id)" size="mini" type="primary">编辑</el-button>
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
</template>
<template v-else>
<el-button v-if="[1,2].includes(row.stateId)" @click="openEdit(row.id)" size="mini" type="primary">编辑</el-button>
<el-button v-if="[1,2,3].includes(row.stateId)" @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
</template>
</template>
@@ -221,7 +222,7 @@ layout("/layouts/platform.html"){
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="旅行社名称" prop="travelAgencyId">
<el-select clearable filterable style="width: 100%" v-model="formData.travelAgencyId"
placeholder="请选择旅行社" @change="$set(formData,'travelAgencyPlace','')">
placeholder="请选择旅行社" @change="travelChange">
<el-option :key="item.id"
:label="item.travelAgencyName+'('+ item.year +'年)'"
:value="item.id"
@@ -246,16 +247,16 @@ layout("/layouts/platform.html"){
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="旅行社联系人">
<el-input
v-model="formData.lineContact"
placeholder="请输入旅行社联系人"
:value="(travelAgencyList?.find(v => v.id === formData.travelAgencyId) ?? {}).contact"
readonly></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="旅行社联系方式">
<el-input
v-model="formData.lineContactPhone"
placeholder="请输入旅行社联系方式"
:value="(travelAgencyList?.find(v => v.id === formData.travelAgencyId) ?? {}).contactMobileNumber"
readonly></el-input>
</el-form-item>
</el-col>
@@ -339,7 +340,6 @@ layout("/layouts/platform.html"){
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="预计费用(元/人次)" prop="estimatedCost">
<el-input clearable maxlength="50" v-model="formData.estimatedCost"
disabled
placeholder="请输入预计费用"></el-input>
</el-form-item>
</el-col>
@@ -349,10 +349,10 @@ layout("/layouts/platform.html"){
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="最多报名人数" prop="maxGroupSize">
<el-input-number :max="1000"
:min="1"
:min="0"
:precision="0"
style="width: 100%"
placeholder="请输入最多报名人数"
placeholder="请输入最多报名人数,设置0则表示不限制"
v-model="formData.maxGroupSize"></el-input-number>
</el-form-item>
</el-col>
@@ -654,6 +654,12 @@ layout("/layouts/platform.html"){
}
},
methods: {
travelChange(val) {
const travel = this.travelAgencyList.find(o => o.id === val)
this.$set(this.formData,'travelAgencyPlace','')
this.$set(this.formData, 'lineContact', travel.contact)
this.$set(this.formData, 'lineContactPhone', travel.contactMobileNumber)
},
validLineTime() {
//如果是校工会直接过
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('SchoolUnionMemberAdmin')}" === 'true') {
@@ -333,7 +333,7 @@ layout("/layouts/platform.html"){
},
pageForm: {
keywords: null,
year: null
year: new Date().getFullYear() + ""
},
//旅行社导入
importVisible: false,
@@ -415,7 +415,7 @@ layout("/layouts/platform.html"){
<el-descriptions-item label="最多报名人数">
<template slot="label">
<span class="text-danger">*</span>
最多报名人数
最多报名人数(0表示不限制)
</template>
<el-form-item :prop="'times.' + $index + '.maxGroupSize'"
:rules="[
@@ -528,13 +528,10 @@ layout("/layouts/platform.html"){
<el-descriptions-item label="最少成团人数">
{{row.minimumGroupSize}}
</el-descriptions-item>
<el-descriptions-item label="交通工具">
{{row.trafficTools}}
</el-descriptions-item>
<el-descriptions-item label="预计费用(元/人次)">
{{row.estimatedCost}}
</el-descriptions-item>
<el-descriptions-item label="最多报名人数">
<el-descriptions-item label="最多报名人数(0表示不限制)">
{{row.maxGroupSize}}
</el-descriptions-item>
<el-descriptions-item label="是否开启">
@@ -502,7 +502,7 @@ layout("/layouts/platform.html"){
:visible.sync="updateRemarkDialogVisible"
width="30%">
<el-form label-position="left" label-width="80px">
<el-form-item label="添加模式">
<el-form-item label="备注">
<el-input v-model="remarkRow.remark"></el-input>
</el-form-item>
</el-form>