Commit 9afd82cd authored by 赵啸非's avatar 赵啸非

优化窗口业务查询

parent bf446a65
...@@ -3,6 +3,7 @@ import com.mortals.framework.exception.AppException; ...@@ -3,6 +3,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; 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.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.window.model.WindowHallEntity; import com.mortals.xhx.module.window.model.WindowHallEntity;
...@@ -15,7 +16,7 @@ import com.mortals.xhx.module.window.dao.WindowHallDao; ...@@ -15,7 +16,7 @@ import com.mortals.xhx.module.window.dao.WindowHallDao;
* @author zxfei * @author zxfei
* @date 2023-04-25 * @date 2023-04-25
*/ */
public interface WindowHallService extends ICRUDService<WindowHallEntity,Long>{ public interface WindowHallService extends ICRUDCacheService<WindowHallEntity,Long> {
WindowHallDao getDao(); WindowHallDao getDao();
......
...@@ -52,9 +52,12 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus ...@@ -52,9 +52,12 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
@Override @Override
protected void findAfter(WindowBusinessEntity entity, PageInfo pageInfo, Context context, List<WindowBusinessEntity> list) throws AppException { protected void findAfter(WindowBusinessEntity entity, PageInfo pageInfo, Context context, List<WindowBusinessEntity> list) throws AppException {
Map<Long, WindowEntity> collect = windowService.findToMap(new WindowQuery(), context);
Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.find(new WindowHallQuery(), context).parallelStream().collect(Collectors.toMap(x -> x.getWindowId(), Function.identity())); Map<Long, WindowEntity> collect = windowService.getCacheList().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
//Map<Long, WindowEntity> collect = windowService.findToMap(new WindowQuery(), context);
Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.getCacheList().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
//Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.find(new WindowHallQuery(), context).parallelStream().collect(Collectors.toMap(x -> x.getWindowId(), Function.identity()));
Iterator iterator = list.iterator(); Iterator iterator = list.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
WindowBusinessEntity item = (WindowBusinessEntity) iterator.next(); WindowBusinessEntity item = (WindowBusinessEntity) iterator.next();
...@@ -67,7 +70,7 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus ...@@ -67,7 +70,7 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
if (!ObjectUtils.isEmpty(windowHallEntity)) { if (!ObjectUtils.isEmpty(windowHallEntity)) {
item.setHallId(windowHallEntity.getHallId()); item.setHallId(windowHallEntity.getHallId());
item.setHallName(windowHallEntity.getHallName()); item.setHallName(windowHallEntity.getHallName());
}else { } else {
//log.info("windowhallEntity is null windowId:{}",item.getWindowId()); //log.info("windowhallEntity is null windowId:{}",item.getWindowId());
} }
} else { } else {
......
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.window.service.impl; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.window.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.module.window.model.WindowEntity; import com.mortals.xhx.module.window.model.WindowEntity;
import com.mortals.xhx.module.window.model.WindowQuery; import com.mortals.xhx.module.window.model.WindowQuery;
import com.mortals.xhx.module.window.service.WindowService; import com.mortals.xhx.module.window.service.WindowService;
...@@ -27,7 +28,7 @@ import java.util.stream.Collectors; ...@@ -27,7 +28,7 @@ import java.util.stream.Collectors;
* @date 2023-04-25 * @date 2023-04-25
*/ */
@Service("windowHallService") @Service("windowHallService")
public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao, WindowHallEntity, Long> implements WindowHallService { public class WindowHallServiceImpl extends AbstractCRUDCacheServiceImpl<WindowHallDao, WindowHallEntity, Long> implements WindowHallService {
@Autowired @Autowired
private WindowService windowService; private WindowService windowService;
...@@ -41,8 +42,14 @@ public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao ...@@ -41,8 +42,14 @@ public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao
*/ */
@Override @Override
protected void findAfter(WindowHallEntity params, PageInfo pageInfo, Context context, List<WindowHallEntity> list) throws AppException { protected void findAfter(WindowHallEntity params, PageInfo pageInfo, Context context, List<WindowHallEntity> list) throws AppException {
super.findAfter(params, pageInfo, context, list);
List<Long> collect = list.stream().map(i -> i.getWindowId()).distinct().collect(Collectors.toList()); Map<Long, WindowEntity> collectWin = windowService.getCacheList().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
list.forEach(item -> {
WindowEntity windowEntity = collectWin.get(item.getWindowId());
item.setFromnum(windowEntity == null ? "" : windowEntity.getFromnum());
});
/* List<Long> collect = list.stream().map(i -> i.getWindowId()).distinct().collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) { if (!ObjectUtils.isEmpty(collect)) {
WindowQuery windowQuery = new WindowQuery(); WindowQuery windowQuery = new WindowQuery();
windowQuery.setIdList(collect); windowQuery.setIdList(collect);
...@@ -51,6 +58,6 @@ public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao ...@@ -51,6 +58,6 @@ public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao
WindowEntity windowEntity = collectWin.get(item.getWindowId()); WindowEntity windowEntity = collectWin.get(item.getWindowId());
item.setFromnum(windowEntity == null ? "" : windowEntity.getFromnum()); item.setFromnum(windowEntity == null ? "" : windowEntity.getFromnum());
}); });
} }*/
} }
} }
\ No newline at end of file
...@@ -3,11 +3,7 @@ ...@@ -3,11 +3,7 @@
POST {{baseUrl}}/window/business/list POST {{baseUrl}}/window/business/list
Content-Type: application/json Content-Type: application/json
{ {"windowIdList":["77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99"],"size":-1}
"page":1,
"size":10
}
###窗口业务更新与保存 ###窗口业务更新与保存
POST {{baseUrl}}/window/business/save POST {{baseUrl}}/window/business/save
......
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