Commit 41c40280 authored by 刘林's avatar 刘林

fix:(监管):刷街道code,15000瓶子作废修改

parent 0ec38bc0
......@@ -5,8 +5,8 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.biz.discardOrder.factory.support.SupportableDiscardOrderCheck;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
......@@ -26,13 +26,13 @@ public class UseRegisterDiscardOrderCheck implements SupportableDiscardOrderChec
if (records.isEmpty()) {
throw new RuntimeException("单据下不存在设备,不能进行作废,请联系管理员!");
}
List<JgUseRegistrationEq> useRegistrationEqs = useRegistrationMapper.selectListForSelfDiscard(records);
List<JgUseRegistrationEq> useRegistrationEqs = ListUtils.partition(records, 1000).stream()
.flatMap(batch -> useRegistrationMapper.selectListForSelfDiscard(batch).stream())
.collect(Collectors.toList());
if (!useRegistrationEqs.isEmpty()) {
String msg = String.format("存在设备正在办理或已办理后续业务:%s,不能进行作废!", String.join(",", useRegistrationEqs.stream().map(u -> GenericDiscardOrderCheck.buildErrorMsg(u.getRecUserName())).collect(Collectors.toSet())));
throw new RuntimeException(msg);
}
return true;
}
}
......@@ -2022,7 +2022,13 @@ public class DataHandlerServiceImpl {
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (!records.isEmpty() && isDelete) {
superviseInfoMapper.deleteDataAll(records);
int batchSize = 1000;
for (int i = 0; i < records.size(); i += batchSize) {
int end = Math.min(i + batchSize, records.size());
List<String> batch = records.subList(i, end);
superviseInfoMapper.deleteDataAll(batch);
deleteFromEs(batch);
}
}
return records.size();
}
......
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