diff --git a/competition/src/main/java/com/huoran/competition/controller/CompetitionController.java b/competition/src/main/java/com/huoran/competition/controller/CompetitionController.java index 783921e..ce5eae7 100644 --- a/competition/src/main/java/com/huoran/competition/controller/CompetitionController.java +++ b/competition/src/main/java/com/huoran/competition/controller/CompetitionController.java @@ -2,20 +2,16 @@ package com.huoran.competition.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.huoran.api.NakadaiClient; import com.huoran.api.UserClient; import com.huoran.common.aop.annotation.NoRepeatSubmit; -import com.huoran.common.constant.DelConstant; import com.huoran.common.response.R; import com.huoran.common.utils.TokenUtils; import com.huoran.competition.entity.*; import com.huoran.competition.entity.req.AfterLoginPageCompetitionListReq; -import com.huoran.competition.entity.req.CompetitionDetailReq; import com.huoran.competition.entity.req.DisableEnableCompetitionReq; import com.huoran.competition.entity.req.PageCompetitionListReq; -import com.huoran.competition.entity.vo.CompetitionDetailsVO; import com.huoran.competition.entity.vo.CompetitionVO; import com.huoran.competition.service.*; import com.huoran.competition.service.impl.CompetitionContentServiceImpl; @@ -32,7 +28,6 @@ import java.util.Date; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; /** *

@@ -162,8 +157,6 @@ public class CompetitionController { competition.setApplicantNum(competitionRegistrationService.registrationPopulation(competitionId)); - - if (registration != null) { CompetitionTeam team = competitionTeamService.getById(registration.getTeamId()); if (team != null) { @@ -324,6 +317,10 @@ public class CompetitionController { if (!ObjectUtils.isEmpty(accountId)) { pageCompetitionListReq.setSchoolId(schoolId); pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); + Integer role = Integer.valueOf(competitionService.queryRole(accountId)); + if (!ObjectUtils.isEmpty(role)) { + pageCompetitionListReq.setRole(role); + } } Future> pageFuture = competitionService.competitionAfterLogin(pageCompetitionListReq); IPage pageList = pageFuture.get(); @@ -331,7 +328,6 @@ public class CompetitionController { } - @ApiOperation(value = "获取当前时间") @GetMapping("/getCurrentTime") public R getCurrentTime() { 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..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,17 +1,20 @@ 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; 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 +37,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 +52,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)); } @@ -63,10 +61,9 @@ public class CompetitionRegistrationController { } - @ApiOperation(value = "报名人员分页条件查询", response = RegistrationVO.class) + @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); } @@ -74,9 +71,7 @@ public class CompetitionRegistrationController { @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(); @@ -87,9 +82,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); @@ -103,20 +96,96 @@ 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); + + } + + + //校验是否已经报名活动 + 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("competitionId") 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不能为空"); + } + //校验是否已经报名活动过 + if (isRegistered(info.getAccountId(), info.getCompetitionId())) { + return R.error("该账号已报名该活动"); + } + 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/req/AfterLoginPageCompetitionListReq.java b/competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java index a8c28ca..7846204 100644 --- a/competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java +++ b/competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java @@ -38,4 +38,8 @@ public class AfterLoginPageCompetitionListReq extends PageReq{ @ApiModelProperty(value = "活动分类id") private Integer classificationId; + + //当前角色 + @ApiModelProperty(value = "当前用户角色(5:幼儿园,6:供应商)") + private Integer role; } \ No newline at end of file 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/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 4bd0829..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 @@ -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 = "3", isImportField = "organizationName", width = 30) + private String organizationName; - @ApiModelProperty(value = "手机号") - @Excel(name = "手机号", orderNum = "4", mergeVertical = true, isImportField = "phone", width = 30) - private String phone; - - @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,19 @@ 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/CompetitionMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionMapper.java index 7b655f0..058d410 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/CompetitionMapper.java +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionMapper.java @@ -60,6 +60,8 @@ public interface CompetitionMapper extends BaseMapper { //获取sys_platform表平台信息 String obtainPlatformInformation(@Param("platformId")String platformId ); + //查询当前账户的角色 + String obtainRole(@Param("accountId")Integer accountId); } 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/CompetitionMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml index 8a14349..f464722 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml @@ -714,6 +714,8 @@ WHERE c.is_open = 0 AND c.publish_status = 1 + AND (c.competition_scope = 1 + OR competition_scope = #{req.role}) and c.classification_id=#{req.classificationId} @@ -821,4 +823,18 @@ ORDER BY create_time DESC + 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..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 @@ -21,8 +21,16 @@ + + + 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 { 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/CompetitionRegistrationServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java index f027552..5ab9f0f 100644 --- a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java @@ -14,11 +14,8 @@ import com.huoran.common.exception.ExceptionEnum; import com.huoran.common.response.R; import com.huoran.competition.entity.Competition; import com.huoran.competition.entity.CompetitionRegistration; -import com.huoran.competition.entity.CompetitionTeam; -import com.huoran.competition.entity.CompleteCompetitionSetup; import com.huoran.competition.entity.req.PageRegistrationStaffReq; -import com.huoran.competition.entity.vo.ExcelData; -import com.huoran.competition.entity.vo.PersonalExcelData; +import com.huoran.competition.entity.vo.RegistrationNewInformationBroughtOutVO; import com.huoran.competition.entity.vo.RegistrationVO; import com.huoran.competition.mapper.*; import com.huoran.competition.service.CompetitionRangeService; @@ -29,7 +26,6 @@ import com.huoran.competition.utils.ExcelStyleUtil; import com.huoran.competition.utils.HandleNameAsteriskReplacementUtil; import org.apache.poi.ss.usermodel.Workbook; import org.jetbrains.annotations.NotNull; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -38,7 +34,6 @@ import org.springframework.util.ObjectUtils; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; -import java.util.ArrayList; import java.util.List; /** @@ -89,14 +84,13 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl { - registrationVO.setUsername(HandleNameAsteriskReplacementUtil.desensitizedName(registrationVO.getUsername())); - }); + pageList.getRecords().forEach(registrationVO -> { + registrationVO.setUsername(HandleNameAsteriskReplacementUtil.desensitizedName(registrationVO.getUsername())); + }); } return R.ok().put("data", pageList); @@ -142,39 +136,37 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl page = new Page(req.getPageNum(), req.getPageSize()); - IPage applicantVOList = baseMapper.selectApplicantByCondition(page, req); - QueryWrapper setupQueryWrapper = new QueryWrapper<>(); - setupQueryWrapper.eq("competition_id", req.getCompetitionId()); - CompleteCompetitionSetup setup = completeCompetitionSetupMapper.selectOne(setupQueryWrapper); - List excelDataList = new ArrayList<>(); - List personalExcelData = new ArrayList<>(); - //导出团队名称 - if (setup.getCompetitionType() == 1) { - applicantVOList.getRecords().forEach(registrationVO -> { - QueryWrapper teamQueryWrapper = new QueryWrapper<>(); - teamQueryWrapper.eq("competition_id", req.getCompetitionId()); - teamQueryWrapper.eq("account_id", registrationVO.getAccountId()); - CompetitionTeam team = competitionTeamMapper.selectOne(teamQueryWrapper); - if (team != null && team.getCaptain() == 0) { - registrationVO.setTeamName(team.getTeamName()); - } else if (team != null) { - CompetitionTeam team1 = competitionTeamMapper.selectById(team.getPid()); - registrationVO.setTeamName(team1.getTeamName()); - } - }); - applicantVOList.getRecords().forEach(applicantVO -> { - ExcelData excelData = new ExcelData(); - BeanUtils.copyProperties(applicantVO, excelData); - excelDataList.add(excelData); - }); - } else { - //个人导出列 - applicantVOList.getRecords().forEach(applicantVO -> { - PersonalExcelData personalExcelData1 = new PersonalExcelData(); - BeanUtils.copyProperties(applicantVO, personalExcelData1); - personalExcelData.add(personalExcelData1); - }); + IPage pageList = baseMapper.selectRegistrationByCondition(page, req); + + + for (RegistrationVO vo : pageList.getRecords()) { + //组织类型/平台来源(5:幼儿园,6:供应商) + switch (vo.getPlatformId()) { + case "5": + vo.setPlatformId("幼儿园"); + break; + case "6": + vo.setPlatformId("供应商"); + break; + } + + + //签到状态(0.待签到 1.已签到 2.未签到:活动结束后没签到的) + switch (vo.getSignInStatus()) { + case "0": + vo.setSignInStatus("待签到"); + break; + case "1": + vo.setSignInStatus("已签到"); + break; + case "2": + vo.setSignInStatus("未签到"); + break; + } + } // 告诉浏览器用什么软件可以打开此文件 @@ -184,12 +176,8 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl listOfExportSub, HttpServletResponse response) throws IOException { + + if (!listOfExportSub.isEmpty()) { + for (RegistrationVO vo : listOfExportSub) { + //组织类型/平台来源(5:幼儿园,6:供应商) + switch (vo.getPlatformId()) { + case "5": + vo.setPlatformId("幼儿园"); + break; + case "6": + vo.setPlatformId("供应商"); + break; + } + + + //签到状态(0.待签到 1.已签到 2.未签到:活动结束后没签到的) + switch (vo.getSignInStatus()) { + case "0": + vo.setSignInStatus("待签到"); + break; + case "1": + vo.setSignInStatus("已签到"); + break; + case "2": + vo.setSignInStatus("未签到"); + break; + } + } + } + // 告诉浏览器用什么软件可以打开此文件 response.setHeader("content-Type", "application/vnd.ms-excel"); // 下载文件的默认名称 @@ -277,4 +294,15 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl headers = new HashMap(); //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 - headers.put("Authorization", "APPCODE " + "5a7f623d06724a4da5806c1fb0544e47"); + headers.put("Authorization", "APPCODE " + "bd4ad25d0e41466eabb31d9baa16a79f");//嘉龙 Map querys = new HashMap(); querys.put("ComapnyName", enterpriseCertification.getCompanyName()); querys.put("CreditCode", enterpriseCertification.getCreditCode()); @@ -208,6 +208,10 @@ public class AliRealNameAuthenticationController { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("open_id", enterpriseCertification.getOpenId()); EnterpriseCertification certification = enterpriseCertificationService.getOne(queryWrapper); + if (certification == null) { + //通过后台删除组织信息的 + return R.error("您已没有组织信息,请联系管理人员!"); + } enterpriseCertification.setId(certification.getId()); try { HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys); @@ -280,7 +284,7 @@ public class AliRealNameAuthenticationController { String method = "GET"; Map headers = new HashMap(); //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 - headers.put("Authorization", "APPCODE " +"5a7f623d06724a4da5806c1fb0544e47"); + headers.put("Authorization", "APPCODE " + "5a7f623d06724a4da5806c1fb0544e47"); Map querys = new HashMap(); querys.put("ComapnyName", enterpriseCertification.getCompanyName()); querys.put("CreditCode", enterpriseCertification.getCreditCode()); diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java index 7fcd37c..d209d50 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java @@ -186,6 +186,7 @@ public class EnterpriseCertificationController { accountQueryWrapper1.eq("platform_id",enterpriseCertification.getPlatformSource()); HrUserAccount userAccount = userAccountService.getOne(accountQueryWrapper1);*/ + //删除团队表 UserAccount userAccount = service.queryAccountInformation(enterpriseCertification.getOpenId(), Integer.valueOf(enterpriseCertification.getPlatformSource())); service.deleteAccountInformation(userAccount.getId()); diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java index 6b18fed..2582061 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java @@ -10,6 +10,7 @@ import com.huoran.common.utils.TokenUtils; import com.huoran.nakadai.entity.PlatformTeam; import com.huoran.nakadai.entity.PlatformTeamAccount; import com.huoran.nakadai.entity.PlatformTeamClassification; +import com.huoran.nakadai.entity.SupplierClassificationConfig; import com.huoran.nakadai.entity.req.*; import com.huoran.nakadai.entity.res.PartnerAccountResp; import com.huoran.nakadai.entity.res.PlatformTeamAccountResp; @@ -154,9 +155,7 @@ public class PlatformTeamAccountController { @GetMapping("/removeOrganization") @ApiOperation(value = "移除组织") - public R removeOrganization( - @ApiParam(name = "teamId", value = "团队id") @RequestParam Integer teamId, - @ApiParam(name = "manageId", value = "组织id") @RequestParam Integer manageId) { + public R removeOrganization(@ApiParam(name = "teamId", value = "团队id") @RequestParam Integer teamId, @ApiParam(name = "manageId", value = "组织id") @RequestParam Integer manageId) { PlatformTeamClassification teamClassification = platformTeamClassificationService.getById(teamId); if (teamClassification.getIsTeam() == 1) { throw new CustomException(ExceptionEnum.PARTNER_REMOVAL); @@ -180,8 +179,8 @@ public class PlatformTeamAccountController { PlatformTeam platformTeam = platformTeamService.getOne(new QueryWrapper().eq("classification_id", teamId)); PlatformTeamAccount platformTeamAccount = platformTeamAccountService.getById(platformTeam.getManageId()); int status = 1; - if (isEnable==1){ - status=0; + if (isEnable == 1) { + status = 0; } platformTeamClassificationService.updateByAccountId(platformTeamAccount.getAccountId(), status); return update ? R.ok() : R.error(); @@ -189,15 +188,13 @@ public class PlatformTeamAccountController { @ApiOperation(value = "用户列表更新账号状态,禁用整个账号禁止登录,不管是哪个端,哪个组织") @PostMapping("/updateAccountStatus") - public R updateAccountStatus( - @RequestParam("openId") @ApiParam(value = "openId") String openId, - @RequestParam("isEnable") @ApiParam(value = "是否禁用(1->启用,0->禁用)") Integer isEnable) { + public R updateAccountStatus(@RequestParam("openId") @ApiParam(value = "openId") String openId, @RequestParam("isEnable") @ApiParam(value = "是否禁用(1->启用,0->禁用)") Integer isEnable) { //根据openId查询账号详情List List userAccountList = platformTeamClassificationService.selectAccountList(openId); for (UserAccount userAccount : userAccountList) { //更新账号信息 platformTeamClassificationService.updateByAccountId(userAccount.getId(), isEnable); - if (Integer.parseInt(userAccount.getPlatformId())!=7){ + if (Integer.parseInt(userAccount.getPlatformId()) != 7) { //查询账号绑定的组织信息 List platformTeamAccounts = platformTeamAccountService.list(new QueryWrapper().eq("account_id", userAccount.getId())); for (PlatformTeamAccount platformTeamAccount : platformTeamAccounts) { @@ -206,8 +203,8 @@ public class PlatformTeamAccountController { PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); platformTeamClassification.setId(platformTeam.getClassificationId()); int status = 1; - if (isEnable==1){ - status=0; + if (isEnable == 1) { + status = 0; } platformTeamClassification.setIsEnable(status); //更新账号绑定的组织信息 @@ -257,21 +254,30 @@ public class PlatformTeamAccountController { Integer accountId = platformTeamService.getAccountIdByTeamId(teamInfo.getId()); - //删除原有分类重新新增分类配置信息 - supplierClassificationConfigService.deleteByAccountId(accountId); - //设置分类配置信息中的accountId - teamInfo.getSupplierClassificationConfigs().forEach(config -> config.setAccountId(accountId)); - //新增分类配置信息 - supplierClassificationConfigService.saveBatch(teamInfo.getSupplierClassificationConfigs()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("account_id", accountId); + //删除供应商原有分类重新新增分类配置信息 + List classificationConfigs = supplierClassificationConfigService.list(queryWrapper); + if (!classificationConfigs.isEmpty()){ + supplierClassificationConfigService.remove(queryWrapper); + } - boolean update = platformTeamClassificationService.updateById(platformTeamClassification); - return update ?R.ok():R.error(); - } + if (teamInfo.getSupplierClassificationConfigs()!=null) { + for (SupplierClassificationConfig config : teamInfo.getSupplierClassificationConfigs()) { + //获取teamInfo.getSupplierClassificationConfigs()第一个账号id + config.setAccountId(accountId); + } + //新增分类配置信息 + supplierClassificationConfigService.saveBatch(teamInfo.getSupplierClassificationConfigs()); + } + boolean update = platformTeamClassificationService.updateById(platformTeamClassification); + return update ? R.ok() : R.error(); + } @ApiOperation(value = "查询团队信息") diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/EnterpriseCertificationServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/EnterpriseCertificationServiceImpl.java index a5b2710..670ff4e 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/EnterpriseCertificationServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/EnterpriseCertificationServiceImpl.java @@ -68,7 +68,7 @@ public class EnterpriseCertificationServiceImpl extends ServiceImpl 0; + return baseMapper.updateAccountInformation(accountId) > 0; } @Override