Browse Source

Merge branch 'dev_group_point' into dev_temp

# Conflicts:
#	epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
#	epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml
dev
zhaoqifeng 5 years ago
parent
commit
0dc4f0648f
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  2. 13
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java
  3. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java
  4. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  5. 101
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointTotalDetailDTO.java
  6. 106
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointUserTotalDetailDTO.java
  7. 17
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java
  8. 38
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java
  9. 44
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRankingResultDTO.java
  10. 6
      epmet-module/epmet-point/epmet-point-server/pom.xml
  11. 76
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java
  12. 43
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java
  13. 44
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointUserTotalDetailDao.java
  14. 71
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointTotalDetailEntity.java
  15. 76
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointUserTotalDetailEntity.java
  16. 129
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java
  17. 143
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointUserTotalDetailService.java
  18. 198
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java
  19. 235
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java
  20. 55
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  21. 33
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml
  22. 32
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointUserTotalDetailDao.xml
  23. 8
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml
  24. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java
  25. 96
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupAchievementConfigDTO.java
  26. 111
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupAchievementStatsDTO.java
  27. 10
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java
  28. 17
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java
  29. 37
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AchievementDetailResultDTO.java
  30. 46
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupPointDetailResultDTO.java
  31. 17
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/AchievementResultDTO.java
  32. 17
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupAchievementDTO.java
  33. 35
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  34. 40
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  35. 49
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/enums/AchievementTypeEnum.java
  36. 68
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  37. 33
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementConfigDao.java
  38. 44
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementStatsDao.java
  39. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
  40. 66
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementConfigEntity.java
  41. 81
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementStatsEntity.java
  42. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java
  43. 95
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementConfigService.java
  44. 113
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementStatsService.java
  45. 39
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  46. 100
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupAchievementConfigServiceImpl.java
  47. 133
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupAchievementStatsServiceImpl.java
  48. 124
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  49. 55
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java
  50. 25
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  51. 53
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/support/GroupAchievementUtils.java
  52. 76
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/support/GroupLevelUtils.java
  53. 24
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
  54. 248
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  55. 37
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java
  56. 22
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementConfigDao.xml
  57. 40
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementStatsDao.xml
  58. 15
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -40,6 +40,7 @@ public interface NumConstant {
int FIFTY_ONE = 51;
int SIXTY = 60;
int ONE_HUNDRED = 100;
int FIVE_HUNDRED = 500;
BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100);
BigDecimal ZERO_DECIMAL = new BigDecimal(0);
int ONE_THOUSAND = 1000;

13
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java

@ -29,6 +29,17 @@ public class BasePointEventMsg implements Serializable {
* 客户Id
*/
private String customerId;
/**
* 机关Id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 被操作用户id
*/
@ -69,4 +80,6 @@ public class BasePointEventMsg implements Serializable {
private Date targetDate;
private String eventTag;
private String eventClass;
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java

@ -17,6 +17,7 @@ public enum EventEnum {
TOPIC_SHIFTED_TO_ISSUE("topic_to_issue","resi_group","话题被转为议题(小组中发布的话题被组长转为议题)"),
SHIFT_TOPIC_TO_ISSUE("shift_topic_to_issue","resi_group","转话题为议题(将自建小组中话题转为议题)"),
TOPIC_SHIFTED_TO_PROJECT("topic_to_project","resi_group","话题被转为项目"),
LEADER_RESOLVE_TOPIC("leader_resolve_topic","resi_group","组长解决组内话题"),
;
private String eventClass;

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -558,6 +558,17 @@ public class DateUtils {
return format.format(timestamp * 1000);
}
/**
* 日期格式转时间戳
* @author zhaoqifeng
* @date 2021/4/19 14:52
* @param date
* @return java.lang.Long
*/
public static Long dateToTimestamp(Date date) {
return date.getTime()/NumConstant.ONE_THOUSAND;
}
/**
* @return java.util.Date
* @param minStr yyyy-MM-dd HH:mm字符串

101
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointTotalDetailDTO.java

@ -0,0 +1,101 @@
/**
* 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.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Data
public class BizPointTotalDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

106
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointUserTotalDetailDTO.java

@ -0,0 +1,106 @@
/**
* 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.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Data
public class BizPointUserTotalDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 用户ID
*/
private String userId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

17
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 9:50
*/
@Data
public class GroupPointFormDTO implements Serializable {
private static final long serialVersionUID = -3231073030413434313L;
private String groupId;
private String gridId;
}

38
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 10:34
*/
@NoArgsConstructor
@Data
public class GroupPointRankingResultDTO implements Serializable {
private static final long serialVersionUID = -9215609608003827403L;
/**
* 排名
*/
private String ranking;
/**
* 小组名
*/
private String groupName;
/**
* 小组积分
*/
private String point;
/**
* 是否本小组
*/
private String isMine;
/**
* 小组ID
*/
private String groupId;
}

44
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRankingResultDTO.java

@ -0,0 +1,44 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 10:05
*/
@NoArgsConstructor
@Data
public class PointRankingResultDTO implements Serializable {
private static final long serialVersionUID = -5383837225811609227L;
/**
* 头像
*/
private String headPhoto;
/**
* 支部小组-姓名/普通小组-昵称
*/
private String name;
/**
* 积分
*/
private String point;
/**
* 排名
*/
private String ranking;
/**
* 是否本人
*/
private String isMine;
/**
* 用户ID
*/
@JsonIgnore
private String userId;
}

6
epmet-module/epmet-point/epmet-point-server/pom.xml

@ -87,6 +87,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>resi-group-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

76
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java

@ -0,0 +1,76 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO;
import com.epmet.dto.result.GroupPointRankingResultDTO;
import com.epmet.dto.result.PointRankingResultDTO;
import com.epmet.service.BizPointTotalDetailService;
import com.epmet.service.BizPointUserTotalDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author zhaoqifeng
* 小组积分
* @date 2021/4/21 9:45
*/
@RestController
@RequestMapping("group/point")
public class GroupPointController {
@Autowired
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Autowired
private BizPointTotalDetailService bizPointTotalDetailService;
/**
* 小组积分贡献榜
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.PointRankingResultDTO>>
* @author zhaoqifeng
* @date 2021/4/21 14:02
*/
@PostMapping("pointranking")
public Result<List<PointRankingResultDTO>> pointRanking(@LoginUser TokenDto tokenDto, @RequestBody GroupPointFormDTO formDTO) {
List<PointRankingResultDTO> list = bizPointUserTotalDetailService.pointRanking(tokenDto, formDTO);
return new Result<List<PointRankingResultDTO>>().ok(list);
}
/**
* 网格小组积分排行
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.GroupPointRankingResultDTO>>
* @author zhaoqifeng
* @date 2021/4/21 14:02
*/
@PostMapping("grouppointranking")
public Result<List<GroupPointRankingResultDTO>> groupPointRanking(@RequestBody GroupPointFormDTO formDTO) {
List<GroupPointRankingResultDTO> list = bizPointTotalDetailService.groupPointRanking(formDTO);
return new Result<List<GroupPointRankingResultDTO>>().ok(list);
}
/**
* 小组积分详情
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:02
*/
@PostMapping("pointdetail")
public Result<GroupPointDetailResultDTO> pointDetail(@RequestBody GroupPointFormDTO formDTO) {
GroupPointDetailResultDTO result = bizPointTotalDetailService.pointDetail(formDTO);
return new Result<GroupPointDetailResultDTO>().ok(result);
}
}

43
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java

@ -0,0 +1,43 @@
/**
* 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.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.entity.BizPointTotalDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Mapper
public interface BizPointTotalDetailDao extends BaseDao<BizPointTotalDetailEntity> {
/**
* 根据业务类型查找数据
* @author zhaoqifeng
* @date 2021/4/20 16:57
* @param type
* @param objectId
* @return com.epmet.dto.BizPointTotalDetailDTO
*/
BizPointTotalDetailDTO selectDataByObject(@Param("type")String type, @Param("objectId")String objectId);
}

44
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointUserTotalDetailDao.java

@ -0,0 +1,44 @@
/**
* 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.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.BizPointUserTotalDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Mapper
public interface BizPointUserTotalDetailDao extends BaseDao<BizPointUserTotalDetailEntity> {
/**
* 获取今日积分增量
* @author zhaoqifeng
* @date 2021/4/21 16:56
* @param type
* @param objectId
* @return java.lang.Integer
*/
Integer selectIncrease(@Param("type")String type, @Param("objectId")String objectId);
}

71
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointTotalDetailEntity.java

@ -0,0 +1,71 @@
/**
* 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.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("biz_point_total_detail")
public class BizPointTotalDetailEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
}

76
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointUserTotalDetailEntity.java

@ -0,0 +1,76 @@
/**
* 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.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("biz_point_user_total_detail")
public class BizPointUserTotalDetailEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 用户ID
*/
private String userId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
}

129
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java

