From 5b8a25c22f5d3d20d20475503cc9f3c31ea344ab Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 05 二月 2024 18:09:49 +0800
Subject: [PATCH] BUG修改
---
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 947 ++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 648 insertions(+), 299 deletions(-)
diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
index 8357092..5ceafb6 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -5,28 +5,47 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.util.ToolUtil;
+import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread;
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService;
-import com.stylefeng.guns.modular.system.dao.RegionMapper;
-import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper;
-import com.stylefeng.guns.modular.system.dao.SysIntegralMapper;
-import com.stylefeng.guns.modular.system.dao.SystemPriceMapper;
+import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
+import com.stylefeng.guns.modular.system.dao.*;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.*;
+import com.stylefeng.guns.modular.system.util.GoogleMap.*;
+import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil;
+import com.stylefeng.guns.modular.system.util.Tingg.TinggPayoutUtil;
+import com.stylefeng.guns.modular.system.util.Tingg.model.AuthStatus;
+import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest;
+import com.stylefeng.guns.modular.system.util.Tingg.model.PayoutResponse;
+import com.stylefeng.guns.modular.system.util.Tingg.model.Results;
+import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils;
import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
import com.stylefeng.guns.modular.taxi.model.PaymentRecord;
import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService;
import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.nodes.FormElement;
+import org.jsoup.select.Elements;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
import java.util.*;
@@ -65,12 +84,10 @@
@Autowired
private IUserInfoService userInfoService;
-
+ @Resource
+ private UserActivityDiscount1Mapper userActivityDiscount1Mapper;
@Autowired
private IPaymentRecordService paymentRecordService;
-
- /* @Autowired
- private ICBCPayUtil icbcPayUtil;*/
@Autowired
private PayMoneyUtil payMoneyUtil;
@@ -102,10 +119,28 @@
@Autowired
private GDMapElectricFenceUtil gdMapElectricFenceUtil;
+ @Autowired
+ private IUserCouponRecordService userCouponRecordService;
+
+ @Autowired
+ private IBankCardService bankCardService;
+
+ @Autowired
+ private TinggPayoutUtil tinggPayoutUtil;
+
@Value("${callbackPath}")
private String callbackPath;
+ @Value("${spring.mail.template-path}")
+ private String templatePath;
+
+ @Autowired
+ private TEmailService emailService;
+
private static List<Integer> orderIds = new ArrayList<>();
+
+ @Autowired
+ private IPhoneService phoneService;
@@ -117,18 +152,18 @@
*/
@Override
public ResultUtil judgingTheCity(String startLonLat, String endAddress) throws Exception {
- Map<String, String> sgeocode = gdMapGeocodingUtil.geocode(startLonLat.split(",")[0], startLonLat.split(",")[1]);
- String scityCode = sgeocode.get("cityCode");
- Map<String, Object> geocoding = gdMapGeocodingUtil.geocoding(endAddress);
- if(Integer.valueOf(geocoding.get("status").toString()) != 0){
- return ResultUtil.error("收货地址有误,无法查询具体地址信息");
- }
- List<String> list = (List<String>)geocoding.get("data");
- Map<String, String> egeocode = gdMapGeocodingUtil.geocode(list.get(0).split(",")[0], list.get(0).split(",")[1]);
- String ecityCode = egeocode.get("cityCode");
- if(!scityCode.equals(ecityCode)){
- return ResultUtil.error("已超出服务范围,请重新选择跨城小件物流");
- }
+// Map<String, String> sgeocode = gdMapGeocodingUtil.geocode(startLonLat.split(",")[0], startLonLat.split(",")[1]);
+// String scityCode = sgeocode.get("cityCode");
+// Map<String, Object> geocoding = gdMapGeocodingUtil.geocoding(endAddress);
+// if(Integer.valueOf(geocoding.get("status").toString()) != 0){
+// return ResultUtil.error("收货地址有误,无法查询具体地址信息");
+// }
+// List<String> list = (List<String>)geocoding.get("data");
+// Map<String, String> egeocode = gdMapGeocodingUtil.geocode(list.get(0).split(",")[0], list.get(0).split(",")[1]);
+// String ecityCode = egeocode.get("cityCode");
+// if(!scityCode.equals(ecityCode)){
+// return ResultUtil.error("已超出服务范围");
+// }
return ResultUtil.success();
}
@@ -142,38 +177,18 @@
* @throws Exception
*/
@Override
- public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer uid) throws Exception {
- Company query = companyCityService.query(startLonLat.split(",")[0], startLonLat.split(",")[1]);
- if(null == query){
- return ResultUtil.error("预约取货点暂无企业服务");
+ public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endLonLat, String endAddress, Integer uid, Integer language) throws Exception {
+ String[] split = endLonLat.split(",");
+ Double lng = Double.valueOf(split[0]);
+ Double lat = Double.valueOf(split[1]);
+ ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language);
+ if(price.getCode() != 200){
+ return price;
}
- Double price1 = 0D;
- Double price2 = 0D;
- if(type == 4){//同城
- Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
- if(null == query1){
- return ResultUtil.error("请先完善价格设定");
- }
- String content = String.valueOf(query1.get("content"));
- JSONObject jsonObject = JSON.parseObject(content);
- price1 = jsonObject.getDouble("num2");
- price2 = jsonObject.getDouble("num13");
- }else{
- Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
- if(null == query1){
- return ResultUtil.error("请先完善价格设定");
- }
- String content = String.valueOf(query1.get("content"));
- JSONObject jsonObject = JSON.parseObject(content);
- price1 = jsonObject.getDouble("num1");
- price2 = jsonObject.getDouble("num2");
- }
- int i = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("isDelete", 1));
- Map<String, Object> map = new HashMap<>();
- map.put("ordinary", price1);
- map.put("precious", price2);
- map.put("first", i);
- return ResultUtil.success(map);
+ Integer i = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("isDelete", 1));
+ Map<String, Double> map = price.getData();
+ map.put("first", i.doubleValue());
+ return price;
}
@@ -185,13 +200,11 @@
* @return
* @throws Exception
*/
- public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress) throws Exception{
- Map<String, Object> geocoding = gdMapGeocodingUtil.geocoding(endAddress);
- if(Integer.valueOf(geocoding.get("status").toString()) != 0){
- return ResultUtil.error("收货地址有误,无法查询具体地址信息");
- }
- String location = ((List<String>)geocoding.get("data")).get(0);
- ResultUtil<Map<String, Double>> price = this.getPrice(type, startLonLat.split(",")[0], startLonLat.split(",")[1], location.split(",")[0], location.split(",")[1]);
+ public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endLonLat, String endAddress, Integer language) throws Exception{
+ String[] split = endLonLat.split(",");
+ Double lng = Double.valueOf(split[0]);
+ Double lat = Double.valueOf(split[1]);
+ ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language);
if(price.getCode() == 200 && type == 5){
Map<String, Double> data = price.getData();
data.put("ordinary", data.get("ordinary") * number);
@@ -225,15 +238,15 @@
*/
@Override
public ResultUtil smallLogistics(Integer type, Integer cargoType, Integer cargoNumber, String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, String recipient,
- String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid) throws Exception {
+ String recipientPhone, String endLonLat, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid, Integer language) throws Exception {
startAddress = startAddress.replaceAll("& #40;", "(");
startAddress = startAddress.replaceAll("& #41;", ")");
endAddress = endAddress.replaceAll("& #40;", "(");
endAddress = endAddress.replaceAll("& #41;", ")");
OrderLogistics orderLogistics = new OrderLogistics();
- Company query = companyCityService.query(placementLon, placementLat);
+ Company query = companyCityService.query1(placementLon, placementLat);
if(null == query){
- return ResultUtil.error("该地点暂无企业服务");
+ return ResultUtil.error(language == 1 ? "该地点暂无企业服务" : language == 2 ? "No service yet at this area" : "Pas encore de service dans cette zone");
}
orderLogistics.setCompanyId(query.getId());
orderLogistics.setType(type);
@@ -244,21 +257,22 @@
orderLogistics.setRemark(remark);
orderLogistics.setPlacementLon(Double.valueOf(placementLon));
orderLogistics.setPlacementLat(Double.valueOf(placementLat));
- Map<String, String> geocode = gdMapGeocodingUtil.geocode(placementLon, placementLat);
- orderLogistics.setPlacementAddress(geocode.get("address"));
+ ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon));
+ if(null == reverseGeocode){
+ return ResultUtil.error(language == 1 ? "解析地址出错" : language == 2 ? "Address resolution error" : "Erreur de résolution d’adresse");
+ }
+
+ String address = reverseGeocode.getAddress();
+ orderLogistics.setPlacementAddress(address);
orderLogistics.setStartLon(Double.valueOf(startLon));
orderLogistics.setStartLat(Double.valueOf(startLat));
orderLogistics.setStartAddress(startAddress);
- Map<String, Object> geocoding = gdMapGeocodingUtil.geocoding(endAddress);
- if(Integer.valueOf(geocoding.get("status").toString()) != 0){
- return ResultUtil.error("收货地址有误,无法查询具体地址信息");
- }
- if(((List<String>)geocoding.get("data")).size() == 0){
- return ResultUtil.error("无法查询具体地址信息");
- }
- String location = ((List<String>)geocoding.get("data")).get(0);
- orderLogistics.setEndLon(Double.valueOf(location.split(",")[0]));
- orderLogistics.setEndLat(Double.valueOf(location.split(",")[1]));
+
+ String[] split = endLonLat.split(",");
+ Double lng = Double.valueOf(split[0]);
+ Double lat = Double.valueOf(split[1]);
+ orderLogistics.setEndLon(lng);
+ orderLogistics.setEndLat(lat);
orderLogistics.setEndAddress(endAddress);
orderLogistics.setUrgent(urgent);
orderLogistics.setRecipient(recipient);
@@ -266,7 +280,7 @@
orderLogistics.setMileage(0D);
orderLogistics.setIsReassign(1);
orderLogistics.setReassignNotice(0);
- ResultUtil<Map<String, Double>> price = this.getPrice(type, String.valueOf(startLon), String.valueOf(startLat), location.split(",")[0], location.split(",")[1]);
+ ResultUtil<Map<String, Double>> price = this.getPrice1(type, String.valueOf(startLon), String.valueOf(startLat), lng.toString(), lat.toString(), language);
if(price.getCode() != 200){
return price;
}
@@ -280,13 +294,15 @@
orderLogistics.setTipMoney(tipMoney);
orderLogistics.setState(7);//待支付
orderLogistics.setInsertTime(new Date());
- orderLogistics.setTravelTime(travelTime);
+ orderLogistics.setTravelTime(null == travelTime ? new Date() : travelTime);
orderLogistics.setOrderSource(orderSource);
orderLogistics.setIsDelete(1);
this.insert(orderLogistics);
//添加消息
- systemNoticeService.addSystemNotice(1, "您的"+ (type == 4 ? "同城" : "跨城") + "小件物流订单已下单成功,我们正在为您指派司机,请稍后!", orderLogistics.getUserId(), 1);
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您的市内包裹订单已下单成功,我们正在为您指派司机,请稍后!" :
+ language == 2 ? "You've placed the delivery order successfully, we are assigning you a driver, please wait."
+ : "Vous avez passé la commande de livraison avec succès, nous vous attribuons un chauffeur, veuillez patienter.", orderLogistics.getUserId(), 1);
BaseWarpper baseWarpper = new BaseWarpper();
baseWarpper.setId(orderLogistics.getId());
@@ -301,7 +317,7 @@
* @throws Exception
*/
public ResultUtil<Map<String, Double>> getPrice(Integer type, String startLon, String startLat, String endLon, String endLat) throws Exception{
- Company query = companyCityService.query(startLon, startLat);
+ Company query = companyCityService.query1(startLon, startLat);
if(null == query){
return ResultUtil.error("预约取货点暂无企业服务");
}
@@ -317,29 +333,68 @@
if(dist.compareTo(0D) >= 0 && dist.compareTo(jsonObject.getDouble("num1")) < 0){
price1 = jsonObject.getDouble("num2");
}
- if(dist.compareTo(0D) >= 0 && dist.compareTo(jsonObject.getDouble("num12")) < 0){
- price2 = jsonObject.getDouble("num13");
- }
if(dist.compareTo(jsonObject.getDouble("num3")) >= 0 && dist.compareTo(jsonObject.getDouble("num4")) < 0){
price1 = jsonObject.getDouble("num5");
- }
- if(dist.compareTo(jsonObject.getDouble("num14")) >= 0 && dist.compareTo(jsonObject.getDouble("num15")) < 0){
- price2 = jsonObject.getDouble("num16");
}
if(dist.compareTo(jsonObject.getDouble("num6")) >= 0 && dist.compareTo(jsonObject.getDouble("num7")) < 0){
price1 = jsonObject.getDouble("num8");
}
- if(dist.compareTo(jsonObject.getDouble("num17")) >= 0 && dist.compareTo(jsonObject.getDouble("num18")) < 0){
- price2 = jsonObject.getDouble("num19");
- }
if(dist.compareTo(jsonObject.getDouble("num9")) >= 0 && dist.compareTo(jsonObject.getDouble("num10")) < 0){
price1 = jsonObject.getDouble("num11");
}
- if(dist.compareTo(jsonObject.getDouble("num20")) >= 0 && dist.compareTo(jsonObject.getDouble("num21")) < 0){
- price2 = jsonObject.getDouble("num22");
+ }else{
+ Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
+ String content = String.valueOf(query1.get("content"));
+ JSONObject jsonObject = JSON.parseObject(content);
+ price1 = jsonObject.getDouble("num1");
+ price2 = jsonObject.getDouble("num2");
+ }
+ Map<String, Double> map = new HashMap<>();
+ map.put("ordinary", price1);//普通
+ map.put("precious", price2);//贵重
+ return ResultUtil.success(map);
+ }
+
+
+
+ public ResultUtil<Map<String, Double>> getPrice1(Integer type, String startLon, String startLat, String endLon, String endLat, Integer language) throws Exception{
+ Company query = companyCityService.query1(startLon, startLat);
+ if(null == query){
+ return ResultUtil.error(language == 1 ? "预约取货点暂无企业服务" : language == 2 ?
+ "No service yet at the reserved pickup point." : "Les points de ramassage prévus ne sont pas disponibles pour le moment.");
+ }
+ Double price1 = 0D;
+ Double price2 = 0D;
+ if(type == 4){//同城
+ Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
+ DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(startLat), Double.valueOf(startLon), Double.valueOf(endLat), Double.valueOf(endLon));
+ if(null == distancematrix){
+ return ResultUtil.error(language == 1 ? "计算距离出错" : language == 2 ? "Errors in computing distance" : "Erreurs dans le calcul de la distance");
+ }
+ if(distancematrix.getDistance() == 0){
+ return ResultUtil.error(language == 1 ? "未获取到有效的距离" : language == 2 ? "Not obtaining available distance" : "Ne pas obtenir la distance disponible");
+ }
+ String content = String.valueOf(query1.get("content"));
+ JSONObject jsonObject = JSON.parseObject(content);
+ Long distance = distancematrix.getDistance();
+ Double dist = Double.valueOf(distance) / 1000;
+ if(dist.compareTo(0D) >= 0 && dist.compareTo(jsonObject.getDouble("num1")) < 0){
+ price1 = jsonObject.getDouble("num2");
+ }
+ if(dist.compareTo(jsonObject.getDouble("num3")) >= 0 && dist.compareTo(jsonObject.getDouble("num4")) < 0){
+ price1 = jsonObject.getDouble("num5");
+ }
+ if(dist.compareTo(jsonObject.getDouble("num6")) >= 0 && dist.compareTo(jsonObject.getDouble("num7")) < 0){
+ price1 = jsonObject.getDouble("num8");
+ }
+ if(dist.compareTo(jsonObject.getDouble("num9")) >= 0 && dist.compareTo(jsonObject.getDouble("num10")) < 0){
+ price1 = jsonObject.getDouble("num11");
+ }
+ if(dist.compareTo(jsonObject.getDouble("num10")) > 0){
+ return ResultUtil.error(language == 1 ? "超出可服务范围" : language == 2 ? "Beyond service range" : "Au-delà de la portée de service");
}
}else{
Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
@@ -372,12 +427,13 @@
if(ToolUtil.isNotEmpty(vehicle)){
integers = JSON.parseArray(vehicle).toJavaList(Integer.class);
}
- Company query = companyCityService.query(String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司
+ Company query = companyCityService.query1(String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司
List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//用专车的推单配置
for(int i = 1; i <= querys.size(); i++){
PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0);
//获取空闲司机
List<Driver> list = driverService.queryIdleDriver(orderLogistics.getType(), null, orderLogistics.getStartLon(), orderLogistics.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机
+ System.err.println("【" + orderLogistics.getId() + "】空闲司机:" + JSON.toJSONString(list));
if(list.size() > 0){
double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数
int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取)
@@ -425,10 +481,10 @@
* @throws Exception
*/
@Override
- public ResultUtil payLogisticsOrder(Integer payType, Integer orderId, Integer type) throws Exception {
+ public ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId,Integer couponId, Integer type, Integer language) throws Exception {
OrderLogistics orderLogistics = this.selectById(orderId);
if(orderLogistics.getState() != 7){
- return ResultUtil.error("订单已完成支付,不允许重复支付", "");
+ return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés.", "");
}
Integer uid = orderLogistics.getUserId();
Double orderMoney = orderLogistics.getOrderMoney();
@@ -436,33 +492,89 @@
orderMoney += null != orderLogistics.getTipMoney() ? orderLogistics.getTipMoney() : 0;
}
UserInfo userInfo = userInfoService.selectById(uid);
- ResultUtil resultUtil = ResultUtil.success(new HashMap<>());
+ ResultUtil resultUtil = ResultUtil.success("");
+ orderLogistics.setCouponMoney(0D);//初始化历史数据
+ orderLogistics.setCouponId(null);
+ //计算优惠券
+ UserCouponRecord userCouponRecord = null;
+ if(null != couponId){
+ userCouponRecord = userCouponRecordService.selectById(couponId);
+ if(userCouponRecord.getCompanyId() != orderLogistics.getCompanyId()){
+ return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", "");
+ }
+ if(userCouponRecord.getState() == 2){
+ return ResultUtil.error(language == 1 ? "优惠券已使用" : language == 2 ? "Coupon has been used." : "Le coupon a été utilisé.", "");
+ }
+ if(userCouponRecord.getState() == 3){
+ return ResultUtil.error(language == 1 ? "优惠券已过期" : language == 2 ? "Coupon is expired." : "Le coupon a expiré.", "");
+ }
+ if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 4){
+ return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", "");
+ }
+ if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){
+ return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", "");
+ }
+ orderMoney = orderMoney - userCouponRecord.getMoney();
+ orderLogistics.setCouponMoney(userCouponRecord.getMoney());
+ orderLogistics.setCouponId(couponId);
+ }
+ orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
- if(payType == 1){//微信支付
- return payMoneyUtil.weixinpay("小件物流下单支付",orderId +"",orderId + "_" + orderLogistics.getType(),orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId());
- /* icbcPayUtil.placeAnOrder(orderId + "," + orderLogistics.getType(), 9, 5, uid.toString(),
- "小件物流下单支付", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "",
- type, userInfo.getAppletsOpenId());*/
- /*if(map.get("code").equals("200")){
- paymentRecordService.saveData(1, null, null, orderId, orderLogistics.getType(), 1, orderMoney, map.get("order_id"), 1);//添加预支付数据
- resultUtil = ResultUtil.success(map.get("data"));
+ if(payType == 1) {//手机支付
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId;
+ CheckoutRequest checkoutRequest = new CheckoutRequest();
+ checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone()));
+ checkoutRequest.setCustomerEmail(userInfo.getEmail());
+ checkoutRequest.setAccountNumber(userInfo.getPhone());
+ checkoutRequest.setCustomerFirstName(userInfo.getFirstName());
+ checkoutRequest.setCustomerLastName(userInfo.getLastName());
+ checkoutRequest.setRequestAmount(orderMoney);
+ checkoutRequest.setMerchantTransactionId(merchantTransactionId);
+ checkoutRequest.setRequestDescription("Travel completion payment");
+ checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi");
+ checkoutRequest.setPendingRedirectUrl("");
+ checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html");
+ checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html");
+ resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest);
+ if(resultUtil.getCode()==200){
+ paymentRecordService.saveData(1, null, null, orderId, 4, 1, orderMoney, null, 1);//添加预支付数据
}else{
- resultUtil = ResultUtil.error(map.get("msg"), "");
- }*/
+ resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", "");
+ }
+ return resultUtil;
}
- if(payType == 2){//支付宝支付
- return payMoneyUtil.alipay("小件物流下单支付","小件物流下单支付",orderId + "," + orderLogistics.getType(),orderMoney+"","/base/aliPayOrderTaxi");
- /* Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + "," + orderLogistics.getType(), 10, 5, uid.toString(), "小件物流下单支付", orderMoney, callbackPath + "/base/aliPayOrderTaxi", "", type, null);
- if(map.get("code").equals("200")){
- paymentRecordService.saveData(1, null, null, orderId, orderLogistics.getType(), 2, orderMoney, map.get("order_id"), 1);//添加预支付数据
- resultUtil = ResultUtil.success(map.get("data"));
+
+ if(payType == 2) {//银行卡支付
+ BankCard bankCard = bankCardService.selectById(bankCardId);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId;
+ CheckoutRequest checkoutRequest = new CheckoutRequest();
+ checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode()));
+ checkoutRequest.setCustomerEmail(userInfo.getEmail());
+ checkoutRequest.setAccountNumber(bankCard.getCode());
+ checkoutRequest.setCustomerFirstName(bankCard.getFirstName());
+ checkoutRequest.setCustomerLastName(bankCard.getLastName());
+ checkoutRequest.setRequestAmount(orderMoney);
+ checkoutRequest.setMerchantTransactionId(merchantTransactionId);
+ checkoutRequest.setRequestDescription("Travel completion payment");
+ checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi");
+ checkoutRequest.setPendingRedirectUrl("");
+ checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html");
+ checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html");
+ resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest);
+
+ if(resultUtil.getCode()==200){
+ paymentRecordService.saveData(1, null, null, orderId, 4, 2, orderMoney, null, 1);//添加预支付数据
}else{
- resultUtil = ResultUtil.error(map.get("msg"), "");
- }*/
+ resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", "");
+ }
+ return resultUtil;
}
+
if(payType == 3){//余额支付
if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
- return ResultUtil.error("余额不足,无法完成支付", "");
+ return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant", "");
}
userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -470,8 +582,15 @@
SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
+ //处理优惠券
+ if(null != userCouponRecord){
+ userCouponRecord.setState(2);
+ userCouponRecord.setEndTime(new Date());
+ userCouponRecordService.updateById(userCouponRecord);
+ }
+
//添加交易明细
- transactionDetailsService.saveData(uid, "小件物流下单支付", orderMoney, 2, 1, 1, 4, orderId);
+ transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId);
userInfoService.updateById(userInfo);
orderLogistics.setState(1);//小件物流先支付后司机抢单
@@ -486,7 +605,44 @@
}
}).start();
- systemNoticeService.addSystemNotice(1, "您已使用余额成功完成小件物流订单支付,谢谢使用!", uid, 1);
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2
+ ? "You've paid for the delivery order successfully, thank you for using I-GO" :
+ "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1);
+ this.pushOrder(orderLogistics);//推单
+ }
+
+ if(payType == 4){//现金支付
+ SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+ userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
+
+ //处理优惠券和红包
+ if(null != userCouponRecord){
+ userCouponRecord.setState(2);
+ userCouponRecord.setEndTime(new Date());
+ userCouponRecordService.updateById(userCouponRecord);
+ }
+
+ //添加交易明细
+ transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId);
+ userInfoService.updateById(userInfo);
+
+ orderLogistics.setState(1);//小件物流先支付后司机抢单
+ orderLogistics.setDriverPay(1);
+ orderLogistics.setPayType(4);
+ orderLogistics.setPayMoney(orderMoney);
+
+ // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
+ pushUtil.pushOfflinePayment(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4);
+ }
+ }).start();
+
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2
+ ? "You've paid for the delivery order successfully, thank you for using I-GO" :
+ "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1);
this.pushOrder(orderLogistics);//推单
}
@@ -507,41 +663,54 @@
* @throws Exception
*/
@Override
- public ResultUtil payLogisticsOrder_(Integer payType, Integer orderId, Integer type) throws Exception {
+ public ResultUtil payLogisticsOrder_(Integer payType, Integer bankCardId, Integer orderId, Integer type, Integer language) throws Exception {
OrderLogistics orderLogistics = this.selectById(orderId);
Integer uid = orderLogistics.getUserId();
OrderLogisticsSpread orderLogisticsSpread = orderLogisticsSpreadService.selectOne(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", orderId));
Double orderMoney = orderLogisticsSpread.getPrice();
UserInfo userInfo = userInfoService.selectById(uid);
ResultUtil resultUtil = ResultUtil.success("");
+ if(payType == 1){//手机支付
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId;
+ CheckoutRequest checkoutRequest = new CheckoutRequest();
+ checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone()));
+ checkoutRequest.setCustomerEmail(userInfo.getEmail());
+ checkoutRequest.setAccountNumber(userInfo.getPhone());
+ checkoutRequest.setCustomerFirstName(userInfo.getFirstName());
+ checkoutRequest.setCustomerLastName(userInfo.getLastName());
+ checkoutRequest.setRequestAmount(orderMoney);
+ checkoutRequest.setMerchantTransactionId(merchantTransactionId);
+ checkoutRequest.setRequestDescription("Travel completion payment");
+ checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread");
+ checkoutRequest.setPendingRedirectUrl("");
+ checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html");
+ checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html");
+ return TinggPayUtil.checkoutRequest(checkoutRequest);
+ }
+ if(payType == 2){//银行卡支付
+ BankCard bankCard = bankCardService.selectById(bankCardId);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId;
+ CheckoutRequest checkoutRequest = new CheckoutRequest();
+ checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode()));
+ checkoutRequest.setCustomerEmail(userInfo.getEmail());
+ checkoutRequest.setAccountNumber(bankCard.getCode());
+ checkoutRequest.setCustomerFirstName(bankCard.getFirstName());
+ checkoutRequest.setCustomerLastName(bankCard.getLastName());
+ checkoutRequest.setRequestAmount(orderMoney);
+ checkoutRequest.setMerchantTransactionId(merchantTransactionId);
+ checkoutRequest.setRequestDescription("Travel completion payment");
+ checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread");
+ checkoutRequest.setPendingRedirectUrl("");
+ checkoutRequest.setSuccessRedirectUrl("http://182.160.16.251:81/payMoney/pages/success.html");
+ checkoutRequest.setFailRedirectUrl("http://182.160.16.251:81/payMoney/pages/fail.html");
+ return TinggPayUtil.checkoutRequest(checkoutRequest);
+ }
- /*if(payType == 1){//微信支付
- Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + "," + orderLogistics.getType(), 9, 5, uid.toString(), "小件物流补差价", orderMoney, callbackPath + "/base/wxPayOrderLogisticsSpread", "", type, userInfo.getAppletsOpenId());
- if(map.get("code").equals("200")){
- paymentRecordService.saveData(1, null, null, orderId, orderLogistics.getType(), 1, orderMoney, map.get("order_id"), 1);//添加预支付数据
- resultUtil = ResultUtil.success(map.get("data"));
- }else{
- resultUtil = ResultUtil.error(map.get("msg"), "");
- }
- }
- if(payType == 2){//支付宝支付
- Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + "," + orderLogistics.getType(), 10, 5, uid.toString(), "小件物流补差价", orderMoney, callbackPath + "/base/aliPayOrderLogisticsSpread", "", type, null);
- if(map.get("code").equals("200")){
- paymentRecordService.saveData(1, null, null, orderId, orderLogistics.getType(), 2, orderMoney, map.get("order_id"), 1);//添加预支付数据
- resultUtil = ResultUtil.success(map.get("data"));
- }else{
- resultUtil = ResultUtil.error(map.get("msg"), "");
- }
- }*/
- if(payType == 1){//微信支付
- return payMoneyUtil.weixinpay("小件物流下单支付",orderId +"",orderId + "_" + orderLogistics.getType(),orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId());
- }
- if(payType == 2){//支付宝支付
- return payMoneyUtil.alipay("小件物流下单支付","小件物流下单支付",orderId + "," + orderLogistics.getType(),orderMoney+"","/base/aliPayOrderTaxi");
- }
if(payType == 3){//余额支付
if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
- return ResultUtil.error("余额不足,无法完成支付", "");
+ return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant");
}
userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -550,7 +719,7 @@
userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
//添加交易明细
- transactionDetailsService.saveData(uid, "小件物流补差价", orderMoney, 2, 1, 1, 4, orderId);
+ transactionDetailsService.saveData(uid, "包裹补差价", orderMoney, 2, 1, 1, 4, orderId);
userInfoService.updateById(userInfo);
orderLogistics.setState(12);//已支付差价
@@ -571,7 +740,190 @@
c = new BigDecimal(orderMoney).subtract(d);
}
if(company.getIsSpeFixedOrProportional() == 1){//比例
- d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));
+ c = new BigDecimal(orderMoney).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ }
+
+ Income income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 1).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType()));
+ income.setMoney(income.getMoney() + d.doubleValue());
+ incomeService.updateById(income);
+ income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", orderLogistics.getDriverId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType()));
+ income.setMoney(income.getMoney() + c.doubleValue());
+ incomeService.updateById(income);
+ Driver driver = driverService.selectById(orderLogistics.getDriverId());
+ driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+ driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+ driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+ driverService.updateById(driver);
+
+ // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
+ pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
+ }
+ }).start();
+
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2
+ ? "You've paid for the difference of delivery order successfully, thank you for using I-GO"
+ : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", uid, 1);
+ }
+
+ if(payType == 4){//现金支付
+ SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+ userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
+
+ //添加交易明细
+ transactionDetailsService.saveData(uid, "包裹补差价", orderMoney, 2, 1, 1, 4, orderId);
+ userInfoService.updateById(userInfo);
+
+ orderLogistics.setState(12);//已支付差价
+ this.updateById(orderLogistics);
+
+ orderLogisticsSpread.setPayMoney(orderMoney);
+ orderLogisticsSpread.setPayTime(new Date());
+ orderLogisticsSpread.setPayType(4);
+ orderLogisticsSpread.setDriverPay(1);
+ orderLogisticsSpreadService.updateById(orderLogisticsSpread);
+
+ //添加已收入明细
+ Company company = companyService.selectById(orderLogistics.getCompanyId());
+ Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney();
+ BigDecimal d = BigDecimal.ZERO;
+ BigDecimal c = BigDecimal.ZERO;
+ if(company.getIsSpeFixedOrProportional() == 2){//固定
+ d = new BigDecimal(speMoney);
+ c = new BigDecimal(orderMoney).subtract(d);
+ }
+ if(company.getIsSpeFixedOrProportional() == 1){//比例
+ d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));
+ c = new BigDecimal(orderMoney).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ }
+
+ Income income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 1).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType()));
+ income.setMoney(income.getMoney() + d.doubleValue());
+ incomeService.updateById(income);
+ income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType()));
+ System.out.println("小件物流补差价income======"+income);
+ income.setMoney(income.getMoney() + c.doubleValue());
+ incomeService.updateById(income);
+ Driver driver = driverService.selectById(orderLogistics.getDriverId());
+ driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+ driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+ driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+ driverService.updateById(driver);
+
+ // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
+ pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
+ }
+ }).start();
+
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2
+ ? "You've paid for the difference of delivery order successfully, thank you for using I-GO"
+ : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", uid, 1);
+ }
+
+
+ this.updateById(orderLogistics);
+ return resultUtil;
+ }
+
+
+
+ @Override
+ public void payOrderLogisticsCallback(Integer id, String order_id, Integer language) throws Exception {
+ OrderLogistics orderLogistics = this.selectById(id);
+ PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), orderLogistics.getType(), null, 1);
+ if(null != query){
+ //添加交易明细
+ transactionDetailsService.saveData(orderLogistics.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, orderLogistics.getType(), query.getOrderId());
+ orderLogistics.setState(1);//先支付后抢单
+ orderLogistics.setPayType(query.getPayType());
+ orderLogistics.setPayMoney(query.getAmount());
+ this.updateById(orderLogistics);
+
+ UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
+ SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+ userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
+ userInfoService.updateById(userInfo);
+
+ //处理优惠券和红包
+ if(null != orderLogistics.getCouponId()){
+ UserCouponRecord userCouponRecord = userCouponRecordService.selectById(orderLogistics.getCouponId());
+ userCouponRecord.setState(2);
+ userCouponRecord.setEndTime(new Date());
+ userCouponRecordService.updateById(userCouponRecord);
+ }
+
+ query.setState(2);
+ query.setCode(order_id);
+ paymentRecordService.updateById(query);
+
+ // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
+ }
+ }).start();
+
+
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2
+ ? "You've paid for the delivery order successfully, thank you for using I-GO" :
+ "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1);
+
+ this.pushOrder(orderLogistics);//推单
+ }else{
+ System.err.println("预支付数据异常(orderId = " + id + ")");
+ }
+ }
+
+
+
+ @Override
+ public void payOrderLogisticsSpreadCallback(Integer id, String order_id, Integer language) throws Exception {
+ OrderLogistics orderLogistics = this.selectById(id);
+ OrderLogisticsSpread orderLogisticsSpread = orderLogisticsSpreadService.selectOne(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", id));
+ PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), orderLogistics.getType(), null, 1);
+ if(null != query){
+ Double orderMoney = query.getAmount();
+ query.setState(2);
+ query.setCode(order_id);
+ paymentRecordService.updateById(query);
+
+ orderLogisticsSpread.setPayMoney(query.getAmount());
+ orderLogisticsSpread.setPayTime(new Date());
+ orderLogisticsSpread.setPayType(query.getPayType());
+ orderLogisticsSpread.setDriverPay(1);
+ orderLogisticsSpreadService.updateById(orderLogisticsSpread);
+
+ UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
+ SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+ userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
+
+ //添加交易明细
+ transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹补差价", orderMoney, 2, 1, 1, 4, id);
+ userInfoService.updateById(userInfo);
+
+ orderLogistics.setState(12);//已支付差价
+ this.updateById(orderLogistics);
+
+ //添加已收入明细
+ Company company = companyService.selectById(orderLogistics.getCompanyId());
+ Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney();
+ BigDecimal d = null;
+ BigDecimal c = null;
+ if(company.getIsSpeFixedOrProportional() == 2){//固定
+ d = new BigDecimal(speMoney);
+ c = new BigDecimal(orderMoney).subtract(d);
+ }
+ if(company.getIsSpeFixedOrProportional() == 1){//比例
+ d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));
c = new BigDecimal(orderMoney).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
}
@@ -596,116 +948,9 @@
}
}).start();
- systemNoticeService.addSystemNotice(1, "您已使用余额成功完成小件物流订单差价支付,谢谢使用!", uid, 1);
- }
-
- this.updateById(orderLogistics);
- return resultUtil;
- }
-
-
-
- @Override
- public void payOrderLogisticsCallback(Integer id, String order_id, Integer type) throws Exception {
- OrderLogistics orderLogistics = this.selectById(id);
- PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), orderLogistics.getType(), type, 1);
- if(null != query){
- //添加交易明细
- transactionDetailsService.saveData(orderLogistics.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, orderLogistics.getType(), query.getOrderId());
- orderLogistics.setState(1);//先支付后抢单
- orderLogistics.setPayType(type);
- orderLogistics.setPayMoney(query.getAmount());
- this.updateById(orderLogistics);
-
- UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
- SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
- userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
- userInfoService.updateById(userInfo);
-
- query.setState(2);
- query.setCode(order_id);
- paymentRecordService.updateById(query);
-
- // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
- new Thread(new Runnable() {
- @Override
- public void run() {
- pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
- }
- }).start();
-
-
- systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功完成小件物流订单支付,谢谢使用!", orderLogistics.getUserId(), 1);
-
- this.pushOrder(orderLogistics);//推单
- }else{
- System.err.println("预支付数据异常(orderId = " + id + ")");
- }
- }
-
-
-
- @Override
- public void payOrderLogisticsSpreadCallback(Integer id, String order_id, Integer type) throws Exception {
- OrderLogistics orderLogistics = this.selectById(id);
- OrderLogisticsSpread orderLogisticsSpread = orderLogisticsSpreadService.selectOne(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", id));
- PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), orderLogistics.getType(), type, 1);
- if(null != query){
- //添加交易明细
- transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流补差价", query.getAmount(), 2, 1, 1, 4, query.getOrderId());
- orderLogistics.setState(4);//待取货
- this.updateById(orderLogistics);
-
- orderLogisticsSpread.setPayMoney(query.getAmount());
- orderLogisticsSpread.setPayTime(new Date());
- orderLogisticsSpread.setPayType(3);
- orderLogisticsSpreadService.updateById(orderLogisticsSpread);
-
- UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
- SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
- userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
- userInfoService.updateById(userInfo);
-
- query.setState(2);
- query.setCode(order_id);
- paymentRecordService.updateById(query);
-
- //添加已收入明细
- Company company = companyService.selectById(orderLogistics.getCompanyId());
- Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney();
- BigDecimal d = null;
- BigDecimal c = null;
- if(company.getIsSpeFixedOrProportional() == 2){//固定
- d = new BigDecimal(speMoney);
- c = new BigDecimal(query.getAmount()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
- }
- if(company.getIsSpeFixedOrProportional() == 1){//比例
- d = new BigDecimal(query.getAmount()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);
- c = new BigDecimal(query.getAmount()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
- }
- Income income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 1).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType()));
- income.setMoney(income.getMoney() + d.doubleValue());
- incomeService.updateById(income);
- income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType()));
- income.setMoney(income.getMoney() + c.doubleValue());
- incomeService.updateById(income);
- Driver driver = driverService.selectById(orderLogistics.getDriverId());
- driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
- driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
- driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
- driverService.updateById(driver);
-
- // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
- new Thread(new Runnable() {
- @Override
- public void run() {
- pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
- pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0);
- }
- }).start();
-
-
- systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功完成小件物流订单差价支付,谢谢使用!", orderLogistics.getUserId(), 1);
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2
+ ? "You've paid for the difference of delivery order successfully, thank you for using I-GO"
+ : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1);
}else{
System.err.println("预支付数据异常(orderId = " + id + ")");
}
@@ -736,9 +981,26 @@
* @throws Exception
*/
@Override
- public List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size) throws Exception {
+ public List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception {
pageNum = (pageNum - 1) * size;
- List<Map<String, Object>> maps = orderLogisticsMapper.queryMyOrderList(uid, pageNum, size);
+ List<Map<String, Object>> maps = orderLogisticsMapper.queryMyOrderList(uid, pageNum, size, language);
+ for (Map<String, Object> map : maps) {
+ if(null != map.get("orderTime")){
+ String orderTime = map.get("orderTime").toString();
+ map.put("orderTime", DateUtil.conversionFormat(language, orderTime));
+ }
+ if(null != map.get("time")){
+ String time = map.get("time").toString();
+ map.put("time", DateUtil.conversionFormat(language, time));
+ }
+ Integer orderId = Integer.valueOf(String.valueOf(map.get("orderId")));
+ Integer state = Integer.valueOf(String.valueOf(map.get("state")));
+ if(state == 6){
+ map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html");
+ }else{
+ map.put("receipt", "");
+ }
+ }
return maps;
}
@@ -749,22 +1011,37 @@
* @return
*/
@Override
- public List<Map<String, Object>> queryMyTravelRecord(Integer uid) {
- return orderLogisticsMapper.queryMyTravelRecord(uid);
+ public List<Map<String, Object>> queryMyTravelRecord(Integer language, Integer uid) {
+ List<Map<String, Object>> list = orderLogisticsMapper.queryMyTravelRecord(uid);
+ for (Map<String, Object> map : list) {
+ if(null != map.get("time")){
+ String time = map.get("time").toString();
+ map.put("time", DateUtil.conversionFormat(language, time));
+ }
+ }
+ return list;
}
@Override
- public List<Map<String, Object>> queryInvoiceOrder(Integer type, Date startTime, Date endTime, Double startMoney, Double endMoney, Integer uid, Integer orderType) throws Exception {
+ public List<Map<String, Object>> queryInvoiceOrder(Integer language, Integer type, Date startTime, Date endTime, Double startMoney, Double endMoney, Integer uid, Integer orderType) throws Exception {
startTime = dateUtil.getStartOrEndDate(startTime, "start");
endTime = dateUtil.getStartOrEndDate(endTime, "end");
- return orderLogisticsMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType);
+ List<Map<String, Object>> list = orderLogisticsMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType);
+ for (Map<String, Object> map : list) {
+ map.put("orderName", language == 1 ? "包裹订单" : language == 2 ? "Delivery" : "Livraison");
+ if(null != map.get("time")){
+ String time = map.get("time").toString();
+ map.put("time", DateUtil.conversionFormat(language, time));
+ }
+ }
+ return list;
}
@Override
- public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception {
+ public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Integer language) throws Exception {
if(ToolUtil.isNotEmpty(remark)){
if(ToolUtil.isNotEmpty(remark)){
List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null);
@@ -774,13 +1051,14 @@
}
}
+ language = userInfoService.queryLanguage(uid, language);
OrderLogistics orderLogistics = this.selectById(id);
Integer integer = null;
if(null == orderLogistics){
- return ResultUtil.error("取消订单失败,订单信息有误");
+ return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande.");
}
if(orderLogistics.getState() > 5 && orderLogistics.getState() != 7 && orderLogistics.getState() != 11){
- return ResultUtil.error("取消订单失败,不合法的操作");
+ return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale.");
}
if(orderLogistics.getState() == 7){
@@ -812,24 +1090,24 @@
orderCancelService.insert(orderCancel);
orderLogistics.setState(10);
this.updateById(orderLogistics);
- integer = orderCancel.getId();
//调用回退接口
PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2);
- Map<String, String> merrefund = payMoneyUtil.wxRefund(query.getCode(),orderLogistics.getId() + "," + orderLogistics.getType(),query.getAmount()+"",query.getAmount()+"","");
- //Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), orderLogistics.getId() + "_" + orderLogistics.getType(), orderLogistics.getOrderNum());
- if ("SUCCESS".equals(merrefund.get("return_code"))) {//成功
- //添加交易明细
- transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId());
- }else{
- return ResultUtil.error("退款返回未知异常");
+ if(null == query){
+ return ResultUtil.error("支付数据异常,无法完成退款");
}
- /*if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 1) {//失败
- return ResultUtil.error("订单取消失败(退款不成功)");
+ UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String payerTransactionID = sdf.format(new Date()) + orderCancel.getId();
+ PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout(userInfo.getPhoneOperator(), "+" + userInfo.getPhone(), payerTransactionID, query.getAmount().doubleValue(), callbackPath + "/base/orderCancelRefundCallback", "取消订单退款");
+ AuthStatus authStatus = payoutResponse.getAuthStatus();
+ Results results = payoutResponse.getResults().get(0);
+ String statusCode = results.getStatusCode();
+ if(!"131".equals(authStatus.getAuthStatusCode())){
+ return ResultUtil.error(authStatus.getAuthStatusDescription());
}
- if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 2) {//未知
-
-
- }*/
+ if(!"139".equals(statusCode)){
+ return ResultUtil.error(results.getStatusDescription());
+ }
}
if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 2){//支付宝
OrderCancel orderCancel = new OrderCancel();
@@ -846,28 +1124,21 @@
integer = orderCancel.getId();
//调用回退接口
PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 2, 2);
- /*Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), orderLogistics.getId() + "_" + orderLogistics.getType(), orderLogistics.getOrderNum());
- if (Integer.valueOf(merrefund.get("code").toString()) == 0) {
- Map<String, Object> refundqry = icbcPayUtil.refundqry("", query.getCode(), orderLogistics.getOrderNum());
- if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 0) {//成功
- //添加交易明细
- transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId());
- }
- if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 1) {//失败
- return ResultUtil.error("订单取消失败(退款不成功)");
- }
- if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 2) {//未知
- return ResultUtil.error("退款返回未知异常");
-
- }
- }*/
- Map<String, String> merrefund = payMoneyUtil.aliRefund(query.getCode(),query.getAmount()+"");
- //Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), orderLogistics.getId() + "_" + orderLogistics.getType(), orderLogistics.getOrderNum());
- if ("SUCCESS".equals(merrefund.get("return_code"))) {//成功
- //添加交易明细
- transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId());
- }else{
- return ResultUtil.error("退款返回未知异常");
+ if(null == query){
+ return ResultUtil.error("支付数据异常,无法完成退款");
+ }
+ UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String payerTransactionID = sdf.format(new Date()) + orderCancel.getId();
+ PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout(userInfo.getPhoneOperator(), "+" + userInfo.getPhone(), payerTransactionID, query.getAmount().doubleValue(), callbackPath + "/base/orderCancelRefundCallback", "取消订单退款");
+ AuthStatus authStatus = payoutResponse.getAuthStatus();
+ Results results = payoutResponse.getResults().get(0);
+ String statusCode = results.getStatusCode();
+ if(!"131".equals(authStatus.getAuthStatusCode())){
+ return ResultUtil.error(authStatus.getAuthStatusDescription());
+ }
+ if(!"139".equals(statusCode)){
+ return ResultUtil.error(results.getStatusDescription());
}
}
if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 3){//余额
@@ -889,7 +1160,30 @@
integer = orderCancel.getId();
//添加交易明细
- transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", orderLogistics.getPayMoney(), 1, 1, 1, 4, orderLogistics.getId());
+ transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹取消退款", orderLogistics.getPayMoney(), 1, 1, 1, 4, orderLogistics.getId());
+ }
+
+
+ if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 4){//现金
+// UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
+// userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney());
+// userInfoService.updateById(userInfo);
+ OrderCancel orderCancel = new OrderCancel();
+ orderCancel.setOrderId(id);
+ orderCancel.setOrderType(orderLogistics.getType());
+ orderCancel.setReason(reason);
+ orderCancel.setRemark(remark);
+ orderCancel.setState(2);
+ orderCancel.setInsertTime(new Date());
+ orderCancel.setUserType(1);
+ orderCancelService.insert(orderCancel);
+
+ orderLogistics.setState(10);
+ this.updateById(orderLogistics);
+ integer = orderCancel.getId();
+
+ //添加交易明细
+ transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹取消退款", orderLogistics.getPayMoney(), 1, 1, 1, 4, orderLogistics.getId());
}
if(null != orderLogistics.getDriverId()){
@@ -902,7 +1196,8 @@
}
//添加消息
- systemNoticeService.addSystemNotice(1, "您已成功取消小件物流订单,谢谢使用!", orderLogistics.getUserId(), 1);
+ systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the delivery order successfully, thank you for using I-GO "
+ : "Vous avez annulé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1);
Map<String, Object> map = new HashMap<>();
map.put("id", integer);
return ResultUtil.success(map);
@@ -957,14 +1252,68 @@
Map<String, Object> map = new HashMap<>();
UserInfo userInfo = userInfoService.selectById(uid);
map.put("balance", userInfo.getBalance());
- map.put("coupon", 0);
+ OrderLogistics orderLogistics = this.selectById(orderId);
+ UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId());
+ double v = orderLogistics.getOrderMoney();
+ if(null != query2){
+ Integer orderNum=this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())"));
+ if(query2.getDistance()*1000>orderLogistics.getMileage() && query2.getOrderNum()>orderNum){
+ Double special = query2.getSpecial();
+ orderLogistics.setDiscount(special);
+ Double orderMoney = orderLogistics.getOrderMoney();
+ v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ }
+ }
+ int i = userCouponRecordService.queryAvailable(uid, orderLogistics.getCompanyId(), 1, 4, v);
+ i = i + userCouponRecordService.queryAvailable(uid, orderLogistics.getCompanyId(), 1, 0, v);
+ map.put("coupon", i);
return map;
}
+ @Override
+ public Map<String, Object> queryOrderInfo(Integer language, Integer orderId) throws Exception {
+ Map<String, Object> map = orderLogisticsMapper.queryOrderInfo(orderId);
+ if(null != map.get("travelTime")){
+ String travelTime = map.get("travelTime").toString();
+ map.put("travelTime", DateUtil.conversionFormat1(language, travelTime));
+ }
+ Integer state = Integer.valueOf(String.valueOf(map.get("state")));
+ OrderLogistics orderLogistics = this.selectById(orderId);
+ if(null != map.get("reassignNotice") && Integer.valueOf(String.valueOf(map.get("reassignNotice"))) == 2){//改派完成,重新获取了新的司机数据,开始修改数据防止继续调用
+ orderLogistics.setReassignNotice(0);
+ this.updateById(orderLogistics);
+ }
+ if(state == 11){
+ map.put("state", map.get("oldState"));
+ }
+ Map<String, String> geocode = gdMapGeocodingUtil.geocode(map.get("startLon").toString(), map.get("startLat").toString());
+ map.put("startCity", geocode.get("city"));
+ geocode = gdMapGeocodingUtil.geocode(map.get("endLon").toString(), map.get("endLat").toString());
+ map.put("endCity", geocode.get("city"));
+ String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId"));
+ map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1);
+ map.put("orderType", orderLogistics.getType());
+ if(state == 6){
+ map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html");
+ }else{
+ map.put("receipt", "");
+ }
+ return map;
+ }
public synchronized String getOrderNum() throws Exception{
int size = this.selectCount(null);
return "LOGISTICS" + String.valueOf(1000000 + size + 1).substring(1);
}
+
+
+ @Override
+ public List<Map<String, Object>> queryCoupon(Integer language, Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception {
+ OrderLogistics orderLogistics = this.selectById(orderId);
+ List<Map<String, Object>> list = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 4, orderLogistics.getOrderMoney(), pageNum, size);
+ List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 0, orderLogistics.getOrderMoney(), pageNum, size);
+ list.addAll(list1);
+ return list;
+ }
}
--
Gitblit v1.7.1