Browse Source

Merge remote-tracking branch 'origin/feature/lc_homeStatistics' into feature/lc_exportData

feature/syp_points
liuchuang 5 years ago
parent
commit
aa43cc11da
  1. 20
      esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/constant/AppHomePageDataTypeConstant.java
  2. 25
      esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcAppHomeDataResultDTO.java
  3. 16
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/v2/ApiNewsV2Controller.java
  4. 12
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/ActInfoFeignClient.java
  5. 4
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/ActInfoFeignClientFallback.java
  6. 11
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/NewsService.java
  7. 33
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java
  8. 81
      esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActUserReadDTO.java
  9. 94
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/ActUserReadController.java
  10. 15
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/AppActInfoController.java
  11. 10
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActInfoDao.java
  12. 33
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActUserReadDao.java
  13. 51
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActUserReadEntity.java
  14. 62
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActUserReadExcel.java
  15. 47
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/redis/ActUserReadRedis.java
  16. 10
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActInfoService.java
  17. 105
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActUserReadService.java
  18. 21
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActInfoServiceImpl.java
  19. 118
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserReadServiceImpl.java
  20. 13
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml
  21. 19
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserReadDao.xml

20
esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/constant/AppHomePageDataTypeConstant.java

@ -0,0 +1,20 @@
package com.elink.esua.epdc.dto.constant;
/**
* 居民端首页数据统计类型常量
*
* @author Liuchuang
* @since 2020/10/26 14:19
*/
public interface AppHomePageDataTypeConstant {
/**
* 消息数量
*/
String HOME_DATA_TYPE_INFORMATION = "informationNum";
/**
* 未查看报名中活动数量
*/
String HOME_DATA_TYPE_UNREAD_SIGN_UP_ACT = "unreadSignUpActNum";
}

25
esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcAppHomeDataResultDTO.java

@ -0,0 +1,25 @@
package com.elink.esua.epdc.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 居民端首页数据统计项
*
* @author Liuchuang
* @since 2020/10/26 14:04
*/
@Data
public class EpdcAppHomeDataResultDTO implements Serializable {
/**
* 数据类型
*/
private String dataType;
/**
* 数量
*/
private Integer num;
}

16
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/v2/ApiNewsV2Controller.java

@ -7,6 +7,7 @@ import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.*;
import com.elink.esua.epdc.dto.result.EpdcAppHomeDataResultDTO;
import com.elink.esua.epdc.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,7 +29,7 @@ public class ApiNewsV2Controller {
@Autowired
private NewsService newsService;
/*
/**
* 移动端通知列表接口 - v2
*
* @param userDetail
@ -42,4 +43,17 @@ public class ApiNewsV2Controller {
return newsService.listV2Notice(userDetail, formDto);
}
/**
* 居民端首页数据统计
*
* @param userDetail
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcAppHomeDataResultDTO>>
* @author Liuchuang
* @since 2020/10/26 14:25
*/
@PostMapping("information/first")
public Result<List<EpdcAppHomeDataResultDTO>> selectOneFristByUserId(@LoginUser TokenDto userDetail) {
return newsService.selectHomeData(userDetail);
}
}

12
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/ActInfoFeignClient.java

@ -13,6 +13,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@ -64,6 +65,15 @@ public interface ActInfoFeignClient {
@GetMapping(value = "heart/actbanner/bannerlist", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<ActBannerDTO>> getBannerList(EpdcAppBannerFormDTO dto);
/**
* 获取用户未查看的报名中的活动数量
*
* @param userId
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.lang.Integer>
* @author Liuchuang
* @since 2020/10/26 13:45
*/
@GetMapping(value = "heart/appactinfo/unreadactnums", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<Integer> getUserUnreadSignUpActCount(String userId);
}

4
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/ActInfoFeignClientFallback.java

@ -47,5 +47,9 @@ public class ActInfoFeignClientFallback implements ActInfoFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "getBannerList", dto);
}
@Override
public Result<Integer> getUserUnreadSignUpActCount(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "getUserUnreadSignUpActCount", userId);
}
}

11
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/NewsService.java