@ -0,0 +1,129 @@
/**
* 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.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO;
import com.epmet.dto.result.GroupPointRankingResultDTO;
import com.epmet.entity.BizPointTotalDetailEntity;
import java.util.List;
import java.util.Map;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
public interface BizPointTotalDetailService extends BaseService<BizPointTotalDetailEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<BizPointTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
PageData<BizPointTotalDetailDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<BizPointTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
List<BizPointTotalDetailDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return BizPointTotalDetailDTO
* @author generator
* @date 2021-04-20
*/
BizPointTotalDetailDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void save(BizPointTotalDetailDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void update(BizPointTotalDetailDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-04-20
*/
void delete(String[] ids);
/**
* 根据业务类型查找数据
*
* @param type
* @param objectId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
BizPointTotalDetailDTO getDataByObject(String type, String objectId);
/**
* 小组积分详情
*
* @param formDTO
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
GroupPointDetailResultDTO pointDetail(GroupPointFormDTO formDTO);
/**
* 网格小组积分排行
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.GroupPointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
List<GroupPointRankingResultDTO> groupPointRanking(GroupPointFormDTO formDTO);
}

143
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointUserTotalDetailService.java

@ -0,0 +1,143 @@
/**
* 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.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.BizPointUserTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.dto.result.PointRankingResultDTO;
import com.epmet.entity.BizPointUserTotalDetailEntity;
import java.util.List;
import java.util.Map;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
public interface BizPointUserTotalDetailService extends BaseService<BizPointUserTotalDetailEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<BizPointUserTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
PageData<BizPointUserTotalDetailDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<BizPointUserTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
List<BizPointUserTotalDetailDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return BizPointUserTotalDetailDTO
* @author generator
* @date 2021-04-20
*/
BizPointUserTotalDetailDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void save(BizPointUserTotalDetailDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void update(BizPointUserTotalDetailDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-04-20
*/
void delete(String[] ids);
/**
* 根据业务类型查找用户数据
*
* @param type
* @param objectId
* @param userId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
BizPointUserTotalDetailDTO getDataByObject(String type, String objectId, String userId);
/**
* 根据业务类型查找积分总和
*
* @param type
* @param objectId
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/20 17:21
*/
Integer getTotalByObject(String type, String objectId);
/**
* 小组积分贡献榜
*
* @param tokenDto
* @param formDTO
* @return java.util.List<com.epmet.dto.result.PointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:06
*/
List<PointRankingResultDTO> pointRanking(TokenDto tokenDto, GroupPointFormDTO formDTO);
/**
* 获取今日增量
* @author zhaoqifeng
* @date 2021/4/21 16:41
* @param type
* @param objectId
* @return java.lang.Integer
*/
Integer getIncrease(String type, String objectId);
}

198
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java

@ -0,0 +1,198 @@
/**
* 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.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.BizPointTotalDetailDao;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO;
import com.epmet.dto.result.GroupPointRankingResultDTO;
import com.epmet.entity.BizPointTotalDetailEntity;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.service.BizPointTotalDetailService;
import com.epmet.service.BizPointUserTotalDetailService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Service
public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTotalDetailDao, BizPointTotalDetailEntity> implements BizPointTotalDetailService {
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
@Autowired
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Override
public PageData<BizPointTotalDetailDTO> page(Map<String, Object> params) {
IPage<BizPointTotalDetailEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, BizPointTotalDetailDTO.class);
}
@Override
public List<BizPointTotalDetailDTO> list(Map<String, Object> params) {
List<BizPointTotalDetailEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, BizPointTotalDetailDTO.class);
}
private QueryWrapper<BizPointTotalDetailEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public BizPointTotalDetailDTO get(String id) {
BizPointTotalDetailEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, BizPointTotalDetailDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(BizPointTotalDetailDTO dto) {
BizPointTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointTotalDetailEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BizPointTotalDetailDTO dto) {
BizPointTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointTotalDetailEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 根据业务类型查找数据
*
* @param type
* @param objectId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
@Override
public BizPointTotalDetailDTO getDataByObject(String type, String objectId) {
return baseDao.selectDataByObject(type, objectId);
}
/**
* 小组积分详情
*
* @param formDTO
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
@Override
public GroupPointDetailResultDTO pointDetail(GroupPointFormDTO formDTO) {
Result<GroupPointDetailResultDTO> result = resiGroupOpenFeignClient.groupPointDetail(formDTO.getGroupId());
if (!result.success() || null == result.getData()) {
throw new RenException(result.getCode(), result.getMsg());
}
GroupPointDetailResultDTO detail = result.getData();
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", "group")
.eq("OBJECT_ID", formDTO.getGroupId())
.eq("DEL_FLAG", NumConstant.ZERO_STR);
BizPointTotalDetailEntity entity = baseDao.selectOne(wrapper);
int toUpgrade = Integer.parseInt(detail.getNextLevelPoint()) - entity.getTotalPoint();
detail.setToUpgrade(Integer.toString(toUpgrade));
Integer increase = bizPointUserTotalDetailService.getIncrease("group", formDTO.getGroupId());
detail.setIncrease(increase.toString());
detail.setTotal(entity.getTotalPoint().toString());
detail.setCurrentPoint(entity.getTotalPoint().toString());
return detail;
}
/**
* 网格小组积分排行
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.GroupPointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
@Override
public List<GroupPointRankingResultDTO> groupPointRanking(GroupPointFormDTO formDTO) {
List<GroupPointRankingResultDTO> list = new ArrayList<>();
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", "group")
.eq("GRID_ID", formDTO.getGridId())
.eq("DEL_FLAG", NumConstant.ZERO_STR)
.orderByDesc("TOTAL_POINT");
List<BizPointTotalDetailEntity> totalDetailList = baseDao.selectList(wrapper);
Result<List<ResiGroupDTO>> groupList = resiGroupOpenFeignClient.getGroupListByGrid(formDTO.getGridId());
list =
totalDetailList.stream().flatMap(detail -> groupList.getData().stream().filter(item -> item.getId().equals(detail.getObjectId())).map(group -> {
GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO();
dto.setGroupId(group.getId());
dto.setGroupName(group.getGroupName());
dto.setPoint(detail.getTotalPoint().toString());
if (formDTO.getGroupId().equals(group.getId())) {
dto.setIsMine(NumConstant.ONE_STR);
} else {
dto.setIsMine(NumConstant.ZERO_STR);
}
return dto;
})).collect(Collectors.toList());
int i = 1;
for (GroupPointRankingResultDTO dto : list) {
dto.setRanking(String.valueOf(i));
i++;
}
return list;
}
}

235
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java

@ -0,0 +1,235 @@
/**
* 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.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.BizPointUserTotalDetailDao;
import com.epmet.dto.BizPointUserTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.dto.result.PointRankingResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.BizPointUserTotalDetailEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.service.BizPointUserTotalDetailService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Service
public class BizPointUserTotalDetailServiceImpl extends BaseServiceImpl<BizPointUserTotalDetailDao, BizPointUserTotalDetailEntity> implements BizPointUserTotalDetailService {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
@Override
public PageData<BizPointUserTotalDetailDTO> page(Map<String, Object> params) {
IPage<BizPointUserTotalDetailEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, BizPointUserTotalDetailDTO.class);
}
@Override
public List<BizPointUserTotalDetailDTO> list(Map<String, Object> params) {
List<BizPointUserTotalDetailEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, BizPointUserTotalDetailDTO.class);
}
private QueryWrapper<BizPointUserTotalDetailEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public BizPointUserTotalDetailDTO get(String id) {
BizPointUserTotalDetailEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(BizPointUserTotalDetailDTO dto) {
BizPointUserTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointUserTotalDetailEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BizPointUserTotalDetailDTO dto) {
BizPointUserTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointUserTotalDetailEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 根据业务类型查找用户数据
*
* @param type
* @param objectId
* @param userId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
@Override
public BizPointUserTotalDetailDTO getDataByObject(String type, String objectId, String userId) {
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("DEL_FLAG", NumConstant.ZERO_STR);
BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class);
}
/**
* 根据业务类型查找积分总和
*
* @param type
* @param objectId
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/20 17:21
*/
@Override
public Integer getTotalByObject(String type, String objectId) {
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(TOTAL_POINT), 0) as TOTAL_POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("DEL_FLAG", NumConstant.ZERO_STR);
BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper);
if (null == entity) {
return NumConstant.ZERO;
}
return entity.getTotalPoint();
}
/**
* 小组积分贡献榜
*
* @param tokenDto
* @param formDTO
* @return java.util.List<com.epmet.dto.result.PointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:06
*/
@Override
public List<PointRankingResultDTO> pointRanking(TokenDto tokenDto, GroupPointFormDTO formDTO) {
List<PointRankingResultDTO> list = new ArrayList<>();
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", "group")
.eq("OBJECT_ID", formDTO.getGroupId())
.eq("DEL_FLAG", NumConstant.ZERO_STR)
.orderByDesc("TOTAL_POINT");
List<BizPointUserTotalDetailEntity> userTotalList = baseDao.selectList(wrapper);
int i = 1;
list = userTotalList.stream().map(item -> {
PointRankingResultDTO dto = new PointRankingResultDTO();
dto.setUserId(item.getUserId());
dto.setPoint(item.getTotalPoint().toString());
if (tokenDto.getUserId().equals(item.getUserId())) {
dto.setIsMine(NumConstant.ONE_STR);
} else {
dto.setIsMine(NumConstant.ZERO_STR);
}
return dto;
}).collect(Collectors.toList());
for (PointRankingResultDTO dto : list) {
dto.setRanking(String.valueOf(i));
i++;
}
//获取小组信息
Result<ResiGroupDTO> group = resiGroupOpenFeignClient.getGroupDetail(formDTO.getGroupId());
if (!group.success() || null == group.getData()) {
throw new RenException(group.getCode(), group.getMsg());
}
//获取用户信息
List<String> userIds = userTotalList.stream().map(BizPointUserTotalDetailEntity :: getUserId).collect(Collectors.toList());
Result<List<UserBaseInfoResultDTO>> userInfoListResult = epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
if (!userInfoListResult.success() || null == userInfoListResult.getData()) {
throw new RenException(userInfoListResult.getCode(), userInfoListResult.getMsg());
}
list.forEach(item -> userInfoListResult.getData().stream().filter(baseInfo -> item.getUserId().equals(baseInfo.getUserId())).forEach(
user -> {
//楼院小组显示昵称,支部小组显示姓名
if (("ordinary").equals(group.getData().getGroupType())) {
item.setName(user.getNickname());
} else {
item.setName(user.getName());
}
item.setHeadPhoto(user.getHeadImgUrl());
}
));
return list;
}
/**
* 获取今日增量
*
* @param type
* @param objectId
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/21 16:41
*/
@Override
public Integer getIncrease(String type, String objectId) {
return baseDao.selectIncrease(type, objectId);
}
}

55
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java

