Commit c071f6bc authored by 赵啸非's avatar 赵啸非

添加材料数量统计

parent ea9c380d
package com.mortals.xhx.daemon.task; package com.mortals.xhx.daemon.task;
import cn.hutool.core.collection.ListUtil;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
...@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -44,7 +46,7 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService { ...@@ -44,7 +46,7 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService {
siteRest.getData().forEach(site -> { siteRest.getData().forEach(site -> {
SiteMatterPdu siteMatterPdu = new SiteMatterPdu(); SiteMatterPdu siteMatterPdu = new SiteMatterPdu();
siteMatterPdu.setPage(1); siteMatterPdu.setPage(1);
siteMatterPdu.setSize(-1); //siteMatterPdu.setSize(-1);
Rest<RespData<List<SiteMatterPdu>>> siteMatterRest = siteMatterFeign.list(siteMatterPdu); Rest<RespData<List<SiteMatterPdu>>> siteMatterRest = siteMatterFeign.list(siteMatterPdu);
if (siteMatterRest.getCode() == YesNoEnum.YES.getValue()) { if (siteMatterRest.getCode() == YesNoEnum.YES.getValue()) {
//删除后新增 //删除后新增
...@@ -61,7 +63,13 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService { ...@@ -61,7 +63,13 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(sheetMatterEntities)) { if (!ObjectUtils.isEmpty(sheetMatterEntities)) {
sheetMatterService.save(sheetMatterEntities); sheetMatterService.getDao().delete(new HashMap());
List<List<SheetMatterEntity>> partition = ListUtil.partition(sheetMatterEntities, 500);
for (List<SheetMatterEntity> matterEntities : partition) {
sheetMatterService.save(matterEntities);
}
} }
} }
}); });
......
...@@ -4,6 +4,7 @@ import com.mortals.framework.model.Context; ...@@ -4,6 +4,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.sheet.dao.SheetMatterDao;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity; import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
/** /**
...@@ -16,5 +17,7 @@ import com.mortals.xhx.module.sheet.model.SheetMatterEntity; ...@@ -16,5 +17,7 @@ import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
*/ */
public interface SheetMatterService extends ICRUDService<SheetMatterEntity, Long> { public interface SheetMatterService extends ICRUDService<SheetMatterEntity, Long> {
SheetMatterDao getDao();
Result<SheetMatterEntity> findSubList(SheetMatterEntity matterQuery, PageInfo pageInfo, Context context); Result<SheetMatterEntity> findSubList(SheetMatterEntity matterQuery, PageInfo pageInfo, Context context);
} }
\ 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