固定配额改成时段限制,不在做每日配额-3

dev
wuwenxiong 2021-08-30 16:26:43 +08:00
parent b2558ca4f2
commit 29845ad96c
2 changed files with 93 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import com.cowr.common.view.Result;
import com.cowr.model.OrderclusterTruck; import com.cowr.model.OrderclusterTruck;
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckPKValidator; import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckPKValidator;
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService; import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckValidator;
import com.jfinal.aop.Before; import com.jfinal.aop.Before;
import com.jfinal.core.Controller; import com.jfinal.core.Controller;

View File

@ -5,6 +5,7 @@ import com.cowr.common.enums.Enums;
import com.cowr.common.enums.OrderStateEnum; import com.cowr.common.enums.OrderStateEnum;
import com.cowr.common.enums.OrderTypeEnum; import com.cowr.common.enums.OrderTypeEnum;
import com.cowr.common.enums.TruckRodState; import com.cowr.common.enums.TruckRodState;
import com.cowr.common.utils.DateTimeUtil;
import com.cowr.common.view.Result; import com.cowr.common.view.Result;
import com.cowr.local.ssjygl.devicectrl.common.Const; import com.cowr.local.ssjygl.devicectrl.common.Const;
import com.cowr.local.ssjygl.main.CliCacheData; import com.cowr.local.ssjygl.main.CliCacheData;
@ -279,6 +280,30 @@ public class TransportSyncService {
} }
// 判断是否有配额、是否在有效时间段内 // 判断是否有配额、是否在有效时间段内
Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId());
if (ordercluster == null) {
log.error("未找到集团订单信息");
Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", "未找到集团订单信息"));
return result;
}
BigDecimal total_weight = ordercluster.getTotalWeight();
Date start_time = ordercluster.getStartTime();
Date cutoff_time = ordercluster.getCutoffTime();
String query_start_time = DateTimeUtil.sdf.get().format(start_time);
String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time);
if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) {
log.error("【%s】无配额", ordercluster.getCustomerName());
Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", ordercluster.getCustomerName() + " 无配额"));
return result;
}
if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) {
log.error("【%s】有效入场时间为【%s】至【%s】", result.getLicense(), query_start_time, query_cutoff_time);
Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", result.getLicense() + " 有效入场时间为" + query_start_time + "至" + query_cutoff_time));
return result;
}
Transport transport = new Transport(); Transport transport = new Transport();
transport.setId(StrKit.getRandomUUID()); transport.setId(StrKit.getRandomUUID());
@ -437,8 +462,33 @@ public class TransportSyncService {
OrderclusterTruck ot = OrderclusterTruckService.me.checkValidLicense(supermarket_id, result.getLicense()); OrderclusterTruck ot = OrderclusterTruckService.me.checkValidLicense(supermarket_id, result.getLicense());
if (ot == null) { if (ot == null) {
log.error("车牌【%s】未授权可能是在黑名单中", result.getLicense()); log.error("【%s】未授权可能是在黑名单中", result.getLicense());
//TODO: 发消息到web端 Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", result.getLicense() + " 未授权。可能是在黑名单中"));
return result;
}
// 判断是否有配额、是否在有效时间段内
Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId());
if (ordercluster == null) {
log.error("未找到集团订单信息");
Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", "未找到集团订单信息"));
return result;
}
BigDecimal total_weight = ordercluster.getTotalWeight();
Date start_time = ordercluster.getStartTime();
Date cutoff_time = ordercluster.getCutoffTime();
String query_start_time = DateTimeUtil.sdf.get().format(start_time);
String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time);
if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) {
log.error("【%s】无配额", ordercluster.getCustomerName());
Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", ordercluster.getCustomerName() + " 无配额"));
return result;
}
if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) {
log.error("【%s】有效入场时间为【%s】至【%s】", result.getLicense(), query_start_time, query_cutoff_time);
Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", result.getLicense() + " 有效入场时间为" + query_start_time + "至" + query_cutoff_time));
return result; return result;
} }
@ -727,6 +777,26 @@ public class TransportSyncService {
return Result.failedstr("车辆【%s】有未完成的入场记录请先处理完毕", truck_license); return Result.failedstr("车辆【%s】有未完成的入场记录请先处理完毕", truck_license);
} }
// 判断是否有配额、是否在有效时间段内
Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId());
if (ordercluster == null) {
return Result.failedstr("车辆【%s】未找到集团订单信息", truck_license);
}
BigDecimal total_weight = ordercluster.getTotalWeight();
Date start_time = ordercluster.getStartTime();
Date cutoff_time = ordercluster.getCutoffTime();
String query_start_time = DateTimeUtil.sdf.get().format(start_time);
String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time);
if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) {
return Result.failedstr("【%s】无配额", ordercluster.getCustomerName());
}
if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) {
return Result.failedstr("【%s】有效入场时间为【%s】至【%s】", truck_license, query_start_time, query_cutoff_time);
}
Date now = new Date(); Date now = new Date();
Transport transport = new Transport(); Transport transport = new Transport();
@ -816,6 +886,27 @@ public class TransportSyncService {
return Result.failedstr("车辆【%s】有未完成的入场记录请先处理完毕", truck_license); return Result.failedstr("车辆【%s】有未完成的入场记录请先处理完毕", truck_license);
} }
// 判断是否有配额、是否在有效时间段内
Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId());
if (ordercluster == null) {
return Result.failedstr("车辆【%s】未找到集团订单信息", truck_license);
}
BigDecimal total_weight = ordercluster.getTotalWeight();
Date start_time = ordercluster.getStartTime();
Date cutoff_time = ordercluster.getCutoffTime();
String query_start_time = DateTimeUtil.sdf.get().format(start_time);
String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time);
if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) {
return Result.failedstr("【%s】无配额", ordercluster.getCustomerName());
}
if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) {
return Result.failedstr("【%s】有效入场时间为【%s】至【%s】", truck_license, query_start_time, query_cutoff_time);
}
Transport transport = new Transport(); Transport transport = new Transport();
transport.setId(StrKit.getRandomUUID()); transport.setId(StrKit.getRandomUUID());
transport.setSupermarketId(supermarket_id); transport.setSupermarketId(supermarket_id);