@ -5,6 +5,7 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.epdc.form.*;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.*;
import com.elink.esua.epdc.dto.result.EpdcAppHomeDataResultDTO;
import java.util.List;
@ -152,4 +153,14 @@ public interface NewsService {
* @return com.elink.esua.epdc.commons.tools.utils.Result
**/
Result browsePoints(TokenDto userDetail, EpdcNewsBrowseFromDTO newsBrowseFromDTO);
/**
* 居民端首页数据统计
*
* @param userDetail
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcAppHomeDataResultDTO>>
* @author Liuchuang
* @since 2020/10/26 14:24
*/
Result<List<EpdcAppHomeDataResultDTO>> selectHomeData(TokenDto userDetail);
}

33
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java

@ -1,12 +1,16 @@
package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.constant.AppHomePageDataTypeConstant;
import com.elink.esua.epdc.dto.epdc.form.*;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.*;
import com.elink.esua.epdc.dto.result.EpdcAppHomeDataResultDTO;
import com.elink.esua.epdc.feign.ActInfoFeignClient;
import com.elink.esua.epdc.feign.NewsFeignClient;
import com.elink.esua.epdc.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,6 +35,9 @@ public class NewsServiceImpl implements NewsService {
@Autowired
private RedisUtils redisUtils;
@Autowired
private ActInfoFeignClient actInfoFeignClient;
@Override
public Result<List<EpdcNoticeListResultDTO>> listNotice(TokenDto userDetail, EpdcNoticeListFormDTO formDto) {
formDto.setDeptId(userDetail.getGridId());
@ -119,4 +126,30 @@ public class NewsServiceImpl implements NewsService {
}
return new Result();
}
@Override
public Result<List<EpdcAppHomeDataResultDTO>> selectHomeData(TokenDto userDetail) {
String userId = userDetail.getUserId();
List<EpdcAppHomeDataResultDTO> data = new ArrayList<>();
// 消息通知数量
EpdcAppHomeDataResultDTO informationDto = new EpdcAppHomeDataResultDTO();
informationDto.setDataType(AppHomePageDataTypeConstant.HOME_DATA_TYPE_INFORMATION);
informationDto.setNum(NumConstant.ZERO);
Result<EpdcInformationFristResultDTO> information = newsFeignClient.selectOneFristByUserId(userId);
if (null != information && information.success()) {
informationDto.setNum(information.getData().getAmount());
}
data.add(informationDto);
// 未查看报名中活动数量
EpdcAppHomeDataResultDTO actDto = new EpdcAppHomeDataResultDTO();
actDto.setDataType(AppHomePageDataTypeConstant.HOME_DATA_TYPE_UNREAD_SIGN_UP_ACT);
actDto.setNum(NumConstant.ZERO);
Result<Integer> act = actInfoFeignClient.getUserUnreadSignUpActCount(userId);
if (null != act && act.success()) {
actDto.setNum(act.getData());
}
data.add(actDto);
return new Result<List<EpdcAppHomeDataResultDTO>>().ok(data);
}
}

81
esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActUserReadDTO.java

@ -0,0 +1,81 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.activity;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
@Data
public class ActUserReadDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 活动ID
*/
private String actId;
/**
* 用户ID
*/
private String userId;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 删除标记
*/
private String delFlag;
}

94
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/ActUserReadController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.activity.controller;
import com.elink.esua.epdc.activity.ActUserReadDTO;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.modules.activity.excel.ActUserReadExcel;
import com.elink.esua.epdc.modules.activity.service.ActUserReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
@RestController
@RequestMapping("actuserread")
public class ActUserReadController {
@Autowired
private ActUserReadService actUserReadService;
@GetMapping("page")
public Result<PageData<ActUserReadDTO>> page(@RequestParam Map<String, Object> params){
PageData<ActUserReadDTO> page = actUserReadService.page(params);
return new Result<PageData<ActUserReadDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ActUserReadDTO> get(@PathVariable("id") String id){
ActUserReadDTO data = actUserReadService.get(id);
return new Result<ActUserReadDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ActUserReadDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
actUserReadService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ActUserReadDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
actUserReadService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
actUserReadService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ActUserReadDTO> list = actUserReadService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ActUserReadExcel.class);
}
}

15
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/AppActInfoController.java

@ -125,4 +125,19 @@ public class AppActInfoController {
return this.actInfoService.getCancelDetailByApp(id);
}
/**
* 获取用户未查看的报名中的活动数量
*
* @param userId
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.lang.Integer>
* @author Liuchuang
* @since 2020/10/26 13:45
*/
@GetMapping("unreadactnums")
public Result<Integer> getUserUnreadSignUpActCount(@RequestBody String userId) {
int unreadCount = actInfoService.countUserUnreadSignUpAct(userId);
return new Result<Integer>().ok(unreadCount);
}
}

