商城bug修复;添加商城管理员管理
This commit is contained in:
parent
e62771a840
commit
0f7fedda1c
@ -82,6 +82,8 @@ wx:
|
||||
# 私钥文件
|
||||
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
|
||||
@ -112,6 +112,8 @@ wx:
|
||||
# 私钥文件
|
||||
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
|
||||
@ -57,8 +57,8 @@ public class CpopWxPayTests {
|
||||
.setTotal(refund)
|
||||
.setCurrency("CNY");
|
||||
request.setSubMchid(wxPayService.getConfig().getSubMchId())
|
||||
.setTransactionId("4200002027202310279036554434")
|
||||
.setOutTradeNo("75505378790948864")
|
||||
.setTransactionId("4200002015202311095099886928")
|
||||
.setOutTradeNo("80137484138201088")
|
||||
//.setTransactionId(order.getOutOrderNo())
|
||||
//.setOutTradeNo(order.getId())
|
||||
.setNotifyUrl(wxPayProperties.getNotifyRefund())
|
||||
|
||||
@ -7,7 +7,9 @@ import com.cpop.mall.business.bo.ProductPageBo;
|
||||
import com.cpop.mall.business.service.ProductRecordService;
|
||||
import com.cpop.mall.business.service.ProductService;
|
||||
import com.cpop.mall.business.service.ProductSpecificationService;
|
||||
import com.cpop.mall.business.task.ShoppingCartAsyncTask;
|
||||
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.StoreListVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
@ -54,6 +56,20 @@ public class BackstageProductController {
|
||||
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 选择品牌下的店铺/校区
|
||||
* @author DB
|
||||
@ -145,7 +161,7 @@ public class BackstageProductController {
|
||||
@DeleteMapping("/removeById/{id}")
|
||||
@ApiOperation("根据主键删除商城-商品")
|
||||
@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);
|
||||
//删规格
|
||||
ProductSpecificationService productSpecificationService = SpringUtils.getBean(ProductSpecificationService.class);
|
||||
@ -153,6 +169,8 @@ public class BackstageProductController {
|
||||
//删商品记录详情
|
||||
ProductRecordService specificationRecordService = SpringUtils.getBean(ProductRecordService.class);
|
||||
specificationRecordService.updateChain().where(PRODUCT_RECORD.PRODUCT_ID.eq(id)).remove();
|
||||
//删除购物车
|
||||
SpringUtils.getBean(ShoppingCartAsyncTask.class).asyncRemoveShoppingCart(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -184,6 +202,4 @@ public class BackstageProductController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -443,8 +443,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
Brand brand = SpringUtils.getBean(BrandService.class).getById(order.getBrandId());
|
||||
if (StringUtils.isBlank(brand.getWxAppId()) || !StringUtils.equals(brand.getWxAppId(), wxPayService.getConfig().getAppId())) {
|
||||
//需要分账
|
||||
if (notifyResult.getTotalFee() >= 10) {
|
||||
wxPayAsyncTask.asyncWxPayProfitSharing(orderId, notifyResult, wxPayService);
|
||||
}
|
||||
}
|
||||
//异步更新
|
||||
SpringUtils.getBean(ProductRecordSyncStockTask.class).asyncUpdateRecords(orderNumMap);
|
||||
} catch (WxPayException e) {
|
||||
|
||||
@ -22,6 +22,7 @@ import com.cpop.mall.business.service.OrderEvaluateService;
|
||||
import com.cpop.mall.business.service.ProductRecordService;
|
||||
import com.cpop.mall.business.service.ProductService;
|
||||
import com.cpop.mall.business.service.ProductSpecificationService;
|
||||
import com.cpop.mall.business.task.ShoppingCartAsyncTask;
|
||||
import com.cpop.mall.business.vo.*;
|
||||
import com.cpop.mall.framework.constant.MallRedisConstant;
|
||||
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());
|
||||
});
|
||||
specificationRecordService.updateBatch(recordList);
|
||||
|
||||
//异步更新购物车价格
|
||||
SpringUtils.getBean(ShoppingCartAsyncTask.class).asyncUpdateShoppingCartAmount(product);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,6 +4,7 @@ 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.exception.ServiceException;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.mall.business.bo.ShoppingCartBo;
|
||||
@ -75,6 +76,12 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, Sho
|
||||
public void insertShoppingCart(ShoppingCartBo bo) {
|
||||
//获取当前用户信息
|
||||
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.setUserId(loginUserInfo.getString("userId"));
|
||||
this.save(shoppingCart);
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.cpop.mall.business.vo;
|
||||
|
||||
import com.cpop.core.annontation.StringArrayConvert;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mybatisflex.annotation.RelationOneToMany;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -43,6 +44,7 @@ public class ProductInfoVo implements Serializable {
|
||||
/**
|
||||
* 商店(校区)集合
|
||||
*/
|
||||
@StringArrayConvert
|
||||
@ApiModelProperty("商店(校区)集合")
|
||||
private String storeIds;
|
||||
|
||||
@ -58,6 +60,13 @@ public class ProductInfoVo implements Serializable {
|
||||
@ApiModelProperty("商品图地址")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 限购数量
|
||||
*/
|
||||
@ApiModelProperty("限购数量")
|
||||
private Integer limitNum;
|
||||
|
||||
|
||||
/**
|
||||
* 商品详情图地址
|
||||
*/
|
||||
|
||||
@ -126,20 +126,6 @@ public class ProductPageVo implements Serializable {
|
||||
@ApiModelProperty("商品交易成功信息")
|
||||
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;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
116
Cpop-Oam/src/main/java/com/cpop/oam/business/bo/MallStaffBo.java
Normal file
116
Cpop-Oam/src/main/java/com/cpop/oam/business/bo/MallStaffBo.java
Normal 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;
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
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);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
@ -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.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.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.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(ROLE.ROLE_NAME)
|
||||
//将部门id分组
|
||||
.select(groupConcat(STAFF_MID_DEPT.DEPT_ID).as(StaffPageVo::getDeptId))
|
||||
.select(groupConcat(STAFF_MID_DEPT.DEPT_ID))
|
||||
.from(STAFF)
|
||||
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID))
|
||||
.leftJoin(ROLE).on(ROLE.ID.eq(STAFF.ROLE_ID))
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
package com.cpop.system.business.controller;
|
||||
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.annontation.OperationLog;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.core.base.enums.OperationLogEnum;
|
||||
import com.cpop.core.base.enums.SourceType;
|
||||
import com.cpop.system.business.bo.BrandBo;
|
||||
import com.cpop.system.business.bo.BrandPageBo;
|
||||
@ -76,7 +78,6 @@ public class BrandController {
|
||||
* @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) {
|
||||
@ -84,4 +85,18 @@ public class BrandController {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -65,6 +65,11 @@ public class Brand extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private String sourceType;
|
||||
|
||||
/**
|
||||
* 背景图
|
||||
*/
|
||||
private String backgroundUrl;
|
||||
|
||||
/**
|
||||
* 逻辑删除(0否1是)
|
||||
*/
|
||||
|
||||
@ -31,4 +31,13 @@ public interface BrandService extends IService<Brand> {
|
||||
* @return: com.mybatisflex.core.paginate.Page<com.cpop.system.business.vo.BrandPageVo>
|
||||
*/
|
||||
Page<BrandPageVo> getBrandPage(BrandPageBo bo);
|
||||
|
||||
/**
|
||||
* @descriptions 根据品牌id删除品牌
|
||||
* @author DB
|
||||
* @date 2023/11/09 10:34
|
||||
* @param id 主键
|
||||
* @return: void
|
||||
*/
|
||||
void removeBrandById(String id);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.cpop.system.business.service.impl;
|
||||
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
@ -80,6 +81,7 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
|
||||
.setWxMchId(brand.getString("wxMchId"))
|
||||
.setWxMchKey(brand.getString("wxMchKey"))
|
||||
.setWxKeyPath(brand.getString("wxKeyPath"))
|
||||
.setBackgroundUrl(brand.getString("brandBg"))
|
||||
.setSourceType(SourceType.JAMBOX.toString());
|
||||
this.save(sysBrand);
|
||||
//果酱拓展表信息
|
||||
@ -90,7 +92,6 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
|
||||
.setId(brandKey)
|
||||
.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())
|
||||
@ -159,8 +160,40 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
|
||||
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)
|
||||
.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())),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
||||
List<MenuRouteVo> list = this.listAs(QueryWrapper.create()
|
||||
.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()),
|
||||
MenuRouteVo.class);
|
||||
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(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()),
|
||||
MenuRouteVo.class));
|
||||
}
|
||||
@ -148,6 +148,8 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
||||
String[] split = bo.getPath().split("/");
|
||||
String name = StringUtils.getMethodName(split[split.length - 1].replace("/", ""));
|
||||
entity.setName(name);
|
||||
} else {
|
||||
entity.setName(null);
|
||||
}
|
||||
//设置组件
|
||||
if (StringUtils.isBlank(bo.getComponent())){
|
||||
|
||||
@ -40,6 +40,31 @@ public class BrandPageVo implements Serializable {
|
||||
@ApiModelProperty("微信商户号")
|
||||
private String wxMchId;
|
||||
|
||||
/**
|
||||
* 微信appid
|
||||
*/
|
||||
@ApiModelProperty("微信appid")
|
||||
private String wxAppId;
|
||||
|
||||
/**
|
||||
* 微信支付密钥
|
||||
*/
|
||||
@ApiModelProperty("微信支付密钥")
|
||||
private String wxMchKey;
|
||||
|
||||
/**
|
||||
* 微信支付keypath
|
||||
*/
|
||||
@ApiModelProperty("微信支付keyPath")
|
||||
private String wxKeyPath;
|
||||
|
||||
/**
|
||||
* 背景图
|
||||
*/
|
||||
@StringArrayConvert
|
||||
@ApiModelProperty("背景图")
|
||||
private String backgroundUrl;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user