Эх сурвалжийг харах

[feat]
拼团接口:1、热门拼团列表;2、项目关联团购列表;3、阶梯价格查询;4、正在拼团的用户;5、项目列表添加最低价团购信息

limeng 2 сар өмнө
parent
commit
16c0c1cd6d
29 өөрчлөгдсөн 944 нэмэгдсэн , 42 устгасан
  1. 130 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteProjectGroupPurchaseController.java
  2. 59 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteProjectGroupPurchaseDetailController.java
  3. 142 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourProjectGroupPurchaseDetailDtoToWebDto.java
  4. 226 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourProjectGroupPurchaseDtoToWebDto.java
  5. 19 18
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/service/impl/TourismProjectToWebServiceImpl.java
  6. 36 0
      application-webadmin/src/main/java/com/tourism/webadmin/app/website/vo/TourGroupPurchaseUserVo.java
  7. 2 2
      application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourProjectGroupPurchaseController.java
  8. 1 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourProjectGroupPurchaseDetailController.java
  9. 8 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourOrderMapper.java
  10. 1 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourProjectGroupPurchaseDetailMapper.java
  11. 22 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourProjectGroupPurchaseMapper.java
  12. 12 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourOrder.java
  13. 16 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourProjectGroupPurchase.java
  14. 0 11
      application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourProjectGroupPurchaseDetail.java
  15. 7 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourOrderService.java
  16. 7 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourProjectGroupPurchaseDetailService.java
  17. 7 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourProjectGroupPurchaseService.java
  18. 7 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourismDatePriceService.java
  19. 6 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourOrderServiceImpl.java
  20. 11 2
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourProjectGroupPurchaseDetailServiceImpl.java
  21. 6 2
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourProjectGroupPurchaseServiceImpl.java
  22. 13 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourismDatePriceServiceImpl.java
  23. 0 6
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourProjectGroupPurchaseDetailVo.java
  24. 20 1
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourProjectGroupPurchaseVo.java
  25. 11 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourismProjectVo.java
  26. 77 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/WebsiteProjectGroupPurchaseVo.java
  27. 2 0
      common/common-core/src/main/java/com/tourism/common/core/constant/ErrorCodeEnum.java
  28. 26 0
      common/common-core/src/main/java/com/tourism/common/core/util/MyDateUtil.java
  29. 70 0
      common/common-core/src/main/java/com/tourism/common/core/util/NumberToChineseConverter.java

+ 130 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteProjectGroupPurchaseController.java

@@ -0,0 +1,130 @@
+package com.tourism.webadmin.app.website.controller;
+
+import cn.dev33.satoken.annotation.SaIgnore;
+import com.github.pagehelper.page.PageMethod;
+import com.tourism.common.additional.config.ApplicationConfig;
+import com.tourism.common.additional.utils.UrlConvertUtils;
+import com.tourism.common.core.constant.ErrorCodeEnum;
+import com.tourism.common.core.object.*;
+import com.tourism.common.core.util.*;
+import com.tourism.webadmin.app.website.dto.TourProjectGroupPurchaseDtoToWebDto;
+import com.tourism.webadmin.app.website.vo.TourGroupPurchaseUserVo;
+import com.tourism.webadmin.back.model.TourProjectGroupPurchase;
+import com.tourism.webadmin.back.model.TourProjectGroupPurchaseDetail;
+import com.tourism.webadmin.back.model.TourUser;
+import com.tourism.webadmin.back.model.TourismDatePrice;
+import com.tourism.webadmin.back.service.TourOrderService;
+import com.tourism.webadmin.back.service.TourProjectGroupPurchaseDetailService;
+import com.tourism.webadmin.back.service.TourProjectGroupPurchaseService;
+import com.tourism.webadmin.back.service.TourismDatePriceService;
+import com.tourism.webadmin.back.vo.TourProjectGroupPurchaseVo;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.time.ZoneId;
+import java.util.List;
+
+/**
+ * 拼团设置主表操作控制器类。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Tag(name = "拼团设置主表管理接口")
+@Slf4j
+@RestController
+@RequestMapping("/website/app/tourProjectGroupPurchase")
+public class WebsiteProjectGroupPurchaseController {
+
+    @Autowired
+    private TourProjectGroupPurchaseService tourProjectGroupPurchaseService;
+    @Autowired
+    private TourOrderService tourOrderService;
+    @Autowired
+    private ApplicationConfig applicationConfig;
+    @Autowired
+    private TourProjectGroupPurchaseDetailService tourProjectGroupPurchaseDetailService;
+    @Autowired
+    private TourismDatePriceService tourismDatePriceService;
+
+    /**
+     * 项目首页热门拼团列表接口。
+     *
+     * @param dto 过滤对象。
+     * @return 应答结果对象,包含查询结果集。
+     */
+    @SaIgnore
+    @GetMapping("/list")
+    public ResponseResult<MyPageData<com.tourism.webadmin.back.vo.TourProjectGroupPurchaseVo>> list(TourProjectGroupPurchaseDtoToWebDto dto) {
+        if (dto != null) {
+            PageMethod.startPage(dto.getPageNum(), dto.getPageSize(), dto.getCount());
+        }
+//        dto.setSuccess(0);
+        TourProjectGroupPurchase tourProjectGroupPurchaseFilter = MyModelUtil.copyTo(dto, TourProjectGroupPurchase.class);
+        MyOrderParam myOrderParam = new MyOrderParam();
+        myOrderParam.add(new MyOrderParam.OrderInfo("showOrder",true,null));
+        String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourProjectGroupPurchase.class);
+        List<TourProjectGroupPurchase> tourProjectGroupPurchaseList =
+                tourProjectGroupPurchaseService.getTourProjectGroupPurchaseListWithRelation(tourProjectGroupPurchaseFilter, orderBy);
+        // 处理距离拼团结束的时间
+        for (TourProjectGroupPurchase entity : tourProjectGroupPurchaseList) {
+            int i = MyDateUtil.calculateRelativeDays(entity.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
+            if(i > 0) {
+                String s = NumberToChineseConverter.convertToChinese(i);
+                entity.setDiffDaysToEnd("还剩" + s + "天失效");
+            }
+            entity.setImage(UrlConvertUtils.urlConvertSingle(applicationConfig.getHostIpPort(), entity.getImage()));
+        }
+        return ResponseResult.success(MyPageUtil.makeResponseData(tourProjectGroupPurchaseList, TourProjectGroupPurchaseVo.class));
+    }
+
+    /**
+     * 查看拼团详情。
+     *
+     * @param id 指定对象主键Id。
+     * @return 应答结果对象,包含对象详情。
+     */
+    @SaIgnore
+    @GetMapping("/view")
+    public ResponseResult<TourProjectGroupPurchaseVo> view(@RequestParam Long id) {
+        TourProjectGroupPurchase tourProjectGroupPurchase = tourProjectGroupPurchaseService.getByIdWithRelation(id, MyRelationParam.full());
+        if (tourProjectGroupPurchase == null) {
+            return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
+        }
+        TourProjectGroupPurchaseVo tourProjectGroupPurchaseVo = MyModelUtil.copyTo(tourProjectGroupPurchase, TourProjectGroupPurchaseVo.class);
+        // 查询项目日历中的原价
+        TourismDatePrice tourismDatePrice = new TourismDatePrice();
+        tourismDatePrice.setProjectId(tourProjectGroupPurchase.getProjectId().toString());
+        tourismDatePrice.setDepartureDate(tourProjectGroupPurchase.getTravelStartTime());
+        TourismDatePrice oneTourismDatePrice = tourismDatePriceService.getOneTourismDatePrice(tourismDatePrice);
+        if (oneTourismDatePrice == null) {
+            tourProjectGroupPurchaseVo.setOriginalPrice(BigDecimal.ZERO);
+        }else {
+            tourProjectGroupPurchaseVo.setOriginalPrice(oneTourismDatePrice.getAdultPrice());
+        }
+
+        // 查询阶梯价格详情以计算当前价格
+        TourProjectGroupPurchaseDetail detail = tourProjectGroupPurchaseDetailService.getTourProjectGroupPurchaseDetail(tourProjectGroupPurchase);
+        if(detail != null) {
+            tourProjectGroupPurchaseVo.setNowPrice(detail.getAdultPrice());
+        }else {
+            tourProjectGroupPurchaseVo.setNowPrice(tourProjectGroupPurchaseVo.getOriginalPrice());
+        }
+        return ResponseResult.success(tourProjectGroupPurchaseVo);
+    }
+
+    /**
+     * 查询拼团成功的用户信息,并展示头像、用户昵称和拼团成功的时间
+     */
+    @SaIgnore
+    @GetMapping("/queryGroupPurchaseUser")
+    public ResponseResult<List<TourGroupPurchaseUserVo>> queryGroupPurchaseUser(@RequestParam Long projectId) {
+        List<TourUser> tourUserList = tourOrderService.getTourUserListByProjectId(projectId);
+        // 把List<TourUser>转为List<TourProjectGroupPurchaseUserVo>
+        List<TourGroupPurchaseUserVo> tourGroupPurchaseUserVoList = MyModelUtil.copyCollectionTo(tourUserList, TourGroupPurchaseUserVo.class);
+        return ResponseResult.success(tourGroupPurchaseUserVoList);
+    }
+}

+ 59 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/controller/WebsiteProjectGroupPurchaseDetailController.java

@@ -0,0 +1,59 @@
+package com.tourism.webadmin.app.website.controller;
+
+import cn.dev33.satoken.annotation.SaIgnore;
+import com.github.pagehelper.page.PageMethod;
+import com.tourism.common.core.constant.ErrorCodeEnum;
+import com.tourism.common.core.object.*;
+import com.tourism.common.core.util.MyModelUtil;
+import com.tourism.common.core.util.MyPageUtil;
+import com.tourism.webadmin.app.website.dto.TourProjectGroupPurchaseDetailDtoToWebDto;
+import com.tourism.webadmin.back.model.TourProjectGroupPurchaseDetail;
+import com.tourism.webadmin.back.service.TourProjectGroupPurchaseDetailService;
+import com.tourism.webadmin.back.vo.TourProjectGroupPurchaseDetailVo;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 拼团设置从表操作控制器类。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Tag(name = "拼团设置从表管理接口")
+@Slf4j
+@RestController
+@RequestMapping("/website/app/tourProjectGroupPurchaseDetail")
+public class WebsiteProjectGroupPurchaseDetailController {
+
+    @Autowired
+    private TourProjectGroupPurchaseDetailService tourProjectGroupPurchaseDetailService;
+
+
+    /**
+     * 阶梯价格接口。
+     *
+     * @param dto 过滤对象。
+     * @return 应答结果对象,包含查询结果集。
+     */
+    @SaIgnore
+    @GetMapping("/list")
+    public ResponseResult<MyPageData<TourProjectGroupPurchaseDetailVo>> list(TourProjectGroupPurchaseDetailDtoToWebDto dto) {
+        if (dto != null) {
+            PageMethod.startPage(dto.getPageNum(), dto.getPageSize(), dto.getCount());
+        }
+        if(dto.getGroupPurchaseCode() == null) {
+            return ResponseResult.error(ErrorCodeEnum.MISS_PROJECT_ID);
+        }
+        TourProjectGroupPurchaseDetail tourProjectGroupPurchaseDetailFilter = MyModelUtil.copyTo(dto, TourProjectGroupPurchaseDetail.class);
+        MyOrderParam myOrderParam = new MyOrderParam();
+        myOrderParam.add(new MyOrderParam.OrderInfo("minCount",true,null));
+        String orderBy = MyOrderParam.buildOrderBy(myOrderParam, TourProjectGroupPurchaseDetail.class);
+        List<TourProjectGroupPurchaseDetail> tourProjectGroupPurchaseDetailList =
+                tourProjectGroupPurchaseDetailService.getTourProjectGroupPurchaseDetailListWithRelation(tourProjectGroupPurchaseDetailFilter, null, orderBy);
+        return ResponseResult.success(MyPageUtil.makeResponseData(tourProjectGroupPurchaseDetailList, TourProjectGroupPurchaseDetailVo.class));
+    }
+}

