|
|
@@ -17,7 +17,6 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
@@ -56,11 +55,10 @@ public class GoodsCategoryLogic {
|
|
|
public List<GoodsCategoryBean> list(Integer type, Integer level, String name, Boolean status, HttpServletRequest request) {
|
|
|
//获取当前登录企业微信id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
- List<String> companyWechatIds = adminUser.getCompanyWechatIds();
|
|
|
if (type == null) {
|
|
|
type = 1;
|
|
|
}
|
|
|
- final List<GoodsCategoryBean> beanList = customGoodsCategoryMapper.list(type, level, status, name, companyWechatIds);
|
|
|
+ final List<GoodsCategoryBean> beanList = customGoodsCategoryMapper.list(type, level, status, name);
|
|
|
if (type == 5 && CollectionUtil.isNotEmpty(beanList)) {
|
|
|
// 文档分类处理
|
|
|
final List<String> categoryList = beanList.stream().map(GoodsCategoryBean::getCategoryId).distinct().collect(Collectors.toList());
|
|
|
@@ -108,9 +106,9 @@ public class GoodsCategoryLogic {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void add(GoodsCategoryBean goodsCategoryBean, HttpServletRequest request) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
-// if (StringUtils.isBlank(adminUser.getCompanyWechatId())) {
|
|
|
-// throw new RemoteServiceException("非租户账号不可操作当前信息");
|
|
|
-// }
|
|
|
+ if (Objects.nonNull(adminUser.getAdminCompanyWechat())) {
|
|
|
+ throw new RemoteServiceException("非平台账号不可操作当前信息");
|
|
|
+ }
|
|
|
GoodsCategoryBean goodsCategory = goodsCategoryBean;
|
|
|
if (!CollectionUtils.isEmpty(goodsCategoryBean.getChildren())) {
|
|
|
goodsCategory = goodsCategoryBean.getChildren().get(0);
|
|
|
@@ -123,7 +121,8 @@ public class GoodsCategoryLogic {
|
|
|
.ne(StringUtils.isNotBlank(goodsCategory.getCategoryId()), GoodsCategory::getCategoryId, goodsCategory.getCategoryId())
|
|
|
.eq(GoodsCategory::getType, goodsCategory.getType())
|
|
|
.eq(GoodsCategory::getName, goodsCategory.getName())
|
|
|
- .eq(GoodsCategory::getCompanyWechatId, adminUser.getCompanyWechatId()).count();
|
|
|
+// .eq(GoodsCategory::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
+ .count();
|
|
|
if (count > 0) {
|
|
|
throw new RemoteServiceException("分类名称【" + goodsCategory.getName() + "】已存在");
|
|
|
}
|
|
|
@@ -133,10 +132,10 @@ public class GoodsCategoryLogic {
|
|
|
} else {
|
|
|
goodsCategory.setLevel(1);
|
|
|
}
|
|
|
- goodsCategory.setCreateTime(new Date());
|
|
|
- goodsCategory.setCompanyWechatId(adminUser.getCompanyWechatId());
|
|
|
- goodsCategory.setCompanyName(adminUser.getCompanyName());
|
|
|
- //goodsCategory.setCreateTime(new Date());
|
|
|
+
|
|
|
+ goodsCategory.setCompanyWechatId("0");
|
|
|
+// goodsCategory.setCompanyWechatId(adminUser.getCompanyWechatId());
|
|
|
+// goodsCategory.setCompanyName(adminUser.getCompanyName());
|
|
|
goodsCategory.insert();
|
|
|
|
|
|
// 文档分类处理
|
|
|
@@ -159,6 +158,10 @@ public class GoodsCategoryLogic {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void update(GoodsCategoryBean goodsCategoryBean) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ if (Objects.nonNull(adminUser.getAdminCompanyWechat())) {
|
|
|
+ throw new RemoteServiceException("非平台账号不可操作当前信息");
|
|
|
+ }
|
|
|
GoodsCategory old = goodsCategoryService.getById(goodsCategoryBean.getCategoryId());
|
|
|
//检查名称不可重复
|
|
|
Integer count = goodsCategoryService.lambdaQuery()
|
|
|
@@ -169,11 +172,9 @@ public class GoodsCategoryLogic {
|
|
|
if (count > 0) {
|
|
|
throw new RemoteServiceException("分类名称【" + goodsCategoryBean.getName() + "】已存在");
|
|
|
}
|
|
|
+
|
|
|
+ goodsCategoryBean.setCompanyWechatId("0");
|
|
|
goodsCategoryService.updateById(goodsCategoryBean);
|
|
|
- //如果有子集,覆盖子集的一些参数
|
|
|
-// goodsCategoryService.lambdaUpdate()
|
|
|
-// .set(GoodsCategory::getIsPromotionDiscount,goodsCategory.getIsPromotionDiscount())
|
|
|
-// .eq(GoodsCategory::getParentId,goodsCategory.getCategoryId()).update();
|
|
|
|
|
|
// 文档分类处理
|
|
|
if (goodsCategoryBean.getType() == 5) {
|
|
|
@@ -198,7 +199,10 @@ public class GoodsCategoryLogic {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void delete(String categoryId) {
|
|
|
-// goodsCategoryService.removeById(categoryId);
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ if (Objects.nonNull(adminUser.getAdminCompanyWechat())) {
|
|
|
+ throw new RemoteServiceException("非平台账号不可操作当前信息");
|
|
|
+ }
|
|
|
//查询分类和子类
|
|
|
List<GoodsCategory> list = goodsCategoryService.lambdaQuery()
|
|
|
.eq(GoodsCategory::getCategoryId, categoryId)
|