Ver código fonte

海盐添加登录

523096025 4 anos atrás
pai
commit
6dd416900a
56 arquivos alterados com 1907 adições e 191 exclusões
  1. 9 0
      huimv-ql-farm/huimv-ql-environment/pom.xml
  2. 2 2
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/HuimvEnvironmentApplication.java
  3. 10 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/EnvironmentControlController.java
  4. 86 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/LoginController.java
  5. 80 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/DeviceUpDataEntity.java
  6. 3 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/IndexEnvEntity.java
  7. 92 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/SysAccountEntity.java
  8. 27 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/DeviceUpDataEntityRepo.java
  9. 6 1
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/FarmSmRepository.java
  10. 28 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/SysAccountEntityRepository.java
  11. 4 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/IEnvironmentControlService.java
  12. 11 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/ILoginService.java
  13. 85 66
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/EnvironmentControlServiceImpl.java
  14. 1 2
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/IndexEnvServiceImpl.java
  15. 47 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/LoginServiceImpl.java
  16. 77 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/session/AccessToken.java
  17. 100 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/session/CheckNumber.java
  18. 27 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/session/IpTools.java
  19. 0 43
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev2.yml
  20. 0 47
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev3.yml
  21. 19 0
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application-haiyan.yml
  22. 38 0
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application-wjj.yml
  23. 19 0
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application-wuyi.yml
  24. 1 1
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev1.yml
  25. 6 2
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application.properties
  26. 200 0
      huimv-ql-farm/huimv-ql-gateway/hs_err_pid33264.log
  27. 14 0
      huimv-ql-farm/huimv-ql-gateway/pom.xml
  28. 12 0
      huimv-ql-farm/huimv-ql-gateway/src/main/java/com/farm/gateway/GatewayApplication.java
  29. 45 0
      huimv-ql-farm/huimv-ql-gateway/src/main/resources/application-haiyan.yml
  30. 45 0
      huimv-ql-farm/huimv-ql-gateway/src/main/resources/application-wjj.yml
  31. 10 4
      huimv-ql-farm/huimv-ql-gateway/src/main/resources/application.yml
  32. 4 0
      huimv-ql-farm/huimv-ql-gateway/src/main/resources/application.properties
  33. 200 0
      huimv-ql-farm/huimv-ql-production/hs_err_pid5788.log
  34. 0 1
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/MFattenAreaController.java
  35. 0 2
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexParameterServiceImpl.java
  36. 2 2
      huimv-ql-farm/huimv-ql-production/src/main/resources/application-haiyan.yml
  37. 19 0
      huimv-ql-farm/huimv-ql-production/src/main/resources/application-wjj.yml
  38. 2 2
      huimv-ql-farm/huimv-ql-production/src/main/resources/application-wuyi.yml
  39. 2 2
      huimv-ql-farm/huimv-ql-production/src/main/resources/application-ycg.yml
  40. 3 2
      huimv-ql-farm/huimv-ql-production/src/main/resources/application.properties
  41. 2 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/HuimvSecurityApplication.java
  42. 32 0
      huimv-ql-farm/huimv-ql-security/src/main/resources/application-haiyan.yml
  43. 2 2
      huimv-ql-farm/huimv-ql-security/src/main/resources/application-dev.yml
  44. 32 0
      huimv-ql-farm/huimv-ql-security/src/main/resources/application-ycg.yml
  45. 3 1
      huimv-ql-farm/huimv-ql-security/src/main/resources/application.properties
  46. 200 0
      huimv-ql-farm/huimv-ql-video/hs_err_pid14620.log
  47. 200 0
      huimv-ql-farm/huimv-ql-video/hs_err_pid27644.log
  48. 4 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/HuimvVideoApplication.java
  49. 1 1
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/MobileUser.java
  50. 1 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/result/ResultStatus.java
  51. 5 5
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/MobileUserServiceImpl.java
  52. 32 0
      huimv-ql-farm/huimv-ql-video/src/main/resources/application-haiyan.yml
  53. 19 0
      huimv-ql-farm/huimv-ql-video/src/main/resources/application-wjj.yml
  54. 32 0
      huimv-ql-farm/huimv-ql-video/src/main/resources/application-wuyi.yml
  55. 2 2
      huimv-ql-farm/huimv-ql-video/src/main/resources/application-dev.yml
  56. 4 1
      huimv-ql-farm/huimv-ql-video/src/main/resources/application.properties

+ 9 - 0
huimv-ql-farm/huimv-ql-environment/pom.xml

@@ -37,6 +37,15 @@
             <artifactId>hutool-all</artifactId>
             <version>5.5.9</version>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.2.5</version>
+        </dependency>
 <!--        <dependency>-->
 <!--            <groupId>org.springframework.boot</groupId>-->
 <!--            <artifactId>spring-boot-starter-log4j2</artifactId>-->

+ 2 - 2
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/HuimvEnvironmentApplication.java

@@ -3,14 +3,14 @@ package com.huimv.environment;
 import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
 
 //自动格式化返回时间
 @EnableJpaAuditing
-// 单数据源
-@SpringBootApplication
 // 多数据源
 //@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
+@SpringBootApplication
 public class HuimvEnvironmentApplication {
 
     public static void main(String[] args) {

+ 10 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/EnvironmentControlController.java

@@ -42,5 +42,15 @@ public class EnvironmentControlController {
     }
 
 
+    @RequestMapping(value = "/warningInfor")
+    public Result warningInfor(){
+        return envControlService.warningInfor();
+    }
+
+    @RequestMapping(value = "/findByZSID")
+    public Result findByZSID(){
+        return envControlService.findByZSID();
+    }
+
 
 }

+ 86 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/LoginController.java

@@ -0,0 +1,86 @@
+package com.huimv.environment.controller;
+
+
+import com.huimv.common.result.Result;
+import com.huimv.environment.service.ILoginService;
+import com.huimv.environment.session.AccessToken;
+import com.huimv.environment.session.CheckNumber;
+import com.huimv.environment.session.IpTools;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.Date;
+
+@RestController
+@RequestMapping(value = "/my")
+public class LoginController {
+    @Autowired
+    ILoginService iLoginService;
+
+    private static String text;
+
+    @RequestMapping(value = "/login", method = RequestMethod.POST)
+    public AccessToken login(HttpSession session, @RequestParam(name = "accountName", required = true) String accountName, @RequestParam(name = "password", required = true) String password, HttpServletRequest req)  {
+        // 对密码加密
+//        Result result = iLoginService.login(accountName,         .getMD5Str(password));
+        // 未对密码加密
+        Result result = iLoginService.login(accountName, password);
+        if(result.getCode() != 1000){
+            AccessToken accessToken = new AccessToken();
+//            accessToken.setToken(session.getId());
+//            accessToken.setLoginIp(userIp);
+            accessToken.setCreated(new Date());
+            accessToken.setAccountName(accountName);
+            accessToken.setCode(result.getCode());
+            accessToken.setMessage(result.getMessage());
+            return accessToken;
+        }
+
+        String userIp = IpTools.getRemoteHost(req);
+        //spring-session默认使用uuid作为sessionId返回:
+        System.out.println("当前请求的sessionId为:" + session.getId());
+
+        AccessToken accessToken = new AccessToken();
+        accessToken.setToken(session.getId());
+        accessToken.setLoginIp(userIp);
+        accessToken.setCreated(new Date());
+        accessToken.setAccountName(accountName);
+        accessToken.setCode(result.getCode());
+        return accessToken;
+    }
+
+    @RequestMapping("/logout")
+    public Result logout(@RequestParam(name = "accountName", required = true) String accountName, @RequestParam(name = "password", required = true) String password) {
+        return iLoginService.logout();
+    }
+
+    //获取验证码
+    @RequestMapping(value = "getCheckNumber", produces = {"text/html;charset=UTF-8"})
+    public void getCheckNumber(HttpServletResponse response) throws IOException {
+        //创建对象
+        CheckNumber checkNumber = new CheckNumber();
+        //获取图片对象
+        BufferedImage image = checkNumber.getImage();
+        //获得图片的文本内容
+        text = checkNumber.getText();
+        //把图片返回前端
+        ImageIO.write(image, "JPEG", response.getOutputStream());
+    }
+
+    @RequestMapping("/checkNumber")
+    public Result checkNumber(String userCaptcha){
+        //获取用户输入的校验码并进行比较
+       // String sessionCheckNumber = (String) session.getAttribute("checkNumber");
+        System.out.println(userCaptcha +":"+ text);
+        if (text.equalsIgnoreCase(userCaptcha)) {
+            return new Result(10001,"验证码正确",true);
+        }
+        return new Result(10002,"验证码错误",false);
+    }
+}

+ 80 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/DeviceUpDataEntity.java

@@ -0,0 +1,80 @@
+package com.huimv.environment.entity;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Data
+@Table(name = "device_up_data")
+public class DeviceUpDataEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "data_bat")
+    private Integer dataBat;
+
+    @Column(name = "data_humi")
+    private Integer dataHumi;
+
+    @Column(name = "data_rssi")
+    private Integer dataRssi;
+
+    @Column(name = "data_stc")
+    private Integer dataStc;
+
+    @Column(name = "data_temp")
+    private Integer dataTemp;
+
+    @Column(name = "data_time")
+    private Integer dataTime;
+
+    @Column(name = "data_ver")
+    private Integer dataVer;
+
+    @Column(name = "device_id")
+    private String deviceId;
+
+    @Column(name = "device_type")
+    private String deviceType;
+
+    @Column(name = "imei")
+    private String imei;
+
+    @Column(name = "imsi")
+    private String imsi;
+
+    @Column(name = "message_type")
+    private String messageType;
+
+    @Column(name = "product_id")
+    private String productId;
+
+    @Column(name = "protocol")
+    private String protocol;
+
+    @Column(name = "service_id")
+    private String serviceId;
+
+    @Column(name = "timestamp")
+    private String timestamp;
+
+    @Column(name = "tenant_id")
+    private String tenantId;
+
+    @Column(name = "data_temp_convert")
+    private Double dataTempConvert;
+
+    @Column(name = "data_humi_convert")
+    private Double dataHumiConvert;
+
+    @Column(name = "data_bat_convert")
+    private Double dataBatConvert;
+
+}

+ 3 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/IndexEnvEntity.java

@@ -36,6 +36,9 @@ public class IndexEnvEntity implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date updateTime;
 
+    @Column(name = "unit")
+    private String unit;
+
 
 
 }

+ 92 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/SysAccountEntity.java

