Commit 5a20aefd by chenxi

Merge remote-tracking branch 'origin/v5.8.3' into v5.8.3

2 parents 950ea110 2974b347
...@@ -27,14 +27,14 @@ public class SopStrategyEventLogService { ...@@ -27,14 +27,14 @@ public class SopStrategyEventLogService {
public static final String EVENT_CODE_H5_PAGE_VIEW = "sop_strategy_h5_marketing_page_view"; public static final String EVENT_CODE_H5_PAGE_VIEW = "sop_strategy_h5_marketing_page_view";
public void recordMenuEntryEvent() { public void recordMenuEntryEvent() {
recordEvent(null, null, "SOP策略", EVENT_CODE_MENU_ENTRY, null); recordEvent(null, null, "SOP策略", EVENT_CODE_MENU_ENTRY, null, null);
} }
public void recordSubmitChangeEvent(Integer strategyId, Long taskId) { public void recordSubmitChangeEvent(Integer strategyId, Long taskId, String createdBy) {
Map<String, Object> eventData = new HashMap<>(); Map<String, Object> eventData = new HashMap<>();
eventData.put("strategyId", strategyId); eventData.put("strategyId", strategyId);
eventData.put("taskId", taskId); eventData.put("taskId", taskId);
recordEvent(strategyId, null, "SOP策略", EVENT_CODE_SUBMIT_CHANGE, eventData); recordEvent(strategyId, null, "SOP策略", EVENT_CODE_SUBMIT_CHANGE, eventData,createdBy);
} }
public void recordH5PageViewEvent(Integer strategyId, Long taskId, public void recordH5PageViewEvent(Integer strategyId, Long taskId,
...@@ -46,11 +46,12 @@ public class SopStrategyEventLogService { ...@@ -46,11 +46,12 @@ public class SopStrategyEventLogService {
eventData.put("storeName", storeName); eventData.put("storeName", storeName);
eventData.put("customerName", customerName); eventData.put("customerName", customerName);
eventData.put("customerPhone", customerPhone); eventData.put("customerPhone", customerPhone);
recordEvent(strategyId, taskId,"SOP策略", EVENT_CODE_H5_PAGE_VIEW, eventData); recordEvent(strategyId, taskId,"SOP策略", EVENT_CODE_H5_PAGE_VIEW, eventData, null);
} }
private void recordEvent(Integer strategyId, private void recordEvent(Integer strategyId,
Long taskId, String eventType, String eventCode, Map<String, Object> eventData) { Long taskId, String eventType, String eventCode, Map<String, Object> eventData,
String createdBy) {
try { try {
SopStrategyEventLog eventLog = new SopStrategyEventLog(); SopStrategyEventLog eventLog = new SopStrategyEventLog();
eventLog.setStrategyId(strategyId); eventLog.setStrategyId(strategyId);
...@@ -65,6 +66,7 @@ public class SopStrategyEventLogService { ...@@ -65,6 +66,7 @@ public class SopStrategyEventLogService {
} }
} }
eventLog.setEventTime(new Date()); eventLog.setEventTime(new Date());
eventLog.setCreatedBy(createdBy);
eventLog.setDeletedFlag("N"); eventLog.setDeletedFlag("N");
sopStrategyEventLogMapper.insertSelective(eventLog); sopStrategyEventLogMapper.insertSelective(eventLog);
log.info("记录埋点事件成功, eventCode:{}, strategyId:{}", log.info("记录埋点事件成功, eventCode:{}, strategyId:{}",
......
...@@ -78,7 +78,7 @@ public class StrategySopService { ...@@ -78,7 +78,7 @@ public class StrategySopService {
saveStrategyBranches(strategyId, request.getBranches(), createdBy); saveStrategyBranches(strategyId, request.getBranches(), createdBy);
sopStrategyEventLogService.recordSubmitChangeEvent(strategyId, null); sopStrategyEventLogService.recordSubmitChangeEvent(strategyId, null,createdBy);
log.info("创建策略成功, strategyId:{}, strategyCode:{}", strategyId, strategyCode); log.info("创建策略成功, strategyId:{}, strategyCode:{}", strategyId, strategyCode);
return strategyId; return strategyId;
} }
...@@ -108,9 +108,10 @@ public class StrategySopService { ...@@ -108,9 +108,10 @@ public class StrategySopService {
sopStrategyActionMediaMapper.deleteByStrategyId(request.getStrategyId()); sopStrategyActionMediaMapper.deleteByStrategyId(request.getStrategyId());
sopStrategyActionMapper.deleteByStrategyId(request.getStrategyId()); sopStrategyActionMapper.deleteByStrategyId(request.getStrategyId());
sopStrategyBranchMapper.deleteByStrategyId(request.getStrategyId()); sopStrategyBranchMapper.deleteByStrategyId(request.getStrategyId());
sopStrategyConditionGroupMapper.deleteByStrategyIdAndStep(request.getStrategyId(), 3);
saveStrategyBranches(request.getStrategyId(), request.getBranches(), updatedBy); saveStrategyBranches(request.getStrategyId(), request.getBranches(), updatedBy);
sopStrategyEventLogService.recordSubmitChangeEvent(request.getStrategyId(), null); sopStrategyEventLogService.recordSubmitChangeEvent(request.getStrategyId(), null, updatedBy);
sopStrategySnapshotCacheService.evictStrategyCache(request.getStrategyId()); sopStrategySnapshotCacheService.evictStrategyCache(request.getStrategyId());
log.info("更新策略成功, strategyId:{}, version:{}", request.getStrategyId(), strategy.getVersion()); log.info("更新策略成功, strategyId:{}, version:{}", request.getStrategyId(), strategy.getVersion());
return true; return true;
...@@ -252,7 +253,6 @@ public class StrategySopService { ...@@ -252,7 +253,6 @@ public class StrategySopService {
return; return;
} }
int groupNo = 1; int groupNo = 1;
sopStrategyConditionGroupMapper.deleteByStrategyIdAndStep(strategyId, 3);
for (SopConditionGroupReqDTO groupReq : conditionGroups) { for (SopConditionGroupReqDTO groupReq : conditionGroups) {
SopStrategyConditionGroup group = BeanUtil.copyProperties(groupReq, SopStrategyConditionGroup.class); SopStrategyConditionGroup group = BeanUtil.copyProperties(groupReq, SopStrategyConditionGroup.class);
group.setStrategyId(strategyId); group.setStrategyId(strategyId);
......
...@@ -43,25 +43,6 @@ public class SopStrategyEventLogServiceTest { ...@@ -43,25 +43,6 @@ public class SopStrategyEventLogServiceTest {
} }
@Test @Test
public void testRecordSubmitChangeEvent() {
doNothing().when(sopStrategyEventLogMapper).insertSelective(any(SopStrategyEventLog.class));
sopStrategyEventLogService.recordSubmitChangeEvent(1, 100L);
verify(sopStrategyEventLogMapper, times(1)).insertSelective(any(SopStrategyEventLog.class));
}
@Test
public void testRecordSubmitChangeEvent_NullExecutionRecordId() {
doNothing().when(sopStrategyEventLogMapper).insertSelective(any(SopStrategyEventLog.class));
sopStrategyEventLogService.recordSubmitChangeEvent(1, null);
verify(sopStrategyEventLogMapper, times(1)).insertSelective(any(SopStrategyEventLog.class));
}
@Test
public void testRecordEvent_Exception() { public void testRecordEvent_Exception() {
doThrow(new RuntimeException("数据库异常")).when(sopStrategyEventLogMapper).insertSelective(any(SopStrategyEventLog.class)); doThrow(new RuntimeException("数据库异常")).when(sopStrategyEventLogMapper).insertSelective(any(SopStrategyEventLog.class));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!