From a54b19497d8cc5bb21967cbdae73613dad288fdc Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Wed, 10 Jan 2024 17:34:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=8E=E5=8F=B0=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8A=A5=E5=90=8D=E4=BA=BA=E5=91=98=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=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