@ -31,6 +31,8 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.dto.BizPointUserTotalDetailDTO;
import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
@ -39,9 +41,7 @@ import com.epmet.entity.PointRuleEntity;
import com.epmet.entity.UserPointActionLogEntity;
import com.epmet.entity.UserPointStatisticalDailyEntity;
import com.epmet.entity.UserPointTotalEntity;
import com.epmet.service.UserPointActionLogService;
import com.epmet.service.UserPointStatisticalDailyService;
import com.epmet.service.UserPointTotalService;
import com.epmet.service.*;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
import com.epmet.utils.RuleCycleEnum;
@ -77,6 +77,10 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
private UserPointStatisticalDailyService userPointStatisticalDailyService;
@Autowired
private PointRuleServiceImpl pointRuleService;
@Autowired
private BizPointTotalDetailService bizPointTotalDetailService;
@Autowired
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Override
public PageData<UserPointActionLogDTO> page(Map<String, Object> params) {
IPage<UserPointActionLogEntity> page = baseDao.selectPage(
@ -263,7 +267,9 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
if(ruleInfo.getUpLimit() > NumConstant.ZERO){
//不按照sourceId查询,查询指定日期内的相关积分规则的总和
Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,null,event.getCustomerId(),dateCheck,right);
if(null == sum) sum = NumConstant.ZERO;
if(null == sum) {
sum = NumConstant.ZERO;
}
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_PLUS,ruleInfo.getOperateType())){
if(ruleInfo.getPoint() < NumConstant.ZERO){
//保证要加的积分是正数
@ -342,6 +348,47 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
point.setCreatedBy(StringUtils.isBlank(event.getOperatorId()) ? ModuleConstant.CREATED_BY_SYSTEM : event.getOperatorId());
point.setUpdatedBy(StringUtils.isBlank(event.getOperatorId()) ? ModuleConstant.CREATED_BY_SYSTEM : event.getOperatorId());
userPointTotalService.insertOrUpdate(point);
//
if (("resi_group").equals(event.getEventClass())) {
//2021.04.20 小组积分统计
//个人小组积分
BizPointUserTotalDetailDTO userTotalDetailDTO = bizPointUserTotalDetailService.getDataByObject("group", event.getSourceId(),
event.getUserId());
if (null == userTotalDetailDTO) {
userTotalDetailDTO = new BizPointUserTotalDetailDTO();
userTotalDetailDTO.setCustomerId(event.getCustomerId());
userTotalDetailDTO.setAgencyId(event.getAgencyId());
userTotalDetailDTO.setGridId(event.getGridId());
userTotalDetailDTO.setUserId(event.getUserId());
userTotalDetailDTO.setBizType("group");
userTotalDetailDTO.setObjectId(event.getSourceId());
userTotalDetailDTO.setTotalPoint(event.getPoint());
bizPointUserTotalDetailService.save(userTotalDetailDTO);
} else {
userTotalDetailDTO.setTotalPoint(userTotalDetailDTO.getTotalPoint() + event.getPoint());
userTotalDetailDTO.setUpdatedTime(new Date());
bizPointUserTotalDetailService.update(userTotalDetailDTO);
}
//小组总积分
BizPointTotalDetailDTO totalDetailDTO = bizPointTotalDetailService.getDataByObject("group", event.getSourceId());
Integer total = bizPointUserTotalDetailService.getTotalByObject("group", event.getSourceId());
if (null == totalDetailDTO) {
totalDetailDTO = new BizPointTotalDetailDTO();
totalDetailDTO.setCustomerId(event.getCustomerId());
totalDetailDTO.setAgencyId(event.getAgencyId());
totalDetailDTO.setGridId(event.getGridId());
totalDetailDTO.setBizType("group");
totalDetailDTO.setObjectId(event.getSourceId());
totalDetailDTO.setTotalPoint(total);
bizPointUserTotalDetailService.save(userTotalDetailDTO);
} else {
totalDetailDTO.setTotalPoint(total);
totalDetailDTO.setUpdatedTime(new Date());
bizPointUserTotalDetailService.update(userTotalDetailDTO);
}
}
}else{

33
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml

@ -0,0 +1,33 @@
<?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.epmet.dao.BizPointTotalDetailDao">
<resultMap type="com.epmet.entity.BizPointTotalDetailEntity" id="bizPointTotalDetailMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="bizType" column="BIZ_TYPE"/>
<result property="objectId" column="OBJECT_ID"/>
<result property="totalPoint" column="TOTAL_POINT"/>
<result property="delFlag" column="DEL_FLAG"/>
<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"/>
</resultMap>
<select id="selectDataByObject" resultType="com.epmet.dto.BizPointTotalDetailDTO">
select ID,
CUSTOMER_ID,
AGENCY_ID,
GRID_ID,
TOTAL_POINT
from biz_point_total_detail
where BIZ_TYPE = #{type}
and OBJECT_ID = #{objectId}
</select>
</mapper>

32
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointUserTotalDetailDao.xml

@ -0,0 +1,32 @@
<?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.epmet.dao.BizPointUserTotalDetailDao">
<resultMap type="com.epmet.entity.BizPointUserTotalDetailEntity" id="bizPointUserTotalDetailMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="userId" column="USER_ID"/>
<result property="bizType" column="BIZ_TYPE"/>
<result property="objectId" column="OBJECT_ID"/>
<result property="totalPoint" column="TOTAL_POINT"/>
<result property="delFlag" column="DEL_FLAG"/>
<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"/>
</resultMap>
<select id="selectIncrease" resultType="java.lang.Integer">
SELECT IFNULL(SUM(TOTAL_POINT), 0)
FROM biz_point_user_total_detail
WHERE
BIZ_TYPE = #{type}
AND OBJECT_ID = #{objectId}
AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
</select>
</mapper>

8
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml

@ -28,7 +28,11 @@
SELECT DISTINCT FUNCTION_ID FROM point_rule WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
</select>
<select id="selectListByFunctionId" resultMap="pointRuleMap">
SELECT ID,RULE_NAME,RULE_DESC,POINT,POINT_UNIT,ENABLED_FLAG FROM point_rule WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND FUNCTION_ID = #{functionId,jdbcType=VARCHAR}
SELECT ID,RULE_NAME,RULE_DESC,POINT,POINT_UNIT,ENABLED_FLAG FROM point_rule
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND FUNCTION_ID = #{functionId,jdbcType=VARCHAR}
AND DEL_FLAG = '0'
</select>
<update id="updateByCustomerId">
UPDATE point_rule
@ -50,4 +54,4 @@
<select id="selectCustomerIds" resultType="java.lang.String">
SELECT DISTINCT CUSTOMER_ID FROM point_rule WHERE DEL_FLAG = '0'
</select>
</mapper>
</mapper>

2
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java

@ -117,4 +117,6 @@ public interface TopicConstant {
* 字段 附件类型 大写 下划线
*/
String FIELD_TOPIC_ATTACHMENT_TYPE = "ATTACHMENT_TYPE";
String RESOLVED = "resolved";
}

96
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupAchievementConfigDTO.java

@ -0,0 +1,96 @@
/**
* 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.epmet.resi.group.dto.group;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小组成就配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Data
public class ResiGroupAchievementConfigDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 里程名称
*/
private String achievementName;
/**
* 前一个里程值
*/
private Integer preValue;
/**
* 目标值
*/
private Integer targetValue;
/**
* 里程类型小组人数membertopic话题数转议题数toIssue话题解决数resloveTopic
*/
private String achievementType;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

111
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupAchievementStatsDTO.java

@ -0,0 +1,111 @@
/**
* 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.epmet.resi.group.dto.group;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小组成就统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Data
public class ResiGroupAchievementStatsDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 小组Id
*/
private String groupId;
/**
* 里程ID
*/
private String achievementId;
/**
* 里程名称
*/
private String achievementName;
/**
* 实现时间
*/
private Date arriveTime;
/**
* 当前值
*/
private Integer currentValue;
/**
* 目标值
*/
private Integer targetValue;
/**
* 目标是否实现10
*/
private Integer isArrive;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

10
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java

@ -85,6 +85,16 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
*/
private String visitSwitch;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
/**
* 小组等级
*/
private Integer level;
/**
* 删除标记 0未删除1已删除
*/

17
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.resi.group.dto.group.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/19 15:57
*/
@Data
public class GroupFormDTO implements Serializable {
private static final long serialVersionUID = 5330629771935235995L;
private String groupId;
private String gridId;
}

37
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AchievementDetailResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/19 14:19
*/
@NoArgsConstructor
@Data
public class AchievementDetailResultDTO implements Serializable {
private static final long serialVersionUID = 2426917315141725167L;
/**
* 小组创建时间
*/
private Long createdDate;
private List<AchievementBean> achievement;
@NoArgsConstructor
@Data
public static class AchievementBean {
/**
* 达成时间
*/
private Long completionDate;
/**
* 成就描述分拼在一起
*/
private String describe;
}
}

46
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupPointDetailResultDTO.java

@ -0,0 +1,46 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 10:37
*/
@NoArgsConstructor
@Data
public class GroupPointDetailResultDTO implements Serializable {
private static final long serialVersionUID = -1158521486690554498L;
/**
* 小组当前等级
*/
private String level;
/**
* 总积分
*/
private String total;
/**
* 今日增长
*/
private String increase;
/**
* 距离升级所需积分
*/
private String toUpgrade;
/**
* 下一等级积分
*/
private String nextLevelPoint;
/**
* 下一等级
*/
private String nextLevel;
/**
* 当前积分
*/
private String currentPoint;
}

17
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/AchievementResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.resi.group.dto.member.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/22 9:24
*/
@Data
public class AchievementResultDTO implements Serializable {
private static final long serialVersionUID = 8079550501852632061L;
private List<String> achievement;
}

17
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupAchievementDTO.java

@ -0,0 +1,17 @@
package com.epmet.resi.group.dto.member.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/22 9:42
*/
@Data
public class GroupAchievementDTO implements Serializable {
private static final long serialVersionUID = 2195790168656351743L;
private String groupName;
private String achievementName;
}

35
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java

@ -5,10 +5,7 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.ApplicationDetailCopyResultDTO;
import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO;
import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO;
import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.*;
@ -217,4 +214,34 @@ public interface ResiGroupOpenFeignClient {
**/
@PostMapping(value = "/resi/group/topic/topicattachmentlist")
Result<TopicAttachmentResultDTO> topicAttachmentList(@RequestBody TopicAttachmentFormDTO formDTO);
/**
* 获取小组详情
* @author zhaoqifeng
* @date 2021/4/21 15:20
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.ResiGroupDTO>
*/
@PostMapping("resi/group/group/groupDetail/{groupId}")
Result<ResiGroupDTO> getGroupDetail(@PathVariable String groupId);
/**
* 获取网格下小组
* @author zhaoqifeng
* @date 2021/4/21 15:57
* @param gridId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.resi.group.dto.group.ResiGroupDTO>>
*/
@PostMapping("resi/group/group/groupList/{gridId}")
Result<List<ResiGroupDTO>> getGroupListByGrid(@PathVariable String gridId);
/**
* 小组积分详情
* @author zhaoqifeng
* @date 2021/4/21 16:30
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
*/
@PostMapping("resi/group/group/groupPointDetail/{groupId}")
Result<GroupPointDetailResultDTO> groupPointDetail(@PathVariable String groupId);
}

40
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java

@ -11,6 +11,7 @@ import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO;
import com.epmet.resi.group.dto.group.form.ApplicationDetailFormDTO;
import com.epmet.resi.group.dto.group.form.GroupInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.*;
@ -165,4 +166,43 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien
public Result<TopicAttachmentResultDTO> topicAttachmentList(TopicAttachmentFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "topicAttachmentList", formDTO);
}
/**
* 获取小组详情
*
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.ResiGroupDTO>
* @author zhaoqifeng
* @date 2021/4/21 15:20
*/
@Override
public Result<ResiGroupDTO> getGroupDetail(String groupId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGroupDetail", groupId);
}
/**
* 获取网格下小组
*
* @param gridId
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.resi.group.dto.group.ResiGroupDTO>>
* @author zhaoqifeng
* @date 2021/4/21 15:57
*/
@Override
public Result<List<ResiGroupDTO>> getGroupListByGrid(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGroupListByGrid", gridId);
}
/**
* 小组积分详情
*
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 16:30
*/
@Override
public Result<GroupPointDetailResultDTO> groupPointDetail(String groupId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "groupPointDetail", groupId);
}
}

