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