UI-Project/src/router/index.js
@@ -1,8 +1,7 @@ import { createRouter, createWebHistory } from 'vue-router' import HomeView from '../views/HomeView.vue' import {createRouter, createWebHashHistory} from 'vue-router' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), history: createWebHashHistory(), routes: [ { path: '/', hangzhoumesParent/common/springsecurity/src/main/java/com/mes/common/filter/JwtAuthenticationTokenFilter.java
@@ -50,7 +50,7 @@ //解析token String userid; try { Claims claims = JwtUtil.parseJWT(token); Claims claims = JwtUtil.getClaimByToken(token); userid = claims.getSubject(); } catch (Exception e) { e.printStackTrace(); hangzhoumesParent/common/springsecurity/src/main/java/com/mes/common/utils/JwtUtil.java
@@ -2,119 +2,54 @@ import io.jsonwebtoken.Claims; import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import lombok.Data; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import java.util.Base64; import java.util.Date; import java.util.UUID; /** * @Author : zhoush * @Date: 2024/4/9 19:15 * @Description: */ @Data public class JwtUtil { //有效期为 public static final Long JWT_TTL = 60 * 60 * 1000L;// 60 * 60 *1000 一个小时 //设置秘钥明文 public static final String JWT_KEY = "sangeng"; private static final long expire = 60 * 60 * 1000L; private static final String secret = "beibo"; private static final String header = "Authorization"; public static String getUUID() { String token = UUID.randomUUID().toString().replaceAll("-", ""); return token; } // 生成jwt public static String generateToken(String username) { /** * 生成jtw * * @param subject token中要存放的数据(json格式) * @return */ public static String createJWT(String subject) { JwtBuilder builder = getJwtBuilder(subject, null, getUUID());// 设置过期时间 return builder.compact(); } Date nowDate = new Date(); Date expireDate = new Date(nowDate.getTime() + 1000 * expire); /** * 生成jtw * * @param subject token中要存放的数据(json格式) * @param ttlMillis token超时时间 * @return */ public static String createJWT(String subject, Long ttlMillis) { JwtBuilder builder = getJwtBuilder(subject, ttlMillis, getUUID());// 设置过期时间 return builder.compact(); } private static JwtBuilder getJwtBuilder(String subject, Long ttlMillis, String uuid) { SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; SecretKey secretKey = generalKey(); long nowMillis = System.currentTimeMillis(); Date now = new Date(nowMillis); if (ttlMillis == null) { ttlMillis = JwtUtil.JWT_TTL; } long expMillis = nowMillis + ttlMillis; Date expDate = new Date(expMillis); return Jwts.builder() .setId(uuid) //唯一的ID .setSubject(subject) // 主题 可以是JSON数据 .setIssuer("sg") // 签发者 .setIssuedAt(now) // 签发时间 .signWith(signatureAlgorithm, secretKey) //使用HS256对称加密算法签名, 第二个参数为秘钥 .setExpiration(expDate); .setHeaderParam("typ", "JWT") .setSubject(username) .setIssuedAt(nowDate) .setExpiration(expireDate)// 7天過期 .signWith(SignatureAlgorithm.HS512, secret) .compact(); } /** * 创建token * * @param id * @param subject * @param ttlMillis * @return */ public static String createJWT(String id, String subject, Long ttlMillis) { JwtBuilder builder = getJwtBuilder(subject, ttlMillis, id);// 设置过期时间 return builder.compact(); // 解析jwt public static Claims getClaimByToken(String jwt) { try { return Jwts.parser() .setSigningKey(secret) .parseClaimsJws(jwt) .getBody(); } catch (Exception e) { return null; } } public static void main(String[] args) throws Exception { String token = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJjYWM2ZDVhZi1mNjVlLTQ0MDAtYjcxMi0zYWEwOGIyOTIwYjQiLCJzdWIiOiJzZyIsImlzcyI6InNnIiwiaWF0IjoxNjM4MTA2NzEyLCJleHAiOjE2MzgxMTAzMTJ9.JVsSbkP94wuczb4QryQbAke3ysBDIL5ou8fWsbt_ebg"; Claims claims = parseJWT(token); System.out.println(claims); // jwt是否过期 public boolean isTokenExpired(Claims claims) { return claims.getExpiration().before(new Date()); } /** * 生成加密后的秘钥 secretKey * * @return */ public static SecretKey generalKey() { byte[] encodedKey = Base64.getDecoder().decode(JwtUtil.JWT_KEY); SecretKey key = new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES"); return key; } /** * 解析 * * @param jwt * @return * @throws Exception */ public static Claims parseJWT(String jwt) throws Exception { SecretKey secretKey = generalKey(); return Jwts.parser() .setSigningKey(secretKey) .parseClaimsJws(jwt) .getBody(); } } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/service/impl/SysUserServiceImpl.java
@@ -54,7 +54,7 @@ //使用userid生成token LoginUser loginUser = (LoginUser) authenticate.getPrincipal(); String userId = loginUser.getUser().getId().toString(); String jwt = JwtUtil.createJWT(userId); String jwt = JwtUtil.generateToken(userId); //authenticate存入redis redisUtil.setCacheObject("login:" + userId, loginUser); //把token响应给前端 hangzhoumesParent/common/springsecurity/src/main/resources/application-dev.yml
New file @@ -0,0 +1,15 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false username: root password: beibo.123/ cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/common/springsecurity/src/main/resources/application-loc.yml
New file @@ -0,0 +1,15 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false username: root password: root cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/common/springsecurity/src/main/resources/application-prod.yml
New file @@ -0,0 +1,15 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false username: root password: beibo.123/ cloud: nacos: discovery: server-addr: 10.153.19.150:8848 redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 hangzhoumesParent/common/springsecurity/src/main/resources/application.yml
@@ -1,24 +1,10 @@ server: port: 8089 spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false username: root password: beibo.123/ cloud: nacos: discovery: server-addr: 10.153.19.150:8848 profiles: active: dev application: name: security redis: database: 0 host: 10.153.19.150 port: 6379 password: session: store-type: redis mybatis-plus: mapper-locations: classpath*:mapper/*.xml configuration: hangzhoumesParent/gateway/src/main/resources/application-dev.yml
New file @@ -0,0 +1,5 @@ spring: cloud: nacos: discovery: server-addr: 127.0.0.1:8848 hangzhoumesParent/gateway/src/main/resources/application-prod.yml
New file @@ -0,0 +1,5 @@ spring: cloud: nacos: discovery: server-addr: 10.153.19.150:8848 hangzhoumesParent/gateway/src/main/resources/application.yml
@@ -1,12 +1,10 @@ server: port: 88 spring: profiles: active: prod application: name: gateway cloud: nacos: discovery: server-addr: 10.153.19.150:8848 gateway: discovery: locator: hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application-dev.yml
New file @@ -0,0 +1,27 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://127.0.0.1:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 application: name: cacheGlass redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application-loc.yml
New file @@ -0,0 +1,27 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://192.168.56.10:3306/pp?serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 application: name: cacheGlass redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application-prod.yml
New file @@ -0,0 +1,27 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 application: name: cacheGlass redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
@@ -1,44 +1,10 @@ server: port: 8081 spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver # pp: # url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 # username: root # password: beibo.123/ # driver-class-name: com.mysql.cj.jdbc.Driver # salve_hangzhoumes: # url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes # username: sa # password: beibo.123/ # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 profiles: active: prod application: name: cacheGlass redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 session: store-type: redis mybatis-plus: mapper-locations: classpath*:mapper/*.xml configuration: hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml
@@ -12,12 +12,6 @@ <artifactId>cacheVerticalGlass</artifactId> <dependencies> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.1.6</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-dev.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://127.0.0.1:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-loc.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://127.0.0.1:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-prod.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
@@ -2,32 +2,10 @@ port: 8082 spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 profiles: active: prod application: name: cacheVerticalGlass redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 mybatis-plus: mapper-locations: classpath*:mapper/*.xml configuration: hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://127.0.0.1:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-loc.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://192.168.56.10:3306/pp?serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-prod.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
@@ -1,33 +1,10 @@ server: port: 8083 spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 profiles: active: prod application: name: loadGlass redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 mybatis-plus: mapper-locations: classpath*:mapper/*.xml configuration: hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application-dev.yml
New file @@ -0,0 +1,22 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 application: name: temperingGlass redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application-loc.yml
New file @@ -0,0 +1,22 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 application: name: temperingGlass redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application-prod.yml
New file @@ -0,0 +1,20 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml
@@ -1,27 +1,10 @@ server: port: 8084 spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 profiles: active: prod application: name: temperingGlass redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 mybatis-plus: mapper-locations: classpath*:mapper/*.xml configuration: hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -1,5 +1,6 @@ package com.mes.downstorage.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.query.MPJQueryWrapper; import com.mes.common.PLCAutoMes; import com.mes.common.S7control; @@ -7,15 +8,12 @@ import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downglassinfo.service.DownGlassTaskService; import com.mes.downstorage.entity.DownStorageCage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; import com.mes.downstorage.mapper.DownStorageCageMapper; import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.downstorage.service.DownStorageCageService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; import com.mes.tools.WebSocketServer; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -56,14 +54,15 @@ @Override public List<DownStorageCageDetails> getCacheLeisure() { log.info(" 查询笼子内空闲"); List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNull("escd.slot") .orderByAsc("escd.slot") ); return list; // List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .isNull("escd.slot") // .orderByAsc("escd.slot") // ); // return list; return null; } @@ -86,17 +85,18 @@ @Override public List<DownStorageCageDetails> getCacheOut(int start, int end) { log.info("根据传入的工位查询符合按照顺序和大小出片的小片"); return downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id") .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id and gi.flowcard_id=escd.flow_card_id ") .isNotNull("escd.slot") .between("dw.workstation_id", start, end) .orderByDesc("escd.width") .orderByDesc("escd.height") ); // return downStorageCageMapper.selectJoinList( // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id") // .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id and gi.flowcard_id=escd.flow_card_id ") // .isNotNull("escd.slot") // .between("dw.workstation_id", start, end) // .orderByDesc("escd.width") // .orderByDesc("escd.height") // ); return null; } @@ -106,12 +106,13 @@ @Override public List<Map> getCacheInfo() { log.info(" 查询笼子内信息"); return downStorageCageMapper.selectJoinList( Map.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .orderByAsc("t.slot") ); // return downStorageCageMapper.selectJoinList( // Map.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .orderByAsc("t.slot") // ); return null; } @@ -120,17 +121,18 @@ @Override public List<DownStorageCageDetails> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width) { log.info(" 查询可进此片玻璃的栅格号 找到相同版图id并且大于前面的顺序的空格"); List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .eq("escd.tempering_layout_id", tempering_layout_id) .lt("escd.tempering_feed_sequence", tempering_feed_sequence) .gt("t.remain_width", width) .orderByAsc("escd.tempering_feed_sequence") ); return list; // List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .isNotNull("escd.slot") // .eq("escd.tempering_layout_id", tempering_layout_id) // .lt("escd.tempering_feed_sequence", tempering_feed_sequence) // .gt("t.remain_width", width) // .orderByAsc("escd.tempering_feed_sequence") // ); // return list; return null; } @@ -142,34 +144,34 @@ @Override public List<DownStorageCageDetails> IsExistIntoCacheByflowcardid(String flowcardid, double width) { log.info(" 查询可进此片玻璃的栅格号"); return downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .lt("escd.flow_card_id", flowcardid) // 条件 t.remain_width - width > 0 .apply("t.remain_width - " + width + " > 0") .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence") ); // return downStorageCageMapper.selectJoinList( // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .isNotNull("escd.slot") // .lt("escd.flow_card_id", flowcardid) // // 条件 t.remain_width - width > 0 // .apply("t.remain_width - " + width + " > 0") // .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence") // ); return null; } @Override public List<DownStorageCageDetails> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width) { log.info(" 查询可进此片玻璃的栅格号"); return downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .lt("escd.tempering_layout_id", tempering_layout_id) // 条件 t.remain_width - width > 0 .apply("t.remain_width - " + width + " > 0") .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence") ); // return downStorageCageMapper.selectJoinList( // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .isNotNull("escd.slot") // .lt("escd.tempering_layout_id", tempering_layout_id) // // 条件 t.remain_width - width > 0 // .apply("t.remain_width - " + width + " > 0") // .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence") // ); return null; } @@ -182,15 +184,16 @@ public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { log.info(" 单片情况 查询可进此片玻璃的栅格号 找到相同流程卡号的空格"); return downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .eq("escd.flow_card_id", flowcardid) .gt("t.remain_width", width) .orderByAsc("escd.sequence") ); // return downStorageCageMapper.selectJoinList( // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .isNotNull("escd.slot") // .eq("escd.flow_card_id", flowcardid) // .gt("t.remain_width", width) // .orderByAsc("escd.sequence") // ); return null; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/DownWorkstationTask.java
@@ -5,9 +5,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.data.annotation.Id; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; //import javax.persistence.Id; import java.io.Serializable; @@ -25,15 +22,8 @@ private static final long serialVersionUID = 1L; /** * id */ @TableId(value = "id", type = IdType.AUTO) @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @TableId(value = "id", type = IdType.AUTO) private Long id; /** hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; @Slf4j @Service public class DownWorkstationServiceImpl extends ServiceImpl<DownWorkstationMapper, DownWorkstation> implements DownWorkstationService { @@ -44,7 +45,7 @@ @Autowired private DownWorkstationTaskService downWorkstationTaskService; // @Override // @Override // public List<DownWorkstation> gettwoDownWorkstations() { // return downWorkstationMapper.getDownWorkstationsInRange(6,10); // } @@ -58,7 +59,8 @@ DownWorkstation result = baseMapper.selectOne(queryWrapper); return result != null ? result.getTotalquantity() : 0; } //工位显示 //工位显示 @Override public List<Map<String, Object>> getTotalGlassDimensionsByWorkstation() { MPJQueryWrapper<DownWorkstionAndDownGlassinfo> queryWrapper = new MPJQueryWrapper<>(); @@ -66,16 +68,16 @@ .leftJoin("down_glass_info b on t.flow_card_id = b.flow_card_id") .groupBy("t.workstation_id", "t.flow_card_id"); List<DownWorkstionAndDownGlassinfo> workstationList = downWorkstationMapper.selectJoinList(DownWorkstionAndDownGlassinfo.class, queryWrapper); // List<DownWorkstionAndDownGlassinfo> workstationList = downWorkstationMapper.selectJoinList(DownWorkstionAndDownGlassinfo.class, queryWrapper); List<DownWorkstionAndDownGlassinfo> workstationList = null; List<Map<String, Object>> result = new ArrayList<>(); for (DownWorkstionAndDownGlassinfo downWorkstionAndDownGlassinfo : workstationList) { Map<String, Object> rack = new HashMap<>(); // 创建子项(item)对象 Map<String, Object> item = new HashMap<>(); item.put("height", downWorkstionAndDownGlassinfo.getTotalheight()); // 设置子项高度,根据实际情况设置 item.put("width", downWorkstionAndDownGlassinfo.getTotalwidth()); // 设置子项宽度,根据实际情况设置 item.put("height", downWorkstionAndDownGlassinfo.getTotalheight()); // 设置子项高度,根据实际情况设置 item.put("width", downWorkstionAndDownGlassinfo.getTotalwidth()); // 设置子项宽度,根据实际情况设置 item.put("fillColor", "yellow"); // 设置子项颜色 item.put("content", downWorkstionAndDownGlassinfo.getFlowCardId()); // 使用流程卡号作为子项内容 @@ -89,14 +91,13 @@ } // @Override // public int getTotalQuantity(int workstationId) { // Integer totalQuantity = downWorkstationMapper.getTotalQuantity(workstationId); // return totalQuantity != null ? totalQuantity : 0; // } // @Override // @Override // public int getRacksNumber(int workstationId) { // Integer racksNumber = downWorkstationMapper.getRacksNumber(workstationId); // return racksNumber != null ? racksNumber : 0; @@ -111,7 +112,8 @@ DownWorkstation result = baseMapper.selectOne(queryWrapper); return result != null ? result.getRacksnumber() : 0; } //根据条件获取工位玻璃信息 //根据条件获取工位玻璃信息 @Override public List<DownWorkstation> getoneDownWorkstations(int startId, int endId) { QueryWrapper<DownWorkstation> queryWrapper = new QueryWrapper<>(); @@ -127,10 +129,9 @@ @Override public void updateracksnumber(String flowCardId, int racksNumber) { UpdateWrapper<DownWorkstation> updateWrapper = new UpdateWrapper<>(); updateWrapper.set("racks_number",racksNumber).eq("flow_card_id", flowCardId); updateWrapper.set("racks_number", racksNumber).eq("flow_card_id", flowCardId); baseMapper.update(null, updateWrapper); } @Override @@ -155,19 +156,12 @@ } public DownWorkstation selectByFlowCardId(String flowcardid) { QueryWrapper<DownWorkstation> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("flow_card_id", flowcardid); return baseMapper.selectOne(queryWrapper); } @Transactional @@ -181,13 +175,8 @@ } @Override public void insertdownglassinfo() { List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState(); @@ -231,8 +220,6 @@ } try { //查询下片工位表中架子是否绑定了流程卡号 工位表和任务表中状态为1的流程卡号和已落架数量 List<DownWorkstationTask> taskdownWorkstation = downWorkstationTaskService.getTaskState(); @@ -241,7 +228,7 @@ for (DownWorkstationTask downWorkstation : taskdownWorkstation) { //更新下片工位表中已落架数量 DownWorkstation downWorkstation1 = selectByFlowCardId(downWorkstation.getFlowCardId()); updateracksnumber(downWorkstation.getFlowCardId(),downWorkstation1.getRacksnumber() + 1); updateracksnumber(downWorkstation.getFlowCardId(), downWorkstation1.getRacksnumber() + 1); //更新机械任务表中状态为0 downWorkstationTaskService.updateTaskStateToZero(downWorkstation.getId()); //删除机械任务表 @@ -256,11 +243,6 @@ // 或者可以进行其他异常处理,比如记录日志或者返回特定的错误信息 } } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application-dev.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://127.0.0.1:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application-loc.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://192.168.56.10:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 127.0.0.1:8848 redis: database: 0 host: 127.0.0.1 port: 6379 password: 123456 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application-prod.yml
New file @@ -0,0 +1,25 @@ spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
@@ -2,32 +2,10 @@ port: 8085 spring: datasource: dynamic: primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes username: sa password: beibo.123/ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 profiles: active: prod application: name: unLoadGlass redis: database: 0 host: 10.153.19.150 port: 6379 password: 123456 mybatis-plus: mapper-locations: classpath*:mapper/*.xml configuration: