UI-Project/config.js
@@ -1,5 +1,5 @@ export default { serverUrl: "10.153.19.150:88/api", serverUrl: "127.0.0.1:88/api", //serverUrl: "localhost:88/api/", serverUrl2: "10.153.19.150:88" //serverUrl:"res.abeim.cn" UI-Project/vite.config.js
@@ -22,7 +22,7 @@ https: false, proxy: { '/api': { target: 'http://10.153.19.150:88/', target: 'http://127.0.0.1:88/', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '/'), }, hangzhoumesParent/common/pom.xml
@@ -48,6 +48,12 @@ </dependency> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join-boot-starter</artifactId> <version>1.4.8</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <version>3.3.1</version> @@ -170,12 +176,6 @@ <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.33</version> </dependency> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.2.4</version> </dependency> </dependencies> hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Swagger2Config.java
@@ -49,43 +49,10 @@ .globalOperationParameters(pars); } @Bean public Docket adminApiConfig() { List<Parameter> pars = new ArrayList<>(); ParameterBuilder tokenPar = new ParameterBuilder(); tokenPar.name("adminId") .description("用户token") .defaultValue("1") .modelRef(new ModelRef("string")) .parameterType("header") .required(false) .build(); pars.add(tokenPar.build()); return new Docket(DocumentationType.SWAGGER_2) .groupName("adminApi") .apiInfo(adminApiInfo()) .select() //只显示admin路径下的页面 .apis(RequestHandlerSelectors.basePackage("com.mes")) .paths(PathSelectors.any()) .build() .globalOperationParameters(pars); } private ApiInfo webApiInfo() { return new ApiInfoBuilder() .title("网站-API文档") .description("本文档描述了mes网站微服务接口定义") .version("1.0") .contact(new Contact("zhan_py", "", "")) .build(); } private ApiInfo adminApiInfo() { return new ApiInfoBuilder() .title("后台管理系统-API文档") .description("本文档描述了mes后台系统服务接口定义") .version("1.0") .contact(new Contact("zhan_py", "", "")) .build(); hangzhoumesParent/common/springsecurity/src/main/java/com/mes/common/config/TokenWebSecurityConfig.java
@@ -8,17 +8,27 @@ import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; @Configuration //@EnableWebSecurity @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class TokenWebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; @Autowired private AuthenticationEntryPoint authenticationEntryPoint; @Autowired private AccessDeniedHandler accessDeniedHandler; @Bean public PasswordEncoder passwordEncoder() { @@ -39,10 +49,16 @@ .authorizeRequests() // 对于登录接口 允许匿名访问 .antMatchers("/userinfo/login").anonymous() .antMatchers("/hello").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().permitAll(); // http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); .anyRequest().authenticated(); http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); //配置异常处理器 http.exceptionHandling() .authenticationEntryPoint(authenticationEntryPoint) .accessDeniedHandler(accessDeniedHandler); //允许跨域 http.cors(); } @Bean hangzhoumesParent/common/springsecurity/src/main/java/com/mes/config/TokenWebSecurityConfig.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/entity/SecurityUser.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/entity/User.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/filter/TokenAuthFilter.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/filter/TokenLoginFilter.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/security/DefaultPasswordEncoder.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/security/TokenLogoutHandler.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/security/TokenManager.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/security/UnauthEntryPoint.java
File was deleted hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/controller/SysUserController.java
@@ -2,10 +2,20 @@ import com.mes.userinfo.entity.SysUser; import com.mes.userinfo.entity.request.UserRequest; import com.mes.userinfo.entity.vo.SysUserVO; import com.mes.userinfo.service.SysUserService; import com.mes.utils.Result; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; /** * <p> @@ -15,6 +25,7 @@ * @author zhoush * @since 2024-04-11 */ @ApiModel("用户信息") @RestController @RequestMapping("/userinfo") public class SysUserController { @@ -22,14 +33,42 @@ @Autowired private SysUserService sysUserService; @ApiOperation("用户登录") @PostMapping("/login") public Result login(@RequestBody SysUser user) { return sysUserService.login(user); public Result<Map<String, String>> login(@RequestBody SysUser user) { return Result.success(sysUserService.login(user)); } @GetMapping("/hello") public Result hello() { return Result.success("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJlZjMyMjQ4NDcyODE0ZWFlYWRlOTBkYmZjYWFlZmNmZSIsInN1YiI6IjEiLCJpc3MiOiJzZyIsImlhdCI6MTcxMjkwMjI0NCwiZXhwIjoxNzEyOTA1ODQ0fQ.DlJkhkiwjZSqprdLzKaTB3yuyxGukerKeF0FbJK_6HY"); @ApiOperation("退出登录") @PostMapping("/logout") public Result<String> logout() { return Result.success(sysUserService.logout()); } @ApiOperation("新增用户信息") @PostMapping("/saveUser") public Result<SysUserVO> saveUser(@RequestBody SysUserVO sysUser) { return Result.success(sysUserService.saveUser(sysUser)); } @ApiOperation("获取用户列表") @PostMapping("/listByUserName") public Result<List<SysUserVO>> listByUserName(@RequestBody UserRequest request) { return Result.success(sysUserService.listByUserName(request)); } @ApiOperation("更新用户信息") @PostMapping("/updateUser") public Result<SysUserVO> updateUser(@RequestBody SysUserVO sysUser) { return Result.success(sysUserService.updateUser(sysUser)); } @ApiOperation("删除用户信息") @PostMapping("/deleteUser") public Result<String> deleteUser(@RequestBody SysUserVO sysUser) { return Result.success(sysUserService.deleteUser(sysUser)); } } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/entity/LoginUser.java
@@ -28,7 +28,7 @@ /** * 存储SpringSecurity调用getAuthorities()方法获取的权限信息的集合 */ @JSONField(serialize = false) // @JSONField(serialize = false) private List<GrantedAuthority> authorities; hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/entity/request/UserRequest.java
New file @@ -0,0 +1,17 @@ package com.mes.userinfo.entity.request; import cn.hutool.db.Page; import lombok.Data; /** * @Author : zhoush * @Date: 2024/4/22 11:21 * @Description: */ @Data public class UserRequest { private String userName; private Page page; } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/entity/vo/SysUserVO.java
New file @@ -0,0 +1,63 @@ package com.mes.userinfo.entity.vo; import com.mes.role.entity.SysRole; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.util.List; /** * <p> * 用户表 * </p> * * @author zhoush * @since 2024-04-11 */ @ApiModel(description = "<p> 用户信息 </p>") @Data public class SysUserVO implements Serializable { @ApiModelProperty(hidden = true) private static final long serialVersionUID = 1L; /** * 主键 */ @ApiModelProperty(value = "主键", position = 2) private Long id; /** * 用户名 */ @ApiModelProperty(value = "用户名", position = 3) private String userName; /** * 昵称 */ @ApiModelProperty(value = "昵称", position = 4) private String nickName; /** * 密码 */ @ApiModelProperty(value = "密码", position = 5) private String password; /** * 头像 */ @ApiModelProperty(value = "头像", position = 6) private String avatar; /** * 用户的角色信息 */ @ApiModelProperty(value = "用户的角色信息", position = 7) private List<SysRole> roleList; } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/mapper/SysUserMapper.java
@@ -1,6 +1,6 @@ package com.mes.userinfo.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.yulichang.base.MPJBaseMapper; import com.mes.userinfo.entity.SysUser; import org.apache.ibatis.annotations.Mapper; @@ -13,6 +13,6 @@ * @since 2024-04-11 */ @Mapper public interface SysUserMapper extends BaseMapper<SysUser> { public interface SysUserMapper extends MPJBaseMapper<SysUser> { } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/service/SysUserService.java
@@ -2,7 +2,11 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.mes.userinfo.entity.SysUser; import com.mes.utils.Result; import com.mes.userinfo.entity.request.UserRequest; import com.mes.userinfo.entity.vo.SysUserVO; import java.util.List; import java.util.Map; /** * <p> @@ -14,7 +18,50 @@ */ public interface SysUserService extends IService<SysUser> { Result login(SysUser user); /** * 用户登录 * * @param user * @return */ Map<String, String> login(SysUser user); Result logout(); /** * 退出登录 * * @return */ String logout(); /** * 新增用户信息 * * @param user * @return */ SysUserVO saveUser(SysUserVO user); /** * 按名称获取用户信息 * * @param sysUser * @return */ SysUserVO updateUser(SysUserVO sysUser); /** * 按名称获取用户信息 * * @param request * @return */ List<SysUserVO> listByUserName(UserRequest request); /** * 删除用户信息 * * @param user * @return */ String deleteUser(SysUserVO user); } hangzhoumesParent/common/springsecurity/src/main/java/com/mes/userinfo/service/impl/SysUserServiceImpl.java
@@ -2,14 +2,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.mes.common.utils.JwtUtil; import com.mes.common.utils.RedisUtil; import com.mes.menu.mapper.SysMenuMapper; import com.mes.role.entity.SysRole; import com.mes.userinfo.entity.LoginUser; import com.mes.userinfo.entity.SysUser; import com.mes.userinfo.entity.SysUserRole; import com.mes.userinfo.entity.request.UserRequest; import com.mes.userinfo.entity.vo.SysUserVO; import com.mes.userinfo.mapper.SysUserMapper; import com.mes.userinfo.service.SysUserService; import com.mes.utils.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -19,10 +23,12 @@ import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; /** @@ -38,6 +44,7 @@ @Autowired private AuthenticationManager authenticationManager; @Autowired private RedisUtil redisUtil; @@ -45,7 +52,7 @@ private SysMenuMapper sysMenuMapper; @Override public Result login(SysUser user) { public Map<String, String> login(SysUser user) { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUserName(), user.getPassword()); Authentication authenticate = authenticationManager.authenticate(authenticationToken); if (Objects.isNull(authenticate)) { @@ -55,24 +62,60 @@ LoginUser loginUser = (LoginUser) authenticate.getPrincipal(); String userId = loginUser.getUser().getId().toString(); String jwt = JwtUtil.createJWT(userId); //查询权限信息 // List<String> perms = sysMenuMapper.selectPermsByUserId(userId); //authenticate存入redis redisUtil.setCacheObject("login:" + userId, loginUser); redisUtil.setCacheObject("login:" + userId, loginUser.getAuthorities()); //把token响应给前端 HashMap<String, String> map = new HashMap<>(); map.put("token", jwt); return Result.success(map); return map; } @Override public Result logout() { public String logout() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); Long userid = loginUser.getUser().getId(); redisUtil.deleteObject("login:" + userid); return Result.success("退出成功"); return "注销成功"; } @Override public SysUserVO saveUser(SysUserVO user) { return null; } @Override public SysUserVO updateUser(SysUserVO sysUser) { return null; } @Override public List<SysUserVO> listByUserName(UserRequest request) { MPJLambdaWrapper<SysUser> wrapper = new MPJLambdaWrapper<>(); wrapper.selectAll(SysUser.class) .selectCollection(SysRole.class, SysUserVO::getRoleList) .leftJoin(SysUserRole.class, SysUserRole::getUserId, SysUser::getId) .leftJoin(SysRole.class, SysRole::getId, SysUserRole::getRoleId) .like(StringUtils.hasText(request.getUserName()), SysUser::getUserName, request.getUserName()); return baseMapper.selectJoinList(SysUserVO.class, wrapper); } @Override public String deleteUser(SysUserVO user) { return null; } /** * 实现UserDetailsService接口,从数据库内获取用户及权限信息 * * @param username * @return * @throws UsernameNotFoundException */ @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { LambdaQueryWrapper<SysUser> lqw = new LambdaQueryWrapper<>(); lqw.eq(SysUser::getUserName, username); hangzhoumesParent/common/springsecurity/src/main/resources/application.yml
@@ -3,18 +3,18 @@ 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 url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false username: root password: beibo.123/ password: root cloud: nacos: discovery: server-addr: 10.153.19.150:8848 server-addr: 127.0.0.1:8848 application: name: security redis: database: 0 host: 10.153.19.150 host: 127.0.0.1 port: 6379 password: session: hangzhoumesParent/gateway/pom.xml
@@ -28,5 +28,13 @@ <artifactId>spring-cloud-starter-gateway</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> hangzhoumesParent/gateway/src/main/resources/application.yml
@@ -6,7 +6,7 @@ cloud: nacos: discovery: server-addr: 10.153.19.150:8848 server-addr: 127.0.0.1:8848 gateway: discovery: locator: hangzhoumesParent/moduleService/CacheGlassModule/pom.xml
@@ -17,11 +17,11 @@ <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.1.6</version> </dependency> <!-- <dependency>--> <!-- <groupId>com.github.yulichang</groupId>--> <!-- <artifactId>mybatis-plus-join</artifactId>--> <!-- <version>1.1.6</version>--> <!-- </dependency>--> <!-- <dependency>--> <!-- <groupId>com.github.yulichang</groupId>--> <!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>--> hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
@@ -7,34 +7,34 @@ strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ password: root driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 url: jdbc:mysql://192.168.56.10:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ password: root driver-class-name: com.mysql.cj.jdbc.Driver # pp: # url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 # url: jdbc:mysql://192.168.56.10:3306/pp?serverTimezone=GMT%2b8 # username: root # password: beibo.123/ # password: root # 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/ # password: root # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 server-addr: 127.0.0.1:8848 application: name: cacheGlass redis: database: 0 host: 10.153.19.150 host: 127.0.0.1 port: 6379 password: 123456 session: hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml
@@ -13,11 +13,11 @@ <artifactId>cacheVerticalGlass</artifactId> <dependencies> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.1.6</version> </dependency> <!-- <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.yml
@@ -8,9 +8,9 @@ strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ password: root driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes @@ -20,12 +20,12 @@ cloud: nacos: discovery: server-addr: 10.153.19.150:8848 server-addr: 127.0.0.1:8848 application: name: cacheVerticalGlass redis: database: 0 host: 10.153.19.150 host: 127.0.0.1 port: 6379 password: 123456 mybatis-plus: hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application.yml
@@ -8,24 +8,24 @@ strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ password: root driver-class-name: com.mysql.cj.jdbc.Driver pp: url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 url: jdbc:mysql://192.168.56.10:3306/pp?serverTimezone=GMT%2b8 username: root password: beibo.123/ password: root driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 server-addr: 127.0.0.1:8848 application: name: loadGlass redis: database: 0 host: 10.153.19.150 host: 127.0.0.1 port: 6379 password: 123456 mybatis-plus: hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/application.yml
@@ -7,19 +7,19 @@ strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ password: root driver-class-name: com.mysql.cj.jdbc.Driver cloud: nacos: discovery: server-addr: 10.153.19.150:8848 server-addr: 127.0.0.1:8848 application: name: temperingGlass redis: database: 0 host: 10.153.19.150 host: 127.0.0.1 port: 6379 password: 123456 mybatis-plus: hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
@@ -27,12 +27,6 @@ <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.2.4</version> </dependency> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> <version>4.0</version> hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -1,20 +1,17 @@ package com.mes.downstorage.service.impl; import com.github.yulichang.query.MPJQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mes.common.PLCAutoMes; import com.mes.common.S7control; import com.mes.device.PlcParameterObject; 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.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; @@ -33,8 +30,6 @@ @Slf4j @Service public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { @Autowired private DownStorageCageMapper downStorageCageMapper; @Autowired private GlassInfoService glassInfoService; @@ -44,7 +39,7 @@ private DownGlassTaskService downGlassTaskService; @Override public List<Map> gettask(){ downStorageCageMapper.selectList(null); baseMapper.selectList(null); // downStorageCageMapper.selectJoin(); return null; }; @@ -54,14 +49,17 @@ @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; // MPJLambdaWrapper<DownStorageCageDetails> wrapper = new MPJLambdaWrapper<>(); // wrapper.selectAll(DownStorageCageDetails.class) // List<DownStorageCageDetails> list = baseMapper.selectJoinList( // DownStorageCageDetails.class,Wrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .isNull("escd.slot") // .orderByAsc("escd.slot") // ); // return list; return null; } @@ -87,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 baseMapper.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; } @@ -107,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 baseMapper.selectJoinList( // Map.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .orderByAsc("t.slot") // ); return null; } @@ -121,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 = baseMapper.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; } @@ -143,34 +144,35 @@ @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 baseMapper.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") ); // log.info(" 查询可进此片玻璃的栅格号"); // return baseMapper.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; } @@ -183,15 +185,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 baseMapper.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/resources/application.yml
@@ -8,9 +8,9 @@ strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. datasource: hangzhoumes: url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 url: jdbc:mysql://192.168.56.10:3306/hangzhoumes?serverTimezone=GMT%2b8 username: root password: beibo.123/ password: root driver-class-name: com.mysql.cj.jdbc.Driver salve_hangzhoumes: url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes @@ -20,12 +20,12 @@ cloud: nacos: discovery: server-addr: 10.153.19.150:8848 server-addr: 127.0.0.1:8848 application: name: unLoadGlass redis: database: 0 host: 10.153.19.150 host: 127.0.0.1 port: 6379 password: 123456 mybatis-plus: hangzhoumesParent/moduleService/UnLoadGlassModule/src/test/java/com/mes/UnLoadGlassApplicationTest.java
New file @@ -0,0 +1,42 @@ package com.mes; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downglassinfo.mapper.DownGlassTaskMapper; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.Arrays; /** * @Author : zhoush * @Date: 2024/3/27 16:37 * @Description: */ @Slf4j @RunWith(SpringRunner.class) @SpringBootTest(classes = UnLoadGlassApplication.class) public class UnLoadGlassApplicationTest { @Autowired DownGlassTaskMapper downGlassTaskMapper; @Test public void testFindPath() { log.info("完整路径:{}", Arrays.asList("123")); } @Test public void testCacheGlass() { DownGlassTask glassTask = new DownGlassTask(); glassTask.setId(1L); glassTask.setTaskType("1"); glassTask.setHeight(100.01); glassTask.setWidth(200.02); int i = downGlassTaskMapper.insert(glassTask); log.info("插入结果:{}", i); } } hangzhoumesParent/moduleService/pom.xml
@@ -56,11 +56,11 @@ </dependency> <!--开发者工具--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <!-- <dependency>--> <!-- <groupId>org.springframework.boot</groupId>--> <!-- <artifactId>spring-boot-devtools</artifactId>--> <!-- <optional>true</optional>--> <!-- </dependency>--> <dependency> <groupId>org.springframework.boot</groupId>