完成后台新增报名人员相关接口

main
rong.liu 11 months ago
parent 5a4248bf6f
commit a54b19497d
  1. 93
      competition/src/main/java/com/huoran/competition/controller/CompetitionRegistrationController.java
  2. 8
      competition/src/main/java/com/huoran/competition/entity/CompetitionRegistration.java
  3. 48
      competition/src/main/java/com/huoran/competition/entity/vo/RegistrationNewInformationBroughtOutVO.java
  4. 2
      competition/src/main/java/com/huoran/competition/entity/vo/RegistrationVO.java
  5. 6
      competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java
  6. 75
      competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml
  7. 7
      competition/src/main/java/com/huoran/competition/service/CompetitionRegistrationService.java
  8. 12
      competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java

@ -6,12 +6,14 @@ import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils; import com.huoran.common.utils.TokenUtils;
import com.huoran.competition.entity.CompetitionRegistration; import com.huoran.competition.entity.CompetitionRegistration;
import com.huoran.competition.entity.req.PageRegistrationStaffReq; 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.entity.vo.RegistrationVO;
import com.huoran.competition.service.CompetitionRegistrationService; import com.huoran.competition.service.CompetitionRegistrationService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -34,14 +36,11 @@ public class CompetitionRegistrationController {
@Autowired @Autowired
private CompetitionRegistrationService competitionRegistrationService; private CompetitionRegistrationService competitionRegistrationService;
@NoRepeatSubmit @NoRepeatSubmit
@ApiOperation(value = "是否禁用报名人员") @ApiOperation(value = "是否禁用报名人员")
@PutMapping("/disableRegistration") @PutMapping("/disableRegistration")
public R disableRegistration( public R disableRegistration(@ApiParam(name = "competitionRegistrationId", value = "报名人员id", required = true) @RequestParam Integer competitionRegistrationId, @ApiParam(name = "isDisable", value = "是否禁用", required = true) @RequestParam Integer isDisable) {
@ApiParam(name = "competitionRegistrationId", value = "报名人员id", required = true)
@RequestParam Integer competitionRegistrationId,
@ApiParam(name = "isDisable", value = "是否禁用", required = true)
@RequestParam Integer isDisable) {
CompetitionRegistration competitionRegistration = new CompetitionRegistration(); CompetitionRegistration competitionRegistration = new CompetitionRegistration();
competitionRegistration.setId(competitionRegistrationId); competitionRegistration.setId(competitionRegistrationId);
competitionRegistration.setIsDisable(isDisable); competitionRegistration.setIsDisable(isDisable);
@ -52,9 +51,7 @@ public class CompetitionRegistrationController {
@NoRepeatSubmit @NoRepeatSubmit
@ApiOperation(value = "个人活动报名") @ApiOperation(value = "个人活动报名")
@PostMapping("/individualEventRegistration") @PostMapping("/individualEventRegistration")
public R individualEventRegistration( public R individualEventRegistration(@ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) @RequestBody CompetitionRegistration competitionRegistration, HttpServletRequest request) {
@ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true)
@RequestBody CompetitionRegistration competitionRegistration, HttpServletRequest request) {
if (competitionRegistration.getAccountId() == null) { if (competitionRegistration.getAccountId() == null) {
String accountId = TokenUtils.getIdByJwtToken(request); String accountId = TokenUtils.getIdByJwtToken(request);
competitionRegistration.setAccountId(Integer.valueOf(accountId)); competitionRegistration.setAccountId(Integer.valueOf(accountId));
@ -65,19 +62,15 @@ public class CompetitionRegistrationController {
@ApiOperation(value = "报名人员列表", response = RegistrationVO.class) @ApiOperation(value = "报名人员列表", response = RegistrationVO.class)
@PostMapping("/queryRegistrationByCondition") @PostMapping("/queryRegistrationByCondition")
public R registrationPageList( public R registrationPageList(@RequestBody PageRegistrationStaffReq req, HttpServletRequest request) {
@RequestBody PageRegistrationStaffReq req, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request); String accountId = TokenUtils.getIdByJwtToken(request);
return competitionRegistrationService.registrationPageConditionQuery(req); return competitionRegistrationService.registrationPageConditionQuery(req);
} }
@ApiOperation(value = "批量禁用人员参赛") @ApiOperation(value = "批量禁用人员参赛")
@PutMapping("/disableContests") @PutMapping("/disableContests")
public R disableContests( public R disableContests(@ApiParam(name = "ids", value = "多个id", required = true) @RequestParam("ids") List<String> ids) {
@ApiParam(name = "ids", value = "多个id", required = true)
@RequestParam("ids") List<String> ids) {
if (ids != null && ids.size() != 0) { if (ids != null && ids.size() != 0) {
boolean delete = competitionRegistrationService.disableContests(ids); boolean delete = competitionRegistrationService.disableContests(ids);
return delete ? R.ok() : R.error(); return delete ? R.ok() : R.error();
@ -88,9 +81,7 @@ public class CompetitionRegistrationController {
@ApiOperation(value = "导出全部数据", response = RegistrationVO.class) @ApiOperation(value = "导出全部数据", response = RegistrationVO.class)
@GetMapping("/excelExport") @GetMapping("/excelExport")
public void excelExport( public void excelExport(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletResponse response) {
@ApiParam(name = "competitionId", value = "活动ID", required = true)
@RequestParam("competitionId") String competitionId, HttpServletResponse response) {
try { try {
PageRegistrationStaffReq req = new PageRegistrationStaffReq(); PageRegistrationStaffReq req = new PageRegistrationStaffReq();
req.setCompetitionId(competitionId); req.setCompetitionId(competitionId);
@ -104,20 +95,76 @@ public class CompetitionRegistrationController {
@ApiOperation(value = "批量导出数据") @ApiOperation(value = "批量导出数据")
@PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8") @PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8")
public void exportSubscribedRecords( public void exportSubscribedRecords(@RequestBody List<RegistrationVO> listOfExportSub, HttpServletResponse response, HttpServletRequest request) throws Exception {
@RequestBody List<RegistrationVO> listOfExportSub,
HttpServletResponse response, HttpServletRequest request) throws Exception {
competitionRegistrationService.exportDataInBatches(listOfExportSub, response); competitionRegistrationService.exportDataInBatches(listOfExportSub, response);
} }
@ApiOperation(value = "取消报名") @ApiOperation(value = "取消报名")
@PostMapping(value = "/cancelRegistration") @PostMapping(value = "/cancelRegistration")
public R cancelRegistration( public R cancelRegistration(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletRequest request) throws Exception {
@ApiParam(name = "competitionId", value = "活动ID", required = true)
@RequestParam("competitionId") String competitionId, HttpServletRequest request) throws Exception {
String accountId = TokenUtils.getIdByJwtToken(request); String accountId = TokenUtils.getIdByJwtToken(request);
return competitionRegistrationService.cancelRegistration(competitionId, Integer.valueOf(accountId)); 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();
}
} }

@ -1,5 +1,6 @@
package com.huoran.competition.entity; package com.huoran.competition.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import java.util.Date; import java.util.Date;
@ -59,4 +60,11 @@ public class CompetitionRegistration implements Serializable {
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "签到情况(签到状态(0待签到 1.已签到 2未签到:活动结束后没签到的))")
private String signInStatus;
@ApiModelProperty(value = "签到时间")
private String signInTime;
} }

@ -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;
}

@ -62,6 +62,8 @@ public class RegistrationVO {
@ApiModelProperty(value = "当前报名生成的主键id(用于禁用/删除等报名人员)") @ApiModelProperty(value = "当前报名生成的主键id(用于禁用/删除等报名人员)")
private Integer id; private Integer id;

@ -6,6 +6,7 @@ import com.huoran.common.entity.School;
import com.huoran.competition.entity.CompetitionRegistration; import com.huoran.competition.entity.CompetitionRegistration;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huoran.competition.entity.req.PageRegistrationStaffReq; 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.entity.vo.RegistrationVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -34,4 +35,9 @@ public interface CompetitionRegistrationMapper extends BaseMapper<CompetitionReg
String selectSchoolName(@Param("accountId")String accountId); String selectSchoolName(@Param("accountId")String accountId);
Integer countTheNumberOfApplicants(@Param("competitionId")Integer competitionId); Integer countTheNumberOfApplicants(@Param("competitionId")Integer competitionId);
//根据手机号带出账户组织信息
List<RegistrationNewInformationBroughtOutVO> getOrganizationalInformation(@Param("phone")String phone,@Param("accountId")Integer accountId);
RegistrationNewInformationBroughtOutVO detailsOfApplicants(@Param("accountId")Integer accountId,@Param("competitionId")String competitionId);
} }

@ -44,10 +44,11 @@
a.phone, a.phone,
u.user_avatars, u.user_avatars,
IFNULL( c.classification_name, '无' ) AS organizationName, 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, r.create_time,
sign_in_status, ( CASE sign_in_status WHEN 0 THEN '待签到' WHEN 1 THEN '已签到' WHEN 2 THEN '未签到' ELSE '无' END ) AS signInStatus,
sign_in_time sign_in_time,
r.is_disable
FROM FROM
c_competition_registration r c_competition_registration r
INNER JOIN nakadai.hr_user_account a ON a.id = r.account_id 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_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 t ON t.manage_id = ta.manage_id
LEFT JOIN nakadai.k_platform_team_classification c ON c.id = t.classification_id LEFT JOIN nakadai.k_platform_team_classification c ON c.id = t.classification_id
where 1=1
<if test=" req.platformId!=null">
and a.platform_id = #{req.platformId}
</if>
<if test=" req.signInStatus!=null ">
and r.sign_in_status = #{req.signInStatus}
</if>
) temp, ) temp,
( SELECT @row_number := 0 ) AS t ( SELECT @row_number := 0 ) AS t
WHERE WHERE
@ -71,13 +80,9 @@
like CONCAT('%',#{req.keyWord},'%') like CONCAT('%',#{req.keyWord},'%')
</if> </if>
<if test=" req.signInStatus!=null ">
and temp.sign_in_status = #{req.signInStatus}
</if>
<if test=" req.platformId!=null">
and temp.platformId = #{req.platformId}
</if>
ORDER BY ORDER BY
temp.create_time DESC temp.create_time DESC
@ -140,4 +145,56 @@
WHERE WHERE
r.competition_id = #{competitionId} r.competition_id = #{competitionId}
</select> </select>
<select id="getOrganizationalInformation"
resultType="com.huoran.competition.entity.vo.RegistrationNewInformationBroughtOutVO">
SELECT
u.user_name,
a.id AS accountId,
c.classification_name AS organizationName,
( CASE ta.platform_id WHEN 6 THEN '供应商' WHEN 5 THEN '幼儿园' END ) AS platformId
FROM
nakadai.hr_user_account a
INNER JOIN nakadai.hr_user_info u ON u.user_id = a.user_id
AND u.is_del = 0
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
a.is_del = 0
<if test="accountId != null">
AND a.id = #{accountId}
</if>
<if test="phone!=null and phone!=''">
AND a.phone = #{phone}
</if>
</select>
<select id="detailsOfApplicants"
resultType="com.huoran.competition.entity.vo.RegistrationNewInformationBroughtOutVO">
SELECT
r.id,
competition_id,
a.phone,
u.user_name,
r.create_time,
sign_in_time,
a.id AS accountId,
c.classification_name AS organizationName,
( CASE ta.platform_id WHEN 6 THEN '供应商' WHEN 5 THEN '幼儿园' END ) AS platformId,
( CASE sign_in_status WHEN 0 THEN '待签到' WHEN 1 THEN '已签到' WHEN 2 THEN '未签到' ELSE '无' END ) AS signInStatus
FROM
occupationlab.c_competition_registration r
INNER JOIN nakadai.hr_user_account a ON a.id = r.account_id
AND a.is_del = 0
INNER JOIN nakadai.hr_user_info u ON u.user_id = a.user_id
AND u.is_del = 0
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
r.competition_id = #{competitionId}
AND r.account_id = #{accountId}
</select>
</mapper> </mapper>

@ -5,6 +5,7 @@ import com.huoran.common.response.R;
import com.huoran.competition.entity.CompetitionRegistration; import com.huoran.competition.entity.CompetitionRegistration;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.competition.entity.req.PageRegistrationStaffReq; 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.entity.vo.RegistrationVO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -38,4 +39,10 @@ public interface CompetitionRegistrationService extends IService<CompetitionRegi
CompetitionRegistration enquireWhetherToRegister(Integer accountId,String competitionId); CompetitionRegistration enquireWhetherToRegister(Integer accountId,String competitionId);
Integer registrationPopulation(String competitionId) ; Integer registrationPopulation(String competitionId) ;
//根据手机号或者账户id带出组织信息
R getOrganizationalInformation(String phone,Integer accountId);
R detailsOfApplicants(Integer accountId,String competitionId);
} }

@ -15,6 +15,7 @@ import com.huoran.common.response.R;
import com.huoran.competition.entity.Competition; import com.huoran.competition.entity.Competition;
import com.huoran.competition.entity.CompetitionRegistration; import com.huoran.competition.entity.CompetitionRegistration;
import com.huoran.competition.entity.req.PageRegistrationStaffReq; 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.entity.vo.RegistrationVO;
import com.huoran.competition.mapper.*; import com.huoran.competition.mapper.*;
import com.huoran.competition.service.CompetitionRangeService; import com.huoran.competition.service.CompetitionRangeService;
@ -293,4 +294,15 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl<CompetitionR
// return competitionRegistrations.size(); // return competitionRegistrations.size();
return baseMapper.countTheNumberOfApplicants(Integer.valueOf(competitionId)); return baseMapper.countTheNumberOfApplicants(Integer.valueOf(competitionId));
} }
@Override
public R getOrganizationalInformation(String phone, Integer accountId) {
return R.ok().put("data", baseMapper.getOrganizationalInformation(phone, accountId));
}
@Override
public R detailsOfApplicants(Integer accountId, String competitionId) {
RegistrationNewInformationBroughtOutVO informationBroughtOutVO = baseMapper.detailsOfApplicants(accountId, competitionId);
return R.ok().put("data", informationBroughtOutVO);
}
} }

Loading…
Cancel
Save