Commit 44089f4e authored by 赵啸非's avatar 赵啸非

添加新闻来源

parent f84445e1
Pipeline #2387 canceled with stages
......@@ -28,4 +28,7 @@ public final class Constant {
public final static String PARAMS_RECOMMEND_COUNT = "recommend_count";
public final static String PARAMS_NOTICE_URL = "notice_url";
}
......@@ -5,4 +5,11 @@ import lombok.Data;
@Data
public class HomeQueryPdu {
private Long siteId;
private Integer size;
private Integer page;
private Integer type;
}
package com.mortals.xhx.module.home.pdu;
import lombok.Data;
@Data
public class NoticeQueryPdu {
private String siteid;
private Integer size;
private Integer page;
private Integer type;
}
package com.mortals.xhx.module.home.web;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
......@@ -9,6 +10,7 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.base.system.param.service.ParamService;
......@@ -21,6 +23,7 @@ import com.mortals.xhx.feign.base.pdu.SitePdu;
import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.home.pdu.HomeQueryPdu;
import com.mortals.xhx.module.home.pdu.NoticeQueryPdu;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
import com.mortals.xhx.module.hotword.service.HotwordService;
......@@ -147,6 +150,71 @@ public class HomeController extends BaseJsonBodyController {
}
@PostMapping({"notice/list"})
@UnAuth
public String noteList(@RequestBody HomeQueryPdu queryPdu) {
String url = GlobalSysInfo.getParamValue(Constant.PARAMS_NOTICE_URL, "http://192.168.0.98:8090/api/");
UrlBuilder domain = UrlBuilder.of(url);
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询新闻列表";
int code = VALUE_RESULT_SUCCESS;
try {
Map<String, String> params = new HashMap<>();
// HttpUtil.d
params.put("siteid",queryPdu.getSiteId().toString());
params.put("type",queryPdu.getType().toString());
params.put("page",queryPdu.getPage().toString());
params.put("size",queryPdu.getSize().toString());
UrlBuilder urlBuilder = domain.addPath("news").addPath("newsList");
String response = HttpUtil.doGet(urlBuilder.toString(), params);
//todo 实现新闻列表
this.recordSysLog(this.request, busiDesc + " 【成功】");
return response;
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, e);
}
ret.setCode(code);
ret.setData(model);
return JSONObject.toJSONString(ret);
}
@PostMapping({"notice/info"})
public String noteInfo(Long id) {
String url = GlobalSysInfo.getParamValue(Constant.PARAMS_NOTICE_URL, "http://192.168.0.98:8090/api/");
UrlBuilder domain = UrlBuilder.of(url);
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询新闻详细";
int code = VALUE_RESULT_SUCCESS;
try {
Map<String, String> params = new HashMap<>();
// HttpUtil.d
params.put("id",id.toString());
UrlBuilder urlBuilder = domain.addPath("news").addPath("newInfo");
String response = HttpUtil.doGet(urlBuilder.toString(), params);
//todo 实现新闻列表
this.recordSysLog(this.request, busiDesc + " 【成功】");
return response;
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(this.request, busiDesc, model, e);
}
ret.setCode(code);
ret.setData(model);
return JSONObject.toJSONString(ret);
}
/**
* 合成表单与模板
*/
......
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