商城bug修复;添加商城管理员管理

This commit is contained in:
DB 2023-11-09 18:15:50 +08:00
parent e62771a840
commit 0f7fedda1c
24 changed files with 624 additions and 34 deletions

View File

@ -82,6 +82,8 @@ wx:
# 私钥文件 # 私钥文件
privateCertPath: /root/cpop-union/cpop-mall/script/secretKey/wxPay_cert.pem privateCertPath: /root/cpop-union/cpop-mall/script/secretKey/wxPay_cert.pem
#支付通知地址 #支付通知地址
notifyUrl: https://test.cpopsz.com/onlineShop/Cpop-Mall/wxPay/callback/notify/order notifyUrl: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/order
#退款通知地址 #退款通知地址
notifyRefund: https://test.cpopsz.com/onlineShop/Cpop-Mall/wxPay/callback/notify/refund notifyRefund: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/refund
#分账通知地址
notifySharing: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/profitSharing

View File

@ -112,6 +112,8 @@ wx:
# 私钥文件 # 私钥文件
privateCertPath: /root/cpop-union/cpop-mall/script/secretKey/wxPay_cert.pem privateCertPath: /root/cpop-union/cpop-mall/script/secretKey/wxPay_cert.pem
#支付通知地址 #支付通知地址
notifyUrl: https://test.cpopsz.com/onlineShop/Cpop-Mall/wxPay/callback/notify/order notifyUrl: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/order
#退款通知地址 #退款通知地址
notifyRefund: https://test.cpopsz.com/onlineShop/Cpop-Mall/wxPay/callback/notify/refund notifyRefund: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/refund
#分账通知地址
notifySharing: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/profitSharing

View File

@ -57,8 +57,8 @@ public class CpopWxPayTests {
.setTotal(refund) .setTotal(refund)
.setCurrency("CNY"); .setCurrency("CNY");
request.setSubMchid(wxPayService.getConfig().getSubMchId()) request.setSubMchid(wxPayService.getConfig().getSubMchId())
.setTransactionId("4200002027202310279036554434") .setTransactionId("4200002015202311095099886928")
.setOutTradeNo("75505378790948864") .setOutTradeNo("80137484138201088")
//.setTransactionId(order.getOutOrderNo()) //.setTransactionId(order.getOutOrderNo())
//.setOutTradeNo(order.getId()) //.setOutTradeNo(order.getId())
.setNotifyUrl(wxPayProperties.getNotifyRefund()) .setNotifyUrl(wxPayProperties.getNotifyRefund())

View File

@ -7,7 +7,9 @@ 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.task.ShoppingCartAsyncTask;
import com.cpop.mall.business.vo.JamboxCardTemplateListVo; import com.cpop.mall.business.vo.JamboxCardTemplateListVo;
import com.cpop.mall.business.vo.ProductInfoVo;
import com.cpop.mall.business.vo.ProductPageVo; import com.cpop.mall.business.vo.ProductPageVo;
import com.cpop.mall.business.vo.StoreListVo; import com.cpop.mall.business.vo.StoreListVo;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
@ -54,6 +56,20 @@ public class BackstageProductController {
return R.ok(page); return R.ok(page);
} }
/**
* @descriptions 查询商城-商品详情
* @author DB
* @date 2023/11/09 11:00
* @param id 主键
* @return: com.cpop.core.base.R<com.cpop.mall.business.vo.ProductInfoVo>
*/
@GetMapping("/getProductInfo/{id}")
@ApiOperation("查询商城-商品详情")
public R<ProductInfoVo> getProductInfo(@PathVariable @ApiParam("主键") String id) {
ProductInfoVo info = productService.getProductInfo(id);
return R.ok(info);
}
/** /**
* @descriptions 选择品牌下的店铺/校区 * @descriptions 选择品牌下的店铺/校区
* @author DB * @author DB
@ -145,7 +161,7 @@ public class BackstageProductController {
@DeleteMapping("/removeById/{id}") @DeleteMapping("/removeById/{id}")
@ApiOperation("根据主键删除商城-商品") @ApiOperation("根据主键删除商城-商品")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public R<Void> removeById(@PathVariable("id") @ApiParam("商城-商品主键") Serializable id) { public R<Void> removeById(@PathVariable("id") @ApiParam("商城-商品主键") String id) {
productService.removeById(id); productService.removeById(id);
//删规格 //删规格
ProductSpecificationService productSpecificationService = SpringUtils.getBean(ProductSpecificationService.class); ProductSpecificationService productSpecificationService = SpringUtils.getBean(ProductSpecificationService.class);
@ -153,6 +169,8 @@ public class BackstageProductController {
//删商品记录详情 //删商品记录详情
ProductRecordService specificationRecordService = SpringUtils.getBean(ProductRecordService.class); ProductRecordService specificationRecordService = SpringUtils.getBean(ProductRecordService.class);
specificationRecordService.updateChain().where(PRODUCT_RECORD.PRODUCT_ID.eq(id)).remove(); specificationRecordService.updateChain().where(PRODUCT_RECORD.PRODUCT_ID.eq(id)).remove();
//删除购物车
SpringUtils.getBean(ShoppingCartAsyncTask.class).asyncRemoveShoppingCart(id);
return R.ok(); return R.ok();
} }
@ -184,6 +202,4 @@ public class BackstageProductController {
return R.ok(); return R.ok();
} }
} }

View File

@ -443,8 +443,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
Brand brand = SpringUtils.getBean(BrandService.class).getById(order.getBrandId()); Brand brand = SpringUtils.getBean(BrandService.class).getById(order.getBrandId());
if (StringUtils.isBlank(brand.getWxAppId()) || !StringUtils.equals(brand.getWxAppId(), wxPayService.getConfig().getAppId())) { if (StringUtils.isBlank(brand.getWxAppId()) || !StringUtils.equals(brand.getWxAppId(), wxPayService.getConfig().getAppId())) {
//需要分账 //需要分账
if (notifyResult.getTotalFee() >= 10) {
wxPayAsyncTask.asyncWxPayProfitSharing(orderId, notifyResult, wxPayService); wxPayAsyncTask.asyncWxPayProfitSharing(orderId, notifyResult, wxPayService);
} }
}
//异步更新 //异步更新
SpringUtils.getBean(ProductRecordSyncStockTask.class).asyncUpdateRecords(orderNumMap); SpringUtils.getBean(ProductRecordSyncStockTask.class).asyncUpdateRecords(orderNumMap);
} catch (WxPayException e) { } catch (WxPayException e) {

View File

@ -22,6 +22,7 @@ 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.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.task.ShoppingCartAsyncTask;
import com.cpop.mall.business.vo.*; import com.cpop.mall.business.vo.*;
import com.cpop.mall.framework.constant.MallRedisConstant; import com.cpop.mall.framework.constant.MallRedisConstant;
import com.cpop.system.business.service.StoreService; import com.cpop.system.business.service.StoreService;
@ -259,7 +260,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
redisService.setCacheObject(MallRedisConstant.STOCK_RECORD_NUM + item.getId(), item.getRecordNum()); redisService.setCacheObject(MallRedisConstant.STOCK_RECORD_NUM + item.getId(), item.getRecordNum());
}); });
specificationRecordService.updateBatch(recordList); specificationRecordService.updateBatch(recordList);
//异步更新购物车价格
SpringUtils.getBean(ShoppingCartAsyncTask.class).asyncUpdateShoppingCartAmount(product);
} }
/** /**

View File

@ -4,6 +4,7 @@ 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.exception.ServiceException;
import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.sql.SqlUtils; import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.mall.business.bo.ShoppingCartBo; import com.cpop.mall.business.bo.ShoppingCartBo;
@ -75,6 +76,12 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, Sho
public void insertShoppingCart(ShoppingCartBo bo) { public void insertShoppingCart(ShoppingCartBo bo) {
//获取当前用户信息 //获取当前用户信息
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
//查询用户购物车是否有同种商品
long count = this.count(QueryWrapper.create().where(SHOPPING_CART.PRODUCT_RECORD_ID.eq(bo.getProductRecordId()))
.and(SHOPPING_CART.USER_ID.eq(loginUserInfo.getString("userId"))));
if (count > 0) {
throw new ServiceException("您当前购物车已有此商品,请勿重复添加");
}
ShoppingCart shoppingCart = BeanUtils.mapToClass(bo, ShoppingCart.class); ShoppingCart shoppingCart = BeanUtils.mapToClass(bo, ShoppingCart.class);
shoppingCart.setUserId(loginUserInfo.getString("userId")); shoppingCart.setUserId(loginUserInfo.getString("userId"));
this.save(shoppingCart); this.save(shoppingCart);

View File

@ -0,0 +1,69 @@
package com.cpop.mall.business.task;
import com.cpop.core.utils.SpringUtils;
import com.cpop.mall.business.entity.Product;
import com.cpop.mall.business.entity.ProductRecord;
import com.cpop.mall.business.service.ProductRecordService;
import com.cpop.mall.business.service.ShoppingCartService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD;
import static com.cpop.mall.business.entity.table.ShoppingCartTableDef.SHOPPING_CART;
/**
* @author DB
* @createTime 2023/11/09 16:42
* @description
*/
@Component
@Slf4j
public class ShoppingCartAsyncTask {
/**
* @Description: 异步更新购物车价格
* @param product 商品
* @Author DB
* @Date: 2023/11/1 0:09
*/
@Async("customAsyncThreadPool")
public void asyncUpdateShoppingCartAmount(Product product) {
//获取商品记录
List<ProductRecord> recordList = SpringUtils.getBean(ProductRecordService.class).queryChain()
.where(PRODUCT_RECORD.PRODUCT_ID.eq(product.getId()))
.list();
//批量修改购物车产品价格
ShoppingCartService cartService = SpringUtils.getBean(ShoppingCartService.class);
recordList.forEach(item->{
cartService.updateChain().setRaw(SHOPPING_CART.AMOUNT, item.getRecordPrice() + " * number")
.setRaw(SHOPPING_CART.POINT, item.getRecordPoints() + " * number")
.where(SHOPPING_CART.PRODUCT_RECORD_ID.eq(item.getId())).update();
});
}
/**
* @Description: 异步删除购物车
* @param productId 商品Id
* @Author DB
* @Date: 2023/11/1 0:09
*/
@Async("customAsyncThreadPool")
public void asyncRemoveShoppingCart(String productId) {
//获取商品记录
List<ProductRecord> recordList = SpringUtils.getBean(ProductRecordService.class).queryChain()
.where(PRODUCT_RECORD.PRODUCT_ID.eq(productId))
.list();
//批量修改购物车产品价格
if (!recordList.isEmpty()){
ShoppingCartService cartService = SpringUtils.getBean(ShoppingCartService.class);
cartService.updateChain()
.where(SHOPPING_CART.PRODUCT_RECORD_ID.in(recordList.stream().map(ProductRecord::getId).collect(Collectors.toSet())))
.remove();
}
}
}

View File

@ -1,5 +1,6 @@
package com.cpop.mall.business.vo; package com.cpop.mall.business.vo;
import com.cpop.core.annontation.StringArrayConvert;
import com.fasterxml.jackson.annotation.JsonFormat; 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;
@ -43,6 +44,7 @@ public class ProductInfoVo implements Serializable {
/** /**
* 商店(校区)集合 * 商店(校区)集合
*/ */
@StringArrayConvert
@ApiModelProperty("商店(校区)集合") @ApiModelProperty("商店(校区)集合")
private String storeIds; private String storeIds;
@ -58,6 +60,13 @@ public class ProductInfoVo implements Serializable {
@ApiModelProperty("商品图地址") @ApiModelProperty("商品图地址")
private String picUrl; private String picUrl;
/**
* 限购数量
*/
@ApiModelProperty("限购数量")
private Integer limitNum;
/** /**
* 商品详情图地址 * 商品详情图地址
*/ */

View File

@ -126,20 +126,6 @@ public class ProductPageVo implements Serializable {
@ApiModelProperty("商品交易成功信息") @ApiModelProperty("商品交易成功信息")
private ProductTradeInfo tradeInfo; private ProductTradeInfo tradeInfo;
/**
* 产品规格
*/
@RelationOneToMany(selfField = "id", targetField = "productId",targetTable = "cp_mall_product_specification")
@ApiModelProperty("产品规格")
private List<ProductSpecificationVo> productSpecificationVos;
/**
* 产品规格记录
*/
@RelationOneToMany(selfField = "id", targetField = "productId",targetTable = "cp_mall_product_record")
@ApiModelProperty("产品规格记录")
private List<ProductRecordVo> productRecordVos;
/** /**
* 创建时间 * 创建时间
*/ */

View File

@ -0,0 +1,116 @@
package com.cpop.oam.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.NotNull;
import java.io.Serializable;
/**
* 员工表Bo
*
* @author DB.lost
* @since 2023-05-11
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "Staff对象", description = "员工表")
public class MallStaffBo implements Serializable {
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 姓名不能为空
*/
@NotBlank(message = "姓名不能为空")
@ApiModelProperty("姓名")
private String name;
/**
* 品牌id不能为空
*/
@NotBlank(message = "品牌id不能为空")
@ApiModelProperty(value = "品牌id")
private String brandId;
/**
* 角色品牌id
*/
@ApiModelProperty("角色品牌id")
private String roleBrandId;
/**
* 用户id
*/
@ApiModelProperty("用户id")
private String userId;
/**
* 用户名
*/
@NotBlank(message = "用户名不能为空")
@ApiModelProperty(value = "用户名",required = true)
private String userName;
/**
* 密码
*/
@NotBlank(message = "密码不能为空")
@ApiModelProperty(value = "密码",required = true)
private String password;
/**
* 昵称
*/
@NotBlank(message = "昵称不能为空")
@ApiModelProperty(value = "昵称",required = true)
private String nickName;
/**
* 邮箱
*/
@ApiModelProperty(value = "邮箱")
private String email;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空")
@ApiModelProperty(value = "手机号",required = true)
private String phoneNumber;
/**
* 性别(0:;1:)
*/
@NotNull(message = "性别不能为空")
@ApiModelProperty(value = "性别(0:男;1:女)",required = true)
private Boolean sex;
/**
* 头像
*/
@ApiModelProperty(value = "头像")
private String avatar;
/**
* 状态(0:停用;1:启用)
*/
@NotNull(message = "状态不能为空")
@ApiModelProperty(value = "状态(0:停用;1:启用)",required = true)
private Boolean status;
/**
* 角色id
*/
@NotBlank(message = "角色id不能为空")
@ApiModelProperty(value = "角色id",required = true)
private String roleId;
}

View File

@ -0,0 +1,29 @@
package com.cpop.oam.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.NotNull;
import java.io.Serializable;
/**
* 员工表Bo
*
* @author DB.lost
* @since 2023-05-11
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "Staff对象", description = "员工表")
public class MallStaffPageBo implements Serializable {
/**
* 姓名不能为空
*/
@ApiModelProperty("姓名")
private String name;
}

View File

@ -0,0 +1,49 @@
package com.cpop.oam.business.controller;
import com.cpop.core.base.R;
import com.cpop.oam.business.bo.MallStaffBo;
import com.cpop.oam.business.bo.MallStaffPageBo;
import com.cpop.oam.business.bo.StaffPageBo;
import com.cpop.oam.business.service.OamMallService;
import com.cpop.oam.business.vo.MallStaffPageVo;
import com.cpop.oam.business.vo.StaffPageVo;
import com.mybatisflex.core.paginate.Page;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author DB
* @createTime 2023/11/09 14:40
* @description
*/
@RestController
@Api(tags = "商城管理模块")
@RequestMapping("/oamMall")
public class OamMallController {
@Autowired
private OamMallService oamMallService;
/**
* @descriptions 查询商城管理员分页列表
* @author DB
* @date 2023/11/09 15:33
* @param brandIds 品牌id集合
* @param name 姓名
* @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.oam.business.vo.MallStaffPageVo>>
*/
@ApiOperation("查询商城管理员分页列表")
@GetMapping("/getMallStaffPage")
public R<Page<MallStaffPageVo>> getMallStaffPage(String brandIds, String name) {
Page<MallStaffPageVo> page = oamMallService.getMallStaffPage(brandIds, name);
return R.ok(page);
}
}

View File

@ -21,7 +21,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import static com.cpop.oam.business.entity.table.RoleTableDef.ROLE; import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
/** /**
* 员工表 控制层 * 员工表 控制层
@ -190,4 +191,6 @@ public class StaffController {
staffService.modifyUserPassword(bo); staffService.modifyUserPassword(bo);
return R.ok(); return R.ok();
} }
} }

View File

@ -0,0 +1,20 @@
package com.cpop.oam.business.service;
import com.cpop.oam.business.vo.MallStaffPageVo;
import com.mybatisflex.core.paginate.Page;
import java.util.List;
/**
* 商城管理
*/
public interface OamMallService {
/**
* @descriptions 查询商城管理员分页列表
* @author DB
* @date 2023/11/09 14:47
* @return: com.mybatisflex.core.paginate.Page<com.cpop.oam.business.vo.MallStaffPageVo>
*/
Page<MallStaffPageVo> getMallStaffPage(String brandIds, String name);
}

View File

@ -0,0 +1,63 @@
package com.cpop.oam.business.service.impl;
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.enums.UserType;
import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.oam.business.bo.MallStaffPageBo;
import com.cpop.oam.business.service.OamMallService;
import com.cpop.oam.business.vo.MallStaffPageVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowUtil;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.system.business.entity.table.RoleTableDef.ROLE;
/**
* @author DB
* @createTime 2023/11/09 14:42
* @description
*/
@Service("oamMallService")
public class OamMallServiceImpl implements OamMallService {
/**
* @descriptions 查询商城管理员分页列表
* @author DB
* @date 2023/11/09 14:47
* @return: com.mybatisflex.core.paginate.Page<com.cpop.oam.business.vo.MallStaffPageVo>
*/
@Override
public Page<MallStaffPageVo> getMallStaffPage(String brandIds, String name) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
QueryWrapper queryWrapper = QueryWrapper.create();
if (StringUtils.isNotBlank(name)) {
queryWrapper.and("name like ?", "%" + name + "%");
}
if (StringUtils.isNotBlank(brandIds)) {
queryWrapper.in("cp_mall_role_brand.brand_id", Arrays.asList(brandIds.split(",")));
}
Page<Row> rowPage = Db.paginate("cp_mall_staff", pageDomain.getPageNum(), pageDomain.getPageSize(),
queryWrapper.select("cp_mall_staff.*")
.select(SYS_USER.USER_NAME, SYS_USER.AVATAR, SYS_USER.EMAIL, SYS_USER.NICK_NAME, SYS_USER.PASSWORD, SYS_USER.PHONE_NUMBER, SYS_USER.SEX, SYS_USER.STATUS)
//角色
.select("cp_sys_role.role_name", "cp_sys_role.id as roleId")
//品牌
.select("cp_sys_brand.id as brandId", "cp_sys_brand.brand_name")
.from("cp_mall_staff")
.leftJoin(SYS_USER).on("cp_sys_user.id = cp_mall_staff.user_id")
.leftJoin("cp_mall_role_brand").on("cp_mall_role_brand.id = cp_mall_staff.role_brand_id")
.leftJoin("cp_sys_role").on("cp_sys_role.id = cp_mall_role_brand.role_id")
.leftJoin("cp_sys_brand").on("cp_sys_brand.id = cp_mall_role_brand.brand_id")
.where(SYS_USER.USER_TYPE.eq(UserType.MALL_USER)));
return rowPage.map(item -> RowUtil.toEntity(item, MallStaffPageVo.class));
}
}

View File

@ -45,9 +45,9 @@ import java.util.List;
import static com.cpop.core.base.table.table.SysOperationLogTableDef.SYS_OPERATION_LOG; import static com.cpop.core.base.table.table.SysOperationLogTableDef.SYS_OPERATION_LOG;
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.oam.business.entity.table.RoleTableDef.ROLE;
import static com.cpop.oam.business.entity.table.StaffMidDeptTableDef.STAFF_MID_DEPT; import static com.cpop.oam.business.entity.table.StaffMidDeptTableDef.STAFF_MID_DEPT;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
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;
@ -77,7 +77,7 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
.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)
//将部门id分组 //将部门id分组
.select(groupConcat(STAFF_MID_DEPT.DEPT_ID).as(StaffPageVo::getDeptId)) .select(groupConcat(STAFF_MID_DEPT.DEPT_ID))
.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).on(ROLE.ID.eq(STAFF.ROLE_ID)) .leftJoin(ROLE).on(ROLE.ID.eq(STAFF.ROLE_ID))

View File

@ -0,0 +1,126 @@
package com.cpop.oam.business.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
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/20 11:06
* @description
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "商城员工分页返回对象")
public class MallStaffPageVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("主键")
private String id;
/**
* 姓名
*/
@ApiModelProperty("姓名")
private String name;
/**
* 用户id
*/
@ApiModelProperty("用户id")
private String userId;
/**
* 角色-品牌-id
*/
@ApiModelProperty("角色-品牌-id")
private String roleBrandId;
/**
* 品牌id
*/
@ApiModelProperty("品牌id")
private String brandId;
/**
* 品牌
*/
@ApiModelProperty("品牌")
private String brandName;
/**
* 用户名
*/
@ApiModelProperty("用户名")
private String userName;
/**
* 昵称
*/
@ApiModelProperty("昵称")
private String nickName;
/**
* 邮箱
*/
@ApiModelProperty("邮箱")
private String email;
/**
* 手机号
*/
@ApiModelProperty("手机号")
private String phoneNumber;
/**
* 性别(0:;1:)
*/
@ApiModelProperty("性别(0:男;1:女)")
private Boolean sex;
/**
* 头像
*/
@ApiModelProperty("头像")
private String avatar;
/**
* 状态(0:停用;1:启用)
*/
@ApiModelProperty("状态(0:停用;1:启用)")
private Boolean status;
/**
* 角色id
*/
@ApiModelProperty("角色id")
private String roleId;
/**
* 角色名
*/
@ApiModelProperty("角色名")
private String roleName;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private LocalDateTime updateTime;
/**
* 密码
*/
@ApiModelProperty("密码")
private String password;
}

