ソースを参照

2021/6/10 16:23 环境管理

yinhao 4 年 前
コミット
2508878965
26 ファイル変更722 行追加10 行削除
  1. 7 0
      huimv-smart-common/src/main/java/com/huimv/common/exception/RRExceptionHandler.java
  2. 5 1
      huimv-smart-management/src/main/java/com/huimv/management/Abc.java
  3. 1 1
      huimv-smart-management/src/main/java/com/huimv/management/controller/DrinkingWaterController.java
  4. 4 1
      huimv-smart-management/src/main/java/com/huimv/management/controller/HealthImmuneRecordController.java
  5. 1 1
      huimv-smart-management/src/main/java/com/huimv/management/controller/IndoorEnvironmentController.java
  6. 1 1
      huimv-smart-management/src/main/java/com/huimv/management/controller/OutdoorEnvironmentController.java
  7. 83 0
      huimv-smart-management/src/main/java/com/huimv/management/controller/ThresholdManagementController.java
  8. 98 0
      huimv-smart-management/src/main/java/com/huimv/management/controller/WarningInfoController.java
  9. 17 0
      huimv-smart-management/src/main/java/com/huimv/management/dao/ThresholdManagementDao.java
  10. 27 0
      huimv-smart-management/src/main/java/com/huimv/management/dao/WarningInfoDao.java
  11. 1 1
      huimv-smart-management/src/main/java/com/huimv/management/entity/HealthImmuneRecordEntity.java
  12. 1 1
      huimv-smart-management/src/main/java/com/huimv/management/entity/HealthIsolationRecordEntity.java
  13. 1 1
      huimv-smart-management/src/main/java/com/huimv/management/entity/HealthMedicalRecordEntity.java
  14. 54 0
      huimv-smart-management/src/main/java/com/huimv/management/entity/ThresholdManagementEntity.java
  15. 1 1
      huimv-smart-management/src/main/java/com/huimv/management/entity/UnitEntity.java
  16. 79 0
      huimv-smart-management/src/main/java/com/huimv/management/entity/WarningInfoEntity.java
  17. 33 0
      huimv-smart-management/src/main/java/com/huimv/management/entity/dto/WarningInfoDto.java
  18. 59 0
      huimv-smart-management/src/main/java/com/huimv/management/entity/vo/WarningInfoVo.java
  19. 27 0
      huimv-smart-management/src/main/java/com/huimv/management/service/ThresholdManagementService.java
  20. 34 0
      huimv-smart-management/src/main/java/com/huimv/management/service/WarningInfoService.java
  21. 37 0
      huimv-smart-management/src/main/java/com/huimv/management/service/impl/ThresholdManagementServiceImpl.java
  22. 81 0
      huimv-smart-management/src/main/java/com/huimv/management/service/impl/WarningInfoServiceImpl.java
  23. 1 0
      huimv-smart-management/src/main/resources/application.yml
  24. 18 0
      huimv-smart-management/src/main/resources/mapper/management/ThresholdManagementDao.xml
  25. 39 0
      huimv-smart-management/src/main/resources/mapper/management/WarningInfoDao.xml
  26. 12 1
      renren-fast/src/main/java/io/renren/modules/sys/service/impl/SysUserTokenServiceImpl.java

+ 7 - 0
huimv-smart-common/src/main/java/com/huimv/common/exception/RRExceptionHandler.java

@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.servlet.NoHandlerFoundException;
 
 import javax.validation.ConstraintViolationException;
+import java.sql.SQLException;
 import java.sql.SQLIntegrityConstraintViolationException;
 
 /**
@@ -101,6 +102,12 @@ public class RRExceptionHandler {
 		return R.error(1001,e.getMessage());
 	}
 
+	@ExceptionHandler(SQLException.class)
+	public R handMissingServletRequestParameterException(SQLException e) {
+		logger.error(e.getMessage(),e);
+		return R.error(1001,e.getMessage());
+	}
+
 	@ExceptionHandler(Exception.class)
 	public R handleException(Exception e){
 		logger.error(e.getMessage(), e);

+ 5 - 1
huimv-smart-management/src/main/java/com/huimv/management/Abc.java

@@ -15,7 +15,7 @@ import java.util.Random;
 
 
 /**
- * @Author yinhao
+ * @author yinhao
  * @Date 2021/4/29 16:58
  * @Description
  */
