预订单时间槽列表逻辑调整,分账、提现 报文字段 保存

This commit is contained in:
Jack 2025-10-30 10:47:14 +08:00
parent 6a335ef1aa
commit 5ff094de7a
6 changed files with 133 additions and 126 deletions

View File

@ -33,6 +33,11 @@ public class BookingArgDTO {
@ApiModelProperty(value = "日期") @ApiModelProperty(value = "日期")
private String date; private String date;
/**
* 工作时间依据"09:00-21:00"
*/
private String working_hours;
/** /**
* 时间项列表 * 时间项列表
*/ */

View File

@ -1046,8 +1046,9 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
String dateStr = DateUtil.format(currentDate, "yyyy-MM-dd"); String dateStr = DateUtil.format(currentDate, "yyyy-MM-dd");
String displayDateStr = DateUtil.format(currentDate, "MM月dd日"); String displayDateStr = DateUtil.format(currentDate, "MM月dd日");
// 安全获取星期信息 // 安全获取星期信息
String weekStr = "未知"; String weekStr = "星期";
try { try {
weekStr = DateTimeUtils.getWeekOfDate(currentDate); weekStr = DateTimeUtils.getWeekOfDate(currentDate);
} catch (Exception e) { } catch (Exception e) {
@ -1082,7 +1083,9 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
// 只有当 timesMap 不为空时才生成其他时间槽 // 只有当 timesMap 不为空时才生成其他时间槽
if (!ObjectUtil.isEmpty(timesMap) && StrUtil.isNotBlank(timesMap.get("startTimeStr")) && StrUtil.isNotBlank(timesMap.get("endTimeStr"))) { 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) { if (i == 0) {
// 对于今天移除除"立即送出"外的所有时间槽 // 对于今天移除除"立即送出"外的所有时间槽
items.addAll(timeSlots.stream().filter(item -> item.getBooking_state() != 1).collect(Collectors.toList())); 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); items.addAll(timeSlots);
} }
bookingArgDTO.setWorking_hours(String.format("%s-%s", startTimeStr, endTimeStr));
} else if (i == 0) { } else if (i == 0) {
// 如果timesMap为空今天只保留"立即送出"选项 // 如果timesMap为空今天只保留"立即送出"选项
logger.debug("[生成预约参数] 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();
}
}
} }

View File

