Compare commits

...

2 Commits

Author SHA1 Message Date
837aa53c11 Merge pull request '优化自提门店接口' (#99) from sjy-two into master
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #99
2024-11-01 16:52:13 +08:00
bd834f366d 优化自提门店接口 2024-11-01 16:48:06 +08:00
14 changed files with 122 additions and 13 deletions

View File

@ -117,13 +117,14 @@ const submitForm = async () => {
if (formType.value === 'create') { if (formType.value === 'create') {
await LitemallBrandApi.createLitemallBrand(data) await LitemallBrandApi.createLitemallBrand(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await LitemallBrandApi.updateLitemallBrand(data) await LitemallBrandApi.updateLitemallBrand(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
dialogVisible.value = false dialogVisible.value = false
// //
emit('success') emit('success')
} finally { } finally {
formLoading.value = false formLoading.value = false
} }

View File

@ -56,7 +56,7 @@
<!-- <el-table-column label="门店管理员" align="center" prop="userId" />--> <!-- <el-table-column label="门店管理员" align="center" prop="userId" />-->
<el-table-column label="门店图片" align="center" prop="picUrl"> <el-table-column label="门店图片" align="center" prop="picUrl">
<template #default="{ row }"> <template #default="{ row }">
<div class="flex"> <div class="flex justify-center items-center">
<el-image fit="cover" :src="row.picUrl" class="flex-none w-50px h-50px" <el-image fit="cover" :src="row.picUrl" class="flex-none w-50px h-50px"
@click="imagePreview(row.picUrl)" /> @click="imagePreview(row.picUrl)" />
</div> </div>
@ -79,7 +79,7 @@
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="权重" align="center" prop="weight" />--> <!-- <el-table-column label="权重" align="center" prop="weight" />-->
<el-table-column label="备注" align="center" prop="remark" /> <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" /> <el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
<el-table-column label="操作" align="center" fixed="right" width="110"> <el-table-column label="操作" align="center" fixed="right" width="110">
<template #default="scope"> <template #default="scope">

View File

@ -8,10 +8,14 @@
v-loading="formLoading" v-loading="formLoading"
> >
<el-form-item label="门店" prop="brandId"> <el-form-item label="门店" prop="brandId">
<!-- <el-input v-model="formData.brandId" placeholder="请输入门店id" />-->
<el-select v-model="formData.brandId" placeholder="请选择门店" clearable class="!w-240px"> <el-select v-model="formData.brandId" placeholder="请选择门店" clearable class="!w-240px">
<el-option v-for="organizationNameOptions in option" :key="organizationNameOptions.id" <el-option
:label="organizationNameOptions.name" :value="organizationNameOptions.id" /> v-for="organizationNameOptions in option"
:key="organizationNameOptions.id"
:label="organizationNameOptions.name"
:value="organizationNameOptions.id"
:disabled="organizationNameOptions.disabled"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="项目名称" prop="name"> <el-form-item label="项目名称" prop="name">

View File

@ -54,7 +54,7 @@
<!-- <el-table-column label="项目图片" align="center" prop="pictrue" /> --> <!-- <el-table-column label="项目图片" align="center" prop="pictrue" /> -->
<el-table-column label="项目图片" align="center" prop="pictrue"> <el-table-column label="项目图片" align="center" prop="pictrue">
<template #default="{ row }"> <template #default="{ row }">
<div class="flex" style="display: flex; align-items: center;"> <div class="flex justify-center items-center" style="display: flex; align-items: center;">
<el-image fit="cover" :src="row.pictrue" class="flex-none w-50px h-50px" <el-image fit="cover" :src="row.pictrue" class="flex-none w-50px h-50px"
@click="imagePreview(row.pictrue)" /> @click="imagePreview(row.pictrue)" />
</div> </div>

View File

@ -2,8 +2,8 @@
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px"> <el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
<el-form-item label="所属门店" prop="brandId"> <el-form-item label="所属项目" prop="brandId">
<el-select v-model="queryParams.brandId" placeholder="请选择门店" clearable class="!w-240px"> <el-select v-model="queryParams.brandId" placeholder="请选择项目" clearable class="!w-240px">
<el-option v-for="organizationNameOptions in option" :key="organizationNameOptions.id" <el-option v-for="organizationNameOptions in option" :key="organizationNameOptions.id"
:label="organizationNameOptions.name" :value="organizationNameOptions.id" /> :label="organizationNameOptions.name" :value="organizationNameOptions.id" />
</el-select> </el-select>
@ -47,7 +47,7 @@
<el-table-column label="名称" align="center" prop="name" /> <el-table-column label="名称" align="center" prop="name" />
<el-table-column label="图片" align="center" prop="photo"> <el-table-column label="图片" align="center" prop="photo">
<template #default="{ row }"> <template #default="{ row }">
<div class="flex"> <div class="flex justify-center items-center">
<el-image fit="cover" :src="row.photo" class="flex-none w-50px h-50px" <el-image fit="cover" :src="row.photo" class="flex-none w-50px h-50px"
@click="imagePreview(row.photo)" /> @click="imagePreview(row.photo)" />
</div> </div>

View File

@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.annotation.security.PermitAll; import javax.annotation.security.PermitAll;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -100,6 +101,7 @@ public class AppPointActivityController {
return success(result); return success(result);
} }
private List<AppPointActivityRespVO> buildAppPointActivityRespVOList(List<PointActivityDO> activityList) { private List<AppPointActivityRespVO> buildAppPointActivityRespVOList(List<PointActivityDO> activityList) {
List<PointProductDO> products = pointActivityService.getPointProductListByActivityIds( List<PointProductDO> products = pointActivityService.getPointProductListByActivityIds(
convertSet(activityList, PointActivityDO::getId)); convertSet(activityList, PointActivityDO::getId));
@ -118,4 +120,29 @@ public class AppPointActivityController {
return result; return result;
} }
//获取更多积分商品
@GetMapping("/pointActivityList")
public CommonResult<List<AppPointActivityRespVO>> pointActivityList() {
List<Long> ids = new ArrayList<>();
List<PointActivityDO> pointActivityDOS = pointActivityService.pointActivityList();
for (int i = 0; i < pointActivityDOS.size(); i++) {
PointActivityDO pointActivityDO = pointActivityDOS.get(i);
ids.add(pointActivityDO.getId());
}
// 1. 获得开启的活动列表
List<PointActivityDO> activityList = pointActivityService.getPointActivityListByIds(ids);
activityList.removeIf(activity -> CommonStatusEnum.isDisable(activity.getStatus()));
if (CollUtil.isEmpty(activityList)) {
return success(Collections.emptyList());
}
// 2. 拼接返回
List<AppPointActivityRespVO> result = buildAppPointActivityRespVOList(activityList);
return success(result);
}
} }

View File

@ -8,6 +8,9 @@ import cn.iocoder.yudao.module.promotion.controller.admin.point.vo.activity.Poin
import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointActivityDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* 积分商城活动 Mapper * 积分商城活动 Mapper
@ -56,4 +59,10 @@ public interface PointActivityMapper extends BaseMapperX<PointActivityDO> {
.setSql("stock = stock + " + count)); .setSql("stock = stock + " + count));
} }
@Select(" select a.* from promotion_point_activity a " +
" left join product_spu b on a.spu_id = b.id " +
" where b.status = 1 and b.deleted = 0 ")
List<PointActivityDO> pointActivityList();
} }