+ 142 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourProjectGroupPurchaseDetailDtoToWebDto.java

@@ -0,0 +1,142 @@
+package com.tourism.webadmin.app.website.dto;
+
+import com.tourism.common.core.object.MyOrderParam;
+import com.tourism.common.core.validator.UpdateGroup;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 拼团设置从表Dto对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Schema(description = "拼团设置从表Dto对象")
+@Data
+public class TourProjectGroupPurchaseDetailDtoToWebDto {
+
+    /**
+     * 主键id。
+     */
+    @Schema(description = "主键id。", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "数据验证失败,主键id不能为空!", groups = {UpdateGroup.class})
+    private Long id;
+
+    /**
+     * 关联 拼团设置的code。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "关联 拼团设置的code。可支持等于操作符的列表数据过滤。")
+    private Long groupPurchaseCode;
+
+    /**
+     * 成人价格。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "成人价格。可支持等于操作符的列表数据过滤。")
+    private BigDecimal adultPrice;
+
+    /**
+     * 儿童价格。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "儿童价格。可支持等于操作符的列表数据过滤。")
+    private BigDecimal childrenPrice;
+
+    /**
+     * 阶梯的人数(下限)。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "阶梯的人数(下限)。可支持等于操作符的列表数据过滤。")
+    private Integer minCount;
+
+    /**
+     * 阶梯的人数(上限)。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "阶梯的人数(上限)。可支持等于操作符的列表数据过滤。")
+    private Integer maxCount;
+
+    /**
+     * adultPrice 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "adultPrice 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal adultPriceStart;
+
+    /**
+     * adultPrice 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "adultPrice 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal adultPriceEnd;
+
+    /**
+     * childrenPrice 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "childrenPrice 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal childrenPriceStart;
+
+    /**
+     * childrenPrice 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "childrenPrice 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal childrenPriceEnd;
+
+    /**
+     * minCount 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "minCount 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private Integer minCountStart;
+
+    /**
+     * minCount 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "minCount 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private Integer minCountEnd;
+
+    /**
+     * maxCount 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "maxCount 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private Integer maxCountStart;
+
+    /**
+     * maxCount 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "maxCount 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private Integer maxCountEnd;
+
+    /**
+     * 分页号码,从1开始计数。
+     */
+    @Schema(description = "分页号码。")
+    private Integer pageNum = 1;
+
+    /**
+     * 每页大小。
+     */
+    @Schema(description = "每页大小。")
+    private Integer pageSize = 10;
+
+    /**
+     * 是否统计totalCount。
+     */
+    @Schema(description = "是否统计totalCount。")
+    private Boolean count;
+
+    /**
+     * 排序。
+     */
+    @Schema(description = "排序。")
+    private MyOrderParam orderParamList;
+}

+ 226 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/dto/TourProjectGroupPurchaseDtoToWebDto.java

@@ -0,0 +1,226 @@
+package com.tourism.webadmin.app.website.dto;
+
+import com.tourism.common.core.object.MyOrderParam;
+import com.tourism.common.core.validator.ConstDictRef;
+import com.tourism.common.core.validator.UpdateGroup;
+import com.tourism.webadmin.back.model.constant.Enable;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 拼团设置主表Dto对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Schema(description = "拼团设置主表Dto对象")
+@Data
+public class TourProjectGroupPurchaseDtoToWebDto {
+
+    /**
+     * 主键id。
+     */
+    @Schema(description = "主键id。", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "数据验证失败,主键id不能为空!", groups = {UpdateGroup.class})
+    private Long id;
+
+    /**
+     * 项目id。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "项目id。可支持等于操作符的列表数据过滤。")
+    private Long projectId;
+
+    /**
+     * 拼团结束时间。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "拼团结束时间。可支持等于操作符的列表数据过滤。")
+    private Date endTime;
+
+    /**
+     * 出行开始时间。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "出行开始时间。可支持等于操作符的列表数据过滤。")
+    private Date travelStartTime;
+
+    /**
+     * 出行结束时间。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "出行结束时间。可支持等于操作符的列表数据过滤。")
+    private Date travelEndTime;
+
+    /**
+     * 拼团状态(0禁用,1启用)。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "拼团状态(0禁用,1启用)。可支持等于操作符的列表数据过滤。")
+    @ConstDictRef(constDictClass = Enable.class, message = "数据验证失败,拼团状态(0禁用,1启用)为无效值!")
+    private Integer state;
+
+    /**
+     * 拼团人数上限。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "拼团人数上限。可支持等于操作符的列表数据过滤。")
+    private Integer maxCount;
+
+    /**
+     * 成人价格。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "成人价格。可支持等于操作符的列表数据过滤。")
+    private BigDecimal adultPrice;
+
+    /**
+     * 儿童价格。
+     * NOTE: 可支持等于操作符的列表数据过滤。
+     */
+    @Schema(description = "儿童价格。可支持等于操作符的列表数据过滤。")
+    private BigDecimal childrenPrice;
+
+    /**
+     * 显示顺序。
+     */
+    @Schema(description = "显示顺序。")
+    private Integer showOrder;
+
+    /**
+     * 关联字段(与从表)。
+     */
+    @Schema(description = "关联字段(与从表)。")
+    private Long code;
+
+    /**
+     * 当前拼团的人数。
+     */
+    @Schema(description = "当前拼团的人数。")
+    private Integer nowCount;
+
+    /**
+     * 拼团是否成功(0.失败;1.成功)。
+     */
+    @Schema(description = "拼团是否成功(0.失败;1.成功)。")
+    private Integer success;
+
+    /**
+     * 拼团标题。
+     */
+    @Schema(description = "拼团标题。")
+    private String title;
+
+    /**
+     * endTime 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "endTime 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private String endTimeStart;
+
+    /**
+     * endTime 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "endTime 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private String endTimeEnd;
+
+    /**
+     * travelStartTime 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "travelStartTime 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private String travelStartTimeStart;
+
+    /**
+     * travelStartTime 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "travelStartTime 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private String travelStartTimeEnd;
+
+    /**
+     * travelEndTime 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "travelEndTime 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private String travelEndTimeStart;
+
+    /**
+     * travelEndTime 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "travelEndTime 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private String travelEndTimeEnd;
+
+    /**
+     * maxCount 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "maxCount 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private Integer maxCountStart;
+
+    /**
+     * maxCount 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "maxCount 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private Integer maxCountEnd;
+
+    /**
+     * adultPrice 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "adultPrice 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal adultPriceStart;
+
+    /**
+     * adultPrice 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "adultPrice 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal adultPriceEnd;
+
+    /**
+     * childrenPrice 范围过滤起始值(>=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "childrenPrice 范围过滤起始值(>=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal childrenPriceStart;
+
+    /**
+     * childrenPrice 范围过滤结束值(<=)。
+     * NOTE: 可支持范围操作符的列表数据过滤。
+     */
+    @Schema(description = "childrenPrice 范围过滤结束值(<=)。可支持范围操作符的列表数据过滤。")
+    private BigDecimal childrenPriceEnd;
+
+    /**
+     * 分页号码,从1开始计数。
+     */
+    @Schema(description = "分页号码。")
+    private Integer pageNum = 1;
+
+    /**
+     * 每页大小。
+     */
+    @Schema(description = "每页大小。")
+    private Integer pageSize = 10;
+
+    /**
+     * 是否统计totalCount。
+     */
+    @Schema(description = "是否统计totalCount。")
+    private Boolean count = true;
+
+    /**
+     * 排序。
+     */
+    @Schema(description = "排序。")
+    private MyOrderParam orderParamList;
+
+}

