Compare commits
2 Commits
61099b2514
...
8633019788
| Author | SHA1 | Date | |
|---|---|---|---|
| 8633019788 | |||
| 4148c447fc |
@@ -134,4 +134,7 @@ public interface PrcOrderBillMapper
|
|||||||
@Param("surchargeAmount") BigDecimal surchargeAmount,
|
@Param("surchargeAmount") BigDecimal surchargeAmount,
|
||||||
@Param("incomeTotal") BigDecimal incomeTotal,
|
@Param("incomeTotal") BigDecimal incomeTotal,
|
||||||
@Param("payTotal") BigDecimal payTotal);
|
@Param("payTotal") BigDecimal payTotal);
|
||||||
|
|
||||||
|
/** Count order bills that reference this sales package version. */
|
||||||
|
int countByPsvId(@Param("psvId") Long psvId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ public class EsBillSearchStore implements IBillSearchStore
|
|||||||
doc.put("bizId", bizId.trim());
|
doc.put("bizId", bizId.trim());
|
||||||
doc.put("status", StringUtils.isEmpty(status) ? EsBizLogSupport.STATUS_SUCCESS : status.trim());
|
doc.put("status", StringUtils.isEmpty(status) ? EsBizLogSupport.STATUS_SUCCESS : status.trim());
|
||||||
doc.put("error", StringUtils.isEmpty(errorMessage) ? null : errorMessage);
|
doc.put("error", StringUtils.isEmpty(errorMessage) ? null : errorMessage);
|
||||||
doc.put("request", parseOrRaw(requestJson));
|
// Index dynamic mapping is strict on a few fields; coerce before PUT.
|
||||||
// Normalize response.ok boolean -> 1/0: index mapping typed response.ok as long.
|
doc.put("request", normalizeRequestForEs(parseOrRaw(requestJson)));
|
||||||
doc.put("response", normalizeResponseForEs(parseOrRaw(responseJson)));
|
doc.put("response", normalizeResponseForEs(parseOrRaw(responseJson)));
|
||||||
String ts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now);
|
String ts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now);
|
||||||
doc.put("updatedAt", ts);
|
doc.put("updatedAt", ts);
|
||||||
@@ -86,7 +86,26 @@ public class EsBillSearchStore implements IBillSearchStore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Index historically mapped response.ok as long; coerce boolean to 1/0. */
|
/**
|
||||||
|
* request.bizDate is mapped as date (ISO / epoch only); bill writes "yyyy-MM-dd HH:mm:ss".
|
||||||
|
* request.taskId is mapped as long; UUID strings must not stay under taskId.
|
||||||
|
*/
|
||||||
|
private Object normalizeRequestForEs(Object request)
|
||||||
|
{
|
||||||
|
if (!(request instanceof JSONObject))
|
||||||
|
{
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
JSONObject obj = (JSONObject) request;
|
||||||
|
normalizeBizDateField(obj);
|
||||||
|
relocateNonNumericTaskId(obj);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* response.ok mapped as long; response.success as boolean; response.taskId as long.
|
||||||
|
* Local rebill DONE used UUID taskId + numeric success and was rejected by ES.
|
||||||
|
*/
|
||||||
private Object normalizeResponseForEs(Object response)
|
private Object normalizeResponseForEs(Object response)
|
||||||
{
|
{
|
||||||
if (!(response instanceof JSONObject))
|
if (!(response instanceof JSONObject))
|
||||||
@@ -99,9 +118,54 @@ public class EsBillSearchStore implements IBillSearchStore
|
|||||||
{
|
{
|
||||||
obj.put("ok", Boolean.TRUE.equals(ok) ? Integer.valueOf(1) : Integer.valueOf(0));
|
obj.put("ok", Boolean.TRUE.equals(ok) ? Integer.valueOf(1) : Integer.valueOf(0));
|
||||||
}
|
}
|
||||||
|
Object success = obj.get("success");
|
||||||
|
if (success instanceof Number)
|
||||||
|
{
|
||||||
|
obj.put("success", Boolean.valueOf(((Number) success).intValue() != 0));
|
||||||
|
}
|
||||||
|
relocateNonNumericTaskId(obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void normalizeBizDateField(JSONObject obj)
|
||||||
|
{
|
||||||
|
Object raw = obj.get("bizDate");
|
||||||
|
if (!(raw instanceof String))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String bizDate = ((String) raw).trim();
|
||||||
|
// "yyyy-MM-dd HH:mm:ss" -> ISO-local so ES date mapper accepts it.
|
||||||
|
if (bizDate.length() >= 19 && bizDate.charAt(10) == ' ')
|
||||||
|
{
|
||||||
|
obj.put("bizDate", bizDate.substring(0, 10) + "T" + bizDate.substring(11));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void relocateNonNumericTaskId(JSONObject obj)
|
||||||
|
{
|
||||||
|
Object taskId = obj.get("taskId");
|
||||||
|
if (!(taskId instanceof String))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String text = ((String) taskId).trim();
|
||||||
|
if (text.isEmpty())
|
||||||
|
{
|
||||||
|
obj.remove("taskId");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj.put("taskId", Long.valueOf(Long.parseLong(text)));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
obj.remove("taskId");
|
||||||
|
obj.put("taskIdStr", text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BillSyncSnapshot get(String logType, String bizId)
|
public BillSyncSnapshot get(String logType, String bizId)
|
||||||
{
|
{
|
||||||
|
|||||||
+11
-3
@@ -40,6 +40,7 @@ import com.bms.price.domain.PrcSurchargeRel;
|
|||||||
import com.bms.price.mapper.BmsProductCountryMapper;
|
import com.bms.price.mapper.BmsProductCountryMapper;
|
||||||
import com.bms.price.mapper.BmsProductMapper;
|
import com.bms.price.mapper.BmsProductMapper;
|
||||||
import com.bms.price.mapper.PrcCustomerPriceSetMapper;
|
import com.bms.price.mapper.PrcCustomerPriceSetMapper;
|
||||||
|
import com.bms.price.mapper.PrcOrderBillMapper;
|
||||||
import com.bms.price.mapper.PrcPriceSetDetailMapper;
|
import com.bms.price.mapper.PrcPriceSetDetailMapper;
|
||||||
import com.bms.price.mapper.PrcPriceSetMapper;
|
import com.bms.price.mapper.PrcPriceSetMapper;
|
||||||
import com.bms.price.mapper.PrcPriceSetProductMapper;
|
import com.bms.price.mapper.PrcPriceSetProductMapper;
|
||||||
@@ -141,6 +142,9 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IBmsCustomerService bmsCustomerService;
|
private IBmsCustomerService bmsCustomerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PrcOrderBillMapper orderBillMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrcPriceSet selectPrcPriceSetById(Long priceSetId)
|
public PrcPriceSet selectPrcPriceSetById(Long priceSetId)
|
||||||
{
|
{
|
||||||
@@ -626,7 +630,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
|||||||
{
|
{
|
||||||
throw new ServiceException(MessageUtils.message("price.set.version.notExists"));
|
throw new ServiceException(MessageUtils.message("price.set.version.notExists"));
|
||||||
}
|
}
|
||||||
// Draft / pending: hard delete; EFFECT: soft delete then reopen previous via refreshVersionStatus
|
// Draft / pending / effect may be deleted; expired stays view-only.
|
||||||
if (!VER_DRAFT.equals(version.getStatus())
|
if (!VER_DRAFT.equals(version.getStatus())
|
||||||
&& !VER_PENDING.equals(version.getStatus())
|
&& !VER_PENDING.equals(version.getStatus())
|
||||||
&& !VER_EFFECT.equals(version.getStatus()))
|
&& !VER_EFFECT.equals(version.getStatus()))
|
||||||
@@ -634,9 +638,13 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
|||||||
throw new ServiceException(MessageUtils.message("price.set.version.delete.statusNotAllowed"));
|
throw new ServiceException(MessageUtils.message("price.set.version.delete.statusNotAllowed"));
|
||||||
}
|
}
|
||||||
requireSet(version.getPriceSetId());
|
requireSet(version.getPriceSetId());
|
||||||
wipeVersionChildren(psvId, version.getStatus());
|
// Products / details / surcharge always physical delete.
|
||||||
|
surchargeRelMapper.physicalDeleteByPsvId(psvId);
|
||||||
|
detailMapper.physicalDeleteByPsvId(psvId);
|
||||||
|
setProductMapper.physicalDeleteByPsvId(psvId);
|
||||||
|
// Version: soft-delete when any order bill references psv_id; otherwise hard-delete.
|
||||||
int rows;
|
int rows;
|
||||||
if (VER_EFFECT.equals(version.getStatus()))
|
if (orderBillMapper.countByPsvId(psvId) > 0)
|
||||||
{
|
{
|
||||||
rows = versionMapper.softDeleteById(psvId, updateBy);
|
rows = versionMapper.softDeleteById(psvId, updateBy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1070,4 +1070,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
where bill_id = #{billId}
|
where bill_id = #{billId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="countByPsvId" resultType="int">
|
||||||
|
select count(1) from prc_order_bill where psv_id = #{psvId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -448,8 +448,8 @@ function onCreateVersion() {
|
|||||||
function onRemoveVersion(row) {
|
function onRemoveVersion(row) {
|
||||||
if (!row || row.psvId == null) return
|
if (!row || row.psvId == null) return
|
||||||
const msg = isEffectVersion(row)
|
const msg = isEffectVersion(row)
|
||||||
? "确认软删除已生效版本(生效时间:" + (row.effectiveTime || '未设置') + ")?版本及产品、明细将标记为已删除,上一版将自动恢复生效并清空失效时间。"
|
? "确认删除该版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除,且上一版将自动恢复生效。"
|
||||||
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?其明细与附加费将一并删除。"
|
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除。"
|
||||||
proxy.$modal.confirm(msg).then(() => {
|
proxy.$modal.confirm(msg).then(() => {
|
||||||
removingPsvId.value = row.psvId
|
removingPsvId.value = row.psvId
|
||||||
proxy.$modal.loading("正在删除,请稍候...")
|
proxy.$modal.loading("正在删除,请稍候...")
|
||||||
|
|||||||
@@ -465,8 +465,8 @@ function onCreateVersion() {
|
|||||||
function onRemoveVersion(row) {
|
function onRemoveVersion(row) {
|
||||||
if (!row || row.psvId == null) return
|
if (!row || row.psvId == null) return
|
||||||
const msg = isEffectVersion(row)
|
const msg = isEffectVersion(row)
|
||||||
? "确认软删除已生效版本(生效时间:" + (row.effectiveTime || '未设置') + ")?版本及产品、明细将标记为已删除,上一版将自动恢复生效并清空失效时间。"
|
? "确认删除该版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除,且上一版将自动恢复生效。"
|
||||||
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?其明细与附加费将一并删除。"
|
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除。"
|
||||||
proxy.$modal.confirm(msg).then(() => {
|
proxy.$modal.confirm(msg).then(() => {
|
||||||
removingPsvId.value = row.psvId
|
removingPsvId.value = row.psvId
|
||||||
proxy.$modal.loading("正在删除,请稍候...")
|
proxy.$modal.loading("正在删除,请稍候...")
|
||||||
|
|||||||
Reference in New Issue
Block a user