Commit 322c581c authored by 赵啸非's avatar 赵啸非

修改根据业务查询部门逻辑

parent b9b680b2
......@@ -25,8 +25,6 @@ import java.util.Map;
public interface MatterService extends ICRUDService<MatterEntity, Long> {
MatterEntity getCache(String id);
/**
* 添加业务到站点
*
......
......@@ -61,7 +61,7 @@ import java.util.stream.Collectors;
*/
@Service("matterService")
@Slf4j
public class MatterServiceImpl extends AbstractCRUDCacheServiceImpl<MatterDao, MatterEntity, Long> implements MatterService {
public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, MatterEntity, Long> implements MatterService {
@Autowired
private SiteMatterService siteMatterService;
@Autowired
......
......@@ -4,6 +4,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -16,6 +17,7 @@ import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* SiteMatterService
......@@ -32,6 +34,29 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
@Override
protected void findAfter(SiteMatterEntity params, PageInfo pageInfo, Context context, List<SiteMatterEntity> list) throws AppException {
if(list.size()>1000000){
}else{
List<Long> matterIdlist = list.stream().map(item -> item.getMatterId()).collect(Collectors.toList());
Map<Long, MatterEntity> matterEntityMap = matterService.find(new MatterQuery().idList(matterIdlist)).parallelStream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
list.forEach(item -> {
if (!ObjectUtils.isEmpty(item.getMatterId())) {
MatterEntity matterEntity = matterEntityMap.get(item.getMatterId());
if (!ObjectUtils.isEmpty(matterEntity)) {
item.setBelongDept(matterEntity.getBelongDept());
item.setWindowToTheSceneNum(matterEntity.getWindowToTheSceneNum());
item.setOnlineToTheSceneNum(matterEntity.getOnlineToTheSceneNum());
item.setDeptCode(matterEntity.getDeptCode());
item.setAreaCode(matterEntity.getAreaCode());
}
}
});
}
/*
list.forEach(item -> {
if (!ObjectUtils.isEmpty(item.getMatterId())) {
MatterEntity matterEntity = matterService.getCache(item.getMatterId().toString());
......@@ -43,7 +68,7 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
item.setAreaCode(matterEntity.getAreaCode());
}
}
});
});*/
super.findAfter(params, pageInfo, context, list);
}
......
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