+ 19 - 18
application-webadmin/src/main/java/com/tourism/webadmin/app/website/service/impl/TourismProjectToWebServiceImpl.java

@@ -7,27 +7,16 @@ import com.tourism.common.additional.config.ApplicationConfig;
 import com.tourism.common.additional.utils.MapConvertUtils;
 import com.tourism.common.additional.utils.StringUtils;
 import com.tourism.common.additional.utils.UrlConvertUtils;
-import com.tourism.common.core.annotation.MyRequestBody;
-import com.tourism.common.core.constant.ErrorCodeEnum;
 import com.tourism.common.core.object.*;
-import com.tourism.common.core.upload.BaseUpDownloader;
-import com.tourism.common.core.upload.UpDownloaderFactory;
-import com.tourism.common.core.upload.UploadResponseInfo;
-import com.tourism.common.core.upload.UploadStoreTypeEnum;
 import com.tourism.common.core.util.IpUtil;
 import com.tourism.common.core.util.MyModelUtil;
 import com.tourism.common.core.util.MyPageUtil;
 import com.tourism.webadmin.app.website.dto.TourismBookProjectDto;
 import com.tourism.webadmin.app.website.dto.TourismProjectToWebDto;
-import com.tourism.webadmin.app.website.service.CleanDataService;
 import com.tourism.webadmin.app.website.service.TourismProjectToWebService;
 import com.tourism.webadmin.app.website.vo.DateRange;
 import com.tourism.webadmin.app.website.vo.TourismProjectDatePriceVo;
 import com.tourism.webadmin.app.website.vo.WebSiteProjectDatePriceVo;
-import com.tourism.webadmin.back.dao.JobContentMapper;
-import com.tourism.webadmin.back.dao.TourTourismTravelNotesContentMapper;
-import com.tourism.webadmin.back.dao.TourismContentMapper;
-import com.tourism.webadmin.back.dto.MultipartFileDto;
 import com.tourism.webadmin.back.model.*;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.vo.TourismProjectVo;
@@ -39,20 +28,13 @@ import org.redisson.api.RBucket;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
 
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.ZoneId;
 import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
