Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/vo/CouponInfoVo.java
# ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserAddressController.java
# ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java
| | |
| | | throw new RuntimeException("编辑用户信息失败"); |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> getCouponCount(Long userId, Long couponId) { |
| | | log.error("获取优惠券数量失败:{}", cause.getMessage()); |
| | | throw new RuntimeException("获取优惠券数量失败"); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/appUser/editAppUserById") |
| | | R<Void> editAppUserById(@RequestParam("appUser") AppUser appUser); |
| | | |
| | | @PostMapping("/appUser/getCouponCount") |
| | | R<Long> getCouponCount(@RequestParam("userId")Long userId, @RequestParam("couponId") Integer couponId ); |
| | | } |
| | |
| | | @ApiModelProperty(value = "推广人id") |
| | | @TableField("invite_user_id") |
| | | private Long inviteUserId; |
| | | @ApiModelProperty(value = "推广人姓名") |
| | | @TableField(exist = false) |
| | | private String inviteUserName; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "绑定门店id") |
| | | @TableField("shop_id") |
| | | private Long shopId; |
| | | @ApiModelProperty(value = "绑定门店名称") |
| | | @TableField(exist = false) |
| | | private String shopName; |
| | | |
| | | @ApiModelProperty(value = "合伙人积分数") |
| | | @TableField("part_point") |
| | |
| | | @TableField("district_code") |
| | | private String districtCode; |
| | | |
| | | @ApiModelProperty("等级1会员数") |
| | | private Long count1; |
| | | |
| | | @ApiModelProperty("等级2会员数") |
| | | private Long count2; |
| | | |
| | | @ApiModelProperty("等级3会员数") |
| | | private Long count3; |
| | | |
| | | @ApiModelProperty("等级4会员数") |
| | | private Long count4; |
| | | |
| | | @ApiModelProperty("等级5会员数") |
| | | private Long count5; |
| | | |
| | | @ApiModelProperty("等级6会员数") |
| | | private Long count6; |
| | | |
| | | @ApiModelProperty("等级7会员数") |
| | | private Long count7; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @TableField("use_time") |
| | | private LocalDateTime useTime; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "优惠劵id") |
| | | @TableField("coupon_id") |
| | | private Integer couponId; |
| | | @ApiModelProperty(value = "优惠劵信息") |
| | | @TableField(exist = false) |
| | | private CouponInfoVo couponInfoVo; |
| | | |
| | | @ApiModelProperty(value = "1未使用2已使用3已过期") |
| | | @TableField(exist = false) |
| | | private Integer status; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private String periodEndTime; |
| | | @ApiModelProperty("是否可用") |
| | | private Boolean available; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_coupon_info") |
| | | @ApiModel(value="CouponInfo对象", description="") |
| | | public class CouponInfoVo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "删除标志(0=否,1=是)") |
| | | @TableField("del_flag") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @TableField("coupon_name") |
| | | private String couponName; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型 1'满减券',2'代金券',3'折扣券',4'商品券'") |
| | | @TableField("coupon_type") |
| | | private Integer couponType; |
| | | |
| | | @ApiModelProperty(value = "满x元") |
| | | @TableField("condition_amount") |
| | | private BigDecimal conditionAmount; |
| | | |
| | | @ApiModelProperty(value = "减x元") |
| | | @TableField("discount_amount") |
| | | private BigDecimal discountAmount; |
| | | |
| | | @ApiModelProperty(value = "代金x元") |
| | | @TableField("money_amount") |
| | | private BigDecimal moneyAmount; |
| | | |
| | | @ApiModelProperty(value = "折扣") |
| | | @TableField("discount") |
| | | private BigDecimal discount; |
| | | |
| | | @ApiModelProperty(value = "适用商品ids,全部-1") |
| | | @TableField("for_good_ids") |
| | | private String forGoodIds; |
| | | |
| | | @ApiModelProperty(value = "发放数量") |
| | | @TableField("send_num") |
| | | private Integer sendNum; |
| | | |
| | | @ApiModelProperty(value = "可领数量") |
| | | @TableField("max_num") |
| | | private Integer maxNum; |
| | | |
| | | @ApiModelProperty(value = "有效期类型 1指定时间内有效 2领取后x天有效") |
| | | @TableField("period_type") |
| | | private Integer periodType; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | @TableField("period_start_time") |
| | | private LocalDateTime periodStartTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | @TableField("period_end_time") |
| | | private LocalDateTime periodEndTime; |
| | | |
| | | @ApiModelProperty(value = "领取后x天有效") |
| | | @TableField("period_days") |
| | | private Integer periodDays; |
| | | |
| | | @ApiModelProperty(value = "开始发放时间") |
| | | @TableField("send_start_time") |
| | | private LocalDateTime sendStartTime; |
| | | |
| | | @ApiModelProperty(value = "结束发放时间") |
| | | @TableField("send_end_time") |
| | | private LocalDateTime sendEndTime; |
| | | |
| | | @ApiModelProperty(value = "1免费发放2积分兑换") |
| | | @TableField("send_type") |
| | | private Integer sendType; |
| | | |
| | | @ApiModelProperty(value = "兑换所需积分") |
| | | @TableField("need_point") |
| | | private BigDecimal needPoint; |
| | | |
| | | @ApiModelProperty(value = "可领用户 1全部 2指定人员 3指定会员 4 新人注册") |
| | | @TableField("person_type") |
| | | private Integer personType; |
| | | |
| | | @ApiModelProperty(value = "可领取对应的ids,用find_in_set查询") |
| | | @TableField("person_ids") |
| | | private String personIds; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField("order_id") |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "评分") |
| | | @TableField("grade") |
| | | private Integer grade; |
| | | private BigDecimal grade; |
| | | |
| | | @ApiModelProperty(value = "评价内容") |
| | | @TableField("comment") |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | @ApiModelProperty("服务次数") |
| | | @TableField(exist = false) |
| | | private Integer serveCount; |
| | | @ApiModelProperty("平均分") |
| | | @TableField(exist = false) |
| | | private BigDecimal grade; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class IndexConfigSetDto { |
| | | @ApiModelProperty("公司理念") |
| | | private String companyWant; |
| | | @ApiModelProperty("宣传图片1") |
| | | private String pic1; |
| | | @ApiModelProperty("跳转类型1 - 1无2外部链接3商品详情4秒杀商品详情5领卷中心") |
| | | private Integer direct1; |
| | | @ApiModelProperty("宣传图片2") |
| | | private String pic2; |
| | | @ApiModelProperty("跳转类型2 - 1无2外部链接3商品详情4秒杀商品详情5领卷中心") |
| | | private String direct2; |
| | | @ApiModelProperty("公司简介") |
| | | private String companyInfo; |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.api.domain.GoodsVip; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsVipClient; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/27 20:29 |
| | | */ |
| | | public class CouponClientFallbackFactory implements FallbackFactory<CouponClient> { |
| | | |
| | | |
| | | @Override |
| | | public CouponClient create(Throwable cause) { |
| | | return new CouponClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<CouponInfo> detail(Integer id) { |
| | | return R.fail("查看优惠券详情失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | |
| | | import com.ruoyi.other.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<OrderClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(OrderFallbackFactory.class); |
| | | |
| | | |
| | | @Override |
| | | public OrderClient create(Throwable cause) { |
| | | log.error("商品订单调用失败:{}", cause.getMessage()); |
| | | return new OrderClient() { |
| | | |
| | | |
| | | @Override |
| | | public R getOrderIdsByTechId(Integer id) { |
| | | return R.fail("根据技师id查订单ids失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.feignClient.OrderClient; |
| | | import com.ruoyi.other.api.feignClient.StoreClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class StoreFallbackFactory implements FallbackFactory<StoreClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(StoreFallbackFactory.class); |
| | | |
| | | |
| | | @Override |
| | | public StoreClient create(Throwable cause) { |
| | | log.error("商品订单调用失败:{}", cause.getMessage()); |
| | | return new StoreClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<Shop> getStoreById(Long id) { |
| | | return R.fail("根据门店id查询详情:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.api.domain.GoodsArea; |
| | | import com.ruoyi.other.api.domain.GoodsVip; |
| | | import com.ruoyi.other.api.factory.CouponClientFallbackFactory; |
| | | import com.ruoyi.other.api.factory.GoodsVipClientFallbackFactory; |
| | | 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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/28 9:42 |
| | | */ |
| | | @FeignClient(contextId = "GoodsVipClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = CouponClientFallbackFactory.class) |
| | | public interface CouponClient { |
| | | |
| | | |
| | | @PostMapping("/coupon-info/detail") |
| | | R<CouponInfo> detail(@RequestParam("id") Integer id); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | |
| | | import com.ruoyi.other.api.factory.OrderFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 后台订单服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "OrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderFallbackFactory.class) |
| | | public interface OrderClient { |
| | | @PostMapping(value = "/management/give/vip") |
| | | public R<List<Long>> getOrderIdsByTechId(@RequestParam("id") Integer id); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.other.api.factory.StoreFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 后台订单服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "StoreClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = StoreFallbackFactory.class) |
| | | public interface StoreClient { |
| | | @PostMapping(value = "/shop/getDetailById") |
| | | public R<Shop> getStoreById(@RequestParam("id") Long id); |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.core.utils.ip.IpUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.RemoteUserService; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | |
| | |
| | | import java.util.Map; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.system.api.model.SysOperLog; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.AfterReturning; |
| | |
| | | import com.ruoyi.common.log.filter.PropertyPreExcludeFilter; |
| | | import com.ruoyi.common.log.service.AsyncLogService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | |
| | | |
| | | /** |
| | | * 操作日志记录处理 |
| | |
| | | package com.ruoyi.common.log.service; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.ruoyi.system.api.model.SysOperLog; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.system.api.RemoteLogService; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | <version>2.6</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | package com.ruoyi.account.controller; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserCancellationLogService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.feignClient.StoreClient; |
| | | import org.junit.Test; |
| | | 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 io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.vo.*; |
| | |
| | | @Api(tags = {"登录注册-小程序"}) |
| | | @RestController |
| | | @RequestMapping("/app-user") |
| | | public class AppUserController extends BaseController { |
| | | |
| | | public class AppUserController { |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/appletLogin") |
| | | @ApiOperation(value = "小程序一键登录") |
| | |
| | | public R getSMSCode(@RequestBody SMSCode smsCode){ |
| | | return appUserService.getSMSCode(smsCode); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/registerAccount") |
| | | @ApiOperation(value = "注册新账号") |
| | | public R<LoginVo> registerAccount(@RequestBody RegisterAccount registerAccount){ |
| | | return appUserService.registerAccount(registerAccount); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getReferrer/{id}") |
| | | @ApiOperation(value = "获取推荐人信息") |
| | |
| | | phone = phone.substring(0, 3) + "****" + phone.substring(7); |
| | | return R.ok(appUser.getName() + "-" + phone); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getNearbyReferrer") |
| | | @ApiOperation(value = "获取附近推荐人列表") |
| | |
| | | List<NearbyReferrerVo> list = appUserService.getNearbyReferrer(nearbyReferrer); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/info") |
| | | @ApiOperation(value = "我的资料", tags = {"小程序-个人中心首页-我的资料"}) |
| | | public R<AppUser> info(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser user = appUserService.getById(userId); |
| | | return R.ok(user); |
| | | } |
| | | @Resource |
| | | private UserCancellationLogService userCancellationLogService; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/unregis") |
| | | @ApiOperation(value = "注销", tags = {"小程序-个人中心首页-我的资料"}) |
| | | public R unregis(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser user = appUserService.getById(userId); |
| | | |
| | | //添加注销记录 |
| | | UserCancellationLog userCancellationLog = new UserCancellationLog(); |
| | | userCancellationLog.setAppUserId(user.getId()); |
| | | userCancellationLog.setVipId(user.getVipId()); |
| | | userCancellationLogService.save(userCancellationLog); |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/index") |
| | | @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"}) |
| | | public R<AppUser> index(){ |
| | | System.err.println("=-===="); |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | //当前用户信息 |
| | | AppUser user = appUserService.getById(userId); |
| | | //当前用户的推荐人信息 |
| | | if (user.getInviteUserId()!=null){ |
| | | AppUser inviteUser = appUserService.getById(user.getInviteUserId()); |
| | | user.setInviteUserName(inviteUser.getName()); |
| | | } |
| | | //当前绑定门店的店铺信息 |
| | | if (user.getShopId()!=null){ |
| | | R<Shop> storeById = storeClient.getStoreById(user.getShopId()); |
| | | if (storeById.getData()!=null){ |
| | | user.setShopName(storeById.getData().getName()); |
| | | } |
| | | } |
| | | Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getTopInviteId, 1).count(); |
| | | Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getTopInviteId, userId).count(); |
| | | user.setCount1(count1); |
| | | user.setCount2(count2); |
| | | user.setCount3(count3); |
| | | user.setCount4(count4); |
| | | user.setCount5(count5); |
| | | user.setCount6(count6); |
| | | user.setCount7(count7); |
| | | return R.ok(user); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import com.ruoyi.account.service.UserAddressService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private UserAddressService userAddressService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | /** |
| | |
| | | return R.ok(userAddress); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R add(@RequestBody UserAddress userAddress){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | userAddress.setAppUserId(userId); |
| | | userAddressService.save(userAddress); |
| | | return R.ok(); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/edit") |
| | | @ApiOperation(value = "编辑", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R edit(@RequestBody UserAddress userAddress){ |
| | | userAddressService.updateById(userAddress); |
| | | return R.ok(); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/delete") |
| | | @ApiOperation(value = "删除", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R edit(@RequestParam Integer id){ |
| | | userAddressService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/set") |
| | | @ApiOperation(value = "设为默认", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R set(@RequestParam Integer id){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<UserAddress> list = userAddressService.lambdaQuery().eq(UserAddress::getAppUserId, userId).list(); |
| | | for (UserAddress userAddress : list) { |
| | | userAddress.setIsDefault(0); |
| | | } |
| | | userAddressService.updateBatchById(list); |
| | | |
| | | UserAddress byId = userAddressService.getById(id); |
| | | byId.setIsDefault(1); |
| | | userAddressService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.api.vo.PaymentUserCoupon; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Banner; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/user-coupon") |
| | | public class UserCouponController { |
| | | @Resource |
| | | private UserCouponService userCouponService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private UserCouponService userCouponService; |
| | | @Resource |
| | | private CouponClient couponClient; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | @Resource |
| | | private UserPointService userPointService; |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("/mine/list") |
| | | @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵"}) |
| | | public R<Page<UserCoupon>> minelist(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | Page<UserCoupon> page = userCouponService.lambdaQuery() |
| | | .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime) |
| | | .isNotNull(status!=null&&status==2,UserCoupon::getUseTime) |
| | | .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now()) |
| | | .eq(UserCoupon::getAppUserId, userid).page(Page.of(pageNum, pageSize)); |
| | | for (UserCoupon record : page.getRecords()) { |
| | | CouponInfo data = couponClient.detail(record.getCouponId()).getData(); |
| | | CouponInfoVo vo = new CouponInfoVo(); |
| | | BeanUtils.copyProperties(data,vo); |
| | | record.setCouponInfoVo(vo); |
| | | if (record.getUseTime()==null){ |
| | | record.setStatus(1); |
| | | if (record.getEndTime().isBefore(LocalDateTime.now())){ |
| | | record.setStatus(3); |
| | | } |
| | | }else { |
| | | record.setStatus(2); |
| | | } |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/get") |
| | | @ApiOperation(value = "领取或者兑换优惠券", tags = {"小程序-个人中心-优惠劵"}) |
| | | public R<Page<UserCoupon>> get(@RequestParam Integer couponId) { |
| | | |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser byId = appUserService.getById(userid); |
| | | |
| | | CouponInfo data = couponClient.detail(couponId).getData(); |
| | | //检验当前优惠券是否存在 |
| | | if (data==null){ |
| | | return R.fail("当前优惠券不存在,请刷新后重试"); |
| | | } |
| | | if (data.getSendType()!=1&&byId.getLavePoint().compareTo(data.getNeedPoint())==-1){ |
| | | return R.fail("当前积分不足,兑换失败"); |
| | | } |
| | | //检验发放时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | if (now.isBefore(data.getSendStartTime())||now.isAfter(data.getSendEndTime())){ |
| | | return R.fail("领取失败,不在发放有效期"); |
| | | } |
| | | //如果是积分兑换,增加积分的历史记录 |
| | | if (data.getSendType()!=1){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(4); |
| | | userPoint.setHistoricalPoint(byId.getLavePoint()); |
| | | userPoint.setVariablePoint(data.getNeedPoint()); |
| | | userPoint.setAppUserId(userid); |
| | | userPoint.setObjectId(Long.valueOf(data.getId())); |
| | | userPointService.save(userPoint); |
| | | //扣除积分 |
| | | byId.setLavePoint(byId.getLavePoint().subtract(userPoint.getVariablePoint())); |
| | | appUserService.updateById(byId); |
| | | } |
| | | //增加优惠券记录,根据时间类型设置开始结束时间 |
| | | UserCoupon userCoupon = new UserCoupon(); |
| | | userCoupon.setAppUserId(userid); |
| | | if (data.getPeriodType()==1) { |
| | | userCoupon.setStartTime(data.getPeriodStartTime()); |
| | | userCoupon.setEndTime(data.getPeriodEndTime()); |
| | | }else { |
| | | userCoupon.setStartTime(now); |
| | | userCoupon.setEndTime(now.plusDays(data.getPeriodDays())); |
| | | } |
| | | userCoupon.setCouponId(data.getId()); |
| | | userCouponService.save(userCoupon); |
| | | return R.ok(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-06 |
| | | */ |
| | | public interface TAppUserService extends IService<TAppUser> { |
| | | |
| | | /** |
| | | * 微信小程序登录用户封装 |
| | | * @param appletUserDecodeData |
| | | * @return |
| | | */ |
| | | Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData,Long inviteUserId); |
| | | |
| | | /** |
| | | * 支付宝小程序登录用户封装 |
| | | * @param response |
| | | * @return |
| | | */ |
| | | // Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response, AlipayUserInfoShareResponse userInfo); |
| | | Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,String phone,Long inviteUserId); |
| | | |
| | | /** |
| | | * 封装用户信息和token |
| | | * @param appUser |
| | | * @return |
| | | */ |
| | | Map<String, Object> getUserInfo(TAppUser appUser); |
| | | |
| | | /** |
| | | * 账号判断 |
| | | * @param status |
| | | */ |
| | | public void throwInfo(Integer status); |
| | | } |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.other.api.domain.Banner; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | .list(); |
| | | return R.ok(list); |
| | | } |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加", tags = {"后台-广告管理-banner管理"}) |
| | | public R add(@RequestBody Banner banner){ |
| | | bannerService.save(banner); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/delete") |
| | | @ApiOperation(value = "删除", tags = {"后台-广告管理-banner管理"}) |
| | | public R delete(@RequestParam Integer id){ |
| | | bannerService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/edit") |
| | | @ApiOperation(value = "修改", tags = {"后台-广告管理-banner管理"}) |
| | | public R edit(@RequestBody Banner banner){ |
| | | bannerService.updateById(banner); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/detail") |
| | | @ApiOperation(value = "详情", tags = {"后台-广告管理-banner管理"}) |
| | | public R detail(@RequestParam Integer id){ |
| | | Banner byId = bannerService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | @PostMapping("/page/list") |
| | | @ApiOperation(value = "列表", tags = {"后台-广告管理--banner"}) |
| | | public R<Page<Banner>> pagelist(String name, Integer jumpType, Integer position,Integer pageNum,Integer pageSize){ |
| | | Page<Banner> page = bannerService.lambdaQuery().like(StringUtils.isNotEmpty(name), Banner::getName, name) |
| | | .eq(Banner::getJumpType, jumpType) |
| | | .eq(Banner::getPosition, position) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Banner; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.service.CouponInfoService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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 com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.service.CouponInfoService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/coupon-info") |
| | | public class CouponInfoController { |
| | | @Resource |
| | | private CouponInfoService couponInfoService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | //查看详情 |
| | | @PostMapping("/detail") |
| | | @ApiOperation(value = "详情", tags = {"后台-优惠劵"}) |
| | | public R<CouponInfo> detail(@RequestParam("id") Integer id){ |
| | | CouponInfo byId = couponInfoService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | @Resource |
| | | private CouponInfoService couponInfoService; |
| | | |
| | | @PostMapping("/gift/list") |
| | | @ApiOperation(value = "待领取列表", tags = {"小程序-个人中心-优惠劵"}) |
| | | public R<List<CouponInfo>> giftlist(){ |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser appUserById = appUserClient.getAppUserById(userid); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | //查出全部可领取的优惠劵 |
| | | List<CouponInfo> list = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 1).list(); |
| | | //查出指定人员可领取优惠券 |
| | | List<CouponInfo> list1 = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 2).apply("FIND_IN_SET('" + appUserById.getId() + "', person_ids)").list(); |
| | | //查出指定会员可领取优惠劵 |
| | | List<CouponInfo> list2 = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 3).apply("FIND_IN_SET('" + appUserById.getVipId() + "', person_ids)").list(); |
| | | List<CouponInfo> returnList= new ArrayList<>(); |
| | | count(userid, list, returnList); |
| | | count(userid, list1, returnList); |
| | | count(userid, list2, returnList); |
| | | |
| | | |
| | | return R.ok(returnList); |
| | | } |
| | | |
| | | private void count(Long userid, List<CouponInfo> list1, List<CouponInfo> returnList) { |
| | | for (CouponInfo couponInfo : list1) { |
| | | Long count = appUserClient.getCouponCount(userid, couponInfo.getId()).getData(); |
| | | couponInfo.setMaxNum(couponInfo.getMaxNum()-count.intValue()); |
| | | for (int i = 0; i < couponInfo.getMaxNum(); i++) { |
| | | returnList.add(couponInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.GoodsCategory; |
| | | import com.ruoyi.other.service.GoodsCategoryService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.GoodsCategory; |
| | | import com.ruoyi.other.service.GoodsCategoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | @Resource |
| | | private GoodsCategoryService goodsCategoryService; |
| | | |
| | | @PostMapping("/index/list") |
| | | @ApiOperation(value = "商品分类", tags = {"小程序-首页"}) |
| | | public R<List<GoodsCategory>> indexlist(){ |
| | | List<GoodsCategory> indexlist = goodsCategoryService.lambdaQuery() |
| | | .orderByDesc(GoodsCategory::getCreateTime) |
| | | .last("limit 8") |
| | | .list() |
| | | ; |
| | | return R.ok(indexlist); |
| | | } |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "商品分类列表", tags = {"小程序-商城-商城-首页-筛选"}) |
| | | public R<List<GoodsCategory>> list(){ |
| | |
| | | import com.ruoyi.other.enums.ShopStatus; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import com.ruoyi.other.vo.VerifiableShopVo; |
| | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | @PostMapping("/getDetailById") |
| | | public R<Shop> getDetailById(@RequestParam("id") Long id){ |
| | | Shop byId = shopService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 附近门店列表 |
| | | */ |
| | |
| | | /** |
| | | * 门店详情 |
| | | */ |
| | | @GetMapping("/technicianList") |
| | | @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"}) |
| | | public AjaxResult technicianList(@ApiParam("门店id") @RequestParam String shopId){ |
| | | return success(technicianService.list(new LambdaQueryWrapper<Technician>() |
| | | .eq(Technician::getShopId,shopId) |
| | | .eq(Technician::getStatus,2) |
| | | .eq(Technician::getSubscribeStatus,1))); |
| | | } |
| | | |
| | | @GetMapping("/shopDetail") |
| | | @ApiOperation(value = "门店详情", tags = {"小程序-首页-门店详情"}) |
| | | public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId, |
| | |
| | | appUserClient.editAppUserById(appUser); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getVerifiableShop") |
| | | @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"}) |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.SystemConfig; |
| | | import com.ruoyi.other.api.dto.IndexConfigSetDto; |
| | | import com.ruoyi.other.service.SystemConfigService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class SystemConfigController { |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | @GetMapping("/byType") |
| | | @ApiOperation(value = "1=启动页管理,2=首页配置,3=订单包邮设置", tags = {"小程序-启动页面","小程序-首页","订单包邮配置"}) |
| | | public R<SystemConfig> byType(Integer type){ |
| | | SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, type).last("limit 1").one(); |
| | | return R.ok(one); |
| | | @PostMapping("/index/add") |
| | | @ApiOperation(value = "添加", tags = {"后台-广告管理-首页配置"}) |
| | | public R add(@RequestBody IndexConfigSetDto indexConfigSetDto){ |
| | | //先删除type=2的数据 |
| | | List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).list(); |
| | | systemConfigService.removeBatchByIds(list); |
| | | SystemConfig systemConfig = new SystemConfig(); |
| | | systemConfig.setType(2); |
| | | systemConfig.setContent(JSON.toJSONString(indexConfigSetDto)); |
| | | systemConfigService.save(systemConfig); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/index/detail") |
| | | @ApiOperation(value = "宣传图片-公司简介", tags = {"后台-广告管理-首页配置","小程序-首页"}) |
| | | public R<IndexConfigSetDto> detail(){ |
| | | SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).one(); |
| | | if (one==null){ |
| | | return R.ok(); |
| | | } |
| | | IndexConfigSetDto indexConfigSetDto = JSONObject.parseObject(one.getContent(), IndexConfigSetDto.class); |
| | | return R.ok(indexConfigSetDto); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, type).last("limit 1").one(); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | | import com.ruoyi.other.api.feignClient.OrderClient; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.service.TechnicianSubscribeService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/technician") |
| | | public class TechnicianController extends BaseController { |
| | | public class TechnicianController { |
| | | @Resource |
| | | private TechnicianService technicianService; |
| | | @Resource |
| | | private GoodsEvaluateService goodsEvaluateService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private TechnicianSubscribeService technicianSubscribeService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @PostMapping("/shop/list") |
| | | @ApiOperation(value = "获取门店的技师列表", tags = {"小程序-门店详情-技师预约"}) |
| | | public R<Page<Technician>> shoplist(@RequestParam Integer shopId,@RequestParam Integer pageNum,@RequestParam Integer pageSize){ |
| | | //查出技师列表 |
| | | Page<Technician> page = technicianService.lambdaQuery().eq(Technician::getShopId, shopId).eq(Technician::getStatus, 2).page(Page.of(pageNum, pageSize)); |
| | | for (Technician technician : page.getRecords()) { |
| | | //查出技师订单 |
| | | R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId()); |
| | | if (orderIdsByTechId.getData().isEmpty()){ |
| | | technician.setGrade(new BigDecimal(0)); |
| | | technician.setServeCount(0); |
| | | continue; |
| | | } |
| | | //查出技师评价 |
| | | List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list(); |
| | | |
| | | //算出平均分并保留一位小数 |
| | | BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP); |
| | | technician.setGrade(avg); |
| | | technician.setServeCount(orderIdsByTechId.getData().size()); |
| | | |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @PostMapping("/shop/detail") |
| | | @ApiOperation(value = "获取门店的技师详情", tags = {"小程序-门店详情-技师预约"}) |
| | | public R<Technician> shopdetail(@RequestParam Integer techId){ |
| | | //查出技师列表 |
| | | Technician technician = technicianService.getById(techId); |
| | | |
| | | //查出技师订单 |
| | | R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId()); |
| | | if (orderIdsByTechId.getData().isEmpty()){ |
| | | technician.setGrade(new BigDecimal(0)); |
| | | technician.setServeCount(0); |
| | | return R.ok(technician); |
| | | } |
| | | //查出技师评价 |
| | | List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list(); |
| | | |
| | | //算出平均分并保留一位小数 |
| | | BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP); |
| | | technician.setGrade(avg); |
| | | technician.setServeCount(orderIdsByTechId.getData().size()); |
| | | return R.ok(technician); |
| | | } |
| | | @PostMapping("/shop/tech") |
| | | @ApiOperation(value = "预约操作", tags = {"小程序-门店详情-技师预约"}) |
| | | public R<Technician> shoptech(@RequestBody TechnicianSubscribe subscribe){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | subscribe.setAppUserId(userId); |
| | | technicianSubscribeService.save(subscribe); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 指定门店技师列表 |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/home/list") |
| | | @ApiOperation(value = "列表", notes = "列表", tags = {"小程序-个人中心-我的预约"}) |
| | | public TableDataInfo homelist(@ApiParam(value = "状态 0=待服务,1=已服务,2=已取消 4 已到期") @RequestParam Integer status){ |
| | | startPage(); |
| | | List<TechnicianSubscribeVO> list = technicianSubscribeService |
| | | .getTechnicianSubscribeByUser(SecurityUtils.getUserId(),status); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.service.VipSettingService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.service.VipSettingService; |
| | |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | public class VipSettingController { |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | @PostMapping("/info") |
| | | @ApiOperation(value = "获取各级会员信息", tags = {"小程序-个人中心首页"}) |
| | | public R<List<VipSetting>> info(){ |
| | | List<VipSetting> list = vipSettingService.list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getVipSettingById") |
| | | @ApiOperation(value = "获取会员设置") |
| | |
| | | */ |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(@Param("userId") Long userId, |
| | | @Param("shopId") Long shopId); |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(@Param("userId") Long userId, |
| | | @Param("status") Integer status); |
| | | } |
| | |
| | | * 查询用于指定门店的相关预约记录 |
| | | */ |
| | | List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId); |
| | | List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Long userId, Integer status); |
| | | |
| | | void subscribe(TechnicianSubscribe technicianSubscribe); |
| | | } |
| | |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) { |
| | | return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(userId, shopId); |
| | | } |
| | | @Override |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Long userId, Integer status) { |
| | | return technicianSubscribeMapper.getTechnicianSubscribeByUser(userId, status); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | /** |
| | | * 预约状态:0=待服务,1=已服务,2=已取消 |
| | | */ |
| | | @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消") |
| | | @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 4 已到期") |
| | | private Integer status; |
| | | } |
| | |
| | | AND tts.del_flag = 0 |
| | | ORDER BY tts.create_time DESC |
| | | </select> |
| | | |
| | | <select id="getTechnicianSubscribeByUser" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO"> |
| | | SELECT * from ( |
| | | SELECT |
| | | tts.user_address, |
| | | ts.`name` shopName, |
| | | ts.address shopAddress, |
| | | tt.name technicianName, |
| | | tts.subscribe_time, |
| | | tts.service_mode, |
| | | CASE |
| | | WHEN tts.subscribe_time lt; NOW() THEN 4 |
| | | ELSE tts.status |
| | | END AS status |
| | | FROM |
| | | t_technician_subscribe tts |
| | | LEFT JOIN t_technician tt ON tts.technician_id = tt.id AND tt.del_flag = 0 |
| | | LEFT JOIN t_shop ts ON tt.shop_id = ts.id AND ts.del_flag = 0 |
| | | WHERE |
| | | tts.app_user_id = #{userId} |
| | | AND tts.del_flag = 0 |
| | | ORDER BY tts.create_time DESC |
| | | |
| | | ) o |
| | | <where> |
| | | <if test="status !=null"> |
| | | o.status = #{status} |
| | | </if> |
| | | </where> |
| | | |
| | | </select> |
| | | </mapper> |