49
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/enums/AchievementTypeEnum.java

@ -0,0 +1,49 @@
package com.epmet.modules.enums;
/**
* 小组成就类型枚举类
* dev|test|prod
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum AchievementTypeEnum {
/**
* 环境变量枚举
*/
MEMBER("member", "小组成员数"),
TOPIC("topic", "话题数"),
TOISSUE("toissue", "转议题数"),
RESOVLE_TOPIC("resovletopic", "解决话题数"),
;
private String code;
private String name;
AchievementTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static AchievementTypeEnum getEnum(String code) {
AchievementTypeEnum[] values = AchievementTypeEnum.values();
for (AchievementTypeEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}

68
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -31,12 +31,19 @@ import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO;
import com.epmet.resi.group.dto.member.result.AchievementResultDTO;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
@ -510,4 +517,65 @@ public class ResiGroupController {
return new Result<List<AllGroupListResultDTO>>().ok(resiGroupService.allGroupList(formDTO));
}
/**
* 小组成就详情
* @author zhaoqifeng
* @date 2021/4/19 14:25
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.AchievementDetailResultDTO>
*/
@PostMapping("achievementdetail")
public Result<AchievementDetailResultDTO> achievementDetail(@RequestBody GroupFormDTO formDTO) {
return new Result<AchievementDetailResultDTO>().ok(resiGroupService.achievementDetail(formDTO));
}
/**
* 获取小组详情
* @author zhaoqifeng
* @date 2021/4/21 15:17
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.ResiGroupDTO>
*/
@PostMapping("groupDetail/{groupId}")
public Result<ResiGroupDTO> getGroupDetail(@PathVariable String groupId) {
ResiGroupDTO groupDTO = resiGroupService.get(groupId);
return new Result<ResiGroupDTO>().ok(groupDTO);
}
/**
* 获取网格下小组
* @author zhaoqifeng
* @date 2021/4/21 15:57
* @param gridId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.resi.group.dto.group.ResiGroupDTO>>
*/
@PostMapping("groupList/{gridId}")
public Result<List<ResiGroupDTO>> getGroupListByGrid(@PathVariable String gridId) {
List<ResiGroupDTO> list = resiGroupService.getGroupListByGrid(gridId);
return new Result<List<ResiGroupDTO>>().ok(list);
}
/**
* 小组积分详情
* @author zhaoqifeng
* @date 2021/4/21 16:22
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
*/
@PostMapping("groupPointDetail/{groupId}")
public Result<GroupPointDetailResultDTO> groupPointDetail(@PathVariable String groupId) {
return new Result<GroupPointDetailResultDTO>().ok(resiGroupService.groupPointDetail(groupId));
}
/**
* 小组近段时间实现的成就列表
* @author zhaoqifeng
* @date 2021/4/22 9:27
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.member.result.AchievementResultDTO>
*/
@PostMapping("achievement")
public Result<AchievementResultDTO> achievement(@LoginUser TokenDto tokenDto) {
return new Result<AchievementResultDTO>().ok(resiGroupService.achievement(tokenDto));
}
}

33
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementConfigDao.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.epmet.modules.group.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 小组成就配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Mapper
public interface ResiGroupAchievementConfigDao extends BaseDao<ResiGroupAchievementConfigEntity> {
}

44
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementStatsDao.java

@ -0,0 +1,44 @@
/**
* 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.epmet.modules.group.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 小组成就统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Mapper
public interface ResiGroupAchievementStatsDao extends BaseDao<ResiGroupAchievementStatsEntity> {
/**
* 获取未完成的成就
* @author zhaoqifeng
* @date 2021/4/19 15:52
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
*/
List<ResiGroupAchievementStatsDTO> selectUnAchieved(@Param("groupId") String groupId);
}

11
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java

@ -26,6 +26,7 @@ import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.notice.result.UnReadListResultDTO;
import com.epmet.resi.group.dto.topic.result.LatestTenResultDTO;
import com.epmet.resi.group.dto.member.result.GroupAchievementDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -212,7 +213,6 @@ public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
int countExistsGroupNameBeforeEdit(@Param("groupId") String groupId,
@Param("gridId") String gridId,
@Param("groupName") String groupName);
/**
/**
* @Description 查询话题所属小组名
@ -296,4 +296,13 @@ public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
* @date 2021/4/21 下午5:08
*/
List<UnReadListResultDTO> selectUnReadInfos(@Param("ids")List<String> ids);
/**
* 我所在小组最近完成的成就
* @author zhaoqifeng
* @date 2021/4/22 9:47
* @param userId
* @return java.util.List<com.epmet.resi.group.dto.member.result.GroupAchievementDTO>
*/
List<GroupAchievementDTO> selectRecentGroupAchievements(@Param("userId") String userId);
}

66
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementConfigEntity.java

@ -0,0 +1,66 @@
/**
* 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.epmet.modules.group.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 小组成就配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("resi_group_achievement_config")
public class ResiGroupAchievementConfigEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 里程名称
*/
private String achievementName;
/**
* 前一个里程值
*/
private Integer preValue;
/**
* 目标值
*/
private Integer targetValue;
/**
* 里程类型小组人数membertopic话题数转议题数toIssue话题解决数resloveTopic
*/
private String achievementType;
}

81
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementStatsEntity.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.epmet.modules.group.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 小组成就统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("resi_group_achievement_stats")
public class ResiGroupAchievementStatsEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 小组Id
*/
private String groupId;
/**
* 里程ID
*/
private String achievementId;
/**
* 里程名称
*/
private String achievementName;
/**
* 实现时间
*/
private Date arriveTime;
/**
* 当前值
*/
private Integer currentValue;
/**
* 目标值
*/
private Integer targetValue;
/**
* 目标是否实现10
*/
private Integer isArrive;
}

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java

@ -88,4 +88,9 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
/**
* 小组等级
*/
private Integer level;
}

95
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementConfigService.java

@ -0,0 +1,95 @@
/**
* 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.epmet.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
import com.epmet.resi.group.dto.group.ResiGroupAchievementConfigDTO;
import java.util.List;
import java.util.Map;
/**
* 小组成就配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
public interface ResiGroupAchievementConfigService extends BaseService<ResiGroupAchievementConfigEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ResiGroupMilestoneConfigDTO>
* @author generator
* @date 2021-04-19
*/
PageData<ResiGroupAchievementConfigDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ResiGroupMilestoneConfigDTO>
* @author generator
* @date 2021-04-19
*/
List<ResiGroupAchievementConfigDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ResiGroupMilestoneConfigDTO
* @author generator
* @date 2021-04-19
*/
ResiGroupAchievementConfigDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-04-19
*/
void save(ResiGroupAchievementConfigDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-04-19
*/
void update(ResiGroupAchievementConfigDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-04-19
*/
void delete(String[] ids);
}

113
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementStatsService.java

@ -0,0 +1,113 @@
/**
* 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.epmet.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO;
import java.util.List;
import java.util.Map;
/**
* 小组成就统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
public interface ResiGroupAchievementStatsService extends BaseService<ResiGroupAchievementStatsEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ResiGroupMilestoneStatsDTO>
* @author generator
* @date 2021-04-19
*/
PageData<ResiGroupAchievementStatsDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ResiGroupMilestoneStatsDTO>
* @author generator
* @date 2021-04-19
*/
List<ResiGroupAchievementStatsDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ResiGroupMilestoneStatsDTO
* @author generator
* @date 2021-04-19
*/
ResiGroupAchievementStatsDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-04-19
*/
void save(ResiGroupAchievementStatsDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-04-19
*/
void update(ResiGroupAchievementStatsDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-04-19
*/
void delete(String[] ids);
/**
* 已达成的成就
* @author zhaoqifeng
* @date 2021/4/19 15:15
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
*/
List<ResiGroupAchievementStatsDTO> getAchieved(String groupId);
/**
* 未达成的成就
* @author zhaoqifeng
* @date 2021/4/19 15:15
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
*/
List<ResiGroupAchievementStatsDTO> getUnAchieved(String groupId);
}

39
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java

@ -20,6 +20,7 @@ package com.epmet.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.resi.group.dto.UserRoleDTO;
@ -28,6 +29,8 @@ import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import com.epmet.resi.group.dto.member.result.AchievementResultDTO;
import jdk.nashorn.internal.parser.Token;
import java.util.HashMap;
import java.util.List;
@ -378,4 +381,40 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @Description 所有小组查询
**/
List<AllGroupListResultDTO> allGroupList(AllGroupListFormDTO formDTO);
/**
* 小组成就详情
* @author zhaoqifeng
* @date 2021/4/19 14:25
* @param formDTO
* @return com.epmet.resi.group.dto.group.result.AchievementDetailResultDTO
*/
AchievementDetailResultDTO achievementDetail(GroupFormDTO formDTO);
/**
* 获取网格下小组列表
* @author zhaoqifeng
* @date 2021/4/21 15:42
* @param gridId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupDTO>
*/
List<ResiGroupDTO> getGroupListByGrid(String gridId);
/**
* 小组积分详情
* @author zhaoqifeng
* @date 2021/4/21 16:22
* @param groupId
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO
*/
GroupPointDetailResultDTO groupPointDetail(String groupId);
/**
* 小组近段时间实现的成就列表
* @author zhaoqifeng
* @date 2021/4/22 9:27
* @param tokenDto
* @return com.epmet.resi.group.dto.member.result.AchievementResultDTO
*/
AchievementResultDTO achievement(TokenDto tokenDto);
}

100
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupAchievementConfigServiceImpl.java

@ -0,0 +1,100 @@
/**
* 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.epmet.modules.group.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.modules.group.dao.ResiGroupAchievementConfigDao;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
import com.epmet.modules.group.service.ResiGroupAchievementConfigService;
import com.epmet.resi.group.dto.group.ResiGroupAchievementConfigDTO;
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 generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Service
public class ResiGroupAchievementConfigServiceImpl extends BaseServiceImpl<ResiGroupAchievementConfigDao, ResiGroupAchievementConfigEntity> implements ResiGroupAchievementConfigService {
@Override
public PageData<ResiGroupAchievementConfigDTO> page(Map<String, Object> params) {
IPage<ResiGroupAchievementConfigEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiGroupAchievementConfigDTO.class);
}
@Override
public List<ResiGroupAchievementConfigDTO> list(Map<String, Object> params) {
List<ResiGroupAchievementConfigEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiGroupAchievementConfigDTO.class);
}
private QueryWrapper<ResiGroupAchievementConfigEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiGroupAchievementConfigEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ResiGroupAchievementConfigDTO get(String id) {
ResiGroupAchievementConfigEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ResiGroupAchievementConfigDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ResiGroupAchievementConfigDTO dto) {
ResiGroupAchievementConfigEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupAchievementConfigEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ResiGroupAchievementConfigDTO dto) {
ResiGroupAchievementConfigEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupAchievementConfigEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

133
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupAchievementStatsServiceImpl.java

@ -0,0 +1,133 @@
/**
* 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.epmet.modules.group.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.modules.group.dao.ResiGroupAchievementStatsDao;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.modules.group.service.ResiGroupAchievementStatsService;
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO;
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 generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Service
public class ResiGroupAchievementStatsServiceImpl extends BaseServiceImpl<ResiGroupAchievementStatsDao, ResiGroupAchievementStatsEntity> implements ResiGroupAchievementStatsService {
@Override
public PageData<ResiGroupAchievementStatsDTO> page(Map<String, Object> params) {
IPage<ResiGroupAchievementStatsEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiGroupAchievementStatsDTO.class);
}
@Override
public List<ResiGroupAchievementStatsDTO> list(Map<String, Object> params) {
List<ResiGroupAchievementStatsEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiGroupAchievementStatsDTO.class);
}
private QueryWrapper<ResiGroupAchievementStatsEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiGroupAchievementStatsEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ResiGroupAchievementStatsDTO get(String id) {
ResiGroupAchievementStatsEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ResiGroupAchievementStatsDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ResiGroupAchievementStatsDTO dto) {
ResiGroupAchievementStatsEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupAchievementStatsEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ResiGroupAchievementStatsDTO dto) {
ResiGroupAchievementStatsEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupAchievementStatsEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 已达成的成就
*
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
* @author zhaoqifeng
* @date 2021/4/19 15:15
*/
@Override
public List<ResiGroupAchievementStatsDTO> getAchieved(String groupId) {
QueryWrapper<ResiGroupAchievementStatsEntity> wrapper = new QueryWrapper<>();
wrapper.eq("GROUP_ID", groupId);
wrapper.eq("IS_ARRIVE", NumConstant.ONE);
wrapper.eq("DEL_FLAG", NumConstant.ZERO);
wrapper.orderByDesc("ARRIVE_TIME");
List<ResiGroupAchievementStatsEntity> list = baseDao.selectList(wrapper);
return ConvertUtils.sourceToTarget(list, ResiGroupAchievementStatsDTO.class);
}
/**
* 未达成的成就
*
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
* @author zhaoqifeng
* @date 2021/4/19 15:15
*/
@Override
public List<ResiGroupAchievementStatsDTO> getUnAchieved(String groupId) {
return baseDao.selectUnAchieved(groupId);
}
}

