Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-order/pom.xml
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("发放优惠券-选择人员列表DTO") |
| | | public class ChoiceUserListQueryDto extends BasePage { |
| | | @ApiModelProperty(value = "用户手机号") |
| | | String userPhone; |
| | | @ApiModelProperty(value = "市code") |
| | | String cityCode; |
| | | @ApiModelProperty(value = "省code") |
| | | String provinceCode; |
| | | @ApiModelProperty(value = "用户标签ids 多个逗号分隔") |
| | | String userTagId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("管理后台发放优惠券DTO") |
| | | public class GrantCouponDto { |
| | | @ApiModelProperty("用户ids 逗号分隔") |
| | | private String userIds; |
| | | @ApiModelProperty("优惠券id") |
| | | private Integer couponId; |
| | | @ApiModelProperty("发放方式 1积分 2现金") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty("结束时间 前端忽略") |
| | | private LocalDateTime endTime; |
| | | } |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserListQueryDto extends BasePage { |
| | | private String userPhone; |
| | | private String cityCode; |
| | | private Integer status; |
| | | private Integer userTagId; |
| | | private Integer vipTypeId; |
| | | private Integer companyId; |
| | | @ApiModelProperty(value = "用户手机号") |
| | | String userPhone; |
| | | @ApiModelProperty(value = "所在地code") |
| | | String cityCode; |
| | | @ApiModelProperty(value = "状态 1正常2冻结 3注销") |
| | | Integer status; |
| | | @ApiModelProperty(value = "用户标签id") |
| | | Integer userTagId; |
| | | @ApiModelProperty(value = "会员类型id") |
| | | Integer vipTypeId; |
| | | @ApiModelProperty(value = "单位id") |
| | | Integer companyId; |
| | | } |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 门店服务降级处理 |
| | |
| | | public AppUserClient create(Throwable throwable) { |
| | | log.error("账户服务调用失败:{}", throwable.getMessage()); |
| | | return new AppUserClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<List<Long>> getUserIdsByPhone(String phone) { |
| | | return R.fail("根据手机号查询用户ids失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.account.api.factory.AppCouponFallbackFactory; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/t-app-coupon/getUseCountByCouponId") |
| | | public R<Integer> getUseCountByCouponId(Integer couponId); |
| | | /** |
| | | * 后台远程调用 根据优惠券id 查询领取记录 |
| | | * @param couponId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-coupon/getExchangeRecordByCouponId") |
| | | R<PageInfo<ExchangeRecordVO>> getExchangeRecordByCouponId(@RequestBody ExchangeRecordGoodsQuery couponId); |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户服务 |
| | |
| | | */ |
| | | @FeignClient(contextId = "AppUserClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppUserFallbackFactory.class) |
| | | public interface AppUserClient { |
| | | |
| | | @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"}) |
| | | @PostMapping(value = "/t-app-user/user/getUserIdsByPhone") |
| | | public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone); |
| | | |
| | | } |
| | |
| | | @ApiModel("管理后台 优惠券兑换记录列表返回VO") |
| | | public class ExchangeRecordVO { |
| | | @ApiModelProperty(value = "获得时间") |
| | | private String createTime; |
| | | private String createTime1; |
| | | @ApiModelProperty(value = "获得时间 前端忽略") |
| | | private LocalDateTime createTime; |
| | | @ApiModelProperty(value = "获得用户") |
| | | private String phone; |
| | | @ApiModelProperty(value = "优惠金额") |
| | |
| | | private String orderId; |
| | | @ApiModelProperty(value = " 前端忽略 获取方式 1=积分兑换 2现金购买") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty(value = " 是否删除0否1是") |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Integer couponId; |
| | | @ApiModelProperty(value = " 是否删除0否1是 前端忽略") |
| | | private Integer delFlag; |
| | | @ApiModelProperty(value = "三方支付流水号 前端忽略") |
| | | private String serialNumber; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | |
| | | public ChargingPileClient create(Throwable throwable) { |
| | | log.error("充电桩调用失败:{}", throwable.getMessage()); |
| | | return new ChargingPileClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id获取充电桩列表失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ChargingPileFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电桩服务 |
| | |
| | | @FeignClient(contextId = "ChargingPileClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = ChargingPileFallbackFactory.class) |
| | | public interface ChargingPileClient { |
| | | |
| | | /** |
| | | * 管理后台-通过站点id获取充电桩列表 不分页 |
| | | */ |
| | | @ApiOperation(value = "管理后台-通过站点id获取充电桩列表 不分页") |
| | | @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId") |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<List<Integer>> getSalesCountByGoodsId(String goodsIds) { |
| | | return null; |
| | | return R.fail("根据商品订单ids查询销量:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<String>> getCodeByOrderId(String goodsIds) { |
| | | return R.fail("根据订单ids查询现金购买优惠券订单编号:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { |
| | | return R.fail("查询活动费用统计失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @PostMapping("/t-exchange-order/getSalesCountByGoodsIds") |
| | | R<List<Integer>> getSalesCountByGoodsId(String goodsIds); |
| | | |
| | | /** |
| | | * 管理后台 根据t_app_coupon订单购买或者兑换优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-exchange-order/getCodeByOrderId") |
| | | public R<List<String>> getCodeByOrderId(String goodsIds); |
| | | /** |
| | | * 管理后台 活动费用统计 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-exchange-order/activityStatistics") |
| | | public R<TActivityVO> activityStatistics(@RequestBody TActivityStatisticsQuery dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_grant_vip") |
| | | @ApiModel(value="TGrantVip对象", description="") |
| | | public class TGrantVip extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "购买的会员id") |
| | | @TableField("vip_id") |
| | | private Integer vipId; |
| | | @ApiModelProperty(value = "购买的会员id") |
| | | @TableField("vip_id") |
| | | private BigDecimal orderAmount; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "管理后台-活动费用统计Query") |
| | | public class TActivityStatisticsQuery extends BasePage { |
| | | @ApiModelProperty(value = "用户电话") |
| | | private String phone; |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String code; |
| | | @ApiModelProperty(value = "参与类型1优惠券 2会员抵扣 3会员活动 4赠送会员") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "订单类型1充电订单 2商品订单 3会员订单 4赠送会员") |
| | | private Integer orderType; |
| | | @ApiModelProperty(value = "电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty(value = "消费时间开始(2020-01-02 00:00)") |
| | | private String startTime; |
| | | @ApiModelProperty(value = "消费时间结束(2020-01-02 00:00)") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | @ApiModelProperty(value = "充电桩ids 前端忽略") |
| | | private List<Integer> chargingPileIds; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.ser.Serializers; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.order.api.model.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "管理后台活动费用统计分页列表", description = "管理后台活动费用统计分页列表") |
| | | public class TActivityStatisticslVO extends BasePojo { |
| | | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "参与类型 优惠券 会员抵扣 会员活动 赠送会员") |
| | | private String type; |
| | | |
| | | @ApiModelProperty(value = "订单类型 充电订单 商品订单 会员订单 赠送会员") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String code; |
| | | @ApiModelProperty(value = "应付/价值") |
| | | private BigDecimal orderAmount; |
| | | @ApiModelProperty(value = "优惠券抵扣") |
| | | private BigDecimal couponDiscountAmount; |
| | | @ApiModelProperty(value = "会员抵扣") |
| | | private BigDecimal vipDiscountAmount; |
| | | @ApiModelProperty(value = "实付") |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private String time; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal total; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal coupon; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal vipActivity; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal grantVip; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOrderAppealVO对象", description = "订单申诉VO对象") |
| | | public class TActivityVO { |
| | | @ApiModelProperty(value = "分页列表") |
| | | private PageInfo<TActivityStatisticslVO> list; |
| | | @ApiModelProperty(value = "优惠总额") |
| | | private BigDecimal total; |
| | | @ApiModelProperty(value = "优惠券总额") |
| | | private BigDecimal coupon; |
| | | @ApiModelProperty(value = "会员抵扣总额") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "会员活动") |
| | | private BigDecimal vipActivity; |
| | | @ApiModelProperty(value = "赠送会员") |
| | | private BigDecimal grantVip; |
| | | |
| | | } |
| | |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.account.api.dto.GrantCouponDto; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/getExchangeRecordByCouponId") |
| | | public R<PageInfo<ExchangeRecordVO>> getUseCountByCouponId(ExchangeRecordGoodsQuery couponId){ |
| | | public R<PageInfo<ExchangeRecordVO>> getExchangeRecordByCouponId(@RequestBody ExchangeRecordGoodsQuery couponId){ |
| | | return R.ok(tAppCouponService.pagelist(couponId)); |
| | | } |
| | | |
| | | /** |
| | | * 后台远程调用 给用户发放优惠券 |
| | | */ |
| | | @PostMapping("/grantCoupon") |
| | | public R getExchangeRecordByCouponId(@RequestBody GrantCouponDto dto){ |
| | | List<TAppCoupon> res = new ArrayList<>(); |
| | | for (String s : dto.getUserIds().split(",")) { |
| | | TAppCoupon tAppCoupon = new TAppCoupon(); |
| | | tAppCoupon.setAppUserId(Long.valueOf(s)); |
| | | tAppCoupon.setCouponId(dto.getCouponId()); |
| | | tAppCoupon.setEndTime(dto.getEndTime()); |
| | | tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); |
| | | tAppCoupon.setStatus(1); |
| | | res.add(tAppCoupon); |
| | | } |
| | | tAppCouponService.saveBatch(res); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.*; |
| | |
| | | |
| | | @Resource |
| | | private ExchangeOrderClient exchangeOrderClient; |
| | | |
| | | @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"}) |
| | | @PostMapping(value = "/user/getUserIdsByPhone") |
| | | public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone) { |
| | | |
| | | return R.ok(appUserService.list(new QueryWrapper<TAppUser>().like("phone",phone)).stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | } |
| | | @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/page") |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券发放-选择人员") |
| | | @PostMapping("/choiceUser") |
| | | public R<Page<TAppUser>> choiceUser(@RequestBody ChoiceUserListQueryDto userListQueryDto) { |
| | | List<Long> userIds = new ArrayList<>(); |
| | | //如果要筛选标签。用标签获取useids |
| | | if (userListQueryDto.getUserTagId() != null){ |
| | | String[] split = userListQueryDto.getUserTagId().split(","); |
| | | userIds = appUserTagService.lambdaQuery().in(TAppUserTag::getUserTagId, Arrays.asList(split)).list().stream().map(TAppUserTag::getAppUserId).collect(Collectors.toList()); |
| | | } |
| | | //列表查询 |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .in(!userIds.isEmpty(),TAppUser::getId,userIds) |
| | | .eq(TAppUser::getStatus,1) |
| | | .page(Page.of(userListQueryDto.getPageCurr(), userListQueryDto.getPageSize())); |
| | | if (page.getRecords().isEmpty()){ |
| | | return R.ok(page); |
| | | } |
| | | List<Integer> vipIds = new ArrayList<>(); |
| | | vipIds = page.getRecords().stream().map(TAppUser::getVipId).collect(Collectors.toList()); |
| | | //获取会员map |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(vipIds); |
| | | //循环处理 |
| | | for (TAppUser appUser : page.getRecords()) { |
| | | //拿到最新的tagId |
| | | TAppUserTag one = appUserTagService.lambdaQuery().eq(TAppUserTag::getAppUserId, appUser.getId()).orderByDesc(TAppUserTag::getCreateTime).last("limit 1").one(); |
| | | //设置最新的tagName |
| | | R<TUserTag> byIdTag = otherClient.getByIdTag(one.getUserTagId()); |
| | | if (byIdTag.getData()!=null) { |
| | | appUser.setTagName(byIdTag.getData().getName()); |
| | | } |
| | | //匹配vipMap的值 |
| | | appUser.setVipName(vipMap.getData().get(appUser.getVipId())); |
| | | //累计充电次数 |
| | | R<Long> useOrderCount = chargingOrderClient.useOrderCount(appUser.getId()); |
| | | appUser.setOrderCount(useOrderCount.getData()); |
| | | |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户添加编辑", tags = {"用户管理-用户列表"}) |
| | |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | @Service |
| | | public class TAppCouponServiceImpl extends ServiceImpl<TAppCouponMapper, TAppCoupon> implements TAppCouponService { |
| | | |
| | | @Autowired |
| | | private OrderClient orderClient; |
| | | @Override |
| | | public PageInfo<ExchangeRecordVO> pagelist(ExchangeRecordGoodsQuery dto) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | PageInfo<ExchangeRecordVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ExchangeRecordVO> list = this.baseMapper.pageList(pageInfo,dto); |
| | | // 现金优惠券 |
| | | // 订单ids |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | // 积分优惠券 |
| | | StringBuilder stringBuilder1 = new StringBuilder(); |
| | | |
| | | for (ExchangeRecordVO exchangeRecordVO : list) { |
| | | switch (exchangeRecordVO.getWaysToObtain()){ |
| | | case 1: |
| | | if (exchangeRecordVO.getSerialNumber()!=null){ |
| | | stringBuilder.append(exchangeRecordVO.getSerialNumber()).append(","); |
| | | if (exchangeRecordVO.getOrderId()!=null){ |
| | | stringBuilder.append(exchangeRecordVO.getOrderId()).append(","); |
| | | }else{ |
| | | stringBuilder.append("0").append(","); |
| | | } |
| | | break; |
| | | case 2: |
| | | if (exchangeRecordVO.getSerialNumber()!=null){ |
| | | stringBuilder1.append(exchangeRecordVO.getSerialNumber()).append(","); |
| | | if (exchangeRecordVO.getOrderId()!=null){ |
| | | stringBuilder.append("-").append(exchangeRecordVO.getOrderId()).append(","); |
| | | }else{ |
| | | stringBuilder1.append("0").append(","); |
| | | stringBuilder.append("-").append("0").append(","); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | Date date = DateUtils.toDate(exchangeRecordVO.getEndTime()); |
| | | Date date1 = DateUtils.toDate(exchangeRecordVO.getCreateTime()); |
| | | exchangeRecordVO.setEndTime1(format.format(date)); |
| | | exchangeRecordVO.setCreateTime1(format.format(date1)); |
| | | if (exchangeRecordVO.getStatus()==1){ |
| | | if (exchangeRecordVO.getDelFlag() == 1){ |
| | | // 删除了 就是已取消状态 |
| | |
| | | exchangeRecordVO.setStatus(2); |
| | | } |
| | | } |
| | | // 根据购买方式 查询对应订单号 |
| | | } |
| | | |
| | | // 去除最后一个字符 |
| | | if (StringUtils.hasText(stringBuilder.toString())){ |
| | | String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); |
| | | // 远程调用 查询关联的现金优惠券订单编号 |
| | | // 远程调用 查询关联的订单编号 |
| | | List<String> data = orderClient.getCodeByOrderId(string).getData(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setOrderId(data.get(i)); |
| | | } |
| | | } |
| | | if (StringUtils.hasText(stringBuilder.toString())){ |
| | | String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); |
| | | // 远程调用 查询关联的积分兑换优惠券订单编号 |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getSiteList1") |
| | | @ApiOperation(value = "获取站点列表 不分页", tags = {"管理后台-活动费用统计"}) |
| | | public AjaxResult<List<Site>> getSiteList1(){ |
| | | return AjaxResult.success(siteService.list(new QueryWrapper<>())); |
| | | } |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理"}) |
| | | @PostMapping("/pageList") |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | |
| | | return AjaxResult.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | /** |
| | | * 管理后台-通过站点id获取充电桩列表 不分页 |
| | | */ |
| | | @ApiOperation(value = "管理后台-通过站点id获取充电桩列表 不分页") |
| | | @PostMapping(value = "/getChargingPileBySiteId") |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId) { |
| | | return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- ruoyi-modules-other-api --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!-- ruoyi-modules-chargingPile-api --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TExchangeOrderService; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.order.service.impl.TChargingOrderServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TShoppingOrderService tShoppingOrderService; |
| | | @Autowired |
| | | private TExchangeOrderService exchangeOrderService; |
| | | @Autowired |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TVipOrderService vipOrderService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private ChargingPileClient chargingPileClient; |
| | | /** |
| | | * 管理后台 活动费用统计 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/activityStatistics") |
| | | public R<TActivityVO> activityStatistics(@RequestBody TActivityStatisticsQuery dto) { |
| | | if (StringUtils.hasLength(dto.getPhone())){ |
| | | // 远程调用查询出符合条件的用户ids |
| | | List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData(); |
| | | dto.setUserIds(data); |
| | | } |
| | | if (dto.getSiteId()!=null){ |
| | | // 远程调用查询出符合条件的充电桩ids |
| | | List<TChargingPile> data = chargingPileClient.getChargingPileBySiteId(dto.getSiteId()).getData(); |
| | | dto.setChargingPileIds(data.stream().map(TChargingPile::getId).collect(Collectors.toList())); |
| | | } |
| | | return R.ok(tShoppingOrderService.activityStatistics(dto)); |
| | | } |
| | | |
| | | //订单详情 |
| | | @PostMapping(value = "/detail") |
| | |
| | | return R.ok(res); |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon流水号查询现金优惠券的订单编号 |
| | | * 管理后台 根据t_app_coupon订单ids查询优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCodeBySerialNumber") |
| | | public R<List<String>> getCodeBySerialNumber(String goodsIds){ |
| | | @PostMapping("/getCodeByOrderId") |
| | | public R<List<String>> getCodeByOrderId(String goodsIds){ |
| | | String[] split = goodsIds.split("-"); |
| | | List<String> strings = new ArrayList<>(); |
| | | for (String s : split) { |
| | | TShoppingOrder one = tShoppingOrderService.getOne(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type", 2) |
| | | .eq("serial_number", s)); |
| | | if (one != null){ |
| | | strings.add(one.getCode()); |
| | | if (s.contains("-")){ |
| | | // 带有负号的是积分兑换的订单 |
| | | TExchangeOrder one = exchangeOrderService.getOne(new QueryWrapper<TExchangeOrder>() |
| | | .eq("order_type", 2) |
| | | .eq("id", s.replace("-",""))); |
| | | if (one != null){ |
| | | strings.add(one.getCode()); |
| | | }else{ |
| | | strings.add(""); |
| | | } |
| | | }else{ |
| | | strings.add(""); |
| | | TShoppingOrder one = tShoppingOrderService.getOne(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type", 2) |
| | | .eq("id", s)); |
| | | if (one != null){ |
| | | strings.add(one.getCode()); |
| | | }else{ |
| | | strings.add(""); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return R.ok(strings); |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon流水号查询积分兑换优惠券的订单编号 |
| | | * 管理后台 根据t_app_coupon订单ids查询积分兑换优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCodeBySerialNumberIntegral") |
| | | public R<List<String>> getCodeBySerialNumberIntegral(String goodsIds){ |
| | | String[] split = goodsIds.split("-"); |
| | | List<String> strings = new ArrayList<>(); |
| | | for (String s : split) { |
| | | TExchangeOrder one = exchangeOrderService.getOne(new QueryWrapper<TExchangeOrder |
| | | >() |
| | | .eq("order_type", 2) |
| | | .eq("serial_number", s)); |
| | | if (one != null){ |
| | | strings.add(one.getCode()); |
| | | }else{ |
| | | strings.add(""); |
| | | } |
| | | } |
| | | |
| | | return R.ok(strings); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Mapper |
| | | public interface TGrantVipMapper extends BaseMapper<TGrantVip> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface TShoppingOrderMapper extends BaseMapper<TShoppingOrder> { |
| | | |
| | | List<TActivityStatisticslVO> activityStatistics(@Param("pageInfo") PageInfo<TActivityStatisticslVO> pageInfo, @Param("req")TActivityStatisticsQuery dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | public interface TGrantVipService extends IService<TGrantVip> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TShoppingOrderService extends IService<TShoppingOrder> { |
| | | |
| | | TActivityVO activityStatistics(TActivityStatisticsQuery dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.mapper.TGrantVipMapper; |
| | | import com.ruoyi.order.mapper.TVipOrderMapper; |
| | | import com.ruoyi.order.service.TGrantVipService; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Service |
| | | public class TGrantVipServiceImpl extends ServiceImpl<TGrantVipMapper, TGrantVip> implements TGrantVipService { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import com.ruoyi.order.mapper.TShoppingOrderMapper; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TShoppingOrderServiceImpl extends ServiceImpl<TShoppingOrderMapper, TShoppingOrder> implements TShoppingOrderService { |
| | | |
| | | @Override |
| | | public TActivityVO activityStatistics(TActivityStatisticsQuery dto) { |
| | | TActivityVO res = new TActivityVO(); |
| | | |
| | | |
| | | |
| | | PageInfo<TActivityStatisticslVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<TActivityStatisticslVO> list = this.baseMapper.activityStatistics(pageInfo,dto); |
| | | list.sort((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())); |
| | | // 优惠券金额 |
| | | BigDecimal coupon = new BigDecimal("0"); |
| | | // 会员抵扣金额 |
| | | BigDecimal discount = new BigDecimal("0"); |
| | | // 会员活动金额 |
| | | BigDecimal vipActivity = new BigDecimal("0"); |
| | | // 赠送会员 |
| | | BigDecimal grantVip = new BigDecimal("0"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | for (TActivityStatisticslVO tActivityStatisticslVO : list) { |
| | | // 判断享有了哪些类型 |
| | | switch (tActivityStatisticslVO.getOrderType()){ |
| | | case 1: |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | |
| | | // 充电订单 优惠券金额大于0 |
| | | if (tActivityStatisticslVO.getCouponDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | coupon = coupon.add(tActivityStatisticslVO.getCouponDiscountAmount()); |
| | | stringBuilder.append("优惠券抵扣").append("+"); |
| | | } |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | discount = discount.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | stringBuilder.append("会员抵扣").append("+"); |
| | | } |
| | | stringBuilder.deleteCharAt(stringBuilder.length()-1); |
| | | tActivityStatisticslVO.setType(stringBuilder.toString()); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | break; |
| | | case 2: |
| | | StringBuilder stringBuilder1 = new StringBuilder(); |
| | | |
| | | // 购物订单 优惠券金额大于0 |
| | | if (tActivityStatisticslVO.getCouponDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | coupon = coupon.add(tActivityStatisticslVO.getCouponDiscountAmount()); |
| | | stringBuilder1.append("优惠券抵扣").append("+"); |
| | | } |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | discount = discount.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | stringBuilder1.append("会员抵扣").append("+"); |
| | | } |
| | | stringBuilder1.deleteCharAt(stringBuilder1.length()-1); |
| | | tActivityStatisticslVO.setType(stringBuilder1.toString()); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | break; |
| | | case 3: |
| | | // 会员订单 优惠金额大于0 |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | vipActivity = vipActivity.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | } |
| | | tActivityStatisticslVO.setType("会员活动"); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | break; |
| | | case 4: |
| | | // 赠送会员订单 如果支付金额为0 那么就是后台赠送的会员 |
| | | if (tActivityStatisticslVO.getPaymentAmount().compareTo(BigDecimal.ZERO)==0){ |
| | | grantVip = grantVip.add(tActivityStatisticslVO.getOrderAmount()); |
| | | tActivityStatisticslVO.setType("赠送会员"); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | }else{ |
| | | // 赠送 |
| | | grantVip = grantVip.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | tActivityStatisticslVO.setType("赠送会员"); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | res.setList(pageInfo); |
| | | res.setTotal(coupon.add(discount).add(vipActivity).add(grantVip)); |
| | | res.setCoupon(coupon); |
| | | res.setDiscount(discount); |
| | | res.setVipActivity(vipActivity); |
| | | res.setGrantVip(grantVip); |
| | | return res; |
| | | } |
| | | } |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, code, app_user_id, order_type, goods_id, coupon_id, purchase_quantity, app_user_address_id, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, payment_status, payment_type, serial_number, remark, status, express_company, express_number, consigner_id, consigner_time, receiving_time, cancellation_time, cancellation_id, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag |
| | | </sql> |
| | | <select id="activityStatistics" resultType="com.ruoyi.order.api.vo.TActivityStatisticslVO"> |
| | | <if test="req.orderType == null or req.orderType == 1"> |
| | | <if test="req.type == null or req.type == 1 or req.type == 2"> |
| | | select t1.code ,t1.order_amount as orderAmount, |
| | | t1.coupon_discount_amount as couponDiscountAmount, |
| | | t1.vip_discount_amount as vipDiscountAmount, |
| | | t1.payment_amount as paymentAmount, |
| | | t1.create_time as createTime, |
| | | 1 as orderType |
| | | from t_charging_order t1 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 1"> |
| | | and t1.coupon_discount_amount != null and t1.coupon_discount_amount != 0 |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 2"> |
| | | and t1.vip_discount_amount != null and t1.vip_discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != req.chargingPileIds and req.chargingPileIds.size()>0" > |
| | | and t1.charging_pile_id in |
| | | <foreach collection="req.chargingPileIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t1.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t1.recharge_payment_status =2 |
| | | and t1.refund_status !=2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 2"> |
| | | <if test="req.type == null or req.type == 1 or req.type == 2"> |
| | | union all |
| | | select t2.code ,t2.order_amount as orderAmount, |
| | | t2.coupon_discount_amount as couponDiscountAmount, |
| | | t2.vip_discount_amount as vipDiscountAmount, |
| | | t2.payment_amount as paymentAmount, |
| | | t2.create_time as createTime, |
| | | 2 as orderType |
| | | from t_shopping_order t2 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t2.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 1"> |
| | | and t2.coupon_discount_amount != null and t1.coupon_discount_amount != 0 |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 2"> |
| | | and t2.vip_discount_amount != null and t1.vip_discount_amount != 0 |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t2.vip_discount_amount != null and t1.vip_discount_amount != 0 and t2.coupon_discount_amount != null and t1.coupon_discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t2.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t2.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t2.refund_status !=2 |
| | | and t2.payment_status =2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 3"> |
| | | <if test="req.type == null or req.type == 3"> |
| | | union all |
| | | select t3.code ,t3.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | t3.discount_amount as vipDiscountAmount, |
| | | t3.payment_amount as paymentAmount, |
| | | t3.create_time as createTime, |
| | | 3 as orderType |
| | | from t_vip_order t3 |
| | | where 1 = 1 |
| | | and t3.type ==1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t3.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t3.discount_amount != null and t3.discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t3.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t3.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t3.payment_status =2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 4"> |
| | | <if test="req.type == null or req.type == 4"> |
| | | union all |
| | | select t4.code ,t4.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | t4.discount_amount as vipDiscountAmount, |
| | | t4.payment_amount as paymentAmount, |
| | | t4.create_time as createTime, |
| | | 4 as orderType |
| | | from t_vip_order t4 |
| | | where 1 = 1 |
| | | and t4.type =2 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t4.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t4.discount_amount != null and t4.discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t4.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t4.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t4.payment_status =2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 4"> |
| | | <if test="req.type == null or req.type == 4"> |
| | | union all |
| | | select t5.code ,t5.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | 0 as vipDiscountAmount, |
| | | 0 as paymentAmount, |
| | | t5.create_time as createTime, |
| | | 4 as orderType |
| | | from t_grant_vip t5 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t5.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t5.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t5.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import com.ruoyi.other.api.domain.TActivity; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.dto.AdvertisingDTO; |
| | | import com.ruoyi.other.query.CouponQuery; |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理后台活动费用统计 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/activity") |
| | | public class TActivityStatisticsController { |
| | | @Autowired |
| | | private OrderClient orderClient; |
| | | @ApiOperation(tags = {"管理后台-活动费用统计"},value = "管理后台活动费用统计") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<TActivityVO> pageList(@RequestBody TActivityStatisticsQuery query) { |
| | | return AjaxResult.ok(orderClient.activityStatistics(query).getData()); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.dto.GrantCouponDto; |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.ruoyi.other.service.TGoodsService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @PostMapping("/exchangeRecord") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情-兑换记录") |
| | | public AjaxResult<PageInfo<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) { |
| | | |
| | | return AjaxResult.ok(null); |
| | | PageInfo<ExchangeRecordVO> data = appCouponClient.getExchangeRecordByCouponId(dto).getData(); |
| | | List<ExchangeRecordVO> records = data.getRecords(); |
| | | for (ExchangeRecordVO record : records) { |
| | | TCoupon byId = tCouponService.getById(record.getCouponId()); |
| | | if (byId!=null){ |
| | | record.setDiscountAmount("¥"+byId.getDiscountAmount()); |
| | | if (Objects.equals(byId.getMeetTheConditions(), BigDecimal.ZERO)){ |
| | | record.setMeetTheConditions("无门槛"); |
| | | }else{ |
| | | record.setMeetTheConditions("满"+byId.getMeetTheConditions()+"元可用"); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.ok(data); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "发放优惠券") |
| | | @GetMapping(value = "/pageList") |
| | | public AjaxResult pageList(@RequestBody GrantCouponDto dto) { |
| | | TCoupon byId = tCouponService.getById(dto.getCouponId()); |
| | | Integer waysToObtain = byId.getWaysToObtain(); |
| | | dto.setWaysToObtain(waysToObtain); |
| | | switch (byId.getValidityPeriodMode()){ |
| | | case 1: |
| | | dto.setEndTime(byId.getEndTime()); |
| | | break; |
| | | case 2: |
| | | dto.setEndTime(LocalDateTime.now().plusDays(byId.getDays())); |
| | | break; |
| | | } |
| | | // 远程送优惠券 |
| | | return AjaxResult.success(); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券列表分页查询") |
| | | @PostMapping(value = "/pageList") |