View File

@ -109,4 +109,6 @@ public interface PointActivityService {
*/ */
PointValidateJoinRespDTO validateJoinPointActivity(Long activityId, Long skuId, Integer count); PointValidateJoinRespDTO validateJoinPointActivity(Long activityId, Long skuId, Integer count);
List<PointActivityDO> pointActivityList();
} }

View File

@ -306,4 +306,9 @@ public class PointActivityServiceImpl implements PointActivityService {
return BeanUtils.toBean(product, PointValidateJoinRespDTO.class); return BeanUtils.toBean(product, PointValidateJoinRespDTO.class);
} }
@Override
public List<PointActivityDO> pointActivityList() {
return pointActivityMapper.pointActivityList();
}
} }

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.time.LocalTime;
@Schema(description = "用户 App - 自提门店 Response VO") @Schema(description = "用户 App - 自提门店 Response VO")
@Data @Data
public class AppDeliveryPickUpStoreRespVO { public class AppDeliveryPickUpStoreRespVO {
@ -37,4 +39,17 @@ public class AppDeliveryPickUpStoreRespVO {
@Schema(description = "距离,单位:千米", example = "100") // 只有在用户传递了经纬度时才进行计算 @Schema(description = "距离,单位:千米", example = "100") // 只有在用户传递了经纬度时才进行计算
private Double distance; private Double distance;
/**
* 营业开始时间
*/
private LocalTime openingTime;
/**
* 营业结束时间
*/
private LocalTime closingTime;
//门店状态营业中休息中
private int stat;
} }

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -81,4 +82,8 @@ public class DeliveryPickUpStoreDO extends BaseDO {
*/ */
private Integer status; private Integer status;
@TableField(exist = false)
private int stat;
} }

