提交 4063a07b authored 作者: jiangwujie's avatar jiangwujie

feature(电子围栏): 短信通知增加判断当前车辆是否是监装子任务的车辆,增加短信次数限制

上级 55e4cb26
......@@ -42,4 +42,13 @@ public class RedisConstants {
*/
public static final String LINE_WARN_WEATHER = "clx-performance:lineWarn:weather:";
/**
* 电子围栏短信通知 未装车
*/
public static final String NOTICE_MESSAGE_LIMIT_UNLOAD = "clx-performance:notice_message_limit_unload:";
/**
* 电子围栏短信通知 未监装
*/
public static final String NOTICE_MESSAGE_LIMIT_UNSUPERVISED = "clx-performance:notice_message_limit_unsupervised:";
}
......@@ -1796,7 +1796,6 @@ public class OrderChildServiceImpl implements OrderChildService {
}
/**
* todo 要改成两个
* 获取监装
* @param orderNo
* @param childNo
......@@ -1822,7 +1821,6 @@ public class OrderChildServiceImpl implements OrderChildService {
if (Objects.isNull(supervisionLoadInfo)) {//有监装信息
return null;
}
//通过运单号查询监装监卸子任务状态
return new SuperviseInfo(supervisionLoadInfo.getTaskContracts(), supervisionLoadInfo.getTaskMobile(), supervisionLoadInfo.getTaskAddress());
}
......@@ -1832,7 +1830,7 @@ public class OrderChildServiceImpl implements OrderChildService {
* @param childNo
* @return
*/
private SuperviseInfo getSuperviseInfoWithSubStatus(String orderNo, String childNo) {
private SuperviseInfo getSuperviseInfoWithSubStatus(String orderNo, String childNo, String truckNo) {
NeedAlertSuperviseInfoResultVO result = new NeedAlertSuperviseInfoResultVO();
App app = appConfig.getPurchaseManageApp();//对接马上来供应链配置信息
//组装配置信息
......@@ -1860,10 +1858,15 @@ public class OrderChildServiceImpl implements OrderChildService {
if (!supervisionLoadTruckInfoDto.succeed()) {//接口调用失败
return null;
}
//监装子任务状态
SupervisionLoadTruckInfoDto supervisionLoadTruckInfo = supervisionLoadTruckInfoDto.getData();
if (Objects.isNull(supervisionLoadTruckInfo) || !supervisionLoadTruckInfo.getLoadStatus()) {
return null;
}
//判断当前卡车是否是监装车辆
if (!Objects.equals(truckNo, supervisionLoadTruckInfo.getTruckNo())) {
return null;
}
return new SuperviseInfo(supervisionLoadInfo.getTaskContracts(), supervisionLoadInfo.getTaskMobile(), supervisionLoadInfo.getTaskAddress());
}
......@@ -3266,6 +3269,7 @@ public class OrderChildServiceImpl implements OrderChildService {
for (OrderChild child : orderChildList) {
String childNo = child.getChildNo();
String truckNo = child.getTruckNo();
Long driverUserNo = child.getDriverUserNo();
//获取卡车的位置
TruckTraceDTO truckTraceDTO = truckTraceMap.get(truckNo);
log.info("运单号:{},卡车:{},中交兴路地图位置:{}", childNo, truckNo, truckTraceDTO);
......@@ -3276,8 +3280,8 @@ public class OrderChildServiceImpl implements OrderChildService {
truckLatitudeY = truckTraceDTO.getLocation()[1];
}
if (truckLongitudeX == null || truckLatitudeY == null) {
BigDecimal[] location = truckTraceService.getTruckCurrentPosition(truckNo);
log.info("运单号:{},卡车:{},卡车经纬度:{}", childNo, truckNo, location);
BigDecimal[] location = truckTraceService.getCurrentPosition(truckNo, driverUserNo);
log.info("运单号:{},卡车:{},卡车/司机经纬度:{}", childNo, truckNo, location);
if (location != null && location.length >= 2) {
truckLongitudeX = location[0];
truckLatitudeY = location[1];
......@@ -3289,10 +3293,10 @@ public class OrderChildServiceImpl implements OrderChildService {
BigDecimal siteLongitudeX = orderGoods.getSendLongitude();
BigDecimal siteLatitudeY = orderGoods.getSendLatitude();
log.info("运单号:{},卡车:{},status:{},站点经度:{},站点纬度:{},卡车经度:{},卡车纬度:{}", childNo, truckNo, child.getStatus(), siteLongitudeX, siteLatitudeY, truckLongitudeX, truckLatitudeY);
//调高德获取距离
if (Objects.isNull(truckLongitudeX) || Objects.isNull(truckLatitudeY)) {
continue;
}
//调高德获取距离
Integer distance = getGdRoute(truckNo, truckLongitudeX, truckLatitudeY, siteLongitudeX,
siteLatitudeY);
if (distance == null) {
......@@ -3308,16 +3312,28 @@ public class OrderChildServiceImpl implements OrderChildService {
//超出货源地x公里范围了,且通知状态为未通知
// 到达货源地
if (Objects.equals(child.getStatus(), OrderChildEnum.Status.ARRIVE_SEND.getCode())) {
Integer count = (Integer) redisTemplate.opsForValue().get(RedisConstants.NOTICE_MESSAGE_LIMIT_UNLOAD + childNo);
if (count != null && count > 3) {
log.info("{}超出货源地x公里范围了,运单{}为到达货源地状态,运单已发送短信次数:{},不进行短信通知", truckNo, childNo, count);
continue;
}
log.info("{}超出货源地x公里范围了,运单{}为到达货源地状态,发送短信", truckNo, childNo);
sendLoadSms(child.getDriverMobile(), child.getTruckNo(), child.getChildNo());
redisTemplate.opsForValue().increment(RedisConstants.NOTICE_MESSAGE_LIMIT_UNLOAD + childNo);
}
// 已装货
if (Objects.equals(child.getStatus(), OrderChildEnum.Status.LOAD.getCode())) {
SuperviseInfo superviseInfo = getSuperviseInfoWithSubStatus(child.getOrderNo(), child.getChildNo());
SuperviseInfo superviseInfo = getSuperviseInfoWithSubStatus(child.getOrderNo(), child.getChildNo(), child.getTruckNo());
log.info("运单号:{},卡车:{},监装信息{}", childNo, truckNo, superviseInfo);
if (superviseInfo != null) {
Integer count = (Integer) redisTemplate.opsForValue().get(RedisConstants.NOTICE_MESSAGE_LIMIT_UNSUPERVISED + childNo);
if (count != null && count > 3) {
log.info("{}超出货源地x公里范围了,运单{}为装货成功状态,运单已发送短信次数:{},不进行短信通知", truckNo, childNo, count);
continue;
}
log.info("{}超出货源地x公里范围了,运单{}为装货成功状态,发送短信", truckNo, childNo);
sendSupervisionSms(child.getDriverMobile(), child.getTruckNo(), child.getChildNo(), superviseInfo.getTaskAddress());
redisTemplate.opsForValue().increment(RedisConstants.NOTICE_MESSAGE_LIMIT_UNSUPERVISED + childNo);
}
}
// 修改 通知状态 为已通知
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论