替换登陆用户信息;添加小程序商城:1.获取商品;2.获取订单;3.评价;4.退款;5.添加校区查询;6:添加品牌拓展;

This commit is contained in:
DB 2023-10-26 18:10:16 +08:00
parent 105b9453bf
commit 51bf8bab32
85 changed files with 1735 additions and 504 deletions

View File

@ -193,4 +193,9 @@ public interface Constants {
* 用户类型 * 用户类型
*/ */
String USER_TYPE = "UserType"; String USER_TYPE = "UserType";
/**
* 登陆查询用户字段
*/
String USERNAME = "UserName";
} }

View File

@ -84,8 +84,9 @@ public class LoginUser implements UserDetails {
public LoginUser() { public LoginUser() {
} }
public LoginUser(SysUser user, Set<String> permissions) { public LoginUser(SysUser user,String identification, Set<String> permissions) {
this.user = user; this.user = user;
this.identification = identification;
this.permissions = permissions; this.permissions = permissions;
} }

View File

@ -1,5 +1,6 @@
package com.cpop.core.base.entity.loginInfo; package com.cpop.core.base.entity.loginInfo;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.base.table.SysUser; import com.cpop.core.base.table.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -39,4 +40,9 @@ public class MallStaffLoginInfo extends SysUser {
* 品牌id * 品牌id
*/ */
private String brandId; private String brandId;
/**
* 用户来源
*/
private SourceType sourceType;
} }

View File

@ -1,6 +1,8 @@
package com.cpop.core.base.entity.loginInfo; package com.cpop.core.base.entity.loginInfo;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.base.table.SysUser; import com.cpop.core.base.table.SysUser;
import com.cpop.core.gateway.miniProgram.MiniUserLoginInfoBuild;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -49,4 +51,9 @@ public class MiniUserLoginInfo extends SysUser {
* 头像 * 头像
*/ */
private String avatar; private String avatar;
/**
* 小程序用户来源
*/
private SourceType sourceType;
} }

View File

@ -0,0 +1,27 @@
package com.cpop.core.base.enums;
import lombok.Getter;
@Getter
public enum SourceType {
/**
* 通用
*/
COMMON("Common"),
/**
* 果酱
*/
JAMBOX("Jambox");
private String name;
SourceType(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -18,7 +18,7 @@ public enum UserType {
*/ */
MINI_USER(1, "mini:loginUser:"), MINI_USER(1, "mini:loginUser:"),
/** /**
* 商城用户 * 商城系统员工
*/ */
MALL_USER(2, "mall:loginUser:"); MALL_USER(2, "mall:loginUser:");

View File

@ -6,6 +6,7 @@ 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.R;
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.UserType; import com.cpop.core.base.enums.UserType;
import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken; import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken;
import com.cpop.core.gateway.sys.SysAuthenticationToken; import com.cpop.core.gateway.sys.SysAuthenticationToken;
@ -17,6 +18,8 @@ import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws; import io.jsonwebtoken.Jws;
import io.jsonwebtoken.JwtException; import io.jsonwebtoken.JwtException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
import org.springframework.lang.NonNullApi;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -51,7 +54,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
private RedisService redisService; private RedisService redisService;
@Override @Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { protected void doFilterInternal(HttpServletRequest request, @NonNull HttpServletResponse response,@NonNull FilterChain chain) throws IOException, ServletException {
String jwt = request.getHeader(jwtUtils.getHeader()); String jwt = request.getHeader(jwtUtils.getHeader());
// 这里如果没有jwt继续往后走因为后面还有鉴权管理器等去判断是否拥有身份凭证所以是可以放行的 // 这里如果没有jwt继续往后走因为后面还有鉴权管理器等去判断是否拥有身份凭证所以是可以放行的
// 没有jwt相当于匿名访问若有一些接口是需要权限的则不能访问这些接口 // 没有jwt相当于匿名访问若有一些接口是需要权限的则不能访问这些接口
@ -73,15 +76,17 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
returnJwtException(response,"token 已过期"); returnJwtException(response,"token 已过期");
return; return;
} }
String username = claim.getSubject(); //当前用户类型下唯一
String identification = claim.getSubject();
String username = jws.getHeader().get(Constants.USERNAME).toString();
UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString()); UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString());
//从缓存中获取 //从缓存中获取
JSONObject jsonObject = redisService.getCacheObject(userType.getKey() + username); JSONObject jsonObject = redisService.getCacheObject(userType.getKey() + identification);
LoginUser loginUser; LoginUser loginUser;
if (null == jsonObject){ if (null == jsonObject){
loginUser = multipleLoadUser(userType, username); loginUser = multipleLoadUser(userType, username);
//存入缓存 //存入缓存
redisService.setCacheObject(userType.getKey() + username, loginUser); redisService.setCacheObject(userType.getKey() + loginUser.getIdentification(), loginUser);
} else { } else {
loginUser = jsonObject.toJavaObject(LoginUser.class); loginUser = jsonObject.toJavaObject(LoginUser.class);
} }
@ -123,6 +128,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
loginUser = (LoginUser) oamStaffDetailsService.loadUserByUsername(username); loginUser = (LoginUser) oamStaffDetailsService.loadUserByUsername(username);
break; break;
case MINI_USER: case MINI_USER:
// 获取用户的权限等信息
loginUser = coreService.loadUserByPhone(username, userType, null);
break; break;
case MALL_USER: case MALL_USER:
loginUser = coreService.loadUserByUsername(username, userType); loginUser = coreService.loadUserByUsername(username, userType);
@ -146,12 +153,12 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
break; break;
case MINI_USER: case MINI_USER:
// MiniProgramAuthenticationToken,实现自动登录 // MiniProgramAuthenticationToken,实现自动登录
MiniProgramAuthenticationToken miniProgramAuthenticationToken = new MiniProgramAuthenticationToken(username, loginUser); MiniProgramAuthenticationToken miniProgramAuthenticationToken = new MiniProgramAuthenticationToken(loginUser.getIdentification(), loginUser, null);
SecurityContextHolder.getContext().setAuthentication(miniProgramAuthenticationToken); SecurityContextHolder.getContext().setAuthentication(miniProgramAuthenticationToken);
break; break;
case MALL_USER: case MALL_USER:
//构建通用系统用户登陆 //构建通用系统用户登陆
SysAuthenticationToken sysAuthenticationToken = new SysAuthenticationToken(username, loginUser,null); SysAuthenticationToken sysAuthenticationToken = new SysAuthenticationToken(loginUser.getIdentification(), loginUser, null);
SecurityContextHolder.getContext().setAuthentication(sysAuthenticationToken); SecurityContextHolder.getContext().setAuthentication(sysAuthenticationToken);
default: default:
} }

View File

@ -23,7 +23,6 @@ import java.util.Map;
*/ */
public class MiniProgramAuthenticationFilter extends AbstractAuthenticationProcessingFilter { public class MiniProgramAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
public MiniProgramAuthenticationFilter() { public MiniProgramAuthenticationFilter() {
super(new AntPathRequestMatcher("/miniLogin", "POST")); super(new AntPathRequestMatcher("/miniLogin", "POST"));
} }
@ -49,6 +48,7 @@ public class MiniProgramAuthenticationFilter extends AbstractAuthenticationProce
String brandId = (String) authenticationBean.get("brandId"); String brandId = (String) authenticationBean.get("brandId");
String nickName = (String) authenticationBean.get("nickName"); String nickName = (String) authenticationBean.get("nickName");
String avatar = (String) authenticationBean.get("avatar"); String avatar = (String) authenticationBean.get("avatar");
String sourceType = (String) authenticationBean.get("sourceType");
UserType userType = UserType.valueOf(authenticationBean.get("userType").toString()); UserType userType = UserType.valueOf(authenticationBean.get("userType").toString());
//传递信息 //传递信息
HashMap<String, Object> credentials = new HashMap<>(2); HashMap<String, Object> credentials = new HashMap<>(2);
@ -58,6 +58,7 @@ public class MiniProgramAuthenticationFilter extends AbstractAuthenticationProce
credentials.put("brandId", brandId); credentials.put("brandId", brandId);
credentials.put("nickName", nickName); credentials.put("nickName", nickName);
credentials.put("avatar", avatar); credentials.put("avatar", avatar);
credentials.put("sourceType", sourceType);
principal = principal.trim(); principal = principal.trim();
MiniProgramAuthenticationToken authRequest = new MiniProgramAuthenticationToken(principal, credentials); MiniProgramAuthenticationToken authRequest = new MiniProgramAuthenticationToken(principal, credentials);
this.setDetails(request, authRequest); this.setDetails(request, authRequest);

View File

@ -5,12 +5,15 @@ import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.abstracts.AbstractLoginInfoBuild; import com.cpop.core.abstracts.AbstractLoginInfoBuild;
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.entity.loginInfo.MiniUserLoginInfo;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.base.exception.CpopAuthenticationException; import com.cpop.core.base.exception.CpopAuthenticationException;
import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.base.table.SysUser; import com.cpop.core.base.table.SysUser;
import com.mybatisflex.annotation.KeyType; import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.core.row.DbChain; import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.row.Row; import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowKey; import com.mybatisflex.core.row.RowKey;
import lombok.Getter;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
@ -35,27 +38,87 @@ public class MiniUserLoginInfoBuild extends AbstractLoginInfoBuild {
private LoginUser getMiniUserInfo(SysUser sysUser, Map<String, Object> credentials) { private LoginUser getMiniUserInfo(SysUser sysUser, Map<String, Object> credentials) {
MiniUserLoginInfo loginInfo = BeanUtils.mapToClass(sysUser, MiniUserLoginInfo.class); MiniUserLoginInfo loginInfo = BeanUtils.mapToClass(sysUser, MiniUserLoginInfo.class);
loginInfo.setUserId(sysUser.getId()); loginInfo.setUserId(sysUser.getId());
//有用户信息
if (credentials == null){
//构建用户信息 //构建用户信息
Row row = DbChain.table("cp_mini_user") Row row = DbChain.table("cp_mini_user")
.select("id","open_id","app_id","user_id","brand_id","nick_name","avatar") .select("cmu.id","cmu.open_id","cmu.app_id","cmu.user_id","cmu.brand_id","cmu.nick_name","cmu.avatar","cmu.source_type")
.from("cp_mini_user") .from("cp_mini_user").as("cmu")
.where("user_id = ?", loginInfo.getUserId()) .where("cmu.user_id = ?", loginInfo.getUserId())
.and("brand_id = ?",credentials.get("brandId")) .and("cmu.is_delete = 0")
.and("app_id = ?",credentials.get("appId")) .one();
.and("open_id = ?",credentials.get("openId")) loginInfo.setOpenId(row.getString("openId"))
.and("is_delete = 0") .setAppId(row.getString("appId"))
.setUserId(row.getString("userId"))
.setBrandId(row.getString("brandId"))
.setNickName(row.getString("nickName"))
.setAvatar(row.getString("avatar"))
.setId(row.getString("id"))
.setSourceType(SourceType.valueOf(row.getString("sourceType")));
} else {
SourceType sourceType;
//校验用户来源
if (credentials.get("sourceType") == null) {
sourceType = SourceType.COMMON;
} else if (SourceType.JAMBOX == SourceType.valueOf(credentials.get("sourceType").toString())){
//来源自果酱
sourceType = SourceType.JAMBOX;
//查询果酱用户
changeJamboxUser(loginInfo, credentials ,sourceType);
} else {
//先用通用
sourceType = SourceType.COMMON;
}
}
return new LoginUser(loginInfo, loginInfo.getId(), null);
}
/**
* @descriptions 获取果酱小程序用户信息
* @author DB
* @date 2023/10/25 14:53
* @param loginInfo 用户信息
* @param credentials 请求参数
* @param sourceType 来源类型
* @return: void
*/
private void changeJamboxUser(MiniUserLoginInfo loginInfo, Map<String, Object> credentials, SourceType sourceType) {
//构建用户信息
Row row = DbChain.table("cp_mini_user")
.select("cmu.id","cmu.open_id","cmu.app_id","cmu.user_id","cmu.brand_id","cmu.nick_name","cmu.avatar","cmu.source_type")
.from("cp_mini_user").as("cmu")
.leftJoin("cp_j_brand_extend").as("cjbe").on("cjbe.brand_id = cmu.brand_id")
.where("cmu.user_id = ?", loginInfo.getUserId())
.and("cjbe.brand_cloud_id = ?",credentials.get("brandId"))
.and("cmu.app_id = ?",credentials.get("appId"))
.and("cmu.open_id = ?",credentials.get("openId"))
//用户来源
.and("cmu.source_type = ?",sourceType)
.and("cmu.is_delete = 0")
.one(); .one();
if (row == null) { if (row == null) {
//获取品牌表
Row brand = DbChain.table("cp_sys_brand")
.select("csb.id")
.from("cp_sys_brand").as("csb")
.leftJoin("cp_j_brand_extend").as("cjbe").on("cjbe.brand_id = csb.id")
.and("cjbe.brand_cloud_id = ?", credentials.get("brandId"))
.one();
if (brand == null) {
throw new ServiceException("用户登陆失败,果酱品牌暂未录入系统");
}
//保存小程序用户信息 //保存小程序用户信息
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
RowKey snowFlakeId = RowKey.SNOW_FLAKE_ID;
DbChain.table("cp_mini_user") DbChain.table("cp_mini_user")
.setId(RowKey.SNOW_FLAKE_ID) .setId(snowFlakeId)
.set("user_id", loginInfo.getUserId()) .set("user_id", loginInfo.getUserId())
.set("open_id", credentials.get("openId")) .set("open_id", credentials.get("openId"))
.set("app_id", credentials.get("appId")) .set("app_id", credentials.get("appId"))
.set("brand_id", credentials.get("brandId")) .set("brand_id", brand.getString("id"))
.set("nick_name", credentials.get("nickName")) .set("nick_name", credentials.get("nickName"))
.set("avatar", credentials.get("avatar")) .set("avatar", credentials.get("avatar"))
.set("source_type", sourceType)
.set("create_time", now) .set("create_time", now)
.set("update_time", now) .set("update_time", now)
.set("create_user_id", 1) .set("create_user_id", 1)
@ -64,17 +127,21 @@ public class MiniUserLoginInfoBuild extends AbstractLoginInfoBuild {
loginInfo.setOpenId((String) credentials.get("openId")) loginInfo.setOpenId((String) credentials.get("openId"))
.setAppId((String) credentials.get("appId")) .setAppId((String) credentials.get("appId"))
.setUserId(loginInfo.getUserId()) .setUserId(loginInfo.getUserId())
.setBrandId((String) credentials.get("brandId")) .setBrandId(brand.getString("id"))
.setNickName((String) credentials.get("nickName")) .setNickName((String) credentials.get("nickName"))
.setAvatar((String) credentials.get("avatar")); .setAvatar((String) credentials.get("avatar"))
.setId(snowFlakeId.getValue())
.setSourceType(sourceType);
} else { } else {
loginInfo.setOpenId(row.getString("openId")) loginInfo.setOpenId(row.getString("openId"))
.setAppId(row.getString("appId")) .setAppId(row.getString("appId"))
.setUserId(row.getString("userId")) .setUserId(row.getString("userId"))
.setBrandId(row.getString("brandId")) .setBrandId(row.getString("brandId"))
.setNickName(row.getString("nickName")) .setNickName(row.getString("nickName"))
.setAvatar(row.getString("avatar")); .setAvatar(row.getString("avatar"))
.setId(row.getString("id"))
.setSourceType(sourceType);
} }
return new LoginUser(loginInfo, null);
} }
} }

View File

@ -7,6 +7,7 @@ import com.cpop.core.base.entity.LoginUser;
import com.cpop.core.base.entity.Permission; import com.cpop.core.base.entity.Permission;
import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo; import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo;
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.base.exception.CpopAuthenticationException; import com.cpop.core.base.exception.CpopAuthenticationException;
import com.cpop.core.base.table.SysUser; import com.cpop.core.base.table.SysUser;
import com.mybatisflex.core.row.DbChain; import com.mybatisflex.core.row.DbChain;
@ -62,8 +63,9 @@ public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
staffLoginInfo.setId(row.getString("id")); staffLoginInfo.setId(row.getString("id"));
}else { }else {
staffLoginInfo.setName(Constants.SUPER_ADMIN); staffLoginInfo.setName(Constants.SUPER_ADMIN);
staffLoginInfo.setId(Constants.SUPER_ADMIN);
} }
return new LoginUser(staffLoginInfo, getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId())); return new LoginUser(staffLoginInfo, staffLoginInfo.getId(), getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId()));
} }
/** /**
@ -80,7 +82,7 @@ public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
//构建员工 //构建员工
if (!staffLoginInfo.getUserName().equals(Constants.SUPER_ADMIN)) { if (!staffLoginInfo.getUserName().equals(Constants.SUPER_ADMIN)) {
Row row = DbChain.table("cp_mall_staff") Row row = DbChain.table("cp_mall_staff")
.select("cms.id", "cms.name", "cms.user_id") .select("cms.id", "cms.name", "cms.user_id","cms.source_type")
.select("cmrb.role_id", "cmrb.brand_id") .select("cmrb.role_id", "cmrb.brand_id")
.from("cp_mall_staff").as("cms") .from("cp_mall_staff").as("cms")
.leftJoin("cp_mall_role_brand").as("cmrb").on("cmrb.id = cms.role_brand_id") .leftJoin("cp_mall_role_brand").as("cmrb").on("cmrb.id = cms.role_brand_id")
@ -94,10 +96,12 @@ public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
staffLoginInfo.setName(row.getString("name")); staffLoginInfo.setName(row.getString("name"));
staffLoginInfo.setId(row.getString("id")); staffLoginInfo.setId(row.getString("id"));
staffLoginInfo.setBrandId(row.getString("brandId")); staffLoginInfo.setBrandId(row.getString("brandId"));
staffLoginInfo.setSourceType(SourceType.valueOf(row.getString("sourceType")));
} else { } else {
staffLoginInfo.setName(Constants.SUPER_ADMIN); staffLoginInfo.setName(Constants.SUPER_ADMIN)
.setSourceType(SourceType.COMMON);
} }
return new LoginUser(staffLoginInfo, getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId())); return new LoginUser(staffLoginInfo, staffLoginInfo.getId(), getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId()));
} }
private Set<String> getPermissionSet(String username, String roleId) { private Set<String> getPermissionSet(String username, String roleId) {
@ -107,7 +111,9 @@ public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
permissionSet.add(Constants.ALL_PERMISSION); permissionSet.add(Constants.ALL_PERMISSION);
} }
else { else {
//查询员工信息 permissionSet.add(Constants.ALL_PERMISSION);
//TODO:测试中所有新建用户都是超级管理员
/*//查询员工信息
List<Row> list = DbChain.table("cp_sys_menu") List<Row> list = DbChain.table("cp_sys_menu")
.select("pom.permission") .select("pom.permission")
.from("cp_sys_menu").as("pom") .from("cp_sys_menu").as("pom")
@ -121,7 +127,7 @@ public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
} else { } else {
List<Permission> permissions = RowUtil.toEntityList(list, Permission.class); List<Permission> permissions = RowUtil.toEntityList(list, Permission.class);
permissionSet = permissions.stream().map(Permission::getPermission).collect(Collectors.toSet()); permissionSet = permissions.stream().map(Permission::getPermission).collect(Collectors.toSet());
} }*/
} }
return permissionSet; return permissionSet;
} }

View File

@ -54,16 +54,16 @@ public class JwtLogoutSuccessHandler implements LogoutSuccessHandler {
if (jwtUtils.isTokenExpired(claim)) { if (jwtUtils.isTokenExpired(claim)) {
throw new JwtException("token 已过期"); throw new JwtException("token 已过期");
} }
String username = claim.getSubject(); String identification = claim.getSubject();
UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString()); UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString());
//从缓存中获取 //从缓存中获取
JSONObject jsonObject = redisService.getCacheObject(userType.getKey() + username); JSONObject jsonObject = redisService.getCacheObject(userType.getKey() + identification);
if (null != jsonObject) { if (null != jsonObject) {
LoginUser loginUser = jsonObject.toJavaObject(LoginUser.class); LoginUser loginUser = jsonObject.toJavaObject(LoginUser.class);
SpringUtils.getBean(CoreService.class).insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGOUT, loginUser, MessageUtils.message("i18n_operationLog_systemLogout")); SpringUtils.getBean(CoreService.class).insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGOUT, loginUser, MessageUtils.message("i18n_operationLog_systemLogout"));
} }
//清除缓存 //清除缓存
redisService.deleteObject(userType.getKey() + username); redisService.deleteObject(userType.getKey() + identification);
httpServletResponse.setContentType("application/json;charset=UTF-8"); httpServletResponse.setContentType("application/json;charset=UTF-8");
ServletOutputStream outputStream = httpServletResponse.getOutputStream(); ServletOutputStream outputStream = httpServletResponse.getOutputStream();
String header = jwtUtils.getHeader(); String header = jwtUtils.getHeader();

View File

@ -8,6 +8,7 @@ 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.entity.loginInfo.MiniUserLoginInfo;
import com.cpop.core.base.enums.OperationLogEnum; import com.cpop.core.base.enums.OperationLogEnum;
import com.cpop.core.base.enums.UserType;
import com.cpop.core.service.CoreService; import com.cpop.core.service.CoreService;
import com.cpop.core.service.RedisService; import com.cpop.core.service.RedisService;
import com.cpop.core.utils.JwtUtils; import com.cpop.core.utils.JwtUtils;
@ -52,7 +53,7 @@ public class LoginSuccessHandler implements AuthenticationSuccessHandler {
loginUser = (LoginUser) authentication.getDetails(); loginUser = (LoginUser) authentication.getDetails();
} }
// 生成JWT并放置到请求头中 // 生成JWT并放置到请求头中
String jwt = jwtUtils.generateToken(authentication.getName(), loginUser.getUserType()); String jwt = jwtUtils.generateToken(loginUser.getIdentification(), loginUser.getUsername(), loginUser.getUserType());
loginSuccessVo.setToken(jwt).setUserId(loginUser.getUserId()).setRole(loginUser.getPermissions()); loginSuccessVo.setToken(jwt).setUserId(loginUser.getUserId()).setRole(loginUser.getPermissions());
String ipAddr = IpUtils.getIpAddr(httpServletRequest); String ipAddr = IpUtils.getIpAddr(httpServletRequest);
loginUser.setIpAddr(ipAddr); loginUser.setIpAddr(ipAddr);
@ -78,16 +79,12 @@ public class LoginSuccessHandler implements AuthenticationSuccessHandler {
coreService.updateSysUserLoginIp(loginUser.getIpAddr(), loginUser.getUsername(), loginUser.getUserType()); coreService.updateSysUserLoginIp(loginUser.getIpAddr(), loginUser.getUsername(), loginUser.getUserType());
//添加登录成功日志 //添加登录成功日志
coreService.insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGIN, loginUser, MessageUtils.message("i18n_login_success")); coreService.insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGIN, loginUser, MessageUtils.message("i18n_login_success"));
//将登录成功用户存入缓存
redisService.setCacheObject(loginUser.getUserType().getKey() + loginUser.getUsername(), loginUser);
break; break;
case MINI_USER: case MINI_USER:
//将登录成功用户存入缓存
MiniUserLoginInfo user = (MiniUserLoginInfo) loginUser.getUser();
redisService.setCacheObject(loginUser.getUserType().getKey() + user.getBrandId() + "-" + user.getAppId() + "-" + user.getOpenId(), loginUser);
break; break;
default: default:
} }
//将登录成功用户存入缓存
redisService.setCacheObject(loginUser.getUserType().getKey() + loginUser.getIdentification(), loginUser);
} }
} }

View File

