|
|
@@ -2,7 +2,9 @@ package cn.com.taiji.ias.manager.order; |
|
|
|
|
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.com.taiji.common.pub.TimeTools; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkAgency; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCardInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkServiceHall; |
|
|
|
import cn.com.taiji.core.entity.dict.EnableStatus; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.SourceType; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.UserType; |
|
|
@@ -19,6 +21,7 @@ import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsCardQueryResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsIssueOrderQueryRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsIssueOrderQueryResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.valid.ErrorMsgBuilder; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkAgencyRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueOrderPayRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueProductPayRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueProductPromotionRepo; |
|
|
@@ -47,6 +50,8 @@ public class OrderInitManager extends AbstractOrderManager<OrderInitRequest> { |
|
|
|
public static final String OLD_ORDER = "oldOrder"; |
|
|
|
public static final String STAFF = "staff"; |
|
|
|
public static final String LOCK = "lock"; |
|
|
|
@Autowired |
|
|
|
private QtkAgencyRepo qtkAgencyRepo; |
|
|
|
|
|
|
|
public OrderInitManager() { |
|
|
|
super(DataType.ORDER_INIT); |
|
|
@@ -74,7 +79,7 @@ public class OrderInitManager extends AbstractOrderManager<OrderInitRequest> { |
|
|
|
@Override |
|
|
|
protected void businessValidateInternal(ErrorMsgBuilder builder, OrderInitRequest request, ServiceLogEvent event, |
|
|
|
Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
// FIXME 验渠道编号 |
|
|
|
|
|
|
|
String lockKey = MyFinals.VEHICLE_LOCK_KEY + request.getVehiclePlate(); |
|
|
|
RLock lock = redissonClient.getLock(lockKey); |
|
|
|
boolean tryLock = false; |
|
|
@@ -86,9 +91,11 @@ public class OrderInitManager extends AbstractOrderManager<OrderInitRequest> { |
|
|
|
if (!tryLock) { |
|
|
|
throw newBusinessException("该车牌重复下单!"); |
|
|
|
} |
|
|
|
//校验渠道网点是否禁用 |
|
|
|
QtkServiceHall qtkServiceHall = checkChannelandAgency(request); |
|
|
|
// 渠道订单校验坐标 |
|
|
|
if (request.getIssueType().intValue()==2) { |
|
|
|
checkElecFence(request.getLatitude(), request.getLongitude(), request.getChannelId()); |
|
|
|
if (request.getIssueType() ==2) { |
|
|
|
checkElecFence(request.getLatitude(), request.getLongitude(), qtkServiceHall); |
|
|
|
} |
|
|
|
// 校验产品 |
|
|
|
checkProduct(request, dataStream); |
|
|
@@ -106,6 +113,19 @@ public class OrderInitManager extends AbstractOrderManager<OrderInitRequest> { |
|
|
|
dataStream.put(STAFF, staff); |
|
|
|
} |
|
|
|
|
|
|
|
private QtkServiceHall checkChannelandAgency(OrderInitRequest request) throws ServiceHandleException { |
|
|
|
QtkAgency agency = qtkAgencyRepo.findByAgencyId(request.getAgentId()); |
|
|
|
if (agency == null) throw newBusinessException("此渠道未在黔通备案"); |
|
|
|
if (EnableStatus.DISABLE.equals(agency.getStatus())) { |
|
|
|
throw newBusinessException("渠道已关闭,不可进行操作"); |
|
|
|
} |
|
|
|
QtkServiceHall serviceHallId = hallRepo.findByServiceHallId(request.getChannelId()); |
|
|
|
if (serviceHallId == null) throw newBusinessException("此网点未在黔通备案"); |
|
|
|
if (EnableStatus.DISABLE.equals(serviceHallId.getState())) throw newBusinessException("网点已关闭,不可进行操作"); |
|
|
|
return serviceHallId; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void persistInternal(OrderInitRequest request, ServiceLogEvent event, Map<String, Object> dataStream) |
|
|
|
throws ServiceHandleException { |