Merge branch 'master' of https://git.njzscloud.com/lzq/njzscloud
commit
1b2687a441
|
|
@ -71,30 +71,32 @@ public class SupervisionStatisticsService {
|
||||||
.thenApply(dataStatistics -> {
|
.thenApply(dataStatistics -> {
|
||||||
Double todayTotalWeight = MapUtil.getDouble(dataStatistics, "todayTotalWeight", 0.0);
|
Double todayTotalWeight = MapUtil.getDouble(dataStatistics, "todayTotalWeight", 0.0);
|
||||||
Double yesterdayTotalWeight = MapUtil.getDouble(dataStatistics, "yesterdayTotalWeight", 0.0);
|
Double yesterdayTotalWeight = MapUtil.getDouble(dataStatistics, "yesterdayTotalWeight", 0.0);
|
||||||
Double dayRate = yesterdayTotalWeight == 0 ? 100 : (todayTotalWeight - yesterdayTotalWeight) / yesterdayTotalWeight * 100;
|
Double dayRate = yesterdayTotalWeight == 0 ? 0 : (todayTotalWeight - yesterdayTotalWeight) / yesterdayTotalWeight * 100;
|
||||||
|
|
||||||
Double currentMonthTotalWeight = MapUtil.getDouble(dataStatistics, "currentMonthTotalWeight", 0.0);
|
Double currentMonthTotalWeight = MapUtil.getDouble(dataStatistics, "currentMonthTotalWeight", 0.0);
|
||||||
Double lastMonthTotalWeight = MapUtil.getDouble(dataStatistics, "lastMonthTotalWeight", 0.0);
|
Double lastMonthTotalWeight = MapUtil.getDouble(dataStatistics, "lastMonthTotalWeight", 0.0);
|
||||||
Double monthRate = lastMonthTotalWeight == 0 ? 100 : (currentMonthTotalWeight - lastMonthTotalWeight) / lastMonthTotalWeight * 100;
|
Double monthRate = lastMonthTotalWeight == 0 ? 0 : (currentMonthTotalWeight - lastMonthTotalWeight) / lastMonthTotalWeight * 100;
|
||||||
|
|
||||||
Double todayFinishCount = MapUtil.getDouble(dataStatistics, "todayFinishCount", 0.0);
|
Double todayFinishCount = MapUtil.getDouble(dataStatistics, "todayFinishCount", 0.0);
|
||||||
Double todayTotalCount = MapUtil.getDouble(dataStatistics, "todayTotalCount", 0.0);
|
Double todayTotalCount = MapUtil.getDouble(dataStatistics, "todayTotalCount", 0.0);
|
||||||
Double todayFinishRate = todayTotalCount == 0 ? 100 : todayFinishCount / todayTotalCount * 100;
|
Double todayFinishRate = todayTotalCount == 0 ? 0 : todayFinishCount / todayTotalCount * 100;
|
||||||
|
|
||||||
Double yesterdayFinishCount = MapUtil.getDouble(dataStatistics, "yesterdayFinishCount", 0.0);
|
Double yesterdayFinishCount = MapUtil.getDouble(dataStatistics, "yesterdayFinishCount", 0.0);
|
||||||
// Double yesterdayTotalCount = MapUtil.getDouble(dataStatistics, "yesterdayTotalCount", 0.0);
|
// Double yesterdayTotalCount = MapUtil.getDouble(dataStatistics, "yesterdayTotalCount", 0.0);
|
||||||
// Double yesterdayFinishRate = yesterdayFinishCount == 0 ? 100 : yesterdayFinishCount / yesterdayTotalCount * 100;
|
// Double yesterdayFinishRate = yesterdayFinishCount == 0 ? 100 : yesterdayFinishCount / yesterdayTotalCount * 100;
|
||||||
Double incFinishRate = yesterdayFinishCount == 0 ? 100 : (todayFinishCount - yesterdayFinishCount) / yesterdayFinishCount * 100;
|
Double incFinishRate = yesterdayFinishCount == 0 ? 0 : (todayFinishCount - yesterdayFinishCount) / yesterdayFinishCount * 100;
|
||||||
|
|
||||||
Double todayWarnCount = MapUtil.getDouble(dataStatistics, "todayWarnCount", 0.0);
|
Double todayWarnCount = MapUtil.getDouble(dataStatistics, "todayWarnCount", 0.0);
|
||||||
Double yesterdayWarnCount = MapUtil.getDouble(dataStatistics, "yesterdayWarnCount", 0.0);
|
Double yesterdayWarnCount = MapUtil.getDouble(dataStatistics, "yesterdayWarnCount", 0.0);
|
||||||
Double warnRate = yesterdayWarnCount == 0 ? 100 : (todayWarnCount - yesterdayWarnCount) / yesterdayWarnCount * 100;
|
Double warnRate = todayTotalCount == 0 ? 0 : todayWarnCount / todayTotalCount * 100;
|
||||||
|
Double incWarnRate = yesterdayWarnCount == 0 ? 0 : (todayWarnCount - yesterdayWarnCount) / yesterdayWarnCount * 100;
|
||||||
|
|
||||||
dataStatistics.put("dayRate", dayRate);
|
dataStatistics.put("dayRate", dayRate);
|
||||||
dataStatistics.put("monthRate", monthRate);
|
dataStatistics.put("monthRate", monthRate);
|
||||||
dataStatistics.put("finishRate", todayFinishRate);
|
dataStatistics.put("finishRate", todayFinishRate);
|
||||||
dataStatistics.put("incFinishRate", incFinishRate);
|
dataStatistics.put("incFinishRate", incFinishRate);
|
||||||
dataStatistics.put("warnRate", warnRate);
|
dataStatistics.put("warnRate", warnRate);
|
||||||
|
dataStatistics.put("incWarnRate", incWarnRate);
|
||||||
return dataStatistics;
|
return dataStatistics;
|
||||||
})
|
})
|
||||||
.exceptionally(ex -> {
|
.exceptionally(ex -> {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
@ConfigurationProperties(prefix = "app")
|
@ConfigurationProperties(prefix = "app")
|
||||||
public class AppProperties {
|
public class AppProperties {
|
||||||
|
|
||||||
private int inOutGap = 300;
|
private int inOutGap = 60;
|
||||||
|
|
||||||
private DefaultPlace defaultPlace;
|
private DefaultPlace defaultPlace;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,19 @@ import com.njzscloud.common.core.tuple.Tuple2;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.common.mqtt.util.Mqtt;
|
import com.njzscloud.common.mqtt.util.Mqtt;
|
||||||
|
import com.njzscloud.supervisory.config.AppProperties;
|
||||||
import com.njzscloud.supervisory.device.contant.DeviceCode;
|
import com.njzscloud.supervisory.device.contant.DeviceCode;
|
||||||
import com.njzscloud.supervisory.device.mapper.DeviceInfoMapper;
|
import com.njzscloud.supervisory.device.mapper.DeviceInfoMapper;
|
||||||
import com.njzscloud.supervisory.device.pojo.entity.DeviceInfoEntity;
|
import com.njzscloud.supervisory.device.pojo.entity.DeviceInfoEntity;
|
||||||
import com.njzscloud.supervisory.order.contant.CheckStatus;
|
import com.njzscloud.supervisory.order.contant.CheckStatus;
|
||||||
import com.njzscloud.supervisory.order.contant.OrderStatus;
|
import com.njzscloud.supervisory.order.contant.OrderStatus;
|
||||||
import com.njzscloud.supervisory.order.contant.PaymentStatus;
|
import com.njzscloud.supervisory.order.contant.PaymentStatus;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderCarInOutEntity;
|
||||||
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
||||||
import com.njzscloud.supervisory.order.pojo.param.TruckComingOrderParam;
|
import com.njzscloud.supervisory.order.pojo.param.TruckComingOrderParam;
|
||||||
import com.njzscloud.supervisory.order.pojo.param.TruckLeavingOrderParam;
|
import com.njzscloud.supervisory.order.pojo.param.TruckLeavingOrderParam;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
||||||
|
import com.njzscloud.supervisory.order.service.OrderCarInOutService;
|
||||||
import com.njzscloud.supervisory.order.service.OrderInfoService;
|
import com.njzscloud.supervisory.order.service.OrderInfoService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -31,6 +34,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -44,6 +49,22 @@ import java.util.Objects;
|
||||||
public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoEntity> implements IService<DeviceInfoEntity> {
|
public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoEntity> implements IService<DeviceInfoEntity> {
|
||||||
private static final TimedCache<String, Tuple2<String, String>> waitOpen = CacheUtil.newTimedCache(600000);
|
private static final TimedCache<String, Tuple2<String, String>> waitOpen = CacheUtil.newTimedCache(600000);
|
||||||
private final OrderInfoService orderInfoService;
|
private final OrderInfoService orderInfoService;
|
||||||
|
private final OrderCarInOutService orderCarInOutService;
|
||||||
|
private final AppProperties appProperties;
|
||||||
|
|
||||||
|
public static void open(String oredrSn) {
|
||||||
|
Tuple2<String, String> tuple2 = waitOpen.get(oredrSn);
|
||||||
|
if (tuple2 == null) {
|
||||||
|
log.warn("开门: {} 无等待订单", oredrSn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String sn = tuple2.get_0();
|
||||||
|
String cid = tuple2.get_1();
|
||||||
|
log.info("开门: {} {}", sn, cid);
|
||||||
|
Mqtt.publish(cid + "/1/barrier", MapUtil.builder()
|
||||||
|
.put("deviceNo", sn)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
|
|
@ -87,17 +108,6 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
return this.getById(id);
|
return this.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param deviceInfoEntity 筛选条件
|
|
||||||
* @param pageParam 分页参数
|
|
||||||
* @return PageResult<DeviceInfoEntity> 分页结果
|
|
||||||
*/
|
|
||||||
public PageResult<DeviceInfoEntity> paging(PageParam pageParam, DeviceInfoEntity deviceInfoEntity) {
|
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<DeviceInfoEntity>query(deviceInfoEntity)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* public void recognition(DeviceRecognitionParam deviceRecognitionParam) {
|
/* public void recognition(DeviceRecognitionParam deviceRecognitionParam) {
|
||||||
String sn = deviceRecognitionParam.getSn();
|
String sn = deviceRecognitionParam.getSn();
|
||||||
DeviceInfoEntity deviceInfoEntity = this.getOne(Wrappers.<DeviceInfoEntity>lambdaQuery().eq(DeviceInfoEntity::getSn, sn));
|
DeviceInfoEntity deviceInfoEntity = this.getOne(Wrappers.<DeviceInfoEntity>lambdaQuery().eq(DeviceInfoEntity::getSn, sn));
|
||||||
|
|
@ -184,6 +194,17 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
|
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param deviceInfoEntity 筛选条件
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @return PageResult<DeviceInfoEntity> 分页结果
|
||||||
|
*/
|
||||||
|
public PageResult<DeviceInfoEntity> paging(PageParam pageParam, DeviceInfoEntity deviceInfoEntity) {
|
||||||
|
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<DeviceInfoEntity>query(deviceInfoEntity)));
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String, Object> report1(JSONObject data) {
|
public Map<String, Object> report1(JSONObject data) {
|
||||||
MapBuilder<String, Object> resBuilder = MapUtil.<String, Object>builder()
|
MapBuilder<String, Object> resBuilder = MapUtil.<String, Object>builder()
|
||||||
|
|
@ -192,6 +213,7 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
MapBuilder<String, Object> dataBuilder = MapUtil.<String, Object>builder()
|
MapBuilder<String, Object> dataBuilder = MapUtil.<String, Object>builder()
|
||||||
.put("order_no", "")
|
.put("order_no", "")
|
||||||
.put("type", 0);
|
.put("type", 0);
|
||||||
|
try {
|
||||||
String sn = data.getString("carDiscernCode");
|
String sn = data.getString("carDiscernCode");
|
||||||
String licensePlate = data.getString("carNumber");
|
String licensePlate = data.getString("carNumber");
|
||||||
DeviceInfoEntity deviceInfoEntity = this.getOne(Wrappers.<DeviceInfoEntity>lambdaQuery().eq(DeviceInfoEntity::getSn, sn));
|
DeviceInfoEntity deviceInfoEntity = this.getOne(Wrappers.<DeviceInfoEntity>lambdaQuery().eq(DeviceInfoEntity::getSn, sn));
|
||||||
|
|
@ -304,26 +326,15 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("上报数据处理异常: {}", data, e);
|
||||||
|
}
|
||||||
|
|
||||||
return resBuilder
|
return resBuilder
|
||||||
.put("data", dataBuilder.put("type", 0).build())
|
.put("data", dataBuilder.put("type", 0).build())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void open(String oredrSn) {
|
|
||||||
Tuple2<String, String> tuple2 = waitOpen.get(oredrSn);
|
|
||||||
if (tuple2 == null) {
|
|
||||||
log.warn("开门: {} 无等待订单", oredrSn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String sn = tuple2.get_0();
|
|
||||||
String cid = tuple2.get_1();
|
|
||||||
log.info("开门: {} {}", sn, cid);
|
|
||||||
Mqtt.publish(cid + "/1/barrier", MapUtil.builder()
|
|
||||||
.put("deviceNo", sn)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void open(String sn, String cid) {
|
private void open(String sn, String cid) {
|
||||||
log.info("开门: {} {}", sn, cid);
|
log.info("开门: {} {}", sn, cid);
|
||||||
Mqtt.publish(cid + "/1/barrier", MapUtil.builder()
|
Mqtt.publish(cid + "/1/barrier", MapUtil.builder()
|
||||||
|
|
@ -340,6 +351,7 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
.put("car_number", "")
|
.put("car_number", "")
|
||||||
.put("order_no", "")
|
.put("order_no", "")
|
||||||
.put("lane_code", "");
|
.put("lane_code", "");
|
||||||
|
try {
|
||||||
String sn = data.getString("carDiscernCode");
|
String sn = data.getString("carDiscernCode");
|
||||||
String licensePlate = data.getString("carNumber");
|
String licensePlate = data.getString("carNumber");
|
||||||
Long orderId = data.getLong("orderNo");
|
Long orderId = data.getLong("orderNo");
|
||||||
|
|
@ -392,15 +404,66 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
// 播语音
|
// 播语音
|
||||||
BigDecimal weight_ = new BigDecimal(weight);
|
BigDecimal weight_ = new BigDecimal(weight);
|
||||||
BigDecimal v = weight_.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
|
BigDecimal v = weight_.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
|
||||||
|
OrderStatus orderStatus = orderInfo.getOrderStatus();
|
||||||
|
|
||||||
|
if (orderStatus == OrderStatus.YiJinChang) {
|
||||||
|
Long carInOutId = orderInfo.getCarInOutId();
|
||||||
|
String orderInfoSn = orderInfo.getSn();
|
||||||
|
if (carInOutId == null) {
|
||||||
|
log.warn("订单{}不存在关联的车辆进场记录", orderInfoSn);
|
||||||
|
return resBuilder
|
||||||
|
.put("data", dataBuilder.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
OrderCarInOutEntity orderCarInOutEntity = orderCarInOutService.getById(carInOutId);
|
||||||
|
if (orderCarInOutEntity == null) {
|
||||||
|
log.warn("订单{}不存在关联的车辆进场记录", orderInfoSn);
|
||||||
|
return resBuilder
|
||||||
|
.put("data", dataBuilder.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
LocalDateTime inTime = orderCarInOutEntity.getInTime();
|
||||||
|
|
||||||
|
long interval = Duration.between(inTime, LocalDateTime.now()).toMillis() / 1000;
|
||||||
|
int inOutGap = appProperties.getInOutGap();
|
||||||
|
if (inOutGap <= 0) {
|
||||||
|
inOutGap = 60;
|
||||||
|
}
|
||||||
|
if (interval <= inOutGap) {
|
||||||
|
log.warn("车辆进场时间间隔不能小于{}秒,订单{}", inOutGap, orderInfoSn);
|
||||||
|
playVoice(sn, cid, "{}重复识别,请稍后再试", licensePlate);
|
||||||
|
return resBuilder
|
||||||
|
.put("data", dataBuilder.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
log.info("进道闸转出道闸,订单号:{}", orderInfoSn);
|
||||||
|
boolean b = orderInfoService.truckLeaving(new TruckLeavingOrderParam()
|
||||||
|
.setOrderId(orderId)
|
||||||
|
.setWeight(weight)
|
||||||
|
.setFrontPhoto(frontPhoto)
|
||||||
|
.setBodyPhoto(bodyPhoto),
|
||||||
|
0);
|
||||||
|
// 播语音
|
||||||
playVoice(sn, cid, "{}称重完成,磅重{}吨", licensePlate, v.toPlainString());
|
playVoice(sn, cid, "{}称重完成,磅重{}吨", licensePlate, v.toPlainString());
|
||||||
|
if (b) {
|
||||||
// 开门
|
// 开门
|
||||||
open(sn, cid);
|
open(sn, cid);
|
||||||
|
} else {
|
||||||
|
waitOpen.put(orderPagingResult.getSn(), Tuple2.create(sn, cid));
|
||||||
|
}
|
||||||
|
return resBuilder
|
||||||
|
.put("data", dataBuilder.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
// 开门
|
||||||
orderInfoService.truckComing(new TruckComingOrderParam()
|
orderInfoService.truckComing(new TruckComingOrderParam()
|
||||||
.setOrderId(orderId)
|
.setOrderId(orderId)
|
||||||
.setWeight(weight)
|
.setWeight(weight)
|
||||||
.setFrontPhoto(frontPhoto)
|
.setFrontPhoto(frontPhoto)
|
||||||
.setBodyPhoto(bodyPhoto),
|
.setBodyPhoto(bodyPhoto),
|
||||||
0);
|
0);
|
||||||
|
playVoice(sn, cid, "{}称重完成,磅重{}吨", licensePlate, v.toPlainString());
|
||||||
|
open(sn, cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deviceCode == DeviceCode.Chu) {
|
if (deviceCode == DeviceCode.Chu) {
|
||||||
|
|
@ -425,6 +488,9 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
playVoice(sn, cid, "{}称重异常,磅重{}吨", licensePlate, v.toPlainString());
|
playVoice(sn, cid, "{}称重异常,磅重{}吨", licensePlate, v.toPlainString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("上报数据处理异常: {}", data, e);
|
||||||
|
}
|
||||||
|
|
||||||
return resBuilder
|
return resBuilder
|
||||||
.put("data", dataBuilder.build())
|
.put("data", dataBuilder.build())
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import com.njzscloud.supervisory.biz.pojo.entity.*;
|
||||||
import com.njzscloud.supervisory.biz.service.BizAuditConfigService;
|
import com.njzscloud.supervisory.biz.service.BizAuditConfigService;
|
||||||
import com.njzscloud.supervisory.biz.service.BizWarnService;
|
import com.njzscloud.supervisory.biz.service.BizWarnService;
|
||||||
import com.njzscloud.supervisory.biz.service.TruckLocationTrackService;
|
import com.njzscloud.supervisory.biz.service.TruckLocationTrackService;
|
||||||
import com.njzscloud.supervisory.config.AppProperties;
|
|
||||||
import com.njzscloud.supervisory.constant.Constant;
|
import com.njzscloud.supervisory.constant.Constant;
|
||||||
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
||||||
import com.njzscloud.supervisory.device.service.DeviceInfoService;
|
import com.njzscloud.supervisory.device.service.DeviceInfoService;
|
||||||
|
|
@ -45,7 +44,10 @@ import com.njzscloud.supervisory.money.service.MoneyAccountService;
|
||||||
import com.njzscloud.supervisory.money.service.MoneyChangeDetailService;
|
import com.njzscloud.supervisory.money.service.MoneyChangeDetailService;
|
||||||
import com.njzscloud.supervisory.order.contant.*;
|
import com.njzscloud.supervisory.order.contant.*;
|
||||||
import com.njzscloud.supervisory.order.mapper.OrderInfoMapper;
|
import com.njzscloud.supervisory.order.mapper.OrderInfoMapper;
|
||||||
import com.njzscloud.supervisory.order.pojo.entity.*;
|
import com.njzscloud.supervisory.order.pojo.entity.OrderCargoPlaceEntity;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderExpenseItemsEntity;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderGoodsEntity;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
||||||
import com.njzscloud.supervisory.order.pojo.param.*;
|
import com.njzscloud.supervisory.order.pojo.param.*;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.*;
|
import com.njzscloud.supervisory.order.pojo.result.*;
|
||||||
import com.njzscloud.supervisory.order.utils.FileUtil;
|
import com.njzscloud.supervisory.order.utils.FileUtil;
|
||||||
|
|
@ -63,7 +65,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
@ -88,7 +89,6 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
private final ExpenseItemsConfigService expenseItemsConfigService;
|
private final ExpenseItemsConfigService expenseItemsConfigService;
|
||||||
private final TruckLocationTrackService truckLocationTrackService;
|
private final TruckLocationTrackService truckLocationTrackService;
|
||||||
private final BizWarnService bizWarnService;
|
private final BizWarnService bizWarnService;
|
||||||
private final AppProperties appProperties;
|
|
||||||
private final StationManageService stationManageService;
|
private final StationManageService stationManageService;
|
||||||
private final CloudVoiceboxService cloudVoiceboxService;
|
private final CloudVoiceboxService cloudVoiceboxService;
|
||||||
private final MoneyAccountService moneyAccountService;
|
private final MoneyAccountService moneyAccountService;
|
||||||
|
|
@ -974,37 +974,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
OrderInfoEntity orderInfoEntity = this.getById(truckComingOrderParam.getOrderId());
|
OrderInfoEntity orderInfoEntity = this.getById(truckComingOrderParam.getOrderId());
|
||||||
Assert.notNull(orderInfoEntity, () -> Exceptions.clierr("订单不存在"));
|
Assert.notNull(orderInfoEntity, () -> Exceptions.clierr("订单不存在"));
|
||||||
OrderStatus orderStatus = orderInfoEntity.getOrderStatus();
|
OrderStatus orderStatus = orderInfoEntity.getOrderStatus();
|
||||||
if (orderStatus == OrderStatus.YiJinChang) {
|
|
||||||
Long carInOutId = orderInfoEntity.getCarInOutId();
|
|
||||||
if (carInOutId == null) {
|
|
||||||
log.warn("订单{}不存在关联的车辆进场记录", orderInfoEntity.getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
OrderCarInOutEntity orderCarInOutEntity = orderCarInOutService.getById(carInOutId);
|
|
||||||
if (orderCarInOutEntity == null) {
|
|
||||||
log.warn("订单{}不存在关联的车辆进场记录", orderInfoEntity.getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LocalDateTime inTime = orderCarInOutEntity.getInTime();
|
|
||||||
|
|
||||||
long interval = Duration.between(inTime, LocalDateTime.now()).toMillis() / 1000;
|
|
||||||
int inOutGap = appProperties.getInOutGap();
|
|
||||||
if (inOutGap <= 0) {
|
|
||||||
inOutGap = 300;
|
|
||||||
}
|
|
||||||
if (interval <= inOutGap) {
|
|
||||||
log.warn("车辆进场时间间隔不能小于{}秒,订单{}", inOutGap, orderInfoEntity.getSn());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
log.info("进道闸转出道闸,订单{}", orderInfoEntity.getSn());
|
|
||||||
truckLeaving(new TruckLeavingOrderParam()
|
|
||||||
.setOrderId(orderInfoEntity.getId())
|
|
||||||
.setWeight(truckComingOrderParam.getWeight())
|
|
||||||
.setFrontPhoto(truckComingOrderParam.getFrontPhoto())
|
|
||||||
.setBodyPhoto(truckComingOrderParam.getBodyPhoto()),
|
|
||||||
0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Assert.isTrue(orderStatus == OrderStatus.QingYunZhong, () -> Exceptions.clierr("当前订单状态,无法进场"));
|
Assert.isTrue(orderStatus == OrderStatus.QingYunZhong, () -> Exceptions.clierr("当前订单状态,无法进场"));
|
||||||
|
|
||||||
OrderCategory orderCategory = orderInfoEntity.getOrderCategory();
|
OrderCategory orderCategory = orderInfoEntity.getOrderCategory();
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,15 @@
|
||||||
LIMIT #{count}
|
LIMIT #{count}
|
||||||
</select>
|
</select>
|
||||||
<select id="baseInfo" resultType="java.util.Map">
|
<select id="baseInfo" resultType="java.util.Map">
|
||||||
SELECT biz_obj bizObj, COUNT(*) `count`
|
SELECT biz_obj bizObj,
|
||||||
|
CASE biz_obj
|
||||||
|
WHEN 'WuYe' THEN '物业'
|
||||||
|
WHEN 'SheQu' THEN '社区'
|
||||||
|
WHEN 'QiYe' THEN '企业'
|
||||||
|
WHEN 'GeTi' THEN '个体户'
|
||||||
|
ELSE ''
|
||||||
|
END bizObjTxt,
|
||||||
|
COUNT(*) `count`
|
||||||
FROM sys_user
|
FROM sys_user
|
||||||
WHERE biz_obj IN (
|
WHERE biz_obj IN (
|
||||||
'WuYe',
|
'WuYe',
|
||||||
|
|
@ -200,16 +208,24 @@
|
||||||
)
|
)
|
||||||
AND deleted = 0
|
AND deleted = 0
|
||||||
GROUP BY biz_obj
|
GROUP BY biz_obj
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'XiaoNa' bizObj,
|
||||||
|
'消纳场' bizObjTxt,
|
||||||
|
COUNT(*) `bizObjTxt`
|
||||||
|
FROM biz_company
|
||||||
|
WHERE station = 1
|
||||||
|
AND deleted = 0
|
||||||
|
AND station_name NOT LIKE '%测试%'
|
||||||
</select>
|
</select>
|
||||||
<select id="disposeInfo" resultType="java.util.Map">
|
<select id="disposeInfo" resultType="java.util.Map">
|
||||||
SELECT c.category_name categoryName, ROUND(IFNULL(SUM(d.settle_weight), 0) / 1000, 2) weight
|
SELECT b.goods_name goodsName, ROUND(IFNULL(SUM(d.settle_weight), 0) / 1000, 2) weight
|
||||||
FROM order_info a
|
FROM order_info a
|
||||||
INNER JOIN order_goods b ON b.id = a.goods_id
|
INNER JOIN order_goods b ON b.id = a.goods_id
|
||||||
INNER JOIN goods_category c ON c.id = b.goods_category_id AND c.deleted = 0
|
INNER JOIN goods_category c ON c.id = b.goods_category_id AND c.deleted = 0
|
||||||
INNER JOIN order_car_in_out d ON d.id = a.car_in_out_id
|
INNER JOIN order_car_in_out d ON d.id = a.car_in_out_id
|
||||||
WHERE a.order_status = 'YiWanCheng'
|
WHERE a.order_status = 'YiWanCheng'
|
||||||
AND a.deleted = 0
|
AND a.deleted = 0
|
||||||
GROUP BY c.category_name
|
GROUP BY b.goods_name
|
||||||
</select>
|
</select>
|
||||||
<select id="garbageInfo" resultType="java.util.Map">
|
<select id="garbageInfo" resultType="java.util.Map">
|
||||||
SELECT area_name areaName, weight
|
SELECT area_name areaName, weight
|
||||||
|
|
@ -282,7 +298,15 @@
|
||||||
LIMIT 50
|
LIMIT 50
|
||||||
</select>
|
</select>
|
||||||
<select id="warningInfo" resultType="java.util.Map">
|
<select id="warningInfo" resultType="java.util.Map">
|
||||||
SELECT warn_category warnCategory, count(*) `count`
|
SELECT warn_category warnCategory,
|
||||||
|
case warn_category
|
||||||
|
when 'SAFETY' then '订单超时预警'
|
||||||
|
when 'SPEED' then '车辆超速预警'
|
||||||
|
when 'ROUTE' then '路线偏离预警'
|
||||||
|
when 'EQUIPMENT' then 'GPS异常预警'
|
||||||
|
else ''
|
||||||
|
end warnCategoryTxt,
|
||||||
|
count(*) `count`
|
||||||
FROM biz_warn
|
FROM biz_warn
|
||||||
GROUP BY warn_category
|
GROUP BY warn_category
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue