|
@@ -1,17 +1,21 @@
|
|
|
package com.jpsoft.smart.modules.mobile.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.github.pagehelper.util.StringUtil;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.jpsoft.smart.modules.base.entity.CompanyInfo;
|
|
|
+import com.jpsoft.smart.modules.base.entity.PersonDeviceFilterLog;
|
|
|
import com.jpsoft.smart.modules.base.entity.PersonDeviceLog;
|
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
|
import com.jpsoft.smart.modules.base.service.CompanyInfoService;
|
|
|
+import com.jpsoft.smart.modules.base.service.PersonDeviceFilterLogService;
|
|
|
import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
|
|
|
import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.smart.modules.common.utils.StringUtils;
|
|
|
+import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -36,6 +40,9 @@ public class PersonDeviceLogApiController {
|
|
|
@Autowired
|
|
|
private PersonDeviceLogService personDeviceLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PersonDeviceFilterLogService personDeviceFilterLogService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private CompanyInfoService companyInfoService;
|
|
|
|
|
@@ -204,4 +211,246 @@ public class PersonDeviceLogApiController {
|
|
|
|
|
|
return messageResult;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("listByPersonIdFourteenDays")
|
|
|
+ @ApiOperation(value="查询个人用户14天内的日志台账")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<List> listByPersonIdFourteenDays(String token,@RequestAttribute String subject){
|
|
|
+ MessageResult<List> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ Date now = new Date();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String endDate = sdf.format(now);
|
|
|
+ Calendar rightNow = Calendar.getInstance();
|
|
|
+ rightNow.setTime(now);
|
|
|
+ rightNow.add(Calendar.DATE, -14);
|
|
|
+ Date dt1 = rightNow.getTime();
|
|
|
+ String startDate = sdf.format(dt1);
|
|
|
+
|
|
|
+ PersonInfo person = personInfoService.get(Long.valueOf(subject));
|
|
|
+
|
|
|
+ List<PersonDeviceFilterLog> personDeviceLogList = personDeviceFilterLogService.findByPersonAndDate(person.getId(),startDate,endDate);
|
|
|
+
|
|
|
+ messageResult.setData(personDeviceLogList);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="移动端台账日志列表")
|
|
|
+ @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> pageList(
|
|
|
+ String token,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.record_time","desc"));
|
|
|
+
|
|
|
+ PersonInfo person = personInfoService.get(Long.valueOf(subject));
|
|
|
+
|
|
|
+ searchParams.put("personId",person.getId());
|
|
|
+
|
|
|
+ Page<PersonDeviceFilterLog> page = personDeviceFilterLogService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="体温台账饼图统计")
|
|
|
+ @RequestMapping(value = "temperaturePieChart",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="startTime",value = "开始时间(格式:yyyy-MM-dd)",paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="endTime",value = "截止时间(格式:yyyy-MM-dd)",paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<List<Map>> temperaturePieChart(
|
|
|
+ String startTime,String endTime,
|
|
|
+ String token, @RequestAttribute String subject){
|
|
|
+ MessageResult<List<Map>> msgResult = new MessageResult<>();
|
|
|
+ List<Map> listMap = new ArrayList<>();
|
|
|
+ try{
|
|
|
+ String startDate = "";
|
|
|
+ String endDate = "";
|
|
|
+ //37度以上为异常体温
|
|
|
+ BigDecimal bd = new BigDecimal(37);
|
|
|
+
|
|
|
+ if(StringUtil.isNotEmpty(startTime)&&StringUtil.isNotEmpty(endTime)) {
|
|
|
+ startDate = startTime;
|
|
|
+ endDate = endTime;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ Date now = new Date();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ Calendar rightNow = Calendar.getInstance();
|
|
|
+ rightNow.setTime(now);
|
|
|
+ rightNow.add(Calendar.DATE, -14);
|
|
|
+
|
|
|
+ Calendar now1 = Calendar.getInstance();
|
|
|
+ now1.setTime(now);
|
|
|
+ now1.add(Calendar.DATE, 1);
|
|
|
+
|
|
|
+ Date dt1 = rightNow.getTime();
|
|
|
+ Date dt2 = now1.getTime();
|
|
|
+ startDate = sdf.format(dt1);
|
|
|
+ endDate = sdf.format(dt2);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<PersonDeviceFilterLog> normalPersonDeviceFilterLogList = personDeviceFilterLogService.temperatureNormalStatistics(bd,startDate,endDate);
|
|
|
+ List<PersonDeviceFilterLog> unusualPersonDeviceFilterLogList = personDeviceFilterLogService.temperatureUnusualStatistics(bd,startDate,endDate);
|
|
|
+
|
|
|
+ Map<String,Object> map1 = new HashMap();
|
|
|
+
|
|
|
+ map1.put("name","体温正常");
|
|
|
+ map1.put("value",normalPersonDeviceFilterLogList.size());
|
|
|
+
|
|
|
+ listMap.add(map1);
|
|
|
+
|
|
|
+ Map<String,Object> map2 = new HashMap();
|
|
|
+
|
|
|
+ map2.put("name","体温异常");
|
|
|
+ map2.put("value",unusualPersonDeviceFilterLogList.size());
|
|
|
+
|
|
|
+ listMap.add(map2);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(listMap);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="体温台账统计")
|
|
|
+ @RequestMapping(value = "temperatureStatistics",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<List<Map>> temperatureStatistics(
|
|
|
+ String token, @RequestAttribute String subject){
|
|
|
+ MessageResult<List<Map>> msgResult = new MessageResult<>();
|
|
|
+ List<Map> listMap = new ArrayList<>();
|
|
|
+
|
|
|
+ try{
|
|
|
+ List<PersonDeviceFilterLog> personDeviceFilterLogList = personDeviceFilterLogService.list();
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("已检测",personDeviceFilterLogList.size());
|
|
|
+ List<CompanyInfo> companyList = companyInfoService.list();
|
|
|
+ listMap.add(map);
|
|
|
+ Map map1 = new HashMap();
|
|
|
+ map1.put("企业数量",companyList.size());
|
|
|
+ listMap.add(map1);
|
|
|
+ List<PersonInfo> personInfo = personInfoService.list();
|
|
|
+ Map map2 = new HashMap();
|
|
|
+ map2.put("监管人数",personInfo.size());
|
|
|
+ listMap.add(map2);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(listMap);
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="异常统计")
|
|
|
+ @RequestMapping(value = "unusualStatistics",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="startTime",value = "开始时间(格式:yyyy-MM-dd)",paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="endTime",value = "截止时间(格式:yyyy-MM-dd)",paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult< List<Map<String, Object>>> unusualStatistics(
|
|
|
+ String startTime,String endTime,
|
|
|
+ String token, @RequestAttribute String subject) {
|
|
|
+ MessageResult<List<Map<String, Object>>> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+
|
|
|
+ try{
|
|
|
+ String startDate = "";
|
|
|
+ String endDate = "";
|
|
|
+ //37度以上为异常体温
|
|
|
+ BigDecimal bd = new BigDecimal(37);
|
|
|
+
|
|
|
+ if(StringUtil.isNotEmpty(startTime)&&StringUtil.isNotEmpty(endTime)) {
|
|
|
+ startDate = startTime;
|
|
|
+ endDate = endTime;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ Date now = new Date();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ Calendar rightNow = Calendar.getInstance();
|
|
|
+ rightNow.setTime(now);
|
|
|
+ rightNow.add(Calendar.DATE, -14);
|
|
|
+
|
|
|
+ Calendar now1 = Calendar.getInstance();
|
|
|
+ now1.setTime(now);
|
|
|
+ now1.add(Calendar.DATE, 1);
|
|
|
+
|
|
|
+ Date dt1 = rightNow.getTime();
|
|
|
+ Date dt2 = now1.getTime();
|
|
|
+ startDate = sdf.format(dt1);
|
|
|
+ endDate = sdf.format(dt2);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> mapList = personDeviceFilterLogService.unusualStatistics(bd,startDate,endDate);
|
|
|
+
|
|
|
+
|
|
|
+ for (Map<String, Object> map:mapList) {
|
|
|
+ if(map.get("name")!=null&&StringUtil.isNotEmpty(map.get("name").toString())){
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(list);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
}
|