ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
@@ -1,10 +1,5 @@ package com.ruoyi.auth.service; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.feignClient.ShopClient; import com.ruoyi.system.api.RemoteUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.SecurityConstants; @@ -17,8 +12,10 @@ import com.ruoyi.common.core.utils.ip.IpUtils; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.RemoteUserService; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.model.LoginUser; import org.springframework.stereotype.Component; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -41,8 +38,7 @@ @Resource private RedisService redisService; @Resource private ShopClient shopClient; /** * 登录 */ @@ -95,32 +91,23 @@ recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户已停用,请联系管理员"); throw new ServiceException("您所属门店已被冻结,请联系平台"); } if (user.getRoleType()==2){ Shop data = shopClient.getShopById(user.getObjectId()).getData(); if (data==null){ throw new ServiceException("门店不存在"); }else{ if (data.getStatus()==2){ throw new ServiceException("您所属门店已被冻结,请联系平台"); } } } passwordService.validate(user, password, request); recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功"); return userInfo; } public LoginUser loginShop(String username, String password, HttpServletRequest request) { username = username.trim(); // 查询用户信息 R<LoginUser> userResult = remoteUserService.infoShop(username, SecurityConstants.INNER); if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) { recordLogService.recordLogininfor(request, null, username, Constants.LOGIN_FAIL_STATUS, "登录用户不存在"); throw new ServiceException("登录用户:" + username + " 不存在"); } LoginUser userInfo = userResult.getData(); SysUser user = userResult.getData().getSysUser(); // 用户名或密码为空 错误 if (StringUtils.isAnyBlank(username, password)) { recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户/密码必须填写"); @@ -144,12 +131,12 @@ recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "很遗憾,访问IP已被列入系统黑名单"); throw new ServiceException("很遗憾,访问IP已被列入系统黑名单"); } if (R.FAIL == userResult.getCode()) { throw new ServiceException(userResult.getMsg()); } if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "对不起,您的账号已被删除"); throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); ruoyi-modules/ruoyi-system/pom.xml
@@ -2,143 +2,143 @@ <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-modules</artifactId> <version>3.6.2</version> </parent> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-modules</artifactId> <version>3.6.2</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>ruoyi-modules-system</artifactId> <description> ruoyi-modules-system系统模块 </description> <artifactId>ruoyi-modules-system</artifactId> <dependencies> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-api-system</artifactId> </dependency> <!-- SpringCloud Alibaba Nacos --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <!-- SpringCloud Alibaba Nacos Config --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> <!-- SpringCloud Alibaba Sentinel --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId> </dependency> <!-- SpringBoot Actuator --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <description> ruoyi-modules-system系统模块 </description> <dependencies> <!-- Swagger UI --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${swagger.fox.version}</version> </dependency> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-api-system</artifactId> </dependency> <!-- Mysql Connector --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- RuoYi Common DataSource --> <!--<dependency>--> <!--<groupId>com.ruoyi</groupId>--> <!--<artifactId>ruoyi-common-datasource</artifactId>--> <!--</dependency>--> <!-- RuoYi Common DataScope --> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-common-datascope</artifactId> </dependency> <!-- RuoYi Common Log --> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-common-log</artifactId> </dependency> <!-- RuoYi Common Swagger --> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-common-swagger</artifactId> </dependency> <!-- SpringCloud Alibaba Nacos --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <!-- SpringCloud Alibaba Nacos Config --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> <!-- SpringCloud Alibaba Sentinel --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency> <!-- <dependency>--> <!-- <groupId>com.alibaba.cloud</groupId>--> <!-- <artifactId>spring-cloud-starter-alibaba-seata</artifactId>--> <!-- </dependency>--> <!-- SpringBoot Actuator --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!-- Swagger UI --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${swagger.fox.version}</version> </dependency> <!-- Mysql Connector --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- RuoYi Common DataSource --> <!--<dependency>--> <!--<groupId>com.ruoyi</groupId>--> <!--<artifactId>ruoyi-common-datasource</artifactId>--> <!--</dependency>--> <!-- RuoYi Common DataScope --> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-common-datascope</artifactId> </dependency> <!-- RuoYi Common Log --> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-common-log</artifactId> </dependency> <!-- RuoYi Common Swagger --> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-common-swagger</artifactId> </dependency> <!-- 引入Druid依赖,阿里巴巴所提供的数据源 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>${druid.version}</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-spring-boot-starter</artifactId> <version>4.1.2</version> <exclusions> <exclusion> <artifactId>guava</artifactId> <groupId>com.google.guava</groupId> </exclusion> </exclusions> </dependency> </dependencies> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> <!-- 引入Druid依赖,阿里巴巴所提供的数据源 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>${druid.version}</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-spring-boot-starter</artifactId> <version>4.1.2</version> <exclusions> <exclusion> <artifactId>guava</artifactId> <groupId>com.google.guava</groupId> </exclusion> </exclusions> </dependency> </dependencies> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project> ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java
@@ -29,7 +29,6 @@ import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserRoleService; import com.ruoyi.system.service.ISysUserService; import io.seata.spring.annotation.GlobalTransactional; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.util.CollectionUtils; @@ -37,7 +36,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.*; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; /** @@ -85,7 +86,7 @@ .eq(SysRole::getStatus, 0); if (sysUser.getRoleType() == 2) { wrapper.eq(SysRole::getShopId, sysUser.getObjectId()); }else { } else { wrapper.isNull(SysRole::getShopId); } List<SysRole> list = roleService.list(wrapper); @@ -104,12 +105,12 @@ } Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserService.getById(userid); if(sysUser.getRoleType() == 2){ if (sysUser.getRoleType() == 2) { wrapper.eq(SysRole::getShopId, sysUser.getObjectId()); }else{ } else { wrapper.isNull(SysRole::getShopId); } wrapper.ne(SysRole::getRoleId,2);//过滤门店管理员 wrapper.ne(SysRole::getRoleId, 2);//过滤门店管理员 PageInfo<SysRole> page = roleService.page(pageInfo, wrapper.orderByDesc(SysRole::getCreateTime)); for (SysRole record : page.getRecords()) { long count = sysUserRoleService.count(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, record.getRoleId())); @@ -129,7 +130,7 @@ .eq(SysRole::getRoleName, dto.getRoleName()).eq(SysRole::getDelFlag, 0); Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserService.getById(userid); if(sysUser.getRoleType() == 2){ if (sysUser.getRoleType() == 2) { wrapper.eq(SysRole::getShopId, sysUser.getObjectId()); } @@ -147,7 +148,7 @@ role.setCreateBy(SecurityUtils.getUsername()); role.setCreateTime(new Date()); if(sysUser.getRoleType() == 2){ if (sysUser.getRoleType() == 2) { role.setShopId(sysUser.getObjectId()); } roleService.insertRole(role); ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/RuoYiDataInterchangeApplication.java
@@ -26,6 +26,6 @@ public static void main(String[] args) { SpringApplication.run(RuoYiDataInterchangeApplication.class, args); System.out.println("(♥◠‿◠)ノ゙ 数据交互模块启动成功 ლ(´ڡ`ლ)゙ "); System.out.println("\n(♥◠‿◠)ノ゙ 数据交互模块启动成功 ლ(´ڡ`ლ)゙ \n"); } } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPExgMsgHistoryLocationDao.java
@@ -9,5 +9,5 @@ * @Date 2025/3/7 17:03 */ @Repository public interface UPExgMsgHistoryLocationDao extends ElasticsearchRepository<UPExgMsgHistoryLocation, Long> { public interface UPExgMsgHistoryLocationDao extends ElasticsearchRepository<UPExgMsgHistoryLocation, String> { } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPExgMsgRealLocationDao.java
@@ -9,5 +9,5 @@ * @Date 2025/3/7 16:38 */ @Repository public interface UPExgMsgRealLocationDao extends ElasticsearchRepository<UPExgMsgRealLocation, Long> { public interface UPExgMsgRealLocationDao extends ElasticsearchRepository<UPExgMsgRealLocation, String> { } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPExgMsgRegisterDao.java
@@ -9,5 +9,13 @@ * @Date 2025/3/7 16:10 */ @Repository public interface UPExgMsgRegisterDao extends ElasticsearchRepository<UPExgMsgRegister, Long> { public interface UPExgMsgRegisterDao extends ElasticsearchRepository<UPExgMsgRegister, String> { /** * 根据车牌号查询数据 * * @param vehicleNo * @return */ UPExgMsgRegister findByVehicleNo(String vehicleNo); } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPExgMsgReportDriverInfoAckDao.java
@@ -9,5 +9,14 @@ * @Date 2025/3/7 17:12 */ @Repository public interface UPExgMsgReportDriverInfoAckDao extends ElasticsearchRepository<UPExgMsgReportDriverInfoAck, Long> { public interface UPExgMsgReportDriverInfoAckDao extends ElasticsearchRepository<UPExgMsgReportDriverInfoAck, String> { /** * 根据车牌号查询数据 * * @param vehicleNo * @return */ UPExgMsgReportDriverInfoAck findByVehicleNo(String vehicleNo); } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPExgMsgTakeEwayBillAckDao.java
@@ -9,5 +9,8 @@ * @Date 2025/3/7 17:18 */ @Repository public interface UPExgMsgTakeEwayBillAckDao extends ElasticsearchRepository<UPExgMsgTakeEwayBillAck, Long> { public interface UPExgMsgTakeEwayBillAckDao extends ElasticsearchRepository<UPExgMsgTakeEwayBillAck, String> { UPExgMsgTakeEwayBillAck findByVehicleNo(String vehicleNo); } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPWarnMsgAdptInfoDao.java
@@ -11,7 +11,7 @@ * @Date 2025/3/7 19:30 */ @Repository public interface UPWarnMsgAdptInfoDao extends ElasticsearchRepository<UPWarnMsgAdptInfo, Long> { public interface UPWarnMsgAdptInfoDao extends ElasticsearchRepository<UPWarnMsgAdptInfo, String> { /** ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPWarnMsgUrgeTodoAckDao.java
@@ -9,5 +9,5 @@ * @Date 2025/3/7 19:24 */ @Repository public interface UPWarnMsgUrgeTodoAckDao extends ElasticsearchRepository<UPWarnMsgUrgeTodoAck, Long> { public interface UPWarnMsgUrgeTodoAckDao extends ElasticsearchRepository<UPWarnMsgUrgeTodoAck, String> { } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/GnssData.java
@@ -25,12 +25,12 @@ * 日月年 */ @Field(type = FieldType.Integer) private int date; private String date; /** * 时分秒 */ @Field(type = FieldType.Integer) private int time; private String time; /** * 经度 */ @@ -82,13 +82,14 @@ */ public GnssData decode(ByteBuf byteBuf) { this.encrypt = byteBuf.readByte(); this.date = byteBuf.readInt(); ByteBuf byteBuf1 = byteBuf.readBytes(3); StringBuilder t = new StringBuilder(); for (int i = 0; i < 3; i++) { t.append(byteBuf1.getByte(i)); } this.time = Integer.valueOf(t.toString()); int d = byteBuf.readByte(); int m = byteBuf.readByte(); int y = byteBuf.readShort(); this.date = y + "-" + String.format("%02d", m) + "-" + String.format("%02d", d); int h = byteBuf.readByte(); int mi = byteBuf.readByte(); int s = byteBuf.readByte(); this.time = String.format("%02d", h) + ":" + String.format("%02d", mi) + ":" + String.format("%02d", s); this.lon = byteBuf.readInt(); this.lat = byteBuf.readInt(); this.vec1 = byteBuf.readShort(); ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPConnectReq.java
@@ -37,7 +37,7 @@ this.userId = byteBuf.readInt(); this.password = Jtt809Util.readGBKString(byteBuf, 8); this.downLinkIp = Jtt809Util.readGBKString(byteBuf, 32); this.downLinkPort = byteBuf.readShort(); this.downLinkPort = byteBuf.readUnsignedShort(); return this; } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java
@@ -1,7 +1,7 @@ package com.ruoyi.dataInterchange.model; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.dataInterchange.pojo.BaseModel; import com.ruoyi.dataInterchange.util.jtt809.common.ByteArrayUtil; import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -9,8 +9,6 @@ import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType; import java.text.ParseException; /** * 上报报警信息 @@ -101,16 +99,11 @@ this.warnSrc = byteBuf.readByte(); //报警类型 this.warnType = byteBuf.readShort(); String date = byteBuf.readByte() + "-" + byteBuf.readByte() + "-" + byteBuf.readShort() + " " + byteBuf.readByte() + ":" + byteBuf.readByte() + ":" + byteBuf.readByte(); long time = 0; try { time = DateUtils.parseDate(date, "dd-MM-yyyy HH:mm:ss").getTime(); } catch (ParseException e) { e.printStackTrace(); } byte[] readableBytes = new byte[8]; byteBuf.readBytes(readableBytes); String time = ByteArrayUtil.bytes2HexStr(readableBytes); //报警时间 this.warnTime = time; this.warnTime = Long.parseLong(time, 16); //信息ID this.infoId = byteBuf.readInt(); //报警数据长度 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/netty/client/ChannelMap.java
@@ -34,8 +34,9 @@ * @param key * @param channel */ public static void addClientChannel(int key, ChannelId channel) { CLIENT_ID_MAP.put(key, channel); public static void addClientChannel(int key, Channel channel) { CLIENT_ID_MAP.put(key, channel.id()); CLIENT_GROUP.add(channel); } @@ -47,6 +48,9 @@ */ public static Channel getClientChannel(int key) { ChannelId channelId = CLIENT_ID_MAP.get(key); if (null == channelId) { return null; } Channel channel = CLIENT_GROUP.find(channelId); return channel; } @@ -58,8 +62,9 @@ * @param key * @param channel */ public static void addServerChannel(int key, ChannelId channel) { SERVER_ID_MAP.put(key, channel); public static void addServerChannel(int key, Channel channel) { SERVER_ID_MAP.put(key, channel.id()); SERVER_GROUP.add(channel); } @@ -71,6 +76,9 @@ */ public static Channel getServerChannel(int key) { ChannelId channelId = SERVER_ID_MAP.get(key); if (null == channelId) { return null; } Channel channel = SERVER_GROUP.find(channelId); return channel; } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/netty/client/NettyClient.java
@@ -73,7 +73,7 @@ ChannelFuture f = bootstrap.connect().sync(); //将通道添加到缓存中,便于后期直接使用 Channel channel = f.channel(); ChannelMap.addClientChannel(code, channel.id()); ChannelMap.addClientChannel(code, channel); // • 最后关闭EventLoopGroup来释放资源 f.channel().closeFuture().sync(); } finally { ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/pojo/BaseModel.java
@@ -5,8 +5,6 @@ import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType; import java.time.LocalDateTime; /** * @author zhibing.pu * @Date 2025/3/7 16:22 @@ -15,7 +13,7 @@ public class BaseModel { @Id @Field(type = FieldType.Auto) private Long id; private String id; /** * 下级平台唯一标识 */ @@ -24,6 +22,6 @@ /** * 添加时间 */ @Field(type = FieldType.Date) private LocalDateTime createTime; @Field(type = FieldType.Long) private Long createTime; } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/ConnectReqService.java
@@ -46,6 +46,7 @@ ByteBuf byteBuf = Unpooled.wrappedBuffer(outerPacket.getBody()); //解析封装原元数据 UPConnectReq upConnectReq = new UPConnectReq().decode(byteBuf); log.info("主链路登录请求体:" + JSON.toJSONString(upConnectReq)); Enterprise data = enterpriseClient.getEnterprise(upConnectReq.getUserId() + "").getData(); UPConnectRsp upConnectRsp = new UPConnectRsp(); if (null == data) { @@ -74,8 +75,8 @@ ctx.flush(); if (upConnectRsp.getResult() == 0x00) { //保存链路 ChannelMap.addServerChannel(outerPacket.getGnsscenterId(), ctx.channel().id()); //从链路连接 TODO 临时注释掉 ChannelMap.addServerChannel(outerPacket.getGnsscenterId(), ctx.channel()); //从链路连接 // downConnect(ctx, outerPacket.getGnsscenterId(), upConnectReq.getDownLinkIp(), upConnectReq.getDownLinkPort(), verifyCode); } else { ctx.close(); ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/DOWNTotalRecvBackMsgService.java
File was deleted ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/ExgMsgService.java
@@ -7,7 +7,6 @@ import com.ruoyi.dataInterchange.netty.client.ChannelMap; import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; import com.ruoyi.dataInterchange.util.jtt809.packet.common.OuterPacket; import com.ruoyi.dataInterchange.wapper.UPConnect; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; @@ -17,6 +16,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.Iterator; /** @@ -129,10 +129,16 @@ public void up_exg_msg_register(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { UPExgMsgRegister upExgMsgRegister = new UPExgMsgRegister().decode(exgMsg); upExgMsgRegister.setInferiorPlatformId(inferiorPlatformId); upExgMsgRegister.setCreateTime(LocalDateTime.now()); upExgMsgRegisterDao.save(upExgMsgRegister); upExgMsgRegister.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); UPExgMsgRegister register = upExgMsgRegisterDao.findByVehicleNo(upExgMsgRegister.getVehicleNo()); if (null == register) { upExgMsgRegisterDao.save(upExgMsgRegister); } //上报驾驶员身份识别信息请求 down_exg_msg_report_driver_info(ctx, inferiorPlatformId, upExgMsgRegister.getVehicleNo(), upExgMsgRegister.getVehicleColor()); UPExgMsgReportDriverInfoAck byVehicleNo = upExgMsgReportDriverInfoAckDao.findByVehicleNo(upExgMsgRegister.getVehicleNo()); if (null == byVehicleNo) { down_exg_msg_report_driver_info(ctx, inferiorPlatformId, upExgMsgRegister.getVehicleNo(), upExgMsgRegister.getVehicleColor()); } } /** @@ -153,10 +159,8 @@ Channel channel = ChannelMap.getClientChannel(inferiorPlatformId); if (null != channel && channel.isActive()) { channel.writeAndFlush(out); channel.flush(); } else { ctx.writeAndFlush(out); ctx.flush(); } } @@ -169,7 +173,7 @@ public void up_exg_msg_real_location(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { UPExgMsgRealLocation upExgMsgRealLocation = new UPExgMsgRealLocation().decode(exgMsg); upExgMsgRealLocation.setInferiorPlatformId(inferiorPlatformId); upExgMsgRealLocation.setCreateTime(LocalDateTime.now()); upExgMsgRealLocation.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); upExgMsgRealLocationDao.save(upExgMsgRealLocation); } @@ -205,11 +209,9 @@ Channel channel = ChannelMap.getClientChannel(inferiorPlatformId); if (null != channel && channel.isActive()) { channel.writeAndFlush(out); channel.flush(); } else { //重新连接从链路 UPConnect ipAndPort = ChannelMap.getIpAndPort(inferiorPlatformId); connectReqService.downConnect(inferiorPlatformId, ipAndPort.getDownLinkIp(), ipAndPort.getDownLinkPort(), ipAndPort.getVerifyCode()); channel = ChannelMap.getServerChannel(inferiorPlatformId); channel.writeAndFlush(out); } } @@ -224,7 +226,7 @@ public void up_exg_msg_history_location(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { UPExgMsgHistoryLocation upExgMsgHistoryLocation = new UPExgMsgHistoryLocation().decode(exgMsg); upExgMsgHistoryLocation.setInferiorPlatformId(inferiorPlatformId); upExgMsgHistoryLocation.setCreateTime(LocalDateTime.now()); upExgMsgHistoryLocation.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); upExgMsgHistoryLocationDao.save(upExgMsgHistoryLocation); } @@ -239,7 +241,7 @@ public void up_exg_msg_report_driver_info_ack(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { UPExgMsgReportDriverInfoAck upExgMsgReportDriverInfoAck = new UPExgMsgReportDriverInfoAck().decode(exgMsg); upExgMsgReportDriverInfoAck.setInferiorPlatformId(inferiorPlatformId); upExgMsgReportDriverInfoAck.setCreateTime(LocalDateTime.now()); upExgMsgReportDriverInfoAck.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); upExgMsgReportDriverInfoAckDao.save(upExgMsgReportDriverInfoAck); } @@ -254,8 +256,11 @@ public void up_exg_msg_take_ewaybill_ack(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { UPExgMsgTakeEwayBillAck upExgMsgTakeEwayBillAck = new UPExgMsgTakeEwayBillAck().decode(exgMsg); upExgMsgTakeEwayBillAck.setInferiorPlatformId(inferiorPlatformId); upExgMsgTakeEwayBillAck.setCreateTime(LocalDateTime.now()); upExgMsgTakeEwayBillAckDao.save(upExgMsgTakeEwayBillAck); upExgMsgTakeEwayBillAck.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); UPExgMsgTakeEwayBillAck byVehicleNo = upExgMsgTakeEwayBillAckDao.findByVehicleNo(upExgMsgTakeEwayBillAck.getVehicleNo()); if (null == byVehicleNo) { upExgMsgTakeEwayBillAckDao.save(upExgMsgTakeEwayBillAck); } } } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/UPLinkTestReqService.java
@@ -19,15 +19,16 @@ /** * 住链路连接保持 * 主链路连接保持 * * @param ctx * @param out */ public void linkTest(ChannelHandlerContext ctx, OuterPacket out){ public void linkTest(ChannelHandlerContext ctx, OuterPacket out) { int gnsscenterId = out.getGnsscenterId(); ChannelMap.addServerChannel(gnsscenterId, ctx.channel().id()); ChannelMap.addServerChannel(gnsscenterId, ctx.channel()); OuterPacket rep = new OuterPacket(DataType.UP_LINKTEST_RSP.getCode(), null); log.info("住链路连接保持应答({}):{}", DataType.UP_LINKTEST_RSP.getCode(), JSON.toJSONString(rep)); log.info("主链路连接保持应答({}):{}", DataType.UP_LINKTEST_RSP.getCode(), JSON.toJSONString(rep)); ctx.writeAndFlush(rep); ctx.flush(); } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java
@@ -11,7 +11,6 @@ import com.ruoyi.dataInterchange.netty.client.ChannelMap; import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; import com.ruoyi.dataInterchange.util.jtt809.packet.common.OuterPacket; import com.ruoyi.dataInterchange.wapper.UPConnect; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; @@ -21,6 +20,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.List; /** @@ -111,7 +111,7 @@ public void up_warn_msg_urge_todo_ack(ChannelHandlerContext ctx, int inferiorPlatformId, WarnMsg warnMsg) { UPWarnMsgUrgeTodoAck upWarnMsgUrgeTodoAck = new UPWarnMsgUrgeTodoAck().decode(warnMsg); upWarnMsgUrgeTodoAck.setInferiorPlatformId(inferiorPlatformId); upWarnMsgUrgeTodoAck.setCreateTime(LocalDateTime.now()); upWarnMsgUrgeTodoAck.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); upWarnMsgUrgeTodoAckDao.save(upWarnMsgUrgeTodoAck); } @@ -126,7 +126,7 @@ UPWarnMsgAdptInfo upWarnMsgAdptInfo = new UPWarnMsgAdptInfo().decode(warnMsg); upWarnMsgAdptInfo.setResult(0x00); upWarnMsgAdptInfo.setInferiorPlatformId(inferiorPlatformId); upWarnMsgAdptInfo.setCreateTime(LocalDateTime.now()); upWarnMsgAdptInfo.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); upWarnMsgAdptInfoDao.save(upWarnMsgAdptInfo); } @@ -155,11 +155,9 @@ Channel channel = ChannelMap.getClientChannel(inferiorPlatformId); if (null != channel && channel.isActive()) { channel.writeAndFlush(out); channel.flush(); } else { //重新连接从链路 UPConnect ipAndPort = ChannelMap.getIpAndPort(inferiorPlatformId); connectReqService.downConnect(inferiorPlatformId, ipAndPort.getDownLinkIp(), ipAndPort.getDownLinkPort(), ipAndPort.getVerifyCode()); channel = ChannelMap.getServerChannel(inferiorPlatformId); channel.writeAndFlush(out); } } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/TaskUtil.java
@@ -1,6 +1,5 @@ package com.ruoyi.dataInterchange.util; import com.ruoyi.dataInterchange.server.DOWNTotalRecvBackMsgService; import com.ruoyi.dataInterchange.server.ExgMsgService; import com.ruoyi.dataInterchange.server.WarnMsgService; import org.springframework.scheduling.annotation.Scheduled; @@ -21,18 +20,6 @@ @Resource private WarnMsgService warnMsgService; @Resource private DOWNTotalRecvBackMsgService downTotalRecvBackMsgService; /** * 接收车辆定位信息数据通知消息 */ @Scheduled(fixedRate = 1000 * 60) public void taskTotalRecvBack() { downTotalRecvBackMsgService.taskTotalRecvBack(); } /** ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/jtt809/decoder/Jtt809Decoder.java
@@ -37,7 +37,7 @@ // 判断包头 if (byteBuf.readByte() != Jtt809Constant.PACKET_HEAD_FLAG) { byteBuf.resetReaderIndex(); log.warn("消息包头错误: {}5d", ByteBufUtil.hexDump(byteBuf)); log.warn("消息包头错误: {}", ByteBufUtil.hexDump(byteBuf)); return; } // crc校验 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/jtt809/encoder/Jtt809Encoder.java
@@ -1,6 +1,5 @@ package com.ruoyi.dataInterchange.util.jtt809.encoder; import com.ruoyi.dataInterchange.util.jtt809.common.ByteArrayUtil; import com.ruoyi.dataInterchange.util.jtt809.common.CRC16CCITT; import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Constant; import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; @@ -72,9 +71,6 @@ out.writeBytes(Jtt809Util.escape(escapeBytes)); // 包尾标识 out.writeByte(Jtt809Constant.PACKET_END_FLAG); byte[] readableBytes = new byte[out.readableBytes()]; out.readBytes(readableBytes); log.info("下发数据包, packetLen : {}, packet : {}", readableBytes.length, ByteArrayUtil.bytes2HexStr(readableBytes)); } }