Commit cea9aa4a by wuwenlong

order info roomImage\roomType\roomTypeName missing value bugfix;

store list packs missing value bugfix;
parent 019f40c5
...@@ -67,7 +67,7 @@ public class SOrderController extends BaseController ...@@ -67,7 +67,7 @@ public class SOrderController extends BaseController
*/ */
@GetMapping(value = "/orderNo") @GetMapping(value = "/orderNo")
public AjaxResult queryByOrderNo(@RequestParam("orderNo") String orderNo) { public AjaxResult queryByOrderNo(@RequestParam("orderNo") String orderNo) {
return success(sOrderService.selectSOrderByOrderNo(orderNo)); return success(sOrderService.queryOrderInfoByNo(orderNo));
} }
@ApiOperation(value = "查询当前用户可用订单(待使用&使用中)") @ApiOperation(value = "查询当前用户可用订单(待使用&使用中)")
......
...@@ -65,4 +65,6 @@ public interface IRoomPackService extends IService<SRoomPack> { ...@@ -65,4 +65,6 @@ public interface IRoomPackService extends IService<SRoomPack> {
int deleteRoomPackByRoomId(Long id); int deleteRoomPackByRoomId(Long id);
List<SRoomPack> selectRoomPackByPackId(Long id); List<SRoomPack> selectRoomPackByPackId(Long id);
List<SRoomPack> listByRoomIds(List<Long> roomIds);
} }
package share.system.service.impl; package share.system.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -93,7 +94,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I ...@@ -93,7 +94,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
@Override @Override
public List<SPack> selectPackListByIds(List<Long> packIds) { public List<SPack> selectPackListByIds(List<Long> packIds) {
if (packIds == null || packIds.size() == 0) { if (packIds == null || packIds.size() == 0) {
return null; return new ArrayList<>();
} }
LambdaQueryWrapper<SPack> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<SPack> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SPack::getId, packIds); queryWrapper.in(SPack::getId, packIds);
......
package share.system.service.impl; package share.system.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -115,4 +116,17 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, SRoomPack> ...@@ -115,4 +116,17 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, SRoomPack>
}); });
return sRoomPackList; return sRoomPackList;
} }
@Override
public List<SRoomPack> listByRoomIds(List<Long> roomIds) {
LambdaQueryWrapper<SRoomPack> roomPackQueryWrapper = new LambdaQueryWrapper();
if (roomIds.size() > 0) {
roomPackQueryWrapper.in(SRoomPack::getRoomId, roomIds);
List<SRoomPack> roomPacks = roomPackMapper.selectList(roomPackQueryWrapper);
return roomPacks;
} else {
return new ArrayList<SRoomPack>();
}
}
} }
...@@ -545,6 +545,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -545,6 +545,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
vo.setAddress(store.getAddress()); vo.setAddress(store.getAddress());
vo.setRoomImages(room.getImages()); vo.setRoomImages(room.getImages());
vo.setRoomName(room.getName()); vo.setRoomName(room.getName());
vo.setRoomType(room.getRoomType());
vo.setRoomTypeName(RoomType.getNameByCode(room.getRoomType()));
vo.setLongitude(store.getLongitude()); vo.setLongitude(store.getLongitude());
vo.setLatitude(store.getLatitude()); vo.setLatitude(store.getLatitude());
vo.setManager(store.getManager()); vo.setManager(store.getManager());
......
...@@ -28,10 +28,7 @@ import share.system.domain.vo.SRoomVo; ...@@ -28,10 +28,7 @@ import share.system.domain.vo.SRoomVo;
import share.system.domain.vo.SStoreVo; import share.system.domain.vo.SStoreVo;
import share.system.mapper.*; import share.system.mapper.*;
import share.system.request.SStoreRequest; import share.system.request.SStoreRequest;
import share.system.service.IPackService; import share.system.service.*;
import share.system.service.ISRoomService;
import share.system.service.ISStoreService;
import share.system.service.QPService;
/** /**
* 门店Service业务层处理 * 门店Service业务层处理
...@@ -42,17 +39,15 @@ import share.system.service.QPService; ...@@ -42,17 +39,15 @@ import share.system.service.QPService;
@Service @Service
public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> implements ISStoreService { public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> implements ISStoreService {
@Autowired @Autowired
private SStoreConsumerMapper storeConsumerMapper;
@Autowired
private ISRoomService sRoomService; private ISRoomService sRoomService;
@Autowired @Autowired
private RoomPackMapper roomPackMapper;
@Autowired
private IPackService packService; private IPackService packService;
@Autowired @Autowired
private QPService qpService; private QPService qpService;
@Autowired @Autowired
private SCleanRecordsMapper sCleanRecordsMapper; private SCleanRecordsMapper sCleanRecordsMapper;
@Autowired
private IRoomPackService roomPackService;
/** /**
* 查询门店 * 查询门店
...@@ -229,59 +224,35 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -229,59 +224,35 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
if (CollectionUtils.isNotEmpty(voList)) { if (CollectionUtils.isNotEmpty(voList)) {
List<Long> storeIds = voList.stream().map(SStoreVo::getId).collect(Collectors.toList()); List<Long> storeIds = voList.stream().map(SStoreVo::getId).collect(Collectors.toList());
List<SRoomVo> roomVoList = sRoomService.listByStoreIds(storeIds); List<SRoomVo> roomVoList = sRoomService.listByStoreIds(storeIds);
List<Long> roomIds = new ArrayList<>(); List<Long> roomIds = roomVoList.stream().map(SRoomVo::getId).collect(Collectors.toList());
roomVoList.stream().forEach(sRoomVo -> { List<SRoomPack> roomPacks = roomPackService.listByRoomIds(roomIds);
roomIds.add(sRoomVo.getId()); List<Long> packIds = roomPacks.stream().map(SRoomPack::getPackId).collect(Collectors.toList());
}); List<SPack> packs = packService.listByIds(packIds);
List<Long> packIds = new ArrayList<>(); Map<Long,SPack> packMap = Optional.ofNullable(packs).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(SPack::getId,o->o,(k1,k2)->k1));
LambdaQueryWrapper<SRoomPack> roomPackQueryWrapper = new LambdaQueryWrapper();
if (roomIds.size() > 0) {
roomPackQueryWrapper.in(SRoomPack::getRoomId, roomIds);
} else {
roomIds.add(0L);
roomPackQueryWrapper.in(SRoomPack::getRoomId, roomIds);
}
List<SRoomPack> roomPacks = roomPackMapper.selectList(roomPackQueryWrapper);
roomPacks.stream().forEach(sRoomPack -> {
packIds.add(sRoomPack.getPackId());
});
List<SPack> packs = packService.selectPackListByIds(packIds);
Map<Long,SPack> map = new HashMap<>();
if (packs != null) {
packs.stream().forEach(sPack -> {
map.put(sPack.getId(), sPack);
});
}
roomVoList.stream().forEach(sRoomVo -> { roomVoList.stream().forEach(sRoomVo -> {
List<SPack> sPacks = new ArrayList<>(); List<SPack> sPacks = new ArrayList<>();
roomPacks.stream().forEach(sRoomPack -> { roomPacks.stream().forEach(sRoomPack -> {
if (Long.compare(sRoomVo.getId(), sRoomPack.getRoomId()) == 0) { if (sRoomVo.getId().compareTo(sRoomPack.getRoomId()) == 0) {
sPacks.add(map.get(sRoomPack.getPackId())); sPacks.add(packMap.get(sRoomPack.getPackId()));
} }
}); });
sRoomVo.setPackList(sPacks); sRoomVo.setPackList(sPacks);
}); });
Map<Long,List<SRoomVo>> roomVoListMap = Optional.ofNullable(roomVoList).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(SRoomVo::getStoreId));
voList.stream().forEach(storeVo -> { voList.stream().forEach(storeVo -> {
storeVo.setRoomVoList(roomVoList.stream().filter(roomVo -> { storeVo.setRoomVoList(roomVoListMap.get(storeVo.getId()));
// List<Long> roomId = roomPackMapper.selectPackListByRoomId(roomVo.getId());
// roomVo.setPackList(packService.selectPackListByIds(roomId));
if (Long.compare(roomVo.getStoreId(), storeVo.getId()) == 0) {
return true;
}
return false;
}).collect(Collectors.toList()));
}); });
} }
} }
@Override @Override
public int deleteStoreConsumer(SStoreConsumer storeConsumer) { public int deleteStoreConsumer(SStoreConsumer storeConsumer) {
return storeConsumerMapper.deleteInfo(storeConsumer); return baseMapper.deleteInfo(storeConsumer);
} }
@Override @Override
public int deleteStoreConsumers(Long storeId, Long[] consumerIds) { public int deleteStoreConsumers(Long storeId, Long[] consumerIds) {
return storeConsumerMapper.deleteInfos(storeId, consumerIds); return baseMapper.deleteInfos(storeId, consumerIds);
} }
@Override @Override
...@@ -294,7 +265,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -294,7 +265,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
sc.setConsumerId(consumerId); sc.setConsumerId(consumerId);
list.add(sc); list.add(sc);
} }
return storeConsumerMapper.batchSStoreConsumer(list); return baseMapper.batchSStoreConsumer(list);
} }
@Override @Override
...@@ -304,7 +275,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -304,7 +275,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
throw new BaseException("当前用户不是保洁人员!"); throw new BaseException("当前用户不是保洁人员!");
} }
//查询保洁人员所属门店 //查询保洁人员所属门店
List<String> storeIdList = storeConsumerMapper.selectByConsumerId(user.getId()); List<String> storeIdList = baseMapper.selectByConsumerId(user.getId());
//List<String> 转 List<Long> //List<String> 转 List<Long>
List<Long> idList = storeIdList.stream().map(Long::parseLong).collect(Collectors.toList()); List<Long> idList = storeIdList.stream().map(Long::parseLong).collect(Collectors.toList());
// 查询门店信息 // 查询门店信息
......
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