Commit 79f14dde by wutong

指定账号跑广告费

parent df6c088c
...@@ -51,19 +51,20 @@ public class AmazonAdProductJob extends PointJob { ...@@ -51,19 +51,20 @@ public class AmazonAdProductJob extends PointJob {
private final long SLEEP_WAIT = 8000; private final long SLEEP_WAIT = 8000;
@Override @Override
public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) { public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) {
int totalPage = getCount();//分片即将处理的账号总数 //int totalPage = getCount();//分片即将处理的账号总数
try { try {
JobAccountLogMapper jobAccountLogMapper = SessionUtil.getSession().getMapper(JobAccountLogMapper.class); JobAccountLogMapper jobAccountLogMapper = SessionUtil.getSession().getMapper(JobAccountLogMapper.class);
/* /*
* 根据不同分片 * 根据不同分片
* 再分页去拿不同的账号执行任务 * 再分页去拿不同的账号执行任务
*/ */
int pageSize = totalPage % shardingContext.getShardingTotalCount() == 0? totalPage / shardingContext.getShardingTotalCount() : totalPage / shardingContext.getShardingTotalCount() + 1; //int pageSize = totalPage % shardingContext.getShardingTotalCount() == 0? totalPage / shardingContext.getShardingTotalCount() : totalPage / shardingContext.getShardingTotalCount() + 1;
int pageSize= 0;
//拿到账号集合, TOKEN到用的时候再拿, 不放集合里 //拿到账号集合, TOKEN到用的时候再拿, 不放集合里
List<JobAccountLog> listByPage = jobAccountLogMapper.getListByPage(platformId,pageSize * shardingContext.getShardingItem(), pageSize); List<JobAccountLog> listByPage = jobAccountLogMapper.getListByPage(platformId,pageSize * shardingContext.getShardingItem(), pageSize);
if (listByPage != null && listByPage.size() > 0) { if (listByPage != null && listByPage.size() > 0) {
for (JobAccountLog jobAccountLog : listByPage) { for (JobAccountLog jobAccountLog : listByPage) {
log.warn("分片: " + shardingContext.getShardingItem() + " 账号: " + jobAccountLog); log.warn("账号个数: " + listByPage.size() + " 分片: " + shardingContext.getShardingItem() + " 账号: " + jobAccountLog);
if (jobAccountLog.getId() == null) { //在任务表无记录 if (jobAccountLog.getId() == null) { //在任务表无记录
BeanUtils.copyProperties(jobAccountLog, jobPointLog); BeanUtils.copyProperties(jobAccountLog, jobPointLog);
jobAccountLog.setId(null); jobAccountLog.setId(null);
...@@ -332,7 +333,7 @@ public class AmazonAdProductJob extends PointJob { ...@@ -332,7 +333,7 @@ public class AmazonAdProductJob extends PointJob {
int i = 0; int i = 0;
try { try {
DcBaseCompanyAccountMapper accountMapper = SessionUtil.getSession().getMapper(DcBaseCompanyAccountMapper.class); DcBaseCompanyAccountMapper accountMapper = SessionUtil.getSession().getMapper(DcBaseCompanyAccountMapper.class);
i = (int)accountMapper.countByExample(DcBaseCompanyAccountExample.newAndCreateCriteria().andPlatformIdEqualTo(platformId).example().limit(1, 63)); i = (int)accountMapper.countByExample(DcBaseCompanyAccountExample.newAndCreateCriteria().andPlatformIdEqualTo(platformId).example());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
......
...@@ -609,8 +609,13 @@ ...@@ -609,8 +609,13 @@
limit 1 limit 1
</select> </select>
<select id="getListByPage" resultType="com.bailuntec.domain.entity.JobAccountLog"> <!-- <select id="getListByPage" resultType="com.bailuntec.domain.entity.JobAccountLog">
SELECT t2.id,t1.company_id, t1.account_id, t2.job_name,t2.page_index,t2.page_size,t2.type,t2.interval_time,t2.start_time,t2.end_time, t2.task_ids FROM SELECT t2.id,t1.company_id, t1.account_id, t2.job_name,t2.page_index,t2.page_size,t2.type,t2.interval_time,t2.start_time,t2.end_time, t2.task_ids FROM
(SELECT * FROM dc_base_company_account WHERE 1=1 <if test="platformId != null">and platform_id=#{platformId} </if>) t1 LEFT JOIN job_account_log t2 on t1.account_id = t2.account_id order by id limit #{pageIndex},#{pageSize} (SELECT * FROM dc_base_company_account WHERE 1=1 <if test="platformId != null">and platform_id=#{platformId} </if>) t1 LEFT JOIN job_account_log t2 on t1.account_id = t2.account_id order by id limit #{pageIndex},#{pageSize}
</select>-->
<select id="getListByPage" resultType="com.bailuntec.domain.entity.JobAccountLog">
SELECT t2.message,t2.id,t1.company_id, t1.account_id, t2.job_name,t2.page_index,t2.page_size,t2.type,t2.interval_time,t2.start_time,t2.end_time, t2.task_ids FROM
(SELECT * FROM dc_base_company_account WHERE 1=1 and platform_id=15) t1 LEFT JOIN job_account_log t2 on t1.account_id = t2.account_id WHERE t2.message != '授权信息为空'order by id limit 1,24
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment