增加套餐产品红线价修改内容日志
This commit is contained in:
@@ -14,6 +14,8 @@ public final class EsLogType
|
||||
public static final String ARREARS = "ARREARS";
|
||||
/** Monitor: sync billing from TAB_ORDER */
|
||||
public static final String ORDER_SOURCE_SYNC = "ORDER_SOURCE_SYNC";
|
||||
/** Monitor: sales / product / redline price before-after changes */
|
||||
public static final String PRICE_CHANGE = "PRICE_CHANGE";
|
||||
|
||||
private EsLogType()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
package com.bms.price.search;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.bms.common.utils.SecurityUtils;
|
||||
import com.bms.common.utils.StringUtils;
|
||||
import com.bms.price.domain.PrcPriceSetDetail;
|
||||
|
||||
/**
|
||||
* Write sales / product / redline price before-after changes to ES (bms_biz_log).
|
||||
*/
|
||||
public final class PriceChangeEsLog
|
||||
{
|
||||
public static final String KIND_SALES = "SALES";
|
||||
public static final String KIND_PRODUCT = "PRODUCT";
|
||||
public static final String KIND_REDLINE = "REDLINE";
|
||||
|
||||
public static final String ACTION_INSERT = "INSERT";
|
||||
public static final String ACTION_UPDATE = "UPDATE";
|
||||
public static final String ACTION_DELETE = "DELETE";
|
||||
public static final String ACTION_IMPORT = "IMPORT";
|
||||
|
||||
private PriceChangeEsLog()
|
||||
{
|
||||
}
|
||||
|
||||
public static String operator()
|
||||
{
|
||||
try
|
||||
{
|
||||
String name = SecurityUtils.getUsername();
|
||||
return StringUtils.isEmpty(name) ? "unknown" : name;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, String> change(String field, String fieldLabel, Object oldValue, Object newValue)
|
||||
{
|
||||
Map<String, String> row = new LinkedHashMap<String, String>();
|
||||
row.put("field", field);
|
||||
row.put("fieldLabel", fieldLabel);
|
||||
row.put("oldValue", stringify(oldValue));
|
||||
row.put("newValue", stringify(newValue));
|
||||
return row;
|
||||
}
|
||||
|
||||
public static boolean valuesEqual(Object a, Object b)
|
||||
{
|
||||
if (a == null && b == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (a instanceof BigDecimal || b instanceof BigDecimal)
|
||||
{
|
||||
BigDecimal ba = toDecimal(a);
|
||||
BigDecimal bb = toDecimal(b);
|
||||
if (ba == null && bb == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (ba == null || bb == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ba.compareTo(bb) == 0;
|
||||
}
|
||||
return Objects.equals(stringify(a), stringify(b));
|
||||
}
|
||||
|
||||
public static void addIfChanged(List<Map<String, String>> changes, String field, String fieldLabel,
|
||||
Object oldValue, Object newValue)
|
||||
{
|
||||
if (changes == null || valuesEqual(oldValue, newValue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
changes.add(change(field, fieldLabel, oldValue, newValue));
|
||||
}
|
||||
|
||||
/** Sales detail price fields (freight / registration / discount). */
|
||||
public static List<Map<String, String>> diffSalesDetail(PrcPriceSetDetail oldRow, PrcPriceSetDetail newRow)
|
||||
{
|
||||
List<Map<String, String>> changes = new ArrayList<Map<String, String>>();
|
||||
if (newRow == null)
|
||||
{
|
||||
if (oldRow != null)
|
||||
{
|
||||
addIfChanged(changes, "fvValue", "\u8fd0\u8d39\u5355\u4ef7", oldRow.getFvValue(), null);
|
||||
addIfChanged(changes, "fvRegistrationFee", "\u6302\u53f7\u8d39", oldRow.getFvRegistrationFee(), null);
|
||||
addIfChanged(changes, "discountValue", "\u6298\u6263", oldRow.getDiscountValue(), null);
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
Object oldFv = oldRow == null ? null : oldRow.getFvValue();
|
||||
Object oldReg = oldRow == null ? null : oldRow.getFvRegistrationFee();
|
||||
Object oldDisc = oldRow == null ? null : oldRow.getDiscountValue();
|
||||
addIfChanged(changes, "fvValue", "\u8fd0\u8d39\u5355\u4ef7", oldFv, newRow.getFvValue());
|
||||
addIfChanged(changes, "fvRegistrationFee", "\u6302\u53f7\u8d39", oldReg, newRow.getFvRegistrationFee());
|
||||
addIfChanged(changes, "discountValue", "\u6298\u6263", oldDisc, newRow.getDiscountValue());
|
||||
return changes;
|
||||
}
|
||||
|
||||
public static List<Map<String, String>> diffCatalogPrice(BigDecimal oldFreight, BigDecimal oldReg,
|
||||
BigDecimal newFreight, BigDecimal newReg)
|
||||
{
|
||||
List<Map<String, String>> changes = new ArrayList<Map<String, String>>();
|
||||
addIfChanged(changes, "freightPrice", "\u8fd0\u8d39\u5355\u4ef7", oldFreight, newFreight);
|
||||
addIfChanged(changes, "registrationFee", "\u6302\u53f7\u8d39", oldReg, newReg);
|
||||
return changes;
|
||||
}
|
||||
|
||||
public static Map<String, Object> bizKeysSales(PrcPriceSetDetail d)
|
||||
{
|
||||
Map<String, Object> keys = new LinkedHashMap<String, Object>();
|
||||
if (d == null)
|
||||
{
|
||||
return keys;
|
||||
}
|
||||
keys.put("psdId", d.getPsdId());
|
||||
keys.put("psvId", d.getPsvId());
|
||||
keys.put("productCode", d.getProductCode());
|
||||
keys.put("productName", d.getProductName());
|
||||
keys.put("countryCode", d.getCountryCode());
|
||||
keys.put("countryName", d.getCountryName());
|
||||
keys.put("zoneCode", d.getZoneCode());
|
||||
keys.put("weightMin", d.getWeightMin());
|
||||
keys.put("weightMax", d.getWeightMax());
|
||||
return keys;
|
||||
}
|
||||
|
||||
public static void save(IBillSearchStore store, String bizId, String priceKind, String action,
|
||||
Map<String, Object> bizKeys, List<Map<String, String>> changes)
|
||||
{
|
||||
save(store, bizId, priceKind, action, bizKeys, changes, null, EsBizLogSupport.STATUS_SUCCESS, null);
|
||||
}
|
||||
|
||||
public static void save(IBillSearchStore store, String bizId, String priceKind, String action,
|
||||
Map<String, Object> bizKeys, List<Map<String, String>> changes, Object extra,
|
||||
String status, String errorMessage)
|
||||
{
|
||||
if (store == null || StringUtils.isEmpty(bizId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (changes != null && changes.isEmpty() && extra == null
|
||||
&& !ACTION_DELETE.equals(action) && !ACTION_INSERT.equals(action))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Map<String, Object> req = new LinkedHashMap<String, Object>();
|
||||
req.put("action", action);
|
||||
req.put("operator", operator());
|
||||
req.put("priceKind", priceKind);
|
||||
req.put("bizKeys", bizKeys);
|
||||
req.put("changes", changes == null ? new ArrayList<Map<String, String>>() : changes);
|
||||
if (extra != null)
|
||||
{
|
||||
req.put("extra", extra);
|
||||
}
|
||||
Map<String, Object> resp = new LinkedHashMap<String, Object>();
|
||||
resp.put("success", !EsBizLogSupport.STATUS_FAIL.equals(status));
|
||||
String st = StringUtils.isEmpty(status) ? EsBizLogSupport.STATUS_SUCCESS : status;
|
||||
store.save(EsLogType.PRICE_CHANGE, bizId, JSON.toJSONString(req), JSON.toJSONString(resp), st, errorMessage);
|
||||
}
|
||||
|
||||
public static String bizIdSales(Long psdId)
|
||||
{
|
||||
return "SALES_" + (psdId == null ? System.currentTimeMillis() : psdId);
|
||||
}
|
||||
|
||||
public static String bizIdProduct(Long detailId)
|
||||
{
|
||||
return "PRODUCT_" + (detailId == null ? System.currentTimeMillis() : detailId);
|
||||
}
|
||||
|
||||
public static String bizIdRedline(Long detailId)
|
||||
{
|
||||
return "REDLINE_" + (detailId == null ? System.currentTimeMillis() : detailId);
|
||||
}
|
||||
|
||||
private static String stringify(Object v)
|
||||
{
|
||||
if (v == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (v instanceof BigDecimal)
|
||||
{
|
||||
return ((BigDecimal) v).stripTrailingZeros().toPlainString();
|
||||
}
|
||||
return String.valueOf(v);
|
||||
}
|
||||
|
||||
private static BigDecimal toDecimal(Object v)
|
||||
{
|
||||
if (v == null || "".equals(v))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (v instanceof BigDecimal)
|
||||
{
|
||||
return (BigDecimal) v;
|
||||
}
|
||||
try
|
||||
{
|
||||
return new BigDecimal(String.valueOf(v).trim());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
-2
@@ -39,10 +39,14 @@ import com.bms.price.domain.BmsProductCountry;
|
||||
import com.bms.price.domain.BmsProductImportTask;
|
||||
import com.bms.price.domain.CatalogPreviewApplyRequest;
|
||||
import com.bms.price.domain.PrcZone;
|
||||
import com.bms.price.domain.PrcPriceSetDetail;
|
||||
import com.bms.price.mapper.BmsProductCountryMapper;
|
||||
import com.bms.price.mapper.BmsProductMapper;
|
||||
import com.bms.price.mapper.PrcPriceSetDetailMapper;
|
||||
import com.bms.price.mapper.PrcZoneMapper;
|
||||
import com.bms.price.domain.PrcPriceExcelFile;
|
||||
import com.bms.price.search.IBillSearchStore;
|
||||
import com.bms.price.search.PriceChangeEsLog;
|
||||
import com.bms.price.service.IBmsProductService;
|
||||
import com.bms.price.service.IPrcPriceExcelFileService;
|
||||
import com.bms.price.service.IPrcSurchargeRelService;
|
||||
@@ -106,6 +110,12 @@ public class BmsProductServiceImpl implements IBmsProductService
|
||||
@Autowired
|
||||
private IPrcPriceExcelFileService priceExcelFileService;
|
||||
|
||||
@Autowired
|
||||
private PrcPriceSetDetailMapper detailMapper;
|
||||
|
||||
@Autowired
|
||||
private IBillSearchStore billSearchStore;
|
||||
|
||||
@Override
|
||||
public BmsProduct selectBmsProductById(Long productId)
|
||||
{
|
||||
@@ -164,13 +174,36 @@ public class BmsProductServiceImpl implements IBmsProductService
|
||||
{
|
||||
if (country == null || country.getDetailId() == null)
|
||||
{
|
||||
throw new ServiceException("明细行主键缺失,无法修改");
|
||||
throw new ServiceException("\u660e\u7ec6\u884c\u4e3b\u952e\u7f3a\u5931\uff0c\u65e0\u6cd5\u4fee\u6539");
|
||||
}
|
||||
PrcPriceSetDetail old = detailMapper.selectPrcPriceSetDetailById(country.getDetailId());
|
||||
int rows = countryMapper.updateBmsProductCountry(country);
|
||||
if (rows > 0)
|
||||
{
|
||||
// 生效/失效日期可能变化,状态按日期重算
|
||||
// Recalc status when effective/expire dates change
|
||||
countryMapper.refreshStatusByDates();
|
||||
List<Map<String, String>> changes = PriceChangeEsLog.diffCatalogPrice(
|
||||
old == null ? null : old.getFvValue(),
|
||||
old == null ? null : old.getFvRegistrationFee(),
|
||||
country.getFreightPrice(),
|
||||
country.getRegistrationFee());
|
||||
if (!changes.isEmpty())
|
||||
{
|
||||
Map<String, Object> keys = new LinkedHashMap<String, Object>();
|
||||
keys.put("detailId", country.getDetailId());
|
||||
keys.put("productCode", country.getProductCode() != null ? country.getProductCode()
|
||||
: (old == null ? null : old.getProductCode()));
|
||||
keys.put("countryCode", country.getCountryCode() != null ? country.getCountryCode()
|
||||
: (old == null ? null : old.getCountryCode()));
|
||||
keys.put("zoneCode", country.getZoneCode() != null ? country.getZoneCode()
|
||||
: (old == null ? null : old.getZoneCode()));
|
||||
keys.put("weightMin", country.getWeightMin() != null ? country.getWeightMin()
|
||||
: (old == null ? null : old.getWeightMin()));
|
||||
keys.put("weightMax", country.getWeightMax() != null ? country.getWeightMax()
|
||||
: (old == null ? null : old.getWeightMax()));
|
||||
PriceChangeEsLog.save(billSearchStore, PriceChangeEsLog.bizIdProduct(country.getDetailId()),
|
||||
PriceChangeEsLog.KIND_PRODUCT, PriceChangeEsLog.ACTION_UPDATE, keys, changes);
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
+35
-2
@@ -40,11 +40,15 @@ import com.bms.price.domain.BmsRedlineProductImportTask;
|
||||
import com.bms.price.domain.RedlineCatalogPreviewApplyRequest;
|
||||
import com.bms.price.domain.PrcZone;
|
||||
import com.bms.price.domain.PrcSurchargeRel;
|
||||
import com.bms.price.domain.PrcPriceSetDetail;
|
||||
import com.bms.price.mapper.BmsRedlineProductCountryMapper;
|
||||
import com.bms.price.mapper.BmsRedlineProductMapper;
|
||||
import com.bms.price.mapper.PrcPriceSetDetailMapper;
|
||||
import com.bms.price.mapper.PrcSurchargeRelMapper;
|
||||
import com.bms.price.mapper.PrcZoneMapper;
|
||||
import com.bms.price.domain.PrcPriceExcelFile;
|
||||
import com.bms.price.search.IBillSearchStore;
|
||||
import com.bms.price.search.PriceChangeEsLog;
|
||||
import com.bms.price.service.IBmsRedlineProductService;
|
||||
import com.bms.price.service.IPrcPriceExcelFileService;
|
||||
import com.bms.price.domain.PriceType;
|
||||
@@ -107,6 +111,12 @@ public class BmsRedlineProductServiceImpl implements IBmsRedlineProductService
|
||||
@Autowired
|
||||
private IPrcPriceExcelFileService priceExcelFileService;
|
||||
|
||||
@Autowired
|
||||
private PrcPriceSetDetailMapper detailMapper;
|
||||
|
||||
@Autowired
|
||||
private IBillSearchStore billSearchStore;
|
||||
|
||||
@Override
|
||||
public BmsRedlineProduct selectBmsRedlineProductById(Long productId)
|
||||
{
|
||||
@@ -165,13 +175,36 @@ public class BmsRedlineProductServiceImpl implements IBmsRedlineProductService
|
||||
{
|
||||
if (country == null || country.getDetailId() == null)
|
||||
{
|
||||
throw new ServiceException("明细行主键缺失,无法修改");
|
||||
throw new ServiceException("\u660e\u7ec6\u884c\u4e3b\u952e\u7f3a\u5931\uff0c\u65e0\u6cd5\u4fee\u6539");
|
||||
}
|
||||
PrcPriceSetDetail old = detailMapper.selectPrcPriceSetDetailById(country.getDetailId());
|
||||
int rows = countryMapper.updateBmsRedlineProductCountry(country);
|
||||
if (rows > 0)
|
||||
{
|
||||
// 生效/失效日期可能变化,状态按日期重算
|
||||
// Recalc status when effective/expire dates change
|
||||
countryMapper.refreshStatusByDates();
|
||||
List<Map<String, String>> changes = PriceChangeEsLog.diffCatalogPrice(
|
||||
old == null ? null : old.getFvValue(),
|
||||
old == null ? null : old.getFvRegistrationFee(),
|
||||
country.getFreightPrice(),
|
||||
country.getRegistrationFee());
|
||||
if (!changes.isEmpty())
|
||||
{
|
||||
Map<String, Object> keys = new LinkedHashMap<String, Object>();
|
||||
keys.put("detailId", country.getDetailId());
|
||||
keys.put("productCode", country.getProductCode() != null ? country.getProductCode()
|
||||
: (old == null ? null : old.getProductCode()));
|
||||
keys.put("countryCode", country.getCountryCode() != null ? country.getCountryCode()
|
||||
: (old == null ? null : old.getCountryCode()));
|
||||
keys.put("zoneCode", country.getZoneCode() != null ? country.getZoneCode()
|
||||
: (old == null ? null : old.getZoneCode()));
|
||||
keys.put("weightMin", country.getWeightMin() != null ? country.getWeightMin()
|
||||
: (old == null ? null : old.getWeightMin()));
|
||||
keys.put("weightMax", country.getWeightMax() != null ? country.getWeightMax()
|
||||
: (old == null ? null : old.getWeightMax()));
|
||||
PriceChangeEsLog.save(billSearchStore, PriceChangeEsLog.bizIdRedline(country.getDetailId()),
|
||||
PriceChangeEsLog.KIND_REDLINE, PriceChangeEsLog.ACTION_UPDATE, keys, changes);
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
+65
@@ -51,6 +51,8 @@ import com.bms.price.mapper.PrcSurchargeRelMapper;
|
||||
import com.bms.common.core.domain.entity.SysUser;
|
||||
import com.bms.system.mapper.SysUserMapper;
|
||||
import com.bms.price.service.IBmsProductService;
|
||||
import com.bms.price.search.IBillSearchStore;
|
||||
import com.bms.price.search.PriceChangeEsLog;
|
||||
import com.bms.price.service.IPrcPriceExcelFileService;
|
||||
import com.bms.price.service.IPrcPriceSetService;
|
||||
import com.bms.price.task.PrcPriceSetSaveAsyncRunner;
|
||||
@@ -129,6 +131,9 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
@Autowired
|
||||
private IPrcPriceExcelFileService priceExcelFileService;
|
||||
|
||||
@Autowired
|
||||
private IBillSearchStore billSearchStore;
|
||||
|
||||
@Override
|
||||
public PrcPriceSet selectPrcPriceSetById(Long priceSetId)
|
||||
{
|
||||
@@ -1505,8 +1510,27 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
}
|
||||
if (!deleteIds.isEmpty())
|
||||
{
|
||||
Map<Long, PrcPriceSetDetail> beforeReplace = new HashMap<Long, PrcPriceSetDetail>();
|
||||
for (PrcPriceSetDetail d : details)
|
||||
{
|
||||
if (d != null && d.getPsdId() != null && deleteIds.contains(d.getPsdId()))
|
||||
{
|
||||
beforeReplace.put(d.getPsdId(), d);
|
||||
}
|
||||
}
|
||||
// Draft/pending: hard delete covered rows; effect/expired: soft delete.
|
||||
deleteDetailRowsByIds(deleteIds, isDraftOrPendingVersionStatus(resolveVersionStatus(psvId)));
|
||||
for (Long id : deleteIds)
|
||||
{
|
||||
PrcPriceSetDetail old = beforeReplace.get(id);
|
||||
if (old == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
PriceChangeEsLog.save(billSearchStore, PriceChangeEsLog.bizIdSales(id),
|
||||
PriceChangeEsLog.KIND_SALES, PriceChangeEsLog.ACTION_IMPORT,
|
||||
PriceChangeEsLog.bizKeysSales(old), PriceChangeEsLog.diffSalesDetail(old, null));
|
||||
}
|
||||
}
|
||||
removeDetailsByReplaceScopes(details, detailIndex, replaceScopes);
|
||||
}
|
||||
@@ -1573,6 +1597,8 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
{
|
||||
continue;
|
||||
}
|
||||
BigDecimal oldFv = hit.getFvValue();
|
||||
BigDecimal oldReg = hit.getFvRegistrationFee();
|
||||
detailMapper.updateDetailPrices(hit.getPsdId(), freight, registration);
|
||||
if (freight != null)
|
||||
{
|
||||
@@ -1582,6 +1608,14 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
{
|
||||
hit.setFvRegistrationFee(registration);
|
||||
}
|
||||
List<Map<String, String>> changes = PriceChangeEsLog.diffSalesDetail(
|
||||
buildPriceSnapshot(oldFv, oldReg), hit);
|
||||
if (!changes.isEmpty())
|
||||
{
|
||||
PriceChangeEsLog.save(billSearchStore, PriceChangeEsLog.bizIdSales(hit.getPsdId()),
|
||||
PriceChangeEsLog.KIND_SALES, PriceChangeEsLog.ACTION_IMPORT,
|
||||
PriceChangeEsLog.bizKeysSales(hit), changes);
|
||||
}
|
||||
touched.add(hit.getPsdId());
|
||||
updated++;
|
||||
}
|
||||
@@ -1606,6 +1640,9 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
{
|
||||
touched.add(created.getPsdId());
|
||||
}
|
||||
PriceChangeEsLog.save(billSearchStore, PriceChangeEsLog.bizIdSales(created.getPsdId()),
|
||||
PriceChangeEsLog.KIND_SALES, PriceChangeEsLog.ACTION_IMPORT,
|
||||
PriceChangeEsLog.bizKeysSales(created), PriceChangeEsLog.diffSalesDetail(null, created));
|
||||
inserted++;
|
||||
}
|
||||
}
|
||||
@@ -2116,6 +2153,16 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
{
|
||||
replaceSalesSurchargeRels(java.util.Collections.singletonList(detail));
|
||||
}
|
||||
if (rows > 0)
|
||||
{
|
||||
List<Map<String, String>> changes = PriceChangeEsLog.diffSalesDetail(old, detail);
|
||||
if (!changes.isEmpty())
|
||||
{
|
||||
PriceChangeEsLog.save(billSearchStore, PriceChangeEsLog.bizIdSales(old.getPsdId()),
|
||||
PriceChangeEsLog.KIND_SALES, PriceChangeEsLog.ACTION_UPDATE,
|
||||
PriceChangeEsLog.bizKeysSales(detail.getPsdId() != null ? detail : old), changes);
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@@ -2130,6 +2177,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
List<Long> softIds = new ArrayList<Long>();
|
||||
Set<String> hardTouchKeys = new HashSet<String>();
|
||||
Set<String> softTouchKeys = new HashSet<String>();
|
||||
List<PrcPriceSetDetail> deletedSnapshots = new ArrayList<PrcPriceSetDetail>();
|
||||
for (Long id : psdIds)
|
||||
{
|
||||
if (id == null)
|
||||
@@ -2143,6 +2191,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
}
|
||||
PrcPriceSet db = requireSet(resolvePriceSetIdByPsvId(old.getPsvId()));
|
||||
assertChildEditable(db);
|
||||
deletedSnapshots.add(old);
|
||||
boolean hard = isDraftOrPendingVersionStatus(resolveVersionStatus(old.getPsvId()));
|
||||
if (hard)
|
||||
{
|
||||
@@ -2172,6 +2221,13 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
rows += deleteDetailRowsByIds(softIds, false);
|
||||
cleanupOrphanSetProducts(softTouchKeys, false);
|
||||
}
|
||||
for (PrcPriceSetDetail old : deletedSnapshots)
|
||||
{
|
||||
List<Map<String, String>> changes = PriceChangeEsLog.diffSalesDetail(old, null);
|
||||
PriceChangeEsLog.save(billSearchStore, PriceChangeEsLog.bizIdSales(old.getPsdId()),
|
||||
PriceChangeEsLog.KIND_SALES, PriceChangeEsLog.ACTION_DELETE,
|
||||
PriceChangeEsLog.bizKeysSales(old), changes);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@@ -2195,6 +2251,15 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
return detailMapper.deletePrcPriceSetDetailByIds(arr);
|
||||
}
|
||||
|
||||
/** Snapshot freight/registration for import before-after log. */
|
||||
private PrcPriceSetDetail buildPriceSnapshot(BigDecimal fvValue, BigDecimal registrationFee)
|
||||
{
|
||||
PrcPriceSetDetail snap = new PrcPriceSetDetail();
|
||||
snap.setFvValue(fvValue);
|
||||
snap.setFvRegistrationFee(registrationFee);
|
||||
return snap;
|
||||
}
|
||||
|
||||
/** Version status draft(0) / pending(3): hard delete children. */
|
||||
private boolean isDraftOrPendingVersionStatus(String status)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user