124
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -30,6 +30,7 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
@ -40,6 +41,7 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.group.constant.GroupConstant;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.modules.feign.EpmetMessageFeignClient;
@ -52,15 +54,13 @@ import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.entity.ResiGroupOperationEntity;
import com.epmet.modules.group.redis.ResiGroupRedis;
import com.epmet.modules.group.service.ResiGroupCodeService;
import com.epmet.modules.group.service.ResiGroupOperationService;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.group.service.ResiGroupStatisticalService;
import com.epmet.modules.group.service.*;
import com.epmet.modules.member.dao.GroupMemeberOperationDao;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
import com.epmet.modules.member.redis.ResiGroupMemberRedis;
import com.epmet.modules.member.service.GroupMemeberOperationService;
import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.support.GroupLevelUtils;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.constant.*;
import com.epmet.resi.group.dto.UserRoleDTO;
@ -73,7 +73,10 @@ import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import com.epmet.resi.group.dto.member.result.AchievementResultDTO;
import com.epmet.resi.group.dto.member.result.GroupAchievementDTO;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -83,7 +86,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.CollectionUtils;
import java.text.SimpleDateFormat;
import java.util.*;
@ -164,6 +166,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Autowired
private ResiGroupCodeService resiGroupCodeService;
@Autowired
private ResiGroupAchievementStatsService resiGroupAchievementStatsService;
@Override
public PageData<ResiGroupDTO> page(Map<String, Object> params) {
IPage<ResiGroupEntity> page = baseDao.selectPage(
@ -966,7 +971,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
**/
@Override
public List<String> getGroupIdByGridId(String gridId) {
if(StringUtils.isBlank(gridId)) return null;
if(StringUtils.isBlank(gridId)) {
return null;
}
return baseDao.getGroupIdByGridId(gridId);
}
@ -979,8 +986,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
**/
@Override
public Map<String, Set<String>> getGroupIdsByGridIdList(List<String> gridIdList) {
if(null == gridIdList || gridIdList.size() < NumConstant.ONE)
return null;
if(null == gridIdList || gridIdList.size() < NumConstant.ONE) {
return null;
}
Map<String, Set<String>> result = new HashMap<>();
List<ResiGroupDTO> groups = new ArrayList<>();
Map<String,List<ResiGroupDTO>> groupMap
@ -1189,6 +1197,106 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
update(after);
}
/**
* 小组成就详情
*
* @param formDTO
* @return com.epmet.resi.group.dto.group.result.AchievementDetailResultDTO
* @author zhaoqifeng
* @date 2021/4/19 14:25
*/
@Override
public AchievementDetailResultDTO achievementDetail(GroupFormDTO formDTO) {
AchievementDetailResultDTO resultDTO = new AchievementDetailResultDTO();
List<AchievementDetailResultDTO.AchievementBean> achievementList = new ArrayList<>();
//1.小组创建时间
ResiGroupEntity group = baseDao.selectById(formDTO.getGroupId());
resultDTO.setCreatedDate(DateUtils.dateToTimestamp(group.getCreatedTime()));
//2.即将完成的3个成就
List<ResiGroupAchievementStatsDTO> unAchievedList = resiGroupAchievementStatsService.getUnAchieved(formDTO.getGroupId());
if (CollectionUtils.isNotEmpty(unAchievedList)) {
unAchievedList.forEach(item -> {
AchievementDetailResultDTO.AchievementBean bean = new AchievementDetailResultDTO.AchievementBean();
String describe = item.getAchievementName() + "(" + item.getCurrentValue().toString() + "/" + item.getTargetValue().toString() + ")";
bean.setDescribe(describe);
achievementList.add(bean);
});
}
//3.已完成的成就
List<ResiGroupAchievementStatsDTO> achievedList = resiGroupAchievementStatsService.getAchieved(formDTO.getGroupId());
if (CollectionUtils.isNotEmpty(achievedList)) {
achievedList.forEach(item -> {
AchievementDetailResultDTO.AchievementBean bean = new AchievementDetailResultDTO.AchievementBean();
bean.setDescribe(item.getAchievementName());
bean.setCompletionDate(DateUtils.dateToTimestamp(item.getArriveTime()));
achievementList.add(bean);
});
}
resultDTO.setAchievement(achievementList);
return resultDTO;
}
/**
* 获取网格下小组列表
*
* @param gridId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupDTO>
* @author zhaoqifeng
* @date 2021/4/21 15:42
*/
@Override
public List<ResiGroupDTO> getGroupListByGrid(String gridId) {
QueryWrapper<ResiGroupEntity> wrapper = new QueryWrapper<>();
wrapper.eq("GRID_ID", gridId)
.eq("STATE", GroupStateConstant.GROUP_APPROVED)
.eq("DEL_FLAG", NumConstant.ZERO_STR);
List<ResiGroupEntity> list = baseDao.selectList(wrapper);
return ConvertUtils.sourceToTarget(list, ResiGroupDTO.class);
}
/**
* 小组积分详情
*
* @param groupId
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO
* @author zhaoqifeng
* @date 2021/4/21 16:22
*/
@Override
public GroupPointDetailResultDTO groupPointDetail(String groupId) {
GroupPointDetailResultDTO result = new GroupPointDetailResultDTO();
ResiGroupEntity group = baseDao.selectById(groupId);
Integer nextLevel = group.getLevel() + 1;
Integer nextLevelPoint = GroupLevelUtils.getPoint(nextLevel);
result.setLevel("LV" + group.getLevel().toString());
result.setNextLevel("LV" + nextLevel.toString());
result.setNextLevelPoint(nextLevelPoint.toString());
return result;
}
/**
* 小组近段时间实现的成就列表
*
* @param tokenDto
* @return com.epmet.resi.group.dto.member.result.AchievementResultDTO
* @author zhaoqifeng
* @date 2021/4/22 9:27
*/
@Override
public AchievementResultDTO achievement(TokenDto tokenDto) {
AchievementResultDTO result = new AchievementResultDTO();
List<String> achievements = new ArrayList<>();
List<GroupAchievementDTO> list = baseDao.selectRecentGroupAchievements(tokenDto.getUserId());
if (CollectionUtils.isNotEmpty(list)) {
achievements = list.stream().map(item -> {
return item.getGroupName() + ":" + "达成“" + item.getAchievementName() + "”" + "成就";
}).collect(Collectors.toList());
}
result.setAchievement(achievements);
return result;
}
@Override
public GroupDetailResultDTO getGroupDetail(String groupId) {
GroupDetailResultDTO groupDetail = new GroupDetailResultDTO();

55
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java

@ -36,10 +36,13 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.dto.IssueShareLinkRecordDTO;
import com.epmet.dto.IssueShareLinkVisitRecordDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.redis.ResiGroupRedis;
@ -115,6 +118,8 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl<GroupMemeb
private EpmetUserOpenFeignClient userClient;
@Autowired
private TopicShareLinkVisitRecordDao topicShareLinkVisitRecordDao;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Override
public PageData<GroupMemeberOperationDTO> page(Map<String, Object> params) {
@ -292,11 +297,12 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl<GroupMemeb
groupMemeberOperation.setGroupInvitationId(param.getShareLinkId());
groupMemeberOperation.setOperateUserId(param.getUserId());
ResiGroupMemberInfoRedisDTO memberInfo = memberRedis.get(groupId, inviter);
if(null != memberInfo && StringUtils.isNotBlank(memberInfo.getUserShowName()))
if(null != memberInfo && StringUtils.isNotBlank(memberInfo.getUserShowName())) {
groupMemeberOperation.setOperateDes(String.format("通过%s的",memberInfo.getUserShowName())
+ (StringUtils.equals("topic",param.getShareLinkType()) ? "话题" : "议题" )+ "分享加入小组");
else
} else {
groupMemeberOperation.setOperateDes(StringUtils.equals("topic",param.getShareLinkType()) ? "通过话题分享申请入组" : "通过议题分享申请入组" );
}
//入组审核开关是开启状态则需要组长审核
if (StringUtils.equals(GroupStateConstant.AUDIT_SWITCH_OPEN , resiGroupDTO.getAuditSwitch())) {
groupMemeberOperation.setOperateStatus(MemberStateConstant.UNDER_AUDITTING);
@ -321,17 +327,30 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl<GroupMemeb
log.error("【{}】该用户入组方式为话题分享链接入组,但未查询到链接访问记录,链接Id【{}】",param.getUserId(),param.getShareLinkId());
throw new RenException("未找到链接访问记录");
}
if(NumConstant.ZERO == record.getIsInviteRegister()) isNew = true;
if(NumConstant.ZERO == record.getIsInviteRegister()) {
isNew = true;
}
}else{
Result<IssueShareLinkVisitRecordDTO> visitRecordResult = issueOpenFeignClient.visitRecord(param.getShareLinkId(), param.getUserId());
if(!visitRecordResult.success() || null == visitRecordResult.getData()){
log.error("【{}】该用户入组方式为议题分享链接入组,但未查询到链接访问记录,链接Id【{}】",param.getUserId(),param.getShareLinkId());
throw new RenException("未找到链接访问记录");
}
if(NumConstant.ZERO == visitRecordResult.getData().getIsInviteRegister()) isNew = true;
if(NumConstant.ZERO == visitRecordResult.getData().getIsInviteRegister()) {
isNew = true;
}
}
if(StringUtils.isNotBlank(inviter)){
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(resiGroupDTO.getGridId());
dataFilterParam.setUserId(param.getUserId());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
//mq的事件类型
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
//事件code
@ -340,11 +359,15 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl<GroupMemeb
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(resiGroupDTO.getCustomerId());
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setGridId(resiGroupDTO.getGridId());
pointEventMsg.setSourceId(groupId);
pointEventMsg.setUserId(inviter);
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setTargetDate(current);
pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag());
pointEventMsg.setEventClass(mqBaseMsgDTO.getEventClass());
//pointEventMsg.setRemark("通过".concat(StringUtils.equals(param.getShareLinkType(),"topic")
// ? "话题":"议题").concat("分享链接邀请").concat(isNew ? "新" : "").concat("用户进组"));
@ -391,15 +414,21 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl<GroupMemeb
groupCache.getGroupStatisticalInfo().setTotalMembers(
null == groupCache.getGroupStatisticalInfo().getTotalMembers() ? NumConstant.TWO : groupCache.getGroupStatisticalInfo().getTotalMembers() +NumConstant.ONE
);
if(StringUtils.equals(userRoleDTO.getPartymemberFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalPartyMembers(
null == groupCache.getGroupStatisticalInfo().getTotalPartyMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalPartyMembers()+NumConstant.ONE
);
if(StringUtils.equals(userRoleDTO.getRegisteredResiFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalNormalMembers(
null == groupCache.getGroupStatisticalInfo().getTotalNormalMembers() ? NumConstant.TWO : groupCache.getGroupStatisticalInfo().getTotalNormalMembers()+NumConstant.ONE
);
if(StringUtils.equals(userRoleDTO.getWarmHeartedFlag(),NumConstant.ONE_STR)) groupCache.getGroupStatisticalInfo().setTotalEarnestMembers(
null == groupCache.getGroupStatisticalInfo().getTotalEarnestMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalEarnestMembers()+NumConstant.ONE
);
if(StringUtils.equals(userRoleDTO.getPartymemberFlag(),NumConstant.ONE_STR)) {
groupCache.getGroupStatisticalInfo().setTotalPartyMembers(
null == groupCache.getGroupStatisticalInfo().getTotalPartyMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalPartyMembers()+NumConstant.ONE
);
}
if(StringUtils.equals(userRoleDTO.getRegisteredResiFlag(),NumConstant.ONE_STR)) {
groupCache.getGroupStatisticalInfo().setTotalNormalMembers(
null == groupCache.getGroupStatisticalInfo().getTotalNormalMembers() ? NumConstant.TWO : groupCache.getGroupStatisticalInfo().getTotalNormalMembers()+NumConstant.ONE
);
}
if(StringUtils.equals(userRoleDTO.getWarmHeartedFlag(),NumConstant.ONE_STR)) {
groupCache.getGroupStatisticalInfo().setTotalEarnestMembers(
null == groupCache.getGroupStatisticalInfo().getTotalEarnestMembers() ? NumConstant.ONE : groupCache.getGroupStatisticalInfo().getTotalEarnestMembers()+NumConstant.ONE
);
}
groupRedis.set(groupCache);
}
//发送消息

25
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java

@ -34,6 +34,8 @@ import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.dto.IssueShareLinkVisitRecordDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
@ -42,6 +44,7 @@ import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.modules.constant.GroupMemberConstant;
import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.redis.ResiGroupRedis;
@ -130,6 +133,8 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
private GovIssueOpenFeignClient issueClient;
@Autowired
private TopicShareLinkVisitRecordService topicShareLinkVisitRecordService;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Override
public PageData<ResiGroupMemberDTO> page(Map<String, Object> params) {
@ -577,7 +582,9 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
logger.error("【{}】该用户入组方式为话题分享链接入组,但未查询到链接访问记录,链接Id【{}】",groupMemeberOperationDTO.getCustomerUserId(),groupMemeberOperationDTO.getGroupInvitationId());
return;
}
if(NumConstant.ZERO == visitRecord.getIsInviteRegister()) isNew = true;
if(NumConstant.ZERO == visitRecord.getIsInviteRegister()) {
isNew = true;
}
inviter = visitRecord.getShareUserId();
}else if(StringUtils.equals(groupMemeberOperationDTO.getEnterGroupType(),ModuleConstant.ENTER_GROUP_TYPE_ISSUE_LINK)){
Result<IssueShareLinkVisitRecordDTO> response = issueClient.visitRecord(groupMemeberOperationDTO.getGroupInvitationId(), groupMemeberOperationDTO.getCustomerUserId());
@ -586,7 +593,9 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
logger.error("【{}】该用户入组方式为议题分享链接入组,但并不是通过该链接发起的入群申请,链接Id【{}】",groupMemeberOperationDTO.getCustomerUserId(),groupMemeberOperationDTO.getGroupInvitationId());
return;
}
if(NumConstant.ZERO == response.getData().getIsInviteRegister()) isNew = true;
if(NumConstant.ZERO == response.getData().getIsInviteRegister()) {
isNew = true;
}
inviter = response.getData().getShareUserId();
}else{
logger.error("【{}】该用户入组方式为议题分享链接入组,但未查询到链接访问记录,链接Id【{}】",groupMemeberOperationDTO.getCustomerUserId(),groupMemeberOperationDTO.getGroupInvitationId());
@ -594,6 +603,15 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
}
}
if(StringUtils.isNotBlank(inviter)){
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(groupCache.getGridId());
dataFilterParam.setUserId(inviter);
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
//mq的事件类型
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
mqBaseMsgDTO.setEventClass("resi_group");
@ -602,6 +620,9 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(groupCache.getCustomerId());
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setGridId(groupCache.getGridId());
pointEventMsg.setSourceId(groupCache.getGroupId());
pointEventMsg.setUserId(inviter);
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);

53
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/support/GroupAchievementUtils.java

@ -0,0 +1,53 @@
package com.epmet.modules.support;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
/**
* desc:小组成就下一等级规则工具类
*
* @author: LiuJanJun
* @date: 2021/4/19 4:11 下午
* @version: 1.0
* @remark 利用此工具类生成下一等级的目标值
*/
public class GroupAchievementUtils {
//小组人数、话题数、转议题数、小组内问题解决数
/**
* desc:获取下一等级的话题数目标值 步长500 起始值 500
*
* @param currentValue
*/
public static Integer getNextTopicTargetValue(Integer currentValue) {
if (currentValue < NumConstant.FIVE_HUNDRED) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode());
}
return currentValue + NumConstant.FIVE_HUNDRED;
}
/**
* desc:获取下一等级的转议题数目标值 步长50 起始值 100
*
* @param currentValue
*/
public static Integer getNextToIssueTargetValue(Integer currentValue) {
if (currentValue < NumConstant.ONE_HUNDRED) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode());
}
return currentValue + NumConstant.FIFTY;
}
/**
* desc:获取下一等级的话题解决数目标值 步长100 起始值 100
*
* @param currentValue
*/
public static Integer getNextResolveTopicTargetValue(Integer currentValue) {
if (currentValue < NumConstant.ONE_HUNDRED) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode());
}
return currentValue + NumConstant.ONE_HUNDRED;
}
}

