小程序登陆;商城订单;订单详情;退款
This commit is contained in:
parent
224866c670
commit
105b9453bf
@ -3,8 +3,10 @@ package com.cpop.core.abstracts;
|
|||||||
import com.cpop.core.base.entity.LoginUser;
|
import com.cpop.core.base.entity.LoginUser;
|
||||||
import com.cpop.core.base.enums.UserType;
|
import com.cpop.core.base.enums.UserType;
|
||||||
import com.cpop.core.base.table.SysUser;
|
import com.cpop.core.base.table.SysUser;
|
||||||
|
import com.cpop.core.gateway.miniProgram.MiniUserLoginInfoBuild;
|
||||||
import com.cpop.core.gateway.sys.SysLoginInfoBuild;
|
import com.cpop.core.gateway.sys.SysLoginInfoBuild;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +31,7 @@ public abstract class AbstractLoginInfoBuild {
|
|||||||
return new SysLoginInfoBuild();
|
return new SysLoginInfoBuild();
|
||||||
//小程序用户
|
//小程序用户
|
||||||
case MINI_USER:
|
case MINI_USER:
|
||||||
return new SysLoginInfoBuild();
|
return new MiniUserLoginInfoBuild();
|
||||||
default:
|
default:
|
||||||
return new SysLoginInfoBuild();
|
return new SysLoginInfoBuild();
|
||||||
}
|
}
|
||||||
@ -38,6 +40,6 @@ public abstract class AbstractLoginInfoBuild {
|
|||||||
/**
|
/**
|
||||||
* 构建用户
|
* 构建用户
|
||||||
*/
|
*/
|
||||||
public abstract LoginUser buildLoginUser(SysUser user);
|
public abstract LoginUser buildLoginUser(SysUser user, Map<String, Object> credentials);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,52 @@
|
|||||||
|
package com.cpop.core.base.entity.loginInfo;
|
||||||
|
|
||||||
|
import com.cpop.core.base.table.SysUser;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @createTime 2023/10/24 9:16
|
||||||
|
* @description 小程序登陆用户信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class MiniUserLoginInfo extends SysUser {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序用户id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序appid
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌id
|
||||||
|
*/
|
||||||
|
private String brandId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.cpop.common.constant.Constants;
|
import com.cpop.common.constant.Constants;
|
||||||
import com.cpop.common.utils.StringUtils;
|
import com.cpop.common.utils.StringUtils;
|
||||||
import com.cpop.common.utils.ip.IpUtils;
|
import com.cpop.common.utils.ip.IpUtils;
|
||||||
|
import com.cpop.core.base.R;
|
||||||
import com.cpop.core.base.entity.LoginUser;
|
import com.cpop.core.base.entity.LoginUser;
|
||||||
import com.cpop.core.base.enums.UserType;
|
import com.cpop.core.base.enums.UserType;
|
||||||
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken;
|
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken;
|
||||||
@ -23,9 +24,11 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
|||||||
|
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: DB
|
* @author: DB
|
||||||
@ -57,12 +60,18 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Jws<Claims> jws = jwtUtils.getClaimsByToken(jwt);
|
Jws<Claims> jws = jwtUtils.getClaimsByToken(jwt);
|
||||||
|
if (jws == null) {
|
||||||
|
returnJwtException(response,"token 失效");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Claims claim = jws.getBody();
|
Claims claim = jws.getBody();
|
||||||
if (claim == null) {
|
if (claim == null) {
|
||||||
throw new JwtException("token 异常");
|
returnJwtException(response,"token 异常");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (jwtUtils.isTokenExpired(claim)) {
|
if (jwtUtils.isTokenExpired(claim)) {
|
||||||
throw new JwtException("token 已过期");
|
returnJwtException(response,"token 已过期");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
String username = claim.getSubject();
|
String username = claim.getSubject();
|
||||||
UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString());
|
UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString());
|
||||||
@ -82,6 +91,21 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jwt异常直接返回
|
||||||
|
* @param response 响应
|
||||||
|
* @param msg 错误信息
|
||||||
|
*/
|
||||||
|
private void returnJwtException(HttpServletResponse response,String msg) throws IOException {
|
||||||
|
response.setContentType("application/json;charset=UTF-8");
|
||||||
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
|
R<String> result = R.fail(401, msg);
|
||||||
|
outputStream.write(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8));
|
||||||
|
outputStream.flush();
|
||||||
|
outputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @descriptions 多种获取用户信息
|
* @descriptions 多种获取用户信息
|
||||||
* @author DB
|
* @author DB
|
||||||
@ -101,7 +125,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
case MINI_USER:
|
case MINI_USER:
|
||||||
break;
|
break;
|
||||||
case MALL_USER:
|
case MALL_USER:
|
||||||
loginUser = coreService.loadUser(username, userType);
|
loginUser = coreService.loadUserByUsername(username, userType);
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return loginUser;
|
return loginUser;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.cpop.core.gateway.miniProgram;
|
package com.cpop.core.gateway.miniProgram;
|
||||||
|
|
||||||
|
import com.cpop.core.base.enums.UserType;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||||
import org.springframework.security.authentication.AuthenticationServiceException;
|
import org.springframework.security.authentication.AuthenticationServiceException;
|
||||||
@ -12,6 +13,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,10 +42,24 @@ public class MiniProgramAuthenticationFilter extends AbstractAuthenticationProce
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
String username = (String) authenticationBean.get("username");
|
String principal = (String) authenticationBean.get("phone");
|
||||||
String password = (String) authenticationBean.get("password");
|
|
||||||
username = username.trim();
|
String openId = (String) authenticationBean.get("openId");
|
||||||
MiniProgramAuthenticationToken authRequest = new MiniProgramAuthenticationToken(username, password);
|
String appId = (String) authenticationBean.get("appId");
|
||||||
|
String brandId = (String) authenticationBean.get("brandId");
|
||||||
|
String nickName = (String) authenticationBean.get("nickName");
|
||||||
|
String avatar = (String) authenticationBean.get("avatar");
|
||||||
|
UserType userType = UserType.valueOf(authenticationBean.get("userType").toString());
|
||||||
|
//传递信息
|
||||||
|
HashMap<String, Object> credentials = new HashMap<>(2);
|
||||||
|
credentials.put("appId", appId);
|
||||||
|
credentials.put("openId", openId);
|
||||||
|
credentials.put("userType", userType);
|
||||||
|
credentials.put("brandId", brandId);
|
||||||
|
credentials.put("nickName", nickName);
|
||||||
|
credentials.put("avatar", avatar);
|
||||||
|
principal = principal.trim();
|
||||||
|
MiniProgramAuthenticationToken authRequest = new MiniProgramAuthenticationToken(principal, credentials);
|
||||||
this.setDetails(request, authRequest);
|
this.setDetails(request, authRequest);
|
||||||
return this.getAuthenticationManager().authenticate(authRequest);
|
return this.getAuthenticationManager().authenticate(authRequest);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,14 @@ package com.cpop.core.gateway.miniProgram;
|
|||||||
|
|
||||||
import com.cpop.core.base.entity.LoginUser;
|
import com.cpop.core.base.entity.LoginUser;
|
||||||
import com.cpop.core.base.enums.UserType;
|
import com.cpop.core.base.enums.UserType;
|
||||||
|
import com.cpop.core.service.CoreService;
|
||||||
|
import com.cpop.core.utils.SpringUtils;
|
||||||
import org.springframework.security.authentication.AuthenticationProvider;
|
import org.springframework.security.authentication.AuthenticationProvider;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DB
|
* @author DB
|
||||||
* @Description: 自定义校验过程
|
* @Description: 自定义校验过程
|
||||||
@ -16,14 +20,13 @@ public class MiniProgramAuthenticationProvider implements AuthenticationProvider
|
|||||||
@Override
|
@Override
|
||||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||||
// 这个获取表单输入中返回的用户名;
|
// 这个获取表单输入中返回的用户名;
|
||||||
String username = authentication.getName();
|
String phone =(String) authentication.getPrincipal();
|
||||||
// 这个是表单中输入的密码;
|
// 这个是表单中输入的密码;
|
||||||
String password = (String)authentication.getCredentials();
|
Map<String,Object> credentials = (Map<String, Object>) authentication.getCredentials();
|
||||||
//TODO:此处添加小程序认证失败返回 throw new RockBladeAuthenticationException("测试抛异常", UserType.MINI_USER);
|
UserType userType = (UserType) credentials.get("userType");
|
||||||
//设置用户详情
|
LoginUser loginUser = SpringUtils.getBean(CoreService.class).loadUserByPhone(phone, userType, credentials);
|
||||||
LoginUser loginUser = new LoginUser();
|
loginUser.setUserType(UserType.MINI_USER);
|
||||||
loginUser.setUserName(username).setUserType(UserType.MINI_USER);
|
MiniProgramAuthenticationToken result = new MiniProgramAuthenticationToken(phone, loginUser);
|
||||||
MiniProgramAuthenticationToken result = new MiniProgramAuthenticationToken(username, loginUser);
|
|
||||||
result.setDetails(loginUser);
|
result.setDetails(loginUser);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,80 @@
|
|||||||
|
package com.cpop.core.gateway.miniProgram;
|
||||||
|
|
||||||
|
import com.cpop.common.constant.Constants;
|
||||||
|
import com.cpop.common.utils.bean.BeanUtils;
|
||||||
|
import com.cpop.core.abstracts.AbstractLoginInfoBuild;
|
||||||
|
import com.cpop.core.base.entity.LoginUser;
|
||||||
|
import com.cpop.core.base.entity.loginInfo.MiniUserLoginInfo;
|
||||||
|
import com.cpop.core.base.exception.CpopAuthenticationException;
|
||||||
|
import com.cpop.core.base.table.SysUser;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.core.row.DbChain;
|
||||||
|
import com.mybatisflex.core.row.Row;
|
||||||
|
import com.mybatisflex.core.row.RowKey;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @createTime 2023/10/24 11:09
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
public class MiniUserLoginInfoBuild extends AbstractLoginInfoBuild {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建登陆小程序用户信息
|
||||||
|
* @param user 系统用户
|
||||||
|
* @return 登陆用户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LoginUser buildLoginUser(SysUser user, Map<String, Object> credentials) {
|
||||||
|
return getMiniUserInfo(user, credentials);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LoginUser getMiniUserInfo(SysUser sysUser, Map<String, Object> credentials) {
|
||||||
|
MiniUserLoginInfo loginInfo = BeanUtils.mapToClass(sysUser, MiniUserLoginInfo.class);
|
||||||
|
loginInfo.setUserId(sysUser.getId());
|
||||||
|
//构建用户信息
|
||||||
|
Row row = DbChain.table("cp_mini_user")
|
||||||
|
.select("id","open_id","app_id","user_id","brand_id","nick_name","avatar")
|
||||||
|
.from("cp_mini_user")
|
||||||
|
.where("user_id = ?", loginInfo.getUserId())
|
||||||
|
.and("brand_id = ?",credentials.get("brandId"))
|
||||||
|
.and("app_id = ?",credentials.get("appId"))
|
||||||
|
.and("open_id = ?",credentials.get("openId"))
|
||||||
|
.and("is_delete = 0")
|
||||||
|
.one();
|
||||||
|
if (row == null) {
|
||||||
|
//保存小程序用户信息
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
DbChain.table("cp_mini_user")
|
||||||
|
.setId(RowKey.SNOW_FLAKE_ID)
|
||||||
|
.set("user_id", loginInfo.getUserId())
|
||||||
|
.set("open_id", credentials.get("openId"))
|
||||||
|
.set("app_id", credentials.get("appId"))
|
||||||
|
.set("brand_id", credentials.get("brandId"))
|
||||||
|
.set("nick_name", credentials.get("nickName"))
|
||||||
|
.set("avatar", credentials.get("avatar"))
|
||||||
|
.set("create_time", now)
|
||||||
|
.set("update_time", now)
|
||||||
|
.set("create_user_id", 1)
|
||||||
|
.set("update_user_id", 1)
|
||||||
|
.save();
|
||||||
|
loginInfo.setOpenId((String) credentials.get("openId"))
|
||||||
|
.setAppId((String) credentials.get("appId"))
|
||||||
|
.setUserId(loginInfo.getUserId())
|
||||||
|
.setBrandId((String) credentials.get("brandId"))
|
||||||
|
.setNickName((String) credentials.get("nickName"))
|
||||||
|
.setAvatar((String) credentials.get("avatar"));
|
||||||
|
} else {
|
||||||
|
loginInfo.setOpenId(row.getString("openId"))
|
||||||
|
.setAppId(row.getString("appId"))
|
||||||
|
.setUserId(row.getString("userId"))
|
||||||
|
.setBrandId(row.getString("brandId"))
|
||||||
|
.setNickName(row.getString("nickName"))
|
||||||
|
.setAvatar(row.getString("avatar"));
|
||||||
|
}
|
||||||
|
return new LoginUser(loginInfo, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,7 +28,7 @@ public class SysAuthenticationProvider implements AuthenticationProvider {
|
|||||||
Map<String,Object> credentials = (Map<String, Object>) authentication.getCredentials();
|
Map<String,Object> credentials = (Map<String, Object>) authentication.getCredentials();
|
||||||
UserType userType = (UserType) credentials.get("userType");
|
UserType userType = (UserType) credentials.get("userType");
|
||||||
//认证用户名密码
|
//认证用户名密码
|
||||||
LoginUser loginUser = SpringUtils.getBean(CoreService.class).loadUser(principal, userType);
|
LoginUser loginUser = SpringUtils.getBean(CoreService.class).loadUserByUsername(principal, userType);
|
||||||
//账号密码校验
|
//账号密码校验
|
||||||
SpringUtils.getBean(PasswordEncoder.class).matches((String) credentials.get("password"), loginUser.getUser().getPassword());
|
SpringUtils.getBean(PasswordEncoder.class).matches((String) credentials.get("password"), loginUser.getUser().getPassword());
|
||||||
SysAuthenticationToken result = new SysAuthenticationToken(principal, loginUser);
|
SysAuthenticationToken result = new SysAuthenticationToken(principal, loginUser);
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import com.mybatisflex.core.row.RowUtil;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ import java.util.stream.Collectors;
|
|||||||
public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
|
public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginUser buildLoginUser(SysUser sysUser) {
|
public LoginUser buildLoginUser(SysUser sysUser, Map<String, Object> credentials) {
|
||||||
switch (sysUser.getUserType()) {
|
switch (sysUser.getUserType()) {
|
||||||
case OAM_USER:
|
case OAM_USER:
|
||||||
return getOamStaffLoginInfo(sysUser);
|
return getOamStaffLoginInfo(sysUser);
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.cpop.core.handler;
|
|||||||
import com.cpop.core.base.R;
|
import com.cpop.core.base.R;
|
||||||
import com.cpop.core.base.exception.ServiceException;
|
import com.cpop.core.base.exception.ServiceException;
|
||||||
import com.cpop.common.enums.ErrorCodeEnum;
|
import com.cpop.common.enums.ErrorCodeEnum;
|
||||||
|
import io.jsonwebtoken.JwtException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
@ -34,6 +35,15 @@ public class GlobalExceptionHandler {
|
|||||||
return null != code ? R.fail(code, e.getMessage()) : R.fail(e.getMessage());
|
return null != code ? R.fail(code, e.getMessage()) : R.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限不足
|
||||||
|
* @param e 权限不足异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(AccessDeniedException.class)
|
||||||
|
public R handleException(AccessDeniedException e) {
|
||||||
|
return R.fail(ErrorCodeEnum.HTTP_401.getInfo());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拦截未知的运行时异常
|
* 拦截未知的运行时异常
|
||||||
* @param e
|
* @param e
|
||||||
@ -47,6 +57,26 @@ public class GlobalExceptionHandler {
|
|||||||
return R.fail(e.getMessage());
|
return R.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义验证异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||||
|
public R handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
String message = Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage();
|
||||||
|
return R.fail(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义验证异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(BindException.class)
|
||||||
|
public R handleBindException(BindException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
String message = e.getAllErrors().get(0).getDefaultMessage();
|
||||||
|
return R.fail(message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统异常
|
* 系统异常
|
||||||
* @param e
|
* @param e
|
||||||
@ -60,34 +90,5 @@ public class GlobalExceptionHandler {
|
|||||||
return R.fail(e.getMessage());
|
return R.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 权限不足
|
|
||||||
* @param e 权限不足异常
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(AccessDeniedException.class)
|
|
||||||
public R handleException(AccessDeniedException e) {
|
|
||||||
return R.fail(ErrorCodeEnum.HTTP_401.getInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义验证异常
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(BindException.class)
|
|
||||||
public R handleBindException(BindException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
String message = e.getAllErrors().get(0).getDefaultMessage();
|
|
||||||
return R.fail(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义验证异常
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
|
||||||
public R handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
String message = Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage();
|
|
||||||
return R.fail(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO:可以自行后续拓展
|
//TODO:可以自行后续拓展
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.cpop.common.utils.ip.IpUtils;
|
|||||||
import com.cpop.core.base.R;
|
import com.cpop.core.base.R;
|
||||||
import com.cpop.core.base.entity.LoginSuccess;
|
import com.cpop.core.base.entity.LoginSuccess;
|
||||||
import com.cpop.core.base.entity.LoginUser;
|
import com.cpop.core.base.entity.LoginUser;
|
||||||
|
import com.cpop.core.base.entity.loginInfo.MiniUserLoginInfo;
|
||||||
import com.cpop.core.base.enums.OperationLogEnum;
|
import com.cpop.core.base.enums.OperationLogEnum;
|
||||||
import com.cpop.core.service.CoreService;
|
import com.cpop.core.service.CoreService;
|
||||||
import com.cpop.core.service.RedisService;
|
import com.cpop.core.service.RedisService;
|
||||||
@ -82,7 +83,8 @@ public class LoginSuccessHandler implements AuthenticationSuccessHandler {
|
|||||||
break;
|
break;
|
||||||
case MINI_USER:
|
case MINI_USER:
|
||||||
//将登录成功用户存入缓存
|
//将登录成功用户存入缓存
|
||||||
redisService.setCacheObject(loginUser.getUserType().getKey() + loginUser.getUsername(), loginUser);
|
MiniUserLoginInfo user = (MiniUserLoginInfo) loginUser.getUser();
|
||||||
|
redisService.setCacheObject(loginUser.getUserType().getKey() + user.getBrandId() + "-" + user.getAppId() + "-" + user.getOpenId(), loginUser);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public interface CoreMapper {
|
|||||||
* @Author DB
|
* @Author DB
|
||||||
* @Date: 2023/8/27 23:39
|
* @Date: 2023/8/27 23:39
|
||||||
*/
|
*/
|
||||||
SysUser getSysUser(@Param("username") String username, @Param("userType") UserType userType);
|
SysUser getSysUserByUsername(@Param("username") String username, @Param("userType") UserType userType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 更新登录地址
|
* @Description: 更新登录地址
|
||||||
@ -121,4 +121,13 @@ public interface CoreMapper {
|
|||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
void removeSysUserById(String id);
|
void removeSysUserById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据用户名获取用户信息
|
||||||
|
* @param phoneNumber 手机号
|
||||||
|
* @return SysUser
|
||||||
|
* @Author: DB
|
||||||
|
* @Date: 2023/8/27 23:37
|
||||||
|
*/
|
||||||
|
SysUser getSysUserByPhone(@Param("phoneNumber") String phoneNumber, @Param("userType") UserType userType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import com.cpop.core.base.table.SysOperationLog;
|
|||||||
import com.cpop.core.base.table.SysUser;
|
import com.cpop.core.base.table.SysUser;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DB
|
* @author DB
|
||||||
* @Description:
|
* @Description:
|
||||||
@ -42,7 +44,7 @@ public interface CoreService {
|
|||||||
* @Author: DB
|
* @Author: DB
|
||||||
* @Date: 2023/8/27 23:37
|
* @Date: 2023/8/27 23:37
|
||||||
*/
|
*/
|
||||||
SysUser getSysUser(String username, UserType userType);
|
SysUser getSysUserByUsername(String username, UserType userType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 更新登录地址
|
* @Description: 更新登录地址
|
||||||
@ -118,5 +120,24 @@ public interface CoreService {
|
|||||||
* @param userType 用户类型
|
* @param userType 用户类型
|
||||||
* @return 登陆用户
|
* @return 登陆用户
|
||||||
*/
|
*/
|
||||||
LoginUser loadUser(String userName, UserType userType);
|
LoginUser loadUserByUsername(String userName, UserType userType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 根据手机号与用户类型获取用户信息
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/19 9:57
|
||||||
|
* @param phoneNumber 手机号
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @return 登陆用户
|
||||||
|
*/
|
||||||
|
LoginUser loadUserByPhone(String phoneNumber, UserType userType, Map<String, Object> credentials);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据用户名获取用户信息
|
||||||
|
* @param phoneNumber 手机号
|
||||||
|
* @return SysUser
|
||||||
|
* @Author: DB
|
||||||
|
* @Date: 2023/8/27 23:37
|
||||||
|
*/
|
||||||
|
SysUser getSysUserByPhone(String phoneNumber, UserType userType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,10 +24,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,8 +98,8 @@ public class CoreServiceImpl implements CoreService {
|
|||||||
* @Date: 2023/8/27 23:37
|
* @Date: 2023/8/27 23:37
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUser getSysUser(String username, UserType userType) {
|
public SysUser getSysUserByUsername(String username, UserType userType) {
|
||||||
return coreMapper.getSysUser(username, userType);
|
return coreMapper.getSysUserByUsername(username, userType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,15 +211,15 @@ public class CoreServiceImpl implements CoreService {
|
|||||||
* @return 登陆用户
|
* @return 登陆用户
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public LoginUser loadUser(String username, UserType userType) {
|
public LoginUser loadUserByUsername(String username, UserType userType) {
|
||||||
//统一获取系统用户信息
|
//统一获取系统用户信息
|
||||||
SysUser sysUser = this.getSysUser(username, userType);
|
SysUser sysUser = this.getSysUserByUsername(username, userType);
|
||||||
if (sysUser == null) {
|
if (sysUser == null) {
|
||||||
throw new UsernameNotFoundException(MessageUtils.message("i18n_alert_accountOrPwdError"));
|
throw new UsernameNotFoundException(MessageUtils.message("i18n_alert_accountOrPwdError"));
|
||||||
}
|
}
|
||||||
//构建登陆用户信息
|
//构建登陆用户信息
|
||||||
AbstractLoginInfoBuild instance = AbstractLoginInfoBuild.getInstance(userType);
|
AbstractLoginInfoBuild instance = AbstractLoginInfoBuild.getInstance(userType);
|
||||||
LoginUser loginUser = instance.buildLoginUser(sysUser);
|
LoginUser loginUser = instance.buildLoginUser(sysUser, null);
|
||||||
loginUser.setUserId(sysUser.getId())
|
loginUser.setUserId(sysUser.getId())
|
||||||
.setUserType(userType)
|
.setUserType(userType)
|
||||||
.setUserName(username)
|
.setUserName(username)
|
||||||
@ -230,4 +227,55 @@ public class CoreServiceImpl implements CoreService {
|
|||||||
.setStatus(sysUser.getStatus());
|
.setStatus(sysUser.getStatus());
|
||||||
return loginUser;
|
return loginUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 根据手机号与用户类型获取用户信息
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/19 9:57
|
||||||
|
* @param phoneNumber 手机号
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @return 登陆用户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LoginUser loadUserByPhone(String phoneNumber, UserType userType, Map<String, Object> credentials) {
|
||||||
|
//统一获取系统用户信息
|
||||||
|
SysUser sysUser = this.getSysUserByPhone(phoneNumber, userType);
|
||||||
|
if (sysUser == null) {
|
||||||
|
//如果是小程序自动注册用户信息
|
||||||
|
if (userType == UserType.MINI_USER) {
|
||||||
|
sysUser = new SysUser();
|
||||||
|
sysUser.setId(IdUtils.fastSimpleUUID())
|
||||||
|
.setUserName(phoneNumber)
|
||||||
|
.setPhoneNumber(phoneNumber)
|
||||||
|
.setStatus(true)
|
||||||
|
.setUserType(userType)
|
||||||
|
.setCreateUserId("1");
|
||||||
|
sysUser.setUpdateUserId("1");
|
||||||
|
this.coreMapper.insertSysUser(sysUser);
|
||||||
|
} else {
|
||||||
|
throw new UsernameNotFoundException("获取用户信息失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//构建登陆用户信息
|
||||||
|
AbstractLoginInfoBuild instance = AbstractLoginInfoBuild.getInstance(userType);
|
||||||
|
LoginUser loginUser = instance.buildLoginUser(sysUser, credentials);
|
||||||
|
loginUser.setUserId(sysUser.getId())
|
||||||
|
.setUserType(userType)
|
||||||
|
.setUserName(sysUser.getUserName())
|
||||||
|
.setLoginTime(System.currentTimeMillis())
|
||||||
|
.setStatus(sysUser.getStatus());
|
||||||
|
return loginUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据用户名获取用户信息
|
||||||
|
* @param phoneNumber 手机号
|
||||||
|
* @return SysUser
|
||||||
|
* @Author: DB
|
||||||
|
* @Date: 2023/8/27 23:37
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser getSysUserByPhone(String phoneNumber, UserType userType) {
|
||||||
|
return coreMapper.getSysUserByPhone(phoneNumber, userType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class OamStaffDetailsServiceImpl implements UserDetailsService {
|
|||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
//统一获取系统用户信息
|
//统一获取系统用户信息
|
||||||
SysUser sysUser = coreService.getSysUser(username, UserType.OAM_USER);
|
SysUser sysUser = coreService.getSysUserByUsername(username, UserType.OAM_USER);
|
||||||
if (sysUser == null) {
|
if (sysUser == null) {
|
||||||
throw new UsernameNotFoundException(MessageUtils.message("i18n_alert_accountOrPwdError"));
|
throw new UsernameNotFoundException(MessageUtils.message("i18n_alert_accountOrPwdError"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!--根据用户名获取用户信息-->
|
<!--根据用户名获取用户信息-->
|
||||||
<select id="getSysUser" resultType="com.cpop.core.base.table.SysUser">
|
<select id="getSysUserByUsername" resultType="com.cpop.core.base.table.SysUser">
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
user_name AS userName,
|
user_name AS userName,
|
||||||
@ -57,6 +57,33 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--根据用户名获取用户信息-->
|
||||||
|
<select id="getSysUserByPhone" resultType="com.cpop.core.base.table.SysUser">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
user_name AS userName,
|
||||||
|
password,
|
||||||
|
nick_name AS nickName,
|
||||||
|
email,
|
||||||
|
phone_number AS phoneNumber,
|
||||||
|
sex,
|
||||||
|
avatar,
|
||||||
|
salt,
|
||||||
|
status,
|
||||||
|
login_ip AS loginIp,
|
||||||
|
user_type AS userType,
|
||||||
|
create_time AS createTime,
|
||||||
|
create_user_id AS createUserId,
|
||||||
|
update_time AS updateTime,
|
||||||
|
update_user_id AS updateUserId
|
||||||
|
FROM
|
||||||
|
cp_sys_user
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
AND phone_number = #{phoneNumber}
|
||||||
|
AND user_type = #{userType}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--加载参数缓存数据-->
|
<!--加载参数缓存数据-->
|
||||||
<select id="loadingConfigCache" resultType="com.cpop.core.base.table.SysConfig">
|
<select id="loadingConfigCache" resultType="com.cpop.core.base.table.SysConfig">
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@ -17,10 +17,6 @@ cpop:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: Cpop-Mall-Prod
|
name: Cpop-Mall-Prod
|
||||||
datasource:
|
|
||||||
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
|
||||||
username: root
|
|
||||||
password: Customer0401
|
|
||||||
#redis配置
|
#redis配置
|
||||||
redis:
|
redis:
|
||||||
#地址
|
#地址
|
||||||
@ -58,3 +54,12 @@ server:
|
|||||||
mybatis-flex:
|
mybatis-flex:
|
||||||
configuration:
|
configuration:
|
||||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||||
|
datasource:
|
||||||
|
mall:
|
||||||
|
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: Customer0401
|
||||||
|
jambox:
|
||||||
|
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_association?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: Customer0401
|
||||||
@ -58,6 +58,15 @@ server:
|
|||||||
mybatis-flex:
|
mybatis-flex:
|
||||||
configuration:
|
configuration:
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
datasource:
|
||||||
|
mall:
|
||||||
|
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: Customer0401
|
||||||
|
jambox:
|
||||||
|
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
|
||||||
|
username: root
|
||||||
|
password: Customer0401
|
||||||
|
|
||||||
# springdoc-openapi项目配置
|
# springdoc-openapi项目配置
|
||||||
knife4j:
|
knife4j:
|
||||||
|
|||||||
@ -19,6 +19,10 @@
|
|||||||
<groupId>com.cpop</groupId>
|
<groupId>com.cpop</groupId>
|
||||||
<artifactId>Cpop-Core</artifactId>
|
<artifactId>Cpop-Core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-System</artifactId>
|
||||||
|
</dependency>
|
||||||
<!--系统包-->
|
<!--系统包-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cpop</groupId>
|
<groupId>com.cpop</groupId>
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.cpop.mall.business.bo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @createTime 2023/10/24 14:58
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value = "商城订单分页请求对象")
|
||||||
|
public class OrderPageBo implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("商品名")
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付用户
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付用户")
|
||||||
|
private String payUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付用户手机号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付用户手机号")
|
||||||
|
private String payUserPhone;
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.cpop.mall.business.bo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @createTime 2023/10/24 16:11
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value = "商城订单拒绝退款请求对象")
|
||||||
|
public class OrderRejectRefundBo implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "订单号不能为空")
|
||||||
|
@ApiModelProperty(value = "订单号",required = true)
|
||||||
|
private String id ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒绝原因
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "拒绝原因不能为空")
|
||||||
|
@ApiModelProperty(value = "拒绝原因",required = true)
|
||||||
|
private String rejectReason;
|
||||||
|
}
|
||||||
@ -24,4 +24,10 @@ public class ProductPageBo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("商品名")
|
@ApiModelProperty("商品名")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品类型(0:课卡;1:周边;2:优惠卷:3:其他
|
||||||
|
*/
|
||||||
|
private Integer productType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.cpop.mall.business.controller.backstage;
|
||||||
|
|
||||||
|
import com.cpop.core.base.R;
|
||||||
|
import com.cpop.mall.business.bo.OrderPageBo;
|
||||||
|
import com.cpop.mall.business.bo.ProductPageBo;
|
||||||
|
import com.cpop.mall.business.vo.OrderPageVo;
|
||||||
|
import com.cpop.mall.business.vo.ProductPageVo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import com.cpop.mall.business.entity.Order;
|
||||||
|
import com.cpop.mall.business.service.OrderService;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单表 控制层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "商城后台订单管理模块")
|
||||||
|
@RequestMapping("/backstage/order")
|
||||||
|
public class BackstageOrderController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderService orderService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 分页查询商城-订单
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 11:56
|
||||||
|
* @param bo 分页参数
|
||||||
|
* @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>>
|
||||||
|
*/
|
||||||
|
@GetMapping("/getOrderPage")
|
||||||
|
@ApiOperation("分页查询商城-订单")
|
||||||
|
public R<Page<OrderPageVo>> getProductPage(@ApiParam("分页参数") OrderPageBo bo) {
|
||||||
|
Page<OrderPageVo> page = orderService.getOrderPage(bo);
|
||||||
|
return R.ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
package com.cpop.mall.business.controller.backstage;
|
||||||
|
|
||||||
|
import com.cpop.core.base.R;
|
||||||
|
import com.cpop.mall.business.bo.OrderRejectRefundBo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import com.cpop.mall.business.entity.OrderRefund;
|
||||||
|
import com.cpop.mall.business.service.OrderRefundService;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单退款记录表 控制层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "商城订单退款记录表接口")
|
||||||
|
@RequestMapping("/backstage/orderRefund")
|
||||||
|
public class BackstageOrderRefundController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderRefundService orderRefundService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 同意退款
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 12:15
|
||||||
|
* @param id 订单id
|
||||||
|
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||||
|
*/
|
||||||
|
@PutMapping("/agreeRefund/{id}")
|
||||||
|
@ApiOperation("同意退款")
|
||||||
|
public R<Void> agreeRefund(@PathVariable String id) {
|
||||||
|
orderRefundService.agreeRefund(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 拒绝退款
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 12:15
|
||||||
|
* @param bo 请求参数
|
||||||
|
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||||
|
*/
|
||||||
|
@PutMapping("/rejectRefund")
|
||||||
|
@ApiOperation("拒绝退款")
|
||||||
|
public R<Void> rejectRefund(@RequestBody @Validated OrderRejectRefundBo bo) {
|
||||||
|
orderRefundService.rejectRefund(bo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
package com.cpop.mall.business.controller.mini;
|
||||||
|
|
||||||
|
import com.cpop.core.base.R;
|
||||||
|
import com.cpop.core.utils.SpringUtils;
|
||||||
|
import com.cpop.jambox.business.vo.CardTemplateListVo;
|
||||||
|
import com.cpop.mall.business.bo.ProductBo;
|
||||||
|
import com.cpop.mall.business.bo.ProductPageBo;
|
||||||
|
import com.cpop.mall.business.service.ProductRecordService;
|
||||||
|
import com.cpop.mall.business.service.ProductService;
|
||||||
|
import com.cpop.mall.business.service.ProductSpecificationService;
|
||||||
|
import com.cpop.mall.business.vo.ProductPageVo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD;
|
||||||
|
import static com.cpop.mall.business.entity.table.ProductSpecificationTableDef.PRODUCT_SPECIFICATION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城-商品表 控制层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-23
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "商城-商品管理")
|
||||||
|
@RequestMapping("/mini/product")
|
||||||
|
public class MiniProductController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProductService productService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 分页查询商城-商品
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 11:56
|
||||||
|
* @param bo 分页参数
|
||||||
|
* @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>>
|
||||||
|
*/
|
||||||
|
@GetMapping("/getProductPage")
|
||||||
|
@ApiOperation("分页查询商城-商品")
|
||||||
|
public R<Page<ProductPageVo>> getProductPage(@ApiParam("分页参数") ProductPageBo bo) {
|
||||||
|
Page<ProductPageVo> page = productService.getProductPage(bo);
|
||||||
|
return R.ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 获取果酱课卡模板
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 11:56
|
||||||
|
* @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>>
|
||||||
|
*/
|
||||||
|
@GetMapping("/getJamboxCardTemplate")
|
||||||
|
@ApiOperation("获取果酱课卡模板")
|
||||||
|
public R<List<CardTemplateListVo>> getJamboxCardTemplate() {
|
||||||
|
List<CardTemplateListVo> list = productService.getJamboxCardTemplate();
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 创建规格
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 12:15
|
||||||
|
* @param specificationGroups 规格集合
|
||||||
|
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||||
|
*/
|
||||||
|
@PostMapping("/createSpecification")
|
||||||
|
@ApiOperation("创建规格")
|
||||||
|
public R<List<String>> createSpecification(@RequestBody @ApiParam("规格集合") List<List<String>> specificationGroups) {
|
||||||
|
List<String> list = productService.createSpecification(specificationGroups);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 保存商城-商品
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 12:15
|
||||||
|
* @param bo 商城-商品
|
||||||
|
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||||
|
*/
|
||||||
|
@PostMapping("/insertProduct")
|
||||||
|
@ApiOperation("保存商城-商品")
|
||||||
|
public R<Void> insertProduct(@RequestBody @Validated @ApiParam("商城-商品") ProductBo bo) {
|
||||||
|
productService.insertProduct(bo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 根据主键重置商城商品
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 12:15
|
||||||
|
* @param id 商城-商品id
|
||||||
|
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||||
|
*/
|
||||||
|
@PutMapping("/resetProduct/{id}")
|
||||||
|
@ApiOperation("根据主键重置商城商品")
|
||||||
|
public R<Void> update(@PathVariable String id) {
|
||||||
|
productService.resetProduct(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 根据主键重置商城商品
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/23 12:15
|
||||||
|
* @param bo 商城-商品
|
||||||
|
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||||
|
*/
|
||||||
|
@PutMapping("/updateProduct")
|
||||||
|
@ApiOperation("根据主键更新商城-商品")
|
||||||
|
public R<Void> updateProduct(@RequestBody @Validated @ApiParam("商城-商品") ProductBo bo) {
|
||||||
|
productService.updateProduct(bo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键删除商城-商品表。
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/removeById/{id}")
|
||||||
|
@ApiOperation("根据主键商城-商品表")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public R<Void> removeById(@PathVariable @ApiParam("商城-商品主键") Serializable id) {
|
||||||
|
productService.removeById(id);
|
||||||
|
//删规格
|
||||||
|
ProductSpecificationService productSpecificationService = SpringUtils.getBean(ProductSpecificationService.class);
|
||||||
|
productSpecificationService.updateChain().where(PRODUCT_SPECIFICATION.PRODUCT_ID.eq(id)).remove();
|
||||||
|
//删商品记录详情
|
||||||
|
ProductRecordService specificationRecordService = SpringUtils.getBean(ProductRecordService.class);
|
||||||
|
specificationRecordService.updateChain().where(PRODUCT_RECORD.PRODUCT_ID.eq(id)).remove();
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
114
Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Order.java
Normal file
114
Cpop-Mall/src/main/java/com/cpop/mall/business/entity/Order.java
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
package com.cpop.mall.business.entity;
|
||||||
|
|
||||||
|
import com.cpop.core.base.entity.BaseEntity;
|
||||||
|
import com.cpop.core.base.entity.BaseInsertListener;
|
||||||
|
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单表 实体类。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper=false)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Table(value = "cp_mall_order", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||||
|
public class Order extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)
|
||||||
|
*/
|
||||||
|
private Integer orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部订单号
|
||||||
|
*/
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总积分
|
||||||
|
*/
|
||||||
|
private Long totalPoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌id
|
||||||
|
*/
|
||||||
|
private String brandId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺(校区)id
|
||||||
|
*/
|
||||||
|
private String storeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名
|
||||||
|
*/
|
||||||
|
private String productNames;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单用户id
|
||||||
|
*/
|
||||||
|
private String payUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单人真实姓名
|
||||||
|
*/
|
||||||
|
private String payUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货人名
|
||||||
|
*/
|
||||||
|
private String receiveName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货人电话
|
||||||
|
*/
|
||||||
|
private String receivePhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货地址
|
||||||
|
*/
|
||||||
|
private String receiveAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流订单号
|
||||||
|
*/
|
||||||
|
private String logisticsOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除(0否1是)
|
||||||
|
*/
|
||||||
|
@Column(isLogicDelete = true)
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.cpop.mall.business.entity;
|
||||||
|
|
||||||
|
import com.cpop.core.base.entity.BaseEntity;
|
||||||
|
import com.cpop.core.base.entity.BaseInsertListener;
|
||||||
|
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单详情表 实体类。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper=false)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Table(value = "cp_mall_order_detail", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||||
|
public class OrderDetail extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品记录id
|
||||||
|
*/
|
||||||
|
private String productRecordId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分
|
||||||
|
*/
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除(0否1是)
|
||||||
|
*/
|
||||||
|
@Column(isLogicDelete = true)
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.cpop.mall.business.entity;
|
||||||
|
|
||||||
|
import com.cpop.core.base.entity.BaseEntity;
|
||||||
|
import com.cpop.core.base.entity.BaseInsertListener;
|
||||||
|
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单退款记录表 实体类。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper=false)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Table(value = "cp_mall_order_refund", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||||
|
public class OrderRefund extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款状态(0:申请中;1:通过;2:驳回)
|
||||||
|
*/
|
||||||
|
private Integer refundStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款原因
|
||||||
|
*/
|
||||||
|
private String refundReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒绝原因
|
||||||
|
*/
|
||||||
|
private String rejectReason;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除(0否1是)
|
||||||
|
*/
|
||||||
|
@Column(isLogicDelete = true)
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cpop.mall.business.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.cpop.mall.business.entity.OrderDetail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单详情表 映射层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cpop.mall.business.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.cpop.mall.business.entity.Order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单表 映射层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface OrderMapper extends BaseMapper<Order> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cpop.mall.business.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.cpop.mall.business.entity.OrderRefund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单退款记录表 映射层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface OrderRefundMapper extends BaseMapper<OrderRefund> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cpop.mall.business.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.cpop.mall.business.entity.OrderDetail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单详情表 服务层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface OrderDetailService extends IService<OrderDetail> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.cpop.mall.business.service;
|
||||||
|
|
||||||
|
import com.cpop.mall.business.bo.OrderRejectRefundBo;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.cpop.mall.business.entity.OrderRefund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单退款记录表 服务层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface OrderRefundService extends IService<OrderRefund> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 同意退款
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/24 16:10
|
||||||
|
* @param id 订单id
|
||||||
|
* @return: void
|
||||||
|
*/
|
||||||
|
void agreeRefund(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 拒绝退款
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/24 16:13
|
||||||
|
* @param bo 请求参数
|
||||||
|
* @return: void
|
||||||
|
*/
|
||||||
|
void rejectRefund(OrderRejectRefundBo bo);
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.cpop.mall.business.service;
|
||||||
|
|
||||||
|
import com.cpop.mall.business.bo.OrderPageBo;
|
||||||
|
import com.cpop.mall.business.vo.OrderPageVo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.cpop.mall.business.entity.Order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单表 服务层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface OrderService extends IService<Order> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 分页查询商城-订单
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/24 15:19
|
||||||
|
* @param bo 请求参数
|
||||||
|
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.OrderPageVo>
|
||||||
|
*/
|
||||||
|
Page<OrderPageVo> getOrderPage(OrderPageBo bo);
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.cpop.mall.business.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.cpop.mall.business.entity.OrderDetail;
|
||||||
|
import com.cpop.mall.business.mapper.OrderDetailMapper;
|
||||||
|
import com.cpop.mall.business.service.OrderDetailService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单详情表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Service("orderDetailService")
|
||||||
|
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package com.cpop.mall.business.service.impl;
|
||||||
|
|
||||||
|
import com.cpop.mall.business.bo.OrderRejectRefundBo;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.cpop.mall.business.entity.OrderRefund;
|
||||||
|
import com.cpop.mall.business.mapper.OrderRefundMapper;
|
||||||
|
import com.cpop.mall.business.service.OrderRefundService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import static com.cpop.mall.business.entity.table.OrderRefundTableDef.ORDER_REFUND;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单退款记录表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Service("orderRefundService")
|
||||||
|
public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, OrderRefund> implements OrderRefundService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 同意退款
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/24 16:10
|
||||||
|
* @param id 订单id
|
||||||
|
* @return: void
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void agreeRefund(String id) {
|
||||||
|
//TODO:调用退款接口
|
||||||
|
this.updateChain().set(ORDER_REFUND.REFUND_STATUS, 1).where(ORDER_REFUND.ID.eq(id)).update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 拒绝退款
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/24 16:13
|
||||||
|
* @param bo 请求参数
|
||||||
|
* @return: void
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void rejectRefund(OrderRejectRefundBo bo) {
|
||||||
|
this.updateChain().set(ORDER_REFUND.REFUND_STATUS, 2)
|
||||||
|
.set(ORDER_REFUND.REFUND_REASON, bo.getRejectReason())
|
||||||
|
.where(ORDER_REFUND.ID.eq(bo.getId()))
|
||||||
|
.update();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.cpop.mall.business.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cpop.core.base.entity.PageDomain;
|
||||||
|
import com.cpop.core.utils.SecurityUtils;
|
||||||
|
import com.cpop.core.utils.sql.SqlUtils;
|
||||||
|
import com.cpop.mall.business.bo.OrderPageBo;
|
||||||
|
import com.cpop.mall.business.vo.OrderPageVo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.cpop.mall.business.entity.Order;
|
||||||
|
import com.cpop.mall.business.mapper.OrderMapper;
|
||||||
|
import com.cpop.mall.business.service.OrderService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
|
||||||
|
import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城订单表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Service("orderService")
|
||||||
|
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 分页查询商城-订单
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/24 15:19
|
||||||
|
* @param bo 请求参数
|
||||||
|
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.OrderPageVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<OrderPageVo> getOrderPage(OrderPageBo bo) {
|
||||||
|
//获取当前登陆用户信息
|
||||||
|
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo();
|
||||||
|
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||||
|
return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
|
||||||
|
QueryWrapper.create()
|
||||||
|
.select(ORDER.ALL_COLUMNS)
|
||||||
|
.from(ORDER)
|
||||||
|
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(ORDER.PAY_USER_ID))
|
||||||
|
.where(ORDER.BRAND_ID.eq(loginStaffInfo.getString("brandId")))
|
||||||
|
.and(ORDER.PAY_USER_NAME.like(bo.getPayUserName()))
|
||||||
|
.and(SYS_USER.PHONE_NUMBER.eq(bo.getPayUserPhone()))
|
||||||
|
.and(ORDER.PRODUCT_NAMES.like(bo.getProductName()))
|
||||||
|
.orderBy(ORDER.CREATE_TIME.desc()),
|
||||||
|
OrderPageVo.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -61,8 +61,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|||||||
QueryWrapper.create()
|
QueryWrapper.create()
|
||||||
.where(PRODUCT.BRAND_ID.eq(loginStaffInfo.getString("brandId")))
|
.where(PRODUCT.BRAND_ID.eq(loginStaffInfo.getString("brandId")))
|
||||||
.and(PRODUCT.PRODUCT_NAME.like(bo.getProductName()))
|
.and(PRODUCT.PRODUCT_NAME.like(bo.getProductName()))
|
||||||
.orderBy(PRODUCT.CREATE_TIME.asc())
|
.and(PRODUCT.PRODUCT_TYPE.eq(bo.getProductType()))
|
||||||
,
|
.orderBy(pageDomain.getOrderByColumn()),
|
||||||
ProductPageVo.class);
|
ProductPageVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.cpop.mall.business.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @createTime 2023/10/24 15:17
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value = "商城订单详情返回对象")
|
||||||
|
public class OrderDetailVo implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品记录id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("商品记录id")
|
||||||
|
private String productRecordId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("商品规格")
|
||||||
|
private String recordNames;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金额
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("金额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("积分")
|
||||||
|
private Integer point;
|
||||||
|
}
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
package com.cpop.mall.business.vo;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.RelationOneToMany;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @createTime 2023/10/24 15:14
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value = "商城订单分页返回对象")
|
||||||
|
public class OrderPageVo implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)")
|
||||||
|
private Integer orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部订单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("外部订单号")
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总金额
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("总金额")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总积分
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("总积分")
|
||||||
|
private Long totalPoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("品牌id")
|
||||||
|
private String brandId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺(校区)id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("店铺(校区)id")
|
||||||
|
private String storeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("商品名")
|
||||||
|
private String productNames;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单用户id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("下单用户id")
|
||||||
|
private String payUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货人名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("收货人名")
|
||||||
|
private String receiveName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货人电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("收货人电话")
|
||||||
|
private String receivePhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("收货地址")
|
||||||
|
private String receiveAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流订单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("物流订单号")
|
||||||
|
private String logisticsOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单详情vo
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单详情")
|
||||||
|
@RelationOneToMany(selfField = "id",
|
||||||
|
targetField = "orderId",
|
||||||
|
targetTable = "cp_mall_order_detail",
|
||||||
|
joinTable = "cp_mall_product_record",
|
||||||
|
joinSelfColumn = "product_record_id",
|
||||||
|
joinTargetColumn = "id")
|
||||||
|
private List<OrderDetailVo> detailList;
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?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.cpop.mall.business.mapper.OrderDetailMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
7
Cpop-Mall/src/main/resources/mapper/OrderMapper.xml
Normal file
7
Cpop-Mall/src/main/resources/mapper/OrderMapper.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?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.cpop.mall.business.mapper.OrderMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?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.cpop.mall.business.mapper.OrderRefundMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
24
Cpop-Mini/pom.xml
Normal file
24
Cpop-Mini/pom.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Union</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<artifactId>Cpop-Mini</artifactId>
|
||||||
|
<name>Cpop-Mini</name>
|
||||||
|
<description>Cpop-Mini 小程序系统通用包</description>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!--核心包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package com.cpop.mini.business.entity;
|
||||||
|
|
||||||
|
import com.cpop.core.base.entity.BaseEntity;
|
||||||
|
import com.cpop.core.base.entity.BaseInsertListener;
|
||||||
|
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序用户信息 实体类。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper=false)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Table(value = "cp_mini_user", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||||
|
public class MiniUser extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在小程序openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在小程序appid
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除(0否1是)
|
||||||
|
*/
|
||||||
|
@Column(isLogicDelete = true)
|
||||||
|
private Boolean isDelete;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cpop.mini.business.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.cpop.mini.business.entity.MiniUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序用户信息 映射层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface MiniUserMapper extends BaseMapper<MiniUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cpop.mini.business.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.cpop.mini.business.entity.MiniUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序用户信息 服务层。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
public interface MiniUserService extends IService<MiniUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.cpop.mini.business.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.cpop.mini.business.entity.MiniUser;
|
||||||
|
import com.cpop.mini.business.mapper.MiniUserMapper;
|
||||||
|
import com.cpop.mini.business.service.MiniUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序用户信息 服务层实现。
|
||||||
|
*
|
||||||
|
* @author DB
|
||||||
|
* @since 2023-10-24
|
||||||
|
*/
|
||||||
|
@Service("miniUserService")
|
||||||
|
public class MiniUserServiceImpl extends ServiceImpl<MiniUserMapper, MiniUser> implements MiniUserService {
|
||||||
|
|
||||||
|
}
|
||||||
1
Cpop-Mini/src/main/resources/application-mini.yml
Normal file
1
Cpop-Mini/src/main/resources/application-mini.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
7
Cpop-Mini/src/main/resources/mapper/MiniUserMapper.xml
Normal file
7
Cpop-Mini/src/main/resources/mapper/MiniUserMapper.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?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.cpop.mini.business.mapper.MiniUserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -50,7 +50,7 @@ public class CpopCoreTests {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void loadUserByUsername() {
|
public void loadUserByUsername() {
|
||||||
System.out.println(coreService.getSysUser("RockBlade", UserType.OAM_USER));
|
System.out.println(coreService.getSysUserByUsername("RockBlade", UserType.OAM_USER));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
<artifactId>Cpop-System</artifactId>
|
<artifactId>Cpop-System</artifactId>
|
||||||
<name>Cpop-System</name>
|
<name>Cpop-System</name>
|
||||||
<description>Cpop-System</description>
|
<description>Cpop-System</description>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!--核心包-->
|
<!--核心包-->
|
||||||
|
|||||||
8
pom.xml
8
pom.xml
@ -28,6 +28,7 @@
|
|||||||
<module>Cpop-Mall</module>
|
<module>Cpop-Mall</module>
|
||||||
<module>Cpop-Mall/Cpop-Mall-Web</module>
|
<module>Cpop-Mall/Cpop-Mall-Web</module>
|
||||||
<module>Cpop-System</module>
|
<module>Cpop-System</module>
|
||||||
|
<module>Cpop-Mini</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -38,7 +39,7 @@
|
|||||||
<commons-IO.version>2.13.0</commons-IO.version>
|
<commons-IO.version>2.13.0</commons-IO.version>
|
||||||
<joda.time.version>2.12.5</joda.time.version>
|
<joda.time.version>2.12.5</joda.time.version>
|
||||||
<fastjson.version>2.0.38</fastjson.version>
|
<fastjson.version>2.0.38</fastjson.version>
|
||||||
<mybatis-flex.version>1.6.4</mybatis-flex.version>
|
<mybatis-flex.version>1.7.2</mybatis-flex.version>
|
||||||
<easyexcel.version>3.3.2</easyexcel.version>
|
<easyexcel.version>3.3.2</easyexcel.version>
|
||||||
<commons-compress.version>1.21</commons-compress.version>
|
<commons-compress.version>1.21</commons-compress.version>
|
||||||
<jjwt.version>0.9.1</jjwt.version>
|
<jjwt.version>0.9.1</jjwt.version>
|
||||||
@ -123,6 +124,11 @@
|
|||||||
<artifactId>Cpop-System</artifactId>
|
<artifactId>Cpop-System</artifactId>
|
||||||
<version>${cpop.version}</version>
|
<version>${cpop.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Mini</artifactId>
|
||||||
|
<version>${cpop.version}</version>
|
||||||
|
</dependency>
|
||||||
<!--HikariCP-->
|
<!--HikariCP-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user