@@ -82,5 +82,9 @@ public class Abc {
 
         int i =(int) Double.parseDouble("39.5");
         System.out.println(i);
+
+        Object o = null;
+        String s = String.valueOf(o);
+        if (s != null) System.out.println(s);
     }
 }

+ 1 - 1
huimv-smart-management/src/main/java/com/huimv/management/controller/DrinkingWaterController.java

@@ -22,7 +22,7 @@ import java.util.Map;
  */
 @Api(tags = "饮用水指标Controller")
 @RestController
-@RequestMapping("management/drinkingwater")
+@RequestMapping("management/drinkingWater")
 public class DrinkingWaterController {
 
     @Autowired

+ 4 - 1
huimv-smart-management/src/main/java/com/huimv/management/controller/HealthImmuneRecordController.java

@@ -81,6 +81,9 @@ public class HealthImmuneRecordController {
      */
     @RequestMapping("/delete")
     public R delete(@RequestBody Integer[] ids){
+        for (Integer id : ids) {
+            
+        }
 		healthImmuneRecordService.removeByIds(Arrays.asList(ids));
 
         return R.ok();
@@ -97,7 +100,7 @@ public class HealthImmuneRecordController {
 
 
         String vaccine = (String)map.get("vaccine");
-        Integer farmId = (Integer)map.get("farmId");
+        Integer farmId = Integer.parseInt((String)map.get("farmId"));
         Integer manId = (Integer)map.get("manId");
 
         healthImmuneRecordService.saveAll(split,vaccine,farmId,manName,manId);

+ 1 - 1
huimv-smart-management/src/main/java/com/huimv/management/controller/IndoorEnvironmentController.java

@@ -22,7 +22,7 @@ import com.huimv.common.utils.R;
  */
 @Api(tags = "室内环境信息")
 @RestController
-@RequestMapping("management/indoorenvironment")
+@RequestMapping("management/indoorEnvironment")
 public class IndoorEnvironmentController {
     @Autowired
     private IndoorEnvironmentService indoorEnvironmentService;

+ 1 - 1
huimv-smart-management/src/main/java/com/huimv/management/controller/OutdoorEnvironmentController.java

@@ -23,7 +23,7 @@ import com.huimv.common.utils.R;
  */
 @Api(tags = "室外环境信息Controller")
 @RestController
-@RequestMapping("management/outdoorenvironment")
+@RequestMapping("management/outdoorEnvironment")
 public class OutdoorEnvironmentController {
     @Autowired
     private OutdoorEnvironmentService outdoorEnvironmentService;

+ 83 - 0
huimv-smart-management/src/main/java/com/huimv/management/controller/ThresholdManagementController.java

@@ -0,0 +1,83 @@
+ package com.huimv.management.controller;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import com.huimv.management.entity.ThresholdManagementEntity;
+import com.huimv.management.service.ThresholdManagementService;
+import com.huimv.common.utils.PageUtils;
+import com.huimv.common.utils.R;
+
+/**
+ * <p>
+ * 报警阈值管理Controller
+ * </p>
+ *
+ * @author yinhao
+ * @version 1.0
+ * @date 2021-06-15 13:01:37
+ */
+@Api(tags = "报警阈值管理Controller")
+@RestController
+@RequestMapping("management/thresholdManagement")
+public class ThresholdManagementController {
+
+    @Autowired
+    private ThresholdManagementService thresholdManagementService;
+
+    /**
+     * 列表
+     */
+    @GetMapping("/list")
+    public R list(@RequestParam Map<String, Object> params){
+        PageUtils page = thresholdManagementService.queryPage(params);
+
+        return R.ok().put("page", page);
+    }
+
+
+    /**
+     * 信息
+     */
+    @GetMapping("/info/{id}")
+    public R info(@PathVariable("id") Integer id){
+		ThresholdManagementEntity thresholdManagement = thresholdManagementService.getById(id);
+
+        return R.ok().put("thresholdManagement", thresholdManagement);
+    }
+
+    /**
+     * 保存
+     */
+    @PostMapping("/save")
+    public R save(@RequestBody ThresholdManagementEntity thresholdManagement){
+		thresholdManagementService.save(thresholdManagement);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    public R update(@RequestBody ThresholdManagementEntity thresholdManagement){
+		thresholdManagementService.updateById(thresholdManagement);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @PostMapping("/delete")
+    public R delete(@RequestBody Integer[] ids){
+		thresholdManagementService.removeByIds(Arrays.asList(ids));
+
+        return R.ok();
+    }
+
+}

+ 98 - 0
huimv-smart-management/src/main/java/com/huimv/management/controller/WarningInfoController.java

@@ -0,0 +1,98 @@
+ package com.huimv.management.controller;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import com.huimv.management.entity.dto.WarningInfoDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.huimv.management.entity.WarningInfoEntity;
+import com.huimv.management.service.WarningInfoService;
+import com.huimv.common.utils.PageUtils;
+import com.huimv.common.utils.R;
+
+
+
+/**
+ * <p>
+ * 报警信息Controller
+ * </p>
+ *
+ * @author yinhao
+ * @version 1.0
+ * @date 2021-06-15 13:01:37
+ */
+@RestController
+@RequestMapping("management/warningInfo")
+public class WarningInfoController {
+    @Autowired
+    private WarningInfoService warningInfoService;
+
+    /**
+     * 列表
+     */
+    @RequestMapping("/list")
+    public R list(@RequestParam Map<String, Object> params){
+        PageUtils page = warningInfoService.queryPage(params);
+
+        return R.ok().put("page", page);
+    }
+
+
+    /**
+     * 信息
+     */
+    @RequestMapping("/info/{id}")
+    public R info(@PathVariable("id") Integer id){
+		WarningInfoEntity warningInfo = warningInfoService.getById(id);
+
+        return R.ok().put("warningInfo", warningInfo);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    public R save(@RequestBody WarningInfoEntity warningInfo){
+		warningInfoService.save(warningInfo);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    public R update(@RequestBody WarningInfoEntity warningInfo){
+		warningInfoService.updateById(warningInfo);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    public R delete(@RequestBody Integer[] ids){
+		warningInfoService.removeByIds(Arrays.asList(ids));
+
+        return R.ok();
+    }
+
+    /**
+     * 确认
+     * @param warningInfoDto
+     * @return
+     */
+    @RequestMapping("/verity")
+    public R verify(@RequestBody WarningInfoDto warningInfoDto) {
+        warningInfoService.verify(warningInfoDto);
+
+        return R.ok();
+    }
+}

+ 17 - 0
huimv-smart-management/src/main/java/com/huimv/management/dao/ThresholdManagementDao.java

@@ -0,0 +1,17 @@
+package com.huimv.management.dao;
+
+import com.huimv.management.entity.ThresholdManagementEntity;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 
+ * 
+ * @author yinhao
+ * @email yinhao@163.com
+ * @date 2021-06-15 13:01:37
+ */
+@Mapper
+public interface ThresholdManagementDao extends BaseMapper<ThresholdManagementEntity> {
+	
+}

+ 27 - 0
huimv-smart-management/src/main/java/com/huimv/management/dao/WarningInfoDao.java

@@ -0,0 +1,27 @@
+package com.huimv.management.dao;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.management.entity.WarningInfoEntity;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.management.entity.vo.WarningInfoVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 报警信息Mapper
+ * </p>
+ * 
+ * @author yinhao
+ * @version 1.0
+ * @date 2021-06-15 13:01:37
+ */
+@Mapper
+@Repository
+public interface WarningInfoDao extends BaseMapper<WarningInfoEntity> {
+
+    IPage<WarningInfoVo> page(@Param("page") IPage page,@Param("ew") QueryWrapper queryWrapper);
+}

+ 1 - 1
huimv-smart-management/src/main/java/com/huimv/management/entity/HealthImmuneRecordEntity.java

@@ -46,7 +46,7 @@ public class HealthImmuneRecordEntity implements Serializable {
 	/**
 	 * 数据有效性
 	 */
-	@TableLogic(delval = "1",value = "1")
+	@TableLogic(delval = "0",value = "1")
 	private Integer effective;
 	/**
 	 * 创建时间

+ 1 - 1
huimv-smart-management/src/main/java/com/huimv/management/entity/HealthIsolationRecordEntity.java

@@ -54,7 +54,7 @@ public class HealthIsolationRecordEntity implements Serializable {
 	/**
 	 * 数据有效性
 	 */
-	@TableLogic(delval = "1",value = "1")
+	@TableLogic(delval = "0",value = "1")
 	private Integer effective;
 	/**
 	 * 创建时间

+ 1 - 1
huimv-smart-management/src/main/java/com/huimv/management/entity/HealthMedicalRecordEntity.java

@@ -75,7 +75,7 @@ public class HealthMedicalRecordEntity implements Serializable {
 	 * 数据有效性
    1:有效(默认) 0:无效
 	 */
-	@TableLogic(delval = "1",value = "1")
+	@TableLogic(delval = "0",value = "1")
 	private Integer effective;
 	/**
 	 * 隔离状态

+ 54 - 0
huimv-smart-management/src/main/java/com/huimv/management/entity/ThresholdManagementEntity.java

@@ -0,0 +1,54 @@
+package com.huimv.management.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 
+ * 
+ * @author yinhao
+ * @email yinhao@163.com
+ * @date 2021-06-15 13:01:37
+ */
+@Data
+@TableName("mgt_threshold_management")
+public class ThresholdManagementEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 主键
+	 */
+	@TableId
+	private Integer id;
+	/**
+	 * 阈值名称
+	 */
+	private String thresholdName;
+	/**
+	 * 阈值类型
+	 */
+	private Integer thresholdType;
+	/**
+	 * 阈值数值
+	 */
+	private Double thresholdValue;
+	/**
+	 * 删除状态 0:未删除 其他:已删除
+	 */
+	@TableLogic
+	private Integer deleted;
+	/**
+	 * 创建时间
+	 */
+	@TableField(fill = FieldFill.INSERT)
+	private Date gmtCreate;
+	/**
+	 * 修改时间
+	 */
+	@TableField(fill = FieldFill.INSERT_UPDATE)
+	private Date gmtModified;
+
+}

+ 1 - 1
huimv-smart-management/src/main/java/com/huimv/management/entity/UnitEntity.java

@@ -34,7 +34,7 @@ public class UnitEntity implements Serializable {
     /**
      * 牧场id
      */
-    private Integer pastureId;
+    private Integer farmId;
 
 	/**
      * 删除状态 0正常 1已删除

+ 79 - 0
huimv-smart-management/src/main/java/com/huimv/management/entity/WarningInfoEntity.java

@@ -0,0 +1,79 @@
+package com.huimv.management.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * <p>
+ * 报警信息entity
+ * </p>
+ * @author yinhao
+ * @version 1.0
+ * @date 2021-06-15 13:01:37
+ */
+@Data
+@TableName("mgt_warning_info")
+public class WarningInfoEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 主键
+	 */
+	@TableId
+	private Integer id;
+	/**
+	 * 当前日期
+	 */
+	private Date nowDate;
+	/**
+	 * 牧场id
+	 */
+	private Integer farmId;
+	/**
+	 * 猪舍id
+	 */
+	private Integer pigstyId;
+	/**
+	 * 报警类型 
+		--室内环境
+		1:室内高温
+		2:室内低温
+		3:室内空气污染
+		4:室内饮用水污染
+
+		--室外环境
+		5.室外高温
+		6.室外低温
+		7.室外空气污染
+
+		--体温
+		8.体温高温
+		9.体温低温
+	 */
+	private Integer warningType;
+	/**
+	 * 当前数值
+	 */
+	private Double nowValue;
+	/**
+	 * 报警时间
+	 */
+	private Date warningTime;
+	/**
+	 * 确认状态 0:未确认 1.已确认
+	 */
+	private Boolean verifyStatus;
+	/**
+	 * 确认人id
+	 */
+	private Integer verifyUserId;
+	/**
+	 * 确认描述
+	 */
+	private String verifyDescription;
+
+}

+ 33 - 0
huimv-smart-management/src/main/java/com/huimv/management/entity/dto/WarningInfoDto.java

@@ -0,0 +1,33 @@
+package com.huimv.management.entity.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author yinhao
+ * @date 2021/6/15 17:22
+ */
+@Data
+public class WarningInfoDto implements Serializable {
+    private static final long serialVersionUID = 2052073652827974104L;
+
+    /**
+     * 主键
+     */
+    @NotNull(message = "id不能为空!")
+    private Integer id;
+
+    /**
+     * 确认描述
+     */
+    @NotBlank(message = "确认描述不能为空!")
+    private String verifyDescription;
+
+}

+ 59 - 0
huimv-smart-management/src/main/java/com/huimv/management/entity/vo/WarningInfoVo.java

@@ -0,0 +1,59 @@
+package com.huimv.management.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 报警信息vo
+ * </p>
+ *
+ * @author yinhao
+ * @version 1.0
+ * @date 2021/6/15 13:52
+ */
+@Data
+public class WarningInfoVo implements Serializable {
+    private static final long serialVersionUID = 4482176341970498690L;
+
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 当前日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GTM+8")
+    private Date nowDate;
+    /**
+     * 牧场id
+     */
+    private Integer farmId;
+    /**
+     * 牧场名称
+     */
+    private String farmName;
+    /**
+     * 猪舍id
+     */
+    private Integer pigstyId;
+    /**
+     * 猪舍名称
+     */
+    private String pigstyName;
+    /**
+     * 报警类型(数字)
+     */
+    private Short warningType;
+    /**
+     * 报警类型名称
+     */
+    private String warningName;
+    /**
+     * 当前数值
+     */
+    private Double nowValue;
+}

+ 27 - 0
huimv-smart-management/src/main/java/com/huimv/management/service/ThresholdManagementService.java

@@ -0,0 +1,27 @@
+package com.huimv.management.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.common.utils.PageUtils;
+import com.huimv.management.entity.ThresholdManagementEntity;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 报警阈值管理Service
+ * </p>
+ *
+ * @author yinhao
+ * @version  1.0
+ * @date 2021-06-15 13:01:37
+ */
+public interface ThresholdManagementService extends IService<ThresholdManagementEntity> {
+
+    /**
+     * 分页列表查询
+     * @param params
+     * @return
+     */
+    PageUtils queryPage(Map<String, Object> params);
+}
+

+ 34 - 0
huimv-smart-management/src/main/java/com/huimv/management/service/WarningInfoService.java

@@ -0,0 +1,34 @@
+package com.huimv.management.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.common.utils.PageUtils;
+import com.huimv.management.entity.WarningInfoEntity;
+import com.huimv.management.entity.dto.WarningInfoDto;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 报警信息Service
+ * </p>
+ *
+ * @author yinhao
+ * @version 1.0
+ * @date 2021-06-15 13:01:37
+ */
+public interface WarningInfoService extends IService<WarningInfoEntity> {
+
+    /**
+     * 分页条件查询
+     * @param params
+     * @return
+     */
+    PageUtils queryPage(Map<String, Object> params);
+
+    /**
+     * 报警信息确认
+     * @param warningInfoDto
+     */
+    void verify(WarningInfoDto warningInfoDto);
+}
+

+ 37 - 0
huimv-smart-management/src/main/java/com/huimv/management/service/impl/ThresholdManagementServiceImpl.java

@@ -0,0 +1,37 @@
+package com.huimv.management.service.impl;
+
+import org.springframework.stereotype.Service;
+import java.util.Map;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.common.utils.PageUtils;
+import com.huimv.common.utils.Query;
+
+import com.huimv.management.dao.ThresholdManagementDao;
+import com.huimv.management.entity.ThresholdManagementEntity;
+import com.huimv.management.service.ThresholdManagementService;
+
+/**
+ * <p>
+ * 报警阈值管理ServiceImpl
+ * </p>
+ *
+ * @author  yinhao
+ * @version 1.0
+ * @date 2021/6/15 13:21
+ */
+@Service("thresholdManagementService")
+public class ThresholdManagementServiceImpl extends ServiceImpl<ThresholdManagementDao, ThresholdManagementEntity> implements ThresholdManagementService {
+
+    @Override
+    public PageUtils queryPage(Map<String, Object> params) {
+        IPage<ThresholdManagementEntity> page = this.page(
+                new Query<ThresholdManagementEntity>().getPage(params),
+                new QueryWrapper<>()
+        );
+
+        return new PageUtils(page);
+    }
+
+}

+ 81 - 0
huimv-smart-management/src/main/java/com/huimv/management/service/impl/WarningInfoServiceImpl.java

@@ -0,0 +1,81 @@
+package com.huimv.management.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.huimv.common.exception.RRException;
+import com.huimv.management.entity.dto.WarningInfoDto;
+import com.huimv.management.entity.vo.WarningInfoVo;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.common.utils.PageUtils;
+import com.huimv.common.utils.Query;
+
+import com.huimv.management.dao.WarningInfoDao;
+import com.huimv.management.entity.WarningInfoEntity;
+import com.huimv.management.service.WarningInfoService;
+
+/**
+ * <p>
+ * 报警信息ServiceImpl
+ * </p>
+ *
+ * @author yinhao
+ * @version 1.0
+ * @date 2021/6/15 13:37
+ */
+@Service("warningInfoService")
+public class WarningInfoServiceImpl extends ServiceImpl<WarningInfoDao, WarningInfoEntity> implements WarningInfoService {
+
+    @Override
+    public PageUtils queryPage(Map<String, Object> params) {
+
+        QueryWrapper<WarningInfoVo> queryWrapper = new QueryWrapper<>();
+
+        //报警类型不能为空
+        String warningType = (String) params.get("warningType");
+        if (StringUtils.isBlank(warningType)) {
+            throw new RRException("报警类型不能为空!");
+        }
+        //牧场id
+        String farmId = (String) params.get("farmId");
+        //猪舍id
+        String pigstyId = (String) params.get("pigstyId");
+        //猪耳标号
+        String earTag = (String) params.get("earTag");
+        //时间区间(前)
+        String startTime = (String) params.get("startTime");
+        //时间区间(后)
+        String endTime = (String) params.get("endTime");
+
+        queryWrapper.eq(StringUtils.isNotBlank(warningType),"warn.warning_type",Short.parseShort(warningType))
+                .eq(StringUtils.isNotBlank(farmId),"warn.farm_id",Integer.parseInt(farmId))
+                .eq(StringUtils.isNotBlank(pigstyId),"warn.pigsty_id",Integer.parseInt(pigstyId))
+                .eq(StringUtils.isNotBlank(earTag),"warn.ear_tag",Integer.parseInt(earTag))
+                .ge(StringUtils.isNotBlank(startTime),"warn.warning_time",startTime)
+                .le(StringUtils.isNotBlank(endTime),"warn.warning_time",endTime)
+                .apply("warn.verify_status = 0 AND farm.deleted = 0 AND pigsty.deleted = 0")
+                .orderByDesc("warn.warning_time");
+
+        IPage<WarningInfoVo> page = baseMapper.page(new Query<>().getPage(params),queryWrapper);
+        return new PageUtils(page);
+
+    }
+
+    @Override
+    public void verify(WarningInfoDto warningInfoDto) {
+
+        LambdaUpdateWrapper<WarningInfoEntity> updateWrapper = Wrappers.lambdaUpdate();
+
+        updateWrapper.set(WarningInfoEntity::getVerifyDescription,warningInfoDto.getVerifyDescription())
+                .set(WarningInfoEntity::getVerifyStatus,false)
+                .eq(WarningInfoEntity::getId,warningInfoDto.getId());
+
+        update(updateWrapper);
+    }
+}

+ 1 - 0
huimv-smart-management/src/main/resources/application.yml

@@ -0,0 +1 @@
+

+ 18 - 0
huimv-smart-management/src/main/resources/mapper/management/ThresholdManagementDao.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.huimv.management.dao.ThresholdManagementDao">
+
+	<!-- 可根据自己的需求,是否要使用 -->
+    <resultMap type="com.huimv.management.entity.ThresholdManagementEntity" id="thresholdManagementMap">
+        <result property="id" column="id"/>
+        <result property="thresholdName" column="threshold_name"/>
+        <result property="thresholdType" column="threshold_type"/>
+        <result property="thresholdValue" column="threshold_value"/>
+        <result property="deleted" column="deleted"/>
+        <result property="gmtCreate" column="gmt_create"/>
+        <result property="gmtModified" column="gmt_modified"/>
+    </resultMap>
+
+
+</mapper>

+ 39 - 0
huimv-smart-management/src/main/resources/mapper/management/WarningInfoDao.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.huimv.management.dao.WarningInfoDao">
+
+	<!-- 可根据自己的需求,是否要使用 -->
+    <resultMap type="com.huimv.management.entity.WarningInfoEntity" id="warningInfoMap">
+        <result property="id" column="id"/>
+        <result property="nowDate" column="now_date"/>
+        <result property="farmId" column="farm_id"/>
+        <result property="pigstyId" column="pigsty_id"/>
+        <result property="warningType" column="warning_type"/>
+        <result property="nowValue" column="now_value"/>
+        <result property="warningTime" column="warning_time"/>
+        <result property="verifyStatus" column="verify_status"/>
+        <result property="verifyUserId" column="verify_user_id"/>
+    </resultMap>
+
+
+    <select id="page" resultType="com.huimv.management.entity.vo.WarningInfoVo">
+        SELECT
+          warn.id,
+          warn.now_date,
+          warn.farm_id,
+          farm.name farm_name,
+          warn.pigsty_id,
+          pigsty.number pigsty_name,
+          warn.warning_type,
+          threshold.threshold_name warning_name,
+          warn.now_value
+        FROM mgt_warning_info warn
+        LEFT JOIN mgt_farm farm ON warn.farm_id = farm.id
+        LEFT JOIN mgt_pigsty pigsty ON warn.pigsty_id = pigsty.id
+        LEFT JOIN mgt_threshold_management threshold ON warn.warning_type = threshold.threshold_type
+          ${ew.customSqlSegment}
+    </select>
+
+
+</mapper>

+ 12 - 1
renren-fast/src/main/java/io/renren/modules/sys/service/impl/SysUserTokenServiceImpl.java

@@ -8,12 +8,18 @@
 
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.renren.common.utils.R;
+import io.renren.modules.app.entity.UserEntity;
+import io.renren.modules.app.service.UserService;
 import io.renren.modules.sys.dao.SysUserTokenDao;
+import io.renren.modules.sys.entity.SysUserEntity;
 import io.renren.modules.sys.entity.SysUserTokenEntity;
 import io.renren.modules.sys.oauth2.TokenGenerator;
+import io.renren.modules.sys.service.SysUserService;
 import io.renren.modules.sys.service.SysUserTokenService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
@@ -24,6 +30,9 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
 	//12小时后过期
 	private final static int EXPIRE = 3600 * 12;
 
+	@Autowired
+	private SysUserService sysUserService;
+
 
 	@Override
 	public R createToken(long userId) {
@@ -35,6 +44,8 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
 		//过期时间
 		Date expireTime = new Date(now.getTime() + EXPIRE * 1000);
 
+		SysUserEntity entity = sysUserService.getOne(Wrappers.<SysUserEntity>lambdaQuery().eq(SysUserEntity::getUserId, userId));
+
 		//判断是否生成过token
 		SysUserTokenEntity tokenEntity = this.getById(userId);
 		if(tokenEntity == null){
@@ -55,7 +66,7 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
 			this.updateById(tokenEntity);
 		}
 
-		R r = R.ok().put("token", token).put("expire", EXPIRE);
+		R r = R.ok().put("token", token).put("expire", EXPIRE).put("farmId",entity.getFarmId());
 
 		return r;
 	}