From 97d5da6a855c16790b0ea582c25d9e92002776eb Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Tue, 9 Jan 2024 15:03:17 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionRegistrationController.java | 3 +- .../entity/req/PageRegistrationStaffReq.java | 25 ++-- .../competition/entity/vo/RegistrationVO.java | 57 +++++---- .../xml/CompetitionRegistrationMapper.xml | 114 +++++++---------- .../CompetitionRegistrationServiceImpl.java | 118 ++++++++++-------- .../AliRealNameAuthenticationController.java | 2 +- 6 files changed, 154 insertions(+), 165 deletions(-) diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java index 04a26ea..96e43be 100644 --- a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java @@ -63,7 +63,7 @@ public class CompetitionRegistrationController { } - @ApiOperation(value = "报名人员分页条件查询", response = RegistrationVO.class) + @ApiOperation(value = "报名人员列表", response = RegistrationVO.class) @PostMapping("/queryRegistrationByCondition") public R registrationPageList( @RequestBody PageRegistrationStaffReq req, HttpServletRequest request) { @@ -72,6 +72,7 @@ public class CompetitionRegistrationController { } + @ApiOperation(value = "批量禁用人员参赛") @PutMapping("/disableContests") public R disableContests( diff --git a/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java b/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java index 3a00dba..0a8d670 100644 --- a/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java +++ b/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java @@ -11,29 +11,26 @@ import lombok.Data; */ @Data @ApiModel(value = "报名人员分页参数列表") -public class PageRegistrationStaffReq extends PageReq{ +public class PageRegistrationStaffReq extends PageReq { - @ApiModelProperty(value = "关键词(学生姓名/手机号)",example = "18818574533") + @ApiModelProperty(value = "关键词(学生姓名/手机号)", example = "18818574533") private String keyWord; - @ApiModelProperty(value = "活动ID",example = "1485860415656255489") + @ApiModelProperty(value = "活动ID", example = "1485860415656255489") private String competitionId; - private Integer pageNum; - - private Integer pageSize; - - @ApiModelProperty(value = "禁用启用0未禁用,1禁用",example = "0") + @ApiModelProperty(value = "禁用启用0未禁用,1禁用", example = "0") private Integer isDisable; - @ApiModelProperty(value = "学校排序标识",example = "1正序,2倒序") - private Integer schoolOrder; - - @ApiModelProperty(value = "团队排序标识",example = "null") - private Integer teamOrder; - @ApiModelProperty(value = "查询来源(1.前台/2.后台)") private Integer querySource; + @ApiModelProperty(value = "平台来源(5:幼儿园,6:供应商)", example = "5") + private Integer platformId; + + @ApiModelProperty(value = "签到状态(0待签到 1.已签到 2未签到:活动结束后没签到的)", example = "5") + private Integer signInStatus; + + } \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java index 4bd0829..537bfde 100644 --- a/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java +++ b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java @@ -1,6 +1,5 @@ package com.huoran.competition.entity.vo; -import ch.qos.logback.core.rolling.helper.IntegerTokenConverter; import cn.afterturn.easypoi.excel.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -13,38 +12,43 @@ public class RegistrationVO { private Integer rownum; - @ApiModelProperty(value = "学校") - @Excel(name = "学校", orderNum = "2", mergeVertical = true, isImportField = "school", width = 30) - private String school; - - @ApiModelProperty(value = "学生姓名") - @Excel(name = "学生姓名", orderNum = "3", mergeVertical = true, isImportField = "username", width = 30) + @ApiModelProperty(value = "姓名") + @Excel(name = "姓名", orderNum = "2", isImportField = "username", width = 30) private String username; - - @ApiModelProperty(value = "手机号") - @Excel(name = "手机号", orderNum = "4", mergeVertical = true, isImportField = "phone", width = 30) - private String phone; + @ApiModelProperty(value = "组织名称") + @Excel(name = "组织名称", orderNum = "3", isImportField = "organizationName", width = 30) + private String organizationName; - @ApiModelProperty(value = "学号") - @Excel(name = "学号", orderNum = "5", mergeVertical = true, isImportField = "workNumber", width = 30) - private String workNumber; + @ApiModelProperty(value = "组织类型/平台来源(5:幼儿园,6:供应商) 没有数据显示'无'") + @Excel(name = "组织类型", orderNum = "4", isImportField = "platformId", width = 30) + private String platformId; @ApiModelProperty(value = "报名时间") - @Excel(name = "报名时间", orderNum = "6", mergeVertical = true, isImportField = "createTime", width = 30) + @Excel(name = "报名时间", orderNum = "5", isImportField = "createTime", width = 30) private String createTime; - @ApiModelProperty(value = "团队名称") - @Excel(name = "团队名称", orderNum = "7", mergeVertical = true, isImportField = "teamName", width = 30) - private String teamName; + + @ApiModelProperty(value = "签到情况(签到状态(0待签到 1.已签到 2未签到:活动结束后没签到的))") + @Excel(name = "签到情况", orderNum = "6", isImportField = "signInStatus", width = 30) + private String signInStatus; + + + @ApiModelProperty(value = "签到时间") + @Excel(name = "签到时间", orderNum = "7", isImportField = "signInTime", width = 30) + private String signInTime; + + + @ApiModelProperty(value = "手机号") + @Excel(name = "手机号", orderNum = "8", isImportField = "phone", width = 30) + private String phone; + @ApiModelProperty(value = "头像") private String userAvatars; - @ApiModelProperty(value = "团队id") - private Integer teamId; @ApiModelProperty(value = "账号id") private Integer accountId; @@ -52,18 +56,17 @@ public class RegistrationVO { @ApiModelProperty(value = "用户id") private Integer userId; - @ApiModelProperty(value = "学校id") - private Integer schoolId; + @ApiModelProperty(value = "活动id") + private Integer competitionId; + + + - @ApiModelProperty(value = "报名id") + @ApiModelProperty(value = "当前报名生成的主键id(用于禁用/删除等报名人员)") private Integer id; @ApiModelProperty(value = "是否禁用") private Integer isDisable; - @ApiModelProperty(value = "是否队长") - private Integer captain; - @ApiModelProperty(value = "内部标识") - private Integer identification; } diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml index 0dcd274..1314801 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml @@ -21,8 +21,16 @@ + diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionService.java index 2bd3bcc..ca8eed5 100644 --- a/competition/src/main/java/com/huoran/competition/service/CompetitionService.java +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionService.java @@ -43,4 +43,7 @@ public interface CompetitionService extends IService { List queryCompetitionStage(String competitionId, String accountId); R isParticipant(IsParticipantReq req); + + //查询当前账户的角色 + String queryRole(String accountId); } diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java index c3ad901..290c092 100644 --- a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java @@ -613,4 +613,9 @@ public class CompetitionServiceImpl extends ServiceImpl Date: Wed, 10 Jan 2024 17:34:34 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=A5=E5=90=8D=E4=BA=BA=E5=91=98=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionRegistrationController.java | 95 ++++++++++++++----- .../entity/CompetitionRegistration.java | 8 ++ ...egistrationNewInformationBroughtOutVO.java | 48 ++++++++++ .../competition/entity/vo/RegistrationVO.java | 2 + .../mapper/CompetitionRegistrationMapper.java | 6 ++ .../xml/CompetitionRegistrationMapper.xml | 75 +++++++++++++-- .../CompetitionRegistrationService.java | 7 ++ .../CompetitionRegistrationServiceImpl.java | 12 +++ 8 files changed, 220 insertions(+), 33 deletions(-) create mode 100644 competition/src/main/java/com/huoran/competition/entity/vo/RegistrationNewInformationBroughtOutVO.java diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java index 96e43be..b889b9e 100644 --- a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java @@ -6,12 +6,14 @@ import com.huoran.common.response.R; import com.huoran.common.utils.TokenUtils; import com.huoran.competition.entity.CompetitionRegistration; import com.huoran.competition.entity.req.PageRegistrationStaffReq; +import com.huoran.competition.entity.vo.RegistrationNewInformationBroughtOutVO; import com.huoran.competition.entity.vo.RegistrationVO; import com.huoran.competition.service.CompetitionRegistrationService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -34,14 +36,11 @@ public class CompetitionRegistrationController { @Autowired private CompetitionRegistrationService competitionRegistrationService; + @NoRepeatSubmit @ApiOperation(value = "是否禁用报名人员") @PutMapping("/disableRegistration") - public R disableRegistration( - @ApiParam(name = "competitionRegistrationId", value = "报名人员id", required = true) - @RequestParam Integer competitionRegistrationId, - @ApiParam(name = "isDisable", value = "是否禁用", required = true) - @RequestParam Integer isDisable) { + public R disableRegistration(@ApiParam(name = "competitionRegistrationId", value = "报名人员id", required = true) @RequestParam Integer competitionRegistrationId, @ApiParam(name = "isDisable", value = "是否禁用", required = true) @RequestParam Integer isDisable) { CompetitionRegistration competitionRegistration = new CompetitionRegistration(); competitionRegistration.setId(competitionRegistrationId); competitionRegistration.setIsDisable(isDisable); @@ -52,10 +51,8 @@ public class CompetitionRegistrationController { @NoRepeatSubmit @ApiOperation(value = "个人活动报名") @PostMapping("/individualEventRegistration") - public R individualEventRegistration( - @ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) - @RequestBody CompetitionRegistration competitionRegistration, HttpServletRequest request) { - if (competitionRegistration.getAccountId()==null){ + public R individualEventRegistration(@ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) @RequestBody CompetitionRegistration competitionRegistration, HttpServletRequest request) { + if (competitionRegistration.getAccountId() == null) { String accountId = TokenUtils.getIdByJwtToken(request); competitionRegistration.setAccountId(Integer.valueOf(accountId)); } @@ -65,19 +62,15 @@ public class CompetitionRegistrationController { @ApiOperation(value = "报名人员列表", response = RegistrationVO.class) @PostMapping("/queryRegistrationByCondition") - public R registrationPageList( - @RequestBody PageRegistrationStaffReq req, HttpServletRequest request) { + public R registrationPageList(@RequestBody PageRegistrationStaffReq req, HttpServletRequest request) { String accountId = TokenUtils.getIdByJwtToken(request); return competitionRegistrationService.registrationPageConditionQuery(req); } - @ApiOperation(value = "批量禁用人员参赛") @PutMapping("/disableContests") - public R disableContests( - @ApiParam(name = "ids", value = "多个id", required = true) - @RequestParam("ids") List ids) { + public R disableContests(@ApiParam(name = "ids", value = "多个id", required = true) @RequestParam("ids") List ids) { if (ids != null && ids.size() != 0) { boolean delete = competitionRegistrationService.disableContests(ids); return delete ? R.ok() : R.error(); @@ -88,9 +81,7 @@ public class CompetitionRegistrationController { @ApiOperation(value = "导出全部数据", response = RegistrationVO.class) @GetMapping("/excelExport") - public void excelExport( - @ApiParam(name = "competitionId", value = "活动ID", required = true) - @RequestParam("competitionId") String competitionId, HttpServletResponse response) { + public void excelExport(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletResponse response) { try { PageRegistrationStaffReq req = new PageRegistrationStaffReq(); req.setCompetitionId(competitionId); @@ -104,20 +95,76 @@ public class CompetitionRegistrationController { @ApiOperation(value = "批量导出数据") @PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8") - public void exportSubscribedRecords( - @RequestBody List listOfExportSub, - HttpServletResponse response, HttpServletRequest request) throws Exception { + public void exportSubscribedRecords(@RequestBody List listOfExportSub, HttpServletResponse response, HttpServletRequest request) throws Exception { competitionRegistrationService.exportDataInBatches(listOfExportSub, response); } @ApiOperation(value = "取消报名") @PostMapping(value = "/cancelRegistration") - public R cancelRegistration( - @ApiParam(name = "competitionId", value = "活动ID", required = true) - @RequestParam("competitionId") String competitionId, HttpServletRequest request) throws Exception { + public R cancelRegistration(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletRequest request) throws Exception { String accountId = TokenUtils.getIdByJwtToken(request); return competitionRegistrationService.cancelRegistration(competitionId, Integer.valueOf(accountId)); } + + @ApiOperation(value = "手机号带出组织信息", response = RegistrationNewInformationBroughtOutVO.class) + @PostMapping("/getOrganizationInformationByPhone") + public R getOrganizationInformationByPhone(@ApiParam(name = "phone", value = "手机号", required = true) @RequestParam("phone") String phone, HttpServletResponse response) { + return competitionRegistrationService.getOrganizationalInformation(phone, null); + + } + + + @ApiOperation(value = "后台-新增报名人员(这里的账号id必传,根据手机号带出的账号信息选中)") + @PostMapping("/addNewApplicantsInTheBackground") + public R addNewApplicantsInTheBackground(@ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) @RequestBody CompetitionRegistration competitionRegistration) { + if (ObjectUtils.isEmpty(competitionRegistration.getAccountId())) { + return R.error("账号id不能为空"); + } + boolean flag = competitionRegistrationService.save(competitionRegistration); + return flag ? R.ok() : R.error("新增失败"); + } + + @ApiOperation(value = "后台-报名人员详情(必填,列表返回的账号id)", response = RegistrationNewInformationBroughtOutVO.class) + @PostMapping("/detailsOfApplicants") + public R detailsOfApplicants(@ApiParam(name = "accountId", value = "账号id(列表返回的账号id)", required = true) @RequestParam("accountId") Integer accountId, @ApiParam(name = "competitionId", value = "活动id", required = true) @RequestParam("accountId") String competitionId) { + if (ObjectUtils.isEmpty(accountId)) { + return R.error("账号id不能为空"); + } + return competitionRegistrationService.detailsOfApplicants(accountId, competitionId); + } + + + @ApiOperation(value = "后台-编辑报名人员信息(此时需要传报名人员id)") + @PostMapping("/editRegistrationInformation") + public R editRegistrationInformation(@ApiParam(name = "info", value = "编辑报名人员详情对象", required = true) @RequestBody RegistrationNewInformationBroughtOutVO info) { + if (ObjectUtils.isEmpty(info.getAccountId())) { + return R.error("账号id不能为空"); + } + //判断活动id不能为空 + if (ObjectUtils.isEmpty(info.getCompetitionId())) { + return R.error("活动id不能为空"); + } + boolean flag = true; + //获取原报名信息 + CompetitionRegistration registration = competitionRegistrationService.getById(info.getId()); + if (!ObjectUtils.isEmpty(registration)) { + //需求:如果时间被清空情况下,签到状态变更为未签到 + if (ObjectUtils.isEmpty(info.getSignInTime())) { + registration.setSignInStatus(String.valueOf(2)); + } + + //判断如果账号id不等于原登记的账户id,则账号id做更改 + if (!info.getAccountId().equals(registration.getAccountId())) { + registration.setAccountId(info.getAccountId()); + } + + flag = competitionRegistrationService.updateById(registration); + + } + + + return flag ? R.ok() : R.error(); + } } diff --git a/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java b/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java index 263f605..a504914 100644 --- a/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java +++ b/competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java @@ -1,5 +1,6 @@ package com.huoran.competition.entity; +import cn.afterturn.easypoi.excel.annotation.Excel; import com.baomidou.mybatisplus.annotation.*; import java.util.Date; @@ -59,4 +60,11 @@ public class CompetitionRegistration implements Serializable { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; + @ApiModelProperty(value = "签到情况(签到状态(0待签到 1.已签到 2未签到:活动结束后没签到的))") + private String signInStatus; + + + @ApiModelProperty(value = "签到时间") + private String signInTime; + } diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationNewInformationBroughtOutVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationNewInformationBroughtOutVO.java new file mode 100644 index 0000000..d8e2822 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationNewInformationBroughtOutVO.java @@ -0,0 +1,48 @@ +package com.huoran.competition.entity.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class RegistrationNewInformationBroughtOutVO { + + @ApiModelProperty(value = "报名人员主键id(编辑时传)") + private Integer id; + + @ApiModelProperty(value = "姓名") + private String userName; + + @ApiModelProperty(value = "组织名称") + private String organizationName; + + + @ApiModelProperty(value = "组织类型/平台来源(5:幼儿园,6:供应商) 没有数据显示'无'") + private String platformId; + + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "账号id") + private Integer accountId; + + @ApiModelProperty(value = "活动id") + private Integer competitionId; + + + @ApiModelProperty(value = "报名时间") + private String createTime; + + + @ApiModelProperty(value = "签到状态") + private String signInStatus; + + + @ApiModelProperty(value = "签到时间") + private String signInTime; + + + + +} diff --git a/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java index 537bfde..382eca5 100644 --- a/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java +++ b/competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java @@ -62,6 +62,8 @@ public class RegistrationVO { + + @ApiModelProperty(value = "当前报名生成的主键id(用于禁用/删除等报名人员)") private Integer id; diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java index ec52c8b..caf18df 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java @@ -6,6 +6,7 @@ import com.huoran.common.entity.School; import com.huoran.competition.entity.CompetitionRegistration; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huoran.competition.entity.req.PageRegistrationStaffReq; +import com.huoran.competition.entity.vo.RegistrationNewInformationBroughtOutVO; import com.huoran.competition.entity.vo.RegistrationVO; import org.apache.ibatis.annotations.Param; @@ -34,4 +35,9 @@ public interface CompetitionRegistrationMapper extends BaseMapper getOrganizationalInformation(@Param("phone")String phone,@Param("accountId")Integer accountId); + + RegistrationNewInformationBroughtOutVO detailsOfApplicants(@Param("accountId")Integer accountId,@Param("competitionId")String competitionId); + } diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml index 1314801..8c388dc 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml @@ -44,10 +44,11 @@ a.phone, u.user_avatars, IFNULL( c.classification_name, '无' ) AS organizationName, - IFNULL( ta.platform_id, '无' ) AS platformId, + ( CASE ta.platform_id WHEN 6 THEN '供应商' WHEN 5 THEN '幼儿园' ELSE '无' END ) AS platformId, r.create_time, - sign_in_status, - sign_in_time + ( CASE sign_in_status WHEN 0 THEN '待签到' WHEN 1 THEN '已签到' WHEN 2 THEN '未签到' ELSE '无' END ) AS signInStatus, + sign_in_time, + r.is_disable FROM c_competition_registration r INNER JOIN nakadai.hr_user_account a ON a.id = r.account_id @@ -57,6 +58,14 @@ LEFT JOIN nakadai.k_platform_team_account ta ON ta.account_id = a.id LEFT JOIN nakadai.k_platform_team t ON t.manage_id = ta.manage_id LEFT JOIN nakadai.k_platform_team_classification c ON c.id = t.classification_id + where 1=1 + + and a.platform_id = #{req.platformId} + + + + and r.sign_in_status = #{req.signInStatus} + ) temp, ( SELECT @row_number := 0 ) AS t WHERE @@ -71,13 +80,9 @@ like CONCAT('%',#{req.keyWord},'%') - - and temp.sign_in_status = #{req.signInStatus} - - - and temp.platformId = #{req.platformId} - + + ORDER BY temp.create_time DESC @@ -140,4 +145,56 @@ WHERE r.competition_id = #{competitionId} + + + diff --git a/competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java b/competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java index ebf66a2..a905615 100644 --- a/competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java +++ b/competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java @@ -5,6 +5,7 @@ import com.huoran.common.response.R; import com.huoran.competition.entity.CompetitionRegistration; import com.baomidou.mybatisplus.extension.service.IService; import com.huoran.competition.entity.req.PageRegistrationStaffReq; +import com.huoran.competition.entity.vo.RegistrationNewInformationBroughtOutVO; import com.huoran.competition.entity.vo.RegistrationVO; import javax.servlet.http.HttpServletResponse; @@ -38,4 +39,10 @@ public interface CompetitionRegistrationService extends IService Date: Wed, 10 Jan 2024 17:57:47 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E4=BA=BA=E5=91=98=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionRegistrationController.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java index b889b9e..aa5e47d 100644 --- a/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java @@ -1,6 +1,7 @@ package com.huoran.competition.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.huoran.common.aop.annotation.NoRepeatSubmit; import com.huoran.common.response.R; import com.huoran.common.utils.TokenUtils; @@ -115,19 +116,35 @@ public class CompetitionRegistrationController { } + //校验是否已经报名活动 + public boolean isRegistered(Integer accountId, Integer competitionId) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", accountId); + queryWrapper.eq("competition_id", competitionId); + CompetitionRegistration competitionRegistration = competitionRegistrationService.getOne(queryWrapper); + return competitionRegistration != null; + } + + @ApiOperation(value = "后台-新增报名人员(这里的账号id必传,根据手机号带出的账号信息选中)") @PostMapping("/addNewApplicantsInTheBackground") public R addNewApplicantsInTheBackground(@ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) @RequestBody CompetitionRegistration competitionRegistration) { if (ObjectUtils.isEmpty(competitionRegistration.getAccountId())) { return R.error("账号id不能为空"); } + //校验是否已经报名活动过 + if (isRegistered(competitionRegistration.getAccountId(), competitionRegistration.getCompetitionId())) { + return R.error("该账号已报名该活动"); + } boolean flag = competitionRegistrationService.save(competitionRegistration); return flag ? R.ok() : R.error("新增失败"); } @ApiOperation(value = "后台-报名人员详情(必填,列表返回的账号id)", response = RegistrationNewInformationBroughtOutVO.class) @PostMapping("/detailsOfApplicants") - public R detailsOfApplicants(@ApiParam(name = "accountId", value = "账号id(列表返回的账号id)", required = true) @RequestParam("accountId") Integer accountId, @ApiParam(name = "competitionId", value = "活动id", required = true) @RequestParam("accountId") String competitionId) { + public R detailsOfApplicants(@ApiParam(name = "accountId", value = "账号id(列表返回的账号id)", required = true) @RequestParam("accountId") Integer accountId, + @ApiParam(name = "competitionId", value = "活动id", required = true) @RequestParam("competitionId") String competitionId) { if (ObjectUtils.isEmpty(accountId)) { return R.error("账号id不能为空"); } @@ -145,6 +162,10 @@ public class CompetitionRegistrationController { if (ObjectUtils.isEmpty(info.getCompetitionId())) { return R.error("活动id不能为空"); } + //校验是否已经报名活动过 + if (isRegistered(info.getAccountId(), info.getCompetitionId())) { + return R.error("该账号已报名该活动"); + } boolean flag = true; //获取原报名信息 CompetitionRegistration registration = competitionRegistrationService.getById(info.getId());