更改小程序端活动依据角色查看数据

main
rong.liu 11 months ago
parent 5d0bb9f5a7
commit 5a4248bf6f
  1. 12
      competition/src/main/java/com/huoran/competition/controller/CompetitionController.java
  2. 4
      competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java
  3. 2
      competition/src/main/java/com/huoran/competition/mapper/CompetitionMapper.java
  4. 16
      competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml
  5. 3
      competition/src/main/java/com/huoran/competition/service/CompetitionService.java
  6. 5
      competition/src/main/java/com/huoran/competition/service/impl/CompetitionServiceImpl.java

@ -2,20 +2,16 @@ package com.huoran.competition.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.core.metadata.IPage;
import com.huoran.api.NakadaiClient; import com.huoran.api.NakadaiClient;
import com.huoran.api.UserClient; import com.huoran.api.UserClient;
import com.huoran.common.aop.annotation.NoRepeatSubmit; import com.huoran.common.aop.annotation.NoRepeatSubmit;
import com.huoran.common.constant.DelConstant;
import com.huoran.common.response.R; import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils; import com.huoran.common.utils.TokenUtils;
import com.huoran.competition.entity.*; import com.huoran.competition.entity.*;
import com.huoran.competition.entity.req.AfterLoginPageCompetitionListReq; 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.DisableEnableCompetitionReq;
import com.huoran.competition.entity.req.PageCompetitionListReq; 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.entity.vo.CompetitionVO;
import com.huoran.competition.service.*; import com.huoran.competition.service.*;
import com.huoran.competition.service.impl.CompetitionContentServiceImpl; import com.huoran.competition.service.impl.CompetitionContentServiceImpl;
@ -32,7 +28,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/** /**
* <p> * <p>
@ -162,8 +157,6 @@ public class CompetitionController {
competition.setApplicantNum(competitionRegistrationService.registrationPopulation(competitionId)); competition.setApplicantNum(competitionRegistrationService.registrationPopulation(competitionId));
if (registration != null) { if (registration != null) {
CompetitionTeam team = competitionTeamService.getById(registration.getTeamId()); CompetitionTeam team = competitionTeamService.getById(registration.getTeamId());
if (team != null) { if (team != null) {
@ -324,6 +317,10 @@ public class CompetitionController {
if (!ObjectUtils.isEmpty(accountId)) { if (!ObjectUtils.isEmpty(accountId)) {
pageCompetitionListReq.setSchoolId(schoolId); pageCompetitionListReq.setSchoolId(schoolId);
pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); pageCompetitionListReq.setAccountId(Integer.valueOf(accountId));
Integer role = Integer.valueOf(competitionService.queryRole(accountId));
if (!ObjectUtils.isEmpty(role)) {
pageCompetitionListReq.setRole(role);
}
} }
Future<IPage<CompetitionVO>> pageFuture = competitionService.competitionAfterLogin(pageCompetitionListReq); Future<IPage<CompetitionVO>> pageFuture = competitionService.competitionAfterLogin(pageCompetitionListReq);
IPage<CompetitionVO> pageList = pageFuture.get(); IPage<CompetitionVO> pageList = pageFuture.get();
@ -331,7 +328,6 @@ public class CompetitionController {
} }
@ApiOperation(value = "获取当前时间") @ApiOperation(value = "获取当前时间")
@GetMapping("/getCurrentTime") @GetMapping("/getCurrentTime")
public R getCurrentTime() { public R getCurrentTime() {

@ -38,4 +38,8 @@ public class AfterLoginPageCompetitionListReq extends PageReq{
@ApiModelProperty(value = "活动分类id") @ApiModelProperty(value = "活动分类id")
private Integer classificationId; private Integer classificationId;
//当前角色
@ApiModelProperty(value = "当前用户角色(5:幼儿园,6:供应商)")
private Integer role;
} }

@ -60,6 +60,8 @@ public interface CompetitionMapper extends BaseMapper<Competition> {
//获取sys_platform表平台信息 //获取sys_platform表平台信息
String obtainPlatformInformation(@Param("platformId")String platformId ); String obtainPlatformInformation(@Param("platformId")String platformId );
//查询当前账户的角色
String obtainRole(@Param("accountId")Integer accountId);
} }

@ -714,6 +714,8 @@
WHERE WHERE
c.is_open = 0 c.is_open = 0
AND c.publish_status = 1 AND c.publish_status = 1
AND (c.competition_scope = 1
OR competition_scope = #{req.role})
<if test=" req.classificationId!=null "> <if test=" req.classificationId!=null ">
and c.classification_id=#{req.classificationId} and c.classification_id=#{req.classificationId}
@ -821,4 +823,18 @@
ORDER BY ORDER BY
create_time DESC create_time DESC
</select> </select>
<select id="obtainRole" resultType="java.lang.String">
SELECT
a.platform_id
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
AND a.id = #{accountId}
</select>
</mapper> </mapper>

@ -43,4 +43,7 @@ public interface CompetitionService extends IService<Competition> {
List<CompetitionStage> queryCompetitionStage(String competitionId, String accountId); List<CompetitionStage> queryCompetitionStage(String competitionId, String accountId);
R isParticipant(IsParticipantReq req); R isParticipant(IsParticipantReq req);
//查询当前账户的角色
String queryRole(String accountId);
} }

@ -613,4 +613,9 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
} }
return R.error("无法参加活动"); return R.error("无法参加活动");
} }
@Override
public String queryRole(String accountId) {
return baseMapper.obtainRole(Integer.valueOf(accountId));
}
} }

Loading…
Cancel
Save