Commit 344f7d3b by 杨涛

添加接口给客户端

parent 6b90f1e2
......@@ -79,5 +79,12 @@ public interface WeixinClockBiz {
* @param wxGroupId
* @return
*/
List<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId);
PageBeanNew<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId, Integer currentPage, Integer numPerPage);
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @return
*/
RankDto getClockWechatUserRank(String wxGroupId, String wxUserId);
}
......@@ -511,8 +511,29 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
*/
@Override
@ParamLog("获取某个群内的打卡排行榜")
public List<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId) {
return weixinClockMemberDao.listWeixinClockRank(wxGroupId, wxUserId);
public PageBeanNew<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
map.put("wxGroupId", wxGroupId);
map.put("wxUserId", wxUserId);
PageBeanNew<RankDto> rankDtos = weixinClockMemberDao.listPageNew(pageParam, map, "listWeixinClockRank");
if (null == rankDtos || ListUtils.isEmpty(rankDtos.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
return rankDtos;
}
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @param wxUserId
* @return
*/
@Override
@ParamLog("获取某个群内某个用户的信息")
public RankDto getClockWechatUserRank(String wxGroupId, String wxUserId) {
RankDto rankDto = weixinClockMemberDao.getClockWechatUserRank(wxGroupId, wxUserId);
return null == rankDto ? new RankDto() : rankDto;
}
}
......@@ -41,4 +41,12 @@ public interface WeixinClockMemberDao extends BaseDao<WeixinClockMember> {
* @return
*/
Integer getMyNewOrder(String wechatGroupId, String userWxId);
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @param wxUserId
* @return
*/
RankDto getClockWechatUserRank(String wxGroupId, String wxUserId);
}
......@@ -70,4 +70,17 @@ public class WeixinClockMemberDaoImpl extends BaseDaoImpl<WeixinClockMember> imp
map.put("userWxId", userWxId);
return super.getSqlSession().selectOne(getStatement("getMyNewOrder"), map);
}
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @return
*/
@Override
public RankDto getClockWechatUserRank(String wxGroupId, String wxUserId) {
Map<String, Object> map = new HashMap<>();
map.put("wxGroupId", wxGroupId);
map.put("wxUserId", wxUserId);
return super.getSqlSession().selectOne(getStatement("getClockWechatUserRank"), map);
}
}
......@@ -95,11 +95,26 @@ public interface WeixinClockFacade {
@ApiOperation("获取某个群内的打卡排行榜")
@ApiImplicitParams({@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "wxGroupId", value = "wxGroupId", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "wxUserId", value = "wxUserId", dataType = "string", paramType = "query")})
@ApiImplicitParam(name = "wxUserId", value = "wxUserId", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页大小", dataType = "Integer", paramType = "query")})
@RequestMapping(value = "listWeixinClockRank", method = RequestMethod.GET)
ResponseDto<?> listWeixinClockRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId)
@RequestParam(value = "wxUserId", required = false) String wxUserId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException;
@ApiOperation("获取某个群内某个用户的信息")
@ApiImplicitParams({@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "wxGroupId", value = "wxGroupId", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "wxUserId", value = "wxUserId", dataType = "string", paramType = "query")
})
@RequestMapping(value = "getClockWechatUserRank", method = RequestMethod.GET)
ResponseDto<?> getClockWechatUserRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId)
throws BizException, PermissionException;
}
......@@ -179,10 +179,29 @@ public class WeixinClockFacadeImpl implements WeixinClockFacade {
@RequestMapping(value = "listWeixinClockRank", method = RequestMethod.GET)
public ResponseDto<?> listWeixinClockRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId)
@RequestParam(value = "wxUserId", required = false) String wxUserId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(weixinClockBiz.listWeixinClockRank(wxGroupId, wxUserId));
return new ResponseDto<>(weixinClockBiz.listWeixinClockRank(wxGroupId, wxUserId, currentPage, numPerPage));
}
/**
* 获取某个群内某个用户的信息
* @param userInfo
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "getClockWechatUserRank", method = RequestMethod.GET)
public ResponseDto<?> getClockWechatUserRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId)
throws BizException, PermissionException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(weixinClockBiz.getClockWechatUserRank(wxGroupId, wxUserId));
}
}
......@@ -38,7 +38,7 @@
(SELECT @i := 0) i
WHERE
w.wx_group_id = #{wxGroupId, jdbcType=VARCHAR}
AND (w.all_clock_day > 0 or w.wx_user_id = #{wxUserId, jdbcType=VARCHAR})
AND (w.all_clock_day <![CDATA[ >]]> 0 or w.wx_user_id = #{wxUserId, jdbcType=VARCHAR})
ORDER BY w.all_clock_day DESC
</select>
......@@ -66,10 +66,24 @@
<select id="getMyNewOrder" parameterType="map" resultType="java.lang.Integer">
select cm.rowNo from (
select wx_user_id, (@rowNum:=@rowNum+1) AS rowNo from (
select wx_user_id, @rowNum:=0 from weixin_clock_member where wx_group_id = #{wechatGroupId}
select wx_user_id, @rowNum:=0 from weixin_clock_member
where wx_group_id = #{wechatGroupId}
AND (all_clock_day <![CDATA[ >]]> 0 or wx_user_id = #{userWxId, jdbcType=VARCHAR})
order by all_clock_day desc, update_time asc
) a
) cm where cm.wx_user_id = #{userWxId}
</select>
<select id="getClockWechatUserRank" parameterType="map" resultType="com.pcloud.book.weixinclock.dto.RankDto">
select cm.rankNum rankNum, cm.clockNum clockNum, cm.nickname nickname, cm.headPic headPic from (
select wx_user_id, (@rowNum:=@rowNum+1) AS rankNum, all_clock_day clockNum, nickname nickname, head_pic headPic from (
select wx_user_id, all_clock_day, nickname, head_pic, @rowNum:=0 from weixin_clock_member
where wx_group_id = #{wechatGroupId}
AND (all_clock_day <![CDATA[ >]]> 0 or wx_user_id = #{userWxId, jdbcType=VARCHAR})
order by all_clock_day desc, update_time asc
) a
) cm where cm.wx_user_id = #{userWxId}
LIMIT 1
</select>
</mapper>
\ No newline at end of file
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