Commit 86ddeb52 authored by 廖旭伟's avatar 廖旭伟

增加首页数据展示接口

parent 698578dc
...@@ -1832,6 +1832,54 @@ data|object|数据对象 ...@@ -1832,6 +1832,54 @@ data|object|数据对象
} }
} }
``` ```
### 首页数据展示
**请求URL:** home/info
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查看数据展示
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
  hotWords|String|热门搜索词汇|-
  datumList|Array|热门表单|-
  matterList|Array|热门事项|-
  datumCont|Integer|入驻表单数量|-
  matterCont|Integer|入驻事项数量|-
  localPrint|Integer|本地打印数量|-
  onlineSubmit|Integer|在线提交数量|-
  dayThrift|Integer|今日节约能量|-
  totalThrift|Integer|累计节约能量|-
**响应消息样例:**
```
{
"data": {
"dayThrift": 66,
"hotWords": "高考成绩查询",
"localPrint": 20,
"datumList": [],
"datumCont": 2,
"totalThrift": 996,
"onlineSubmit": 20,
"matterList": [],
"matterCont": 19
},
"code": 1,
"msg": "获取首页数据成功",
"dict": null
}
```
## 基础设置 ## 基础设置
### 查看基础设置 ### 查看基础设置
......
...@@ -12,6 +12,7 @@ import com.mortals.framework.service.IUser; ...@@ -12,6 +12,7 @@ import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseJsonBodyController; import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.feign.base.IApiBaseManagerFeign; import com.mortals.xhx.feign.base.IApiBaseManagerFeign;
...@@ -22,7 +23,9 @@ import com.mortals.xhx.feign.device.pdu.DevicePdu; ...@@ -22,7 +23,9 @@ import com.mortals.xhx.feign.device.pdu.DevicePdu;
import com.mortals.xhx.feign.rsp.ApiResp; import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.module.home.pdu.HomeQueryPdu; import com.mortals.xhx.module.home.pdu.HomeQueryPdu;
import com.mortals.xhx.module.matter.model.MatterDatumEntity; import com.mortals.xhx.module.matter.model.MatterDatumEntity;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterDatumService; import com.mortals.xhx.module.matter.service.MatterDatumService;
import com.mortals.xhx.module.matter.service.MatterService;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -42,6 +45,10 @@ public class HomeController extends BaseJsonBodyController { ...@@ -42,6 +45,10 @@ public class HomeController extends BaseJsonBodyController {
private IApiDeviceFeign iApiDeviceFeign; private IApiDeviceFeign iApiDeviceFeign;
@Autowired @Autowired
private MatterDatumService matterDatumService; private MatterDatumService matterDatumService;
@Autowired
private MatterService matterService;
@Autowired
private ParamService paramService;
@PostMapping({"site/list"}) @PostMapping({"site/list"})
public Rest<Object> list() { public Rest<Object> list() {
...@@ -205,4 +212,46 @@ public class HomeController extends BaseJsonBodyController { ...@@ -205,4 +212,46 @@ public class HomeController extends BaseJsonBodyController {
} }
return jsonObject.toJSONString(); return jsonObject.toJSONString();
} }
@PostMapping({"info"})
@UnAuth
public Rest<Object> homePageInfo() {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "获取首页数据" ;
int code=1;
try {
model.put("hotWords", paramService.getHotWords());
MatterEntity matterQuery = new MatterEntity();
int matterCont = matterService.count(matterQuery,this.getContext());
matterQuery.setIsRecommend(1);
List<MatterEntity> matterList = matterService.find(matterQuery,this.getContext());
model.put("matterList",matterList); //热门事项
model.put("matterCont",matterCont); //入驻事项数量
MatterDatumEntity matterDatumQuery = new MatterDatumEntity();
int datumCont = matterDatumService.count(matterDatumQuery,this.getContext());
matterDatumQuery.setIsRecommend(1);
List<MatterDatumEntity> datumList = matterDatumService.find(matterDatumQuery,this.getContext());
model.put("datumList",datumList); //热门表单
model.put("datumCont",datumCont); //入驻表单数量
model.put("localPrint",20); //本地打印数量
model.put("onlineSubmit",20); //在线提交数量
model.put("dayThrift",66); //今日节约
model.put("totalThrift",996); //累计节约
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return 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