76
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/support/GroupLevelUtils.java

@ -0,0 +1,76 @@
package com.epmet.modules.support;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 小组等级积分工具类
*
* @author zhaoqifeng
* @date 2021/4/21 10:22
*/
@Slf4j
public class GroupLevelUtils {
/**
* 根据等级算出升级所需的积分
*
* @param level
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/21 10:25
* @remark 通项公式an=n(n-1)/2+2n-2(nN+) -3+n(n-1)/2需要特殊处理所以引用前面的
*/
public static Integer getPoint(Integer level) {
if (level == null || level < NumConstant.ONE) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode());
}
Integer point = (level * (level - NumConstant.ONE) / NumConstant.TWO + NumConstant.TWO * level - NumConstant.TWO) * NumConstant.ONE_HUNDRED;
log.info("getPoint level:{},point:{}", level, point);
return point;
}
/**
* 根据积分算出当前的等级
*
* @param point
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/21 10:25
*/
public static Integer getLevel(Integer point) {
if (point == null || point < NumConstant.ZERO) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode());
}
//如果是0 则返回等级1
if (point == NumConstant.ZERO) {
return NumConstant.ONE;
}
AtomicBoolean flag = new AtomicBoolean(false);
AtomicInteger initLevel = new AtomicInteger(1);
do {
Integer point1 = getPoint(initLevel.incrementAndGet());
if (point < point1) {
int i = initLevel.decrementAndGet();
log.info("getLevel level:{},point:{}", i, point);
return i;
}
} while (!flag.get());
return null;
}
public static void main(String[] args) {
for (int i = 1; i < 10; i++) {
System.out.println("lv" + i + ":" + getPoint(i));
}
System.out.println(getLevel(3300));
System.out.println(getLevel(299));
}
}

