Commit 31b2cf2a by 周海峰

优化

parent db76d466
...@@ -94,16 +94,15 @@ public class ExternalController { ...@@ -94,16 +94,15 @@ public class ExternalController {
public ResultJson queryActivitiList(NoticeManageActivitiDTO noticeManageActivitiDTO, @PathVariable String userid, HttpServletRequest request){ public ResultJson queryActivitiList(NoticeManageActivitiDTO noticeManageActivitiDTO, @PathVariable String userid, HttpServletRequest request){
String token = request.getHeader("Auth3"); String token = request.getHeader("Auth3");
String url = SpringUtil.getBean(PlatformUrlManager.class).getPlatformURI(PlatformUrlManager.API_ACTIVITI_URL); String url = SpringUtil.getBean(PlatformUrlManager.class).getPlatformURI(PlatformUrlManager.API_ACTIVITI_URL);
String result = null; String result = null;
try { try {
result = this.doPost(url, noticeManageActivitiDTO, token); result = this.doPost(url, noticeManageActivitiDTO, token);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return ResultJson.ok(JSONObject.parseObject(result)); return ResultJson.ok(JSONObject.parseObject(result));
} }
@GetMapping("/law/list/{userid}") @GetMapping("/law/list/{userid}")
public ResultJson lawlisttoindex(LawPolicylistDTO lawPolicylistDTO, @PathVariable String userid, HttpServletRequest request){ public ResultJson lawlisttoindex(LawPolicylistDTO lawPolicylistDTO, @PathVariable String userid, HttpServletRequest request){
String token = request.getHeader(tokenHeader); String token = request.getHeader(tokenHeader);
...@@ -169,26 +168,21 @@ public class ExternalController { ...@@ -169,26 +168,21 @@ public class ExternalController {
public ResultJson queryCommentsPageList(@PathVariable String noticeId,NoticeManageActivitiDTO noticeManageActivitiDTO, int pageIndex, int pageSize,@PathVariable String userid, HttpServletRequest request){ public ResultJson queryCommentsPageList(@PathVariable String noticeId,NoticeManageActivitiDTO noticeManageActivitiDTO, int pageIndex, int pageSize,@PathVariable String userid, HttpServletRequest request){
int p= Integer.parseInt(noticeManageActivitiDTO.getPageIndex()); int p= Integer.parseInt(noticeManageActivitiDTO.getPageIndex());
int b= Integer.parseInt(noticeManageActivitiDTO.getPageSize()); int b= Integer.parseInt(noticeManageActivitiDTO.getPageSize());
noticeManageActivitiDTO.setPageSize(String.valueOf(b));
noticeManageActivitiDTO.setPageIndex(String.valueOf((p-1)*b)); noticeManageActivitiDTO.setPageIndex(String.valueOf((p-1)*b));
String url = SpringUtil.getBean(PlatformUrlManager.class).getPlatformURI(PlatformUrlManager.API_COMMENTS_PAGE_URL); String url = SpringUtil.getBean(PlatformUrlManager.class).getPlatformURI(PlatformUrlManager.API_COMMENTS_PAGE_URL);
String token = request.getHeader("Auth3"); String token = request.getHeader("Auth3");
String result = null; String result = null;
try { try {
result = this.doPost(url+"/"+noticeId, noticeManageActivitiDTO, token); result = this.doPost(url+"/"+noticeId, noticeManageActivitiDTO, token);
log.info("调用公告列表接口返回结果为:"+result+" pageSize="+noticeManageActivitiDTO.getPageSize()+" --- "+noticeManageActivitiDTO.getPageIndex());
JSONObject json = JSONUtil.getJSONFromString(result); JSONObject json = JSONUtil.getJSONFromString(result);
int resultCode = json.getIntValue("resultCode"); int resultCode = json.getIntValue("resultCode");
String resultMsg = json.getString("resultMs"); String resultMsg = json.getString("resultMs");
int dataCount = json.getIntValue("dataCount"); int dataCount = json.getIntValue("dataCount");
List<CommentsDTO> list = new ArrayList<CommentsDTO>(); List<CommentsDTO> list = new ArrayList<CommentsDTO>();
if (resultCode==1){ if (resultCode==1){
JSONArray jsonArray =json.getJSONArray("obj"); JSONArray jsonArray =json.getJSONArray("obj");
if (jsonArray!=null&&jsonArray.size()>0){ if (jsonArray!=null&&jsonArray.size()>0){
jsonArray.stream().forEach(jsons->{ jsonArray.stream().forEach(jsons->{
JSONObject jsonObject = (JSONObject) jsons; JSONObject jsonObject = (JSONObject) jsons;
CommentsDTO commentsDTO = new CommentsDTO(); CommentsDTO commentsDTO = new CommentsDTO();
commentsDTO.setId(jsonObject.getString("id")); commentsDTO.setId(jsonObject.getString("id"));
...@@ -219,7 +213,7 @@ public class ExternalController { ...@@ -219,7 +213,7 @@ public class ExternalController {
}); });
} }
} }
Pagination pagination = new Pagination(list,new Long(dataCount),pageSize,pageIndex); Pagination pagination = new Pagination(list, (long) dataCount,b,p);
return ResultJson.ok(pagination); return ResultJson.ok(pagination);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论