Commit 37520635 by jx-art

Merge remote-tracking branch 'origin/feature-changeFlow-221110' into feature-changeFlow-221110

parents 4b564183 880d1e97
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
package com.netease.mail.yanxuan.change.biz.task; package com.netease.mail.yanxuan.change.biz.task;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -17,12 +18,9 @@ import org.springframework.stereotype.Component; ...@@ -17,12 +18,9 @@ import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.netease.mail.yanxuan.change.biz.biz.ChangeFlowBiz; import com.netease.mail.yanxuan.change.biz.biz.ChangeFlowBiz;
import com.netease.mail.yanxuan.change.biz.meta.exception.ExceptionFactory;
import com.netease.mail.yanxuan.change.biz.service.ChangeFlowService; import com.netease.mail.yanxuan.change.biz.service.ChangeFlowService;
import com.netease.mail.yanxuan.change.common.bean.CommonConstants; import com.netease.mail.yanxuan.change.common.bean.CommonConstants;
import com.netease.mail.yanxuan.change.common.bean.ResponseCode;
import com.netease.mail.yanxuan.change.common.enums.ChangeFlowEnum; import com.netease.mail.yanxuan.change.common.enums.ChangeFlowEnum;
import com.netease.mail.yanxuan.change.common.enums.ChangeStatusEnum;
import com.netease.mail.yanxuan.change.common.enums.FlowOperationTypeEnum; import com.netease.mail.yanxuan.change.common.enums.FlowOperationTypeEnum;
import com.netease.mail.yanxuan.change.common.util.DateUtils; import com.netease.mail.yanxuan.change.common.util.DateUtils;
import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord; import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord;
...@@ -51,20 +49,28 @@ public class AutoSubmit extends IJobHandler { ...@@ -51,20 +49,28 @@ public class AutoSubmit extends IJobHandler {
@Override @Override
public ReturnT<String> execute(String... strings) throws Exception { public ReturnT<String> execute(String... strings) throws Exception {
log.info("AutoSubmit start"); log.info("AutoSubmit start");
// 查询今天时间之前的数据 long startTime = DateUtils.getCurrentTime();
long currentTime = DateUtils.getCurrentTime(); List<Long> count = new ArrayList<>();
Long entityId = 0L; Long entityId = 0L;
// 查询今天时间之前的数据
try {
while (true) { while (true) {
List<ChangeRecord> records = changeFlowService.getByStatusAndTime(entityId, ChangeFlowEnum.CHANGE_FLOW_EXE.getNodeId(), List<ChangeRecord> records = changeFlowService.getByStatusAndTime(entityId, ChangeFlowEnum.CHANGE_FLOW_EXE.getNodeId(),
ChangeFlowEnum.CHANGE_FLOW_CONFIRM.getNodeId(), currentTime); ChangeFlowEnum.CHANGE_FLOW_CONFIRM.getNodeId(), startTime);
if (CollectionUtils.isEmpty(records)) { if (CollectionUtils.isEmpty(records)) {
break; break;
} }
records.forEach(this::progressRecord); records.forEach(this::progressRecord);
List<Long> idList = records.stream().map(ChangeRecord::getId).collect(Collectors.toList()); List<Long> idList = records.stream().map(ChangeRecord::getId).collect(Collectors.toList());
entityId = idList.stream().max(Long::compare).get(); entityId = idList.stream().max(Long::compare).get();
count.addAll(idList);
}
} catch (Exception e) {
log.error("error on AutoSubmit");
} }
return null; log.info(
"AutoSubmit end, count:{}, maxId:{}, usedTime:{}", count.size(), entityId, DateUtils.getCurrentTime() - startTime);
return ReturnT.SUCCESS;
} }
private void progressRecord(ChangeRecord changeRecord) { private void progressRecord(ChangeRecord changeRecord) {
......
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