24
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java

@ -39,12 +39,15 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.comment.entity.ResiTopicCommentEntity;
import com.epmet.modules.constant.ResiGroupRedisKeys;
import com.epmet.modules.constant.WxmpSubscribeConstant;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.redis.ResiGroupRedis;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
import com.epmet.modules.member.redis.ResiGroupMemberRedis;
@ -58,6 +61,7 @@ import com.epmet.resi.group.constant.MemberStateConstant;
import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO;
import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO;
import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO;
@ -112,6 +116,8 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
@Autowired
LoginUserUtil loginUserUtil;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@ -253,12 +259,26 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
if (StringUtils.isBlank(customerId)){
throw new RenException(TopicConstant.GET_CUSTOMER_ID_FAILURE);
}
ResiGroupInfoRedisDTO groupCache = groupRedis.get(topic.getGroupId());
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(groupCache.getGridId());
dataFilterParam.setUserId(tokenDto.getUserId());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
pointEventMsg.setCustomerId(customerId);
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setGridId(groupCache.getGridId());
pointEventMsg.setSourceId(topic.getGroupId());
pointEventMsg.setUserId(tokenDto.getUserId());
// 加分
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag());
pointEventMsg.setEventClass(mqBaseMsgDTO.getEventClass());
//某某小组中评论话题“某某某…”
StringBuilder builder = new StringBuilder(groupRedis.get(topic.getGroupId()).getGroupName()).append("小组中评论");
String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent());
@ -270,7 +290,9 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
(content.substring(NumConstant.ZERO,NumConstant.TEN) + "…") :
content);
builder.append("\"");
}else builder.append("语音话题");
}else {
builder.append("语音话题");
}
pointEventMsg.setRemark(builder.toString());
pointEventMsgList.add(pointEventMsg);

248
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -394,6 +394,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
// 查询此人今日发表话题数量
Integer publishTopicCount = baseDao.selectPublishTopicCountByUserId(tokenDto.getUserId());
if (null != publishTopicCount && publishTopicCount <= NumConstant.THREE){
//mq的事件类型
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
mqBaseMsgDTO.setEventClass(EventEnum.PUBLISH_ONE_TOPIC.getEventClass());
@ -407,13 +408,29 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
if (null == resiGroupEntity){
throw new RenException(TopicConstant.GROUP_INFO_FAILURE);
}
pointEventMsg.setCustomerId(resiGroupEntity.getCustomerId());
pointEventMsg.setGridId(resiGroupEntity.getGridId());
pointEventMsg.setSourceId(resiGroupEntity.getId());
} else {
pointEventMsg.setCustomerId(resiGroupInfoRedisDTO.getCustomerId());
pointEventMsg.setGridId(resiGroupInfoRedisDTO.getGridId());
pointEventMsg.setSourceId(resiGroupInfoRedisDTO.getGroupId());
}
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(pointEventMsg.getGridId());
dataFilterParam.setUserId(tokenDto.getUserId());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setUserId(tokenDto.getUserId());
// 加分
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(mqBaseMsgDTO.getEventTag());
pointEventMsg.setEventClass(mqBaseMsgDTO.getEventClass());
pointEventMsgList.add(pointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList));
@ -707,6 +724,54 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
operation.setCustomerId(loginUserUtil.getLoginUserCustomerId());
resiTopicOperationDao.insertOne(operation);
//2021.04.19组长解决话题积分
if (TopicConstant.RESOLVED.equals(closeFormDTO.getClosedStatus())) {
ResiGroupInfoRedisDTO groupCache = resiGroupRedis.get(topic.getGroupId());
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(groupCache.getGridId());
dataFilterParam.setUserId(tokenDto.getUserId());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
//mq的事件类型
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
mqBaseMsgDTO.setEventClass("resi_group");
//事件code 组长解决组内话题
mqBaseMsgDTO.setEventTag(EventEnum.LEADER_RESOLVE_TOPIC.getEventTag());
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(tokenDto.getCustomerId());
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setGridId(groupCache.getGridId());
pointEventMsg.setSourceId(groupCache.getGroupId());
pointEventMsg.setUserId(tokenDto.getUserId());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(EventEnum.LEADER_RESOLVE_TOPIC.getEventTag());
pointEventMsg.setEventClass(EventEnum.LEADER_RESOLVE_TOPIC.getEventClass());
//将话题“某某某…” (前十个字后面省略号) 转为议题
String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent());
pointEventMsg.setRemark(
(StringUtils.isBlank(content)
|| StringUtils.equals("语音话题", content) ? "语音话题" :
"话题\"" +
content
.substring(NumConstant.ZERO, content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN)
+ (NumConstant.TEN > content.length() ? "\"" : "…\"")) +
"已被解决");
pointEventMsgList.add(pointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList));
if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){
log.error("组长解决话题事件发送失败,参数:{}",JSON.toJSONString(closeFormDTO));
}
}
return new Result();
}
@ -823,8 +888,12 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
if(null == groupEntity || StringUtils.isBlank(groupEntity.getCustomerId())){
log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.getTopicDetail,获取不到组信息,话题Id:{}小组Id:{}",topicId,topicDetail.getGroupId());
throw new RenException(ModuleConstant.NO_SUCH_GROUP);
}else customerId = groupEntity.getCustomerId();
}else customerId = groupCache.getCustomerId();
}else {
customerId = groupEntity.getCustomerId();
}
}else {
customerId = groupCache.getCustomerId();
}
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR
= userOpenFeignClient.userShowBadge(new UserGroupFormDTO(customerId, userId));
@ -835,7 +904,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
Collections.EMPTY_LIST:
badgeR.getData().get(topicDetail.getCreatedBy()).stream().map(UserBadgeUnitFormDTO :: getBadgeIcon).collect(Collectors.toList())
);
}else resultDTO.setBadgeList(Collections.EMPTY_LIST);
}else {
resultDTO.setBadgeList(Collections.EMPTY_LIST);
}
return new Result<ResiTopicIncludeIssueDetailResultDTO>().ok(resultDTO);
}
@ -1617,7 +1688,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
if (operationResult != NumConstant.ONE) {
logger.warn(ModuleConstant.FAILURE_TO_ADD_TOPIC_OPERATION);
}
} else logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC);
} else {
logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC);
}
//7.更新组统计信息 议题数量+1
resiGroupStatisticalDao.incryTotalIssues(group.getGroupId());
if (null != groupCache && null != groupCache.getGroupStatisticalInfo()) {
@ -1642,10 +1715,14 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(groupCache.getCustomerId());
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setGridId(group.getGridId());
pointEventMsg.setSourceId(group.getGroupId());
pointEventMsg.setUserId(group.getTopicAuthorId());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_ISSUE.getEventTag());
pointEventMsg.setEventClass(EventEnum.TOPIC_SHIFTED_TO_ISSUE.getEventClass());
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题
String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent());
pointEventMsg.setRemark(new StringBuilder(groupCache.getGroupName()).append("小组中发布的")
@ -1662,6 +1739,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//2.转话题为议题 组长
BasePointEventMsg pointEventMsg2 = new BasePointEventMsg();
pointEventMsg2.setCustomerId(groupCache.getCustomerId());
pointEventMsg2.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg2.setGridId(group.getGridId());
pointEventMsg.setSourceId(group.getGroupId());
pointEventMsg2.setUserId(topicTurnIssueFromDTO.getUserId());
pointEventMsg2.setActionFlag(MqConstant.PLUS);
pointEventMsg2.setIsCommon(false);
@ -1684,7 +1764,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.AllowAuditionGroup.class);
}
}else throw new RenException(dataFilterResult.getMsg());
}else {
throw new RenException(dataFilterResult.getMsg());
}
return result;
@ -1701,12 +1783,18 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
public IssueShiftedFromTopicFormDTO getIssueInfoWhenAudit(ResiTopicTurnIssueFromDTO param) {
ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(param.getTopicId());
if (null == group) throw new RenException(ModuleConstant.QUERY_GROUPINFO_FAILED);
if (null == group) {
throw new RenException(ModuleConstant.QUERY_GROUPINFO_FAILED);
}
ResiTopicEntity topic = resiTopicDao.selectById(param.getTopicId());
if (null == topic) throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
if (null == topic) {
throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
}
if (topic.getShiftIssue()) throw new RenException(ModuleConstant.ALREADY_SHIFT_ISSUE);
if (topic.getShiftIssue()) {
throw new RenException(ModuleConstant.ALREADY_SHIFT_ISSUE);
}
IssueShiftedFromTopicFormDTO issueInfo = ConvertUtils.sourceToTarget(param, IssueShiftedFromTopicFormDTO.class);
@ -1752,7 +1840,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
if (operationResult != NumConstant.ONE) {
logger.warn(ModuleConstant.FAILURE_TO_ADD_TOPIC_OPERATION);
}
} else logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC);
} else {
logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC);
}
//7.更新组统计信息 议题数量+1
resiGroupStatisticalDao.incryTotalIssues(group.getGroupId());
if (null != groupCache && null != groupCache.getGroupStatisticalInfo()) {
@ -1762,9 +1852,13 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
);
resiGroupRedis.set(groupCache);
}
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(group.getGridId());
dataFilterParam.setUserId(param.getUserId());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
//发送积分
//mq的事件类型
@ -1778,10 +1872,14 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(groupCache.getCustomerId());
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setGridId(group.getGridId());
pointEventMsg.setSourceId(group.getGroupId());
pointEventMsg.setUserId(group.getTopicAuthorId());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_ISSUE.getEventTag());
pointEventMsg.setEventClass(EventEnum.TOPIC_SHIFTED_TO_ISSUE.getEventClass());
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题
String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent());
pointEventMsg.setRemark(new StringBuilder(groupCache.getGroupName()).append("小组中发布的")
@ -1798,6 +1896,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//2.转话题为议题 组长
BasePointEventMsg pointEventMsg2 = new BasePointEventMsg();
pointEventMsg2.setCustomerId(groupCache.getCustomerId());
pointEventMsg2.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg2.setGridId(group.getGridId());
pointEventMsg2.setSourceId(group.getGroupId());
pointEventMsg2.setUserId(param.getUserId());
pointEventMsg2.setActionFlag(MqConstant.PLUS);
pointEventMsg2.setIsCommon(false);
@ -2007,62 +2108,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
throw new RenException(reply.getInternalMsg());
}
/**
* @Description 根据事件枚举发送积分事件
* @param param
* @return void
* @author wangc
* @date 2021.01.04 16:41
*/
@Override
public void sendTopicPointEventByEventType(TopicEventFormDTO param) {
ResiTopicEntity topic = baseDao.selectById(param.getTopicId());
if(null == topic){
log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.sendTopicPointEventByEventType,根据话题Id没有找到对应的话题信息,参数:{}",JSON.toJSONString(param
));
return;
}
ResiGroupInfoRedisDTO group = resiGroupRedis.get(topic.getGroupId());
if(null == group){
log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.sendTopicPointEventByEventType,根据组Id没有找到对应的小组信息,组Id:{}",topic.getGroupId());
return;
}
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为项目
if(EventEnum.TOPIC_SHIFTED_TO_PROJECT == param.getEvent()){
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
mqBaseMsgDTO.setEventClass("resi_group");
mqBaseMsgDTO.setEventTag(EventEnum.TOPIC_SHIFTED_TO_PROJECT.getEventTag());
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
//话题被转为项目 话题作者
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(group.getCustomerId());
pointEventMsg.setUserId(topic.getCreatedBy());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_PROJECT.getEventTag());
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题
String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent());
pointEventMsg.setRemark(new StringBuilder(group.getGroupName()).append("小组中发布的")
.append(
StringUtils.isBlank(content) ||
StringUtils.equals("语音话题",content) ? "语音话题" :
"话题\"" +
content
.substring(NumConstant.ZERO,content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN)
+ (NumConstant.TEN > content.length() ? "\"" : "…\"")
).append("被转为项目").toString());
pointEventMsgList.add(pointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList));
if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){
log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(param));
}
}
}
/**
* @param tokenDto
* @param sourceId
@ -2180,6 +2225,73 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
return resultDTO;
}
/**
* @Description 根据事件枚举发送积分事件
* @param param
* @return void
* @author wangc
* @date 2021.01.04 16:41
*/
@Override
public void sendTopicPointEventByEventType(TopicEventFormDTO param) {
ResiTopicEntity topic = baseDao.selectById(param.getTopicId());
if(null == topic){
log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.sendTopicPointEventByEventType,根据话题Id没有找到对应的话题信息,参数:{}",JSON.toJSONString(param
));
return;
}
ResiGroupInfoRedisDTO group = resiGroupRedis.get(topic.getGroupId());
if(null == group){
log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.sendTopicPointEventByEventType,根据组Id没有找到对应的小组信息,组Id:{}",topic.getGroupId());
return;
}
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(group.getGridId());
dataFilterParam.setUserId(topic.getCreatedBy());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为项目
if(EventEnum.TOPIC_SHIFTED_TO_PROJECT == param.getEvent()){
MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO();
mqBaseMsgDTO.setEventClass("resi_group");
mqBaseMsgDTO.setEventTag(EventEnum.TOPIC_SHIFTED_TO_PROJECT.getEventTag());
List<BasePointEventMsg> pointEventMsgList = new ArrayList<>();
//话题被转为项目 话题作者
BasePointEventMsg pointEventMsg = new BasePointEventMsg();
pointEventMsg.setCustomerId(group.getCustomerId());
pointEventMsg.setAgencyId(dataFilterResult.getData().getAgencyId());
pointEventMsg.setGridId(group.getGridId());
pointEventMsg.setSourceId(topic.getGroupId());
pointEventMsg.setUserId(topic.getCreatedBy());
pointEventMsg.setActionFlag(MqConstant.PLUS);
pointEventMsg.setIsCommon(false);
pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_PROJECT.getEventTag());
pointEventMsg.setEventClass(EventEnum.TOPIC_SHIFTED_TO_PROJECT.getEventClass());
//某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题
String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent());
pointEventMsg.setRemark(new StringBuilder(group.getGroupName()).append("小组中发布的")
.append(
StringUtils.isBlank(content) ||
StringUtils.equals("语音话题",content) ? "语音话题" :
"话题\"" +
content
.substring(NumConstant.ZERO,content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN)
+ (NumConstant.TEN > content.length() ? "\"" : "…\"")
).append("被转为项目").toString());
pointEventMsgList.add(pointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList));
if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){
log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(param));
}
}
}
@Override
public ResiTopicDTO queryTopicInfoByIssueId(String issueId) {

37
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java

@ -37,9 +37,12 @@ import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.scan.result.VoiceResultDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.*;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.CommonDataFilterResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupStatisticalDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
@ -144,6 +147,8 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
private ResiGroupMemberRedis resiGroupMemberRedis;
@Autowired
private TopicDraftScanTaskService topicDraftScanTaskService;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@ -777,7 +782,16 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
}else {
breviary.append("话题");
}
sendMqMsg(draft.getCreatedBy(), draft.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString());
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(draft.getGridId());
dataFilterParam.setUserId(draft.getCreatedBy());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
sendMqMsg(draft.getCreatedBy(), draft.getCustomerId(), draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),
breviary.toString(), dataFilterResult.getData().getAgencyId(), draft.getGridId(), draft.getGroupId());
}
//记录操作记录
entity = baseDao.selectById(formDTO.getTopicDraftId());
@ -903,8 +917,18 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
breviary.append("话题\"");
breviary.append(content.length() > NumConstant.TEN ? (content.substring(NumConstant.ZERO,NumConstant.TEN) + "…") : content);
breviary.append("\"");
}else breviary.append("语音话题");
sendMqMsg(tokenDto.getUserId(), formDTO.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString());
}else {
breviary.append("语音话题");
}
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO();
dataFilterParam.setGridId(formDTO.getGridId());
dataFilterParam.setUserId(tokenDto.getUserId());
Result<CommonDataFilterResultDTO> dataFilterResult = govOrgFeignClient.gridDataFilter(dataFilterParam);
if (!dataFilterResult.success() || null == dataFilterResult.getData()) {
throw new RenException(dataFilterResult.getMsg());
}
sendMqMsg(tokenDto.getUserId(), formDTO.getCustomerId(), draft.getCreatedTime(), resiGroupRedis.get(draft.getGroupId()).getGroupName(),
breviary.toString(), dataFilterResult.getData().getAgencyId(), formDTO.getGridId(), formDTO.getGroupId());
}
@ -919,7 +943,8 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
* @author wangc
* @date 2020.12.25 15:45
*/
private void sendMqMsg(String userId, String customerId, Date targetDate, String groupName, String topicBreviary) {
private void sendMqMsg(String userId, String customerId, Date targetDate, String groupName, String topicBreviary, String agencyId,
String gridId, String groupId) {
//6.发送积分
MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO();
//mq的事件类型
@ -929,12 +954,16 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
List<BasePointEventMsg> actPointEventMsgList=new ArrayList<>();
BasePointEventMsg actPointEventMsg=new BasePointEventMsg();
actPointEventMsg.setCustomerId(customerId);
actPointEventMsg.setAgencyId(agencyId);
actPointEventMsg.setGridId(gridId);
actPointEventMsg.setSourceId(groupId);
actPointEventMsg.setUserId(userId);
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false);
actPointEventMsg.setRemark(new StringBuilder(groupName).append("小组中发布").append(topicBreviary).toString());
actPointEventMsg.setTargetDate(targetDate);
actPointEventMsg.setEventTag(EventEnum.PUBLISH_ONE_TOPIC.getEventTag());
actPointEventMsg.setEventClass(EventEnum.PUBLISH_ONE_TOPIC.getEventClass());
actPointEventMsgList.add(actPointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList));

22
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementConfigDao.xml

@ -0,0 +1,22 @@
<?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.epmet.modules.group.dao.ResiGroupAchievementConfigDao">
<resultMap type="com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity" id="resiGroupAchievementConfigMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="achievementName" column="ACHIEVEMENT_NAME"/>
<result property="preValue" column="PRE_VALUE"/>
<result property="targetValue" column="TARGET_VALUE"/>
<result property="achievementType" column="ACHIEVEMENT_TYPE"/>
<result property="delFlag" column="DEL_FLAG"/>
<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"/>
</resultMap>
</mapper>

40
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementStatsDao.xml

@ -0,0 +1,40 @@
<?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.epmet.modules.group.dao.ResiGroupAchievementStatsDao">
<resultMap type="com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity" id="resiGroupAchievementStatsMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="groupId" column="GROUP_ID"/>
<result property="achievementId" column="ACHIEVEMENT_ID"/>
<result property="achievementName" column="ACHIEVEMENT_NAME"/>
<result property="arriveTime" column="ARRIVE_TIME"/>
<result property="currentValue" column="CURRENT_VALUE"/>
<result property="targetValue" column="TARGET_VALUE"/>
<result property="isArrive" column="IS_ARRIVE"/>
<result property="delFlag" column="DEL_FLAG"/>
<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"/>
</resultMap>
<select id="selectUnAchieved" resultType="com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO">
SELECT
ACHIEVEMENT_ID,
ACHIEVEMENT_NAME,
CURRENT_VALUE,
TARGET_VALUE
FROM
resi_group_achievement_stats
WHERE DEL_FLAG = '0'
AND GROUP_ID = #{groupId}
AND IS_ARRIVE = 0
ORDER BY
CURRENT_VALUE / TARGET_VALUE ASC
LIMIT 3
</select>
</mapper>

15
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

@ -767,4 +767,19 @@
)temp
</select>
<select id="selectRecentGroupAchievements" resultType="com.epmet.resi.group.dto.member.result.GroupAchievementDTO">
SELECT
rg.GROUP_NAME,
rgas.ACHIEVEMENT_NAME
FROM
resi_group_achievement_stats rgas
INNER JOIN resi_group rg ON rgas.GROUP_ID = rg.ID
INNER JOIN resi_group_member rgm ON rgas.GROUP_ID = rgm.RESI_GROUP_ID
AND rgm.CUSTOMER_USER_ID = #{userId}
WHERE
rgas.IS_ARRIVE = 1
ORDER BY
rgas.ARRIVE_TIME DESC
LIMIT 10
</select>
</mapper>

Loading…
Cancel
Save