From 7bf07f46d7c39fa01b6d8abd860bd80c210d86cb Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 09 十月 2025 15:48:31 +0800
Subject: [PATCH] 修改上传图片配置
---
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 214 insertions(+), 25 deletions(-)
diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
index 945781e..3765267 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -3,6 +3,8 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.google.api.client.http.UrlEncodedParser;
+import com.stylefeng.guns.core.util.MD5Util;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService;
import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
@@ -11,6 +13,7 @@
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
+import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.*;
@@ -26,14 +29,24 @@
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.bouncycastle.util.encoders.UrlBase64Encoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -45,6 +58,8 @@
@RestController
@RequestMapping("")
public class OrderController {
+
+ private Logger log = LoggerFactory.getLogger(OrderController.class);
@Autowired
private IOrderTaxiService orderTaxiService;
@@ -105,9 +120,20 @@
@Autowired
private IUserRedPacketRecordService userRedPacketRecordService;
+
+ @Resource
+ private UserActivityDiscount1Mapper userActivityDiscount1Mapper;
+
+ @Resource
+ private RedisUtil redisUtil;
+
+
+
+
+
/**
- * 获取正在进行中的订单
+ * 获取正在sudo rm -rf的订单
* @param request
* @return
*/
@@ -136,6 +162,7 @@
orderStatusWarpper.setOrderId(orderPrivateCar.getId());
orderStatusWarpper.setOrderType(1);
orderStatusWarpper.setState(orderPrivateCar.getState());
+ orderStatusWarpper.setTripId(orderPrivateCar.getTripId());
data.add(orderStatusWarpper);
}
List<OrderTaxi> list = orderTaxiService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12);
@@ -147,6 +174,7 @@
orderStatusWarpper.setOrderId(orderTaxi.getId());
orderStatusWarpper.setOrderType(2);
orderStatusWarpper.setState(orderTaxi.getState());
+// orderStatusWarpper.setTripId(orderTaxi.getTripId());
data.add(orderStatusWarpper);
}
List<OrderCrossCity> orderCrossCities = orderCrossCityService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12);
@@ -158,6 +186,20 @@
orderStatusWarpper.setOrderId(orderCrossCity.getId());
orderStatusWarpper.setOrderType(3);
orderStatusWarpper.setState(orderCrossCity.getState());
+// orderStatusWarpper.setTripId(orderPrivateCar.getTripId());
+ data.add(orderStatusWarpper);
+ }
+ List<OrderLogistics> orderLogistics = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().eq("userId", uid)
+ .in("state", Arrays.asList(1, 2, 3, 4, 5, 6, 7, 11, 12)).eq("isDelete", 1));
+ for(OrderLogistics orderLogistics1 : orderLogistics){
+ if(orderLogistics1.getState() == 11){
+ orderLogistics1.setState(orderLogistics1.getOldState());
+ }
+ OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper();
+ orderStatusWarpper.setOrderId(orderLogistics1.getId());
+ orderStatusWarpper.setOrderType(4);
+ orderStatusWarpper.setState(orderLogistics1.getState());
+ orderStatusWarpper.setTripId(orderLogistics1.getTripId());
data.add(orderStatusWarpper);
}
return ResultUtil.success(data);
@@ -193,6 +235,9 @@
if(null == uid){
return ResultUtil.tokenErr();
}
+ UserInfo userInfo = userInfoService.selectById(uid);
+ userInfo.setLanguage(language);
+ userInfoService.updateById(userInfo);
List<Map<String, Object>> list = null;
switch (type){
case 1:
@@ -233,7 +278,7 @@
@ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"),
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
- public ResultUtil<TravelRecordWarpper> queryMyTravelRecord(Integer pageNum, Integer size, Integer language, HttpServletRequest request){
+ public ResultUtil<List<TravelRecordListWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, Integer language, HttpServletRequest request){
try {
Integer uid = userInfoService.getUserIdFormRedis(request);
if(null == uid){
@@ -245,10 +290,10 @@
for (Map<String, Object> map : maps) {
Integer orderType = Integer.valueOf(map.get("orderType").toString());
if(1 == orderType){
- map.put("name", language == 1 ? "打车订单取消" : language == 2 ? "Ride order cancelled" : "Commande de trajet annulée");
+ map.put("name", language == 1 ? "打车订单取消" : language == 2 ? "Ride order cancelled" : "Commande de course annulée");
}
if(4 == orderType){
- map.put("name", language == 1 ? "包裹订单取消" : language == 2 ? "Parcel order cancellation" : "Annulation de commande de livraison");
+ map.put("name", language == 1 ? "包裹订单取消" : language == 2 ? "Delivery order cancelled" : "Commande de livraison annulée");
}
}
List<Map<String, Object>> list = orderPrivateCarService.queryMyTravelRecord(language, uid);//专车
@@ -288,10 +333,10 @@
}else{
orderWarpper = new ArrayList<>();
}
- TravelRecordWarpper travelRecordWarpper = new TravelRecordWarpper();
- travelRecordWarpper.setList(orderWarpper);
- travelRecordWarpper.setTotal(sum);
- return ResultUtil.success(travelRecordWarpper);
+ orderWarpper.forEach(s->{
+ s.setTotal(sum);
+ });
+ return ResultUtil.success(orderWarpper);
}catch (Exception e){
e.printStackTrace();
return ResultUtil.runErr();
@@ -648,7 +693,7 @@
*/
@ResponseBody
@PostMapping("/base/order/sendOrderState")
- public ResultUtil cancelOrder(Integer id, Integer orderType){
+ public ResultUtil cancelOrder(Integer id, Integer orderType, String from){
try {
Integer driverId = null;
Integer userId = null;
@@ -660,7 +705,7 @@
userId = orderPrivateCar.getUserId();
state = orderPrivateCar.getState();
if(null != driverId){
- pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
+ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from);
}
break;
case 2:
@@ -669,7 +714,7 @@
userId = orderTaxi.getUserId();
state = orderTaxi.getState();
if(null != driverId){
- pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
+ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from);
}
break;
case 3:
@@ -680,7 +725,7 @@
if(orderCrossCity.getPayMoney() == null && state == 10){//支付的情况才推送取消
break;
}else{
- pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
+ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from);
}
break;
case 4:
@@ -691,7 +736,7 @@
if(orderLogistics.getPayMoney() == null && state == 10){//支付的情况才推送取消
break;
}else{
- pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
+ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from);
}
break;
case 5:
@@ -702,11 +747,11 @@
if(orderLogistics1.getPayMoney() == null && state == 10){//支付的情况才推送取消
break;
}else{
- pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
+ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "", from);
}
break;
}
- pushUtil.pushOrderState(1, userId, id, orderType, state, 0);
+ pushUtil.pushOrderState(1, userId, id, orderType, state, 0, "", from);
return ResultUtil.success();
}catch (Exception e){
e.printStackTrace();
@@ -806,9 +851,10 @@
@ApiImplicitParam(value = "终点经度", name = "elon", required = true, dataType = "double"),
@ApiImplicitParam(value = "终点纬度", name = "elat", required = true, dataType = "double")
})
- public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat){
+ public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat, HttpServletRequest request){
try {
- return orderService.queryExpectedTime(slon, slat, elon, elat);
+ Integer uid = userInfoService.getUserIdFormRedis(request);
+ return orderService.queryExpectedTime(uid, slon, slat, elon, elat);
}catch (Exception e){
e.printStackTrace();
return ResultUtil.runErr();
@@ -881,6 +927,24 @@
if(null == uid){
return ResultUtil.tokenErr();
}
+ if(ToolUtil.isNotEmpty(reason)){
+ reason = reason.replaceAll("& #40;", "(")
+ .replaceAll("& #41;", ")")
+ .replaceAll("& #40;", "(")
+ .replaceAll("& #41;", ")")
+ .replaceAll("& #39;", "'")
+ .replaceAll("& lt;", "<")
+ .replaceAll("& gt;", ">");
+ }
+ if(ToolUtil.isNotEmpty(remark)){
+ remark = remark.replaceAll("& #40;", "(")
+ .replaceAll("& #41;", ")")
+ .replaceAll("& #40;", "(")
+ .replaceAll("& #41;", ")")
+ .replaceAll("& #39;", "'")
+ .replaceAll("& lt;", "<")
+ .replaceAll("& gt;", ">");
+ }
switch (orderType){
case 1:
return orderPrivateCarService.addCancle(id, reason, remark, uid, lon, lat, address, language);
@@ -901,8 +965,9 @@
return ResultUtil.runErr();
}
}
-
-
+
+
+
/**
* 取消订单退款回调
* @param request
@@ -969,6 +1034,13 @@
if(null == uid){
return ResultUtil.tokenErr();
}
+ String format = String.format("uid=%s&id=%s&orderType=%s&payType=%s&type=%s", uid, id, orderType, payType, type);
+ String key = MD5Util.encrypt(format);
+ String value = redisUtil.getValue(key);
+ if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){
+ return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération");
+ }
+ redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5);
switch (orderType){
case 1:
return orderPrivateCarService.cancleOrderPrivateCar(id, payType, bankCardId, cancleId, type, language);
@@ -1045,9 +1117,28 @@
return ResultUtil.tokenErr();
}
Map<String, Object> map = new HashMap<>();
+ Double payMoney = 0D;
+ Integer companyId = null;
switch (orderType){
case 1:
map = orderPrivateCarService.queryBalance(orderId, uid);
+ OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
+ companyId = orderPrivateCar.getCompanyId();
+ payMoney = orderPrivateCar.getOrderMoney();
+ UserActivityDiscount1 query = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId());
+ if(null != query){
+ Integer orderNum=orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query.getId()).last(" and to_days(getoffTime) = to_days(now())"));
+ if(query.getDistance()*1000>orderPrivateCar.getMileage() && query.getOrderNum()>orderNum){
+ Double special = query.getSpecial();
+ orderPrivateCar.setDiscount(special);
+ Double orderMoney = orderPrivateCar.getOrderMoney();
+ double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ if(orderMoney.compareTo(v) > 0){
+ payMoney = v;
+ }
+ }
+
+ }
break;
// case 2:
// map = orderTaxiService.queryBalance(orderId, uid);
@@ -1057,10 +1148,40 @@
// break;
case 4:
map = orderLogisticsService.queryBalance(orderId, uid);
+ OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
+ companyId = orderLogistics.getCompanyId();
+ payMoney = orderLogistics.getOrderMoney();
+ UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId());
+ if(null != query2){
+ Integer orderNum=orderLogisticsService.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.getLogistics();
+ orderLogistics.setDiscount(special);
+ Double orderMoney = orderLogistics.getOrderMoney();
+ double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ if(orderMoney.compareTo(v) > 0){
+ payMoney = v;
+ }
+ }
+ }
break;
// case 5:
// map = orderLogisticsService.queryBalance(orderId, uid);
// break;
+ }
+ List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>()
+ .eq("companyId", companyId).eq("state", 1).eq("userId", uid));
+ Double aDouble = 0D;
+ if(userRedPacketRecords.size() > 0){
+ aDouble = userRedPacketRecords.stream().mapToDouble(UserRedPacketRecord::getRemainingAmount).sum();
+ }
+ map.put("redTotal", aDouble);
+ RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings();
+ if(null == redEnvelopePaymentSettings){
+ map.put("deductionAmount", 0D);
+ }else{
+ Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue();
+ map.put("deductionAmount", aDouble.compareTo(deductionAmount) >= 0 ? deductionAmount : aDouble);
}
return ResultUtil.success(map);
}catch (Exception e){
@@ -1149,6 +1270,16 @@
if(null == uid){
return ResultUtil.tokenErr();
}
+ System.err.println("支付接口请求参数:payType=" + payType + "&bankCardId=" + bankCardId + "&orderId=" + orderId + "&orderType=" + orderType +
+ "&couponId=" + couponId + "&redDeduction=" + redDeduction + "&type=" + type + "&language=" + language);
+ String format = String.format("uid=%s&payType=%s&orderId=%s&orderType=%s", uid, payType, orderId, orderType);
+ String key = MD5Util.encrypt(format);
+ String value = redisUtil.getValue(key);
+ if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){
+ return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération");
+ }
+ redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5);
+
switch (orderType){
case 1:
return orderPrivateCarService.payPrivateCarOrder(payType, bankCardId, orderId, couponId, redDeduction, type, language);
@@ -1301,6 +1432,7 @@
@ResponseBody
@PostMapping("/base/wxCancelOrderTaxi")
public CallbackResponse wxCancelOrderTaxi(@RequestBody CallbackRequest callbackRequest){
+ log.info("取消订单支付回调结果:{}", JSON.toJSONString(callbackRequest));
CallbackResponse callbackResponse = new CallbackResponse();
try {
/**
@@ -1352,6 +1484,7 @@
}catch (Exception e){
e.printStackTrace();
}
+ log.info("取消订单支付回调处理结束:{}", JSON.toJSONString(callbackResponse));
return callbackResponse;
}
@@ -1403,6 +1536,7 @@
@ResponseBody
@PostMapping("/base/wxPayOrderTaxi")
public CallbackResponse wxPayOrderTaxi(@RequestBody CallbackRequest callbackRequest){
+ log.info("订单完成支付回调结果:{}", JSON.toJSONString(callbackRequest));
CallbackResponse callbackResponse = new CallbackResponse();
try {
/**
@@ -1457,6 +1591,7 @@
}catch (Exception e){
e.printStackTrace();
}
+ log.info("订单完成支付回调处理结束:{}", JSON.toJSONString(callbackResponse));
return callbackResponse;
}
@@ -1653,26 +1788,57 @@
return ResultUtil.tokenErr();
}
Double payMoney = 0D;
+ Integer companyId = 1;
switch (orderType){
case 1:
OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
- payMoney = orderPrivateCar.getPayMoney();
+ companyId = orderPrivateCar.getCompanyId();
+ Double orderMoney = orderPrivateCar.getOrderMoney();
+ if(null == orderMoney){
+ orderMoney = 0D;
+ }
+ UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId());
+ if(null != query2){
+ Integer orderNum=orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId", uid).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())"));
+ if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){
+ Double special = query2.getSpecial();
+ if(null != special){
+ double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ payMoney = v;
+ }
+ }
+ }
break;
case 4:
OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
- payMoney = orderLogistics.getPayMoney();
+ companyId = orderLogistics.getCompanyId();
+ Double orderMoney1 = orderLogistics.getOrderMoney();
+ if(null == orderMoney1){
+ orderMoney1 = 0D;
+ }
+ UserActivityDiscount1 query1 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId());
+ if(null != query1){
+ Integer orderNum=orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("activityId",query1.getId()).last(" and to_days(getoffTime) = to_days(now())"));
+ if(query1.getDistance()*1000>orderLogistics.getMileage() && query1.getOrderNum()>orderNum){
+ Double special = query1.getLogistics();
+ if(null != special){
+ double v = new BigDecimal(orderMoney1).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ payMoney = v;
+ }
+ }
+ }
break;
}
-
- Double aDouble = userRedPacketRecordService.queryRemainingAmount(uid);
+ List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid)
+ .eq("state", 1).eq("companyId", companyId).gt("remainingAmount", 0).orderBy("insertTime", false));
Map<String, Object> map = new HashMap<>();
- map.put("redTotal", aDouble);
+ map.put("redTotal", userRedPacketRecords.stream().mapToDouble(UserRedPacketRecord::getRemainingAmount).sum());
RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings();
if(null == redEnvelopePaymentSettings){
map.put("deductionAmount", 0D);
return ResultUtil.success(map);
}
- Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue();
+ Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
map.put("deductionAmount", deductionAmount);
return ResultUtil.success(map);
}catch (Exception e){
@@ -1680,4 +1846,27 @@
return ResultUtil.runErr();
}
}
+
+
+ @ResponseBody
+ @PostMapping("/api/order/getNewTripId")
+ @ApiOperation(value = "获取google预定tripid【2.0】", tags = {"用户端-首页"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResultUtil<String> getNewTripId(HttpServletRequest request){
+ try {
+ Integer uid = userInfoService.getUserIdFormRedis(request);
+ if(null == uid){
+ return ResultUtil.tokenErr();
+ }
+ String randomCode = UUIDUtil.getRandomCode();
+ redisUtil.setStrValue("trip" + uid, randomCode);
+ log.warn("生成tripId:{} {}", System.currentTimeMillis(), randomCode);
+ return ResultUtil.success(randomCode);
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
}
--
Gitblit v1.7.1