预订单时间槽列表逻辑调整,分账、提现 报文字段 保存
This commit is contained in:
parent
6a335ef1aa
commit
5ff094de7a
@ -33,6 +33,11 @@ public class BookingArgDTO {
|
||||
@ApiModelProperty(value = "日期")
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 工作时间依据(如"09:00-21:00")
|
||||
*/
|
||||
private String working_hours;
|
||||
|
||||
/**
|
||||
* 时间项列表
|
||||
*/
|
||||
|
||||
@ -1046,8 +1046,9 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
String dateStr = DateUtil.format(currentDate, "yyyy-MM-dd");
|
||||
String displayDateStr = DateUtil.format(currentDate, "MM月dd日");
|
||||
|
||||
|
||||
// 安全获取星期信息
|
||||
String weekStr = "未知";
|
||||
String weekStr = "星期";
|
||||
try {
|
||||
weekStr = DateTimeUtils.getWeekOfDate(currentDate);
|
||||
} catch (Exception e) {
|
||||
@ -1080,9 +1081,11 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
items.add(immediateItem);
|
||||
}
|
||||
|
||||
// 只有当timesMap不为空时才生成其他时间槽
|
||||
// 只有当 timesMap 不为空时才生成其他时间槽
|
||||
if (!ObjectUtil.isEmpty(timesMap) && StrUtil.isNotBlank(timesMap.get("startTimeStr")) && StrUtil.isNotBlank(timesMap.get("endTimeStr"))) {
|
||||
List<BookingArgDTO.BookingArgItem> timeSlots = generateTimeSlots(dateStr, timesMap.get("startTimeStr"), timesMap.get("endTimeStr"), i == 0);
|
||||
String startTimeStr = timesMap.get("startTimeStr");
|
||||
String endTimeStr = timesMap.get("endTimeStr");
|
||||
List<BookingArgDTO.BookingArgItem> timeSlots = generateTimeSlots(dateStr, startTimeStr, endTimeStr, i == 0);
|
||||
if (i == 0) {
|
||||
// 对于今天,移除除"立即送出"外的所有时间槽
|
||||
items.addAll(timeSlots.stream().filter(item -> item.getBooking_state() != 1).collect(Collectors.toList()));
|
||||
@ -1090,6 +1093,8 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
// 对于其他日期,添加所有时间槽
|
||||
items.addAll(timeSlots);
|
||||
}
|
||||
|
||||
bookingArgDTO.setWorking_hours(String.format("%s-%s", startTimeStr, endTimeStr));
|
||||
} else if (i == 0) {
|
||||
// 如果timesMap为空,今天只保留"立即送出"选项
|
||||
logger.debug("[生成预约参数] timesMap为空,今天只生成立即送出选项");
|
||||
@ -1109,57 +1114,6 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据 storeIds(一个或多个 storeid,如 34,23,43,23,),先对id去重,再获取多个店铺的营业时间 List<map{startTimeStr, endTimeStr}> 列表list
|
||||
*
|
||||
* @param storeIds 以逗号分隔的店铺ID字符串
|
||||
* @return 包含店铺营业时间信息的列表,每个元素为包含opening_hours和close_hours的Map
|
||||
*/
|
||||
private List<Map<String, String>> selStoreBizTimeMapList(String storeIds) {
|
||||
// 参数校验
|
||||
if (StrUtil.isBlank(storeIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
try {
|
||||
// 1. 解析并去重店铺ID
|
||||
List<Integer> uniqueStoreIds = Arrays.stream(storeIds.split(","))
|
||||
.map(String::trim)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(Integer::valueOf)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 如果没有有效的店铺ID,返回空列表
|
||||
if (uniqueStoreIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 3. 批量获取店铺信息
|
||||
QueryWrapper<ShopStoreInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("store_opening_hours", "store_close_hours"); // 只查询必要字段
|
||||
queryWrapper.in("store_id", storeIds);
|
||||
|
||||
List<ShopStoreInfo> shopStoreInfos = shopStoreInfoService.find(queryWrapper);
|
||||
|
||||
// 4. 转换为营业时间映射列表
|
||||
return shopStoreInfos.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(storeInfo -> {
|
||||
Map<String, String> timeSlot = new HashMap<>();
|
||||
timeSlot.put("startTimeStr", storeInfo.getStore_opening_hours());
|
||||
timeSlot.put("endTimeStr", storeInfo.getStore_close_hours());
|
||||
return timeSlot;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[获取店铺营业时间] 处理店铺营业时间异常,storeIds: {}", storeIds, e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成时间槽列表
|
||||
*
|
||||
@ -1273,5 +1227,55 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 storeIds(一个或多个 storeid,如 34,23,43,23,),先对id去重,再获取多个店铺的营业时间 List<map{startTimeStr, endTimeStr}> 列表list
|
||||
*
|
||||
* @param storeIds 以逗号分隔的店铺ID字符串
|
||||
* @return 包含店铺营业时间信息的列表,每个元素为包含opening_hours和close_hours的Map
|
||||
*/
|
||||
private List<Map<String, String>> selStoreBizTimeMapList(String storeIds) {
|
||||
// 参数校验
|
||||
if (StrUtil.isBlank(storeIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
try {
|
||||
// 1. 解析并去重店铺ID
|
||||
List<Integer> uniqueStoreIds = Arrays.stream(storeIds.split(","))
|
||||
.map(String::trim)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.map(Integer::valueOf)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 如果没有有效的店铺ID,返回空列表
|
||||
if (uniqueStoreIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 3. 批量获取店铺信息
|
||||
QueryWrapper<ShopStoreInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("store_opening_hours", "store_close_hours"); // 只查询必要字段
|
||||
queryWrapper.in("store_id", storeIds);
|
||||
|
||||
List<ShopStoreInfo> shopStoreInfos = shopStoreInfoService.find(queryWrapper);
|
||||
|
||||
// 4. 转换为营业时间映射列表
|
||||
return shopStoreInfos.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(storeInfo -> {
|
||||
Map<String, String> timeSlot = new HashMap<>();
|
||||
timeSlot.put("startTimeStr", storeInfo.getStore_opening_hours());
|
||||
timeSlot.put("endTimeStr", storeInfo.getStore_close_hours());
|
||||
return timeSlot;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[获取店铺营业时间] 处理店铺营业时间异常,storeIds: {}", storeIds, e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -31,16 +31,16 @@ public interface SFExpressApiService {
|
||||
*
|
||||
* @param mchId 商家入驻编号
|
||||
* @param storeId 商家门店ID
|
||||
* @param shopName 店名
|
||||
* @param cityName 城市
|
||||
* @param shopAddress 店铺详细地址
|
||||
* // * @param shopName 店名
|
||||
* // * @param cityName 城市
|
||||
* // * @param shopAddress 店铺详细地址
|
||||
* @param contactName 店铺联系人
|
||||
* @param contactPhone 店铺电话
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @return
|
||||
*/
|
||||
Pair<Boolean, String> createSfExpressShop(Long mchId, Integer storeId, String shopName, String cityName, String shopAddress, String contactName, String contactPhone, String longitude, String latitude);
|
||||
Pair<Boolean, String> createSfExpressShop(Long mchId, Integer storeId, String contactName, String contactPhone, String longitude, String latitude);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -185,42 +185,42 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
return Pair.of(false, "联系人手机号不能为空");
|
||||
}
|
||||
|
||||
AddressParseResultTO addressParseResultTO = AddressUtil.parseAddress(shopMchEntry.getStore_address());
|
||||
// 解析城市名称
|
||||
String cityName = "桂平市"; // 默认城市
|
||||
|
||||
// 去掉省市区的详细地址
|
||||
String storeAddress = addressParseResultTO.getDetailAddress();
|
||||
|
||||
if (StrUtil.isNotBlank(shopMchEntry.getStore_area())) {
|
||||
String[] areaNames = shopMchEntry.getStore_area().split("/");
|
||||
if (areaNames.length >= 3) {
|
||||
cityName = areaNames[areaNames.length - 1];
|
||||
} else {
|
||||
cityName = shopMchEntry.getStore_area().replace("/", "");
|
||||
}
|
||||
} else {
|
||||
cityName = addressParseResultTO.getCity();
|
||||
}
|
||||
|
||||
// 如果解析后城市名为空,使用默认值
|
||||
if (StrUtil.isBlank(cityName)) {
|
||||
cityName = "桂平市";
|
||||
logger.warn("[顺丰] 城市名为空,使用默认城市: {}", cityName);
|
||||
} else {
|
||||
logger.debug("[顺丰] 解析得到城市名: {}", cityName);
|
||||
}
|
||||
|
||||
// 为了其他顺丰店同名,店铺名称加上[门店ID]; 如:xxxx[xxxx] 聚万家生鲜超市[69]
|
||||
String shopStoreName = String.format("%s[%s]", shopMchEntry.getStore_name(), shopMchEntry.getStore_id());
|
||||
// AddressParseResultTO addressParseResultTO = AddressUtil.parseAddress(shopMchEntry.getStore_address());
|
||||
// // 解析城市名称
|
||||
// String cityName = "桂平市"; // 默认城市
|
||||
//
|
||||
// // 去掉省市区的详细地址
|
||||
// String storeAddress = addressParseResultTO.getDetailAddress();
|
||||
//
|
||||
// if (StrUtil.isNotBlank(shopMchEntry.getStore_area())) {
|
||||
// String[] areaNames = shopMchEntry.getStore_area().split("/");
|
||||
// if (areaNames.length >= 3) {
|
||||
// cityName = areaNames[areaNames.length - 1];
|
||||
// } else {
|
||||
// cityName = shopMchEntry.getStore_area().replace("/", "");
|
||||
// }
|
||||
// } else {
|
||||
// cityName = addressParseResultTO.getCity();
|
||||
// }
|
||||
//
|
||||
// // 如果解析后城市名为空,使用默认值
|
||||
// if (StrUtil.isBlank(cityName)) {
|
||||
// cityName = "桂平市";
|
||||
// logger.warn("[顺丰] 城市名为空,使用默认城市: {}", cityName);
|
||||
// } else {
|
||||
// logger.debug("[顺丰] 解析得到城市名: {}", cityName);
|
||||
// }
|
||||
//
|
||||
// // 为了其他顺丰店同名,店铺名称加上[门店ID]; 如:xxxx[xxxx] 聚万家生鲜超市[69]
|
||||
// String shopStoreName = String.format("%s[%s]", shopMchEntry.getStore_name(), shopMchEntry.getStore_id());
|
||||
|
||||
// 调用创建店铺方法
|
||||
Pair<Boolean, String> result = createSfExpressShop(
|
||||
mchId,
|
||||
Convert.toInt(shopMchEntry.getStore_id()),
|
||||
shopStoreName,
|
||||
cityName,
|
||||
storeAddress,
|
||||
// shopStoreName,
|
||||
// cityName,
|
||||
// storeAddress,
|
||||
shopMchEntry.getContact_name(),
|
||||
contactMobile,
|
||||
shopMchEntry.getStore_longitude(),
|
||||
@ -237,9 +237,6 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
*
|
||||
* @param mchId 商家入驻编号
|
||||
* @param storeId 商家门店ID
|
||||
* @param shopName 店名
|
||||
* @param cityName 城市
|
||||
* @param shopAddress 店铺详细地址
|
||||
* @param contactName 店铺联系人
|
||||
* @param contactPhone 店铺电话
|
||||
* @param longitude 经度
|
||||
@ -247,17 +244,16 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
* @return Pair<Boolean, String> 第一个元素表示是否成功,第二个元素表示结果信息或错误信息
|
||||
*/
|
||||
@Override
|
||||
public Pair<Boolean, String> createSfExpressShop(Long mchId, Integer storeId, String shopName, String cityName,
|
||||
String shopAddress, String contactName, String contactPhone,
|
||||
public Pair<Boolean, String> createSfExpressShop(Long mchId, Integer storeId, String contactName, String contactPhone,
|
||||
String longitude, String latitude) {
|
||||
logger.info("开始创建顺丰同城店铺, storeId: {}", storeId);
|
||||
|
||||
try {
|
||||
// 1. 验证必要参数
|
||||
if ((CheckUtil.isEmpty(mchId) && CheckUtil.isEmpty(storeId)) ||
|
||||
StringUtils.isAnyBlank(shopName, shopAddress, contactName, contactPhone)) {
|
||||
logger.error("创建顺丰店铺,缺少必要参数!mchId:{}, storeId:{},shopName:{},shopAddress:{},contactName:{},contactPhone:{}",
|
||||
mchId, storeId, shopName, shopAddress, contactName, contactPhone);
|
||||
StringUtils.isAnyBlank(contactName, contactPhone)) {
|
||||
logger.error("创建顺丰店铺,缺少必要参数!mchId:{}, storeId:{},contactName:{},contactPhone:{}",
|
||||
mchId, storeId, contactName, contactPhone);
|
||||
return Pair.of(false, "创建顺丰店铺,缺少必要参数!");
|
||||
}
|
||||
|
||||
@ -280,6 +276,29 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
}
|
||||
}
|
||||
|
||||
AddressParseResultTO addressParseResultTO = AddressUtil.parseAddress(shopMchEntry.getStore_address());
|
||||
String cityName = "桂平市";
|
||||
String shopAddress = addressParseResultTO != null ? addressParseResultTO.getDetailAddress() : "";
|
||||
|
||||
if (StrUtil.isNotBlank(shopMchEntry.getStore_area())) {
|
||||
String[] areaNames = shopMchEntry.getStore_area().split("/");
|
||||
cityName = areaNames.length >= 3 ? areaNames[2] :
|
||||
areaNames.length > 0 ? areaNames[areaNames.length - 1] : cityName;
|
||||
} else if (addressParseResultTO != null && StrUtil.isNotBlank(addressParseResultTO.getCity())) {
|
||||
cityName = addressParseResultTO.getCity();
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(cityName)) {
|
||||
cityName = "桂平市";
|
||||
logger.warn("[顺丰] 城市名为空,使用默认城市: {}", cityName);
|
||||
} else {
|
||||
logger.debug("[顺丰] 解析得到城市名: {}", cityName);
|
||||
}
|
||||
|
||||
// 为了其他顺丰店同名,店铺名称加上[门店ID]; 如:xxxx[xxxx] 聚万家生鲜超市[69]
|
||||
String shopName = String.format("%s[%s]", shopMchEntry.getStore_name(), shopMchEntry.getStore_id());
|
||||
|
||||
|
||||
// 3. 获取或初始化商家配送信息
|
||||
ShopStoreSameCityTransportBase transportBase = shopStoreSameCityTransportBaseService
|
||||
.getShopStoreSameCityTransportBaseById(Long.valueOf(storeId));
|
||||
|
||||
@ -646,27 +646,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
return;
|
||||
}
|
||||
|
||||
// 这是E签宝的逻辑
|
||||
// if (CommonConstant.MCH_APPR_STA_PASS.equals(record.getApproval_status())
|
||||
// && (StrUtil.isBlank(record.getContract_download_url()) || !CommonConstant.CONTRACT_SIGN_STA_FINISH.equals(record.getSigned_status()))) {
|
||||
// // 审核通过的,但是没有合同文件的情况,要进一步同步状态和合同文件
|
||||
// Pair<Integer, String> contractInfo = esignContractService.checkSignFlowStatus(record.getLogin_mobile());
|
||||
// if (contractInfo != null) {
|
||||
// record.setSigned_status(contractInfo.getFirst());
|
||||
// record.setContract_download_url(contractInfo.getSecond());
|
||||
//
|
||||
// // 更改同步合同审核状态和合同下载地址
|
||||
// taskService.executeTask(() -> {
|
||||
// log.debug("###更改同步合同审核状态和下载地址###");
|
||||
// if (!updateMerchEntrySignedStatusAndContractDownloadUrl(record.getLogin_mobile(), record.getSigned_status(), record.getContract_download_url())) {
|
||||
// log.error("###更改同步合同审核状态和下载地址失败###");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// === 拉卡拉签约逻辑 ===
|
||||
|
||||
Long mchId = record.getId();
|
||||
if (CommonConstant.Enable.equals(record.getHas_ec_signed())) {
|
||||
LklLedgerEc ec = lklLedgerEcService.getByMchId(
|
||||
@ -830,7 +810,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
&& CommonConstant.Enable.equals(shopMchEntry.getHas_bind_receiver());
|
||||
|
||||
if (!isValidStatus) {
|
||||
log.debug("入驻记录状态未全部通过审核,不能创建店铺,入驻ID: {}", mchId);
|
||||
log.error("入驻记录状态未全部通过审核,不能创建店铺,入驻ID: {}", mchId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -3430,15 +3430,14 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
shopMchEntryService.updateMerchEntryStoreStatus(shopMchEntry.getId(), storeId);
|
||||
}
|
||||
|
||||
// 创建顺丰店铺(修复经纬度参数错误)
|
||||
if (storeArea != null) {
|
||||
String[] areaNames = storeArea.split("/");
|
||||
String cityName = areaNames.length > 0 ? areaNames[areaNames.length - 1] : storeArea.replace("/", "");
|
||||
// 创建顺丰店铺
|
||||
// if (storeArea != null) {
|
||||
// String[] areaNames = storeArea.split("/");
|
||||
// String cityName = areaNames.length > 0 ? areaNames[areaNames.length - 1] : storeArea.replace("/", "");
|
||||
|
||||
sfExpressApiService.createSfExpressShop(mchId, storeId, shopMchEntry.getStore_name(),
|
||||
cityName, shopMchEntry.getStore_address(), shopMchEntry.getContact_name(),
|
||||
contact_mobile, shopMchEntry.getStore_longitude(), shopMchEntry.getStore_latitude());
|
||||
}
|
||||
sfExpressApiService.createSfExpressShop(mchId, storeId, shopMchEntry.getContact_name(),
|
||||
contact_mobile, shopMchEntry.getStore_longitude(), shopMchEntry.getStore_latitude());
|
||||
// }
|
||||
|
||||
return Pair.of(storeId, "新增成功");
|
||||
} catch (Exception e) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user