|
@@ -4,7 +4,6 @@ import cn.com.ctop.common.module.entity.MailLog;
|
|
import cn.com.ctop.common.module.entity.Project;
|
|
import cn.com.ctop.common.module.entity.Project;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.mapper.MailLogMapper;
|
|
import cn.com.ctop.common.module.mapper.MailLogMapper;
|
|
-import cn.com.ctop.common.module.service.ICorpFeishuUserService;
|
|
|
|
import cn.com.ctop.common.module.service.IProjectService;
|
|
import cn.com.ctop.common.module.service.IProjectService;
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
import cn.com.ctop.common.module.utils.BigDecimalUtil;
|
|
import cn.com.ctop.common.module.utils.BigDecimalUtil;
|
|
@@ -28,8 +27,6 @@ import java.util.List;
|
|
@Slf4j
|
|
@Slf4j
|
|
public class BytedanceBidWarningServiceImpl implements IBytedanceBidWarningService {
|
|
public class BytedanceBidWarningServiceImpl implements IBytedanceBidWarningService {
|
|
@Autowired
|
|
@Autowired
|
|
- private ICorpFeishuUserService corpFeishuUserService;
|
|
|
|
- @Autowired
|
|
|
|
private IProjectService projectService;
|
|
private IProjectService projectService;
|
|
@Autowired
|
|
@Autowired
|
|
private IUserAllocationService userAllocationService;
|
|
private IUserAllocationService userAllocationService;
|
|
@@ -40,46 +37,42 @@ public class BytedanceBidWarningServiceImpl implements IBytedanceBidWarningServi
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void bidWarning() {
|
|
public void bidWarning() {
|
|
- XxlJobLogger.log("---------头条出价预警定时任务开始----------");
|
|
|
|
|
|
+ XxlJobLogger.log("开始头条出价预警定时任务");
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
try {
|
|
try {
|
|
List<Project> projects = projectService.list();
|
|
List<Project> projects = projectService.list();
|
|
- if (Check.isNull(projects)) {
|
|
|
|
- XxlJobLogger.log("查询所属项目为空");
|
|
|
|
- return ;
|
|
|
|
- }
|
|
|
|
- for (Project project : projects) {
|
|
|
|
- if (Check.isNull(project)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- Long maxBid = project.getMaxBid();
|
|
|
|
- Long projectId = project.getId();
|
|
|
|
- List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
|
|
|
|
- if (Check.isNull(userAllocations)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- for (UserAllocation userAllocation : userAllocations) {
|
|
|
|
- if (userAllocation.getAccountStatus() == 1) {
|
|
|
|
|
|
+ if (!Check.isNull(projects)) {
|
|
|
|
+ for (Project project : projects) {
|
|
|
|
+ if (Check.isNull(project)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- Long accountId = userAllocation.getAccountId();
|
|
|
|
- List<String> unitWarning = new ArrayList<>();
|
|
|
|
- if ("1".equals(userAllocation.getMediaId())) {
|
|
|
|
- BigDecimal bid = new BigDecimal(maxBid);
|
|
|
|
- BigDecimal bigDecimal = BigDecimalUtil.divideBigDecimal(bid, new BigDecimal(1000));
|
|
|
|
- unitWarning = byteDanceAdvertisePlanService.selectWarningGroup(accountId, bigDecimal);
|
|
|
|
- if (!Check.isNull(unitWarning)) {
|
|
|
|
- sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
|
|
|
|
|
|
+ Long maxBid = project.getMaxBid();
|
|
|
|
+ Long projectId = project.getId();
|
|
|
|
+ List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
|
|
|
|
+ if (!Check.isNull(userAllocations)) {
|
|
|
|
+ for (UserAllocation userAllocation : userAllocations) {
|
|
|
|
+ if (userAllocation.getAccountStatus() == 1) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Long accountId = userAllocation.getAccountId();
|
|
|
|
+ List<String> unitWarning = new ArrayList<>();
|
|
|
|
+ if ("1".equals(userAllocation.getMediaId())) {
|
|
|
|
+ BigDecimal bid = new BigDecimal(maxBid);
|
|
|
|
+ BigDecimal bigDecimal = BigDecimalUtil.divideBigDecimal(bid, new BigDecimal(1000));
|
|
|
|
+ unitWarning = byteDanceAdvertisePlanService.selectWarningGroup(accountId, bigDecimal);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(unitWarning)) {
|
|
|
|
+ sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
XxlJobLogger.log("头条出价预警定时任务执行完毕,共耗时:{} s", (System.currentTimeMillis() - start) / 1000);
|
|
XxlJobLogger.log("头条出价预警定时任务执行完毕,共耗时:{} s", (System.currentTimeMillis() - start) / 1000);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
|
|
private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
|