Commit a76ec2dc by zhouhaibao

fix(strategy): 修复SOP策略动作处理逻辑

- 修正了消息类型为4时的动作内容设置顺序
- 将insert操作移至URL构建之前避免数据不一致
- 修改数据库操作从insert改为update以正确更新记录
- 更新测试用例中的策略名称避免重复
- 移除页面浏览记录测试方法简化代码结构
1 parent 5618651a
...@@ -311,17 +311,20 @@ public class StrategySopService { ...@@ -311,17 +311,20 @@ public class StrategySopService {
if (messageType == 4) { if (messageType == 4) {
action.setContent(actionReq.getPageTitle()); action.setContent(actionReq.getPageTitle());
String finalUrl = buildWebpageUrl(action);
if (StrUtil.isNotBlank(finalUrl)) {
action.setJumpUrl(finalUrl);
}
} }
} }
sopStrategyActionMapper.insertSelective(action); sopStrategyActionMapper.insertSelective(action);
Integer actionId = action.getId(); Integer actionId = action.getId();
if (messageType == 4) {
String finalUrl = buildWebpageUrl(action);
if (StrUtil.isNotBlank(finalUrl)) {
action.setJumpUrl(finalUrl);
}
}
sopStrategyActionMapper.updateByPrimaryKeySelective(action);
saveActionMedias(actionId, actionReq.getMedias(), createdBy); saveActionMedias(actionId, actionReq.getMedias(), createdBy);
actionNo++ ; actionNo++ ;
} }
......
...@@ -12,4 +12,6 @@ ore.starter.class-name=Main ...@@ -12,4 +12,6 @@ ore.starter.class-name=Main
# diamond config # diamond config
ore.diamond.group=dijia ore.diamond.group=dijia
ore.diamond.dataId=rpc-dj-strategy ore.diamond.dataId=rpc-dj-strategy
ore.diamond.env=release
\ No newline at end of file \ No newline at end of file
ore.diamond.env=release
# ROP HTTP配置
\ No newline at end of file \ No newline at end of file
...@@ -77,7 +77,7 @@ public class StrategySopServiceTest { ...@@ -77,7 +77,7 @@ public class StrategySopServiceTest {
@Test @Test
public void testCreateSopStrategy_Success() { public void testCreateSopStrategy_Success() {
SopStrategyCreateReqDTO request = new SopStrategyCreateReqDTO(); SopStrategyCreateReqDTO request = new SopStrategyCreateReqDTO();
request.setStrategyName("测试策略图片发送"); request.setStrategyName("测试策略图片发送54545466");
request.setBizType(1); request.setBizType(1);
request.setStoreScopeType(1); request.setStoreScopeType(1);
request.setMarketingStage("AFTER_DELIVERY"); request.setMarketingStage("AFTER_DELIVERY");
...@@ -454,23 +454,4 @@ public class StrategySopServiceTest { ...@@ -454,23 +454,4 @@ public class StrategySopServiceTest {
verify(sopStrategyExecutionService, never()).executeTask(anyInt()); verify(sopStrategyExecutionService, never()).executeTask(anyInt());
} }
@Test
public void testRecordMarketingPageView_Success() {
cn.com.glsx.dj.strategy.dto.sop.SopMarketingPageViewReqDTO request = new cn.com.glsx.dj.strategy.dto.sop.SopMarketingPageViewReqDTO();
request.setStrategyId(1L);
request.setExecutionRecordId(100L);
request.setCustomerInstanceId(200L);
request.setStoreName("门店A");
request.setCustomerName("张三");
request.setCustomerPhone("13800138000");
doNothing().when(sopStrategyEventLogService).recordH5PageViewEvent(
eq(1), eq(100L), eq(200L), eq("门店A"), eq("张三"), eq("13800138000"));
Boolean result = strategySopService.recordMarketingPageView(request);
assertTrue(result);
verify(sopStrategyEventLogService, times(1)).recordH5PageViewEvent(
eq(1), eq(100L), eq(200L), eq("门店A"), eq("张三"), eq("13800138000"));
}
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!