@ -47,12 +47,13 @@ public class JwtUtils {
* @param username 用户名 * @param username 用户名
* @return {@link String} * @return {@link String}
**/ **/
public String generateToken(String username, UserType userType) { public String generateToken(String identification, String username, UserType userType) {
Date nowDate = new Date(); Date nowDate = new Date();
Date expireDate = new Date(nowDate.getTime() + 1000 * expire); Date expireDate = new Date(nowDate.getTime() + 1000 * expire);
return Jwts.builder() return Jwts.builder()
.setHeaderParam(Constants.USERNAME, username)
.setHeaderParam(Constants.USER_TYPE, userType) .setHeaderParam(Constants.USER_TYPE, userType)
.setSubject(username) .setSubject(identification)
.setIssuedAt(nowDate) .setIssuedAt(nowDate)
// 7天过期 // 7天过期
.setExpiration(expireDate) .setExpiration(expireDate)

View File

@ -50,16 +50,16 @@ public class SecurityUtils {
} }
/** /**
* @descriptions 获取登陆员工信息 * @descriptions 获取缓存用户信息
* @author DB * @author DB
* @date 2023/09/21 16:00 * @date 2023/09/21 16:00
* @return com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo * @return com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo
*/ */
public JSONObject getLoginStaffInfo() { public JSONObject getLoginUserInfo() {
//获取当前登录用户信息 //获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
//获取缓存信息 //获取缓存信息
JSONObject jsonObject = SpringUtils.getBean(RedisService.class).getCacheObject(loginUser.getUserType().getKey() + loginUser.getUsername()); JSONObject jsonObject = SpringUtils.getBean(RedisService.class).getCacheObject(loginUser.getUserType().getKey() + loginUser.getIdentification());
return jsonObject.getJSONObject("user"); return jsonObject.getJSONObject("user");
} }

View File

@ -4,7 +4,7 @@ cpop:
profile: E:/Cpop/uploadPath profile: E:/Cpop/uploadPath
jwt: jwt:
#白名单 #白名单
whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources whiteList: /login,/miniLogin,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources
gateway: gateway:
rsa-keypair: rsa-keypair:
# 公钥文件 # 公钥文件

View File

@ -1,21 +1,23 @@
package com.cpop.jambox.business.entity; package com.cpop.jambox.business.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import com.cpop.core.base.entity.BaseEntity; import com.cpop.core.base.entity.BaseEntity;
import com.cpop.core.base.entity.BaseInsertListener; import com.cpop.core.base.entity.BaseInsertListener;
import com.cpop.core.base.entity.BaseUpdateListener; 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.*;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
/** /**
* 品牌表 实体类 * 果酱品牌拓展表 实体类
* *
* @author DB * @author DB
* @since 2023-09-13 * @since 2023-10-25
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@ -23,8 +25,8 @@ import java.io.Serializable;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@Table(value = "cp_j_brand", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) @Table(value = "cp_j_brand_extend", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
public class Brand extends BaseEntity implements Serializable { public class BrandExtend extends BaseEntity implements Serializable {
/** /**
* 主键 * 主键
@ -32,31 +34,21 @@ public class Brand extends BaseEntity implements Serializable {
@Id @Id
private String id; private String id;
/**
* 系统品牌id
*/
private String brandId;
/** /**
* 云函数id * 云函数id
*/ */
private String brandCloudId; private String brandCloudId;
/**
* 品牌名
*/
private String name;
/** /**
* 背景地址 * 背景地址
*/ */
private String backgroundUrl; private String backgroundUrl;
/**
* 顾问名
*/
private String consultantName;
/**
* openId
*/
private String openId;
/** /**
* 是否删除(0否1是) * 是否删除(0否1是)
*/ */

View File

@ -34,6 +34,11 @@ public class CardTemplate extends BaseEntity implements Serializable {
@Id @Id
private String id; private String id;
/**
* 旧模板id
*/
private String oldTemplateId;
/** /**
* 云品牌id * 云品牌id
*/ */

View File

@ -0,0 +1,14 @@
package com.cpop.jambox.business.mapper;
import com.mybatisflex.core.BaseMapper;
import com.cpop.jambox.business.entity.BrandExtend;
/**
* 果酱品牌拓展表 映射层
*
* @author DB
* @since 2023-10-25
*/
public interface BrandExtendMapper extends BaseMapper<BrandExtend> {
}

View File

@ -1,14 +0,0 @@
package com.cpop.jambox.business.mapper;
import com.mybatisflex.core.BaseMapper;
import com.cpop.jambox.business.entity.Brand;
/**
* 品牌表 映射层
*
* @author DB
* @since 2023-09-13
*/
public interface BrandMapper extends BaseMapper<Brand> {
}

View File

@ -0,0 +1,14 @@
package com.cpop.jambox.business.service;
import com.mybatisflex.core.service.IService;
import com.cpop.jambox.business.entity.BrandExtend;
/**
* 果酱品牌拓展表 服务层
*
* @author DB
* @since 2023-10-25
*/
public interface BrandExtendService extends IService<BrandExtend> {
}

View File

@ -1,34 +0,0 @@
package com.cpop.jambox.business.service;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.cpop.jambox.business.bo.BrandBo;
import com.cpop.jambox.business.bo.BrandPageBo;
import com.cpop.jambox.business.entity.Brand;
import com.cpop.jambox.business.vo.BrandPageVo;
/**
* 品牌表 服务层
*
* @author DB
* @since 2023-09-13
*/
public interface BrandService extends IService<Brand> {
/**
* @descriptions 查询品牌分页列表
* @author DB
* @date 2023/09/13 17:55
* @param bo 请求参数
* @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.jambox.business.vo.BrandPageVo>>
*/
Page<BrandPageVo> getBrandPage(BrandPageBo bo);
/**
* @descriptions 修改品牌表
* @author DB
* @date 2023/09/14 11:40
* @param bo 请求参数
*/
void updateBrand(BrandBo bo);
}

View File

@ -1,33 +1,19 @@
package com.cpop.jambox.business.service.impl; package com.cpop.jambox.business.service.impl;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl; import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.common.utils.bean.BeanUtils; import com.cpop.jambox.business.entity.BrandExtend;
import com.cpop.core.base.entity.PageDomain; import com.cpop.jambox.business.mapper.BrandExtendMapper;
import com.cpop.core.utils.sql.SqlUtils; import com.cpop.jambox.business.service.BrandExtendService;
import com.cpop.jambox.business.bo.BrandBo;
import com.cpop.jambox.business.bo.BrandPageBo;
import com.cpop.jambox.business.entity.Brand;
import com.cpop.jambox.business.mapper.BrandMapper;
import com.cpop.jambox.business.service.BrandService;
import com.cpop.jambox.business.vo.BrandPageVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import static com.mybatisflex.core.query.QueryMethods.groupConcat;
import static com.cpop.jambox.business.entity.table.BrandStaffMidCampusTableDef.BRAND_STAFF_MID_CAMPUS;
import static com.cpop.jambox.business.entity.table.BrandStaffTableDef.BRAND_STAFF;
import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND;
/** /**
* 品牌表 服务层实现 * 果酱品牌拓展表 服务层实现
* *
* @author DB * @author DB
* @since 2023-09-13 * @since 2023-10-25
*/ */
@Service("brandService") @Service("brandExtendService")
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements BrandService { public class BrandExtendServiceImpl extends ServiceImpl<BrandExtendMapper, BrandExtend> implements BrandExtendService {
/** /**
* @descriptions 查询品牌分页列表 * @descriptions 查询品牌分页列表
* @author DB * @author DB
@ -35,7 +21,7 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
* @param bo 请求参数 * @param bo 请求参数
* @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.jambox.business.vo.BrandPageVo>> * @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.jambox.business.vo.BrandPageVo>>
*/ */
@Override /*@Override
public Page<BrandPageVo> getBrandPage(BrandPageBo bo) { public Page<BrandPageVo> getBrandPage(BrandPageBo bo) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
@ -50,7 +36,7 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
.and(BRAND.NAME.like(bo.getName())) .and(BRAND.NAME.like(bo.getName()))
.groupBy(BRAND.ID), .groupBy(BRAND.ID),
BrandPageVo.class); BrandPageVo.class);
} }*/
/** /**
* @descriptions 修改品牌表 * @descriptions 修改品牌表
@ -58,10 +44,10 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
* @date 2023/09/14 11:40 * @date 2023/09/14 11:40
* @param bo 请求参数 * @param bo 请求参数
*/ */
@Override /*@Override
public void updateBrand(BrandBo bo) { public void updateBrand(BrandBo bo) {
Brand entity = BeanUtils.mapToClass(bo, Brand.class); Brand entity = BeanUtils.mapToClass(bo, Brand.class);
this.updateById(entity); this.updateById(entity);
//TODO:可能需要通知到云库 //TODO:可能需要通知到云库
} }*/
} }

View File

@ -4,10 +4,8 @@ import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl; import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.common.utils.bean.BeanUtils; import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.SpringUtils;
import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.jambox.business.bo.BrandStaffBo; import com.cpop.jambox.business.bo.BrandStaffBo;
import com.cpop.jambox.business.bo.BrandStaffPageBo; import com.cpop.jambox.business.bo.BrandStaffPageBo;
import com.cpop.jambox.business.entity.BrandStaff; import com.cpop.jambox.business.entity.BrandStaff;
@ -26,11 +24,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.mybatisflex.core.query.QueryMethods.distinct;
import static com.mybatisflex.core.query.QueryMethods.groupConcat;
import static com.cpop.jambox.business.entity.table.BrandStaffMidCampusTableDef.BRAND_STAFF_MID_CAMPUS; import static com.cpop.jambox.business.entity.table.BrandStaffMidCampusTableDef.BRAND_STAFF_MID_CAMPUS;
import static com.cpop.jambox.business.entity.table.BrandStaffTableDef.BRAND_STAFF;
import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS;
/** /**
@ -51,7 +45,7 @@ public class BrandStaffServiceImpl extends ServiceImpl<BrandStaffMapper, BrandSt
**/ **/
@Override @Override
public Page<BrandStaffPageVo> getBrandStaffPage(BrandStaffPageBo bo) { public Page<BrandStaffPageVo> getBrandStaffPage(BrandStaffPageBo bo) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); /*PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
QueryWrapper.create() QueryWrapper.create()
.select(BRAND_STAFF.ID,BRAND_STAFF.NAME,BRAND_STAFF.PHONE_NUMBER,BRAND_STAFF.CREATE_TIME) .select(BRAND_STAFF.ID,BRAND_STAFF.NAME,BRAND_STAFF.PHONE_NUMBER,BRAND_STAFF.CREATE_TIME)
@ -70,7 +64,8 @@ public class BrandStaffServiceImpl extends ServiceImpl<BrandStaffMapper, BrandSt
.and(BRAND_STAFF.PHONE_NUMBER.eq(bo.getPhoneNumber())) .and(BRAND_STAFF.PHONE_NUMBER.eq(bo.getPhoneNumber()))
.and(BRAND.NAME.like(bo.getBrandName())) .and(BRAND.NAME.like(bo.getBrandName()))
.groupBy(BRAND_STAFF.ID), .groupBy(BRAND_STAFF.ID),
BrandStaffPageVo.class); BrandStaffPageVo.class);*/
return null;
} }
/** /**

View File

@ -1,11 +1,8 @@
package com.cpop.jambox.business.service.impl; package com.cpop.jambox.business.service.impl;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl; import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.common.utils.bean.BeanUtils; import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.jambox.business.bo.CampusBo; import com.cpop.jambox.business.bo.CampusBo;
import com.cpop.jambox.business.bo.CampusPageBo; import com.cpop.jambox.business.bo.CampusPageBo;
import com.cpop.jambox.business.entity.Campus; import com.cpop.jambox.business.entity.Campus;
@ -14,9 +11,6 @@ import com.cpop.jambox.business.service.CampusService;
import com.cpop.jambox.business.vo.CampusPageVo; import com.cpop.jambox.business.vo.CampusPageVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS;
/** /**
* 校区表 服务层实现 * 校区表 服务层实现
* *
@ -35,14 +29,15 @@ public class CampusServiceImpl extends ServiceImpl<CampusMapper, Campus> impleme
*/ */
@Override @Override
public Page<CampusPageVo> getCampusPage(CampusPageBo bo) { public Page<CampusPageVo> getCampusPage(CampusPageBo bo) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); /*PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
QueryWrapper.create() QueryWrapper.create()
.select(CAMPUS.ALL_COLUMNS) .select(CAMPUS.ALL_COLUMNS)
.select(BRAND.NAME.as(CampusPageVo::getBrandName)) .select(BRAND.NAME.as(CampusPageVo::getBrandName))
.leftJoin(BRAND).on(BRAND.ID.eq(CAMPUS.BRAND_ID)) .leftJoin(BRAND).on(BRAND.ID.eq(CAMPUS.BRAND_ID))
.and(CAMPUS.NAME.like(bo.getName())), .and(CAMPUS.NAME.like(bo.getName())),
CampusPageVo.class); CampusPageVo.class);*/
return null;
} }
/** /**

View 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.jambox.business.mapper.BrandExtendMapper">
</mapper>

View File

@ -23,12 +23,6 @@
<groupId>com.cpop</groupId> <groupId>com.cpop</groupId>
<artifactId>Cpop-System</artifactId> <artifactId>Cpop-System</artifactId>
</dependency> </dependency>
<!--系统包-->
<dependency>
<groupId>com.cpop</groupId>
<artifactId>Cpop-System</artifactId>
</dependency>
<!--果酱包-->
<dependency> <dependency>
<groupId>com.cpop</groupId> <groupId>com.cpop</groupId>
<artifactId>Cpop-Jambox</artifactId> <artifactId>Cpop-Jambox</artifactId>

View File

@ -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/26 17:22
* @description
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "用户申请退款对象")
public class OrderApplyRefundBo implements Serializable {
/**
* 订单id
*/
@NotBlank(message = "订单id不能为空")
@ApiModelProperty(value = "订单id",required = true)
private String orderId;
/**
* 退款原因
*/
@NotBlank(message = "退款原因不能为空")
@ApiModelProperty(value = "退款原因",required = true)
private String refundReason;
}

View File

@ -0,0 +1,54 @@
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/26 17:13
* @description
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "用户评价订单")
public class OrderEvaluateBo implements Serializable {
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 产品id
*/
@NotBlank(message = "产品id不能为空")
@ApiModelProperty(value = "产品id",required = true)
private String productId;
/**
* 订单id
*/
@NotBlank(message = "订单id不能为空")
@ApiModelProperty(value = "订单id",required = true)
private String orderId;
/**
* 评价
*/
@NotBlank(message = "评价不能为空")
@ApiModelProperty(value = "评价",required = true)
private String evaluate;
/**
*
*/
@NotBlank(message = "星不能为空")
@ApiModelProperty(value = "",required = true)
private Double start;
}

View File

@ -34,4 +34,10 @@ public class OrderPageBo implements Serializable {
*/ */
@ApiModelProperty("支付用户手机号") @ApiModelProperty("支付用户手机号")
private String payUserPhone; private String payUserPhone;
/**
* 订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)
*/
@ApiModelProperty("订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)")
private Integer orderStatus;
} }

View File

@ -0,0 +1,133 @@
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 javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @author DB
* @createTime 2023/10/25 9:21
* @description
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "商城订单下单请求对象")
public class PlaceOrderBo implements Serializable {
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 总金额
*/
@NotNull(message = "总金额不能为空")
@ApiModelProperty(value = "总金额",required = true)
private BigDecimal totalAmount;
/**
* 总积分
*/
@NotNull(message = "总积分不能为空")
@ApiModelProperty(value = "总积分",required = true)
private Long totalPoint;
/**
* 品牌id
*/
@NotBlank(message = "品牌id不能为空")
@ApiModelProperty(value = "品牌id",required = true)
private String brandId;
/**
* 店铺(校区)id
*/
@ApiModelProperty("店铺(校区)id")
private String storeId;
/**
* 下单人真实姓名
*/
@ApiModelProperty("下单人真实姓名")
private String payUserName;
/**
* 收货人名
*/
@NotBlank(message = "收货人名不能为空")
@ApiModelProperty(value = "收货人名",required = true)
private String receiveName;
/**
* 收货人电话
*/
@NotBlank(message = "收货人电话不能为空")
@ApiModelProperty(value = "收货人电话",required = true)
private String receivePhone;
/**
* 收货地址
*/
@NotBlank(message = "收货地址不能为空")
@ApiModelProperty(value = "收货地址",required = true)
private String receiveAddress;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remarks;
/**
* 订单详情
*/
@NotEmpty(message = "订单详情不能为空")
@ApiModelProperty(value = "订单详情",required = true)
private List<PlaceOrderDetail> placeOrderDetailList;
/**
* 下单详情
*/
@Data
@ApiModel(value = "商城订单下单详情请求对象")
public static class PlaceOrderDetail implements Serializable{
/**
* 商品记录id
*/
@NotBlank(message = "商品规格记录id不能为空")
@ApiModelProperty(value = "商品规格记录id",required = true)
private String productRecordId;
/**
* 金额
*/
@NotNull(message = "金额不能为空")
@ApiModelProperty(value = "金额",required = true)
private BigDecimal amount;
/**
* 积分
*/
@NotNull(message = "积分不能为空")
@ApiModelProperty(value = "积分",required = true)
private Integer point;
/**
* 下单数量
*/
@NotNull(message = "下单数量不能为空")
@ApiModelProperty(value = "下单数量",required = true)
private Integer number;
}
}

View File

