Browse Source

【功能优化】控制活动的可见范围

1.社区只能看到自己的
2.上级可以看到下级的
3.活动列表根据开始时间倒序
national_dev
Bill 2 years ago
parent
commit
5d641bb887
  1. 5
      code/smart-community/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPageFormDTO.java
  2. 8
      code/smart-community/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java
  3. 4
      code/smart-community/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  4. 5
      code/smart-community/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

5
code/smart-community/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPageFormDTO.java

@ -33,4 +33,9 @@ public class ActPageFormDTO extends PageFormDTO implements Serializable {
*/
private String customerId;
private String userId;
/**
* 组织ID
*/
private String agencyId;
}

8
code/smart-community/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java

@ -2,8 +2,11 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.ActConstant;
@ -11,6 +14,7 @@ import com.epmet.dto.form.work.*;
import com.epmet.dto.result.work.*;
import com.epmet.service.WorkActService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -323,6 +327,10 @@ public class WorkActController {
public Result<PageData<ActPageResDTO>> pageList(@LoginUser TokenDto tokenDto, @RequestBody ActPageFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
if(!StringUtils.hasText(formDTO.getAgencyId())) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
formDTO.setAgencyId(staffInfoCacheResult.getAgencyId());
}
PageData<ActPageResDTO> page = workActService.pageList(formDTO);
return new Result<PageData<ActPageResDTO>>().ok(page);
}

4
code/smart-community/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -417,6 +417,10 @@ public class WorkActServiceImpl implements WorkActService {
Result<CustomerAgencyDTO> result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId());
if(result.success()&&null!=result.getData()){
actInfoEntity.setPid(result.getData().getPid());
if(StringUtils.isEmpty(actInfoEntity.getSponsorPath()) || actInfoEntity.getSponsorPath().indexOf(":") == -1) {
actInfoEntity.setSponsorPath(result.getData().getPids());
}
}else{
logger.warn("根据agencyId查询组织信息失败,agencyId={}",formDTO.getSponsorId());
}

5
code/smart-community/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

@ -849,6 +849,9 @@
<if test='null != status and "" != status'>
AND ai.ACT_STATUS = #{status}
</if>
<if test='null != agencyId and "" != agencyId'>
AND (ai.SPONSOR_ID = #{agencyId} or ai.SPONSOR_PATH like concat('%',#{agencyId},'%') )
</if>
<if test='null != title and "" != title'>
AND ai.TITLE like concat('%',#{title},'%')
</if>
@ -860,6 +863,6 @@
</if>
and ai.CUSTOMER_ID= #{customerId}
and ai.act_type = 'heart'
order by ai.CREATED_TIME desc
order by ai.ACT_START_TIME desc
</select>
</mapper>

Loading…
Cancel
Save