Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
# ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/ISiteService.java
# ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java
8 文件已重命名
2个文件已删除
15个文件已添加
39个文件已修改
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | @Data |
| | | public class UserDetailDto extends TAppUser { |
| | | @ApiModelProperty("累计充电数") |
| | | private Long orderCount; |
| | | @ApiModelProperty("单位名称") |
| | | private String unitName; |
| | | |
| | | @ApiModelProperty("车辆列表") |
| | | List<TAppUserCar> carList; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserListQueryDto extends BasePage { |
| | | String userPhone; |
| | | String cityCode; |
| | | Integer status; |
| | | Integer userTagId; |
| | | Integer vipTypeId; |
| | | Integer companyId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | 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; |
| | | |
| | | /** |
| | | * 门店服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class AppCouponFallbackFactory implements FallbackFactory<AppCouponClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AppCouponFallbackFactory.class); |
| | | |
| | | @Override |
| | | public AppCouponClient create(Throwable throwable) { |
| | | log.error("用户优惠券记录调用失败:{}", throwable.getMessage()); |
| | | return new AppCouponClient() { |
| | | |
| | | @Override |
| | | public R<List<Integer>> getCountByCouponIds(String couponIds) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<Integer> getUseCountByCouponId(Integer couponId) { |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.AppCouponFallbackFactory; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "AppCouponClient", value = ServiceNameConstants.CONTRACT_ACCOUNT, fallbackFactory = AppCouponFallbackFactory.class) |
| | | public interface AppCouponClient { |
| | | |
| | | /** |
| | | * 管理后台远程调用 根据优惠券ids 查询对应的发放数量 |
| | | * @return 优惠券ids 查询每个优惠券的发放数量 |
| | | */ |
| | | @PostMapping("/t-app-coupon/getCountByCouponIds") |
| | | public R<List<Integer>> getCountByCouponIds(String couponIds); |
| | | /** |
| | | * 管理后台远程调用 根据优惠券id 查询对应的使用数量 |
| | | * @param couponId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-coupon/getUseCountByCouponId") |
| | | public R<Integer> getUseCountByCouponId(Integer couponId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "状态(1=未使用,2=已使用)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "订单id 后台发放的优惠券没有订单id") |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | |
| | | |
| | | |
| | |
| | | private LocalDateTime lastLoginTime; |
| | | |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "标签名称") |
| | | @TableField(exist = false) |
| | | private String tagName; |
| | | @ApiModelProperty(value = "vip名称") |
| | | @TableField(exist = false) |
| | | private String vipName; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-08 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_app_user_vip_detail") |
| | | @ApiModel(value="TAppUserVipDetail对象", description="") |
| | | public class TAppUserVipDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId("id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "剩余充电次数") |
| | | @TableField("charge_num") |
| | | private Integer chargeNum; |
| | | |
| | | @ApiModelProperty(value = "会员id") |
| | | @TableField("vip_id") |
| | | private Integer vipId; |
| | | |
| | | @ApiModelProperty(value = "会员开始时间") |
| | | @TableField("start_time") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "会员结束时间") |
| | | @TableField("end_time") |
| | | private LocalDateTime endTime; |
| | | |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("管理后台 优惠券兑换记录") |
| | | public class ExchangeRecordGoodsQuery extends BasePage { |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String phone; |
| | | @ApiModelProperty(value = "状态1未使用 2已使用 3已过期 4已取消") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "优惠券id",required = true) |
| | | private Integer couponId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("管理后台 优惠券兑换记录列表返回VO") |
| | | public class ExchangeRecordVO { |
| | | @ApiModelProperty(value = "获得时间") |
| | | private String createTime; |
| | | @ApiModelProperty(value = "获得用户") |
| | | private String phone; |
| | | @ApiModelProperty(value = "优惠金额") |
| | | private String discountAmount; |
| | | @ApiModelProperty(value = "使用门槛") |
| | | private String meetTheConditions; |
| | | @ApiModelProperty(value = "使用状态 1未使用 2已使用 3已过期 4已取消") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "失效时间") |
| | | private String endTime1; |
| | | @ApiModelProperty(value = "失效时间 前端忽略") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "关联订单") |
| | | private String orderId; |
| | | @ApiModelProperty(value = " 前端忽略 获取方式 1=积分兑换 2现金购买") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty(value = " 是否删除0否1是") |
| | | private Integer delFlag; |
| | | @ApiModelProperty(value = "三方支付流水号 前端忽略") |
| | | private String serialNumber; |
| | | |
| | | } |
| | |
| | | com.ruoyi.account.api.factory.AppUserFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserFallbackFactory |
| | | com.ruoyi.account.api.factory.AppCouponFallbackFactory |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "故障内容") |
| | | @Length(max = 200, message = "故障内容长度不能超过200") |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "故障时间") |
| | | @TableField("down_time") |
| | | private LocalDateTime downTime; |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteQuery对象",description = "站点查询条件") |
| | | public class SiteQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "站点名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "排序方式 1=离我最近 2=价格较低 3=空闲较多") |
| | | @NotNull(message = "排序方式不能为空") |
| | | private Integer sortType; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @NotNull(message = "地址经度不能为空") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @NotNull(message = "地址纬度不能为空") |
| | | private String lat; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteVO对象", description = "站点信息") |
| | | public class SiteVO extends Site { |
| | | |
| | | @ApiModelProperty(value = "快充数量") |
| | | private Integer fastCount; |
| | | @ApiModelProperty(value = "超充数量") |
| | | private Integer superCount; |
| | | @ApiModelProperty(value = "慢充数量") |
| | | private Integer slowCount; |
| | | @ApiModelProperty(value = "普通电价") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | | private BigDecimal vipElectrovalence; |
| | | |
| | | } |
| | |
| | | @ApiModel(value = "TAccountingStrategyDetailVO",description = "计费策略明细") |
| | | public class TAccountingStrategyDetailVO extends TAccountingStrategyDetail { |
| | | |
| | | @ApiModelProperty(value = "原价服务费") |
| | | @ApiModelProperty(value = "总价") |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty(value = "会员折扣") |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | public ChargingOrderClient create(Throwable throwable) { |
| | | log.error("充电订单调用失败:{}", throwable.getMessage()); |
| | | return new ChargingOrderClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<Long> useOrderCount(Long userId) { |
| | | return R.fail("订单计数:" + throwable.getMessage()); |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class OrderFallbackFactory implements FallbackFactory<ChargingOrderClient> |
| | | public class OrderFallbackFactory implements FallbackFactory<OrderClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(OrderFallbackFactory.class); |
| | | |
| | | |
| | | @Override |
| | | public ChargingOrderClient create(Throwable cause) { |
| | | public OrderClient create(Throwable cause) { |
| | | log.error("商品订单调用失败:{}", cause.getMessage()); |
| | | return new ChargingOrderClient() { |
| | | return new OrderClient() { |
| | | |
| | | @Override |
| | | public R<List<Integer>> getSalesCountByGoodsId(String goodsIds) { |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * 充电订单服务 |
| | |
| | | */ |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class) |
| | | public interface ChargingOrderClient { |
| | | @PostMapping(value = "/t-charging-order/useOrderCount") |
| | | R<Long> useOrderCount(@RequestParam Long userId); |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "状态(1=上架,2=下架)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "发放数量") |
| | | @TableField(exist = false) |
| | | private Integer count; |
| | | @ApiModelProperty(value = "使用数量") |
| | | @TableField(exist = false) |
| | | private Integer useCount; |
| | | |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 商品服务降级处理 |
| | |
| | | public R deleteTag(Integer id) { |
| | | return R.fail("查询标签:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Map<Integer, String>> getTagMap(List<Integer> ids) { |
| | | return R.fail("查询标签map:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TUserTag> getByIdTag(Integer id) { |
| | | return R.fail("查询标签:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Map<Integer, String>> getVipMap(List<Integer> ids) { |
| | | return R.fail("获取会员map:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.factory.GoodsFallbackFactory; |
| | | import com.ruoyi.other.api.factory.OtherFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 商品服务 |
| | |
| | | @PostMapping(value = "/t-company/unit/delete") |
| | | R unitDelete(@RequestParam Integer id); |
| | | |
| | | @PostMapping(value = "/t-company/unit/detail") |
| | | R<TCompany> unitDetail(@RequestParam Integer id); |
| | | |
| | | //标签分页 |
| | | @PostMapping(value = "/t-user-tag/page") |
| | |
| | | //用户新增标签 |
| | | @PostMapping(value = "/t-user-tag/addorUpdateTag") |
| | | R addorUpdateTag(@RequestBody TUserTag tUserTag); |
| | | //删除用户标签 |
| | | @PostMapping(value = "/t-user-tag/delete") |
| | | R deleteTag(@RequestParam Integer id); |
| | | |
| | | //获取标签Map |
| | | @PostMapping(value = "/t-user-tag/getTagMap") |
| | | R<Map<Integer, String>> getTagMap(@RequestBody List<Integer> ids); |
| | | //获取标签 |
| | | @PostMapping(value = "/t-user-tag/getById") |
| | | R<TUserTag> getByIdTag(@RequestParam Integer id); |
| | | |
| | | @PostMapping(value = "/vip/getVipMap") |
| | | R<Map<Integer, String>> getVipMap(@RequestBody List<Integer> ids); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<SysUser> queryUserByAccount(String account) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<SysUser> queryUserByUserName(String userName) { |
| | | return R.fail("通过账号查询用户失败:" + cause.getMessage()); |
| | | } |
| | |
| | | public R addSysUser(SysUser user) { |
| | | return R.fail("添加用户失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R resetPassword(SysUser user) { |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public static final String CONTRACT_SERVICE = "ruoyi-contract"; |
| | | public static final String CONTRACT_ORDER = "ruoyi-order"; |
| | | public static final String CONTRACT_ACCOUNT = "ruoyi-account"; |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum SiteStatusEnum { |
| | | |
| | | |
| | | NORMAL_USE(1, "正常使用"), |
| | | IN_MAINTENANCE(2, "维修中"), |
| | | CLOSE_OFFLINE(3, "关闭下线"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | SiteStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static SiteStatusEnum fromCode(Integer code) { |
| | | SiteStatusEnum[] resultTypes = SiteStatusEnum.values(); |
| | | for (SiteStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-lang</groupId> |
| | | <artifactId>commons-lang</artifactId> |
| | | <version>2.6</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | 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.other.api.domain.TCoupon; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/t-app-coupon") |
| | | public class TAppCouponController { |
| | | @Autowired |
| | | private TAppCouponService tAppCouponService; |
| | | |
| | | /** |
| | | * 管理后台远程调用 根据优惠券ids 查询对应的发放数量 |
| | | * @return 优惠券ids 查询每个优惠券的发放数量 |
| | | */ |
| | | @PostMapping("/getCountByCouponIds") |
| | | public R<List<Integer>> getCountByCouponIds(String couponIds) { |
| | | // 最终结果 和优惠券id一一对应 |
| | | List<Integer> res = new ArrayList<>(); |
| | | String[] split = couponIds.split(","); |
| | | // 查询每个优惠券的发放数量 |
| | | List<TAppCoupon> couponId = tAppCouponService.list(new QueryWrapper<TAppCoupon>() |
| | | .in("coupon_id", Arrays.asList(split))); |
| | | for (String s : split) { |
| | | res.add(tAppCouponService.list(new QueryWrapper<TAppCoupon>() |
| | | .eq("coupon_id", s)).size()); |
| | | } |
| | | return R.ok(res); |
| | | } |
| | | |
| | | /** |
| | | * 后台远程调用 根据优惠券id 查询使用数量 |
| | | * @param couponId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getUseCountByCouponId") |
| | | public R<Integer> getUseCountByCouponId(Integer couponId){ |
| | | return R.ok(tAppCouponService.list(new QueryWrapper<TAppCoupon>() |
| | | .eq("coupon_id", couponId) |
| | | .eq("status",2)).size()); |
| | | } |
| | | /** |
| | | * 后台远程调用 根据优惠券id 查询领取记录 |
| | | * @param couponId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getExchangeRecordByCouponId") |
| | | public R<PageInfo<ExchangeRecordVO>> getUseCountByCouponId(ExchangeRecordGoodsQuery couponId){ |
| | | return R.ok(tAppCouponService.pagelist(couponId)); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.UnitListQueryDto; |
| | | import com.ruoyi.account.api.dto.UserDetailDto; |
| | | import com.ruoyi.account.api.dto.UserListQueryDto; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.api.model.TAppUserTag; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TAppUserTagService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private OtherClient otherClient; |
| | | @Resource |
| | | private TAppUserService appUserService; |
| | | @Resource |
| | | private TAppUserTagService appUserTagService; |
| | | |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Resource |
| | | private TAppUserCarService appUserCarService; |
| | | |
| | | @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/page") |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户列表", tags = {"用户管理-用户管理"}) |
| | | @ApiOperation(value = "用户列表", tags = {"用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/page") |
| | | public R<Page<TCompany>> userPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | | public R<Page<TAppUser>> userPage(@RequestBody UserListQueryDto userListQueryDto) { |
| | | List<Long> userIds = new ArrayList<>(); |
| | | |
| | | //拿到标签tag |
| | | //如果要筛选标签。用标签获取useids |
| | | if (userListQueryDto.getUserTagId() != null){ |
| | | userIds = appUserTagService.lambdaQuery().eq(TAppUserTag::getUserTagId, userListQueryDto.getUserTagId()).list().stream().map(TAppUserTag::getAppUserId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | //拿到会员map |
| | | |
| | | |
| | | //列表查询 |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCompanyId() != null, TAppUser::getCompanyId, userListQueryDto.getCompanyId()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getStatus() != null, TAppUser::getStatus, userListQueryDto.getStatus()) |
| | | .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId()) |
| | | .in(!userIds.isEmpty(),TAppUser::getId,userIds) |
| | | .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())); |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "用户添加编辑", tags = {"用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/addOrUpdate") |
| | | public R addOrUpdate(@RequestBody TAppUser tAppUser) { |
| | | if (tAppUser.getId() != null){ |
| | | //为编辑操作,要进行vip的逻辑处理 |
| | | TAppUser nowUser = appUserService.getById(tAppUser.getId()); |
| | | //会员结束时间不为空 |
| | | if (tAppUser.getVipEndTime()!=null&&tAppUser.getVipEndTime()!=nowUser.getVipEndTime()){ |
| | | //计算改变后的结束时间和当前结束时间差距了多少时间 |
| | | Duration duration = Duration.between(tAppUser.getVipEndTime(), nowUser.getVipEndTime()); |
| | | List<TAppUserVipDetail> detailList = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, tAppUser.getId()).gt(TAppUserVipDetail::getEndTime, LocalDateTime.now()).orderByAsc(TAppUserVipDetail::getStartTime).list(); |
| | | //如果是增加,则将明细表里当前会员的结束时间往后移,并将其余未开始会员的开始时间和结束时间往后移 |
| | | if (tAppUser.getVipEndTime().isAfter(nowUser.getVipEndTime())){ |
| | | for (int i = 0; i < detailList.size(); i++) { |
| | | TAppUserVipDetail tAppUserVipDetail = detailList.get(i); |
| | | if (i == 0 ){ |
| | | tAppUserVipDetail.setEndTime(tAppUser.getVipEndTime().plus(duration)); |
| | | }else { |
| | | tAppUserVipDetail.setStartTime(tAppUserVipDetail.getStartTime().plus(duration)); |
| | | tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plus(duration)); |
| | | } |
| | | } |
| | | }else { |
| | | //如果是减少,将当前会员结束时间减少,并将其余会员开始和结束时间都往前移动 |
| | | for (int i = 0; i < detailList.size(); i++) { |
| | | TAppUserVipDetail tAppUserVipDetail = detailList.get(i); |
| | | if (i == 0 ){ |
| | | tAppUserVipDetail.setEndTime(tAppUser.getVipEndTime().minus(duration)); |
| | | }else { |
| | | tAppUserVipDetail.setStartTime(tAppUserVipDetail.getStartTime().minus(duration)); |
| | | tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().minus(duration)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | appUserService.saveOrUpdate(tAppUser); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户详情", tags = {"用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/detail/{id}") |
| | | public R<UserDetailDto> userDetail(@PathVariable Long id) { |
| | | TAppUser user = appUserService.getById(id); |
| | | UserDetailDto userDetailDto = new UserDetailDto(); |
| | | BeanUtils.copyProperties(user,userDetailDto); |
| | | if (user.getVipId()!=null) { |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(Arrays.asList(user.getVipId())); |
| | | user.setVipName(vipMap.getData().get(user.getVipId())); |
| | | } |
| | | //获取累计充电数量 |
| | | R<Long> useOrderCount = chargingOrderClient.useOrderCount(user.getId()); |
| | | userDetailDto.setOrderCount(useOrderCount.getData()); |
| | | R<TCompany> tCompanyR = otherClient.unitDetail(user.getCompanyId()); |
| | | if (tCompanyR.getData()!=null){ |
| | | userDetailDto.setUnitName(tCompanyR.getData().getName()); |
| | | } |
| | | List<TAppUserCar> carList = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, id).orderByDesc(BasePojo::getCreateTime).list(); |
| | | userDetailDto.setCarList(carList); |
| | | |
| | | List<Integer> tagIds = appUserTagService.lambdaQuery().eq(TAppUserTag::getAppUserId, id).orderByDesc(TAppUserTag::getCreateTime).list().stream().map(TAppUserTag::getUserTagId).collect(Collectors.toList()); |
| | | R<Map<Integer, String>> tagMap = otherClient.getTagMap(tagIds); |
| | | userDetailDto.setTagName(tagMap.getData().values().toString()); |
| | | return R.ok(userDetailDto); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TAppCouponMapper extends BaseMapper<TAppCoupon> { |
| | | |
| | | List<ExchangeRecordVO> pageList(@Param("pageInfo")PageInfo<ExchangeRecordVO> pageInfo,@Param("req") ExchangeRecordGoodsQuery dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-08 |
| | | */ |
| | | public interface TAppUserVipDetailMapper extends BaseMapper<TAppUserVipDetail> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TAppCouponService extends IService<TAppCoupon> { |
| | | |
| | | PageInfo<ExchangeRecordVO> pagelist(ExchangeRecordGoodsQuery couponId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-08 |
| | | */ |
| | | public interface TAppUserVipDetailService extends IService<TAppUserVipDetail> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.account.mapper.TAppCouponMapper; |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TAppCouponServiceImpl extends ServiceImpl<TAppCouponMapper, TAppCoupon> implements TAppCouponService { |
| | | |
| | | @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); |
| | | // 现金优惠券 |
| | | 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(","); |
| | | }else{ |
| | | stringBuilder.append("0").append(","); |
| | | } |
| | | break; |
| | | case 2: |
| | | if (exchangeRecordVO.getSerialNumber()!=null){ |
| | | stringBuilder1.append(exchangeRecordVO.getSerialNumber()).append(","); |
| | | }else{ |
| | | stringBuilder1.append("0").append(","); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | Date date = DateUtils.toDate(exchangeRecordVO.getEndTime()); |
| | | exchangeRecordVO.setEndTime1(format.format(date)); |
| | | if (exchangeRecordVO.getStatus()==1){ |
| | | if (exchangeRecordVO.getDelFlag() == 1){ |
| | | // 删除了 就是已取消状态 |
| | | exchangeRecordVO.setStatus(4); |
| | | }else{ |
| | | // 未删除 判断endTime是否过期 |
| | | // 设置了过期时间 |
| | | if (exchangeRecordVO.getEndTime().isBefore(java.time.LocalDateTime.now())){ |
| | | exchangeRecordVO.setStatus(3); |
| | | }else{ |
| | | // 没过期 |
| | | exchangeRecordVO.setStatus(1); |
| | | } |
| | | } |
| | | } |
| | | if (exchangeRecordVO.getStatus()==2){ |
| | | if (exchangeRecordVO.getDelFlag() == 1){ |
| | | // 删除了 就是已取消状态 |
| | | exchangeRecordVO.setStatus(4); |
| | | }else{ |
| | | exchangeRecordVO.setStatus(2); |
| | | } |
| | | } |
| | | // 根据购买方式 查询对应订单号 |
| | | } |
| | | |
| | | // 去除最后一个字符 |
| | | if (StringUtils.hasText(stringBuilder.toString())){ |
| | | String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); |
| | | // 远程调用 查询关联的现金优惠券订单编号 |
| | | } |
| | | if (StringUtils.hasText(stringBuilder.toString())){ |
| | | String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); |
| | | // 远程调用 查询关联的积分兑换优惠券订单编号 |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.mapper.TAppUserVipDetailMapper; |
| | | |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-08 |
| | | */ |
| | | @Service |
| | | public class TAppUserVipDetailServiceImpl extends ServiceImpl<TAppUserVipDetailMapper, TAppUserVipDetail> implements TAppUserVipDetailService { |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TAppCouponMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppCoupon"> |
| | | <id column="id" property="id" /> |
| | | <result column="app_user_id" property="appUserId" /> |
| | | <result column="coupon_id" property="couponId" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="ways_to_obtain" property="waysToObtain" /> |
| | | <result column="redeem_points" property="redeemPoints" /> |
| | | <result column="payment_amount" property="paymentAmount" /> |
| | | <result column="payment_type" property="paymentType" /> |
| | | <result column="serial_number" property="serialNumber" /> |
| | | <result column="payment_time" property="paymentTime" /> |
| | | <result column="status" property="status" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, app_user_id, coupon_id, end_time, ways_to_obtain, redeem_points, payment_amount, payment_type, serial_number, payment_time, status, create_time, del_flag |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.account.api.vo.ExchangeRecordVO"> |
| | | select t1.id,t1.app_user_id as appUserId, t1.coupon_id as couponId, |
| | | t1.end_time as endTime, t1.ways_to_obtain as waysToObtain, |
| | | t1.redeem_points as redeemPoints, |
| | | t1.payment_amount as paymentAmount, |
| | | t1.payment_type as paymentType, |
| | | t1.serial_number as serialNumber, |
| | | t1.payment_time as paymentTime, |
| | | t1.status, |
| | | t1.create_time AS createTime, |
| | | t1.del_flag AS delFlag, |
| | | t2.phone |
| | | from t_app_coupon t1 |
| | | left join t_app_user t2 on t1.app_user_id = t2.id |
| | | <where> |
| | | and t1.coupon_id = #{req.couponId} |
| | | <if test="req.phone != null and req.phone != ''"> |
| | | AND t2.phone LIKE concat('%',#{req.phone}, '%') |
| | | </if> |
| | | <if test="req.status != null and req.status = 1"> |
| | | AND t1.status =1 and t1.endTime >= now() |
| | | </if> |
| | | <if test="req.status != null and req.status = 2"> |
| | | AND t1.status =2 |
| | | </if> |
| | | <if test="req.status != null and req.status = 3"> |
| | | AND t1.status =1 and t1.endTime <= now() and t1.del_flag = 0 |
| | | </if> |
| | | <if test="req.status != null and req.status = 4"> |
| | | AND t1.del_flag = 0 |
| | | </if> |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TAppUserAddressMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TAppUserAddressMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserAddress"> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserCarMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TAppUserCarMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TAppUserCarMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserCar"> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TAppUserIntegralChangeMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TAppUserIntegralChangeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserIntegralChange"> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TAppUserMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TAppUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUser"> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserSignMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TAppUserSignMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TAppUserSignMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserSign"> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserTagMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TAppUserTagMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TAppUserTagMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserTag"> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInviteUserMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TInviteUserMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TInviteUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TInviteUser"> |
File was renamed from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.api.mapper.TInvoiceInformationMapper"> |
| | | <mapper namespace="com.ruoyi.account.mapper.TInvoiceInformationMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TInvoiceInformation"> |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getSiteList") |
| | | @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"}) |
| | |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理"}) |
| | | @PostMapping("/pageList") |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ |
| | | return AjaxResult.success(siteService.pageList(query)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSiteList") |
| | |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam Integer strategyId) { |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getCostServiceCharge().add(detail.getElectrovalence())); |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-accounting-strategy-detail") |
| | | public class TAccountingStrategyDetailController { |
| | | |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyDetailController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | this.accountingStrategyService = accountingStrategyService; |
| | | this.accountingStrategyDetailService = accountingStrategyDetailService; |
| | | } |
| | | |
| | | /** |
| | | * 通过电站id查询计费策略明细列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-计费策略"},value = "通过站点id查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailBySiteId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | // TODO 修改 |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Api(tags = "充电桩") |
| | | @RestController |
| | | @RequestMapping("/chargingPile") |
| | | @RequestMapping("/t-charging-pile") |
| | | public class TChargingPileController { |
| | | |
| | | private final TChargingPileService chargingPileService; |
| | | |
| | | @Autowired |
| | | public TChargingPileController(TChargingPileService chargingPileService) { |
| | | this.chargingPileService = chargingPileService; |
| | | } |
| | | |
| | | /** |
| | | * 查询充电桩列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-充电桩"},value = "查询充电桩列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TChargingPile>> list(@RequestParam(name = "siteId",value = "站点id",required = false)Integer siteId) { |
| | | return AjaxResult.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | @RequestMapping("/t-fault-message") |
| | | public class TFaultMessageController { |
| | | |
| | | private final TFaultMessageService faultMessageService; |
| | | |
| | | @Autowired |
| | | public TFaultMessageController(TFaultMessageService faultMessageService) { |
| | | this.faultMessageService = faultMessageService; |
| | | } |
| | | |
| | | /** |
| | | * 添加故障报修管理 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-故障报修"},value = "添加故障报修管理") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TFaultMessage dto) { |
| | | return AjaxResult.ok(faultMessageService.save(dto)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<GetSiteListDTO> getSiteList(PageInfo<GetSiteListDTO> pageInfo, @Param("item") GetSiteList siteList); |
| | | |
| | | /** |
| | | * 获取站点分页列表 |
| | | * @return |
| | | */ |
| | | List<SiteVO> pageList(@Param("query")SiteQuery query,@Param("pageInfo")PageInfo<SiteVO> pageInfo); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | |
| | | this.updateById(site); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SiteVO> pageList(SiteQuery query) { |
| | | PageInfo<SiteVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | <id column="id" property="id" /> |
| | | <result column="partner_id" property="partnerId" /> |
| | | <result column="`code`" property="code" /> |
| | | <result column="name" property="name" /> |
| | | <result column="`name`" property="name" /> |
| | | <result column="site_type" property="siteType" /> |
| | | <result column="business_category" property="businessCategory" /> |
| | | <result column="status" property="status" /> |
| | |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, partner_id, code, `name`, site_type, business_category, status, construction_site, img_url, province, province_code, city, city_code, districts, districts_code, lon, lat, address, country_code, phone, service_phone, guide, start_service_time, end_service_time, service_description, vehicle_description, parking_space, rate_description, space_charge_explain, accounting_strategy_id, establishment_time, sort, remark, create_time, del_flag, mark |
| | | </sql> |
| | | |
| | | <select id="getSiteList" resultType="com.ruoyi.chargingPile.api.dto.GetSiteListDTO"> |
| | | select |
| | |
| | | </if> |
| | | order by a.sort desc, a.create_time desc limit #{item.pageCurr}, #{item.pageSize} |
| | | </select> |
| | | |
| | | <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.SiteVO"> |
| | | select |
| | | ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status, ts.construction_site, ts.img_url, |
| | | ts.lon, ts.lat, ts.address, ts.country_code, ts.phone,ts.guide, ts.service_description, ts.vehicle_description, |
| | | ts.parking_space, ts.rate_description, ts.space_charge_explain, ts.accounting_strategy_id,ts.del_flag,tcg.fastCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | | POW( |
| | | SIN( |
| | | ( |
| | | #{query.lat} * PI() / 180 - ts.lat * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) + COS(#{query.lat} * PI() / 180) * COS(ts.lat * PI() / 180) * POW( |
| | | SIN( |
| | | ( |
| | | #{query.lon} * PI() / 180 - ts.lon * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) |
| | | ) |
| | | ) * 1000 |
| | | ) AS distance |
| | | from t_site ts |
| | | left join ( |
| | | select site_id, |
| | | SUM(CASE WHEN charge_mode = 1 THEN 1 ELSE 0 END) AS superCount, |
| | | SUM(CASE WHEN charge_mode = 2 THEN 1 ELSE 0 END) AS fastCount, |
| | | SUM(CASE WHEN charge_mode = 3 THEN 1 ELSE 0 END) AS slowCount |
| | | from |
| | | t_charging_gun |
| | | where |
| | | del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | group by |
| | | site_id) tcg on (ts.id = tcg.site_id) |
| | | left join ( |
| | | select |
| | | a.accounting_strategy_id, |
| | | (a.electrovalence+a.service_charge) AS electrovalence, |
| | | ((a.electrovalence+a.service_charge)*a.discount) AS vipElectrovalence |
| | | from |
| | | t_accounting_strategy_detail a |
| | | left join |
| | | t_accounting_strategy b on (a.accounting_strategy_id = b.id) |
| | | where b.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND DATE_FORMAT(NOW(), '%H:%i:%s') between b.start_time and b.end_time) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) |
| | | <where> |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.SiteStatusEnum@NORMAL_USE.getCode()} |
| | | </where> |
| | | <if test="query.sortType != null"> |
| | | <choose> |
| | | <when test="query.sortType == 1"> |
| | | ORDER BY ts.distance ASC |
| | | </when> |
| | | <when test="query.sortType == 2"> |
| | | ORDER BY tasd.electrovalence ASC |
| | | </when> |
| | | <when test="query.sortType == 3"> |
| | | ORDER BY (tcg.fastCount + tcg.slowCount + tcg.superCount) DESC |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import io.swagger.annotations.Api; |
| | | 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 javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-charging-order") |
| | | public class TChargingOrderController { |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | @PostMapping(value = "/useOrderCount") |
| | | public R<Long> useOrderCount(@RequestParam Long userId) { |
| | | Long count = chargingOrderService.lambdaQuery().eq(TChargingOrder::getAppUserId, userId).count(); |
| | | |
| | | return R.ok(count); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private TExchangeOrderService exchangeOrderService; |
| | | /** |
| | | * 管理后台 根据商品ids 查询对应的销量 |
| | | * @param goodsIds |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-exchange-order/getSalesCountByGoodsIds") |
| | | @PostMapping("/getSalesCountByGoodsIds") |
| | | public R<List<Integer>> getSalesCountByGoodsId(String goodsIds){ |
| | | String[] split = goodsIds.split("-"); |
| | | // 取出最后一位字符 类型1查询现金购买 类型2查询积分兑换 |
| | |
| | | switch (Integer.parseInt(s)){ |
| | | case 1: |
| | | for (int i = 0; i < split.length-1; i++) { |
| | | |
| | | Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() |
| | | .eq("goods_id", split[i]) |
| | | .eq("payment_status", 2) |
| | | .ne("refund_status", 2)) |
| | | .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | |
| | | res.add(reduce); |
| | | } |
| | | break; |
| | |
| | | .eq("goods_id", split[i]) |
| | | ) |
| | | .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | |
| | | res.add(reduce); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | |
| | | return R.ok(res); |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon流水号查询现金优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCodeBySerialNumber") |
| | | public R<List<String>> getCodeBySerialNumber(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()); |
| | | }else{ |
| | | strings.add(""); |
| | | } |
| | | } |
| | | |
| | | return R.ok(strings); |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon流水号查询积分兑换优惠券的订单编号 |
| | | * @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); |
| | | } |
| | | } |
| | | |
| | |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/unit/delete") |
| | | public R<TCompany> delete(@RequestParam Integer id) { |
| | | |
| | | |
| | | return R.ok( companyService.getById(id)); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.dto.GoodsDTO; |
| | | import com.ruoyi.other.query.CouponQuery; |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.ruoyi.other.service.TGoodsService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/t-coupon") |
| | | public class TCouponController { |
| | | @Autowired |
| | | private TCouponService tCouponService; |
| | | |
| | | @Autowired |
| | | private AppCouponClient appCouponClient; |
| | | @PostMapping("/saveGoods") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券添加") |
| | | public AjaxResult saveActivity(@RequestBody TCoupon dto) { |
| | | tCouponService.save(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/delete") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券删除") |
| | | public AjaxResult delete(Integer id) { |
| | | tCouponService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券修改") |
| | | public AjaxResult updateActivity(@RequestBody TCoupon dto) { |
| | | tCouponService.updateById(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情") |
| | | public AjaxResult<TCoupon> getInfo(Integer id) { |
| | | TCoupon byId = tCouponService.getById(id); |
| | | // 查询累计发放数量 |
| | | byId.setCount(appCouponClient.getCountByCouponIds(String.valueOf(id)).getData().get(0)); |
| | | // 查询累计使用数量 |
| | | byId.setUseCount(appCouponClient.getUseCountByCouponId(id).getData()); |
| | | return AjaxResult.ok(byId); |
| | | } |
| | | @PostMapping("/exchangeRecord") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情-兑换记录") |
| | | public AjaxResult<PageInfo<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) { |
| | | |
| | | return AjaxResult.ok(null); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TCoupon>> pageList(@RequestBody CouponQuery dto) { |
| | | return AjaxResult.ok(tCouponService.pageList(dto)); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private TUserTagService tUserTagService; |
| | | |
| | | //标签分页 |
| | | @PostMapping(value = "/page") |
| | | public R<Page<TUserTag>> page(@RequestBody TagListQueryDto tagListQueryDto) { |
| | | Page<TUserTag> page = tUserTagService.lambdaQuery() |
| | |
| | | return R.ok(page); |
| | | |
| | | } |
| | | |
| | | //标签新增修改 |
| | | @PostMapping(value = "/addorUpdateTag") |
| | | public R addorUpdateTag(@RequestBody TUserTag tUserTag) { |
| | | tUserTag.setCreateTime(LocalDateTime.now()); |
| | | tUserTagService.saveOrUpdate(tUserTag); |
| | | return R.ok(); |
| | | } |
| | | |
| | | //标签删除 |
| | | @PostMapping(value = "/delete") |
| | | public R delete(@RequestParam Integer id) { |
| | | tUserTagService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | //获取标签map |
| | | @PostMapping(value = "/getTagMap") |
| | | public R<Map<Integer, String>> getTagMap(@RequestBody List<Integer> ids) { |
| | | |
| | | List<TUserTag> list = tUserTagService.lambdaQuery().in(!ids.isEmpty(), TUserTag::getId, ids).list(); |
| | | Map<Integer, String> idNameMap = list.stream() |
| | | .collect(Collectors.toMap( |
| | | TUserTag::getId, |
| | | TUserTag::getName |
| | | )); |
| | | return R.ok(idNameMap); |
| | | } |
| | | |
| | | @PostMapping(value = "/getById") |
| | | public R<TUserTag> getById(@RequestParam Integer id) { |
| | | |
| | | return R.ok(tUserTagService.getById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.service.TVipService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return AjaxResult.ok(vipService.pageList(pageCurr,pageSize)); |
| | | } |
| | | |
| | | //获取会员Map |
| | | @PostMapping(value = "/getVipMap") |
| | | public R<Map<Integer, String>> getVipMap(@RequestBody List<Integer> ids) { |
| | | |
| | | List<TVip> list = vipService.lambdaQuery().in(!ids.isEmpty(), TVip::getId, ids).list(); |
| | | Map<Integer, String> idNameMap = list.stream() |
| | | .collect(Collectors.toMap( |
| | | TVip::getId, |
| | | TVip::getName |
| | | )); |
| | | return R.ok(idNameMap); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.dto.GoodsDTO; |
| | | import com.ruoyi.other.query.CouponQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TCouponMapper extends BaseMapper<TCoupon> { |
| | | |
| | | List<TCoupon> pageList(@Param("pageInfo")PageInfo<TCoupon> pageInfo, @Param("req") CouponQuery dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.query; |
| | | |
| | | 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 CouponQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "类型 1充电优惠券 2购物优惠券") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "获得方式(1=积分兑换,2=现金购买)") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty(value = "启用状态 1启用 2禁用") |
| | | private Integer status; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.query.CouponQuery; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TCouponService extends IService<TCoupon> { |
| | | |
| | | PageInfo<TCoupon> pageList(CouponQuery dto); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.mapper.TCouponMapper; |
| | | import com.ruoyi.other.query.CouponQuery; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TCouponServiceImpl extends ServiceImpl<TCouponMapper, TCoupon> implements TCouponService { |
| | | |
| | | @Autowired |
| | | private AppCouponClient appCouponClient; |
| | | @Override |
| | | public PageInfo<TCoupon> pageList(CouponQuery dto) { |
| | | PageInfo<TCoupon> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<TCoupon> list = this.baseMapper.pageList(pageInfo,dto); |
| | | StringBuilder couponIds = new StringBuilder(); |
| | | for (TCoupon tCoupon : list) { |
| | | couponIds.append(tCoupon.getId()).append(","); |
| | | } |
| | | if (StringUtils.hasLength(couponIds)){ |
| | | // 去除最后一个字符 |
| | | couponIds.deleteCharAt(couponIds.length()-1); |
| | | } |
| | | List<Integer> data = appCouponClient.getCountByCouponIds(couponIds.toString()).getData(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setCount(data.get(i)); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | return pageInfo; |
| | | } |
| | | String string = stringBuilder.toString(); |
| | | // 订单号加上商品类型 |
| | | String res = string+"-"+dto.getType(); |
| | | |
| | | List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, type, name, preferential_mode, discount_amount, meet_the_conditions, discount, maximum_discount_amount, inventory_quantity, validity_period_mode, end_time, days, ways_to_obtain, redeem_points, exchange_limit, payment_amount, vip_payment_amount, explain, remark, status, create_time, del_flag |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.other.api.domain.TCoupon"> |
| | | select * from t_coupon |
| | | <where> |
| | | <if test="req.name != null and req.name != ''"> |
| | | AND `name` LIKE concat('%',#{req.name}, '%') |
| | | </if> |
| | | <if test="req.type != null"> |
| | | AND `type` = #{req.type} |
| | | </if> |
| | | <if test="req.status != null"> |
| | | AND status = #{req.status} |
| | | </if> |
| | | <if test="req.waysToObtain != null"> |
| | | AND ways_to_obtain = #{req.waysToObtain} |
| | | </if> |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |