Browse Source
# 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.xmldev
58 changed files with 3358 additions and 107 deletions
@ -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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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); |
|||
} |
|||
} |
@ -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); |
|||
} |
@ -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); |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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); |
|||
} |
@ -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); |
|||
} |
@ -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; |
|||
} |
|||
|
|||
} |
@ -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); |
|||
} |
|||
|
|||
} |
@ -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> |
@ -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> |
@ -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; |
|||
|
|||
/** |
|||
* 里程类型:小组人数:member;topic:话题数;转议题数: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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
/** |
|||
* 目标是否实现,是:1;否:0 |
|||
*/ |
|||
private Integer isArrive; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
|||
|
|||
} |
@ -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> { |
|||
|
|||
} |
@ -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); |
|||
} |
@ -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; |
|||
|
|||
/** |
|||
* 里程类型:小组人数:member;topic:话题数;转议题数:toIssue;话题解决数:resloveTopic |
|||
*/ |
|||
private String achievementType; |
|||
|
|||
} |
@ -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; |
|||
|
|||
/** |
|||
* 目标是否实现,是:1;否:0 |
|||
*/ |
|||
private Integer isArrive; |
|||
|
|||
} |
@ -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); |
|||
} |
@ -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); |
|||
} |
@ -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)); |
|||
} |
|||
|
|||
} |
@ -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); |
|||
} |
|||
|
|||
} |
@ -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; |
|||
} |
|||
} |
@ -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(n∈N+) -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)); |
|||
|
|||
} |
|||
} |
@ -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> |
@ -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> |
Loading…
Reference in new issue