|
@@ -83,7 +83,8 @@ public class IndexController extends BaseController {
|
|
|
*机器启动数量/机器总数量
|
|
|
*/
|
|
|
@RequestMapping(value = "/equipmentNumber", method = RequestMethod.GET)
|
|
|
- public Map<String,Integer> equipmentNumber(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ @ResponseBody
|
|
|
+ public String equipmentNumber(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
Map<String,Integer> map = new HashMap<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
List<Equipment> equipmentList = equipmentService.findByAdminId(admin.getId());
|
|
@@ -97,13 +98,17 @@ public class IndexController extends BaseController {
|
|
|
map.put("totalNum",equipmentList.size());
|
|
|
map.put("openNum",on);
|
|
|
model.addAttribute("equipmentNumber", map);
|
|
|
- return map;
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("totalNum",equipmentList.size());
|
|
|
+ jsonObject.put("openNum",on);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
/**
|
|
|
*今日定时清洗次数/随机清洗次数
|
|
|
*/
|
|
|
@RequestMapping(value = "/cleanNumber", method = RequestMethod.GET)
|
|
|
- public Map<String,Integer> cleanNumber(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ @ResponseBody
|
|
|
+ public String cleanNumber(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
Map<String,Integer> map = new HashMap<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
List<Filter> fs = new ArrayList<>();
|
|
@@ -148,26 +153,31 @@ public class IndexController extends BaseController {
|
|
|
map.put("random",random);
|
|
|
map.put("regular",regular);
|
|
|
model.addAttribute("cleanNumber", map);
|
|
|
- return map;
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("random",random);
|
|
|
+ jsonObject.put("regular",regular);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
/**
|
|
|
*机器的状态,温度,湿度,清洗剂的剩余用量
|
|
|
*/
|
|
|
- @RequestMapping(value = "/equipmentStatus", method = RequestMethod.GET)
|
|
|
- public List<Equipment> equipmentStatus(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ @RequestMapping(value = "/equipmentStatus", method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|
|
+ @ResponseBody
|
|
|
+ public String equipmentStatus(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
List<Equipment> equipmentList = new ArrayList<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
equipmentList = equipmentService.findByAdminId(admin.getId());
|
|
|
model.addAttribute("equipmentList", equipmentList);
|
|
|
- return equipmentList;
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("equipmentList",equipmentList);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
/**
|
|
|
*机器今日的报警记录,故障处理
|
|
|
*/
|
|
|
- @RequestMapping(value = "/alarmRecordList", method = RequestMethod.GET)
|
|
|
+ @RequestMapping(value = "/alarmRecordList", method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|
|
@ResponseBody
|
|
|
public String alarmRecordList(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
-// HttpServletResponse response = new HttpServletResponse;
|
|
|
List<AlarmRecord> alarmRecordList = new ArrayList<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
List<Filter> fs = new ArrayList<>();
|
|
@@ -204,19 +214,22 @@ public class IndexController extends BaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/allCleanNumber", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public List<CleanStatisticsDTO> allCleanNumber(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ public String allCleanNumber(ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
List<CleanStatisticsDTO> list = new ArrayList<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
list = cleanHistoryService.findByTime(admin.getId());
|
|
|
model.addAttribute("allCleanNumber", list);
|
|
|
- return list;
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("allCleanNumber",list);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*机器消耗的资源,水电
|
|
|
*/
|
|
|
@RequestMapping(value = "/consumedResources", method = RequestMethod.GET)
|
|
|
- public Map<String,Integer> consumedResources(String time,ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ @ResponseBody
|
|
|
+ public String consumedResources(String time,ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
Map<String,Integer> map = new HashMap<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
List<Filter> fs = new ArrayList<>();
|
|
@@ -269,13 +282,17 @@ public class IndexController extends BaseController {
|
|
|
map.put("electricity",electricity);
|
|
|
map.put("water",water);
|
|
|
model.addAttribute("consumedResources", map);
|
|
|
- return map;
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("electricity",electricity);
|
|
|
+ jsonObject.put("water",water);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
/**
|
|
|
*报警的类型统计,问题占比
|
|
|
*/
|
|
|
- @RequestMapping(value = "/alarmRecordType", method = RequestMethod.GET)
|
|
|
- public List<AlarmStatisticsDTO> alarmRecordType(String time, ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ @RequestMapping(value = "/alarmRecordType", method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|
|
+ @ResponseBody
|
|
|
+ public String alarmRecordType(String time, ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
List<AlarmStatisticsDTO> list = new ArrayList<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
List<Filter> fs = new ArrayList<>();
|
|
@@ -291,14 +308,17 @@ public class IndexController extends BaseController {
|
|
|
end = endM(time);
|
|
|
}
|
|
|
list = alarmRecordService.findByType(admin.getId(),begin,end);
|
|
|
- model.addAttribute("alarmRecordType", list);
|
|
|
- return list;
|
|
|
+ model.addAttribute("", list);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("alarmRecordType",list);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
/**
|
|
|
*机器故障排行
|
|
|
*/
|
|
|
- @RequestMapping(value = "/alarmRecordLine", method = RequestMethod.GET)
|
|
|
- public List<AlarmStatisticsDTO> alarmRecordLine(String time, ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ @RequestMapping(value = "/alarmRecordLine", method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|
|
+ @ResponseBody
|
|
|
+ public String alarmRecordLine(String time, ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
List<AlarmStatisticsDTO> list = new ArrayList<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
List<Filter> fs = new ArrayList<>();
|
|
@@ -315,13 +335,16 @@ public class IndexController extends BaseController {
|
|
|
}
|
|
|
list = alarmRecordService.findLine(admin.getId(),begin,end);
|
|
|
model.addAttribute("alarmRecordLine", list);
|
|
|
- return list;
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("alarmRecordLine",list);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
/**
|
|
|
*机器清洗排行
|
|
|
*/
|
|
|
- @RequestMapping(value = "/cleanLine", method = RequestMethod.GET)
|
|
|
- public List<AlarmStatisticsDTO> cleanLine(String time, ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
+ @RequestMapping(value = "/cleanLine", method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
|
|
|
+ @ResponseBody
|
|
|
+ public String cleanLine(String time, ModelMap model , RedirectAttributes redirectAttributes) {
|
|
|
List<AlarmStatisticsDTO> list = new ArrayList<>();
|
|
|
Admin admin = adminService.getCurrent();
|
|
|
List<Filter> fs = new ArrayList<>();
|
|
@@ -338,7 +361,9 @@ public class IndexController extends BaseController {
|
|
|
}
|
|
|
list = cleanHistoryService.findLine(admin.getId(),begin,end);
|
|
|
model.addAttribute("cleanLine", list);
|
|
|
- return list;
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("cleanLine",list);
|
|
|
+ return jsonObject.toString();
|
|
|
}
|
|
|
private Date beginY(String time) {
|
|
|
Date dater = null;
|