commit
This commit is contained in:
+17
-1
@@ -88,10 +88,26 @@ public class ClientActivityController {
|
||||
@At("/list-signup-user/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listSignUpUser(Long activityId) {
|
||||
List<ActUser> list = dao.query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(ActUser::getSignUpUserId, "=", StpClientUtil.STP.getLoginIdAsLong()));
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or(ActUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong());
|
||||
group.or(ActUser::getSignUpUserId, "=", StpClientUtil.STP.getLoginIdAsLong());
|
||||
List<ActUser> list = dao.query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(group));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否报名
|
||||
*/
|
||||
@At("/is-sign-up/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result isSignUp(Long activityId) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or(ActUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong());
|
||||
group.or(ActUser::getSignUpUserId, "=", StpClientUtil.STP.getLoginIdAsLong());
|
||||
int count = dao.count(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(group));
|
||||
return Result.success().addData(count > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我报名的活动
|
||||
*/
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.budwk.app.client.module.activity.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.client.module.activity.service.ClientActivityService;
|
||||
import com.budwk.app.module.activity.models.ActGroup;
|
||||
import com.budwk.app.module.activity.models.ActUser;
|
||||
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/4/28 17:35
|
||||
* @description 我的团队
|
||||
*/
|
||||
@IocBean
|
||||
@At("/client/group")
|
||||
@Ok("json:full")
|
||||
public class ClientGroupController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ClientActivityService clientActivityService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询我的活动
|
||||
* @return
|
||||
*/
|
||||
@At("/list-act")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listAct(){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.id,
|
||||
t1.title,
|
||||
t1.address,
|
||||
t1.startTime,
|
||||
t1.endTime,
|
||||
t1.signStartTime,
|
||||
t1.signEndTime
|
||||
FROM
|
||||
activity t1
|
||||
LEFT JOIN act_user t2 ON t1.id = t2.activityId
|
||||
WHERE
|
||||
t2.userId = @userId
|
||||
AND t2.isSignIn =1
|
||||
""").setParam("userId", StpClientUtil.STP.getLoginIdAsLong());
|
||||
List<NutMap> list = clientActivityService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At("/info/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result info(Long activityId){
|
||||
ActGroup group = dao.fetch(ActGroup.class, Cnd.where(ActGroup::getActivityId, "=", activityId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询团队成员
|
||||
*/
|
||||
@At("/list-team-user/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listTeamUser(Long activityId){
|
||||
List<ActUser> list = dao.query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(ActUser::getIsSignIn, "=", 1));
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.budwk.app.client.module.activity.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import com.budwk.app.base.page.PageForm;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.client.module.activity.service.ClientActivityService;
|
||||
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
||||
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.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.adaptor.JsonAdaptor;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/4/28 15:59
|
||||
* @description 我的
|
||||
*/
|
||||
@IocBean
|
||||
@At("/client/profile")
|
||||
@Ok("json:full")
|
||||
public class ClientProfileController {
|
||||
|
||||
@Inject
|
||||
private ClientActivityService clientActivityService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/list-act")
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listAct(PageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.id,
|
||||
t1.title,
|
||||
t1.address,
|
||||
t1.startTime,
|
||||
t1.endTime,
|
||||
t1.signStartTime,
|
||||
t1.signEndTime,
|
||||
t1.cover,
|
||||
t1.coHostUnit
|
||||
FROM
|
||||
activity t1
|
||||
LEFT JOIN act_user t2 ON t1.id=t2.activityId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or("t2.userId", "=", StpClientUtil.STP.getLoginIdAsLong());
|
||||
group.or("t2.signUpUserId", "=", StpClientUtil.STP.getLoginIdAsLong());
|
||||
cnd.groupBy("t1.id");
|
||||
cnd.and(group);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = clientActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消报名
|
||||
*/
|
||||
@At("/cancel-sign-up/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result cancelSignUp(Long activityId) {
|
||||
clientActivityService.cancelSignUp(activityId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -25,4 +25,8 @@ public interface ClientActivityService extends BaseService<Activity> {
|
||||
void signIn(Long activityId);
|
||||
|
||||
|
||||
/**
|
||||
* 取消报名
|
||||
*/
|
||||
void cancelSignUp(Long activityId);
|
||||
}
|
||||
|
||||
+11
-1
@@ -14,6 +14,7 @@ import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -49,7 +50,7 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
||||
List<ActUser> userList = signVO.getUserList();
|
||||
// 首先检查报名人员是否已经在用户表中
|
||||
for (ActUser user : userList) {
|
||||
Client_user clientUser = dao().fetch(Client_user.class, Cnd.where(Client_user::getIdCard, "=", user.getIdCard()));
|
||||
Client_user clientUser = dao().fetch(Client_user.class, Cnd.where(Client_user::getIdCard, "=", user.getIdCard()).or(Client_user::getPhone, "=", user.getPhone()));
|
||||
if (clientUser == null) {
|
||||
// 创建用户
|
||||
clientUser = new Client_user();
|
||||
@@ -100,4 +101,13 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
||||
actUser.setSignInTime(LocalDateTime.now());
|
||||
dao().update(actUser, "isSignIn|signInTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelSignUp(Long activityId) {
|
||||
ActUser actUser = dao().fetch(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(ActUser::getSignUpUserId, "=", StpClientUtil.STP.getLoginIdAsLong()));
|
||||
if (Lang.isEmpty(actUser)) {
|
||||
throw new BaseException("请联系报名人取消报名!");
|
||||
}
|
||||
dao().clear(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(ActUser::getSignUpUserId, "=", StpClientUtil.STP.getLoginIdAsLong()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
@@ -14,7 +16,7 @@ import org.nutz.dao.entity.annotation.*;
|
||||
*/
|
||||
@Data
|
||||
@Comment("活动队伍")
|
||||
//@Table("act_group")
|
||||
@Table("act_group")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class ActGroup extends BaseModel {
|
||||
@@ -23,18 +25,24 @@ public class ActGroup extends BaseModel {
|
||||
@Comment("ID")
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
@Comment("活动ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long activityId;
|
||||
|
||||
@Column
|
||||
@Comment("队伍名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String groupName;
|
||||
|
||||
@Column
|
||||
@Comment("领队Id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long groupLeaderId;
|
||||
@Comment("队伍总得分")
|
||||
@ColDefine(customType = "decimal", width = 10, precision = 2)
|
||||
private BigDecimal totalScore;
|
||||
|
||||
@Column
|
||||
@Comment("领队名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 128)
|
||||
private Long groupLeaderName;
|
||||
@Comment("队伍总排名")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer totalRank;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,7 @@ package com.budwk.app.module.activity.models;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.Comment;
|
||||
import org.nutz.dao.entity.annotation.Id;
|
||||
import org.nutz.dao.entity.annotation.Table;
|
||||
import org.nutz.dao.entity.annotation.TableMeta;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
@@ -17,7 +14,7 @@ import org.nutz.dao.entity.annotation.TableMeta;
|
||||
*/
|
||||
@Data
|
||||
@Comment("活动队伍人员")
|
||||
//@Table("act_group_user")
|
||||
@Table("act_group_user")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class ActGroupUser extends BaseModel {
|
||||
@@ -25,4 +22,19 @@ public class ActGroupUser extends BaseModel {
|
||||
@Id
|
||||
@Comment("ID")
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
@Comment("队伍Id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long groupId;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long userId;
|
||||
|
||||
@Column
|
||||
@Comment("是否领队")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isLeader;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.budwk.app.module.activity.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/4/28 17:55
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Comment("活动项目队伍得分表")
|
||||
@Table("act_item_group_score")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class ActItemGroupScore extends BaseModel {
|
||||
|
||||
@Id
|
||||
@Comment("ID")
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
@Comment("活动ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long activityId;
|
||||
|
||||
@Column
|
||||
@Comment("活动项目ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long itemId;
|
||||
|
||||
@Column
|
||||
@Comment("队伍ID")
|
||||
@ColDefine(customType = "bigint")
|
||||
private Long groupId;
|
||||
|
||||
@Column
|
||||
@Comment("队伍得分")
|
||||
@ColDefine(customType = "decimal", width = 10, precision = 2)
|
||||
private BigDecimal score;
|
||||
|
||||
@Column
|
||||
@Comment("队伍排名")
|
||||
private Integer rank;
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Table("act_item_user")
|
||||
@Comment("项目报名人员")
|
||||
|
||||
Reference in New Issue
Block a user