Commit 3bf55899 by 阳浪

新积分排名

parent 982f12f6
...@@ -28,6 +28,9 @@ public interface PointUserFeignClients { ...@@ -28,6 +28,9 @@ public interface PointUserFeignClients {
@GetMapping("/manage/point/user/rank/list") @GetMapping("/manage/point/user/rank/list")
Page<PointUserListVO> userRankList(@RequestBody PointUserParamVO vo); Page<PointUserListVO> userRankList(@RequestBody PointUserParamVO vo);
@GetMapping("/manage/point/new/user/rank/list")
Page<PointUserListVO> newUserRankList(@RequestBody PointUserParamVO vo);
@GetMapping("/manage/point/user/rank/list/export") @GetMapping("/manage/point/user/rank/list/export")
List<PointUserListVO> userRankListExport(@RequestBody PointUserParamVO vo); List<PointUserListVO> userRankListExport(@RequestBody PointUserParamVO vo);
......
...@@ -39,4 +39,12 @@ public class PointUserParamVO { ...@@ -39,4 +39,12 @@ public class PointUserParamVO {
private Date endAt; private Date endAt;
@ApiModelProperty("时间类型:1年,2月,3日")
private Integer dateType;
private String dateString;
@ApiModelProperty("显示名称:1部门,2用户")
private Integer nameType;
} }
...@@ -59,6 +59,11 @@ public class PointUserController { ...@@ -59,6 +59,11 @@ public class PointUserController {
} }
@GetMapping("/new/rank/list")
public Page<PointUserListVO> newUserRankList(@RequestBody PointUserParamVO vo) {
return pointUserService.newUserRankList(vo);
}
@GetMapping("/rank/list/export") @GetMapping("/rank/list/export")
public List<PointUserListVO> userRankListExport(@RequestBody PointUserParamVO vo) { public List<PointUserListVO> userRankListExport(@RequestBody PointUserParamVO vo) {
return pointUserService.userRankListExport(vo); return pointUserService.userRankListExport(vo);
......
...@@ -32,6 +32,10 @@ public interface PointUserMapper extends BaseMapper<PointUser> { ...@@ -32,6 +32,10 @@ public interface PointUserMapper extends BaseMapper<PointUser> {
Timestamp getStartDate(); Timestamp getStartDate();
List<PointUserListVO> getNewUserRankList(@Param("vo") PointUserParamVO vo);
Integer getNewUserRankCount(@Param("vo") PointUserParamVO vo);
List<TotalPointVO> totalPoint(@Param("siteIds") List<Long> siteIds, List<TotalPointVO> totalPoint(@Param("siteIds") List<Long> siteIds,
@Param("startDate") String startDate, @Param("endDate") String endDate); @Param("startDate") String startDate, @Param("endDate") String endDate);
} }
...@@ -24,6 +24,8 @@ public interface PointUserService extends IService<PointUser> { ...@@ -24,6 +24,8 @@ public interface PointUserService extends IService<PointUser> {
Page<PointUserListVO> userRankList(PointUserParamVO vo); Page<PointUserListVO> userRankList(PointUserParamVO vo);
Page<PointUserListVO> newUserRankList(PointUserParamVO vo);
List<PointUserListVO> userRankListExport(PointUserParamVO vo); List<PointUserListVO> userRankListExport(PointUserParamVO vo);
Integer acquirePoint(Long accountId, Long learnSourceId, String createTime); Integer acquirePoint(Long accountId, Long learnSourceId, String createTime);
......
...@@ -17,6 +17,7 @@ import com.yizhi.system.application.vo.HQAccountInManageParam; ...@@ -17,6 +17,7 @@ import com.yizhi.system.application.vo.HQAccountInManageParam;
import com.yizhi.system.application.vo.ReportAccountRespInManageVO; import com.yizhi.system.application.vo.ReportAccountRespInManageVO;
import com.yizhi.system.application.vo.ReportAccountRespVO; import com.yizhi.system.application.vo.ReportAccountRespVO;
import com.yizhi.system.application.vo.ReportRangeAccountReqVO; import com.yizhi.system.application.vo.ReportRangeAccountReqVO;
import com.yizhi.util.application.date.DateUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -59,6 +60,29 @@ public class PointUserServiceImpl extends ServiceImpl<PointUserMapper, PointUser ...@@ -59,6 +60,29 @@ public class PointUserServiceImpl extends ServiceImpl<PointUserMapper, PointUser
} }
@Override @Override
public Page<PointUserListVO> newUserRankList(PointUserParamVO vo) {
Integer start =(vo.getPageNo()-1)*vo.getPageSize();
Integer end=vo.getPageNo()*vo.getPageSize();
Page<PointUserListVO> page = new Page<PointUserListVO>(vo.getPageNo(), vo.getPageSize());
String date = DateUtil.toDay(new Date());
String[] dateArrays = date.split("-");
vo.setDateString(date);
if(Objects.equals(vo.getDateType(),1)){
vo.setDateString(dateArrays[0]);
}
if(Objects.equals(vo.getDateType(),2)){
vo.setDateString(dateArrays[0]+"-"+dateArrays[1]);
}
vo.setPageNo(start);
vo.setPageSize(end);
List<PointUserListVO> pointUserListVOS = pointUserMapper.getNewUserRankList(vo);
Integer size = pointUserMapper.getNewUserRankCount(vo);
page.setRecords(pointUserListVOS);
page.setSize(size);
return page;
}
@Override
public Page<PointUserListVO> userRankList(PointUserParamVO vo) { public Page<PointUserListVO> userRankList(PointUserParamVO vo) {
......
...@@ -34,6 +34,54 @@ ...@@ -34,6 +34,54 @@
AS companyId, org_id AS orgId, site_id AS AS companyId, org_id AS orgId, site_id AS
siteId siteId
</sql> </sql>
<select id="getNewUserRankList" resultType="com.yizhi.point.application.vo.PointUserListVO">
select
<if test="vo.nameType!=null and vo.nameType==1">
aug.name as name,
</if>
<if test="vo.nameType!=null and vo.nameType==1">
a.full_name as name,
</if>
sum(pu.total_point) as totalPoint
from
cloud_point.point_user pu
left join cloud_system.account a on
pu.user_id = a.id
left join (
select
aug.id,
aug.name,
aug.description,
aug.site_id,
aug.company_id,
aar.account_id
from
cloud_system.authz_user_group aug
inner join cloud_system.authz_role_user_group arug on
aug.id = arug.user_group_id
inner join cloud_system.authz_account_role aar on
arug.role_id = aar.role_id) aug on
a.id = aug.account_id
where
pu.state = 1
<if test="vo.dateType!=null and vo.dateType==1">
and DATE_FORMAT(pu.create_time, '%Y') = #{vo.dateString}
</if>
<if test="vo.dateType!=null and vo.dateType==2">
and DATE_FORMAT(pu.create_time, '%Y-%m') = #{vo.dateString}
</if>
<if test="vo.dateType!=null and vo.dateType==3">
and DATE_FORMAT(pu.create_time, '%Y-%m-%d') = #{vo.dateString}
</if>
<if test="vo.nameType!=null and vo.nameType==1">
group by aug.name
</if>
<if test="vo.nameType!=null and vo.nameType==1">
group by a.full_name
</if>
order by sum(pu.total_point) desc
LIMIT #{vo.pageNo}, #{vo.pageSize}
</select>
<select id="queryPiont" resultType="java.lang.Integer"> <select id="queryPiont" resultType="java.lang.Integer">
select SUM(point) from select SUM(point) from
...@@ -101,4 +149,52 @@ ...@@ -101,4 +149,52 @@
AND #{endDate} AND #{endDate}
group by accountId group by accountId
</select> </select>
<select id="getNewUserRankCount" resultType="java.lang.Integer">
select count(1) from(select
<if test="vo.nameType!=null and vo.nameType==1">
aug.name,
</if>
<if test="vo.nameType!=null and vo.nameType==1">
a.full_name,
</if>
sum(pu.total_point)
from
cloud_point.point_user pu
left join cloud_system.account a on
pu.user_id = a.id
left join (
select
aug.id,
aug.name,
aug.description,
aug.site_id,
aug.company_id,
aar.account_id
from
cloud_system.authz_user_group aug
inner join cloud_system.authz_role_user_group arug on
aug.id = arug.user_group_id
inner join cloud_system.authz_account_role aar on
arug.role_id = aar.role_id) aug on
a.id = aug.account_id
where
pu.state = 1
<if test="vo.dateType!=null and vo.dateType==1">
and DATE_FORMAT(pu.create_time, '%Y') = #{vo.dateString}
</if>
<if test="vo.dateType!=null and vo.dateType==2">
and DATE_FORMAT(pu.create_time, '%Y-%m') = #{vo.dateString}
</if>
<if test="vo.dateType!=null and vo.dateType==3">
and DATE_FORMAT(pu.create_time, '%Y-%m-%d') = #{vo.dateString}
</if>
<if test="vo.nameType!=null and vo.nameType==1">
group by aug.name
</if>
<if test="vo.nameType!=null and vo.nameType==1">
group by a.full_name
</if>
order by sum(pu.total_point) desc
) a
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment