搬家调试

20230922-ljl-fixBug
qiushengjie 1 year ago
parent 29e369a84f
commit e1ec2dca94

@ -865,8 +865,10 @@ public class MoveService {
String[] arr = skuKey.split(MoveConst.skuKeyInterval);
String colorName = arr.length >= 1 ? arr[0] : "";
String sizeName = arr.length >= 2 ? arr[1] : "";
String newColorName = replaceIllegalChars(colorName, filterBanWord, foundBanWordList);
String newSizeName = replaceIllegalChars(sizeName, filterBanWord, foundBanWordList);
// String newColorName = replaceIllegalChars(colorName, filterBanWord, foundBanWordList);
// String newSizeName = replaceIllegalChars(sizeName, filterBanWord, foundBanWordList);
String newColorName = "";
String newSizeName = "";
Boolean needSkip = false;
if (colorName.length() > 0 && ObjectUtil.isNotEmpty(colorSpecArrCalc) && (newColorName.length() == 0 || !colorSpecArrCalc.contains(newColorName))) {
needSkip = true;
@ -922,7 +924,8 @@ public class MoveService {
filterEmptyColorImgYesArr.add(temp);
continue;
}
name = replaceIllegalChars(name, filterBanWord, foundBanWordList);
// name = replaceIllegalChars(name, filterBanWord, foundBanWordList);
name = "";
if (name.length() == 0) {
continue;
}
@ -961,7 +964,8 @@ public class MoveService {
JSONObject sizeMap = (JSONObject) entry.getValue();
sourceSizeName = (String) sizeMap.get("name");
String name = sizeMap.containsKey("newName") ? (String) sizeMap.get("newName") : (sizeMap.containsKey("calName") ? (String) sizeMap.get("calName") : (String) sizeMap.get("name"));
name = replaceIllegalChars(name, filterBanWord, foundBanWordList);
// name = replaceIllegalChars(name, filterBanWord, foundBanWordList);
name = "";
if (name.length() == 0) {
continue;
}

@ -61,12 +61,15 @@ public class MoveMaterialAuditProcessTaskService extends TaskBaseService {
/**
*
*/
@Override
public int getCorePoolSiz() {
return 30;
}
@Override
public boolean isCirculate() {return true;}
@Override
public int getIntervalTimeSecond() {return 1;}
/**

@ -382,7 +382,6 @@ public class MovePublishBufferTaskService extends TaskBaseService {
log.info("end addPublishQueueToRedis redis Queue Total[" + redisTotal[0] + "]");
transactionManager.commit(status);
} catch (Exception e) {
e.printStackTrace();
shopBufferCountMap = null;
transactionManager.rollback(status);
log.error("把删除buffer中的数据放入到queue中同时放入到redis中 任务执行失败 数据回滚: ", e);

@ -675,7 +675,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
if (!Objects.isNull(imagePaths) && !imagePaths.isEmpty()) {
defaultColorImg = imagePaths.get(0);
}
JSONObject skus = buildFastModeAddSkuMinPriceSku(queueMsg.getIsFastMode(), moveBaseData.getJSONObject("skus"), queueMsg.getCondition().getPrice(), defaultColorImg);
JSONObject skus = buildFastModeAddSkuMinPriceSku(queueMsg.getIsFastMode(), moveBaseData.getJSONObject("skus"), queueMsg.getCondition(), defaultColorImg);
moveBaseData.put("skus", skus);
Ret processSkuAliasRet = replaceAndDeleteSkuName(moveBaseData, (JSONObject) JSONObject.toJSON(condition));
@ -1795,19 +1795,22 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
for (Map.Entry entry : skuMap.entrySet()) {
JSONObject skuInfo = (JSONObject) entry.getValue();
double price = skuInfo.getDouble("price");
if (skuInfo.containsKey("newPrice") && skuInfo.getDouble("newPrice") > 0) {
price = skuInfo.getDouble("newPrice");
}
if (skuInfo.containsKey("calPrice") && skuInfo.getDouble("calPrice") > 0) {
price = skuInfo.getDouble("calPrice");
}
if (skuInfo.containsKey("sale_price") && skuInfo.getDouble("sale_price") > 0) {
price = skuInfo.getDouble("sale_price");
if(ObjectUtil.isNotEmpty(skuInfo)){
// double price = skuInfo.getDouble("price");
//
// if (skuInfo.containsKey("newPrice") && skuInfo.getDouble("newPrice") > 0) {
// price = skuInfo.getDouble("newPrice");
// }
// if (skuInfo.containsKey("calPrice") && skuInfo.getDouble("calPrice") > 0) {
// price = skuInfo.getDouble("calPrice");
// }
// if (skuInfo.containsKey("sale_price") && skuInfo.getDouble("sale_price") > 0) {
// price = skuInfo.getDouble("sale_price");
// }
//
// priceArr.add(CommonTool.numFormat(price, 2));
}
priceArr.add(CommonTool.numFormat(price, 2));
}
return priceArr.stream().mapToDouble(v -> v).max().orElse(0.0);
@ -1824,22 +1827,23 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
for (String propString : skuMap.keySet()) {
JSONObject skuDetail = skuMap.getJSONObject(propString);
if(ObjectUtil.isNotEmpty(skuDetail)){
if (resetSkuStockNum > 0 && skuDetail.containsKey("stock") && skuDetail.getInteger("stock") < resetSkuStockNum) {
skuDetail.put("oriStock", skuDetail.get("stock"));
skuDetail.put("stock", 0);
}
if (resetSkuStockNum > 0 && skuDetail.containsKey("stock") && skuDetail.getInteger("stock") < resetSkuStockNum) {
skuDetail.put("oriStock", skuDetail.get("stock"));
skuDetail.put("stock", 0);
}
if (resetSkuZeroStockNum > 0 && skuDetail.containsKey("oriStock") && skuDetail.getInteger("oriStock") == 0) {
skuDetail.put("stock", resetSkuZeroStockNum);
}
if (resetSkuZeroStockNum > 0 && skuDetail.containsKey("oriStock") && skuDetail.getInteger("oriStock") == 0) {
skuDetail.put("stock", resetSkuZeroStockNum);
}
if ((ObjectUtil.isNotNull(resetSkuZeroStockNum) && resetSkuZeroStockNum > 0) && skuDetail.containsKey("stock") && skuDetail.getInteger("stock") == 0) {
skuDetail.put("stock", resetSkuZeroStockNum);
}
if ((ObjectUtil.isNotNull(resetSkuZeroStockNum) && resetSkuZeroStockNum > 0) && skuDetail.containsKey("stock") && skuDetail.getInteger("stock") == 0) {
skuDetail.put("stock", resetSkuZeroStockNum);
}
if (quantity > 0) {
skuDetail.put("stock", quantity);
if (quantity > 0) {
skuDetail.put("stock", quantity);
}
}
}
return skuMap;
@ -1901,25 +1905,25 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return moveBaseData;
}
private JSONObject buildFastModeAddSkuMinPriceSku(int isFastMode, JSONObject skus, JSONObject priceCondition, String defaultColorImg) {
private JSONObject buildFastModeAddSkuMinPriceSku(int isFastMode, JSONObject skus, MoveShopSettingBO priceCondition, String defaultColorImg) {
JSONObject skuMap = skus.getJSONObject("skuMap");
JSONObject colorMap = skus.getJSONObject("colorMap");
JSONObject sizeMap = skus.getJSONObject("sizeMap");
if (isFastMode != 1) {
return skus;
}
if (!priceCondition.containsKey("skuMinPriceStatus") || ObjectUtil.isEmpty(priceCondition.get("skuMinPriceStatus"))) {
return skus;
}
// if (isFastMode != 1) {
// return skus;
// }
if (!priceCondition.containsKey("skuMinPriceType") || !Objects.equals(priceCondition.getInteger("skuMinPriceType"), MoveConst.skuMinPriceTypeAdd)) {
return skus;
}
// if (!priceCondition.containsKey("skuMinPriceStatus") || ObjectUtil.isEmpty(priceCondition.get("skuMinPriceStatus"))) {
// return skus;
// }
//
// if (!priceCondition.containsKey("skuMinPriceType") || !Objects.equals(priceCondition.getInteger("skuMinPriceType"), MoveConst.skuMinPriceTypeAdd)) {
// return skus;
// }
double minPrice = -1;
Integer addSkuPriceSource = priceCondition.getInteger("addSkuPriceSource");
// Integer addSkuPriceSource = priceCondition.getInteger("addSkuPriceSource");
for (Object value : skuMap.values()) {
JSONObject sku = (JSONObject) value;
double price;
@ -1935,16 +1939,16 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
price = ((Number) sku.get("price")).doubleValue();
sourcePrice = ((Number) sku.get("price")).doubleValue();
}
if (minPrice == -1) {
minPrice = price;
if (addSkuPriceSource.equals(MoveConst.skuMinPriceSkuPriceSourceFromSource) && sku.containsKey("sourcePrice") && sku.get("sourcePrice") != null) {
minPrice = ((Number) sku.get("sourcePrice")).doubleValue();
}
continue;
}
if (addSkuPriceSource.equals(MoveConst.skuMinPriceSkuPriceSourceFromSource) && sku.containsKey("sourcePrice") && sku.get("sourcePrice") != null) {
price = ((Number) sku.get("sourcePrice")).doubleValue();
}
// if (minPrice == -1) {
// minPrice = price;
// if (addSkuPriceSource.equals(MoveConst.skuMinPriceSkuPriceSourceFromSource) && sku.containsKey("sourcePrice") && sku.get("sourcePrice") != null) {
// minPrice = ((Number) sku.get("sourcePrice")).doubleValue();
// }
// continue;
// }
// if (addSkuPriceSource.equals(MoveConst.skuMinPriceSkuPriceSourceFromSource) && sku.containsKey("sourcePrice") && sku.get("sourcePrice") != null) {
// price = ((Number) sku.get("sourcePrice")).doubleValue();
// }
if (minPrice > price) {
minPrice = price;
}
@ -1963,7 +1967,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return skus;
}
private Object[] processAddSkuMinPrice(JSONObject priceCondition, double minPrice, JSONObject colorMap, JSONObject sizeMap, JSONObject skuMap, String defaultColorImg) {
private Object[] processAddSkuMinPrice(MoveShopSettingBO priceCondition, double minPrice, JSONObject colorMap, JSONObject sizeMap, JSONObject skuMap, String defaultColorImg) {
if (colorMap.isEmpty() && sizeMap.isEmpty()) {
return new Object[]{colorMap, sizeMap, skuMap};
}
@ -1971,15 +1975,15 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
String skuMinPriceStr = "skuMinPrice";
if (!colorMap.isEmpty() && !sizeMap.isEmpty()) {
if (priceCondition.getInteger("addSkuMinPriceType").equals(MoveConst.skuMinSkuPriceTypeColor)) {
Object[] result = appendSkuMinPriceColorToSkuMap(priceCondition, minPrice, colorMap, sizeMap, skuMap, skuMinPriceStr);
colorMap = (JSONObject) result[0];
skuMap = (JSONObject) result[1];
} else {
// if (priceCondition.getInteger("addSkuMinPriceType").equals(MoveConst.skuMinSkuPriceTypeColor)) {
// Object[] result = appendSkuMinPriceColorToSkuMap(priceCondition, minPrice, colorMap, sizeMap, skuMap, skuMinPriceStr);
// colorMap = (JSONObject) result[0];
// skuMap = (JSONObject) result[1];
// } else {
Object[] result = appendSkuMinPriceSizeToSkuMap(priceCondition, minPrice, colorMap, sizeMap, skuMap, defaultColorImg);
sizeMap = (JSONObject) result[0];
skuMap = (JSONObject) result[1];
}
// }
}
if (!colorMap.isEmpty() && sizeMap.isEmpty()) {
@ -1988,7 +1992,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
JSONObject skuMinPrice = new JSONObject();
skuMinPrice.put("calPrice", minPrice);
skuMinPrice.put("isSkuMinPrice", true);
skuMinPrice.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
// skuMinPrice.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
skuMinPrice.put("calStock", 0);
skuMap.put(skuMinPriceKeyStr, skuMinPrice);
}
@ -1998,49 +2003,52 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
JSONObject skuMinPrice = new JSONObject();
skuMinPrice.put("calPrice", minPrice);
skuMinPrice.put("isSkuMinPrice", true);
skuMinPrice.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
// skuMinPrice.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
skuMinPrice.put("calStock", 0);
skuMap.put(skuMinPriceKeyStr, skuMinPrice);
}
return new Object[]{colorMap, sizeMap, skuMap};
}
private Object[] appendSkuMinPriceColorToSkuMap(JSONObject priceCondition, double minPrice, JSONObject colorMap, JSONObject sizeMap, JSONObject skuMap, String skuMinPriceStr) {
private Object[] appendSkuMinPriceColorToSkuMap(MoveShopSettingBO priceCondition, double minPrice, JSONObject colorMap, JSONObject sizeMap, JSONObject skuMap, String skuMinPriceStr) {
colorMap = appendSkuMinPriceSaleProp(colorMap, priceCondition, skuMinPriceStr, true, "");
for (String sizeKeyStr : sizeMap.keySet()) {
JSONObject colorInfo = sizeMap.getJSONObject(sizeKeyStr);
JSONObject temp = new JSONObject();
temp.put("calPrice", minPrice);
temp.put("isSkuMinPrice", true);
temp.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
// temp.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
temp.put("calStock", 0);
skuMap.put(";" + skuMinPriceStr + ";" + sizeKeyStr + ";", temp);
}
return new Object[]{colorMap, skuMap};
}
private Object[] appendSkuMinPriceSizeToSkuMap(JSONObject priceCondition, double minPrice, JSONObject colorMap, JSONObject sizeMap, JSONObject skuMap, String skuMinPriceStr) {
private Object[] appendSkuMinPriceSizeToSkuMap(MoveShopSettingBO priceCondition, double minPrice, JSONObject colorMap, JSONObject sizeMap, JSONObject skuMap, String skuMinPriceStr) {
sizeMap = appendSkuMinPriceSaleProp(sizeMap, priceCondition, skuMinPriceStr, false, "");
for (String colorKeyStr : colorMap.keySet()) {
JSONObject colorInfo = colorMap.getJSONObject(colorKeyStr);
JSONObject temp = new JSONObject();
temp.put("calPrice", minPrice);
temp.put("isSkuMinPrice", true);
temp.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
// temp.put("calStock", priceCondition.containsKey("addSkuMinPriceQuantity") ? priceCondition.getInteger("addSkuMinPriceQuantity") : 0);
temp.put("calStock", 0);
skuMap.put(";" + colorKeyStr + ";" + skuMinPriceStr + ";", temp);
}
return new Object[]{sizeMap, skuMap};
}
private JSONObject appendSkuMinPriceSaleProp(JSONObject saleProp, JSONObject priceCondition, String skuMinPriceStr, boolean isColor, String defaultColorImg) {
priceCondition.put("addSkuMinPriceSkuName", priceCondition.getOrDefault("addSkuMinPriceSkuName", "").toString().trim());
private JSONObject appendSkuMinPriceSaleProp(JSONObject saleProp, MoveShopSettingBO priceCondition, String skuMinPriceStr, boolean isColor, String defaultColorImg) {
// priceCondition.put("addSkuMinPriceSkuName", priceCondition.getOrDefault("addSkuMinPriceSkuName", "").toString().trim());
JSONObject propInfo = new JSONObject();
propInfo.put("name", priceCondition.getOrDefault("addSkuMinPriceSkuName", "定制款联系客服").toString());
// propInfo.put("name", priceCondition.getOrDefault("addSkuMinPriceSkuName", "定制款联系客服").toString());
if (isColor) {
String addSkuMinPriceColorImg = priceCondition.getString("addSkuMinPriceColorImg");
if (addSkuMinPriceColorImg.isEmpty() && !defaultColorImg.isEmpty()) {
addSkuMinPriceColorImg = defaultColorImg;
}
propInfo.put("imgUrls", new JSONArray().add(addSkuMinPriceColorImg));
// String addSkuMinPriceColorImg = priceCondition.getString("addSkuMinPriceColorImg");
// if (addSkuMinPriceColorImg.isEmpty() && !defaultColorImg.isEmpty()) {
// addSkuMinPriceColorImg = defaultColorImg;
// }
// propInfo.put("imgUrls", new JSONArray().add(addSkuMinPriceColorImg));
}
saleProp.put(skuMinPriceStr, propInfo);
return saleProp;

Loading…
Cancel
Save