View File

@ -1,7 +1,9 @@
package com.cpop.system.business.controller; package com.cpop.system.business.controller;
import com.cpop.common.utils.bean.BeanUtils; import com.cpop.common.utils.bean.BeanUtils;
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.base.enums.SourceType; import com.cpop.core.base.enums.SourceType;
import com.cpop.system.business.bo.BrandBo; import com.cpop.system.business.bo.BrandBo;
import com.cpop.system.business.bo.BrandPageBo; import com.cpop.system.business.bo.BrandPageBo;
@ -76,7 +78,6 @@ public class BrandController {
* @param bo 请求参数 * @param bo 请求参数
* @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo>> * @return com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo>>
*/ */
@PreAuthorize("@aps.hasPermission('brandAndCampus:brand:list')")
@ApiOperation("查询品牌分页列表") @ApiOperation("查询品牌分页列表")
@GetMapping("/getBrandPage") @GetMapping("/getBrandPage")
public R<Page<BrandPageVo>> getBrandPageList(BrandPageBo bo) { public R<Page<BrandPageVo>> getBrandPageList(BrandPageBo bo) {
@ -84,4 +85,18 @@ public class BrandController {
return R.ok(pageVo); return R.ok(pageVo);
} }
/**
* @descriptions 根据品牌id删除品牌
* @author DB
* @date 2023/11/09 10:31
* @param id 主键
* @return: com.cpop.core.base.R<java.lang.Void>
*/
@ApiOperation("根据品牌id删除品牌")
@DeleteMapping("/removeBrandById/{id}")
public R<Void> removeBrandById(@PathVariable String id) {
brandService.removeBrandById(id);
return R.ok();
}
} }

View File

@ -65,6 +65,11 @@ public class Brand extends BaseEntity implements Serializable {
*/ */
private String sourceType; private String sourceType;
/**
* 背景图
*/
private String backgroundUrl;
/** /**
* 逻辑删除0否1是 * 逻辑删除0否1是
*/ */

View File

@ -31,4 +31,13 @@ public interface BrandService extends IService<Brand> {
* @return: com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo> * @return: com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo>
*/ */
Page<BrandPageVo> getBrandPage(BrandPageBo bo); Page<BrandPageVo> getBrandPage(BrandPageBo bo);
/**
* @descriptions 根据品牌id删除品牌
* @author DB
* @date 2023/11/09 10:34
* @param id 主键
* @return: void
*/
void removeBrandById(String id);
} }

View File

@ -1,5 +1,6 @@
package com.cpop.system.business.service.impl; package com.cpop.system.business.service.impl;
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.LoginUser; import com.cpop.core.base.entity.LoginUser;
import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.entity.PageDomain;
@ -80,6 +81,7 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
.setWxMchId(brand.getString("wxMchId")) .setWxMchId(brand.getString("wxMchId"))
.setWxMchKey(brand.getString("wxMchKey")) .setWxMchKey(brand.getString("wxMchKey"))
.setWxKeyPath(brand.getString("wxKeyPath")) .setWxKeyPath(brand.getString("wxKeyPath"))
.setBackgroundUrl(brand.getString("brandBg"))
.setSourceType(SourceType.JAMBOX.toString()); .setSourceType(SourceType.JAMBOX.toString());
this.save(sysBrand); this.save(sysBrand);
//果酱拓展表信息 //果酱拓展表信息
@ -90,7 +92,6 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
.setId(brandKey) .setId(brandKey)
.set("brand_id", sysBrand.getId()) .set("brand_id", sysBrand.getId())
.set("brand_cloud_id", brand.getString("brandId")) .set("brand_cloud_id", brand.getString("brandId"))
.set("background_url", brand.getString("brandBg"))
.set("create_time", now) .set("create_time", now)
.set("update_time", now) .set("update_time", now)
.set("create_user_id", loginUser.getUserId()) .set("create_user_id", loginUser.getUserId())
@ -157,10 +158,42 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
@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(),
QueryWrapper.create() QueryWrapper.create()
.select(BRAND.ID,BRAND.BRAND_NAME,BRAND.WX_MCH_ID,BRAND.CREATE_TIME) .select(BRAND.ID, BRAND.BRAND_NAME, BRAND.WX_MCH_ID, BRAND.CREATE_TIME, BRAND.BACKGROUND_URL, BRAND.WX_APP_ID, BRAND.WX_MCH_KEY, BRAND.WX_KEY_PATH)
.and(BRAND.BRAND_NAME.like(bo.getName())), .and(BRAND.BRAND_NAME.like(bo.getName())),
BrandPageVo.class); BrandPageVo.class);
} }
/**
* @descriptions 根据品牌id删除品牌
* @author DB
* @date 2023/11/09 10:34
* @param id 主键
* @return: void
*/
@Override
public void removeBrandById(String id) {
Brand brand = this.getById(id);
StoreService storeService = SpringUtils.getBean(StoreService.class);
if (StringUtils.equals(brand.getSourceType(),SourceType.JAMBOX.toString())){
//果酱处导入,先删除拓展校区
List<Store> storeList = storeService.queryChain().where(STORE.BRAND_ID.eq(id)).list();
if (!storeList.isEmpty()){
DbChain.table("cp_j_store_extend")
.set("is_delete = ?", 1)
.where("store_id in ?", storeList.stream().map(Store::getId).collect(Collectors.toSet()))
.update();
}
}
//删除校区
storeService.updateChain().where(STORE.BRAND_ID.eq(brand.getId())).remove();
//逻辑删除品牌拓展
DbChain.table("cp_j_brand_extend")
.set("is_delete = ?", 1)
.where("brand_id = ?", id)
.update();
//删除品牌
this.removeById(id);
}
} }