-import static java.util.stream.Collectors.toList;
-
 /**
  * 门户网站首页Service
  *
@@ -78,6 +60,8 @@ public class TourismProjectToWebServiceImpl implements TourismProjectToWebServic
     private DirectoryInfoService directoryInfoService;
     @Autowired
     private TourismFileService tourismFileService;
+    @Autowired
+    private TourProjectGroupPurchaseService tourProjectGroupPurchaseService;
 
 
     @Override
@@ -132,6 +116,15 @@ public class TourismProjectToWebServiceImpl implements TourismProjectToWebServic
         MyPageData<TourismProjectVo> tourismProjectVoMyPageData = MyPageUtil.makeResponseData(tourismProjectList, TourismProjectVo.class);
 
         List<TourismProjectVo> dataList = tourismProjectVoMyPageData.getDataList();
+
+        // 获取dataList里的项目id
+        List<Long> projectIdList = tourismProjectList.stream().map(TourismProject::getId).collect(Collectors.toList());
+        // 查询最低价格的团购
+        List<TourProjectGroupPurchase> lowestPriceGroupPurchase = tourProjectGroupPurchaseService.getLowestPriceGroupPurchase(projectIdList);
+        // 把项目和团购价格以project_id为key,以TourProjectGroupPurchase对象为value处理成map,便于后边匹配
+        Map<Long, TourProjectGroupPurchase> collect = lowestPriceGroupPurchase.stream().collect(Collectors.toMap(TourProjectGroupPurchase::getProjectId, item -> item, (v1, v2) -> v2));
+
+
         //先把imgUrl由jaon转换为List<FileUrlObject>
         dataList.stream().forEach(item ->{
             //遍历查询关联的tourismFile
@@ -153,7 +146,15 @@ public class TourismProjectToWebServiceImpl implements TourismProjectToWebServic
             item.setTourismUrlsAfterConvert(arrayList);
             List<String> arrayList1 = UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), item.getTravelNotesBanner());
             item.setTravelNotesBannerAfterConvert(arrayList1);
+
+            // 匹配团购信息
+            TourProjectGroupPurchase tourProjectGroupPurchase = collect.get(Long.valueOf(item.getId()));
+            if(tourProjectGroupPurchase != null) {
+                item.setLowestPrice(tourProjectGroupPurchase.getAdultPrice());
+                item.setGroupPeopleCount(tourProjectGroupPurchase.getMaxCount());
+            }
         });
+
         return tourismProjectVoMyPageData;
     }
 

+ 36 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/website/vo/TourGroupPurchaseUserVo.java

@@ -0,0 +1,36 @@
+package com.tourism.webadmin.app.website.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 门户用户管理实体对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Data
+public class TourGroupPurchaseUserVo {
+
+    /**
+     * 昵称。
+     */
+    @Schema(description = "昵称")
+    private String showName;
+
+    /**
+     * 用户头像的Url。
+     */
+    @Schema(description = "头像url")
+    private String headImageUrl;
+
+    /**
+     * 创建时间。
+     */
+    @Schema(description = "创建时间")
+    private Date createTime;
+
+    private String createTimeStr;
+}

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourProjectGroupPurchaseController.java

@@ -9,9 +9,8 @@ import com.tourism.common.core.upload.UploadStoreInfo;
 import com.tourism.common.log.annotation.OperationLog;
 import com.tourism.common.log.model.constant.SysOperationLogType;
 import com.github.pagehelper.page.PageMethod;
-import com.tourism.webadmin.back.vo.*;
+import com.tourism.webadmin.back.model.TourProjectGroupPurchase;
 import com.tourism.webadmin.back.dto.*;
-import com.tourism.webadmin.back.model.*;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.common.core.object.*;
 import com.tourism.common.core.util.*;
@@ -20,6 +19,7 @@ import com.tourism.common.core.annotation.MyRequestBody;
 import com.tourism.common.redis.cache.SessionCacheHelper;
 import com.tourism.common.additional.config.ApplicationConfig;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.tourism.webadmin.back.vo.TourProjectGroupPurchaseVo;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourProjectGroupPurchaseDetailController.java

@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import com.tourism.common.log.annotation.OperationLog;
 import com.tourism.common.log.model.constant.SysOperationLogType;
 import com.github.pagehelper.page.PageMethod;
+import com.tourism.webadmin.back.model.TourProjectGroupPurchase;
 import com.tourism.webadmin.back.vo.*;
 import com.tourism.webadmin.back.dto.*;
 import com.tourism.webadmin.back.model.*;

+ 8 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourOrderMapper.java

@@ -2,7 +2,9 @@ package com.tourism.webadmin.back.dao;
 
 import com.tourism.common.core.base.dao.BaseDaoMapper;
 import com.tourism.webadmin.back.model.TourOrder;
+import com.tourism.webadmin.back.model.TourUser;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.*;
 
@@ -30,4 +32,10 @@ public interface TourOrderMapper extends BaseDaoMapper<TourOrder> {
      */
     List<TourOrder> getTourOrderList(
             @Param("tourOrderFilter") TourOrder tourOrderFilter, @Param("orderBy") String orderBy);
+
+    //user_id in (select create_user_id from tour_order where project_id=#{projectId} and type = 1)
+    @Select("select tu.show_name,tu.head_image_url,to1.create_time from tour_user tu " +
+            "inner join tour_order to1 on tu.user_id = to1.create_user_id " +
+            "where to1.project_id = #{projectId} and to1.type = 1")
+    List<TourUser> getTourUserList(@Param("projectId") Long projectId);
 }

+ 1 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourProjectGroupPurchaseDetailMapper.java

@@ -4,6 +4,7 @@ import com.tourism.common.core.base.dao.BaseDaoMapper;
 import com.tourism.webadmin.back.model.TourProjectGroupPurchaseDetail;
 import com.tourism.webadmin.back.model.TourProjectGroupPurchase;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.*;
 

+ 22 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/TourProjectGroupPurchaseMapper.java

@@ -3,6 +3,7 @@ package com.tourism.webadmin.back.dao;
 import com.tourism.common.core.base.dao.BaseDaoMapper;
 import com.tourism.webadmin.back.model.TourProjectGroupPurchase;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.*;
 
@@ -30,4 +31,25 @@ public interface TourProjectGroupPurchaseMapper extends BaseDaoMapper<TourProjec
      */
     List<TourProjectGroupPurchase> getTourProjectGroupPurchaseList(
             @Param("tourProjectGroupPurchaseFilter") TourProjectGroupPurchase tourProjectGroupPurchaseFilter, @Param("orderBy") String orderBy);
+
+
+    /**
+     * 获取各个项目最低价格的团购
+     */
+    @Select({
+            "<script>",
+            "SELECT tpgp.* FROM tour_project_group_purchase AS tpgp ",
+            "LEFT JOIN tour_tourism_project AS ttp ON tpgp.project_id = ttp.id ",
+                "WHERE(tpgp.project_id, tpgp.adult_price) IN (",
+                "SELECT project_id, min(adult_price) FROM tour_project_group_purchase ",
+                "WHERE project_id IN",
+                "<foreach collection='projectIds' item='id' open='(' separator=',' close=')'>",
+                    "#{id}",
+                "</foreach>",
+                "AND end_time > #{endTime}",
+                "GROUP BY project_id)",
+            "</script>"
+    })
+    List<TourProjectGroupPurchase> getLowestPriceGroupPurchaseList(@Param("projectIds") List<Long> projectIds, @Param("endTime") Date endTime);
+
 }

