Browse Source

Merge remote-tracking branch 'origin/master'

master
梁超 1 month ago
parent
commit
22bb7b0676

+ 9
- 10
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/order/AbstractOrderManager.java View File

issueOrderChannelNoticeRepo.persist(quDaoCallBackResult); 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); Point2D.Double aDouble = new Point2D.Double(latitude, longitude);
QtkServiceHall byServiceHallId = hallRepo.findByServiceHallId(channelId);
if (byServiceHallId == null) {
if (serviceHall == null) {
throw newBusinessException("网点不存在,请确认网点编号"); throw newBusinessException("网点不存在,请确认网点编号");
} }
if (byServiceHallId.getLongitude() == null || byServiceHallId.getLatitude() == null)
if (serviceHall.getLongitude() == null || serviceHall.getLatitude() == null)
throw newBusinessException("网点经纬度信息未配置"); throw newBusinessException("网点经纬度信息未配置");


String minserviceHallName = "";//最近网点 String minserviceHallName = "";//最近网点
double serlatitude = 0; 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); double v = calculateDistance(aDouble, point2D);
if (v < byServiceHallId.getRadial()) {
if (v < serviceHall.getRadial()) {
return; return;
} else if (min == 0 || v < min) { } else if (min == 0 || v < min) {
minserviceHallName = byServiceHallId.getName();
minserviceHallName = serviceHall.getName();
min = v; 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) { for (QtkServicehallLocation serviceHallLocation : qtkServiceHallLocations) {
Point2D.Double point = new Point2D.Double(serviceHallLocation.getLatitude(), serviceHallLocation.getLongitude()); Point2D.Double point = new Point2D.Double(serviceHallLocation.getLatitude(), serviceHallLocation.getLongitude());
double s = calculateDistance(aDouble, point); double s = calculateDistance(aDouble, point);

+ 23
- 3
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/order/OrderInitManager.java View File



import cn.com.taiji.common.manager.net.http.ServiceHandleException; import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.common.pub.TimeTools; 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.QtkCardInfo;
import cn.com.taiji.core.entity.basic.QtkServiceHall;
import cn.com.taiji.core.entity.dict.EnableStatus; 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.SourceType;
import cn.com.taiji.core.entity.dict.basic.UserType; import cn.com.taiji.core.entity.dict.basic.UserType;
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsIssueOrderQueryRequest; 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.ods.oqs.issue.OqsIssueOrderQueryResponse;
import cn.com.taiji.core.model.comm.protocol.valid.ErrorMsgBuilder; 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.IssueOrderPayRepo;
import cn.com.taiji.core.repo.jpa.issue.IssueProductPayRepo; import cn.com.taiji.core.repo.jpa.issue.IssueProductPayRepo;
import cn.com.taiji.core.repo.jpa.issue.IssueProductPromotionRepo; import cn.com.taiji.core.repo.jpa.issue.IssueProductPromotionRepo;
public static final String OLD_ORDER = "oldOrder"; public static final String OLD_ORDER = "oldOrder";
public static final String STAFF = "staff"; public static final String STAFF = "staff";
public static final String LOCK = "lock"; public static final String LOCK = "lock";
@Autowired
private QtkAgencyRepo qtkAgencyRepo;


public OrderInitManager() { public OrderInitManager() {
super(DataType.ORDER_INIT); super(DataType.ORDER_INIT);
@Override @Override
protected void businessValidateInternal(ErrorMsgBuilder builder, OrderInitRequest request, ServiceLogEvent event, protected void businessValidateInternal(ErrorMsgBuilder builder, OrderInitRequest request, ServiceLogEvent event,
Map<String, Object> dataStream) throws ServiceHandleException { Map<String, Object> dataStream) throws ServiceHandleException {
// FIXME 验渠道编号
String lockKey = MyFinals.VEHICLE_LOCK_KEY + request.getVehiclePlate(); String lockKey = MyFinals.VEHICLE_LOCK_KEY + request.getVehiclePlate();
RLock lock = redissonClient.getLock(lockKey); RLock lock = redissonClient.getLock(lockKey);
boolean tryLock = false; boolean tryLock = false;
if (!tryLock) { if (!tryLock) {
throw newBusinessException("该车牌重复下单!"); 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); checkProduct(request, dataStream);
dataStream.put(STAFF, staff); 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 @Override
protected void persistInternal(OrderInitRequest request, ServiceLogEvent event, Map<String, Object> dataStream) protected void persistInternal(OrderInitRequest request, ServiceLogEvent event, Map<String, Object> dataStream)
throws ServiceHandleException { throws ServiceHandleException {

Loading…
Cancel
Save