View File

@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalTime;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -78,7 +79,29 @@ public class DeliveryPickUpStoreServiceImpl implements DeliveryPickUpStoreServic
@Override @Override
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status) { public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status) {
return deliveryPickUpStoreMapper.selectListByStatus(status); List<DeliveryPickUpStoreDO> deliveryPickUpStoreDOS = deliveryPickUpStoreMapper.selectListByStatus(status);
for (int i = 0; i < deliveryPickUpStoreDOS.size(); i++) {
DeliveryPickUpStoreDO deliveryPickUpStoreDO = deliveryPickUpStoreDOS.get(i);
LocalTime openingTime = deliveryPickUpStoreDO.getOpeningTime();
LocalTime closingTime = deliveryPickUpStoreDO.getClosingTime();
LocalTime currentTime = LocalTime.now(); // 获取当前时间
boolean isOpen = isStoreOpen(openingTime, closingTime, currentTime);
if (isOpen) {
System.out.println("商店现在是开着的。");
deliveryPickUpStoreDO.setStat(1);
} else {
System.out.println("商店现在是关着的。");
deliveryPickUpStoreDO.setStat(0);
}
}
return deliveryPickUpStoreDOS;
}
public static boolean isStoreOpen(LocalTime openingTime, LocalTime closingTime, LocalTime currentTime) {
// 检查当前时间是否在开店时间和关店时间之间
return !currentTime.isBefore(openingTime) && !currentTime.isAfter(closingTime);
} }
} }

View File

@ -70,4 +70,8 @@ public class LitemallBrandDO extends BaseDO {
*/ */
private String remark; private String remark;
//状态显示下拉框数据显示或隐藏
@TableField(exist = false)
private boolean disabled;
} }

View File

@ -42,6 +42,12 @@ public class LitemallBrandServiceImpl implements LitemallBrandService {
public void updateLitemallBrand(LitemallBrandSaveReqVO updateReqVO) { public void updateLitemallBrand(LitemallBrandSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
validateLitemallBrandExists(updateReqVO.getId()); validateLitemallBrandExists(updateReqVO.getId());
// //停用门店
// if (updateReqVO.getStatus() == 1){
//
// }
// 更新 // 更新
LitemallBrandDO updateObj = BeanUtils.toBean(updateReqVO, LitemallBrandDO.class); LitemallBrandDO updateObj = BeanUtils.toBean(updateReqVO, LitemallBrandDO.class);
litemallBrandMapper.updateById(updateObj); litemallBrandMapper.updateById(updateObj);
@ -73,7 +79,15 @@ public class LitemallBrandServiceImpl implements LitemallBrandService {
@Override @Override
public List<LitemallBrandDO> getOrganization() { public List<LitemallBrandDO> getOrganization() {
return litemallBrandMapper.selectList(); List<LitemallBrandDO> litemallBrandDOS = litemallBrandMapper.selectList();
for (int i = 0; i < litemallBrandDOS.size(); i++) {
LitemallBrandDO litemallBrandDO = litemallBrandDOS.get(i);
if (litemallBrandDO.getStatus() == 1){ //关闭
litemallBrandDO.setDisabled(true);
}
}
return litemallBrandDOS;
} }
} }