+ 12 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourOrder.java

@@ -174,6 +174,18 @@ public class TourOrder extends BaseModel {
     private Integer dataState;
 
     /**
+     * 团购id
+     */
+    @TableField(value = "group_purchase_progress_id")
+    private Long groupPurchaseProgressId;
+
+    /**
+     * 订单的类型(0.普通订单;1.拼团的订单)
+     */
+    @TableField(value = "type")
+    private Integer type;
+
+    /**
      * departureDate 范围过滤起始值(>=)。
      */
     @TableField(exist = false)

+ 16 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourProjectGroupPurchase.java

@@ -11,6 +11,7 @@ import lombok.EqualsAndHashCode;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -222,6 +223,21 @@ public class TourProjectGroupPurchase extends BaseModel {
     @TableField(exist = false)
     private Map<String, Object> stateDictMap;
 
+
+
+    @RelationOneToMany(
+            masterIdField = "code",
+            slaveModelClass = TourProjectGroupPurchaseDetail.class,
+            slaveIdField = "groupPurchaseCode")
+    @TableField(exist = false)
+    private List<TourProjectGroupPurchase> tourProjectGroupPurchaseList;
+
+    /**
+     * 距离结束时间的天数。
+     */
+    @TableField(exist = false)
+    private String diffDaysToEnd;
+
     @RelationConstDict(
             masterIdField = "success",
             constantDictClass = Success.class)

+ 0 - 11
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourProjectGroupPurchaseDetail.java

@@ -110,15 +110,4 @@ public class TourProjectGroupPurchaseDetail extends BaseModel {
      */
     @TableField(exist = false)
     private Integer maxCountEnd;
-
-    /**
-     * TourProjectGroupPurchase 的一对多关联表数据对象。
-     * 通常在一对多的关联中,我们基于从表数据过滤主表数据,此时需要先对从表数据进行嵌套子查询过滤,并将从表过滤数据列表集成到该字段。
-     */
-    @RelationOneToMany(
-            masterIdField = "groupPurchaseCode",
-            slaveModelClass = TourProjectGroupPurchase.class,
-            slaveIdField = "code")
-    @TableField(exist = false)
-    private List<TourProjectGroupPurchase> tourProjectGroupPurchaseList;
 }

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourOrderService.java

@@ -65,4 +65,11 @@ public interface TourOrderService extends IBaseService<TourOrder, Long> {
      * @return 查询结果集。
      */
     List<TourOrder> getTourOrderListWithRelation(TourOrder filter, String orderBy);
+
+    /**
+     * 根据项目id查询该项目参与拼团的用户
+     * @param projectId
+     * @return
+     */
+    List<TourUser> getTourUserListByProjectId(Long projectId);
 }

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourProjectGroupPurchaseDetailService.java

@@ -76,4 +76,11 @@ public interface TourProjectGroupPurchaseDetailService extends IBaseService<Tour
      * @return 没有关联数据返回true,否则false,同时返回具体的提示信息。
      */
     CallResult verifyRelatedDataBeforeDelete(TourProjectGroupPurchaseDetail tourProjectGroupPurchaseDetail);
+
+    /**
+     * 查询团购当前阶梯价格
+     * @param tourProjectGroupPurchase
+     * @return
+     */
+    TourProjectGroupPurchaseDetail getTourProjectGroupPurchaseDetail(TourProjectGroupPurchase tourProjectGroupPurchase);
 }

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourProjectGroupPurchaseService.java

@@ -75,4 +75,11 @@ public interface TourProjectGroupPurchaseService extends IBaseService<TourProjec
      * @return 没有关联数据返回true,否则false,同时返回具体的提示信息。
      */
     CallResult verifyRelatedDataBeforeDelete(TourProjectGroupPurchase tourProjectGroupPurchase);
+
+    /**
+     * 获取某项目最低价格的团购
+     * @param projectIds
+     * @return
+     */
+    List<TourProjectGroupPurchase> getLowestPriceGroupPurchase(List<Long> projectIds);
 }

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/TourismDatePriceService.java

@@ -65,4 +65,11 @@ public interface TourismDatePriceService extends IBaseService<TourismDatePrice,
      * @return 查询结果集。
      */
     List<TourismDatePrice> getTourismDatePriceListWithRelation(TourismDatePrice filter, String orderBy);
+
+    /**
+     * 查询某天日历价格
+     * @param tourismDatePrice
+     * @return
+     */
+    TourismDatePrice getOneTourismDatePrice(TourismDatePrice tourismDatePrice);
 }

+ 6 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourOrderServiceImpl.java

@@ -1,6 +1,7 @@
 package com.tourism.webadmin.back.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.dao.*;
@@ -123,6 +124,11 @@ public class TourOrderServiceImpl extends BaseService<TourOrder, Long> implement
         return CallResult.ok();
     }
 