@ -31,14 +31,14 @@ public class ProductBo implements Serializable {
* 商品名 * 商品名
*/ */
@NotBlank(message = "商品名不能为空") @NotBlank(message = "商品名不能为空")
@ApiModelProperty("商品名") @ApiModelProperty(value = "商品名",required = true)
private String productName; private String productName;
/** /**
* 产品类型(0:课卡;1:周边;2:优惠卷:3:其他) * 产品类型(0:课卡;1:周边;2:优惠卷:3:其他)
*/ */
@NotNull(message = "产品类型不能为空") @NotNull(message = "产品类型不能为空")
@ApiModelProperty("产品类型(0:课卡;1:周边;2:优惠卷:3:其他)") @ApiModelProperty(value = "产品类型(0:课卡;1:周边;2:优惠卷:3:其他)",required = true)
private Integer productType; private Integer productType;
/** /**
@ -57,33 +57,33 @@ public class ProductBo implements Serializable {
* 描述 * 描述
*/ */
@NotBlank(message = "描述不能为空") @NotBlank(message = "描述不能为空")
@ApiModelProperty("描述") @ApiModelProperty(value = "描述",required = true)
private String description; private String description;
/** /**
* 商品图地址 * 商品图地址
*/ */
@NotBlank(message = "商品图地址不能为空") //@NotBlank(message = "商品图地址不能为空")
@ApiModelProperty("商品图地址") @ApiModelProperty(value = "商品图地址",required = true)
private String picUrl; private String picUrl;
/** /**
* 购买限制(0:会员限制;1:新客限定;2:用户限购) * 购买限制(0:会员限制;1:新客限定;2:用户限购)
*/ */
@NotNull(message = "购买限制不能为空")
@ApiModelProperty("购买限制(0:会员限制;1:新客限定;2:用户限购)") @ApiModelProperty("购买限制(0:会员限制;1:新客限定;2:用户限购)")
private Integer buyRestrict; private Integer buyRestrict;
/** /**
* 规格集合 * 规格集合
*/ */
@ApiModelProperty("规格集合") @NotEmpty(message = "规格详情不能为空")
@ApiModelProperty(value = "规格集合",required = true)
private List<ProductSpecificationBo> specificationList; private List<ProductSpecificationBo> specificationList;
/** /**
* 规格详情 * 规格详情
*/ */
@NotEmpty(message = "规格详情不能为空") @NotEmpty(message = "规格详情不能为空")
@ApiModelProperty("规格详情") @ApiModelProperty(value = "规格详情",required = true)
private List<ProductRecordBo> recordList; private List<ProductRecordBo> recordList;
} }

View File

@ -28,6 +28,19 @@ public class ProductPageBo implements Serializable {
/** /**
* 产品类型(0:课卡;1:周边;2:优惠卷:3:其他 * 产品类型(0:课卡;1:周边;2:优惠卷:3:其他
*/ */
@ApiModelProperty("产品类型(0:课卡;1:周边;2:优惠卷:3:其他")
private Integer productType; private Integer productType;
/**
* 购买限制(0:会员限制;1:新客限定;2:用户限购)
*/
@ApiModelProperty("购买限制(0:会员限制;1:新客限定;2:用户限购)")
private Integer buyRestrict;
/**
* 价格排序
*/
@ApiModelProperty("价格排序(false:从低到高;true:从高到低)")
private Boolean priceOrder;
} }

View File

@ -1,5 +1,6 @@
package com.cpop.mall.business.bo; package com.cpop.mall.business.bo;
import com.cpop.core.annontation.StringArrayConvert;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -27,6 +28,7 @@ public class ProductRecordBo implements Serializable {
/** /**
* 记录集合 * 记录集合
*/ */
@StringArrayConvert
@ApiModelProperty("记录集合") @ApiModelProperty("记录集合")
private String recordNames; private String recordNames;
@ -36,7 +38,7 @@ public class ProductRecordBo implements Serializable {
@ApiModelProperty("数量") @ApiModelProperty("数量")
private Integer recordNum; private Integer recordNum;
/** /**关联
* 记录消耗金额 * 记录消耗金额
*/ */
@ApiModelProperty("记录消耗金额") @ApiModelProperty("记录消耗金额")

View File

@ -1,5 +1,6 @@
package com.cpop.mall.business.bo; package com.cpop.mall.business.bo;
import com.cpop.core.annontation.StringArrayConvert;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -36,5 +37,6 @@ public class ProductSpecificationBo implements Serializable {
* 规格名 * 规格名
*/ */
@ApiModelProperty("规格名") @ApiModelProperty("规格名")
@StringArrayConvert
private String specificationNames; private String specificationNames;
} }

View File

@ -111,7 +111,7 @@ public class StaffBo implements Serializable {
/** /**
* 角色id * 角色id
*/ */
@NotBlank(message = "角色id不能为空") //TODO:@NotBlank(message = "角色id不能为空")
@ApiModelProperty(value = "角色id",required = true) @ApiModelProperty(value = "角色id",required = true)
private String roleId; private String roleId;

View File

@ -2,9 +2,7 @@ package com.cpop.mall.business.controller.backstage;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cpop.common.constant.Constants; import com.cpop.common.constant.Constants;
import com.cpop.core.annontation.OperationLog;
import com.cpop.core.base.R; import com.cpop.core.base.R;
import com.cpop.core.base.enums.OperationLogEnum;
import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.SpringUtils;
import com.cpop.mall.business.bo.ModifyUserPasswordBo; import com.cpop.mall.business.bo.ModifyUserPasswordBo;
@ -12,9 +10,10 @@ import com.cpop.mall.business.bo.StaffBo;
import com.cpop.mall.business.bo.StaffPageBo; import com.cpop.mall.business.bo.StaffPageBo;
import com.cpop.mall.business.entity.RoleBrand; import com.cpop.mall.business.entity.RoleBrand;
import com.cpop.mall.business.service.RoleBrandService; import com.cpop.mall.business.service.RoleBrandService;
import com.cpop.mall.business.vo.BrandListVo;
import com.cpop.mall.business.vo.StaffInfoVo; import com.cpop.mall.business.vo.StaffInfoVo;
import com.cpop.mall.business.vo.StaffPageVo; import com.cpop.mall.business.vo.StaffPageVo;
import com.cpop.system.business.service.RoleService; import com.cpop.system.business.service.BrandService;
import com.cpop.system.business.vo.RoleVo; import com.cpop.system.business.vo.RoleVo;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
@ -28,16 +27,15 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.cpop.mall.business.entity.Staff;
import com.cpop.mall.business.service.StaffService; import com.cpop.mall.business.service.StaffService;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import java.io.Serializable;
import java.util.List; import java.util.List;
import static com.cpop.mall.business.entity.table.RoleBrandTableDef.ROLE_BRAND; import static com.cpop.mall.business.entity.table.RoleBrandTableDef.ROLE_BRAND;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE; import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
/** /**
@ -54,6 +52,9 @@ public class BackstageStaffController {
@Autowired @Autowired
private StaffService staffService; private StaffService staffService;
@Autowired
private BrandService brandService;
/** /**
* @descriptions 查询员工分页列表 * @descriptions 查询员工分页列表
* @author DB * @author DB
@ -121,7 +122,7 @@ public class BackstageStaffController {
@GetMapping("/getAllRoleList") @GetMapping("/getAllRoleList")
public R<List<RoleVo>> getAllSysRoleList() { public R<List<RoleVo>> getAllSysRoleList() {
//获取当前登陆用户所在品牌 //获取当前登陆用户所在品牌
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
String roleBrandId = loginStaffInfo.getString("roleBrandId"); String roleBrandId = loginStaffInfo.getString("roleBrandId");
RoleBrandService roleBrandService = SpringUtils.getBean(RoleBrandService.class); RoleBrandService roleBrandService = SpringUtils.getBean(RoleBrandService.class);
RoleBrand roleBrand = roleBrandService.getById(roleBrandId); RoleBrand roleBrand = roleBrandService.getById(roleBrandId);
@ -181,4 +182,17 @@ public class BackstageStaffController {
return R.ok(); return R.ok();
} }
/**
* @descriptions 查询员工分页列表
* @author DB
* @date 2023/09/07 18:07
* @return R<Page<SysStaffPageVo>>
*/
@ApiOperation("查询品牌列表")
@GetMapping("/getBrandList")
public R<List<BrandListVo>> getBrandList(String query) {
List<BrandListVo> list = brandService.listAs(QueryWrapper.create().and(BRAND.BRAND_NAME.like(query)), BrandListVo.class);
return R.ok(list);
}
} }

View File

@ -0,0 +1,96 @@
package com.cpop.mall.business.controller.mini;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.R;
import com.cpop.core.utils.SpringUtils;
import com.cpop.mall.business.bo.*;
import com.cpop.mall.business.entity.OrderEvaluate;
import com.cpop.mall.business.service.OrderEvaluateService;
import com.cpop.mall.business.service.OrderService;
import com.cpop.mall.business.vo.OrderPageVo;
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 static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
/**
* @author DB
* @createTime 2023/10/25 9:19
* @description
*/
@RestController
@Api(tags = "小程序商城-订单管理")
@RequestMapping("/mini/order")
public class MiniOrderController {
@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>> getOrderPage(@ApiParam("分页参数") OrderPageBo bo) {
Page<OrderPageVo> page = orderService.getOrderPage(bo);
return R.ok(page);
}
/**
* @descriptions 商城-订单-下单
* @author DB
* @date 2023/10/23 12:15
* @param bo 下单请求对象
* @return: com.cpop.core.base.R<java.lang.Void>
*/
@PostMapping("/placeOrder")
@ApiOperation("商城-订单-下单")
public R<Void> placeOrder(@RequestBody @Validated @ApiParam("商城-订单") PlaceOrderBo bo) {
orderService.placeOrder(bo);
return R.ok();
}
/**
* @param bo 评价订单对象
* @descriptions 评价订单
* @author DB
* @date 2023/10/23 12:15
* @return: com.cpop.core.base.R<java.lang.Void>
*/
@PostMapping("/orderEvaluate")
@ApiOperation("评价订单")
@Transactional(rollbackFor = Exception.class)
public R<Void> orderEvaluate(@RequestBody @Validated @ApiParam("评价订单对象") OrderEvaluateBo bo) {
SpringUtils.getBean(OrderEvaluateService.class).save(BeanUtils.mapToClass(bo, OrderEvaluate.class));
//修改订单
orderService.updateChain().set(ORDER.HAVE_EVALUATE, true).where(ORDER.ID.eq(bo.getOrderId())).update();
return R.ok();
}
/**
* @descriptions 申请退款
* @author DB
* @date 2023/10/26 17:22
* @param bo 申请退款对象
* @return: com.cpop.core.base.R<java.lang.Void>
*/
@PostMapping("/applyRefund")
@ApiOperation("申请退款")
@Transactional(rollbackFor = Exception.class)
public R<Void> applyRefund(@RequestBody @Validated @ApiParam("申请退款对象") OrderApplyRefundBo bo) {
orderService.applyRefund(bo);
return R.ok();
}
}

View File