10
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActInfoDao.java

@ -123,4 +123,14 @@ public interface ActInfoDao extends BaseDao<ActInfoEntity> {
* @return void
*/
void rejectActInfo(@Param("relationId") String relationId);
/**
* 获取用户未查看的报名中的活动数量
*
* @param userId
* @return int
* @author Liuchuang
* @since 2020/10/26 13:40
*/
int selectCountUserUnreadSignUpAct(@Param("userId") String userId);
}

33
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActUserReadDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.activity.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.activity.entity.ActUserReadEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
@Mapper
public interface ActUserReadDao extends BaseDao<ActUserReadEntity> {
}

51
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActUserReadEntity.java

@ -0,0 +1,51 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.activity.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_act_user_read")
public class ActUserReadEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 活动ID
*/
private String actId;
/**
* 用户ID
*/
private String userId;
}

62
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActUserReadExcel.java

@ -0,0 +1,62 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.activity.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
@Data
public class ActUserReadExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "活动ID")
private String actId;
@Excel(name = "用户ID")
private String userId;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
@Excel(name = "删除标记")
private String delFlag;
}

47
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/redis/ActUserReadRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.activity.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
@Component
public class ActUserReadRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

10
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActInfoService.java

@ -214,4 +214,14 @@ public interface ActInfoService extends BaseService<ActInfoEntity> {
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result rejectActClockInfo(RejectRecordDTO dto);
/**
* 获取用户未查看的报名中的活动数量
*
* @param userId
* @return int
* @author Liuchuang
* @since 2020/10/26 13:42
*/
int countUserUnreadSignUpAct(String userId);
}

105
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActUserReadService.java

