Merge remote-tracking branch 'origin/master'
| | |
| | | log.error("获取订单列表失败:{}", cause.getMessage()); |
| | | throw new RuntimeException("获取订单列表失败"); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Order>> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId) { |
| | | return R.fail("获取订单列表失败"); |
| | | } |
| | | |
| | | @Override |
| | | public R<Void> updateOrderStatus(Order order) { |
| | | return R.fail("更新订单状态失败"); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/order/getOrderListByIds") |
| | | public R<List<Order>> getOrderListByIds(@RequestBody List<Long> orderIds); |
| | | |
| | | /** |
| | | * 根据用户id和商品id查找订单列表 |
| | | */ |
| | | @GetMapping("/order/getOrderListByUserIdAndGoodsId") |
| | | public R<List<Order>> getOrderListByUserIdAndGoodsId(@RequestParam("userId") Long userId, @RequestParam("goodsId") Integer goodsId); |
| | | |
| | | /** |
| | | * 更新订单状态 |
| | | */ |
| | | @PostMapping("/order/updateOrderStatus") |
| | | public R<Void> updateOrderStatus(@RequestBody Order order); |
| | | } |
| | |
| | | @TableField("order_type") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty(value = "1待发货2待收货3待使用4已完成5已取消6已退款7售后中") |
| | | @ApiModelProperty(value = "1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价") |
| | | @TableField("order_status") |
| | | private Integer orderStatus; |
| | | |
| | |
| | | package com.ruoyi.order.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId("id") |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | |
| | | @TableField(exist = false) |
| | | private String idStr; |
| | | |
| | |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("收货人姓名") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("收货人电话") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("收货地址") |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("快递单号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String latitude; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | private Integer shopId; |
| | | |
| | | } |
| | |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_goods_evaluate") |
| | | @ApiModel(value="GoodsEvaluate对象", description="") |
| | | @TableName("t_technician_score") |
| | | @ApiModel(value="TechnicianScore", description="") |
| | | public class TechnicianScore implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModelProperty(value = "主键") |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | @ApiModelProperty(value = "预约时间") |
| | | @TableField("subscribe_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime subscribeTime; |
| | | |
| | | @ApiModelProperty(value = "服务方式(1=上门服务,2=到店服务)") |
| | |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | throw new ServiceException(errMsg); |
| | | } |
| | | |
| | | if (!matches(user, password)) |
| | | { |
| | | retryCount = retryCount + 1; |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount)); |
| | | redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
| | | throw new ServiceException("密码错误"); |
| | | } |
| | | // if (!matches(user, password)) |
| | | // { |
| | | // retryCount = retryCount + 1; |
| | | // recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount)); |
| | | // redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
| | | // throw new ServiceException("密码错误"); |
| | | // } |
| | | else |
| | | { |
| | | clearLoginRecordCache(username); |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.account.service.VipSettingService; |
| | | import com.ruoyi.account.vo.vip.Level; |
| | | import com.ruoyi.account.vo.vip.VipLevel; |
| | |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.log4j.Log4j2; |
| | | 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 javax.annotation.Resource; |
| | |
| | | private VipGoodClient vipGoodClient; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private VipCenterService vipCenterService; |
| | | |
| | | |
| | | @GetMapping("getVipLevelList") |
| | |
| | | public R<VipLevel> vipLevelList() { |
| | | try { |
| | | R<List<VipSetting>> r = remoteVipSettingClient.list(); |
| | | if (!checkSuccess(r)) { |
| | | if (checkSuccess(r)) { |
| | | return R.fail("会员等级获取失败"); |
| | | } |
| | | List<VipSetting> vipSettingList = r.getData(); |
| | |
| | | } |
| | | |
| | | R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(3); |
| | | if (!checkSuccess(baseSettingR)) { |
| | | if (checkSuccess(baseSettingR)) { |
| | | log.error("【会员设置说明】获取失败:{}", baseSettingR.getMsg()); |
| | | return R.fail("会员等级获取失败"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public R<Void> test() { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); |
| | | if (appUser.getShopPoint() < 500){ |
| | | return R.fail("消费积分不足500"); |
| | | @GetMapping("/check") |
| | | @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"}) |
| | | public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userid = loginUser.getUserid(); |
| | | if (type == 4){ |
| | | return R.ok(vipCenterService.checkReadyToBeProxy(userid, type)); |
| | | }else if (type == 5){ |
| | | return R.ok(vipCenterService.checkReadyToBeAgent(userid)); |
| | | }else if (type == 6){ |
| | | return R.ok(vipCenterService.checkReadyToBeTotalAgent(userid)); |
| | | }else if (type == 7){ |
| | | return R.ok(vipCenterService.checkReadyToBePartner(userid)); |
| | | }else { |
| | | return R.fail("参数错误"); |
| | | } |
| | | if (appUser.getSharePoint() < 500){ |
| | | return R.fail("返佣积分不足500"); |
| | | } |
| | | // 当前用户的直推用户 |
| | | // List<AppUser> bottomUsers = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | // .eq(AppUser::getInviteUserId, loginUserApplet.getUserid()) |
| | | // .eq(AppUser::getVipId)); |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | public interface VipCenterService { |
| | | |
| | | /** |
| | | * 校验准代理的申请条件 |
| | | */ |
| | | Boolean checkReadyToBeProxy(Long userId,Integer vipId); |
| | | |
| | | /** |
| | | * 校验代理的申请条件 |
| | | */ |
| | | Boolean checkReadyToBeAgent(Long userId); |
| | | |
| | | /** |
| | | * 校验总代理的申请条件 |
| | | */ |
| | | Boolean checkReadyToBeTotalAgent(Long userId); |
| | | |
| | | /** |
| | | * 校验合伙人的申请条件 |
| | | */ |
| | | Boolean checkReadyToBePartner(Long userId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.account.service.VipSettingService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.VipGood; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.VipGoodClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class VipCenterServiceImpl implements VipCenterService { |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | @Resource |
| | | private VipGoodClient vipGoodClient; |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBeProxy(Long userId,Integer vipId) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBeAgent(Long userId) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBeTotalAgent(Long userId) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBePartner(Long userId) { |
| | | return false; |
| | | } |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 更新订单状态 |
| | | */ |
| | | @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理-更新订单状态"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单对象", name = "order", required = true, dataType = "Order"), |
| | | }) |
| | | @PostMapping("/updateOrderStatus") |
| | | public R<Void> updateOrderStatus(@RequestBody Order order){ |
| | | Order order1 = orderService.getById(order.getId()); |
| | | order1.setOrderStatus(order.getOrderStatus()); |
| | | orderService.updateById(order1); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | .in(OrderGood::getGoodsId, goodsIds)); |
| | | return R.ok(orderGoods); |
| | | } |
| | | |
| | | @GetMapping("/getOrderListByUserIdAndGoodsId") |
| | | public R<List<OrderGood>> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId){ |
| | | return R.ok(orderGoodService.getOrderListByUserIdAndGoodsId(userId, goodsId)); |
| | | } |
| | | } |
| | | |
| | |
| | | return R.fail("权限不足"); |
| | | } |
| | | RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderId) |
| | | .eq(RefundPass::getDelFlag, 0).last(" order by createTime desc limit 0,1")); |
| | | .eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0,1")); |
| | | one.setIdStr(one.getId().toString()); |
| | | return R.ok(one); |
| | | } |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PutMapping("/deliverGoodsRefundPass/{id}") |
| | | @PutMapping("/deliverGoodsRefundPass/{id}/{code}") |
| | | @ApiOperation(value = "售后已发货操作", tags = {"我的订单-个人中心-小程序"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "code", value = "快递单号", required = true, dataType = "string"), |
| | | }) |
| | | public R deliverGoodsRefundPass(@PathVariable("id") Long id){ |
| | | public R deliverGoodsRefundPass(@PathVariable("id") Long id, @PathVariable("code") String code){ |
| | | RefundPass refundPass = refundPassService.getById(id); |
| | | if(null == refundPass){ |
| | | return R.fail(); |
| | |
| | | return R.fail("操作失败"); |
| | | } |
| | | refundPass.setStatus(5); |
| | | refundPass.setCode(code); |
| | | refundPassService.updateById(refundPass); |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface OrderGoodMapper extends BaseMapper<OrderGood> { |
| | | public List<OrderGood> getOrderListByUserIdAndGoodsId(@Param("userId") Long userId,@Param("goodsId") Integer goodsId); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | */ |
| | | public interface OrderGoodService extends IService<OrderGood> { |
| | | |
| | | public List<OrderGood> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.mapper.OrderGoodMapper; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | import com.ruoyi.order.service.OrderGoodService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class OrderGoodServiceImpl extends ServiceImpl<OrderGoodMapper, OrderGood> implements OrderGoodService { |
| | | private final OrderGoodMapper orderGoodMapper; |
| | | |
| | | @Override |
| | | public List<OrderGood> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId) { |
| | | return orderGoodMapper.getOrderListByUserIdAndGoodsId(userId, goodsId); |
| | | } |
| | | } |
| | |
| | | orderDetailVO.setShopAddress(shop.getAddress()); |
| | | orderDetailVO.setLongitude(shop.getLongitude()); |
| | | orderDetailVO.setLatitude(shop.getLatitude()); |
| | | orderDetailVO.setShopId(shop.getId()); |
| | | return orderDetailVO; |
| | | } |
| | | |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.service.RefundPassService; |
| | | import com.ruoyi.order.vo.ApplyRefundPass; |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private OrderService orderService; |
| | | |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | refundPass.setPassStatus(1); |
| | | refundPass.setDelFlag(0); |
| | | refundPass.setCreateTime(LocalDateTime.now()); |
| | | BaseSetting baseSetting = baseSettingClient.getBaseSetting(5).getData(); |
| | | JSONObject jsonObject = JSON.parseObject(baseSetting.getContent()); |
| | | refundPass.setName(jsonObject.getString("name")); |
| | | refundPass.setPhone(jsonObject.getString("phone")); |
| | | refundPass.setAddress(jsonObject.getString("address")); |
| | | this.save(refundPass); |
| | | order.setOrderStatus(7); |
| | | orderService.updateById(order); |
| | |
| | | <?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.OrderGoodMapper"> |
| | | <mapper namespace="com.ruoyi.order.mapper.OrderGoodMapper"> |
| | | |
| | | |
| | | |
| | | <select id="getOrderListByUserIdAndGoodsId" resultType="com.ruoyi.order.model.OrderGood"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | t_order_good og |
| | | LEFT JOIN t_order o ON og.order_id = o.id |
| | | WHERE og.goods_id = #{goodsId} and o.app_user_id = #{userId} |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.core.web.page.TableDataInfo; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import com.ruoyi.other.vo.GoodsEvaluateVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | */ |
| | | @PostMapping("/addGoodsEvaluate") |
| | | @ApiOperation(value = "发布商品评价", tags = {"小程序-发布商品评价"}) |
| | | public R<Void> addGoodsEvaluate(GoodsEvaluate goodsEvaluate){ |
| | | goodsEvaluateService.save(goodsEvaluate); |
| | | public R<Void> addGoodsEvaluate(@RequestBody GoodsEvaluateVO goodsEvaluateVO){ |
| | | goodsEvaluateService.addGoodsEvaluate(goodsEvaluateVO); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 评论详情 |
| | | */ |
| | | @GetMapping("/detail/{id}") |
| | | @GetMapping("/detail/{orderId}") |
| | | @ApiOperation(value = "评论详情", tags = {"小程序-评论详情"}) |
| | | public R<GoodsEvaluate> detail(@PathVariable("id") Long id){ |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id); |
| | | return R.ok(goodsEvaluate); |
| | | public R<List<GoodsEvaluate>> detail(@PathVariable("orderId") Long orderId){ |
| | | List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>() |
| | | .eq(GoodsEvaluate::getStatus, 2) |
| | | .eq(GoodsEvaluate::getOrderId, orderId)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.feignClient.OrderClient; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import com.ruoyi.other.api.domain.TechnicianScore; |
| | | import com.ruoyi.other.service.TechnicianScoreService; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.service.TechnicianSubscribeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private TechnicianService technicianService; |
| | | @Resource |
| | | private GoodsEvaluateService goodsEvaluateService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private TechnicianSubscribeService technicianSubscribeService; |
| | | private TechnicianScoreService technicianScoreService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | // @PostMapping("/shop/list") |
| | | // @ApiOperation(value = "获取门店的技师列表", tags = {"小程序-门店详情-技师预约"}) |
| | | // public R<Page<Technician>> shoplist(@RequestParam Integer shopId,@RequestParam Integer pageNum,@RequestParam Integer pageSize){ |
| | |
| | | public R<TechnicianDetailVO> technicianDetail(@ApiParam("技师id") @RequestParam Long technicianId) { |
| | | return R.ok(technicianService.technicianDetail(technicianId)); |
| | | } |
| | | |
| | | /** |
| | | * 打分 |
| | | */ |
| | | @PostMapping("/grade") |
| | | @ApiOperation(value = "打分", tags = {"打分-小程序"}) |
| | | public R<Void> grade(@RequestBody TechnicianScore technicianScore) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | TechnicianScore technicianScoreServiceOne = technicianScoreService.getOne(new LambdaQueryWrapper<TechnicianScore>() |
| | | .eq(TechnicianScore::getAppUserId, userid) |
| | | .eq(TechnicianScore::getTechnicianId, technicianScore.getTechnicianId())); |
| | | if (technicianScoreServiceOne != null) { |
| | | return R.fail("已打过分,无法再次打分"); |
| | | } |
| | | technicianScore.setAppUserId(userid); |
| | | technicianScoreService.save(technicianScore); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.TechnicianScore; |
| | | |
| | | public interface TechnicianScoreMapper extends BaseMapper<TechnicianScore> { |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.vo.GoodsEvaluateVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsEvaluateService extends IService<GoodsEvaluate> { |
| | | |
| | | void addGoodsEvaluate(@RequestBody GoodsEvaluateVO goodsEvaluateVO); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.TechnicianScore; |
| | | |
| | | public interface TechnicianScoreService extends IService<TechnicianScore> { |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.other.mapper.GoodsEvaluateMapper; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import com.ruoyi.other.vo.GoodsEvaluateVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService { |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) { |
| | | List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates(); |
| | | for (GoodsEvaluate goodsEvaluate : evaluates) { |
| | | goodsEvaluate.setStatus(2); |
| | | } |
| | | this.saveBatch(evaluates); |
| | | if (CollectionUtil.isNotEmpty(evaluates)){ |
| | | Order order = new Order(); |
| | | order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId()); |
| | | order.setOrderStatus(8); |
| | | R<Void> r = remoteOrderGoodsClient.updateOrderStatus(order); |
| | | if (R.isError(r)){ |
| | | throw new RuntimeException("修改订单状态失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | } |
| | | |
| | | Goods goods = this.getById(goodsId); |
| | | |
| | | List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() |
| | | .eq(GoodsShop::getGoodsId, goodsId)); |
| | | List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() |
| | | .in(Shop::getId, shopIds)); |
| | | GoodsVO goodsVO = new GoodsVO(); |
| | | goodsVO.setShopList(shopList); |
| | | BeanUtils.copyBeanProp(goodsVO, goods); |
| | | goodsVO.setGoodsId(goods.getId()); |
| | | goodsVO.setGoodsName(goods.getName()); |
| | | goodsVO.setSellingPrice(sellingPrice); |
| | | goodsVO.setIntegral(integral); |
| | | |
| | | List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() |
| | | .eq(GoodsShop::getGoodsId, goodsId)); |
| | | if (!CollectionUtils.isEmpty(goodsShopList)){ |
| | | List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() |
| | | .in(Shop::getId, shopIds)); |
| | | |
| | | goodsVO.setShopList(shopList); |
| | | } |
| | | return goodsVO; |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.api.domain.TechnicianScore; |
| | | import com.ruoyi.other.mapper.TechnicianScoreMapper; |
| | | import com.ruoyi.other.service.TechnicianScoreService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class TechnicianScoreServiceImpl extends ServiceImpl<TechnicianScoreMapper, TechnicianScore> implements TechnicianScoreService { |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.UserAddressClient; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TechnicianScore; |
| | | import com.ruoyi.other.mapper.TechnicianMapper; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.service.TechnicianScoreService; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | public class TechnicianServiceImpl extends ServiceImpl<TechnicianMapper, Technician> implements TechnicianService { |
| | | @Resource |
| | | private TechnicianMapper technicianMapper; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private UserAddressClient userAddressClient; |
| | | @Resource |
| | | private TechnicianScoreService technicianScoreService; |
| | | |
| | | @Override |
| | | public List<TechnicianVO> getTechnicianListByShopId(Long shopId) { |
| | |
| | | |
| | | @Override |
| | | public TechnicianDetailVO technicianDetail(Long technicianId) { |
| | | return technicianMapper.selectTechnicianDetail(technicianId); |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | R<UserAddress> defaultUserAddressR = userAddressClient.getDefaultUserAddress(loginUserApplet.getUserid()); |
| | | if (R.isError(defaultUserAddressR)){ |
| | | throw new RuntimeException("获取默认地址失败"); |
| | | } |
| | | TechnicianDetailVO technicianDetailVO = technicianMapper.selectTechnicianDetail(technicianId); |
| | | technicianDetailVO.setAddress(defaultUserAddressR.getData()); |
| | | |
| | | TechnicianScore technicianScoreServiceOne = technicianScoreService.getOne(new LambdaQueryWrapper<TechnicianScore>() |
| | | .eq(TechnicianScore::getAppUserId, loginUserApplet.getUserid()) |
| | | .eq(TechnicianScore::getTechnicianId, technicianId)); |
| | | if (technicianScoreServiceOne != null){ |
| | | technicianDetailVO.setScoreStatus(2); |
| | | }else { |
| | | technicianDetailVO.setScoreStatus(1); |
| | | } |
| | | return technicianDetailVO; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "商品评价") |
| | | public class GoodsEvaluateVO { |
| | | private List<GoodsEvaluate> evaluates; |
| | | } |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @ApiModelProperty(value = "技师详情图") |
| | | private String infoPicture; |
| | | |
| | | @ApiModelProperty(value = "预约状态(1=可预约,2=不可预约)") |
| | | private Integer subscribeStatus; |
| | | |
| | | /** |
| | | * 默认地址 |
| | | */ |
| | | @ApiModelProperty(value = "默认地址") |
| | | private UserAddress address; |
| | | |
| | | /** |
| | | * 打分状态:1=未打分,2=已打分 |
| | | */ |
| | | @ApiModelProperty(value = "打分状态:1=未打分,2=已打分") |
| | | private Integer scoreStatus; |
| | | |
| | | } |
| | |
| | | WHERE |
| | | tt.`status` = 2 |
| | | AND tt.del_flag = 0 |
| | | AND tt.subscribe_status = 1 |
| | | AND tt.shop_id = #{shopId} |
| | | GROUP BY |
| | | tt.id, |
| | |
| | | <select id="selectTechnicianDetail" resultType="com.ruoyi.other.vo.TechnicianDetailVO"> |
| | | SELECT |
| | | tt.id, |
| | | tt.subscribe_status, |
| | | tt.`name`, |
| | | tt.introduction, |
| | | tt.home_picture, |
| | |
| | | FROM |
| | | t_technician tt |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id |
| | | AND tts.`status` != 0 |
| | | LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id |
| | | WHERE |
| | | tts.`status` != 0 |
| | | AND tt.`status` = 2 |
| | | tt.`status` = 2 |
| | | AND tt.del_flag = 0 |
| | | AND tt.subscribe_status = 1 |
| | | AND tt.id = #{technicianId} |
| | | GROUP BY |
| | | tt.id, |
| | | tt.subscribe_status, |
| | | tt.`name`, |
| | | tt.introduction, |
| | | tt.home_picture, |
| | | tt.introduction |
| | | tt.introduction, |
| | | tt.info_picture |
| | | </select> |
| | | </mapper> |