@ -3,12 +3,15 @@ package com.cpop.mall.business.controller.mini;
import com.cpop.core.base.R; import com.cpop.core.base.R;
import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.SpringUtils;
import com.cpop.jambox.business.vo.CardTemplateListVo; import com.cpop.jambox.business.vo.CardTemplateListVo;
import com.cpop.mall.business.bo.PlaceOrderBo;
import com.cpop.mall.business.bo.ProductBo; import com.cpop.mall.business.bo.ProductBo;
import com.cpop.mall.business.bo.ProductPageBo; import com.cpop.mall.business.bo.ProductPageBo;
import com.cpop.mall.business.service.ProductRecordService; import com.cpop.mall.business.service.ProductRecordService;
import com.cpop.mall.business.service.ProductService; import com.cpop.mall.business.service.ProductService;
import com.cpop.mall.business.service.ProductSpecificationService; import com.cpop.mall.business.service.ProductSpecificationService;
import com.cpop.mall.business.vo.ProductEvaluateVo;
import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.ProductPageVo;
import com.cpop.mall.business.vo.StoreListVo;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -31,7 +34,7 @@ import static com.cpop.mall.business.entity.table.ProductSpecificationTableDef.P
* @since 2023-10-23 * @since 2023-10-23
*/ */
@RestController @RestController
@Api(tags = "商城-商品管理") @Api(tags = "小程序商城-商品管理")
@RequestMapping("/mini/product") @RequestMapping("/mini/product")
public class MiniProductController { public class MiniProductController {
@ -53,94 +56,30 @@ public class MiniProductController {
} }
/** /**
* @descriptions 获取果酱课卡模板 * @descriptions 下单需要选择店铺/校区
* @author DB * @author DB
* @date 2023/10/23 11:56 * @date 2023/10/23 11:56
* @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>> * @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>>
*/ */
@GetMapping("/getJamboxCardTemplate") @GetMapping("/paySelectStore")
@ApiOperation("获取果酱课卡模板") @ApiOperation("下单需要选择店铺/校区")
public R<List<CardTemplateListVo>> getJamboxCardTemplate() { public R<List<StoreListVo>> paySelectStore() {
List<CardTemplateListVo> list = productService.getJamboxCardTemplate(); List<StoreListVo> list = productService.paySelectStore();
return R.ok(list); return R.ok(list);
} }
/** /**
* @descriptions 创建规格 * @descriptions 查询商品评价分页列表
* @author DB * @author DB
* @date 2023/10/23 12:15 * @date 2023/10/23 11:56
* @param specificationGroups 规格集合 * @param productId 商品id
* @return: com.cpop.core.base.R<java.lang.Void> * @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>>
*/ */
@PostMapping("/createSpecification") @GetMapping("/getOrderEvaluatePage/{productId}")
@ApiOperation("创建规格") @ApiOperation("查询商品评价分页列表")
public R<List<String>> createSpecification(@RequestBody @ApiParam("规格集合") List<List<String>> specificationGroups) { public R<Page<ProductEvaluateVo>> getOrderEvaluatePage(@PathVariable @ApiParam("商品id") String productId) {
List<String> list = productService.createSpecification(specificationGroups); Page<ProductEvaluateVo> page = productService.getOrderEvaluatePage(productId);
return R.ok(list); return R.ok(page);
} }
/**
* @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();
}
} }

View File

@ -65,6 +65,11 @@ public class Order extends BaseEntity implements Serializable {
*/ */
private String storeId; private String storeId;
/**
* 模板id
*/
private String templateId;
/** /**
* 产品名 * 产品名
*/ */
@ -105,6 +110,11 @@ public class Order extends BaseEntity implements Serializable {
*/ */
private String remarks; private String remarks;
/**
* 是否评价(0否1是)
*/
private String haveEvaluate;
/** /**
* 逻辑删除0否1是 * 逻辑删除0否1是
*/ */

View File

@ -14,6 +14,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/** /**
* 商城订单详情表 实体类 * 商城订单详情表 实体类
* *
@ -50,6 +52,11 @@ public class OrderDetail extends BaseEntity implements Serializable {
*/ */
private Integer point; private Integer point;
/**
* 下单数量
*/
private Integer number;
/** /**
* 逻辑删除0否1是 * 逻辑删除0否1是
*/ */

View File

@ -0,0 +1,63 @@
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-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Table(value = "cp_mall_order_evaluate", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
public class OrderEvaluate extends BaseEntity implements Serializable {
/**
* 主键
*/
@Id
private String id;
/**
* 产品id
*/
private String productId;
/**
* 订单id
*/
private String orderId;
/**
* 评价
*/
private String evaluate;
/**
*
*/
private Double start;
/**
* 逻辑删除0否1是
*/
@Column(isLogicDelete = true)
private Boolean isDelete;
}

View File

@ -7,6 +7,7 @@ import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table; import com.mybatisflex.annotation.Table;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -69,9 +70,30 @@ public class Product extends BaseEntity implements Serializable {
*/ */
private Integer buyRestrict; private Integer buyRestrict;
/**
* 限购数量
*/
private Integer limitNum;
/**
* 支付方式
*/
private Integer payType;
/**
* 上下架
*/
private Boolean isUp;
/**
* 最高价
*/
private BigDecimal maxPrice;
/**
* 最低价
*/
private BigDecimal minPrice;
/** /**
* 逻辑删除0否1是 * 逻辑删除0否1是

View File

@ -0,0 +1,40 @@
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.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-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Table(value = "cp_mall_product_out", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
public class ProductOut extends BaseEntity implements Serializable {
/**
* 商品id
*/
private String productId;
/**
* 外部关联id
*/
private String outJoinId;
}

View File

@ -24,7 +24,7 @@ import lombok.experimental.Accessors;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@Table(value = "cp_mall_product_specification_record", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) @Table(value = "cp_mall_product_record", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
public class ProductRecord extends BaseEntity implements Serializable { public class ProductRecord extends BaseEntity implements Serializable {
/** /**
@ -44,7 +44,7 @@ public class ProductRecord extends BaseEntity implements Serializable {
private String recordNames; private String recordNames;
/** /**
* 数量 * 数量(库存)
*/ */
private Integer recordNum; private Integer recordNum;

View File

@ -3,6 +3,8 @@ package com.cpop.mall.business.entity;
import com.cpop.core.base.entity.BaseEntity; import com.cpop.core.base.entity.BaseEntity;
import com.cpop.core.base.entity.BaseInsertListener; import com.cpop.core.base.entity.BaseInsertListener;
import com.cpop.core.base.entity.BaseUpdateListener; import com.cpop.core.base.entity.BaseUpdateListener;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.gateway.miniProgram.MiniUserLoginInfoBuild;
import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table; import com.mybatisflex.annotation.Table;
@ -44,15 +46,16 @@ public class Staff extends BaseEntity implements Serializable {
*/ */
private String userId; private String userId;
/**
* 用户来源
*/
private SourceType sourceType;
/** /**
* 角色-品牌-id * 角色-品牌-id
*/ */
private String roleBrandId; private String roleBrandId;
/** /**
* 逻辑删除(0否1是) * 逻辑删除(0否1是)
*/ */

View File

@ -0,0 +1,14 @@
package com.cpop.mall.business.mapper;
import com.mybatisflex.core.BaseMapper;
import com.cpop.mall.business.entity.OrderEvaluate;
/**
* 商城-订单评价表 映射层
*
* @author DB
* @since 2023-10-26
*/
public interface OrderEvaluateMapper extends BaseMapper<OrderEvaluate> {
}

View File

@ -0,0 +1,14 @@
package com.cpop.mall.business.mapper;
import com.mybatisflex.core.BaseMapper;
import com.cpop.mall.business.entity.ProductOut;
/**
* 商城-商品外部拓展表 映射层
*
* @author DB
* @since 2023-10-26
*/
public interface ProductOutMapper extends BaseMapper<ProductOut> {
}

View File

@ -0,0 +1,14 @@
package com.cpop.mall.business.service;
import com.mybatisflex.core.service.IService;
import com.cpop.mall.business.entity.OrderEvaluate;
/**
* 商城-订单评价表 服务层
*
* @author DB
* @since 2023-10-26
*/
public interface OrderEvaluateService extends IService<OrderEvaluate> {
}

View File

@ -1,6 +1,8 @@
package com.cpop.mall.business.service; package com.cpop.mall.business.service;
import com.cpop.mall.business.bo.OrderApplyRefundBo;
import com.cpop.mall.business.bo.OrderPageBo; import com.cpop.mall.business.bo.OrderPageBo;
import com.cpop.mall.business.bo.PlaceOrderBo;
import com.cpop.mall.business.vo.OrderPageVo; import com.cpop.mall.business.vo.OrderPageVo;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService; import com.mybatisflex.core.service.IService;
@ -22,4 +24,22 @@ public interface OrderService extends IService<Order> {
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.OrderPageVo> * @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.OrderPageVo>
*/ */
Page<OrderPageVo> getOrderPage(OrderPageBo bo); Page<OrderPageVo> getOrderPage(OrderPageBo bo);
/**
* @descriptions 商城-订单-下单
* @author DB
* @date 2023/10/25 9:32
* @param bo 下单请求对象
* @return: void
*/
void placeOrder(PlaceOrderBo bo);
/**
* @descriptions 申请退款
* @author DB
* @date 2023/10/26 17:24
* @param bo 申请退款对象
* @return: void
*/
void applyRefund(OrderApplyRefundBo bo);
} }

View File

@ -0,0 +1,14 @@
package com.cpop.mall.business.service;
import com.mybatisflex.core.service.IService;
import com.cpop.mall.business.entity.ProductOut;
/**
* 商城-商品外部拓展表 服务层
*
* @author DB
* @since 2023-10-26
*/
public interface ProductOutService extends IService<ProductOut> {
}

View File

@ -4,7 +4,9 @@ import com.cpop.jambox.business.entity.CardTemplate;
import com.cpop.jambox.business.vo.CardTemplateListVo; import com.cpop.jambox.business.vo.CardTemplateListVo;
import com.cpop.mall.business.bo.ProductBo; import com.cpop.mall.business.bo.ProductBo;
import com.cpop.mall.business.bo.ProductPageBo; import com.cpop.mall.business.bo.ProductPageBo;
import com.cpop.mall.business.vo.ProductEvaluateVo;
import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.ProductPageVo;
import com.cpop.mall.business.vo.StoreListVo;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService; import com.mybatisflex.core.service.IService;
import com.cpop.mall.business.entity.Product; import com.cpop.mall.business.entity.Product;
@ -72,4 +74,21 @@ public interface ProductService extends IService<Product> {
* @return: java.util.List<com.cpop.jambox.business.entity.CardTemplate> * @return: java.util.List<com.cpop.jambox.business.entity.CardTemplate>
*/ */
List<CardTemplateListVo> getJamboxCardTemplate(); List<CardTemplateListVo> getJamboxCardTemplate();
/**
* @descriptions 下单需要选择店铺/校区
* @author DB
* @date 2023/10/26 15:34
* @return: java.util.List<com.cpop.mall.business.vo.StoreListVo>
*/
List<StoreListVo> paySelectStore();
/**
* @descriptions 查询商品评价分页列表
* @author DB
* @date 2023/10/26 17:02
* @param productId 商品id
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.ProductEvaluateVo>
*/
Page<ProductEvaluateVo> getOrderEvaluatePage(String productId);
} }

View File

@ -0,0 +1,18 @@
package com.cpop.mall.business.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.mall.business.entity.OrderEvaluate;
import com.cpop.mall.business.mapper.OrderEvaluateMapper;
import com.cpop.mall.business.service.OrderEvaluateService;
import org.springframework.stereotype.Service;
/**
* 商城-订单评价表 服务层实现
*
* @author DB
* @since 2023-10-26
*/
@Service("orderEvaluateService")
public class OrderEvaluateServiceImpl extends ServiceImpl<OrderEvaluateMapper, OrderEvaluate> implements OrderEvaluateService {
}

View File

@ -1,11 +1,25 @@
package com.cpop.mall.business.service.impl; package com.cpop.mall.business.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cpop.common.utils.StringUtils;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.base.enums.UserType;
import com.cpop.core.service.RedisService;
import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.SpringUtils;
import com.cpop.core.utils.sql.SqlUtils; import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.mall.business.bo.OrderApplyRefundBo;
import com.cpop.mall.business.bo.OrderPageBo; import com.cpop.mall.business.bo.OrderPageBo;
import com.cpop.mall.business.bo.PlaceOrderBo;
import com.cpop.mall.business.entity.OrderDetail;
import com.cpop.mall.business.entity.OrderRefund;
import com.cpop.mall.business.entity.Product;
import com.cpop.mall.business.service.OrderDetailService;
import com.cpop.mall.business.service.OrderRefundService;
import com.cpop.mall.business.service.ProductService;
import com.cpop.mall.business.vo.OrderPageVo; import com.cpop.mall.business.vo.OrderPageVo;
import com.cpop.mall.framework.constant.MallRedisConstant;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl; import com.mybatisflex.spring.service.impl.ServiceImpl;
@ -13,9 +27,16 @@ import com.cpop.mall.business.entity.Order;
import com.cpop.mall.business.mapper.OrderMapper; import com.cpop.mall.business.mapper.OrderMapper;
import com.cpop.mall.business.service.OrderService; import com.cpop.mall.business.service.OrderService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER; import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD;
import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT;
/** /**
@ -37,18 +58,101 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Override @Override
public Page<OrderPageVo> getOrderPage(OrderPageBo bo) { public Page<OrderPageVo> getOrderPage(OrderPageBo bo) {
//获取当前登陆用户信息 //获取当前登陆用户信息
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
//如果是商城员工
QueryWrapper queryWrapper = QueryWrapper.create();
UserType userType = UserType.valueOf(loginUserInfo.getString("userType"));
if (userType == UserType.MALL_USER){
//只能查询当前用户品牌下所有订单
queryWrapper.where(ORDER.BRAND_ID.eq(loginUserInfo.getString("brandId")));
}
//如果是小程序用户
if (userType == UserType.MINI_USER) {
//查询此用户订单
queryWrapper.where(ORDER.PAY_USER_ID.eq(loginUserInfo.getString("userId")));
}
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(), return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
QueryWrapper.create() queryWrapper
.select(ORDER.ALL_COLUMNS) .select(ORDER.ALL_COLUMNS)
.from(ORDER) .from(ORDER)
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(ORDER.PAY_USER_ID)) .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(ORDER.PAY_USER_NAME.like(bo.getPayUserName()))
.and(SYS_USER.PHONE_NUMBER.eq(bo.getPayUserPhone())) .and(SYS_USER.PHONE_NUMBER.eq(bo.getPayUserPhone()))
.and(ORDER.PRODUCT_NAMES.like(bo.getProductName())) .and(ORDER.PRODUCT_NAMES.like(bo.getProductName()))
//订单状态
.and(ORDER.ORDER_STATUS.eq(bo.getOrderStatus()))
.orderBy(ORDER.CREATE_TIME.desc()), .orderBy(ORDER.CREATE_TIME.desc()),
OrderPageVo.class); OrderPageVo.class);
} }
/**
* @descriptions 商城-订单-下单
* @author DB
* @date 2023/10/25 9:32
* @param bo 下单请求对象
* @return: void
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void placeOrder(PlaceOrderBo bo) {
Order order = BeanUtils.mapToClass(bo, Order.class);
List<OrderDetail> orderDetails = BeanUtils.mapToList(bo.getPlaceOrderDetailList(), OrderDetail.class);
//规格记录ids
Set<String> recordIds = orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet());
//获取涉及到的商品
ProductService productService = SpringUtils.getBean(ProductService.class);
List<Product> productList = productService.queryChain()
.select(PRODUCT.ID, PRODUCT.PRODUCT_NAME)
.from(PRODUCT)
.leftJoin(PRODUCT_RECORD).on(PRODUCT_RECORD.PRODUCT_ID.eq(PRODUCT.ID))
.where(PRODUCT_RECORD.ID.in(recordIds))
.list();
//获取当前下单用户信息
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
//设置待付款
order.setOrderStatus(0)
.setProductNames(productList.stream().map(Product::getProductName).collect(Collectors.joining(",")))
.setPayUserId(loginStaffInfo.getString("userId"));
if (StringUtils.isBlank(bo.getPayUserName())) {
order.setPayUserName(loginStaffInfo.getString("nickName"));
}
this.save(order);
//保存订单详情
orderDetails.forEach(item -> {
item.setOrderId(order.getId());
});
SpringUtils.getBean(OrderDetailService.class).saveBatch(orderDetails);
}
/**
* @descriptions 库存是否足够
* @author DB
* @date 2023/10/25 10:18
* @param recordId 规格记录id
* @param num 下单数量
* @return: java.lang.Boolean
*/
private Boolean recordNumIsEnough(String recordId,Integer num) {
RedisService redisService = SpringUtils.getBean(RedisService.class);
//库存
Integer stockNum = redisService.getCacheObject(MallRedisConstant.STOCK_RECORD_NUM + recordId);
return stockNum - num >= 0;
}
/**
* @descriptions 申请退款
* @author DB
* @date 2023/10/26 17:24
* @param bo 申请退款对象
* @return: void
*/
@Override
public void applyRefund(OrderApplyRefundBo bo) {
OrderRefund orderRefund = BeanUtils.mapToClass(bo, OrderRefund.class);
orderRefund.setRefundStatus(0);
SpringUtils.getBean(OrderRefundService.class).save(orderRefund);
//修改订单状态
this.updateChain().set(ORDER.ORDER_STATUS, 3).where(ORDER.ID.eq(bo.getOrderId())).update();
}
} }

View File

@ -0,0 +1,18 @@
package com.cpop.mall.business.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.mall.business.entity.ProductOut;
import com.cpop.mall.business.mapper.ProductOutMapper;
import com.cpop.mall.business.service.ProductOutService;
import org.springframework.stereotype.Service;
/**
* 商城-商品外部拓展表 服务层实现
*
* @author DB
* @since 2023-10-26
*/
@Service("productOutService")
public class ProductOutServiceImpl extends ServiceImpl<ProductOutMapper, ProductOut> implements ProductOutService {
}

View File

@ -4,22 +4,32 @@ import com.alibaba.fastjson.JSONObject;
import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.StringUtils;
import com.cpop.common.utils.bean.BeanUtils; import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.gateway.miniProgram.MiniUserLoginInfoBuild;
import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.SpringUtils;
import com.cpop.core.utils.sql.SqlUtils; import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.jambox.business.entity.CardTemplate; import com.cpop.jambox.business.entity.BrandExtend;
import com.cpop.jambox.business.service.BrandExtendService;
import com.cpop.jambox.business.vo.CardTemplateListVo; import com.cpop.jambox.business.vo.CardTemplateListVo;
import com.cpop.mall.business.bo.ProductBo; import com.cpop.mall.business.bo.ProductBo;
import com.cpop.mall.business.bo.ProductPageBo; import com.cpop.mall.business.bo.ProductPageBo;
import com.cpop.mall.business.entity.ProductSpecification; import com.cpop.mall.business.entity.ProductSpecification;
import com.cpop.mall.business.entity.ProductRecord; import com.cpop.mall.business.entity.ProductRecord;
import com.cpop.mall.business.service.OrderEvaluateService;
import com.cpop.mall.business.service.ProductRecordService; import com.cpop.mall.business.service.ProductRecordService;
import com.cpop.mall.business.service.ProductSpecificationService; import com.cpop.mall.business.service.ProductSpecificationService;
import com.cpop.mall.business.vo.ProductEvaluateVo;
import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.ProductPageVo;
import com.cpop.mall.business.vo.ProductRecordVo;
import com.cpop.mall.business.vo.StoreListVo;
import com.cpop.system.business.entity.Brand;
import com.cpop.system.business.service.BrandService;
import com.mybatisflex.core.datasource.DataSourceKey; import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db; import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.row.Row; import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowUtil; import com.mybatisflex.core.row.RowUtil;
import com.mybatisflex.spring.service.impl.ServiceImpl; import com.mybatisflex.spring.service.impl.ServiceImpl;
@ -29,12 +39,18 @@ import com.cpop.mall.business.service.ProductService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import static com.cpop.jambox.business.entity.table.BrandExtendTableDef.BRAND_EXTEND;
import static com.cpop.mall.business.entity.table.OrderEvaluateTableDef.ORDER_EVALUATE;
import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD; import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD;
import static com.cpop.mall.business.entity.table.ProductSpecificationTableDef.PRODUCT_SPECIFICATION; import static com.cpop.mall.business.entity.table.ProductSpecificationTableDef.PRODUCT_SPECIFICATION;
import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT; import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
/** /**
* 商城-商品表 服务层实现 * 商城-商品表 服务层实现
@ -55,13 +71,22 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
@Override @Override
public Page<ProductPageVo> getProductPage(ProductPageBo bo) { public Page<ProductPageVo> getProductPage(ProductPageBo bo) {
//获取当前用户品牌 //获取当前用户品牌
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
QueryWrapper queryWrapper = QueryWrapper.create();
if (null != bo.getPriceOrder()){
if (bo.getPriceOrder()) {
queryWrapper.orderBy(PRODUCT.MAX_PRICE.desc());
} else {
queryWrapper.orderBy(PRODUCT.MIN_PRICE.asc());
}
}
return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(), return this.mapper.paginateWithRelationsAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
QueryWrapper.create() queryWrapper
.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()))
.and(PRODUCT.PRODUCT_TYPE.eq(bo.getProductType())) .and(PRODUCT.PRODUCT_TYPE.eq(bo.getProductType()))
.and(PRODUCT.BUY_RESTRICT.eq(bo.getBuyRestrict()))
.orderBy(pageDomain.getOrderByColumn()), .orderBy(pageDomain.getOrderByColumn()),
ProductPageVo.class); ProductPageVo.class);
} }
@ -115,7 +140,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
public void insertProduct(ProductBo bo) { public void insertProduct(ProductBo bo) {
Product product = BeanUtils.mapToClass(bo, Product.class); Product product = BeanUtils.mapToClass(bo, Product.class);
if (StringUtils.isBlank(bo.getBrandId())){ if (StringUtils.isBlank(bo.getBrandId())){
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
product.setBrandId(loginStaffInfo.getString("brandId")); product.setBrandId(loginStaffInfo.getString("brandId"));
} }
this.save(product); this.save(product);
@ -189,12 +214,96 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
*/ */
@Override @Override
public List<CardTemplateListVo> getJamboxCardTemplate() { public List<CardTemplateListVo> getJamboxCardTemplate() {
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
//获取果酱品牌拓展信息
BrandExtendService brandExtendService = SpringUtils.getBean(BrandExtendService.class);
BrandExtend brandExtend = brandExtendService.queryChain()
.leftJoin(BRAND).on(BRAND.ID.eq(BRAND_EXTEND.BRAND_ID))
.where(BRAND.ID.eq(loginStaffInfo.getString("brandId"))).one();
//多数据源 //多数据源
List<Row> rowList;
List<CardTemplateListVo> cardTemplateListVos;
try {
DataSourceKey.use("jambox"); DataSourceKey.use("jambox");
List<Row> rowList = Db.selectListByQuery("t_card_template", QueryWrapper.create() rowList = Db.selectListByQuery("t_card_template", QueryWrapper.create()
.select("template_id AS id,brand_id,name") .select("tct.template_id AS id,tct.brand_id,tct.name")
.where("brand_id = ?", loginStaffInfo.getString("brandId"))); .from("t_card_template").as("tct")
return RowUtil.toEntityList(rowList, CardTemplateListVo.class); .leftJoin("t_brand_info").as("tbi").on("tbi.id = tct.brand_id")
.where("tbi.brand_id = ?", brandExtend.getBrandCloudId()));
cardTemplateListVos = RowUtil.toEntityList(rowList, CardTemplateListVo.class);
} finally {
DataSourceKey.clear();
}
return cardTemplateListVos;
}
/**
* @descriptions 下单需要选择店铺/校区
* @author DB
* @date 2023/10/26 15:34
* @return: java.util.List<com.cpop.mall.business.vo.StoreListVo>
*/
@Override
public List<StoreListVo> paySelectStore() {
//获取当前用户信息
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
SourceType sourceType = SourceType.valueOf(loginUserInfo.getString("sourceType"));
switch (sourceType) {
//果酱
case JAMBOX:
BrandExtend brandExtend = SpringUtils.getBean(BrandExtendService.class).queryChain()
.from(BRAND_EXTEND)
.leftJoin(BRAND).on(BRAND.ID.eq(BRAND_EXTEND.BRAND_ID))
.where(BRAND.ID.eq(loginUserInfo.getString("brandId"))).one();
return getJamboxStore(brandExtend.getBrandCloudId());
case COMMON:
break;
default:
}
return null;
}
/**
* @descriptions 获取果酱校区信息
* @author DB
* @date 2023/10/26 15:54
* @param brandCloudId 云平拍id
* @return: java.util.List<com.cpop.mall.business.vo.StoreListVo>
*/
private List<StoreListVo> getJamboxStore(String brandCloudId) {
try {
DataSourceKey.use("jambox");
//机构表
List<Row> list = DbChain.table("t_mechanism_info")
.select("tmi.mechanism as storeName", "tmi.mechanism_id as id")
.from("t_mechanism_info").as("tmi")
.leftJoin("t_brand_info").as("tbi").on("tbi.id = tmi.brand_id")
.where("tbi.brand_id = ?", brandCloudId)
.list();
return RowUtil.toEntityList(list,StoreListVo.class);
} finally {
DataSourceKey.clear();
}
}
/**
* @descriptions 查询商品评价分页列表
* @author DB
* @date 2023/10/26 17:02
* @param productId 商品id
* @return: com.mybatisflex.core.paginate.Page<com.cpop.mall.business.vo.ProductEvaluateVo>
*/
@Override
public Page<ProductEvaluateVo> getOrderEvaluatePage(String productId) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
OrderEvaluateService evaluateService = SpringUtils.getBean(OrderEvaluateService.class);
return evaluateService.getMapper().paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
QueryWrapper.create()
.select(ORDER_EVALUATE.ALL_COLUMNS)
.from(ORDER_EVALUATE)
.leftJoin(ORDER).on(ORDER.ID.eq(ORDER_EVALUATE.ORDER_ID))
.leftJoin(PRODUCT).on(PRODUCT.ID.eq(ORDER_EVALUATE.PRODUCT_ID))
.where(PRODUCT.ID.eq(productId)),
ProductEvaluateVo.class);
} }
} }

