修复订单状态回退没有刷新缓存的问题

This commit is contained in:
lulz1 2024-03-13 13:30:20 +08:00
parent 088ca0a9ea
commit ce76c2e264
6 changed files with 127 additions and 9 deletions

View File

@ -15,7 +15,7 @@ public class OrderDetailMapper {
OrderDetailRes orderDetailRes = BeanUtil.copyProperties(orderDetail.reloadStatus(), OrderDetailRes.class);
orderDetailRes.setOutOrderStatus(orderDetail.getOutOrderStatus());
Integer productType = orderDetail.getProductType();
orderDetailRes.setScheduleType(translateLegTypeEn(productType));
switch (productType) {
case LEG_TYPE_TRAIN -> {
TrainExtensionField trainExtensionField = getTrainExtensionField(orderDetail);
@ -53,4 +53,16 @@ public class OrderDetailMapper {
private static CarExtensionField getCarExtensionField(OrderDetail orderDetail) {
return BeanUtil.copyProperties(orderDetail.getCarOrderDetail(),CarExtensionField.class);
}
private static String translateLegTypeEn(int type) {
return switch (type) {
case LEG_TYPE_TRAIN -> LEG_TYPE_TRAIN_EN_NAME;
case LEG_TYPE_AIRPLANE -> LEG_TYPE_AIRPLANE_EN_NAME;
case LEG_TYPE_HOTEL -> LEG_TYPE_HOTEL_EN_NAME;
case LEG_TYPE_TAXI -> LEG_TYPE_TAXI_EN_NAME;
case LEG_TYPE_OTHER -> LEG_TYPE_OTHER_EN_NAME;
default -> "未知类型";
};
}
}

View File

@ -23,6 +23,8 @@ public class OrderDetailRes {
private String productName; // 产品名称
@ApiModelProperty("商品类型")
private Integer productType; // 商品类型
@ApiModelProperty("商品类型英文名")
private String scheduleType;
@ApiModelProperty("数量")
private Integer quantity; // 数量
@ApiModelProperty("价格")
@ -47,7 +49,7 @@ public class OrderDetailRes {
private String orderStatus;
@ApiModelProperty("供应商订单状态")
private String outOrderStatus;
//
@ApiModelProperty("机票扩展字段")
private FLightExtensionField fLightExtensionField;
@ApiModelProperty("用车扩展字段")
@ -64,7 +66,6 @@ public class OrderDetailRes {
public static OrderDetailRes copyFromExtension(OrderDetail orderDetail) {
OrderDetailRes orderDetailRes = copyFrom(orderDetail);
orderDetailRes.setOutOrderStatus(orderDetail.getOutOrderStatus());
return orderDetailRes;
}
}

View File

@ -184,11 +184,11 @@ public class Leg implements Serializable {
private String translateLegTypeEn(int type) {
return switch (type) {
case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_EN_NAME;
case LegConstant.LEG_TYPE_AIRPLANE -> LegConstant.LEG_TYPE_AIRPLANE_EN_NAME;
case LegConstant.LEG_TYPE_HOTEL -> LegConstant.LEG_TYPE_HOTEL_EN_NAME;
case LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_EN_NAME;
case LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_EN_NAME;
case LEG_TYPE_TRAIN -> LEG_TYPE_TRAIN_EN_NAME;
case LEG_TYPE_AIRPLANE -> LEG_TYPE_AIRPLANE_EN_NAME;
case LEG_TYPE_HOTEL -> LEG_TYPE_HOTEL_EN_NAME;
case LEG_TYPE_TAXI -> LEG_TYPE_TAXI_EN_NAME;
case LEG_TYPE_OTHER -> LEG_TYPE_OTHER_EN_NAME;
default -> "未知类型";
};
}

View File

@ -34,6 +34,7 @@ public class LegExtensionField implements Serializable {
private String estimatedAmount;
public LegExtensionField addLocationIdsAsString(List<Long> locationIds) {
this.locationIds = Arrays.toString(locationIds.toArray());
return this;

View File

@ -53,7 +53,7 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
@Override
public OrderDetail save(OrderDetail orderDetail) {
routeCacheService.invalidateRouteCache(orderDetail.getOrderId());
routeCacheService.invalidateRouteCache(orderDetail.getRouteId());
return orderDetailRepository.save(orderDetail);
}

View File

@ -0,0 +1,104 @@
package com.chint.infrastructure.util;
import cn.hutool.core.codec.Base64Encoder;
import com.chint.domain.exceptions.AuthException;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.Key;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class AESUtils {
private static final int NUM_16 = 16;
private static final int NUM_255 = 255;
private static final byte[] IV = new byte[]{56, 55, 54, 53, 52, 51, 50, 49, 56, 55, 54, 53, 52, 51, 50, 49};
public static final String PRIVATE_KEY = "yuanian-console-2018";
public static final String KEY_ALGORITHM = "AES";
public static final String CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";
public static final Pattern check = Pattern.compile("(\r\n|\r|\n|\n\r)");
private AESUtils() {
}
public static void main(String[] ags) {
String encrypt = encrypt("230615020");
System.out.println(encrypt);
}
public static String encrypt(String content) {
try {
byte[] passwordByte = dealPassword("yuanian-console-2018");
Key key = new SecretKeySpec(passwordByte, "AES");
Cipher in = Cipher.getInstance("AES/CBC/PKCS5Padding");
in.init(1, key, new IvParameterSpec(IV));
byte[] enc = in.doFinal(content.getBytes("UTF-8"));
return parseByte2HexStr(enc);
} catch (Exception var5) {
throw new AuthException("AES算法加密数据出错");
}
}
public static String decrypt(String content) {
try {
byte[] passwordByte = dealPassword("yuanian-console-2018");
Key key = new SecretKeySpec(passwordByte, "AES");
Cipher out = Cipher.getInstance("AES/CBC/PKCS5Padding");
out.init(2, key, new IvParameterSpec(IV));
byte[] dec = out.doFinal(parseHexStr2Byte(content));
return new String(dec, "UTF-8");
} catch (Exception var5) {
throw new AuthException("AES算法加密数据出错");
}
}
public static String parseByte2HexStr(byte[] buf) {
StringBuffer sb = new StringBuffer();
for(int i = 0; i < buf.length; ++i) {
String hex = Integer.toHexString(buf[i] & 255);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
public static byte[] parseHexStr2Byte(String hexStr) {
if (hexStr.length() < 1) {
return null;
} else {
byte[] result = new byte[hexStr.length() / 2];
for(int i = 0; i < hexStr.length() / 2; ++i) {
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16);
result[i] = (byte)(high * 16 + low);
}
return result;
}
}
public static byte[] dealPassword(String password) throws UnsupportedEncodingException {
byte[] result = new byte[16];
byte[] temp = password.getBytes("UTF-8");
int i = 16;
if (temp.length < 16) {
i = temp.length;
}
for(int j = 0; j < i; ++j) {
result[j] = temp[j];
}
return result;
}
}