|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.ytpm.advertise.enums.AdPlatformTypeEnum;
|
|
|
import com.ytpm.advertise.enums.AdSourceTypeEnum;
|
|
|
import com.ytpm.agent.enums.UserStatusEnum;
|
|
|
@@ -20,6 +21,7 @@ import com.ytpm.lemonios.dao.AdRecordMapper;
|
|
|
import com.ytpm.lemonios.dao.AppUserMapper;
|
|
|
import com.ytpm.lemonios.service.AdService;
|
|
|
import com.ytpm.middle.view.*;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -35,6 +37,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@RefreshScope
|
|
|
public class AdServiceImpl implements AdService {
|
|
|
@@ -56,8 +59,20 @@ public class AdServiceImpl implements AdService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Result<?> saveRecord(DyzAdRecordParam param) {
|
|
|
YtDyzUser user;
|
|
|
- if (param.getUserId().isEmpty()) {
|
|
|
+ if (StrUtil.isEmpty(param.getUserId())) {
|
|
|
user = appUserMapper.selectByIosId((param.getIosId()));
|
|
|
+ YtDyzAdRecord adRecord = new YtDyzAdRecord();
|
|
|
+ if(Objects.isNull(param.getBeginTime()) || "null".equals(param.getBeginTime())){
|
|
|
+ if ("null".equals(param.getBeginTime())) {
|
|
|
+ log.warn("param beginTime is null !");
|
|
|
+ }
|
|
|
+ param.setBeginTime(param.getFinishTime());
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(param, adRecord);
|
|
|
+ adRecord.setUserId(user.getUserId());
|
|
|
+ adRecord.setRecordId(IdUtil.fastSimpleUUID());
|
|
|
+ adRecord.setNetworkName(AdPlatformTypeEnum.getDesc(Integer.parseInt(param.getNetworkFormId())));
|
|
|
+ adRecordMapper.addOneVisitor(adRecord);
|
|
|
} else {
|
|
|
user = appUserMapper.selectPrimaryKey(param.getUserId());
|
|
|
}
|