localizer
lzq 2025-10-27 17:51:51 +08:00
parent 4f13fb3365
commit 086ec04309
9 changed files with 102 additions and 19 deletions

View File

@ -0,0 +1,28 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.njzscloud</groupId>
<artifactId>njzscloud-common</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>njzscloud-common-sshtunnel</artifactId>
<packaging>jar</packaging>
<name>njzscloud-common-sshtunnel</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,5 +1,6 @@
package com.njzscloud.common.ws.support;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.njzscloud.common.core.tuple.Tuple2;
import com.njzscloud.common.security.support.Token;
@ -40,7 +41,7 @@ public class TokenHandshakeInterceptor implements HandshakeInterceptor {
if (resolved == null) return false;
Long uid = resolved.get_0();
String cid = resolved.get_1();
attributes.put(Constants.SESSION_ATTRIBUTE_TOKEN, authorization);
attributes.put(Constants.SESSION_ATTRIBUTE_TOKEN, StrUtil.isBlank(authorization) ? cid : authorization);
attributes.put(Constants.SESSION_ATTRIBUTE_CID, cid);
attributes.put(Constants.SESSION_ATTRIBUTE_UID, uid);
return true;
@ -65,6 +66,7 @@ public class TokenHandshakeInterceptor implements HandshakeInterceptor {
}
private Tuple2<Long, String> resolve(String tokenStr) {
if (StrUtil.isBlank(tokenStr)) return Tuple2.create(0L, IdUtil.fastSimpleUUID());
UserDetail userDetail = SecurityUtil.parseToken(tokenStr);
if (userDetail == null) return null;
Token token = userDetail.getToken();

View File

@ -30,6 +30,7 @@
<module>njzscloud-common-wechat</module>
<module>njzscloud-common-localizer</module>
<module>njzscloud-common-ws</module>
<module>njzscloud-common-sshtunnel</module>
</modules>

View File

@ -93,6 +93,8 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
.setProvince(defaultPlace.getProvince())
.setCity(defaultPlace.getCity())
.setProvinceName(defaultPlace.getProvinceName())
.setAuditStatus(oldData.getAuditStatus() == AuditStatus.TongGuo ? AuditStatus.TongGuo : AuditStatus.DaiShenHe)
.setAuditMemo("")
.setCityName(defaultPlace.getCityName());
this.updateById(bizCompanyEntity);
}

View File

@ -575,8 +575,8 @@ public class TruckLocationTrackService extends ServiceImpl<TruckLocationTrackMap
List<TruckLocationTrackEntity> records = resultPage.getRecords();
if (records.isEmpty()) {
if (errCount >= 20) {
log.error("查询历史轨迹异常, 订单ID: {}, 时间: {}", orderId, startTime);
if (errCount >= 200) {
log.error("暂无实时数据, 订单ID: {}, 时间: {}", orderId, startTime);
Websocket.publish(new WsMsg()
.setEvent("down/truck_location_track/realtime")
.setData(R.failed(ExceptionMsg.SYS_ERR_MSG, "暂无实时数据"))

View File

@ -189,6 +189,12 @@ public class OrderInfoController {
return R.success();
}
@GetMapping("/gps_test")
public R<?> gpsTest(@RequestParam("sn") String sn, @RequestParam(value = "count", required = false, defaultValue = "1000") int count) {
orderInfoService.gpsTest(sn, count);
return R.success();
}
/**
*
*

View File

@ -48,6 +48,7 @@ public class OrderPagingResult {
private String sn;
private String projectName;
private LocalDateTime checkTime;
private LocalDateTime transTime;
private LocalDateTime assignmentTransTime;
private LocalDateTime assignmentDriverTime;
private LocalDateTime driverConfirmTime;

View File

@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
@ -68,6 +69,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import static com.njzscloud.supervisory.constant.Constant.CERTIFICATE_SN_CODE;
@ -93,7 +95,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
private final CloudVoiceboxService cloudVoiceboxService;
private final MoneyAccountService moneyAccountService;
private final MoneyChangeDetailService moneyChangeDetailService;
private final AtomicBoolean test_thread_running = new AtomicBoolean(false);
Thread test_thread = null;
@Value("${app.check-gps:false}")
private boolean checkGps;
@ -239,9 +242,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Set<String> roles = userDetail.getRoles();
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
Long stationId = orderPagingSearchParam.getStationId();
Assert.notNull(stationId, () -> Exceptions.clierr("请选择站点"));
ew
.eq("a.station_id", stationId)
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
.eq("a.order_status", OrderStatus.YiYuYue)
.isNull("a.trans_company_id ")
;
@ -266,9 +268,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Set<String> roles = userDetail.getRoles();
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
Long stationId = orderPagingSearchParam.getStationId();
Assert.notNull(stationId, () -> Exceptions.clierr("请选择站点"));
ew
.eq("a.station_id", stationId)
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
.in("a.order_status", OrderStatus.DaiPaiDan, OrderStatus.DaiJieDan, OrderStatus.YiJieDan)
;
return;
@ -306,9 +307,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Set<String> roles = userDetail.getRoles();
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
Long stationId = orderPagingSearchParam.getStationId();
Assert.notNull(stationId, () -> Exceptions.clierr("请选择站点"));
ew
.eq("a.station_id", stationId)
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
.in("a.order_status", OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang)
;
return;
@ -349,9 +349,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Set<String> roles = userDetail.getRoles();
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
Long stationId = orderPagingSearchParam.getStationId();
Assert.notNull(stationId, () -> Exceptions.clierr("请选择站点"));
ew
.eq("a.station_id", stationId)
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
.eq("a.order_status", OrderStatus.YiWanCheng)
;
return;
@ -374,9 +373,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Set<String> roles = userDetail.getRoles();
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
Long stationId = orderPagingSearchParam.getStationId();
Assert.notNull(stationId, () -> Exceptions.clierr("请选择站点"));
ew
.eq("a.station_id", stationId)
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
.eq("a.order_status", OrderStatus.YiQuXiao)
;
return;
@ -388,9 +386,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Set<String> roles = userDetail.getRoles();
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
Long stationId = orderPagingSearchParam.getStationId();
Assert.notNull(stationId, () -> Exceptions.clierr("请选择站点"));
ew
.eq("a.station_id", stationId)
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
.ne("a.auto_order", 3)
;
return;
@ -660,7 +657,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
);
}
private boolean assignmentTrafficCompany(AssignmentOrderParam assignmentOrderParam, OrderInfoEntity orderInfo) {
private boolean assignmentTrafficCompany(AssignmentOrderParam assignmentOrderParam,
OrderInfoEntity orderInfo) {
Long transCompanyId = assignmentOrderParam.getTransCompanyId();
if (transCompanyId == null) return false;
Assert.isNull(orderInfo.getTransCompanyId(), () -> Exceptions.clierr("当前订单已分配清运公司,无需重复分配"));
@ -857,7 +855,6 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
}
}
public void startTrackOrder(Long orderId) {
OrderInfoEntity orderInfo = this.getById(orderId);
Long truckId = orderInfo.getTruckId();
@ -1379,4 +1376,49 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
}
});
}
public void gpsTest(String sn, int count) {
if (count <= 0) {
if (test_thread != null) {
test_thread_running.set(false);
}
return;
}
Assert.isTrue(count <= 1000, () -> Exceptions.clierr("数量必须大于0且小于等于1000"));
OrderInfoEntity orderInfo = this.getOne(Wrappers.lambdaQuery(OrderInfoEntity.class).eq(OrderInfoEntity::getSn, sn));
Assert.notNull(orderInfo, () -> Exceptions.clierr("订单不存在"));
Page<TruckLocationTrackEntity> page = truckLocationTrackService.page(new Page<>(1, count), Wrappers.lambdaQuery(TruckLocationTrackEntity.class)
.eq(TruckLocationTrackEntity::getOrderId, 1982687926996865026L)
.orderByAsc(TruckLocationTrackEntity::getLocationTime)
);
List<TruckLocationTrackEntity> records = page.getRecords();
if (CollUtil.isEmpty(records)) {
Assert.notNull(orderInfo, () -> Exceptions.clierr("无数据"));
}
test_thread = new Thread(() -> {
for (TruckLocationTrackEntity record : records) {
if (!test_thread_running.get()) {
break;
}
truckLocationTrackService.save(new TruckLocationTrackEntity()
.setOrderId(orderInfo.getId())
.setTruckId(record.getTruckId())
.setTerminalId(record.getTerminalId())
.setLatitude(record.getLatitude())
.setLongitude(record.getLongitude())
.setAltitude(record.getAltitude())
.setSpeed(record.getSpeed())
.setLocationTime(LocalDateTime.now())
.setDirection(record.getDirection())
.setOverspeed(record.getOverspeed())
.setCompensate(record.getCompensate()));
ThreadUtil.sleep(1000);
}
log.info("{} 数据导入完成", orderInfo.getSn());
});
test_thread_running.set(true);
test_thread.start();
}
}

View File

@ -49,6 +49,7 @@
a.deleted,
a.cargo_place_id,
a.car_in_out_id,
a.trans_time,
a.site_photos,
b.province,
b.city,