浏览代码

Merge remote-tracking branch 'origin/master'

master
梁超 1 个月前
父节点
当前提交
22bb7b0676

+ 9
- 10
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/order/AbstractOrderManager.java 查看文件

@@ -192,14 +192,13 @@ public abstract class AbstractOrderManager<T extends AbstractSignTypeRequest<?>>
issueOrderChannelNoticeRepo.persist(quDaoCallBackResult);
}

protected void checkElecFence(Double latitude, Double longitude, String channelId) throws ServiceHandleException {
protected void checkElecFence(Double latitude, Double longitude, QtkServiceHall serviceHall) throws ServiceHandleException {
//渠道传的地点
Point2D.Double aDouble = new Point2D.Double(latitude, longitude);
QtkServiceHall byServiceHallId = hallRepo.findByServiceHallId(channelId);
if (byServiceHallId == null) {
if (serviceHall == null) {
throw newBusinessException("网点不存在,请确认网点编号");
}
if (byServiceHallId.getLongitude() == null || byServiceHallId.getLatitude() == null)
if (serviceHall.getLongitude() == null || serviceHall.getLatitude() == null)
throw newBusinessException("网点经纬度信息未配置");

String minserviceHallName = "";//最近网点
@@ -208,19 +207,19 @@ public abstract class AbstractOrderManager<T extends AbstractSignTypeRequest<?>>
double serlatitude = 0;
//===================================单经纬度校验=====================================
//网点地点
Point2D.Double point2D = new Point2D.Double(byServiceHallId.getLatitude(), byServiceHallId.getLongitude());
Point2D.Double point2D = new Point2D.Double(serviceHall.getLatitude(), serviceHall.getLongitude());
//两点距离
double v = calculateDistance(aDouble, point2D);
if (v < byServiceHallId.getRadial()) {
if (v < serviceHall.getRadial()) {
return;
} else if (min == 0 || v < min) {
minserviceHallName = byServiceHallId.getName();
minserviceHallName = serviceHall.getName();
min = v;
serlongitude = byServiceHallId.getLongitude();
serlatitude = byServiceHallId.getLatitude();
serlongitude = serviceHall.getLongitude();
serlatitude = serviceHall.getLatitude();
}
//===================================多经纬度校验=====================================
List<QtkServicehallLocation> qtkServiceHallLocations = locationRepo.findByServicehallId(byServiceHallId.getServiceHallId());
List<QtkServicehallLocation> qtkServiceHallLocations = locationRepo.findByServicehallId(serviceHall.getServiceHallId());
for (QtkServicehallLocation serviceHallLocation : qtkServiceHallLocations) {
Point2D.Double point = new Point2D.Double(serviceHallLocation.getLatitude(), serviceHallLocation.getLongitude());
double s = calculateDistance(aDouble, point);

+ 23
- 3
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/order/OrderInitManager.java 查看文件

@@ -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 {

正在加载...
取消
保存