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