|
@@ -1,12 +1,81 @@
|
|
|
package com.jpsoft.smart.modules.mobile.controller;
|
|
|
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.smart.modules.base.dto.PersonDeviceFilterLogDTO;
|
|
|
+import com.jpsoft.smart.modules.base.entity.CompanyPosition;
|
|
|
+import com.jpsoft.smart.modules.base.entity.DeviceInfo;
|
|
|
+import com.jpsoft.smart.modules.base.entity.PersonDeviceFilterLog;
|
|
|
+import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
|
+import com.jpsoft.smart.modules.base.service.DeviceInfoService;
|
|
|
+import com.jpsoft.smart.modules.base.service.PersonDeviceFilterLogService;
|
|
|
+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 io.swagger.annotations.ApiOperation;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping("/mobile/PersonDeviceFilterLog")
|
|
|
public class PersonDeviceFilterLogController {
|
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PersonDeviceFilterLogService personDeviceFilterLogService;
|
|
|
+ @Autowired
|
|
|
+ private DeviceInfoService deviceInfoService;
|
|
|
+ @Autowired
|
|
|
+ private PersonInfoService personInfoService;
|
|
|
+
|
|
|
+ @ApiOperation(value="获取信息")
|
|
|
+ @GetMapping("edit/{id}")
|
|
|
+ public MessageResult<PersonDeviceFilterLogDTO> edit(@PathVariable("id") Long id){
|
|
|
+ MessageResult<PersonDeviceFilterLogDTO> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ PersonDeviceFilterLog personDeviceFilterLog = personDeviceFilterLogService.get(id);
|
|
|
+ PersonDeviceFilterLogDTO personDeviceFilterLogDTO = new PersonDeviceFilterLogDTO();
|
|
|
+
|
|
|
+ if (personDeviceFilterLog != null) {
|
|
|
+ PojoUtils.map(personDeviceFilterLog, personDeviceFilterLogDTO);
|
|
|
+
|
|
|
+ DeviceInfo deviceInfo = deviceInfoService.get(personDeviceFilterLog.getDeviceNo());
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(personDeviceFilterLog.getPersonId()));
|
|
|
+
|
|
|
+ personDeviceFilterLogDTO.setDeviceName(deviceInfo.getAliasName());
|
|
|
+ personDeviceFilterLogDTO.setPersonName(personInfo.getName());
|
|
|
+ if(personDeviceFilterLog.getTemperature().compareTo(new BigDecimal("37")) == 1 || personDeviceFilterLog.getTemperature().compareTo(new BigDecimal("37")) == 0){
|
|
|
+ personDeviceFilterLogDTO.setFever(true);
|
|
|
+ }else {
|
|
|
+ personDeviceFilterLogDTO.setFever(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(personDeviceFilterLogDTO);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|