View File

@ -52,7 +52,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
List<MenuRouteVo> list = this.listAs(QueryWrapper.create() List<MenuRouteVo> list = this.listAs(QueryWrapper.create()
.where(MENU.TYPE.in(0, 1)) .where(MENU.TYPE.in(0, 1))
//构建公共菜单与特有菜单 //构建公共菜单与特有菜单
.and(MENU.USER_TYPE.in("COMMON", user.getUserType())) .and(MENU.USER_TYPE.eq(user.getUserType()))
.orderBy(MENU.ORDER_NO.asc()), .orderBy(MENU.ORDER_NO.asc()),
MenuRouteVo.class); MenuRouteVo.class);
return buildMenuRouteTree(list); return buildMenuRouteTree(list);
@ -66,7 +66,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
.and(MENU.NAME.notIn(Constants.HIDE_MENU.split(","))) .and(MENU.NAME.notIn(Constants.HIDE_MENU.split(",")))
.and(ROLE_MENU.ROLE_ID.eq(loginStaffInfo.getString("roleId"))) .and(ROLE_MENU.ROLE_ID.eq(loginStaffInfo.getString("roleId")))
//构建公共菜单与特有菜单 //构建公共菜单与特有菜单
.and(MENU.USER_TYPE.in("COMMON", user.getUserType())) .and(MENU.USER_TYPE.eq(user.getUserType()))
.orderBy(MENU.ORDER_NO.asc()), .orderBy(MENU.ORDER_NO.asc()),
MenuRouteVo.class)); MenuRouteVo.class));
} }
@ -148,6 +148,8 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
String[] split = bo.getPath().split("/"); String[] split = bo.getPath().split("/");
String name = StringUtils.getMethodName(split[split.length - 1].replace("/", "")); String name = StringUtils.getMethodName(split[split.length - 1].replace("/", ""));
entity.setName(name); entity.setName(name);
} else {
entity.setName(null);
} }
//设置组件 //设置组件
if (StringUtils.isBlank(bo.getComponent())){ if (StringUtils.isBlank(bo.getComponent())){

View File

@ -40,6 +40,31 @@ public class BrandPageVo implements Serializable {
@ApiModelProperty("微信商户号") @ApiModelProperty("微信商户号")
private String wxMchId; private String wxMchId;
/**
* 微信appid
*/
@ApiModelProperty("微信appid")
private String wxAppId;
/**
* 微信支付密钥
*/
@ApiModelProperty("微信支付密钥")
private String wxMchKey;
/**
* 微信支付keypath
*/
@ApiModelProperty("微信支付keyPath")
private String wxKeyPath;
/**
* 背景图
*/
@StringArrayConvert
@ApiModelProperty("背景图")
private String backgroundUrl;
/** /**
* 创建时间 * 创建时间
*/ */