View File

@ -27,9 +27,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.mall.business.entity.table.RoleBrandTableDef.ROLE_BRAND; import static com.cpop.mall.business.entity.table.RoleBrandTableDef.ROLE_BRAND;
import static com.cpop.mall.business.entity.table.StaffTableDef.STAFF; import static com.cpop.mall.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.system.business.entity.table.MenuTableDef.MENU; import static com.cpop.system.business.entity.table.MenuTableDef.MENU;
import static com.cpop.system.business.entity.table.RoleMenuTableDef.ROLE_MENU; import static com.cpop.system.business.entity.table.RoleMenuTableDef.ROLE_MENU;
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE; import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
@ -55,7 +55,7 @@ public class RoleBrandServiceImpl extends ServiceImpl<RoleBrandMapper, RoleBrand
@Override @Override
public Page<MallRolePageVo> getMallRolePageList(MallRolePageBo bo) { public Page<MallRolePageVo> getMallRolePageList(MallRolePageBo bo) {
//获取当前登录用户信息 //获取当前登录用户信息
JSONObject staffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject staffInfo = SecurityUtils.getInstance().getLoginUserInfo();
//获取分页参数 //获取分页参数
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
@ -105,7 +105,7 @@ public class RoleBrandServiceImpl extends ServiceImpl<RoleBrandMapper, RoleBrand
//录入商城角色品牌表 //录入商城角色品牌表
RoleBrand roleBrand = new RoleBrand(); RoleBrand roleBrand = new RoleBrand();
if (StringUtils.isBlank(bo.getBrandId())){ if (StringUtils.isBlank(bo.getBrandId())){
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
roleBrand.setRoleId(role.getId()) roleBrand.setRoleId(role.getId())
.setBrandId(loginStaffInfo.getString("brandId")); .setBrandId(loginStaffInfo.getString("brandId"));
} else { } else {

View File

@ -8,6 +8,7 @@ import com.cpop.core.base.entity.LoginUser;
import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo; import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo;
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.base.enums.UserType; import com.cpop.core.base.enums.UserType;
import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.base.table.SysUser; import com.cpop.core.base.table.SysUser;
@ -23,6 +24,8 @@ import com.cpop.mall.business.entity.RoleBrand;
import com.cpop.mall.business.service.RoleBrandService; import com.cpop.mall.business.service.RoleBrandService;
import com.cpop.mall.business.vo.StaffInfoVo; import com.cpop.mall.business.vo.StaffInfoVo;
import com.cpop.mall.business.vo.StaffPageVo; import com.cpop.mall.business.vo.StaffPageVo;
import com.cpop.system.business.entity.Brand;
import com.cpop.system.business.service.BrandService;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.DbChain; import com.mybatisflex.core.row.DbChain;
@ -39,6 +42,7 @@ import java.time.LocalDateTime;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.mall.business.entity.table.RoleBrandTableDef.ROLE_BRAND; import static com.cpop.mall.business.entity.table.RoleBrandTableDef.ROLE_BRAND;
import static com.cpop.mall.business.entity.table.StaffTableDef.STAFF; import static com.cpop.mall.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE; import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
import static com.mybatisflex.core.query.QueryMethods.distinct; import static com.mybatisflex.core.query.QueryMethods.distinct;
import static com.mybatisflex.core.query.QueryMethods.groupConcat; import static com.mybatisflex.core.query.QueryMethods.groupConcat;
@ -68,11 +72,14 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
.select(distinct(STAFF.ALL_COLUMNS)) .select(distinct(STAFF.ALL_COLUMNS))
.select(SYS_USER.USER_NAME,SYS_USER.NICK_NAME, SYS_USER.EMAIL, SYS_USER.PHONE_NUMBER, SYS_USER.SEX, SYS_USER.AVATAR, SYS_USER.STATUS, SYS_USER.PASSWORD) .select(SYS_USER.USER_NAME,SYS_USER.NICK_NAME, SYS_USER.EMAIL, SYS_USER.PHONE_NUMBER, SYS_USER.SEX, SYS_USER.AVATAR, SYS_USER.STATUS, SYS_USER.PASSWORD)
.select(ROLE.ROLE_NAME) .select(ROLE.ROLE_NAME)
.select(ROLE_BRAND.BRAND_ID)
.select(BRAND.BRAND_NAME)
.from(STAFF) .from(STAFF)
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID)) .leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID))
//关键中间表 //关键中间表
.leftJoin(ROLE_BRAND).on(ROLE_BRAND.ID.eq(STAFF.ROLE_BRAND_ID)) .leftJoin(ROLE_BRAND).on(ROLE_BRAND.ID.eq(STAFF.ROLE_BRAND_ID))
.leftJoin(ROLE).on(ROLE.ID.eq(ROLE_BRAND.ROLE_ID)) .leftJoin(ROLE).on(ROLE.ID.eq(ROLE_BRAND.ROLE_ID))
.leftJoin(BRAND).on(BRAND.ID.eq(ROLE_BRAND.BRAND_ID))
//姓名 //姓名
.and(STAFF.NAME.like(bo.getName())) .and(STAFF.NAME.like(bo.getName()))
.and(SYS_USER.USER_NAME.ne(Constants.SUPER_ADMIN).or(SYS_USER.USER_NAME.isNull())) .and(SYS_USER.USER_NAME.ne(Constants.SUPER_ADMIN).or(SYS_USER.USER_NAME.isNull()))
@ -116,15 +123,19 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
roleBrand.setBrandId(bo.getBrandId()); roleBrand.setBrandId(bo.getBrandId());
} else { } else {
//获取当前用户信息 //获取当前用户信息
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
roleBrand.setBrandId(loginStaffInfo.getString("brandId")); roleBrand.setBrandId(loginStaffInfo.getString("brandId"));
} }
roleBrand.setRoleId(bo.getRoleId()); //获取品牌信息
Brand brand = SpringUtils.getBean(BrandService.class).queryChain().where(BRAND.ID.eq(roleBrand.getBrandId())).one();
//TODO:角色暂时不做处理,都是超级管理员
//roleBrand.setRoleId(bo.getRoleId());
//设置中间表 //设置中间表
roleBrandService.save(roleBrand); roleBrandService.save(roleBrand);
staff.setUserId(sysUser.getId()) staff.setUserId(sysUser.getId())
.setName(bo.getName()) .setName(bo.getName())
.setRoleBrandId(roleBrand.getId()); .setRoleBrandId(roleBrand.getId())
.setSourceType(brand.getSourceType());
this.save(staff); this.save(staff);
} }
@ -280,7 +291,7 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
@Override @Override
public void modifyUserPassword(ModifyUserPasswordBo bo) { public void modifyUserPassword(ModifyUserPasswordBo bo) {
//只允许超级管理员或自己修改面膜 //只允许超级管理员或自己修改面膜
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
String userName = loginStaffInfo.getString("userName"); String userName = loginStaffInfo.getString("userName");
//同数据库密码进行比较 //同数据库密码进行比较
SysUser user = DbChain.table(SYS_USER) SysUser user = DbChain.table(SYS_USER)

View File

@ -0,0 +1,32 @@
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;
/**
* Description:
* date: 2023/6/2 17:39
*
* @author DB
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "Brand对象", description = "品牌表")
public class BrandListVo implements Serializable {
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 云函数id
*/
@ApiModelProperty("品牌名")
private String brandName;
}

View File

@ -0,0 +1,59 @@
package com.cpop.mall.business.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Id;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author DB
* @createTime 2023/10/26 17:02
* @description
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "商城商品评价分页返回对象")
public class ProductEvaluateVo implements Serializable {
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 产品id
*/
@ApiModelProperty("产品id")
private String productId;
/**
* 订单id
*/
@ApiModelProperty("订单id")
private String orderId;
/**
* 评价
*/
@ApiModelProperty("评价")
private String evaluate;
/**
*
*/
@ApiModelProperty("")
private Double start;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -1,6 +1,7 @@
package com.cpop.mall.business.vo; package com.cpop.mall.business.vo;
import com.cpop.mall.business.entity.ProductSpecification; import com.cpop.mall.business.entity.ProductSpecification;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.RelationOneToMany; import com.mybatisflex.annotation.RelationOneToMany;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -8,6 +9,8 @@ import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -56,6 +59,12 @@ public class ProductPageVo implements Serializable {
@ApiModelProperty("描述") @ApiModelProperty("描述")
private String description; private String description;
/**
* 上下架
*/
@ApiModelProperty("上下架")
private Boolean isUp;
/** /**
* 商品图地址 * 商品图地址
*/ */
@ -68,17 +77,36 @@ public class ProductPageVo implements Serializable {
@ApiModelProperty("购买限制(0:会员限制;1:新客限定;2:用户限购)") @ApiModelProperty("购买限制(0:会员限制;1:新客限定;2:用户限购)")
private Integer buyRestrict; private Integer buyRestrict;
/**
* 最高价
*/
@ApiModelProperty("最高价")
private BigDecimal maxPrice;
/**
* 最低价
*/
@ApiModelProperty("最低价")
private BigDecimal minPrice;
/** /**
* 产品规格 * 产品规格
*/ */
@RelationOneToMany(selfField = "id", targetField = "productId") @RelationOneToMany(selfField = "id", targetField = "productId",targetTable = "cp_mall_product_specification")
@ApiModelProperty("产品规格") @ApiModelProperty("产品规格")
private List<ProductSpecificationVo> productSpecificationVos; private List<ProductSpecificationVo> productSpecificationVos;
/** /**
* 产品规格记录 * 产品规格记录
*/ */
@RelationOneToMany(selfField = "id", targetField = "productId") @RelationOneToMany(selfField = "id", targetField = "productId",targetTable = "cp_mall_product_record")
@ApiModelProperty("产品规格记录") @ApiModelProperty("产品规格记录")
private List<ProductRecordVo> productRecordVos; private List<ProductRecordVo> productRecordVos;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
} }

View File

@ -46,6 +46,18 @@ public class StaffPageVo implements Serializable {
@ApiModelProperty("角色-品牌-id") @ApiModelProperty("角色-品牌-id")
private String roleBrandId; private String roleBrandId;
/**
* 品牌id
*/
@ApiModelProperty("品牌id")
private String brandId;
/**
* 品牌
*/
@ApiModelProperty("品牌")
private String brandName;
/** /**
* 用户名 * 用户名
*/ */

View File

@ -0,0 +1,29 @@
package com.cpop.mall.business.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author DB
* @createTime 2023/10/26 15:30
* @description
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "店铺/校区返回对象")
public class StoreListVo {
/**
* 主键
*/
@ApiModelProperty("主键")
private String id ;
/**
* 店铺/校区名
*/
@ApiModelProperty("店铺/校区名")
private String storeName;
}

View File

@ -0,0 +1,9 @@
package com.cpop.mall.framework.constant;
/**
* 商城redis实体类
*/
public interface MallRedisConstant {
String STOCK_RECORD_NUM = "mall:stock:recordNum:";
}

View 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.OrderEvaluateMapper">
</mapper>

View 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.ProductOutMapper">
</mapper>

View File

@ -59,9 +59,10 @@ public class MiniUser extends BaseEntity implements Serializable {
*/ */
private String avatar; private String avatar;
/**
* 来源类型
*/
private String sourceType;
/** /**
* 逻辑删除0否1是 * 逻辑删除0否1是

View File

@ -27,6 +27,10 @@
<groupId>com.cpop</groupId> <groupId>com.cpop</groupId>
<artifactId>Cpop-Jambox</artifactId> <artifactId>Cpop-Jambox</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.cpop</groupId>
<artifactId>Cpop-System</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,75 +0,0 @@
package com.cpop.oam.business.controller;
import com.mybatisflex.core.paginate.Page;
import com.cpop.core.base.R;
import com.cpop.jambox.business.bo.BrandBo;
import com.cpop.jambox.business.bo.BrandPageBo;
import com.cpop.jambox.business.service.BrandService;
import com.cpop.jambox.business.vo.BrandPageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 品牌表 控制层
*
* @author DB
* @since 2023-09-13
*/
@RestController
@Api(tags = "果酱-品牌接口")
@RequestMapping("/brand")
public class BrandController {
@Autowired
private BrandService brandService;
/**
* @descriptions 查询品牌分页列表
* @author DB
* @date 2023/09/13 17:55
* @param bo 请求参数
* @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.jambox.business.vo.BrandPageVo>>
*/
@PreAuthorize("@aps.hasPermission('brandAndCampus:brand:list')")
@ApiOperation("查询品牌分页列表")
@GetMapping("/getBrandPage")
public R<Page<BrandPageVo>> getBrandPageList(BrandPageBo bo) {
Page<BrandPageVo> pageVo = brandService.getBrandPage(bo);
return R.ok(pageVo);
}
/**
* @descriptions 修改品牌表
* @author DB
* @date 2023/09/14 11:40
* @param bo 请求参数
* @return com.cpop.core.base.R<java.lang.Void>
*/
@PreAuthorize("@aps.hasPermission('brandAndCampus:brand:update')")
@ApiOperation("修改品牌")
@PutMapping("/updateBrand")
public R<Void> updateBrand(@RequestBody @Validated BrandBo bo) {
brandService.updateBrand(bo);
return R.ok();
}
/**
* @Description: 删除品牌
* @param id 主键
* @return: R<Void>
* @Author: DB
* @Date: 2023/6/5 10:03
**/
@PreAuthorize("@aps.hasPermission('brandAndCampus:brand:remove')")
@ApiOperation("删除品牌")
@DeleteMapping("/removeBrandById/{id}")
public R<Void> removeBrandById(@PathVariable String id) {
brandService.removeById(id);
return R.ok();
}
}

View File

@ -1,12 +1,12 @@
package com.cpop.oam.business.controller; package com.cpop.oam.business.controller;
import com.cpop.system.business.service.BrandService;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.cpop.core.base.R; import com.cpop.core.base.R;
import com.cpop.jambox.business.bo.BrandStaffBo; import com.cpop.jambox.business.bo.BrandStaffBo;
import com.cpop.jambox.business.bo.BrandStaffPageBo; import com.cpop.jambox.business.bo.BrandStaffPageBo;
import com.cpop.jambox.business.bo.CampusListByBrandBo; import com.cpop.jambox.business.bo.CampusListByBrandBo;
import com.cpop.jambox.business.service.BrandService;
import com.cpop.jambox.business.service.BrandStaffService; import com.cpop.jambox.business.service.BrandStaffService;
import com.cpop.jambox.business.service.CampusService; import com.cpop.jambox.business.service.CampusService;
import com.cpop.jambox.business.vo.BrandListVo; import com.cpop.jambox.business.vo.BrandListVo;

View File

@ -1,97 +0,0 @@
package com.cpop.oam.business.controller;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.cpop.core.base.R;
import com.cpop.jambox.business.bo.CampusBo;
import com.cpop.jambox.business.bo.CampusPageBo;
import com.cpop.jambox.business.service.BrandService;
import com.cpop.jambox.business.service.CampusService;
import com.cpop.jambox.business.vo.BrandListVo;
import com.cpop.jambox.business.vo.CampusPageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 校区表 控制层
*
* @author DB
* @since 2023-09-13
*/
@RestController
@Api(tags = "果酱-校区接口")
@RequestMapping("/campus")
public class CampusController {
@Autowired
private CampusService campusService;
@Autowired
private BrandService brandService;
/**
* @Description: 查询校区分页列表
* @param bo 请求参数
* @return R<PageVo<CampusPageListVo>>
* @Author Administrator
* @Date: 2023/6/7 0007 10:18
*/
@PreAuthorize("@aps.hasPermission('brandAndCampus:campus:list')")
@ApiOperation("查询校区分页列表")
@GetMapping("/getCampusPage")
public R<Page<CampusPageVo>> getCampusPage(CampusPageBo bo) {
Page<CampusPageVo> pageVo = campusService.getCampusPage(bo);
return R.ok(pageVo);
}
/**
* @descriptions 查询品牌列表
* @author DB
* @date 2023/09/13 17:55
* @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.jambox.business.vo.BrandPageVo>>
*/
@ApiOperation("查询品牌列表")
@GetMapping("/getBrandList")
public R<List<BrandListVo>> getBrandList() {
List<BrandListVo> pageVo = brandService.listAs(QueryWrapper.create(), BrandListVo.class);
return R.ok(pageVo);
}
/**
* @descriptions 修改校区
* @author DB
* @date 2023/09/14 11:40
* @param bo 请求参数
* @return com.cpop.core.base.R<java.lang.Void>
*/
@PreAuthorize("@aps.hasPermission('brandAndCampus:campus:update')")
@ApiOperation("修改校区")
@PutMapping("/updateCampus")
public R<Void> updateCampus(@RequestBody @Validated CampusBo bo) {
campusService.updateCampus(bo);
return R.ok();
}
/**
* @Description: 删除校区
* @param id 主键
* @return: R<Void>
* @Author: DB
* @Date: 2023/6/5 10:03
**/
@PreAuthorize("@aps.hasPermission('brandAndCampus:campus:remove')")
@ApiOperation("删除校区")
@DeleteMapping("/removeCampusById/{id}")
public R<Void> removeCampusById(@PathVariable String id) {
brandService.removeById(id);
//TODO:通知到云库
return R.ok();
}
}

View File

@ -33,11 +33,11 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.oam.business.entity.table.TaskDemandTableDef.TASK_DEMAND; import static com.cpop.oam.business.entity.table.TaskDemandTableDef.TASK_DEMAND;
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK; import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
/** /**
* OAM-任务-需求表 服务层实现 * OAM-任务-需求表 服务层实现
@ -74,7 +74,7 @@ public class TaskDemandServiceImpl extends ServiceImpl<TaskDemandMapper, TaskDem
queryWrapper.select(TASK.ALL_COLUMNS) queryWrapper.select(TASK.ALL_COLUMNS)
.select(TASK_DEMAND.DEMAND_TYPE.as(TaskDemandPageVo::getDemandType),TASK_DEMAND.RECORD_STAFF_ID,TASK_DEMAND.BRAND_ID,TASK_DEMAND.CAMPUS_ID) .select(TASK_DEMAND.DEMAND_TYPE.as(TaskDemandPageVo::getDemandType),TASK_DEMAND.RECORD_STAFF_ID,TASK_DEMAND.BRAND_ID,TASK_DEMAND.CAMPUS_ID)
.select(CAMPUS.NAME.as(TaskDemandPageVo::getCampusName)) .select(CAMPUS.NAME.as(TaskDemandPageVo::getCampusName))
.select(BRAND.NAME.as(TaskDemandPageVo::getBrandName)) .select(BRAND.BRAND_NAME.as(TaskDemandPageVo::getBrandName))
.select(STAFF.NAME.as(TaskDemandPageVo::getRecordStaffName)) .select(STAFF.NAME.as(TaskDemandPageVo::getRecordStaffName))
.from(TASK) .from(TASK)
//任务需求表 //任务需求表

View File

@ -46,7 +46,6 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS;
import static com.cpop.oam.business.entity.table.DutyTableDef.DUTY; import static com.cpop.oam.business.entity.table.DutyTableDef.DUTY;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
@ -54,6 +53,7 @@ import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STA
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK; import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
import static com.cpop.oam.business.entity.table.TaskWorkOrderRecordTableDef.TASK_WORK_ORDER_RECORD; import static com.cpop.oam.business.entity.table.TaskWorkOrderRecordTableDef.TASK_WORK_ORDER_RECORD;
import static com.cpop.oam.business.entity.table.TaskWorkOrderTableDef.TASK_WORK_ORDER; import static com.cpop.oam.business.entity.table.TaskWorkOrderTableDef.TASK_WORK_ORDER;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
/** /**
* 任务-工单表 服务层实现 * 任务-工单表 服务层实现
@ -194,7 +194,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
TASK.ATTACHMENT_URL.as(TaskWorkOrderPageVo::getAttachmentUrl), TASK.RESPONSIBLE_STAFF_ID.as(TaskWorkOrderPageVo::getResponsibleStaffId), TASK.ATTACHMENT_URL.as(TaskWorkOrderPageVo::getAttachmentUrl), TASK.RESPONSIBLE_STAFF_ID.as(TaskWorkOrderPageVo::getResponsibleStaffId),
TASK.RESPONSIBLE_STAFF_ID.as(TaskWorkOrderPageVo::getResponsibleStaffId)) TASK.RESPONSIBLE_STAFF_ID.as(TaskWorkOrderPageVo::getResponsibleStaffId))
.select(STAFF.NAME.as(TaskWorkOrderPageVo::getRecordStaffId)) .select(STAFF.NAME.as(TaskWorkOrderPageVo::getRecordStaffId))
.select(BRAND.NAME.as(TaskWorkOrderPageVo::getBrandName)) .select(BRAND.BRAND_NAME.as(TaskWorkOrderPageVo::getBrandName))
.select(CAMPUS.NAME.as(TaskWorkOrderPageVo::getCampusName)) .select(CAMPUS.NAME.as(TaskWorkOrderPageVo::getCampusName))
.select("rs.name as responsibleStaffName") .select("rs.name as responsibleStaffName")
.from(TASK_WORK_ORDER) .from(TASK_WORK_ORDER)

View File

@ -33,6 +33,11 @@
<groupId>com.github.binarywang</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-cp</artifactId> <artifactId>weixin-java-cp</artifactId>
</dependency> </dependency>
<!--微信支付-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
</dependency>
<!-- 腾讯云--> <!-- 腾讯云-->
<dependency> <dependency>
<groupId>com.qcloud</groupId> <groupId>com.qcloud</groupId>

View File

@ -0,0 +1,46 @@
package com.cpop.system.business.bo;
import com.mybatisflex.annotation.Id;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author DB
* @createTime 2023/10/25 16:43
* @description
*/
@Data
@ApiModel(value = "品牌参数")
public class BrandBo {
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 品牌名
*/
@ApiModelProperty(value = "品牌名", required = true)
private String brandName;
/**
* 微信商户号
*/
@ApiModelProperty("微信商户号")
private String wxMchId;
/**
* 微信支付密钥
*/
@ApiModelProperty("微信支付密钥")
private String wxMchKey;
/**
* 微信支付keypath
*/
@ApiModelProperty("微信支付keypath")
private String wxKeyPath;
}

View File

@ -1,4 +1,4 @@
package com.cpop.jambox.business.bo; package com.cpop.system.business.bo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -0,0 +1,87 @@
package com.cpop.system.business.controller;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.R;
import com.cpop.core.base.enums.SourceType;
import com.cpop.system.business.bo.BrandBo;
import com.cpop.system.business.bo.BrandPageBo;
import com.cpop.system.business.vo.BrandPageVo;
import com.mybatisflex.core.paginate.Page;
import org.springframework.security.access.prepost.PreAuthorize;
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.system.business.entity.Brand;
import com.cpop.system.business.service.BrandService;
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-25
*/
@RestController
@Api(tags = "系统-品牌表接口")
@RequestMapping("/brand")
public class BrandController {
@Autowired
private BrandService brandService;
/**
* @descriptions 新增系统品牌
* @author DB
* @date 2023/10/25 16:53
* @param brand 品牌参数
* @return: com.cpop.core.base.R<java.lang.Void>
*/
@PostMapping("/insertSysBrand")
@ApiOperation("新增系统品牌")
public R<Void> insertSysBrand(@RequestBody @ApiParam("系统-品牌") BrandBo brand) {
Brand entity = BeanUtils.mapToClass(brand, Brand.class);
entity.setSourceType(SourceType.COMMON);
brandService.save(entity);
return R.ok();
}
/**
* @descriptions 导入果酱品牌
* @author DB
* @date 2023/10/25 15:53
* @param brandId 果酱品牌信息
* @return: boolean
*/
@PostMapping("/importJamboxBrand/{brandId}")
@ApiOperation("导入果酱品牌")
public R<Void> importJamboxBrand(@PathVariable String brandId) {
brandService.importJamboxBrand(brandId);
return R.ok();
}
/**
* @descriptions 查询品牌分页列表
* @author DB
* @date 2023/09/13 17:55
* @param bo 请求参数
* @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo>>
*/
@PreAuthorize("@aps.hasPermission('brandAndCampus:brand:list')")
@ApiOperation("查询品牌分页列表")
@GetMapping("/getBrandPage")
public R<Page<BrandPageVo>> getBrandPageList(BrandPageBo bo) {
Page<BrandPageVo> pageVo = brandService.getBrandPage(bo);
return R.ok(pageVo);
}
}

View File

@ -0,0 +1,69 @@
package com.cpop.system.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.cpop.core.base.enums.SourceType;
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-25
*/
@Data
@EqualsAndHashCode(callSuper=false)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Table(value = "cp_sys_brand", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
public class Brand extends BaseEntity implements Serializable {
/**
* 主键
*/
@Id
private String id;
/**
* 品牌名
*/
private String brandName;
/**
* 微信商户号
*/
private String wxMchId;
/**
* 微信支付密钥
*/
private String wxMchKey;
/**
* 微信支付keypath
*/
private String wxKeyPath;
/**
* 数据来源
*/
private SourceType sourceType;
/**
* 逻辑删除0否1是
*/
@Column(isLogicDelete = true)
private Boolean isDelete;
}

View File

@ -0,0 +1,14 @@
package com.cpop.system.business.mapper;
import com.mybatisflex.core.BaseMapper;
import com.cpop.system.business.entity.Brand;
/**
* 系统-品牌表 映射层
*
* @author DB
* @since 2023-10-25
*/
public interface BrandMapper extends BaseMapper<Brand> {
}

View File

@ -0,0 +1,34 @@
package com.cpop.system.business.service;
import com.cpop.system.business.bo.BrandPageBo;
import com.cpop.system.business.vo.BrandPageVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.cpop.system.business.entity.Brand;
/**
* 系统-品牌表 服务层
*
* @author DB
* @since 2023-10-25
*/
public interface BrandService extends IService<Brand> {
/**
* @descriptions 导入果酱品牌
* @author DB
* @date 2023/10/25 15:54
* @param brandId 果酱品牌id
* @return: void
*/
void importJamboxBrand(String brandId);
/**
* @descriptions 查询品牌分页列表
* @author DB
* @date 2023/10/25 17:32
* @param bo 请求参数
* @return: com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo>
*/
Page<BrandPageVo> getBrandPage(BrandPageBo bo);
}

View File

@ -0,0 +1,108 @@
package com.cpop.system.business.service.impl;
import com.cpop.core.base.entity.LoginUser;
import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.base.enums.SourceType;
import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.system.business.bo.BrandPageBo;
import com.cpop.system.business.vo.BrandPageVo;
import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowKey;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.system.business.entity.Brand;
import com.cpop.system.business.mapper.BrandMapper;
import com.cpop.system.business.service.BrandService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
/**
* 系统-品牌表 服务层实现
*
* @author DB
* @since 2023-10-25
*/
@Service("brandService")
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements BrandService {
/**
* @descriptions 导入果酱品牌
* @author DB
* @date 2023/10/25 15:54
* @param brandId 果酱品牌id
* @return: void
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void importJamboxBrand(String brandId) {
//获取果酱品牌信息
Row brand;
try {
DataSourceKey.use("jambox");
brand = Db.selectOneByQuery(QueryWrapper.create()
.select()
.from("t_brand_info")
.where("id = ?", brandId));
if (brand == null) {
throw new ServiceException("获取果酱品牌失败,请联系相关人员");
}
} finally {
DataSourceKey.clear();
}
//查询品牌是否已经录入
long count = DbChain.table("cp_j_brand_extend")
.where("brand_cloud_id = ?", brand.getString("brandId"))
.and("is_delete = 0")
.count();
if (count > 0) {
throw new ServiceException("当前品牌已导入,请勿重复导入");
}
Brand sysBrand = new Brand();
sysBrand.setBrandName(brand.getString("name"))
.setWxMchId(brand.getString("wxMchId"))
.setWxMchKey(brand.getString("wxMchKey"))
.setWxKeyPath(brand.getString("wxKeyPath"))
.setSourceType(SourceType.JAMBOX);
this.save(sysBrand);
//果酱拓展表信息
LocalDateTime now = LocalDateTime.now();
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
DbChain.table("cp_j_brand_extend")
.setId(RowKey.SNOW_FLAKE_ID)
.set("brand_id", sysBrand.getId())
.set("brand_cloud_id", brand.getString("brandId"))
.set("background_url", brand.getString("brandBg"))
.set("create_time", now)
.set("update_time", now)
.set("create_user_id", loginUser.getUserId())
.set("update_user_id", loginUser.getUserId())
.save();
}
/**
* @descriptions 查询品牌分页列表
* @author DB
* @date 2023/10/25 17:32
* @param bo 请求参数
* @return: com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo>
*/
@Override
public Page<BrandPageVo> getBrandPage(BrandPageBo bo) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
QueryWrapper.create()
.select(BRAND.ID,BRAND.BRAND_NAME,BRAND.WX_MCH_ID,BRAND.CREATE_TIME)
.and(BRAND.BRAND_NAME.like(bo.getName())),
BrandPageVo.class);
}
}

View File

@ -36,7 +36,7 @@ public class LoginServiceImpl implements LoginService {
//获取当前登录用户信息 //获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
//获取申请员工信息 //获取申请员工信息
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
return new LoginUserInfoVo() return new LoginUserInfoVo()
.setUserId(loginUser.getUserId()) .setUserId(loginUser.getUserId())
.setUsername(loginUser.getUsername()) .setUsername(loginUser.getUsername())

View File

@ -45,7 +45,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
//获取用户信息 //获取用户信息
LoginUser user = SecurityUtils.getInstance().getLoginUser(); LoginUser user = SecurityUtils.getInstance().getLoginUser();
//获取申请员工信息 //获取申请员工信息
JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginStaffInfo(); JSONObject loginStaffInfo = SecurityUtils.getInstance().getLoginUserInfo();
//超级管理员 //超级管理员
if (Constants.SUPER_ADMIN.equals(user.getUsername())) { if (Constants.SUPER_ADMIN.equals(user.getUsername())) {
//获取菜单 //获取菜单

View File

@ -1,7 +1,7 @@
package com.cpop.jambox.business.vo; package com.cpop.system.business.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.cpop.core.annontation.StringArrayConvert; import com.cpop.core.annontation.StringArrayConvert;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -13,8 +13,7 @@ import java.time.LocalDateTime;
/** /**
* Description: * Description:
* date: 2023/6/1 18:08 * date: 2023/6/1 18:08
* * @author DB
* @Author ST
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ -32,39 +31,14 @@ public class BrandPageVo implements Serializable {
/** /**
* 云函数id * 云函数id
*/ */
@ApiModelProperty("云函数id")
private String brandCloudId;
/**
* 品牌名
*/
@ApiModelProperty("品牌名") @ApiModelProperty("品牌名")
private String name; private String brandName;
/** /**
* 背景地址 * 微信商户号
*/ */
@StringArrayConvert @ApiModelProperty("微信商户号")
@ApiModelProperty("背景地址") private String wxMchId;
private String backgroundUrl;
/**
* 顾问名
*/
@ApiModelProperty("顾问名")
private String consultantName;
/**
* 品牌管理员工id
*/
@ApiModelProperty("品牌管理员工id")
private String brandStaffId;
/**
* 品牌管理员工
*/
@ApiModelProperty("品牌管理员工")
private String brandStaffName;
/** /**
* 创建时间 * 创建时间

View File

@ -2,6 +2,6 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpop.jambox.business.mapper.BrandMapper"> <mapper namespace="com.cpop.system.business.mapper.BrandMapper">
</mapper> </mapper>

View File

@ -188,6 +188,12 @@
<artifactId>weixin-java-cp</artifactId> <artifactId>weixin-java-cp</artifactId>
<version>${wechat-java.version}</version> <version>${wechat-java.version}</version>
</dependency> </dependency>
<!--微信支付-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
<version>${wechat-java.version}</version>
</dependency>
<!-- 腾讯云--> <!-- 腾讯云-->
<dependency> <dependency>
<groupId>com.qcloud</groupId> <groupId>com.qcloud</groupId>