+    @Override
+    public List<TourUser> getTourUserListByProjectId(Long projectId) {
+        return tourOrderMapper.getTourUserList(projectId);
+    }
+
     private TourOrder buildDefaultValue(TourOrder tourOrder) {
         if (tourOrder.getId() == null) {
             tourOrder.setId(idGenerator.nextLongId());

+ 11 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourProjectGroupPurchaseDetailServiceImpl.java

@@ -1,12 +1,11 @@
 package com.tourism.webadmin.back.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.dao.*;
 import com.tourism.webadmin.back.model.*;
-import com.tourism.webadmin.config.DataSourceType;
-import com.tourism.common.core.annotation.MyDataSource;
 import com.tourism.common.core.base.dao.BaseDaoMapper;
 import com.tourism.common.core.constant.GlobalDeletedFlag;
 import com.tourism.common.core.object.MyRelationParam;
@@ -118,6 +117,16 @@ public class TourProjectGroupPurchaseDetailServiceImpl extends BaseService<TourP
         return CallResult.ok();
     }
 
+    @Override
+    public TourProjectGroupPurchaseDetail getTourProjectGroupPurchaseDetail(TourProjectGroupPurchase entity) {
+        LambdaQueryWrapper<TourProjectGroupPurchaseDetail> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.ge(TourProjectGroupPurchaseDetail::getMinCount, entity.getNowCount());
+        queryWrapper.le(TourProjectGroupPurchaseDetail::getMaxCount, entity.getNowCount());
+        queryWrapper.eq(TourProjectGroupPurchaseDetail::getGroupPurchaseCode, entity.getCode());
+
+        return tourProjectGroupPurchaseDetailMapper.selectOne(queryWrapper);
+    }
+
     private TourProjectGroupPurchaseDetail buildDefaultValue(TourProjectGroupPurchaseDetail tourProjectGroupPurchaseDetail) {
         if (tourProjectGroupPurchaseDetail.getId() == null) {
             tourProjectGroupPurchaseDetail.setId(idGenerator.nextLongId());

+ 6 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourProjectGroupPurchaseServiceImpl.java

@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.dao.*;
 import com.tourism.webadmin.back.model.*;
-import com.tourism.webadmin.config.DataSourceType;
-import com.tourism.common.core.annotation.MyDataSource;
 import com.tourism.common.core.base.dao.BaseDaoMapper;
 import com.tourism.common.core.constant.GlobalDeletedFlag;
 import com.tourism.common.core.object.MyRelationParam;
@@ -124,6 +122,12 @@ public class TourProjectGroupPurchaseServiceImpl extends BaseService<TourProject
         return CallResult.ok();
     }
 
+    @Override
+    public List<TourProjectGroupPurchase> getLowestPriceGroupPurchase(List<Long> projectIds) {
+        Date endTime = new Date();
+        return tourProjectGroupPurchaseMapper.getLowestPriceGroupPurchaseList(projectIds, endTime);
+    }
+
     private TourProjectGroupPurchase buildDefaultValue(TourProjectGroupPurchase tourProjectGroupPurchase) {
         if (tourProjectGroupPurchase.getId() == null) {
             tourProjectGroupPurchase.setId(idGenerator.nextLongId());

+ 13 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourismDatePriceServiceImpl.java

@@ -1,6 +1,7 @@
 package com.tourism.webadmin.back.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.tourism.webadmin.back.service.*;
 import com.tourism.webadmin.back.dao.*;
@@ -106,6 +107,18 @@ public class TourismDatePriceServiceImpl extends BaseService<TourismDatePrice, S
         return CallResult.ok();
     }
 
+    @Override
+    public TourismDatePrice getOneTourismDatePrice(TourismDatePrice tourismDatePrice) {
+        LambdaQueryWrapper<TourismDatePrice> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TourismDatePrice::getProjectId, tourismDatePrice.getProjectId());
+        queryWrapper.eq(TourismDatePrice::getDepartureDate, tourismDatePrice.getDepartureDate());
+        TourismDatePrice one = tourismDatePriceMapper.selectOne(queryWrapper);
+        if (one != null) {
+            return one;
+        }
+        return null;
+    }
+
     private TourismDatePrice buildDefaultValue(TourismDatePrice tourismDatePrice) {
         if (tourismDatePrice.getId() == null) {
             tourismDatePrice.setId(idGenerator.nextStringId());

+ 0 - 6
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourProjectGroupPurchaseDetailVo.java

@@ -55,10 +55,4 @@ public class TourProjectGroupPurchaseDetailVo extends BaseVo {
      */
     @Schema(description = "阶梯的人数(上限)")
     private Integer maxCount;
-
-    /**
-     * TourProjectGroupPurchase 的一对多关联表数据对象。数据对应类型为TourProjectGroupPurchase。
-     */
-    @Schema(description = "TourProjectGroupPurchase 的一对多关联表数据对象。数据对应类型为TourProjectGroupPurchase")
-    private List<Map<String, Object>> tourProjectGroupPurchaseList;
 }

+ 20 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourProjectGroupPurchaseVo.java

@@ -1,5 +1,6 @@
 package com.tourism.webadmin.back.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.tourism.common.core.base.vo.BaseVo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
@@ -30,7 +31,7 @@ public class TourProjectGroupPurchaseVo extends BaseVo {
      * 项目id。
      */
     @Schema(description = "项目id")
-    private Long projectId;
+    private String projectId;
 
     /**
      * 拼团结束时间。
@@ -135,8 +136,26 @@ public class TourProjectGroupPurchaseVo extends BaseVo {
     private Map<String, Object> stateDictMap;
 
     /**
+     * 距离结束时间的天数。
+     */
+    @Schema(description = "距离结束时间的天数")
+    private String diffDaysToEnd;
+
+    /**
      * success 常量字典关联数据。
      */
     @Schema(description = "success 常量字典关联数据")
     private Map<String, Object> successDictMap;
+
+    /**
+     * 当前价格
+     */
+    @Schema(description = "当前价格")
+    private BigDecimal nowPrice;
+
+    /**
+     * 原价
+     */
+    @Schema(description = "原价")
+    private BigDecimal originalPrice;
 }

+ 11 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourismProjectVo.java

@@ -266,5 +266,16 @@ public class TourismProjectVo extends BaseVo {
     @Schema(description = "fileUrl旅游项目图集转换后的图片对象")
     private List<String> fileUrlList;
 
+    /**
+     * 团购人数
+     */
+    @Schema(description = "团购人数")
+    private Integer groupPeopleCount;
+
+    /**
+     * 最低价格
+     */
+    @Schema(description = "最低价格")
+    private BigDecimal lowestPrice;
 
 }

+ 77 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/WebsiteProjectGroupPurchaseVo.java

@@ -0,0 +1,77 @@
+package com.tourism.webadmin.back.vo;
+
+import com.tourism.common.core.base.vo.BaseVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 拼团设置主表VO视图对象。
+ *
+ * @author 吃饭睡觉
+ * @date 2024-09-06
+ */
+@Schema(description = "拼团设置主表VO视图对象")
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WebsiteProjectGroupPurchaseVo extends BaseVo {
+
+    /**
+     * 主键id。
+     */
+    @Schema(description = "主键id")
+    private String id;
+
+    /**
+     * 项目id。
+     */
+    @Schema(description = "项目id")
+    private String projectId;
+
+    /**
+     * 拼团结束时间。
+     */
+    @Schema(description = "拼团结束时间")
+    private Date endTime;
+
+    /**
+     * 拼团人数上限。
+     */
+    @Schema(description = "拼团人数上限")
+    private Integer maxCount;
+
+    /**
+     * 成人价格。
+     */
+    @Schema(description = "成人价格")
+    private BigDecimal adultPrice;
+
+    /**
+     * 显示顺序。
+     */
+    @Schema(description = "显示顺序")
+    private Integer showOrder;
+
+    /**
+     * projectId 字典关联数据。
+     */
+    @Schema(description = "projectId 字典关联数据")
+    private Map<String, Object> projectIdDictMap;
+
+    /**
+     * 距离截止时间,汉字
+     */
+    @Schema(description = "距离截止时间")
+    private String distanceToDeadline;
+
+    /**
+     * 当前参与的拼团人数
+     */
+    @Schema(description = "当前参与的拼团人数")
+    private Integer nowCount;
+}

+ 2 - 0
common/common-core/src/main/java/com/tourism/common/core/constant/ErrorCodeEnum.java

@@ -93,6 +93,8 @@ public enum ErrorCodeEnum {
     TOUR_ORDER_STATUS_NOT_ALLOW("请与平台负责人确认后,由后台客服进行删除。"),
     TOUR_ORDER_DRIVER_ALREADY_INORDER("司机已经被占用,请刷新页面重新下单!"),
 
+    MISS_PROJECT_ID("缺少必填参数【groupPurchaseCode】"),
+
     ;
     // 下面的枚举值为特定枚举值,即开发者可以根据自己的项目需求定义更多的非通用枚举值
 

+ 26 - 0
common/common-core/src/main/java/com/tourism/common/core/util/MyDateUtil.java

@@ -7,6 +7,8 @@ import org.joda.time.Period;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
 
+import java.time.LocalDate;
+import java.time.temporal.ChronoUnit;
 import java.util.Calendar;
 import java.util.Date;
 
@@ -317,6 +319,30 @@ public class MyDateUtil {
     }
 
     /**
+     * 比对某一条数据的时间与当前时间的天数差
+     * @param date 数据的时间(LocalDate 格式)
+     * @return 返回与今天的相对天数(今天返回 1,明天返回 2,后天返回 3,以此类推)
+     */
+    public static int calculateRelativeDays(LocalDate date) {
+        if (date == null) {
+            throw new IllegalArgumentException("The provided date cannot be null");
+        }
+
+        // 获取当前日期
+        LocalDate today = LocalDate.now();
+
+        // 计算天数差
+        long daysDifference = ChronoUnit.DAYS.between(today, date);
+
+        // 如果日期是今天或未来,则返回相对天数
+        if (daysDifference >= 0) {
+            return (int) daysDifference + 1;
+        } else {
+            throw new IllegalArgumentException("The provided date is in the past");
+        }
+    }
+
+    /**
      * 私有构造函数,明确标识该常量类的作用。
      */
     private MyDateUtil() {

+ 70 - 0
common/common-core/src/main/java/com/tourism/common/core/util/NumberToChineseConverter.java

@@ -0,0 +1,70 @@
+package com.tourism.common.core.util;
+
+public class NumberToChineseConverter {
+
+    // 中文数字字符数组
+    private static final String[] CHINESE_DIGITS = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
+    private static final String[] CHINESE_UNITS = {"", "十", "百", "千"};
+    private static final String[] CHINESE_BIG_UNITS = {"", "万", "亿", "兆"};
+
+    /**
+     * 将阿拉伯数字转换为汉字
+     * @param number 输入的阿拉伯数字
+     * @return 转换后的汉字字符串
+     */
+    public static String convertToChinese(int number) {
+        if (number == 0) {
+            return "零";
+        }
+        if (number < 0) {
+            return "负" + convertToChinese(-number);
+        }
+
+        StringBuilder result = new StringBuilder();
+        String numStr = String.valueOf(number);
+        int length = numStr.length();
+
+        // 分组:每四位一组
+        int groupIndex = 0;
+        while (length > 0) {
+            int start = Math.max(length - 4, 0);
+            String group = numStr.substring(start, length);
+            String groupChinese = convertGroupToChinese(Integer.parseInt(group));
+            if (!groupChinese.isEmpty()) {
+                result.insert(0, groupChinese + CHINESE_BIG_UNITS[groupIndex]);
+            }
+            length -= 4;
+            groupIndex++;
+        }
+
+        return result.toString().replaceAll("零+$", ""); // 去除尾部多余的零
+    }
+
+    /**
+     * 将四位以内的数字转换为汉字
+     * @param number 四位以内的数字
+     * @return 转换后的汉字字符串
+     */
+    private static String convertGroupToChinese(int number) {
+        StringBuilder result = new StringBuilder();
+        String numStr = String.valueOf(number);
+        int length = numStr.length();
+        boolean hasZero = false;
+
+        for (int i = 0; i < length; i++) {
+            int digit = numStr.charAt(i) - '0';
+            if (digit == 0) {
+                hasZero = true;
+            } else {
+                if (hasZero) {
+                    result.append("零");
+                    hasZero = false;
+                }
+                result.append(CHINESE_DIGITS[digit]).append(CHINESE_UNITS[length - 1 - i]);
+            }
+        }
+
+        return result.toString().replaceAll("零+$", ""); // 去除尾部多余的零
+    }
+}
+