localizer
parent
eef7f575fe
commit
88712f4fbd
|
|
@ -1,6 +1,5 @@
|
|||
package com.njzscloud.common.mqtt.support;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njzscloud.common.core.jackson.Jackson;
|
||||
import com.njzscloud.common.mqtt.config.MqttProperties;
|
||||
|
|
@ -13,6 +12,7 @@ import org.springframework.beans.BeansException;
|
|||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
|
@ -24,7 +24,7 @@ public class MqttCliWrapper implements BeanPostProcessor {
|
|||
|
||||
public MqttCliWrapper(MqttProperties mqttProperties) {
|
||||
String broker = mqttProperties.getBroker();
|
||||
String clientId = mqttProperties.getClientId() + "-" + IdUtil.nanoId();
|
||||
String clientId = mqttProperties.getClientId() + "_" + new Date().getTime();
|
||||
String username = mqttProperties.getUsername();
|
||||
String password = mqttProperties.getPassword();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<finalName>localizer</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
mqtt:
|
||||
enabled: true
|
||||
broker: tcp://139.224.54.144:1883
|
||||
client-id: njzscloud-svr1
|
||||
username: gps
|
||||
password: TKG4TV3dF7CeazDnUdCF
|
||||
|
||||
localizer:
|
||||
enabled: true
|
||||
boss-threads: 1
|
||||
worker-threads: 1
|
||||
port: 18888
|
||||
|
|
@ -1,21 +1,16 @@
|
|||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
location: /home/njzscloud/temp
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/njzscloud?characterEncoding=UTF-8&allowMultiQueries=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
application:
|
||||
name: localizer
|
||||
|
||||
oss:
|
||||
type: ali
|
||||
ali:
|
||||
region: cn-shanghai
|
||||
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||
access-key: LTAI5tJJu2WayYchExrT5W1E
|
||||
secret-key: zllX0ZJ1EwsZXT6dE6swCLgTF4ImGg
|
||||
bucket-name: cdn-zsy
|
||||
mqtt:
|
||||
enabled: true
|
||||
broker: tcp://127.0.0.1:1883
|
||||
client-id: localizer
|
||||
username: zsy
|
||||
password: zsy_mqtt_cli
|
||||
|
||||
mybatis-plus:
|
||||
tunnel:
|
||||
enable: false
|
||||
localizer:
|
||||
enabled: true
|
||||
boss-threads: 10
|
||||
worker-threads: 20
|
||||
port: ${LOCALIZER_PORT:10088}
|
||||
|
|
|
|||
|
|
@ -104,8 +104,8 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<finalName>greenfrog</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 车辆信息
|
||||
|
|
@ -67,15 +65,8 @@ public class BizTruckController {
|
|||
*
|
||||
*/
|
||||
@PostMapping("/del")
|
||||
public R<?> del(@RequestBody HashMap<String, Object> map) {
|
||||
Object ids = map.get("id");
|
||||
if (ids instanceof List) {
|
||||
List<?> ids1 = (List<?>) ids;
|
||||
List<Long> collect = ids1.stream().map(it -> Long.parseLong(it.toString())).collect(Collectors.toList());
|
||||
bizTruckService.del(collect);
|
||||
} else {
|
||||
throw new IllegalArgumentException("参数格式错误");
|
||||
}
|
||||
public R<?> del(@RequestBody List<Long> ids) {
|
||||
bizTruckService.del(ids);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆信息
|
||||
*/
|
||||
|
|
@ -22,4 +24,45 @@ public class ModifyBizTruckParam {
|
|||
*/
|
||||
private String gps;
|
||||
|
||||
|
||||
/**
|
||||
* 车牌
|
||||
*/
|
||||
private String licensePlate;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private String truckCategory;
|
||||
|
||||
/**
|
||||
* 行驶证图片
|
||||
*/
|
||||
private List<String> truckLicense;
|
||||
|
||||
/**
|
||||
* 车架号
|
||||
*/
|
||||
private String vnCode;
|
||||
|
||||
/**
|
||||
* 合格证图片
|
||||
*/
|
||||
private List<String> qualification;
|
||||
|
||||
/**
|
||||
* 最大载重; 单位:千克
|
||||
*/
|
||||
private Integer carryingCapacity;
|
||||
|
||||
/**
|
||||
* 皮重; 单位:千克
|
||||
*/
|
||||
private Integer tareWeight;
|
||||
|
||||
/**
|
||||
* 车辆图片
|
||||
*/
|
||||
private String picture;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,16 @@ public class BizTruckService extends ServiceImpl<BizTruckMapper, BizTruckEntity>
|
|||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modify(ModifyBizTruckParam modifyBizTruckParam) {
|
||||
Long id = modifyBizTruckParam.getId();
|
||||
BizTruckEntity oldData = this.getById(id);
|
||||
Assert.notNull(oldData, () -> Exceptions.exception("车辆不存在"));
|
||||
String licensePlate = modifyBizTruckParam.getLicensePlate();
|
||||
boolean exists = this.exists(Wrappers.lambdaQuery(BizTruckEntity.class)
|
||||
.eq(BizTruckEntity::getLicensePlate, licensePlate)
|
||||
.ne(BizTruckEntity::getId, id));
|
||||
if (exists) {
|
||||
throw Exceptions.exception("车牌号已存在:{}", licensePlate);
|
||||
}
|
||||
String gps = modifyBizTruckParam.getGps();
|
||||
if (StrUtil.isNotBlank(gps)) {
|
||||
long count = deviceLocalizerService.count(Wrappers.<DeviceLocalizerEntity>query().eq("terminal_id", gps));
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import com.njzscloud.common.mp.support.PageResult;
|
|||
import com.njzscloud.common.mqtt.support.MqttMsg;
|
||||
import com.njzscloud.common.mqtt.util.Mqtt;
|
||||
import com.njzscloud.common.ws.support.Websocket;
|
||||
import com.njzscloud.supervisory.biz.service.TruckLocationTrackService;
|
||||
import com.njzscloud.supervisory.device.contant.LocalizerCategory;
|
||||
import com.njzscloud.supervisory.device.mapper.DeviceLocalizerMapper;
|
||||
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
||||
|
|
@ -44,7 +43,6 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, DeviceLocalizerEntity> implements IService<DeviceLocalizerEntity> {
|
||||
private final TruckLocationTrackService truckLocationTrackService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
|
|
@ -59,7 +57,9 @@ public class DeviceLocalizerService extends ServiceImpl<DeviceLocalizerMapper, D
|
|||
.eq(DeviceLocalizerEntity::getTerminalId, terminalId)
|
||||
.eq(DeviceLocalizerEntity::getLocalizerCategory, localizerCategory)),
|
||||
() -> Exceptions.exception("定位器已存在"));
|
||||
this.save(deviceLocalizerEntity.setConfig(new LocalizerConfig()
|
||||
this.save(deviceLocalizerEntity
|
||||
.setLastTime(LocalDateTime.now())
|
||||
.setConfig(new LocalizerConfig()
|
||||
.setSpeedThreshold(60)
|
||||
.setEnableWarn(true)
|
||||
));
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ import com.njzscloud.supervisory.sys.stationletter.constant.WarnCategory;
|
|||
import com.njzscloud.supervisory.voicebox.service.CloudVoiceboxService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -92,6 +93,9 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
private final MoneyAccountService moneyAccountService;
|
||||
private final MoneyChangeDetailService moneyChangeDetailService;
|
||||
|
||||
@Value("${app.check-gps:false}")
|
||||
private boolean checkGps;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
|
|
@ -748,12 +752,15 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
Assert.notNull(truckId, () -> Exceptions.clierr("订单未分配车辆"));
|
||||
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
|
||||
Assert.notNull(truckInfo, () -> Exceptions.clierr("车辆不存在"));
|
||||
|
||||
String gpsId = truckInfo.getGps();
|
||||
String licensePlate = truckInfo.getLicensePlate();
|
||||
if (checkGps) {
|
||||
Assert.notEmpty(gpsId, () -> Exceptions.clierr("车辆未绑定GPS"));
|
||||
DeviceLocalizerEntity deviceLocalizerEntity = baseMapper.gpsLastOnlineTime(gpsId);
|
||||
LocalDateTime lastTime = deviceLocalizerEntity.getLastTime();
|
||||
boolean after = lastTime.isBefore(LocalDateTime.now().minusMinutes(5));
|
||||
|
||||
boolean after = lastTime == null || lastTime.isBefore(LocalDateTime.now().minusMinutes(5));
|
||||
if (after) {
|
||||
bizWarnService.save(new BizWarnEntity()
|
||||
.setWarnCategory(WarnCategory.EQUIPMENT.getVal())
|
||||
|
|
@ -762,6 +769,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
startTrack(gpsId, licensePlate, orderInfoId, truckId);
|
||||
|
||||
CompletableFuture.runAsync(() -> Websocket.publish(new WsMsg().setEvent("down/order/status_change")
|
||||
|
|
@ -1340,6 +1349,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
}
|
||||
|
||||
private void startTrack(String gpsId, String licensePlate, Long orderInfoId, Long truckId) {
|
||||
if (StrUtil.isBlank(gpsId)) return;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
Mqtt.subscribe(gpsId + "/track_location", (msg) -> {
|
||||
RealtimeLocationResult realtimeLocationResult = msg.getMsg(RealtimeLocationResult.class);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,80 @@
|
|||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
location: /home/njzscloud/temp
|
||||
application:
|
||||
name: greenfrog
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/njzscloud?characterEncoding=UTF-8&allowMultiQueries=true&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
url: jdbc:mysql://rm-uf6g259329on1376u.mysql.rds.aliyuncs.com:3306/greenfrog?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||
username: zsy
|
||||
password: DtRcBCWYmMSd7Vre2jT
|
||||
security:
|
||||
auth-ignores:
|
||||
- /auth/obtain_code
|
||||
- /user/register
|
||||
- /oss/**
|
||||
- /district/tree
|
||||
- /sys_sn_config/add
|
||||
- /test/**
|
||||
- /device_info/report1
|
||||
- /device_info/report2
|
||||
- /geo_fence_config/**
|
||||
- /statistics/**
|
||||
- /district/default_place
|
||||
- /bulletin/detail
|
||||
- /bulletin/paging
|
||||
- /truck_location_track/**
|
||||
- /fdx
|
||||
- /payment/wechat/notify
|
||||
- /payment/wechat/refundNotify
|
||||
- /district/areaList
|
||||
- /biz_audit_config/copy
|
||||
|
||||
app:
|
||||
in-out-gap: 180
|
||||
default-place:
|
||||
province: 340000
|
||||
city: 341100
|
||||
province-name: 安徽省
|
||||
city-name: 滁州市
|
||||
|
||||
oss:
|
||||
type: ali
|
||||
ali:
|
||||
region: cn-shanghai
|
||||
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||
access-key: LTAI5tJJu2WayYchExrT5W1E
|
||||
secret-key: zllX0ZJ1EwsZXT6dE6swCLgTF4ImGg
|
||||
bucket-name: cdn-zsy
|
||||
access-key: LTAI5t96qDgWDzu5rSRHUttZ
|
||||
secret-key: GS9wh0stna11POzBXG7kzh0lKYvhkg
|
||||
bucket-name: czxcsy-cdn
|
||||
|
||||
mybatis-plus:
|
||||
tunnel:
|
||||
enable: false
|
||||
|
||||
wechat:
|
||||
# app-id: wx3c06d9dd4e56c58d
|
||||
# app-secret: ff280a71a4c06fc2956178f8c472ef96
|
||||
app-id: wx989ea47a5ddf9bfb
|
||||
app-secret: 66c98dc487a372acb4f1931b38fee8ff
|
||||
base-url: https://api.weixin.qq.com
|
||||
pay:
|
||||
app-id: wx989ea47a5ddf9bfb
|
||||
mch-id: 1729703110
|
||||
# API密钥(32位字符串)
|
||||
api-key: KXM36nZCXji1sQt75tGk77k7b2K5RBpf
|
||||
# 证书序列号
|
||||
cert-serial-no: 1BCB1533688F349541C7B636EF67C666828BADBA
|
||||
# 文件路径
|
||||
private-key-path: classpath:cert/apiclient_cert.p12
|
||||
# private-key-path: D:/project/再昇云/代码/njzscloud/njzscloud-svr/src/main/resources/cert/apiclient_cert.p12
|
||||
# 支付回调地址
|
||||
notify-url: http://115.29.236.92:8082/payment/wechat/notify
|
||||
# 退款回调地址
|
||||
refund-notify-url: http://115.29.236.92:8082/payment/wechat/refundNotify
|
||||
|
||||
mqtt:
|
||||
enabled: true
|
||||
broker: tcp://127.0.0.1:1883
|
||||
client-id: greenfrog
|
||||
username: zsy
|
||||
password: zsy_mqtt_cli
|
||||
|
||||
localizer:
|
||||
enabled: false
|
||||
|
|
|
|||
Loading…
Reference in New Issue