增加了查询预约和删除预约接口
This commit is contained in:
parent
e2810d28fb
commit
030f4c7f3b
|
@ -170,18 +170,21 @@ create table if not exists manicurist
|
|||
INDEX idx_userId (userId)
|
||||
) comment ='美甲师表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
create table if not exists manicurist_auth
|
||||
CREATE TABLE IF NOT EXISTS manicurist_auth
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT COMMENT '认证唯一标识(主键,自增)' PRIMARY KEY,
|
||||
artistId BIGINT not null comment '美甲师ID(关联美甲师表)',
|
||||
artistId BIGINT NOT NULL COMMENT '美甲师ID(关联美甲师表)',
|
||||
name VARCHAR(100) COMMENT '美甲师名称',
|
||||
certification_number VARCHAR(100) COMMENT '认证编号',
|
||||
issuing_authority VARCHAR(100) COMMENT '发证机构',
|
||||
certificate_path VARCHAR(255) COMMENT '证书文件的存储路径或链接',
|
||||
createTime DATETIME default CURRENT_TIMESTAMP not null comment '记录创建时间',
|
||||
updateTime DATETIME default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '记录更新时间',
|
||||
isDelete TINYINT default 0 comment '逻辑删除标志,0 表示未删除,1 表示已删除',
|
||||
createTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '记录创建时间',
|
||||
updateTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '记录更新时间',
|
||||
isDelete TINYINT DEFAULT 0 COMMENT '逻辑删除标志,0 表示未删除,1 表示已删除',
|
||||
INDEX idx_artistId (artistId)
|
||||
) comment ='美甲师认证表' COLLATE = utf8mb4_unicode_ci;
|
||||
) COMMENT ='美甲师认证表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
|
||||
|
||||
-- 预约表
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.Appointments;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.appointments.AppointmentsAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.AppointmentsVO;
|
||||
import com.cj.jiaqingjiayi.service.AppointmentsService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "预约接口")
|
||||
|
@ -56,4 +58,27 @@ public class AppointmentsController {
|
|||
|
||||
return ResultUtils.success(id, "预约成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询我的预约")
|
||||
@GetMapping("/query")
|
||||
public BaseResponse<List<AppointmentsVO>> queryMyAppointments(HttpServletRequest request){
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
|
||||
QueryWrapper<Appointments> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("userId", loginUser.getId());
|
||||
List<Appointments> appointmentsList = appointmentsService.list(wrapper);
|
||||
|
||||
List<AppointmentsVO> appointmentsVOList = appointmentsService.queryAppointmentsVO(appointmentsList);
|
||||
return ResultUtils.success(appointmentsVOList);
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperation(value = "取消预约")
|
||||
public BaseResponse<Boolean> removeAppointments(@RequestBody CommonRequest commonRequest) {
|
||||
|
||||
boolean flag = appointmentsService.removeId(commonRequest.getId());
|
||||
|
||||
return ResultUtils.success(flag);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,12 +72,14 @@ public class BusinessController {
|
|||
String encryptPassword = DigestUtils.md5DigestAsHex((USER_SALT + user.getUserPassword()).getBytes());
|
||||
user.setUserPassword(encryptPassword);
|
||||
|
||||
business.setState(0);
|
||||
|
||||
//更改用户权限为商家
|
||||
user.setUserRole(2);
|
||||
|
||||
//往user表中补充商家信息
|
||||
user.setUsername(business.getBusinessName());
|
||||
user.setAvatarUrl(business.getBusinessAvatar());
|
||||
// user.setAvatarUrl(business.getBusinessAvatar());
|
||||
user.setPhone(business.getBusinessPhone());
|
||||
|
||||
//插入到表中
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
|
@ -13,16 +14,15 @@ import com.cj.jiaqingjiayi.model.domain.User;
|
|||
|
||||
import com.cj.jiaqingjiayi.model.domain.UserRating;
|
||||
import com.cj.jiaqingjiayi.model.request.userRating.UserRatingAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.userRating.UserRatingReviewRequest;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.UserRatingService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -79,7 +79,7 @@ public class UserRatingController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 展示当前用户评分
|
||||
* 展示当前用户评论
|
||||
* @param request 当前用户
|
||||
* @return 评分列表
|
||||
*/
|
||||
|
@ -91,4 +91,38 @@ public class UserRatingController {
|
|||
List<UserRating> list = userRatingService.list(Wrappers.<UserRating>lambdaQuery().eq(UserRating::getUserId, userId));
|
||||
return ResultUtils.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示当前店铺评分
|
||||
*/
|
||||
@ApiOperation(value = "展示商家评论")
|
||||
@GetMapping("/listBusinessRating")
|
||||
public BaseResponse<List<UserRating>> listUserRatingBusiness (@RequestParam Long businessId) {
|
||||
|
||||
List<UserRating> list = userRatingService.list(Wrappers.<UserRating>lambdaQuery().eq(UserRating::getBusinessId, businessId));
|
||||
return ResultUtils.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*商家回复
|
||||
*/
|
||||
@ApiOperation(value = "商家回复")
|
||||
@PostMapping("/business/reply")
|
||||
// @AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<Boolean> businessReply (@RequestBody UserRatingReviewRequest userRatingReviewRequest, HttpServletRequest request) {
|
||||
if (userRatingReviewRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = userRatingReviewRequest.getId();
|
||||
String businessReview = userRatingReviewRequest.getBusinessReview();
|
||||
userRatingService.validUserRatingByBusiness(id, request);
|
||||
LambdaQueryWrapper<UserRating> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserRating::getId, id);
|
||||
UserRating userRating = userRatingService.getOne(wrapper);
|
||||
userRating.setBusinessReview(businessReview);
|
||||
boolean update = userRatingService.updateById(userRating);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,11 +46,6 @@ public class BusinessAuth implements Serializable {
|
|||
*/
|
||||
private String backIdCard;
|
||||
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
private String bankCard;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
|
@ -24,6 +24,11 @@ public class ManicuristAuth implements Serializable {
|
|||
*/
|
||||
private Long artistId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String nameUser;
|
||||
|
||||
/**
|
||||
* 认证编号
|
||||
*/
|
||||
|
|
|
@ -32,11 +32,6 @@ public class BusinessAddRequest implements Serializable {
|
|||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 门店头像
|
||||
*/
|
||||
private String businessAvatar;
|
||||
|
||||
/**
|
||||
* 门店手机号
|
||||
*/
|
||||
|
@ -47,21 +42,6 @@ public class BusinessAddRequest implements Serializable {
|
|||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 门店简介
|
||||
*/
|
||||
private String businessProfile;
|
||||
|
||||
/**
|
||||
* 商家相册
|
||||
*/
|
||||
private String businessImages;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 店主名
|
||||
*/
|
||||
|
@ -82,18 +62,4 @@ public class BusinessAddRequest implements Serializable {
|
|||
*/
|
||||
private String backIdCard;
|
||||
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
private String bankCard;
|
||||
|
||||
/**
|
||||
* 开始营业时间
|
||||
*/
|
||||
private String startBusiness;
|
||||
|
||||
/**
|
||||
* 结束营业时间
|
||||
*/
|
||||
private String endBusiness;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ public class ManicuristAddRequest implements Serializable {
|
|||
*/
|
||||
private String manicuristName;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String nameUser;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,11 @@ public class UserRatingAddRequest implements Serializable {
|
|||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 美甲师ID(关联美甲师表)
|
||||
*/
|
||||
private Long manicuristId;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
|
@ -26,4 +31,14 @@ public class UserRatingAddRequest implements Serializable {
|
|||
* 评分
|
||||
*/
|
||||
private Integer rating;
|
||||
|
||||
/**
|
||||
* 美甲师评分
|
||||
*/
|
||||
private Integer manicuristRating;
|
||||
|
||||
/**
|
||||
* 评论
|
||||
*/
|
||||
private String review;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.cj.jiaqingjiayi.model.request.userRating;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class UserRatingReviewRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家回复内容
|
||||
*/
|
||||
private String businessReview;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -2254826620684237034L;
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.cj.jiaqingjiayi.model.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class AppointmentsVO {
|
||||
|
||||
/**
|
||||
* 预约ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID(关联用户表)
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 商家ID(关联商家表)
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 商家名
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 美甲师ID, 如果为空到店分配
|
||||
*/
|
||||
private Long manicuristId;
|
||||
|
||||
/**
|
||||
* 美甲师名
|
||||
*/
|
||||
private String manicuristName;
|
||||
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private Date appointmentTime;
|
||||
|
||||
/**
|
||||
* 服务方式(0 - 线上, 1 - 到店)
|
||||
*/
|
||||
private Integer serviceMode;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String notes;
|
||||
|
||||
/**
|
||||
* 预约状态(0 - 已确认, 1 - 已完成, 2 - 已取消)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
}
|
|
@ -2,6 +2,11 @@ package com.cj.jiaqingjiayi.service;
|
|||
|
||||
import com.cj.jiaqingjiayi.model.domain.Appointments;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.cj.jiaqingjiayi.model.domain.CommoditiesGroup;
|
||||
import com.cj.jiaqingjiayi.model.vo.AppointmentsVO;
|
||||
import com.cj.jiaqingjiayi.model.vo.GroupVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
|
@ -13,6 +18,18 @@ public interface AppointmentsService extends IService<Appointments> {
|
|||
//校验
|
||||
void valid(Appointments appointments);
|
||||
|
||||
//预约
|
||||
//添加预约
|
||||
Long addAppointments(Appointments appointments);
|
||||
|
||||
boolean removeId(Long id);
|
||||
|
||||
/**
|
||||
* 获取预约视图
|
||||
*/
|
||||
AppointmentsVO getAppointmentsVO(Appointments appointments);
|
||||
|
||||
/**
|
||||
* 获取预约视图列表
|
||||
*/
|
||||
List<AppointmentsVO> queryAppointmentsVO(List<Appointments> list);
|
||||
}
|
||||
|
|
|
@ -57,4 +57,5 @@ public interface BusinessService extends IService<Business> {
|
|||
* 查询所有商家
|
||||
*/
|
||||
List<BusinessVO> findAllBusiness();
|
||||
|
||||
}
|
||||
|
|
|
@ -61,5 +61,5 @@ public interface ManicuristService extends IService<Manicurist> {
|
|||
/**
|
||||
*更新美甲师等级
|
||||
*/
|
||||
public void updateManicuristLevel(Long manicuristId);
|
||||
void updateManicuristLevel(Long manicuristId);
|
||||
}
|
||||
|
|
|
@ -16,4 +16,6 @@ public interface UserRatingService extends IService<UserRating> {
|
|||
* 校验
|
||||
*/
|
||||
void validUserRating(UserRating userRating, HttpServletRequest request);
|
||||
|
||||
void validUserRatingByBusiness(Long userRatingId, HttpServletRequest request);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.cj.jiaqingjiayi.service.impl;
|
|||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
|
@ -9,6 +10,8 @@ import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
|||
import com.cj.jiaqingjiayi.model.domain.Appointments;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.Manicurist;
|
||||
import com.cj.jiaqingjiayi.model.vo.AppointmentsVO;
|
||||
import com.cj.jiaqingjiayi.model.vo.GroupVO;
|
||||
import com.cj.jiaqingjiayi.service.AppointmentsService;
|
||||
import com.cj.jiaqingjiayi.mapper.AppointmentsMapper;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
|
@ -16,12 +19,16 @@ import com.cj.jiaqingjiayi.service.ManicuristService;
|
|||
import com.cj.jiaqingjiayi.utils.RegexUtils;
|
||||
import javassist.expr.NewArray;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
|
@ -90,6 +97,32 @@ public class AppointmentsServiceImpl extends ServiceImpl<AppointmentsMapper, App
|
|||
|
||||
return appointments.getId();
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeId(Long id) {
|
||||
boolean remove = this.removeById(id);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppointmentsVO getAppointmentsVO(Appointments appointments) {
|
||||
AppointmentsVO appointmentsVO = new AppointmentsVO();
|
||||
if (appointments == null) {
|
||||
return null;
|
||||
}
|
||||
BeanUtils.copyProperties(appointments,appointmentsVO);
|
||||
return appointmentsVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppointmentsVO> queryAppointmentsVO(List<Appointments> appointmentsList) {
|
||||
if (CollectionUtils.isEmpty(appointmentsList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return appointmentsList.stream().map(this::getAppointmentsVO).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.cj.jiaqingjiayi.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -7,10 +8,7 @@ import com.cj.jiaqingjiayi.common.ErrorCode;
|
|||
import com.cj.jiaqingjiayi.contant.CommonConstant;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.BusinessAuth;
|
||||
import com.cj.jiaqingjiayi.model.domain.BusinessLevel;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.domain.*;
|
||||
import com.cj.jiaqingjiayi.model.request.business.BusinessQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.BusinessVO;
|
||||
import com.cj.jiaqingjiayi.service.*;
|
||||
|
@ -71,6 +69,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
|
|||
|
||||
@Override
|
||||
public void validUser(User user, boolean add) {
|
||||
|
||||
ThrowUtils.throwIf(user == null , ErrorCode.NULL_ERROR);
|
||||
|
||||
String userAccount = user.getUserAccount();
|
||||
|
@ -100,15 +99,12 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
|
|||
public void validBusiness(Business business, boolean add) {
|
||||
Long id = business.getId();
|
||||
String businessName = business.getBusinessName();
|
||||
String businessAvatar = business.getBusinessAvatar();
|
||||
String businessPhone = business.getBusinessPhone();
|
||||
String address = business.getAddress();
|
||||
String startBusiness = business.getStartBusiness();
|
||||
String endBusiness = business.getEndBusiness();
|
||||
|
||||
//只在添加时严格校验 保证商家信息是全的
|
||||
if (add) {
|
||||
if (StringUtils.isAnyBlank(businessName, businessAvatar, businessPhone, address, startBusiness, endBusiness)) {
|
||||
if (StringUtils.isAnyBlank(businessName, businessPhone, address)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "商家信息不全");
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +142,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
|
|||
String license = businessAuth.getLicense();
|
||||
String frontIdCard = businessAuth.getFrontIdCard();
|
||||
String backIdCard = businessAuth.getBackIdCard();
|
||||
String bankCard = businessAuth.getBankCard();
|
||||
if (StringUtils.isAnyBlank(shopkeeper, license, frontIdCard, bankCard, backIdCard)) {
|
||||
if (StringUtils.isAnyBlank(shopkeeper, license, frontIdCard, backIdCard)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "商家认证信息不全");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ public class CommoditiesGroupServiceImpl extends ServiceImpl<CommoditiesGroupMap
|
|||
//只在添加时校验是否存在
|
||||
if(flag) {
|
||||
|
||||
queryWrapper.eq("businessId", commoditiesGroup.getBusinessId());
|
||||
queryWrapper.eq("groupName", commoditiesGroup.getGroupName());
|
||||
|
||||
long count = this.count(queryWrapper);
|
||||
|
|
|
@ -95,16 +95,16 @@ public class ManicuristServiceImpl extends ServiceImpl<ManicuristMapper, Manicur
|
|||
Long userId = loginUser.getId();
|
||||
manicurist.setUserId(userId);
|
||||
|
||||
//更改用户权限为美甲师
|
||||
// //更改用户权限为美甲师
|
||||
// loginUser.setUserRole(3);
|
||||
|
||||
//往user表中补充美甲师信息
|
||||
loginUser.setUsername(manicurist.getManicuristName());
|
||||
loginUser.setAvatarUrl(manicurist.getManicuristAvatar());
|
||||
loginUser.setPhone(manicurist.getPhone());
|
||||
// loginUser.setUsername(manicurist.getManicuristName());
|
||||
// loginUser.setAvatarUrl(manicurist.getManicuristAvatar());
|
||||
// loginUser.setPhone(manicurist.getPhone());
|
||||
|
||||
boolean save = userService.updateById(loginUser);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "绑定失败");
|
||||
// boolean save = userService.updateById(loginUser);
|
||||
// ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR, "绑定失败");
|
||||
|
||||
boolean save1 = this.save(manicurist);
|
||||
ThrowUtils.throwIf(!save1, ErrorCode.OPERATION_ERROR, "绑定id失败");
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package com.cj.jiaqingjiayi.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.Orders;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.domain.UserRating;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.OrdersService;
|
||||
import com.cj.jiaqingjiayi.service.UserRatingService;
|
||||
import com.cj.jiaqingjiayi.mapper.UserRatingMapper;
|
||||
|
@ -32,6 +35,9 @@ public class UserRatingServiceImpl extends ServiceImpl<UserRatingMapper, UserRat
|
|||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
@Override
|
||||
public void validUserRating(UserRating userRating, HttpServletRequest request) {
|
||||
|
||||
|
@ -39,8 +45,10 @@ public class UserRatingServiceImpl extends ServiceImpl<UserRatingMapper, UserRat
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "分数不在可选范围内");
|
||||
}
|
||||
|
||||
Orders ordersById = ordersService.getById(userRating.getOrderId());
|
||||
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
if (!loginUser.getId().equals(userRating.getUserId())) {
|
||||
if (!loginUser.getId().equals(ordersById.getUserId())) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "当前登录用户与评分中的用户不匹配");
|
||||
}
|
||||
Orders orders = ordersService.getOne(Wrappers.<Orders>lambdaQuery().eq(Orders::getId, userRating.getOrderId()));
|
||||
|
@ -50,6 +58,24 @@ public class UserRatingServiceImpl extends ServiceImpl<UserRatingMapper, UserRat
|
|||
long count = this.count(Wrappers.<UserRating>lambdaQuery().eq(UserRating::getOrderId, userRating.getOrderId()));
|
||||
ThrowUtils.throwIf(count > 0, ErrorCode.SYSTEM_ERROR, "该订单已评分");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validUserRatingByBusiness(Long userRatingId, HttpServletRequest request) {
|
||||
LambdaQueryWrapper<UserRating> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserRating::getId, userRatingId);
|
||||
UserRating userRating = this.getOne(queryWrapper);
|
||||
Business loginBusiness = businessService.getLoginBusiness(request);
|
||||
Long businessId = loginBusiness.getId();
|
||||
if (!businessId.equals(userRating.getBusinessId())) {
|
||||
throw new BusinessException(ErrorCode.OPERATION_ERROR,"该用户评分不属于当前商家");
|
||||
}
|
||||
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(userRating.getReview())) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "当前用户没有评论");
|
||||
}
|
||||
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(userRating.getBusinessReview())) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR,"当前用户评分已回复");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<resultMap id="BaseResultMap" type="com.cj.jiaqingjiayi.model.domain.ManicuristAuth">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="nameUser" column="nameUser" jdbcType="VARCHAR"/>
|
||||
<result property="artistId" column="artistId" jdbcType="BIGINT"/>
|
||||
<result property="certification_number" column="certification_number" jdbcType="VARCHAR"/>
|
||||
<result property="issuing_authority" column="issuing_authority" jdbcType="VARCHAR"/>
|
||||
|
@ -18,6 +19,7 @@
|
|||
<sql id="Base_Column_List">
|
||||
id,artistId,certification_number,
|
||||
issuing_authority,certificate_path,
|
||||
createTime,updateTime,isDelete
|
||||
createTime,updateTime,isDelete,
|
||||
nameUser
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue
Block a user