@@ -0,0 +1,92 @@
+package com.huimv.environment.entity;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "sys_account")
+public class SysAccountEntity implements Serializable {
+
+    private static final long serialVersionUID = 6073065542016688601L;
+
+    @Override
+    public String toString() {
+        return "SysAccountEntity{" +
+                "id=" + id +
+                ", accountName='" + accountName + '\'' +
+                ", password='" + password + '\'' +
+                ", accountStatus=" + accountStatus +
+                ", remark='" + remark + '\'' +
+                ", userId=" + userId +
+                '}';
+    }
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "account_name")
+    private String accountName;
+
+    @Column(name = "password")
+    private String password;
+
+    @Column(name = "account_status")
+    private Integer accountStatus;
+
+    @Column(name = "remark")
+    private String remark;
+
+    @Column(name = "user_id")
+    private Long userId;
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setAccountName(String accountName) {
+        this.accountName = accountName;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setAccountStatus(Integer accountStatus) {
+        this.accountStatus = accountStatus;
+    }
+
+    public Integer getAccountStatus() {
+        return accountStatus;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+}

+ 27 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/DeviceUpDataEntityRepo.java

@@ -0,0 +1,27 @@
+package com.huimv.environment.repo;
+
+import com.huimv.environment.entity.DeviceUpDataEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Date;
+import java.util.List;
+
+public interface DeviceUpDataEntityRepo extends JpaRepository<DeviceUpDataEntity, Integer>, JpaSpecificationExecutor<DeviceUpDataEntity> {
+
+
+    @Query(nativeQuery = true,value = "select * from device_up_data where device_id =?1 ORDER by id DESC limit 1")
+    DeviceUpDataEntity findByDeviceId(String deviceId);
+
+
+//    List<DeviceUpDataEntity> findAllByTimestampBetweenAndDeviceId(Date startTime, Date endTime, String deviceId);
+
+    @Query(nativeQuery = true,value = "SELECT * FROM device_up_data WHERE DATE_FORMAT(timestamp ,'%Y-%m-%d')=DATE_FORMAT(?1,'%Y-%m-%d') and device_id = ?2")
+    List<DeviceUpDataEntity> findAllByDeviceIdOrderByIdDesc(String today, String deviceId);
+
+    @Query(nativeQuery = true,value = "SELECT * FROM (SELECT * FROM device_up_data WHERE data_temp_convert < ?1 OR data_temp_convert > ?2 )  a\n" +
+            "WHERE DATE_FORMAT(TIMESTAMP,'%Y-%m-%d')=DATE_FORMAT(?3,'%Y-%m-%d')  ")
+    List<DeviceUpDataEntity> findAllByTimestampBetween(Double minTemp,Double maxTemp, String today );
+
+}

+ 6 - 1
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/FarmSmRepository.java

@@ -4,4 +4,9 @@ import com.huimv.environment.entity.FarmSm;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
-public interface FarmSmRepository extends JpaRepository<FarmSm, Integer>,JpaSpecificationExecutor<FarmSm>{}
+import java.util.List;
+
+public interface FarmSmRepository extends JpaRepository<FarmSm, Integer>,JpaSpecificationExecutor<FarmSm>{
+
+    FarmSm findByLqid(String lqid);
+}

+ 28 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/SysAccountEntityRepository.java

@@ -0,0 +1,28 @@
+package com.huimv.environment.repo;
+
+import com.huimv.environment.entity.SysAccountEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface SysAccountEntityRepository extends JpaRepository<SysAccountEntity, Integer>, JpaSpecificationExecutor<SysAccountEntity> {
+    @Query(nativeQuery = true , value = "SELECT * FROM sys_account WHERE account_name=?1 AND password=?2")
+    SysAccountEntity findByAccountName(String accountName, String password);
+
+    @Transactional
+    @Modifying(clearAutomatically = true, flushAutomatically = true)
+    @Query(nativeQuery = true,value = "UPDATE sys_account SET account_status=?2 WHERE user_id=(SELECT user_id FROM sys_user WHERE id=?1)")
+    int updateAccountStatus(Integer id, Integer status);
+
+    @Transactional
+    @Modifying(clearAutomatically = true, flushAutomatically = true)
+    @Query(nativeQuery = true,value = "DELETE FROM sys_account WHERE user_id=?1")
+    void deleteByUserId(Long userId);
+
+    @Query(nativeQuery = true,value = "SELECT * FROM sys_account WHERE user_id=?1")
+    List<SysAccountEntity> findByUserId(Long userId);
+}

+ 4 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/IEnvironmentControlService.java

@@ -12,4 +12,8 @@ public interface IEnvironmentControlService {
 
 
     Result getAllBylqid(String lqid);
+
+    Result warningInfor();
+
+    Result findByZSID();
 }

+ 11 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/ILoginService.java

@@ -0,0 +1,11 @@
+package com.huimv.environment.service;
+
+
+import com.huimv.common.result.Result;
+
+public interface ILoginService {
+
+    Result login(String accountName, String password);
+
+    Result logout();
+}

+ 85 - 66
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/EnvironmentControlServiceImpl.java

@@ -1,5 +1,6 @@
 package com.huimv.environment.service.impl;
 
+import cn.hutool.core.date.DateTime;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
@@ -10,6 +11,7 @@ import com.huimv.environment.entity.*;
 import com.huimv.environment.repo.*;
 import com.huimv.environment.service.IEnvironmentControlService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.text.ParseException;
@@ -38,6 +40,11 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
     @Autowired
     private FarmSmRepository farmSmRepository;
 
+    @Value("${minTemp}")
+    private  Double minTemp ; //低温报警值
+    @Value("${maxTemp}")
+    private  Double maxTemp ;//高温报警值
+
     @Override
     public Result getPigpenByFarm(Integer farmId) {
         //--读取所有猪舍
@@ -82,7 +89,6 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
     }
 
     @Override
-//    @DS("master")
     public Result getLastEnvData(Integer lqid) {
         String todayDate = new DateUtil().formatDate(new Date());
         System.out.println(" todayDate>>"+todayDate);
@@ -114,70 +120,83 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
         return new Result(ResultCode.SUCCESS, envJo);
     }
 
-//    @Override
-//    public Result getAllFarm() {
-//
-//
-//        List<FarmSm> all = farmSmRepository.findAll();
-//
-//        String dateStr = "2021-03-14 00:00:00";
-//        Date date = null;
-//        try {
-//             date = DateUtil.parseDateTime(dateStr);
-//        } catch (ParseException e) {
-//            e.printStackTrace();
-//        }
-//
-//       List endList = new ArrayList();
-//
-//        for (FarmSm farmSm : all) {
-//            Map endMap = new HashMap();
-//            endMap.put("name",farmSm.getName());
-//
-//            String lqid = farmSm.getLqid();
-//            endMap.put("lqid",farmSm.getLqid());
-//
-//
-//
-//            List<SjHkAq> allByLqidAndScsjBetween = aqRepo.findAllByLqidAndScsjBetween(lqid, date, new Date());
-//
-//            List aqList = new ArrayList();
-//            for (SjHkAq sjHkAq : allByLqidAndScsjBetween) {
-//                Map map1 = new HashMap();
-//                map1.put("time",(sjHkAq.getScsj()+"").substring(11,19));
-//                map1.put("data",sjHkAq.getDqaq());
-//                aqList.add(map1);
-//            }
-//
-//            endMap.put("aq",aqList);
-//
-//            List<SjHkSd> allByLqidAndScsjBetween1 = sdRepo.findAllByLqidAndScsjBetween(lqid, date, new Date());
-//            List sdList = new ArrayList();
-//            for (SjHkSd sjHkAq : allByLqidAndScsjBetween1) {
-//                Map map1 = new HashMap();
-//                map1.put("time",(sjHkAq.getScsj()+"").substring(11,19));
-//                map1.put("data",sjHkAq.getDqsd());
-//                sdList.add(map1);
-//            }
-//            endMap.put("sd",sdList);
-//
-//
-//            List<SjHkWd> allByLqidAndScsjBetween2 = wdRepo.findAllByLqidAndScsjBetween(lqid, date, new Date());
-//            List wdList = new ArrayList();
-//            for (SjHkWd sjHkAq : allByLqidAndScsjBetween2) {
-//                Map map1 = new HashMap();
-//                map1.put("time",(sjHkAq.getScsj()+"").substring(11,19));
-//                map1.put("data",sjHkAq.getDqwd());
-//                wdList.add(map1);
-//            }
-//            endMap.put("wd",wdList);
-//            endList.add(endMap);
-//
-//        }
-//        return new Result(ResultCode.SUCCESS,endList);
-//    }
+
+    @Autowired
+    private  DeviceUpDataEntityRepo deviceUpDataEntityRepo;
+
+    @Override
+    public Result getAllFarm(){
+        List endList  = new ArrayList();
+        List<FarmSm> all = farmSmRepository.findAll();
+
+
+        for (FarmSm farmSm : all) {
+            Map map = new HashMap();
+            String lqid = farmSm.getLqid();
+            DeviceUpDataEntity byDeviceId = deviceUpDataEntityRepo.findByDeviceId(lqid);
+            map.put("aq",0);
+            map.put("name",farmSm.getName());
+            map.put("lqid",byDeviceId.getDeviceId());
+            map.put("sd",byDeviceId.getDataHumiConvert());
+            map.put("wd",byDeviceId.getDataTempConvert());
+            endList.add(map);
+        }
+
+
+        return new Result(ResultCode.SUCCESS,endList);
+    }
 
     @Override
+    public Result getAllBylqid(String lqid) {
+         List endList = new ArrayList();
+
+
+        String today= cn.hutool.core.date.DateUtil.today();
+//        List<DeviceUpDataEntity> allByTimestampBetweenAndDeviceId = deviceUpDataEntityRepo.findAllByTimestampBetweenAndDeviceId(starTime, endTime, lqid);
+        List<DeviceUpDataEntity> allByDeviceIdOrderByIdDesc = deviceUpDataEntityRepo.findAllByDeviceIdOrderByIdDesc(today,lqid);
+        for (DeviceUpDataEntity deviceUpDataEntity : allByDeviceIdOrderByIdDesc) {
+            Map map = new HashMap();
+            map.put("time",deviceUpDataEntity.getTimestamp().substring(11));
+            map.put("wd",deviceUpDataEntity.getDataTempConvert());
+            map.put("sd",deviceUpDataEntity.getDataHumiConvert());
+            map.put("aq",0);
+            endList.add(map);
+        }
+
+
+        return new Result(ResultCode.SUCCESS,endList);
+    }
+
+
+    @Override
+    public Result warningInfor() {
+        List endList  = new ArrayList();
+        List<DeviceUpDataEntity> allByTimestampBetween = deviceUpDataEntityRepo.findAllByTimestampBetween(minTemp, maxTemp, cn.hutool.core.date.DateUtil.today());
+        for (DeviceUpDataEntity deviceUpDataEntity : allByTimestampBetween) {
+            Map map  = new HashMap();
+            map.put("farmName",farmSmRepository.findByLqid(deviceUpDataEntity.getDeviceId()).getName());
+            map.put("time",deviceUpDataEntity.getTimestamp());
+            String str  = "";
+            if (deviceUpDataEntity.getDataTempConvert() < minTemp){
+                str = str +"温度过低,温度:"+ deviceUpDataEntity.getDataTempConvert();
+            }
+            if (deviceUpDataEntity.getDataTempConvert() > maxTemp){
+                str = str +"温度过高,温度:"+ deviceUpDataEntity.getDataTempConvert();
+            }
+            map.put("msg",str);
+            endList.add(map);
+        }
+
+        return new Result(ResultCode.SUCCESS,endList) ;
+    }
+
+
+    @Override
+    public Result findByZSID() {
+        return null;
+    }
+
+  /*  @Override
     public Result getAllFarm() {
 
 
@@ -228,9 +247,9 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
 
         }
         return new Result(ResultCode.SUCCESS,endList);
-    }
+    }*/
 
-    @Override
+   /* @Override
     public Result getAllBylqid(String lqid) {
 
         String dateStr = "2021-03-14 00:00:00";
@@ -282,6 +301,6 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
 
         return new Result(ResultCode.SUCCESS,map);
     }
-
+*/
 
 }

+ 1 - 2
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/IndexEnvServiceImpl.java

@@ -1,5 +1,6 @@
 package com.huimv.environment.service.impl;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.huimv.common.result.Result;
 import com.huimv.common.result.ResultCode;
 import com.huimv.environment.entity.IndexEnvEntity;
@@ -54,7 +55,6 @@ public class IndexEnvServiceImpl implements IndexEnvService {
             return new Result(10001,"删除失败",false);
         }
     }
-
     @Override
     public Result update(IndexEnvEntity envEntity) {
         if (envEntity == null){
@@ -69,7 +69,6 @@ public class IndexEnvServiceImpl implements IndexEnvService {
             return new Result(10001,"修改失败",false);
         }
     }
-
     @Override
     public Result findAll() {
         try {

+ 47 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/LoginServiceImpl.java

@@ -0,0 +1,47 @@
+package com.huimv.environment.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.huimv.common.result.Result;
+import com.huimv.common.result.ResultCode;
+import com.huimv.environment.entity.SysAccountEntity;
+import com.huimv.environment.repo.SysAccountEntityRepository;
+import com.huimv.environment.service.ILoginService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class LoginServiceImpl implements ILoginService {
+
+    @Autowired
+    private SysAccountEntityRepository sysAccountEntityRepo;
+
+    @Override
+    public Result login(String accountName, String password) {
+        //Step1:判断账户状态
+        //Step2:读取菜单组
+        SysAccountEntity accountEntity = sysAccountEntityRepo.findByAccountName(accountName, password);
+        if (accountEntity == null) {
+//            throw new PlatformException("The account or password is wrong.", "该账号不存在或密码错误.");
+            return new Result(10002, "账号不存在或密码错误.", false);
+        }
+        int status = accountEntity.getAccountStatus();
+        if (status == 0) {
+            return new Result(10003, "该账号未启用.", false);
+//            throw new PlatformException("10003", "该账号未启用.");
+        }
+        if (status == -1) {
+            return new Result(10004, "该账号已暂停使用.", false);
+//            throw new PlatformException("10004", "该账号已暂停使用.");
+        }
+        int accountId = accountEntity.getId();
+        System.out.println("accountId>>"+accountId);
+//        List<SysMenuEntity> menuEntityList = sysMenuEntityRepo.findByAccountId(accountId);
+//        return new Result(ResultCode.SUCCESS, menuEntityList);
+        return new Result(ResultCode.SUCCESS,accountEntity);
+    }
+
+    @Override
+    public Result logout() {
+        return null;
+    }
+}

+ 77 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/session/AccessToken.java

@@ -0,0 +1,77 @@
+package com.huimv.environment.session;
+
+import java.util.Date;
+
+/**
+ * 登录的token信息
+ * @author guojian
+ */
+public class AccessToken {
+    private String token;
+    private String loginIp;
+    private Date created;
+    private String accountName;
+    private Integer code;
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    private String message;
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public void setAccountName(String accountName) {
+        this.accountName = accountName;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+	public String getLoginIp() {
+		return loginIp;
+	}
+
+	public void setLoginIp(String loginIp) {
+		this.loginIp = loginIp;
+	}
+
+    @Override
+    public String toString() {
+        return "AccessToken{" +
+                "token='" + token + '\'' +
+                ", loginIp='" + loginIp + '\'' +
+                ", created=" + created +
+                ", accountName='" + accountName + '\'' +
+                ", code=" + code +
+                ", message='" + message + '\'' +
+                '}';
+    }
+}

+ 100 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/session/CheckNumber.java

@@ -0,0 +1,100 @@
+package com.huimv.environment.session;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Random;
+
+public class CheckNumber {
+    private int w = 70;//验证码图片宽
+    private int h = 35;//验证码图片高
+    private Random r = new Random();//随机对象
+    // {"宋体", "华文楷体", "黑体", "华文新魏", "华文隶书", "微软雅黑", "楷体_GB2312"}
+    private String[] fontNames = {"宋体", "华文楷体", "黑体", "微软雅黑", "楷体_GB2312"};
+    // 可选字符
+    private String codes = "0123456789abcdefghjkmnopqrstuvwxyz";
+    // 背景色
+    private Color bgColor = new Color(255, 255, 255);
+    // 验证码上的文本
+    private String text;
+
+    // 生成随机的颜色
+    private Color randomColor() {
+        int red = r.nextInt(150);
+        int green = r.nextInt(150);
+        int blue = r.nextInt(150);
+        return new Color(red, green, blue);
+    }
+
+    // 生成随机的字体
+    private Font randomFont() {
+        int index = r.nextInt(fontNames.length);
+        String fontName = fontNames[index];//生成随机的字体名称
+        int style = r.nextInt(4);//生成随机的样式, 0(无样式), 1(粗体), 2(斜体), 3(粗体+斜体)
+        int size = r.nextInt(5) + 24; //生成随机字号, 24 ~ 28
+        //Font对象的参数:1.字体名称2.字体样式3.字体大小
+        return new Font(fontName, style, size);
+    }
+
+    // 传入一个BufferImage对象,给图片画干扰线
+    private void drawLine(BufferedImage image) {
+        int num = 3;//一共画3条
+        Graphics2D g2 = (Graphics2D) image.getGraphics();
+        for (int i = 0; i < num; i++) {//生成两个点的坐标,即4个值
+            int x1 = r.nextInt(w);
+            int y1 = r.nextInt(h);
+            int x2 = r.nextInt(w);
+            int y2 = r.nextInt(h);
+            g2.setStroke(new BasicStroke(1.5F));
+            g2.setColor(Color.BLUE); //干扰线是蓝色
+            g2.drawLine(x1, y1, x2, y2);//画线
+        }
+    }
+
+    // 随机生成一个字符
+    private char randomChar() {
+        int index = r.nextInt(codes.length());
+        return codes.charAt(index);
+    }
+
+    // 创建BufferedImage
+    private BufferedImage createImage() {
+        BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2 = (Graphics2D) image.getGraphics();
+        g2.setColor(this.bgColor);
+        g2.fillRect(0, 0, w, h);
+        return image;
+    }
+
+    // 调用这个方法得到验证码
+    public BufferedImage getImage() {
+        BufferedImage image = createImage();//创建图片缓冲区
+        Graphics2D g2 = (Graphics2D) image.getGraphics();//得到绘制环境
+        StringBuilder sb = new StringBuilder();//用来装载生成的验证码文本
+        // 向图片中画4个字符
+        for (int i = 0; i < 4; i++) {//循环四次,每次生成一个字符
+            String s = randomChar() + "";//随机生成一个字母
+            sb.append(s); //把字母添加到sb中
+            float x = i * 1.0F * w / 4; //设置当前字符的x轴坐标
+            g2.setFont(randomFont()); //设置随机字体
+            g2.setColor(randomColor()); //设置随机颜色
+            g2.drawString(s, x, h - 5); //画图
+        }
+        this.text = sb.toString(); //把生成的字符串赋给了this.text
+        drawLine(image); //添加干扰线
+        return image;
+    }
+
+    // 返回验证码图片上的文本
+    public String getText() {
+        return text;
+    }
+
+    // 保存图片到指定的输出流
+    public static void output(BufferedImage image, OutputStream out)
+            throws IOException {
+        ImageIO.write(image, "JPEG", out);
+    }
+}

+ 27 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/session/IpTools.java

@@ -0,0 +1,27 @@
+package com.huimv.environment.session;
+
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author yejijie
+ * @created 2020年7月17日 上午11:24:20
+*/
+@Component
+public class IpTools {
+
+    public static String getRemoteHost(HttpServletRequest request){
+        String ip = request.getHeader("x-forwarded-for");
+        if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+        if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+        if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){
+            ip = request.getRemoteAddr();
+        }
+        return ip.equals("0:0:0:0:0:0:0:1")?"127.0.0.1":ip;
+    }
+}

+ 0 - 43
huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev2.yml

@@ -1,43 +0,0 @@
-server:
-  port: 8085
-spring:
-  application:
-    name: environment
-
-  datasource:
-    dynamic:
-      datasource:
-        master:
-          url: jdbc:mysql://122.112.250.26:3306/env_db?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-          username: root
-          password: hm123456
-          driver-class-name: com.mysql.cj.jdbc.Driver
-          max-active: 5
-          max-idle: 5
-          min-idle: 3
-          initial-size: 3
-        slave:
-          url: jdbc:mysql://122.112.219.87:3306/ifm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-          username: huimv
-          password: hm123456
-          driver-class-name: com.mysql.cj.jdbc.Driver
-          max-active: 5
-          max-idle: 5
-          min-idle: 3
-          initial-size: 3
-        third:
-          url: jdbc:mysql://121.36.134.218:3306/device_db?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-          username: root
-          password: hm123456
-          driver-class-name: com.mysql.cj.jdbc.Driver
-          max-active: 5
-          max-idle: 5
-          min-idle: 3
-          initial-size: 3
-  jpa:
-    show-sql: true
-    database: mysql
-    hibernate:
-      ddl-auto: update
-    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
-    open-in-view: true

+ 0 - 47
huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev3.yml

@@ -1,47 +0,0 @@
-server:
-  port: 8085
-spring:
-  application:
-    name: environment
-
-  datasource:
-    dynamic:
-      druid: #以下是全局默认值,可以全局更改
-        initial-size: 0
-        max-active: 8
-        min-idle: 2
-        max-wait: -1
-        min-evictable-idle-time-millis: 30000
-        max-evictable-idle-time-millis: 30000
-        time-between-eviction-runs-millis: 0
-        validation-query: select 1
-        validation-query-timeout: -1
-        test-on-borrow: false
-        test-on-return: false
-        test-while-idle: true
-        pool-prepared-statements: true
-        max-open-prepared-statements: 100
-        filters: stat,wall
-        share-prepared-statements: true
-      datasource:
-        master:
-          url: jdbc:mysql://192.168.1.7:3306/env_db?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-          driver-class-name: com.mysql.cj.jdbc.Driver
-          username: root
-          password: hm123456
-          druid:
-            initial-size: 5
-        slave:
-          url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-          username: root
-          password: hm123456
-          driver-class-name: com.mysql.cj.jdbc.Driver
-          druid:
-            initial-size: 3
-  jpa:
-    show-sql: true
-    database: mysql
-    hibernate:
-      ddl-auto: update
-    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
-    open-in-view: true

+ 19 - 0
huimv-ql-farm/huimv-ql-environment/src/main/resources/application-haiyan.yml

@@ -0,0 +1,19 @@
+server:
+  port: 8085
+spring:
+  application:
+    name: environment
+
+  #------DataSource-----
+  datasource:
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+
+  jpa:
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    show-sql: true

+ 38 - 0
huimv-ql-farm/huimv-ql-environment/src/main/resources/application-wjj.yml

@@ -0,0 +1,38 @@
+server:
+  port: 8085
+spring:
+  application:
+    name: environment
+
+  #------DataSource-----
+  datasource:
+    dynamic:
+      datasource:
+        master:
+          url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_wjj?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+          #    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+          username: root
+          password: hm123456
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          max-active: 5
+          max-idle: 5
+          min-idle: 3
+          initial-size: 3
+        slave:
+          url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+          #    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+          username: root
+          password: hm123456
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          max-active: 5
+          max-idle: 5
+          min-idle: 3
+          initial-size: 3
+
+
+
+  jpa:
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    show-sql: true
+    database: mysql
+    open-in-view: true

+ 19 - 0
huimv-ql-farm/huimv-ql-environment/src/main/resources/application-wuyi.yml

@@ -0,0 +1,19 @@
+server:
+  port: 8085
+spring:
+  application:
+    name: environment
+
+  #------DataSource-----
+  datasource:
+    url: jdbc:mysql://122.112.250.26:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+
+  jpa:
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    show-sql: true

+ 1 - 1
huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev1.yml

@@ -7,7 +7,7 @@ spring:
   #------DataSource-----
   datasource:
 #    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 6 - 2
huimv-ql-farm/huimv-ql-environment/src/main/resources/application.properties

@@ -1,2 +1,6 @@
-spring.profiles.active=dev1
-
+#spring.profiles.active=ycg
+#spring.profiles.active=wuyi
+spring.profiles.active=haiyan
+#spring.profiles.active=wjj
+minTemp=10.0
+maxTemp=30.0

Diferenças do arquivo suprimidas por serem muito extensas
+ 200 - 0
huimv-ql-farm/huimv-ql-gateway/hs_err_pid33264.log


+ 14 - 0
huimv-ql-farm/huimv-ql-gateway/pom.xml

@@ -27,6 +27,20 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-gateway</artifactId>
         </dependency>
+
+<!--       限流-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
+            <!--如果父项目中限定了版本的话,这里不需要再具体制定-->
+            <version>2.1.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
+            <version>2.2.1.RELEASE</version>
+        </dependency>
+
     </dependencies>
 
     <dependencyManagement>

+ 12 - 0
huimv-ql-farm/huimv-ql-gateway/src/main/java/com/farm/gateway/GatewayApplication.java

@@ -3,6 +3,10 @@ package com.farm.gateway;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
 
 //@EnableDiscoveryClient
 @SpringBootApplication
@@ -27,4 +31,12 @@ public class GatewayApplication {
 //        return new TokenFilter();
 //    }
 
+    //注入bean
+    @Bean
+    public KeyResolver ipKeyResolver() {
+        return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getHostName());
+    }
+
+
+
 }

+ 45 - 0
huimv-ql-farm/huimv-ql-gateway/src/main/resources/application-haiyan.yml

@@ -0,0 +1,45 @@
+server:
+  port: 8011
+
+spring:
+  application:
+    name: gateway
+  cloud:
+    gateway:
+      enabled: true
+      routes:
+        - id: environment_route
+          uri: http://47.98.40.154:8090
+          predicates:
+            - Path=/production/**
+          filters:
+            - StripPrefix=1
+        - id: video_route
+          uri: http://47.98.40.154:8101
+          predicates:
+            - Path=/video/**
+          filters:
+            - StripPrefix=1
+        - id: production_route
+          uri: http://47.98.40.154:8086
+          predicates:
+            - Path=/environment/**
+          filters:
+            - StripPrefix=1
+        - id: security_route
+          uri: http://47.98.40.154:8095
+          predicates:
+            - Path=/security/**
+          filters:
+            - StripPrefix=1
+        - id: security_route
+          uri: http://47.98.40.154:8089
+          predicates:
+            - Path=/testreal/**
+          filters:
+            - StripPrefix=1
+logging:
+  level:
+    org.springframework.cloud.gateway: debug  # Gateway调试模式
+
+

+ 45 - 0
huimv-ql-farm/huimv-ql-gateway/src/main/resources/application-wjj.yml

@@ -0,0 +1,45 @@
+server:
+  port: 8010
+
+spring:
+  application:
+    name: gateway
+  cloud:
+    gateway:
+      enabled: true
+      routes:
+        - id: environment_route
+          uri: http://192.168.1.68:8090
+          predicates:
+            - Path=/production/**
+          filters:
+            - StripPrefix=1
+        - id: video_route
+          uri: http://192.168.1.68:8100
+          predicates:
+            - Path=/video/**
+          filters:
+            - StripPrefix=1
+        - id: production_route
+          uri: http://192.168.1.68:8085
+          predicates:
+            - Path=/environment/**
+          filters:
+            - StripPrefix=1
+        - id: security_route
+          uri: http://192.168.1.68:8095
+          predicates:
+            - Path=/security/**
+          filters:
+            - StripPrefix=1
+        - id: security_route
+          uri: http://192.168.1.68:8089
+          predicates:
+            - Path=/testreal/**
+          filters:
+            - StripPrefix=1
+logging:
+  level:
+    org.springframework.cloud.gateway: debug  # Gateway调试模式
+
+

+ 10 - 4
huimv-ql-farm/huimv-ql-gateway/src/main/resources/application.yml

@@ -9,29 +9,35 @@ spring:
       enabled: true
       routes:
         - id: environment_route
-          uri: http://192.168.1.53:8090
+          uri: http://127.0.0.1:8090
           predicates:
             - Path=/production/**
           filters:
             - StripPrefix=1
         - id: video_route
-          uri: http://192.168.1.53:8100
+          uri: http://127.0.0.1:8100
           predicates:
             - Path=/video/**
           filters:
             - StripPrefix=1
         - id: production_route
-          uri: http://192.168.1.53:8085
+          uri: http://127.0.0.1:8085
           predicates:
             - Path=/environment/**
           filters:
             - StripPrefix=1
         - id: security_route
-          uri: http://192.168.1.53:8095
+          uri: http://127.0.0.1:8095
           predicates:
             - Path=/security/**
           filters:
             - StripPrefix=1
+        - id: security_route
+          uri: http://127.0.0.1:8089
+          predicates:
+            - Path=/testreal/**
+          filters:
+            - StripPrefix=1
 logging:
   level:
     org.springframework.cloud.gateway: debug  # Gateway调试模式

+ 4 - 0
huimv-ql-farm/huimv-ql-gateway/src/main/resources/application.properties

@@ -0,0 +1,4 @@
+#spring.profiles.active=ycg
+#spring.profiles.active=wuyi
+spring.profiles.active=haiyan
+#spring.profiles.active=wjj

Diferenças do arquivo suprimidas por serem muito extensas
+ 200 - 0
huimv-ql-farm/huimv-ql-production/hs_err_pid5788.log


+ 0 - 1
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/MFattenAreaController.java

@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 @RestController
-
 @RequestMapping("/fattenArea")
 public class MFattenAreaController {
 

+ 0 - 2
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexParameterServiceImpl.java

@@ -76,8 +76,6 @@ public class IndexParameterServiceImpl implements IndexParameterService {
     @Override
     public Result findAll() {
         try {
-
-
             return new Result(10000, ResultStatus.findSuccess,parameterEntityRepository.findAll());
         }catch (Exception e){
             return new Result(10001, ResultStatus.findFailed,null);

+ 2 - 2
huimv-ql-farm/huimv-ql-production/src/main/resources/application-haiyan.yml

@@ -5,8 +5,8 @@ spring:
     name: production
 
   datasource:
-#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://122.112.250.26:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 19 - 0
huimv-ql-farm/huimv-ql-production/src/main/resources/application-wjj.yml

@@ -0,0 +1,19 @@
+server:
+  port: 8090
+spring:
+  application:
+    name: environment
+
+  #------DataSource-----
+  datasource:
+    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_wjj?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+
+  jpa:
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    show-sql: true

+ 2 - 2
huimv-ql-farm/huimv-ql-production/src/main/resources/application-wuyi.yml

@@ -5,8 +5,8 @@ spring:
     name: production
 
   datasource:
-#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 2 - 2
huimv-ql-farm/huimv-ql-production/src/main/resources/application-ycg.yml

@@ -5,8 +5,8 @@ spring:
     name: production
 
   datasource:
-#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai&failOverReadOnly=false&validationQuery=select 1&testOnBorrow=true
+    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 3 - 2
huimv-ql-farm/huimv-ql-production/src/main/resources/application.properties

@@ -1,3 +1,4 @@
-spring.profiles.active=ycg
+#spring.profiles.active=ycg
 #spring.profiles.active=wuyi
-#spring.profiles.active=haiyan
+spring.profiles.active=haiyan
+#spring.profiles.active=wjj

+ 2 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/HuimvSecurityApplication.java

@@ -1,3 +1,4 @@
+/*
 package com.huimv.security;
 
 import org.springframework.boot.SpringApplication;
@@ -13,3 +14,4 @@ public class HuimvSecurityApplication {
     }
 
 }
+*/

+ 32 - 0
huimv-ql-farm/huimv-ql-security/src/main/resources/application-haiyan.yml

@@ -0,0 +1,32 @@
+server:
+  port: 8095
+spring:
+  application:
+    name: environment
+
+  datasource:
+    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
+
+    #  redis:
+#    database: 0
+#    host: 119.3.84.55
+#    port: 6379
+#    password: hm123456
+#    jedis:
+#      pool:
+#        max-active: 20
+#        max-wait: -1
+#        max-idle: 10
+#        min-idle: 0
+#    timeout: 5000

+ 2 - 2
huimv-ql-farm/huimv-ql-security/src/main/resources/application-dev.yml

@@ -5,8 +5,8 @@ spring:
     name: environment
 
   datasource:
-#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 32 - 0
huimv-ql-farm/huimv-ql-security/src/main/resources/application-ycg.yml

@@ -0,0 +1,32 @@
+server:
+  port: 8095
+spring:
+  application:
+    name: environment
+
+  datasource:
+    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
+
+    #  redis:
+#    database: 0
+#    host: 119.3.84.55
+#    port: 6379
+#    password: hm123456
+#    jedis:
+#      pool:
+#        max-active: 20
+#        max-wait: -1
+#        max-idle: 10
+#        min-idle: 0
+#    timeout: 5000

+ 3 - 1
huimv-ql-farm/huimv-ql-security/src/main/resources/application.properties

@@ -1 +1,3 @@
-spring.profiles.active=dev
+#spring.profiles.active=ycg
+spring.profiles.active=wuyi
+#spring.profiles.active=haiyan

Diferenças do arquivo suprimidas por serem muito extensas
+ 200 - 0
huimv-ql-farm/huimv-ql-video/hs_err_pid14620.log


Diferenças do arquivo suprimidas por serem muito extensas
+ 200 - 0
huimv-ql-farm/huimv-ql-video/hs_err_pid27644.log


+ 4 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/HuimvVideoApplication.java

@@ -10,4 +10,8 @@ public class HuimvVideoApplication {
         SpringApplication.run(HuimvVideoApplication.class, args);
     }
 
+
+
+
+
 }

+ 1 - 1
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/MobileUser.java

@@ -11,7 +11,7 @@ import java.io.Serializable;
 public class MobileUser implements Serializable {
 
 	@Id
-	@GeneratedValue(strategy = GenerationType.IDENTITY)
+//	@GeneratedValue(strategy = GenerationType.IDENTITY)
 	@Column(name = "id")
 	private Integer id;
 

+ 1 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/result/ResultStatus.java

@@ -12,4 +12,5 @@ public  class ResultStatus {
 	public  final static String updateFailed = "修改失败";
 	public  final static String findSuccess = "查询成功";
 	public  final static String findFailed = "查询失败";
+
 }

+ 5 - 5
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/MobileUserServiceImpl.java

@@ -22,7 +22,7 @@ public class MobileUserServiceImpl implements MobileUserService {
 		if (entity == null){
 			return new Result(10002, ResultStatus.addNull);
 		}
-		try {
+//		try {
 			String password = entity.getPassword();
 			String account = entity.getAccount();
 
@@ -32,13 +32,13 @@ public class MobileUserServiceImpl implements MobileUserService {
 					return new Result(10001,"注册失败,该账号已存在");
 				}
 			}
-
 			entity.setPassword(DigestUtils.md5DigestAsHex(password.getBytes()));
+
 			rep.save(entity);
 			return new Result(10000,"注册成功,即将跳转到登录页面");
-		}catch (Exception e){
-			return new Result(10001,"注册失败");
-		}
+//		}catch (Exception e){
+//			return new Result(10001,"注册失败");
+//		}
 	}
 
 	@Override

+ 32 - 0
huimv-ql-farm/huimv-ql-video/src/main/resources/application-haiyan.yml

@@ -0,0 +1,32 @@
+server:
+  port: 8101
+spring:
+  application:
+    name: video
+
+  datasource:
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://122.112.250.26:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
+
+    #  redis:
+#    database: 0
+#    host: 119.3.84.55
+#    port: 6379
+#    password: hm123456
+#    jedis:
+#      pool:
+#        max-active: 20
+#        max-wait: -1
+#        max-idle: 10
+#        min-idle: 0
+#    timeout: 5000

+ 19 - 0
huimv-ql-farm/huimv-ql-video/src/main/resources/application-wjj.yml

@@ -0,0 +1,19 @@
+server:
+  port: 8100
+spring:
+  application:
+    name: video
+
+  #------DataSource-----
+  datasource:
+    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_wjj?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+
+  jpa:
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    show-sql: true

+ 32 - 0
huimv-ql-farm/huimv-ql-video/src/main/resources/application-wuyi.yml

@@ -0,0 +1,32 @@
+server:
+  port: 8100
+spring:
+  application:
+    name: video
+
+  datasource:
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://122.112.250.26:3306/huimv_ql_farm_wuyi?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
+
+    #  redis:
+#    database: 0
+#    host: 119.3.84.55
+#    port: 6379
+#    password: hm123456
+#    jedis:
+#      pool:
+#        max-active: 20
+#        max-wait: -1
+#        max-idle: 10
+#        min-idle: 0
+#    timeout: 5000

+ 2 - 2
huimv-ql-farm/huimv-ql-video/src/main/resources/application-dev.yml

@@ -2,11 +2,11 @@ server:
   port: 8100
 spring:
   application:
-    name: environment
+    name: video
 
   datasource:
 #    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 4 - 1
huimv-ql-farm/huimv-ql-video/src/main/resources/application.properties

@@ -1 +1,4 @@
-spring.profiles.active=dev
+#spring.profiles.active=ycg
+#spring.profiles.active=wuyi
+spring.profiles.active=haiyan
+#spring.profiles.active=wjj