@ -31,16 +31,16 @@ public interface SFExpressApiService {
* *
* @param mchId 商家入驻编号 * @param mchId 商家入驻编号
* @param storeId 商家门店ID * @param storeId 商家门店ID
* @param shopName 店名 * // * @param shopName 店名
* @param cityName 城市 * // * @param cityName 城市
* @param shopAddress 店铺详细地址 * // * @param shopAddress 店铺详细地址
* @param contactName 店铺联系人 * @param contactName 店铺联系人
* @param contactPhone 店铺电话 * @param contactPhone 店铺电话
* @param longitude 经度 * @param longitude 经度
* @param latitude 纬度 * @param latitude 纬度
* @return * @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);
/** /**

View File

@ -185,42 +185,42 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
return Pair.of(false, "联系人手机号不能为空"); return Pair.of(false, "联系人手机号不能为空");
} }
AddressParseResultTO addressParseResultTO = AddressUtil.parseAddress(shopMchEntry.getStore_address()); // AddressParseResultTO addressParseResultTO = AddressUtil.parseAddress(shopMchEntry.getStore_address());
// 解析城市名称 // // 解析城市名称
String cityName = "桂平市"; // 默认城市 // String cityName = "桂平市"; // 默认城市
//
// 去掉省市区的详细地址 // // 去掉省市区的详细地址
String storeAddress = addressParseResultTO.getDetailAddress(); // String storeAddress = addressParseResultTO.getDetailAddress();
//
if (StrUtil.isNotBlank(shopMchEntry.getStore_area())) { // if (StrUtil.isNotBlank(shopMchEntry.getStore_area())) {
String[] areaNames = shopMchEntry.getStore_area().split("/"); // String[] areaNames = shopMchEntry.getStore_area().split("/");
if (areaNames.length >= 3) { // if (areaNames.length >= 3) {
cityName = areaNames[areaNames.length - 1]; // cityName = areaNames[areaNames.length - 1];
} else { // } else {
cityName = shopMchEntry.getStore_area().replace("/", ""); // cityName = shopMchEntry.getStore_area().replace("/", "");
} // }
} else { // } else {
cityName = addressParseResultTO.getCity(); // cityName = addressParseResultTO.getCity();
} // }
//
// 如果解析后城市名为空使用默认值 // // 如果解析后城市名为空使用默认值
if (StrUtil.isBlank(cityName)) { // if (StrUtil.isBlank(cityName)) {
cityName = "桂平市"; // cityName = "桂平市";
logger.warn("[顺丰] 城市名为空,使用默认城市: {}", cityName); // logger.warn("[顺丰] 城市名为空,使用默认城市: {}", cityName);
} else { // } else {
logger.debug("[顺丰] 解析得到城市名: {}", cityName); // logger.debug("[顺丰] 解析得到城市名: {}", cityName);
} // }
//
// 为了其他顺丰店同名店铺名称加上[门店ID]; xxxx[xxxx] 聚万家生鲜超市[69] // // 为了其他顺丰店同名店铺名称加上[门店ID]; xxxx[xxxx] 聚万家生鲜超市[69]
String shopStoreName = String.format("%s[%s]", shopMchEntry.getStore_name(), shopMchEntry.getStore_id()); // String shopStoreName = String.format("%s[%s]", shopMchEntry.getStore_name(), shopMchEntry.getStore_id());
// 调用创建店铺方法 // 调用创建店铺方法
Pair<Boolean, String> result = createSfExpressShop( Pair<Boolean, String> result = createSfExpressShop(
mchId, mchId,
Convert.toInt(shopMchEntry.getStore_id()), Convert.toInt(shopMchEntry.getStore_id()),
shopStoreName, // shopStoreName,
cityName, // cityName,
storeAddress, // storeAddress,
shopMchEntry.getContact_name(), shopMchEntry.getContact_name(),
contactMobile, contactMobile,
shopMchEntry.getStore_longitude(), shopMchEntry.getStore_longitude(),
@ -237,9 +237,6 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
* *
* @param mchId 商家入驻编号 * @param mchId 商家入驻编号
* @param storeId 商家门店ID * @param storeId 商家门店ID
* @param shopName 店名
* @param cityName 城市
* @param shopAddress 店铺详细地址
* @param contactName 店铺联系人 * @param contactName 店铺联系人
* @param contactPhone 店铺电话 * @param contactPhone 店铺电话
* @param longitude 经度 * @param longitude 经度
@ -247,17 +244,16 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
* @return Pair<Boolean, String> 第一个元素表示是否成功第二个元素表示结果信息或错误信息 * @return Pair<Boolean, String> 第一个元素表示是否成功第二个元素表示结果信息或错误信息
*/ */
@Override @Override
public Pair<Boolean, String> createSfExpressShop(Long mchId, Integer storeId, String shopName, String cityName, public Pair<Boolean, String> createSfExpressShop(Long mchId, Integer storeId, String contactName, String contactPhone,
String shopAddress, String contactName, String contactPhone,
String longitude, String latitude) { String longitude, String latitude) {
logger.info("开始创建顺丰同城店铺, storeId: {}", storeId); logger.info("开始创建顺丰同城店铺, storeId: {}", storeId);
try { try {
// 1. 验证必要参数 // 1. 验证必要参数
if ((CheckUtil.isEmpty(mchId) && CheckUtil.isEmpty(storeId)) || if ((CheckUtil.isEmpty(mchId) && CheckUtil.isEmpty(storeId)) ||
StringUtils.isAnyBlank(shopName, shopAddress, contactName, contactPhone)) { StringUtils.isAnyBlank(contactName, contactPhone)) {
logger.error("创建顺丰店铺缺少必要参数mchId:{}, storeId:{},shopName:{},shopAddress:{},contactName:{},contactPhone:{}", logger.error("创建顺丰店铺缺少必要参数mchId:{}, storeId:{},contactName:{},contactPhone:{}",
mchId, storeId, shopName, shopAddress, contactName, contactPhone); mchId, storeId, contactName, contactPhone);
return Pair.of(false, "创建顺丰店铺,缺少必要参数!"); 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. 获取或初始化商家配送信息 // 3. 获取或初始化商家配送信息
ShopStoreSameCityTransportBase transportBase = shopStoreSameCityTransportBaseService ShopStoreSameCityTransportBase transportBase = shopStoreSameCityTransportBaseService
.getShopStoreSameCityTransportBaseById(Long.valueOf(storeId)); .getShopStoreSameCityTransportBaseById(Long.valueOf(storeId));

View File

@ -646,27 +646,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
return; 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(); Long mchId = record.getId();
if (CommonConstant.Enable.equals(record.getHas_ec_signed())) { if (CommonConstant.Enable.equals(record.getHas_ec_signed())) {
LklLedgerEc ec = lklLedgerEcService.getByMchId( LklLedgerEc ec = lklLedgerEcService.getByMchId(
@ -830,7 +810,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
&& CommonConstant.Enable.equals(shopMchEntry.getHas_bind_receiver()); && CommonConstant.Enable.equals(shopMchEntry.getHas_bind_receiver());
if (!isValidStatus) { if (!isValidStatus) {
log.debug("入驻记录状态未全部通过审核不能创建店铺入驻ID: {}", mchId); log.error("入驻记录状态未全部通过审核不能创建店铺入驻ID: {}", mchId);
return false; return false;
} }

View File

@ -3430,15 +3430,14 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
shopMchEntryService.updateMerchEntryStoreStatus(shopMchEntry.getId(), storeId); shopMchEntryService.updateMerchEntryStoreStatus(shopMchEntry.getId(), storeId);
} }
// 创建顺丰店铺修复经纬度参数错误 // 创建顺丰店铺
if (storeArea != null) { // if (storeArea != null) {
String[] areaNames = storeArea.split("/"); // String[] areaNames = storeArea.split("/");
String cityName = areaNames.length > 0 ? areaNames[areaNames.length - 1] : storeArea.replace("/", ""); // String cityName = areaNames.length > 0 ? areaNames[areaNames.length - 1] : storeArea.replace("/", "");
sfExpressApiService.createSfExpressShop(mchId, storeId, shopMchEntry.getStore_name(), sfExpressApiService.createSfExpressShop(mchId, storeId, shopMchEntry.getContact_name(),
cityName, shopMchEntry.getStore_address(), shopMchEntry.getContact_name(),
contact_mobile, shopMchEntry.getStore_longitude(), shopMchEntry.getStore_latitude()); contact_mobile, shopMchEntry.getStore_longitude(), shopMchEntry.getStore_latitude());
} // }
return Pair.of(storeId, "新增成功"); return Pair.of(storeId, "新增成功");
} catch (Exception e) { } catch (Exception e) {