Commit 24e1ef84 by fudahua

一分钟之内没完成 就重试

parent 85b2ef3c
...@@ -151,4 +151,13 @@ public interface PreDealLogMapper { ...@@ -151,4 +151,13 @@ public interface PreDealLogMapper {
*/ */
public int countByDataId(@Param("taskId") String taskId, @Param("dataId") String dataId,@Param("dataType") int dataType); public int countByDataId(@Param("taskId") String taskId, @Param("dataId") String dataId,@Param("dataType") int dataType);
/**
* 统计任务数量
* countExcepAndPreByTaskId
*
* @param taskId
* @return
*/
public TabHaobanPreDealLog getLastPreDataByTaskId(@Param("taskId") String taskId);
} }
\ No newline at end of file
...@@ -138,4 +138,11 @@ public interface PreDealService { ...@@ -138,4 +138,11 @@ public interface PreDealService {
* @return * @return
*/ */
public boolean existDataId(String taskId, String dataId); public boolean existDataId(String taskId, String dataId);
/**
* 获取最近的数据
*
* @return
*/
public PreDealLogInfoDTO getLastPreDataByTaskId(String taskId);
} }
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.impl; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.impl;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.PreDealLogInfoDTO; import com.gic.haoban.manage.api.dto.PreDealLogInfoDTO;
import com.gic.haoban.manage.api.dto.SyncCheckDTO; import com.gic.haoban.manage.api.dto.SyncCheckDTO;
...@@ -120,4 +121,10 @@ public class PreDealServiceImpl implements PreDealService { ...@@ -120,4 +121,10 @@ public class PreDealServiceImpl implements PreDealService {
int i = preDealLogMapper.countByDataId(taskId, dataId,PreDealTypeEnum.clerk.getVal()); int i = preDealLogMapper.countByDataId(taskId, dataId,PreDealTypeEnum.clerk.getVal());
return i > 0; return i > 0;
} }
@Override
public PreDealLogInfoDTO getLastPreDataByTaskId(String taskId) {
TabHaobanPreDealLog preDealLog = preDealLogMapper.getLastPreDataByTaskId(taskId);
return EntityUtil.changeEntityByOrika(PreDealLogInfoDTO.class,preDealLog);
}
} }
...@@ -37,6 +37,7 @@ import com.task.allocation.exception.TaskAllocationException; ...@@ -37,6 +37,7 @@ import com.task.allocation.exception.TaskAllocationException;
import com.task.allocation.qo.TaskAllocationComputed; import com.task.allocation.qo.TaskAllocationComputed;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -449,6 +450,16 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -449,6 +450,16 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId); TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
syncCheckDTO.setSyncStatus(syncTask.getStatusFlag()); syncCheckDTO.setSyncStatus(syncTask.getStatusFlag());
PreDealLogInfoDTO dealLogInfoDTO = preDealService.getLastPreDataByTaskId(taskId);
//一分钟内没执行就重试
Date date = DateUtils.addMinutes(new Date(), -1);
if (dealLogInfoDTO.getUpdateTime().before(date)) {
logger.info("重试:{}",taskId);
syncTaskService.updateTaskStatus(taskId,SyncTaskStatusEnum.exception_close.getVal());
reDealDepartment(taskId,-1);
return syncCheckDTO;
}
int totalCount = preDealService.countByTaskId(taskId, -1, -1); int totalCount = preDealService.countByTaskId(taskId, -1, -1);
int groupErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.group.getVal(), PreDealStatusEnum.exception.getVal()); int groupErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.group.getVal(), PreDealStatusEnum.exception.getVal());
int storeErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.store.getVal(), PreDealStatusEnum.exception.getVal()); int storeErrCount = preDealService.countByTaskId(taskId, PreDealTypeEnum.store.getVal(), PreDealStatusEnum.exception.getVal());
......
...@@ -318,4 +318,11 @@ ...@@ -318,4 +318,11 @@
and data_type=#{dataType} and data_type=#{dataType}
</if> </if>
</select> </select>
<select id="getLastPreDataByTaskId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_pre_deal_log
where task_id = #{taskId,jdbcType=INTEGER} order by update_time desc limit 1
</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