|
|
|
@ -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,9 +51,7 @@ public class CompetitionRegistrationController { |
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@ApiOperation(value = "个人活动报名") |
|
|
|
|
@PostMapping("/individualEventRegistration") |
|
|
|
|
public R individualEventRegistration( |
|
|
|
|
@ApiParam(name = "competitionRegistration", value = "报名人员对象", required = true) |
|
|
|
|
@RequestBody CompetitionRegistration competitionRegistration, HttpServletRequest request) { |
|
|
|
|
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<String> ids) { |
|
|
|
|
public R disableContests(@ApiParam(name = "ids", value = "多个id", required = true) @RequestParam("ids") List<String> 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<RegistrationVO> listOfExportSub, |
|
|
|
|
HttpServletResponse response, HttpServletRequest request) throws Exception { |
|
|
|
|
public void exportSubscribedRecords(@RequestBody List<RegistrationVO> 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(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|