|
|
@@ -180,6 +180,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
|
|
|
private final LifeUserViolationMapper lifeUserViolationMapper;
|
|
|
|
|
|
+ private final EssentialHolidayComparisonMapper essentialHolidayComparisonMapper;
|
|
|
+
|
|
|
private final StorePaymentConfigService storePaymentConfigService;
|
|
|
|
|
|
|
|
|
@@ -439,10 +441,40 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<StoreBusinessInfo> getStoreInfoBusinessHours(Integer id) {
|
|
|
- //营业时间
|
|
|
- List<StoreBusinessInfo> storeBusinessInfoList = storeBusinessInfoMapper.selectList(new LambdaQueryWrapper<StoreBusinessInfo>().eq(StoreBusinessInfo::getStoreId, id));
|
|
|
- return storeBusinessInfoList;
|
|
|
+ public List<StoreBusinessInfoVo> getStoreInfoBusinessHours(Integer id) {
|
|
|
+ // 查询营业时间(包含正常时间和特殊时间)
|
|
|
+ List<StoreBusinessInfo> storeBusinessInfoList = storeBusinessInfoMapper.selectList(
|
|
|
+ new LambdaQueryWrapper<StoreBusinessInfo>()
|
|
|
+ .eq(StoreBusinessInfo::getStoreId, id)
|
|
|
+ .eq(StoreBusinessInfo::getDeleteFlag, 0)
|
|
|
+ .orderByAsc(StoreBusinessInfo::getBusinessType) // 先按类型排序:1-正常时间,2-特殊时间
|
|
|
+ .orderByAsc(StoreBusinessInfo::getBusinessDate) // 再按日期排序
|
|
|
+ );
|
|
|
+
|
|
|
+ // 转换为 VO 并关联节假日信息
|
|
|
+ List<StoreBusinessInfoVo> resultList = new ArrayList<>();
|
|
|
+ for (StoreBusinessInfo businessInfo : storeBusinessInfoList) {
|
|
|
+ StoreBusinessInfoVo vo = new StoreBusinessInfoVo();
|
|
|
+ // 复制基本信息
|
|
|
+ BeanUtils.copyProperties(businessInfo, vo);
|
|
|
+
|
|
|
+ // 如果有关联的节假日ID,查询节假日信息
|
|
|
+ if (businessInfo.getEssentialId() != null && !businessInfo.getEssentialId().trim().isEmpty()) {
|
|
|
+ try {
|
|
|
+ Integer essentialId = Integer.parseInt(businessInfo.getEssentialId().trim());
|
|
|
+ EssentialHolidayComparison holiday = essentialHolidayComparisonMapper.selectById(essentialId);
|
|
|
+ if (holiday != null) {
|
|
|
+ vo.setHolidayInfo(holiday);
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.warn("门店营业时间关联的节假日ID格式错误,storeId={}, essentialId={}", id, businessInfo.getEssentialId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ resultList.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1370,6 +1402,21 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
tagStoreRelationMapper.insert(tagStoreRelation);
|
|
|
}
|
|
|
|
|
|
+ // 保存门店营业时间
|
|
|
+ if (storeInfoDto.getStoreBusinessTime() != null && !storeInfoDto.getStoreBusinessTime().isEmpty()) {
|
|
|
+ List<StoreBusinessInfo> storeBusinessTimeList = storeInfoDto.getStoreBusinessTime();
|
|
|
+ for (StoreBusinessInfo businessInfo : storeBusinessTimeList) {
|
|
|
+ // 设置门店ID
|
|
|
+ businessInfo.setStoreId(storeInfo.getId());
|
|
|
+ // 新增门店时,所有营业时间都是新增,清空ID确保是新增
|
|
|
+ businessInfo.setId(null);
|
|
|
+ }
|
|
|
+ // 批量保存营业时间
|
|
|
+ for (StoreBusinessInfo businessInfo : storeBusinessTimeList) {
|
|
|
+ storeBusinessInfoMapper.insert(businessInfo);
|
|
|
+ }
|
|
|
+ log.info("保存门店营业时间成功,门店ID:{},营业时间数量:{}", storeInfo.getId(), storeBusinessTimeList.size());
|
|
|
+ }
|
|
|
|
|
|
// 发送通知
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
@@ -6025,13 +6072,13 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// // 获取店铺动态总数
|
|
|
// result.setTotalDynamicsNum(storeDynamicslist.size());
|
|
|
|
|
|
- //营业时间
|
|
|
- List<StoreBusinessInfo> storeBusinessInfos = storeBusinessInfoMapper.selectList(
|
|
|
- new LambdaQueryWrapper<StoreBusinessInfo>()
|
|
|
- .eq(StoreBusinessInfo::getStoreId, storeId)
|
|
|
- .eq(StoreBusinessInfo::getDeleteFlag, 0)
|
|
|
- );
|
|
|
- // 回显所有营业时间信息(特殊营业时间和正常营业时间)
|
|
|
+ //营业时间(通过 getStoreInfoBusinessHours 方法获取,包含节假日信息)
|
|
|
+ List<StoreBusinessInfoVo> storeBusinessInfoVos = this.getStoreInfoBusinessHours(Integer.parseInt(storeId));
|
|
|
+ // 设置包含节假日信息的营业时间列表
|
|
|
+ result.setStoreBusinessInfoVos(storeBusinessInfoVos);
|
|
|
+ // 转换为 List<StoreBusinessInfo> 用于后续判断(StoreBusinessInfoVo 继承自 StoreBusinessInfo)
|
|
|
+ List<StoreBusinessInfo> storeBusinessInfos = new ArrayList<>(storeBusinessInfoVos);
|
|
|
+ // 回显所有营业时间信息(特殊营业时间和正常营业时间,包含节假日信息)
|
|
|
if (ObjectUtils.isNotEmpty(storeBusinessInfos)) {
|
|
|
result.setStoreBusinessInfo(storeBusinessInfos.get(0));
|
|
|
result.setStoreBusinessInfos(storeBusinessInfos);
|