@ -0,0 +1,105 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.activity.service;
import com.elink.esua.epdc.activity.ActUserReadDTO;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.modules.activity.entity.ActUserReadEntity;
import java.util.List;
import java.util.Map;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
public interface ActUserReadService extends BaseService<ActUserReadEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ActUserReadDTO>
* @author generator
* @date 2020-10-26
*/
PageData<ActUserReadDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ActUserReadDTO>
* @author generator
* @date 2020-10-26
*/
List<ActUserReadDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ActUserReadDTO
* @author generator
* @date 2020-10-26
*/
ActUserReadDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-10-26
*/
void save(ActUserReadDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-10-26
*/
void update(ActUserReadDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-10-26
*/
void delete(String[] ids);
/**
* 标记用户已读活动
*
* @param dto
* @return boolean
* @author Liuchuang
* @since 2020/10/26 11:20
*/
boolean addActUserReadRecord(ActUserReadDTO dto);
}

21
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActInfoServiceImpl.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.activity.ActBannerDTO;
import com.elink.esua.epdc.activity.ActInfoDTO;
import com.elink.esua.epdc.activity.ActUserReadDTO;
import com.elink.esua.epdc.activity.ActUserRelationDTO;
import com.elink.esua.epdc.activity.form.ActInfoAppFormDTO;
import com.elink.esua.epdc.activity.form.ActInfoFormDTO;
@ -58,6 +59,7 @@ import com.elink.esua.epdc.modules.activity.entity.ActUserClockLogEntity;
import com.elink.esua.epdc.modules.activity.entity.ActUserRelationEntity;
import com.elink.esua.epdc.modules.activity.service.ActBannerService;
import com.elink.esua.epdc.modules.activity.service.ActInfoService;
import com.elink.esua.epdc.modules.activity.service.ActUserReadService;
import com.elink.esua.epdc.modules.async.NewsTask;
import com.elink.esua.epdc.modules.feign.AdminFeignClient;
import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient;
@ -104,6 +106,9 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
@Autowired
private ActClockPicDao actClockPicDao;
@Autowired
private ActUserReadService actUserReadService;
@Override
public PageData<ActInfoDTO> page(Map<String, Object> params) {
IPage<ActInfoEntity> page = baseDao.selectPage(
@ -433,8 +438,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
Result<String> userVolunteerFlagResult = userInfoFeignClient.queryUserVolunteerFlag(formDto.getUserId());
detailResultDTO.setUserVolunteerFlag(userVolunteerFlagResult.getData());
ActInfoDetailAppResultDTO resultDTO = ConvertUtils.sourceToTarget(detailResultDTO, ActInfoDetailAppResultDTO.class);
//获取活动详情 活动信息表 浏览数+1 banner表 浏览数+1
this.addActBrowseNumber(resultDTO.getId());
//获取活动详情 活动信息表 浏览数+1 banner表 浏览数+1 标记用户已读
this.addActBrowseNumber(resultDTO.getId(), formDto.getUserId());
return new Result<ActInfoDetailAppResultDTO>().ok(resultDTO);
}
@ -626,7 +631,7 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
* @Author: zy
* @Date: 2020-02-06
*/
private void addActBrowseNumber(String actId) {
private void addActBrowseNumber(String actId, String userId) {
//活动信息表 浏览数+1
ActInfoEntity infoEntity = baseDao.selectById(actId);
infoEntity.setActBrowseNum(infoEntity.getActBrowseNum() + 1);
@ -638,6 +643,11 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
ActBannerEntity bannerEntity = ConvertUtils.sourceToTarget(bannerDto, ActBannerEntity.class);
actBannerService.updateById(bannerEntity);
}
// 标记用户已读
ActUserReadDTO actUserReadDto = new ActUserReadDTO();
actUserReadDto.setActId(actId);
actUserReadDto.setUserId(userId);
actUserReadService.addActUserReadRecord(actUserReadDto);
}
/**
@ -721,4 +731,9 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
actClockPicDao.rejectActClockPicInfo(dto.getRelationId());
return new Result();
}
@Override
public int countUserUnreadSignUpAct(String userId) {
return baseDao.selectCountUserUnreadSignUpAct(userId);
}
}

118
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserReadServiceImpl.java

@ -0,0 +1,118 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.activity.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.activity.ActUserReadDTO;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.modules.activity.dao.ActUserReadDao;
import com.elink.esua.epdc.modules.activity.entity.ActUserReadEntity;
import com.elink.esua.epdc.modules.activity.service.ActUserReadService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 用户活动已读表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-10-26
*/
@Service
public class ActUserReadServiceImpl extends BaseServiceImpl<ActUserReadDao, ActUserReadEntity> implements ActUserReadService {
@Override
public PageData<ActUserReadDTO> page(Map<String, Object> params) {
IPage<ActUserReadEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ActUserReadDTO.class);
}
@Override
public List<ActUserReadDTO> list(Map<String, Object> params) {
List<ActUserReadEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ActUserReadDTO.class);
}
private QueryWrapper<ActUserReadEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ActUserReadEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ActUserReadDTO get(String id) {
ActUserReadEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ActUserReadDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ActUserReadDTO dto) {
ActUserReadEntity entity = ConvertUtils.sourceToTarget(dto, ActUserReadEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ActUserReadDTO dto) {
ActUserReadEntity entity = ConvertUtils.sourceToTarget(dto, ActUserReadEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean addActUserReadRecord(ActUserReadDTO dto) {
// 判断是否已读
QueryWrapper<ActUserReadEntity> wrapper = new QueryWrapper<>();
wrapper.eq("ACT_ID", dto.getActId());
wrapper.eq("USER_ID", dto.getUserId());
wrapper.eq(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR);
int readCount = baseDao.selectCount(wrapper);
if (readCount > 0) {
return true;
}
ActUserReadEntity entity = ConvertUtils.sourceToTarget(dto, ActUserReadEntity.class);
return insert(entity);
}
}

13
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml

@ -518,4 +518,17 @@
UPDATE epdc_act_info SET DEL_FLAG = 1,UPDATED_TIME=NOW()
where id=#{relationId}
</update>
<select id="selectCountUserUnreadSignUpAct" resultType="integer">
SELECT
COUNT( ai.ID )
FROM
epdc_act_info ai
WHERE
ai.DEL_FLAG = '0'
AND ai.ACT_STATUS = '1'
AND NOW() BETWEEN ai.SIGNUP_START_TIME
AND ai.SIGNUP_END_TIME
AND ai.ID NOT IN ( SELECT t.ACT_ID FROM ( SELECT ACT_ID FROM epdc_act_user_read WHERE DEL_FLAG = '0' AND USER_ID = #{userId} ) t );
</select>
</mapper>

19
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserReadDao.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.activity.dao.ActUserReadDao">
<resultMap type="com.elink.esua.epdc.modules.activity.entity.ActUserReadEntity" id="actUserReadMap">
<result property="id" column="ID"/>
<result property="actId" column="ACT_ID"/>
<result property="userId" column="USER_ID"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
</mapper>
Loading…
Cancel
Save