From 0a530dd5d5101f3c9da70f787ffcb048fe5583f8 Mon Sep 17 00:00:00 2001 From: username <1532322479@qq.com> Date: Thu, 6 Jun 2024 08:11:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=90=86=E5=95=86?= =?UTF-8?q?=E4=BA=A7=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bs/df/controller/DfBrokerController.java | 33 ++++ .../DfProductArticleController.java | 7 + .../controller/DfProductInfoController.java | 170 +++++++++++++++--- .../controller/DfProductMomentController.java | 7 + .../controller/DfProductPosterController.java | 17 ++ .../main/java/com/bs/df/domain/DfBroker.java | 4 + .../com/bs/df/domain/DfBrokerProduct.java | 5 + .../java/com/bs/df/domain/DfProductInfo.java | 5 + .../com/bs/df/service/IDfBrokerService.java | 20 +++ .../df/service/impl/DfBrokerServiceImpl.java | 51 ++++++ .../controller/system/SysUserController.java | 25 +-- bs-ui/src/api/product/info.js | 54 +++++- bs-ui/src/views/article/article/index.vue | 4 +- bs-ui/src/views/biz/clue/index.vue | 70 ++++---- .../broker/broker/components/BrokerUser.vue | 3 + .../broker/broker/components/DfBroker.vue | 6 +- .../product/components/BrokerProduct.vue | 101 ++++++----- .../broker/product/components/DfBroker.vue | 6 +- bs-ui/src/views/broker/product/index.vue | 2 +- .../views/broker/user/components/DfBroker.vue | 6 +- bs-ui/src/views/moment/moment/index.vue | 4 +- .../order/order/components/OrderUser.vue | 3 + bs-ui/src/views/poster/poster/index.vue | 2 +- bs-ui/src/views/product/info/index.vue | 44 +++-- .../views/system/user/profile/userInfo.vue | 2 +- 25 files changed, 505 insertions(+), 146 deletions(-) diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfBrokerController.java b/bs-admin/src/main/java/com/bs/df/controller/DfBrokerController.java index 74b524c..10e11f2 100644 --- a/bs-admin/src/main/java/com/bs/df/controller/DfBrokerController.java +++ b/bs-admin/src/main/java/com/bs/df/controller/DfBrokerController.java @@ -8,6 +8,7 @@ import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; import com.bs.common.core.domain.entity.SysUser; +import com.bs.common.utils.SecurityUtils; import com.bs.df.domain.DfProductPoster; import com.bs.df.utils.HtmlUtils; import com.bs.system.service.ISysUserService; @@ -57,6 +58,10 @@ public class DfBrokerController extends BaseController { public TableDataInfo pageList(DfBroker dfBroker) { startPage(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List longs = dfBrokerService.filterByUser(); + queryWrapper.in(DfBroker::getId, longs); + } queryWrapper.orderByAsc(DfBroker::getOrderNum); condition(queryWrapper,dfBroker); List list = dfBrokerService.list(queryWrapper); @@ -96,6 +101,8 @@ public class DfBrokerController extends BaseController { } + + /** * 查询代理商经纪列表 */ @@ -118,9 +125,35 @@ public class DfBrokerController extends BaseController { condition(queryWrapper,dfBroker); List list = dfBrokerService.list(queryWrapper); List treeList = buildTree(list); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List longs = dfBrokerService.filterByUser(); + treeList = filterTree(treeList, longs); +// queryWrapper.in(DfBroker::getId, longs); + } return success(treeList); } + private List filterTree(List treeList, List idList) { + List filteredList = new ArrayList<>(); + for (DfBroker broker : treeList) { + // 如果当前节点的 ID 在列表中,则将其加入到结果列表中 + if (idList.contains(broker.getId())) { + filteredList.add(broker); + } + // 如果当前节点有子节点,则递归调用该方法对其子节点进行过滤 + if (broker.getChildren() != null && !broker.getChildren().isEmpty()) { + List children = filterTree(broker.getChildren(), idList); + // 如果子节点也被过滤掉了,则不加入到结果列表中 + if (!children.isEmpty()) { + broker.setChildren(children); + filteredList.add(broker); + } + } + } + return filteredList; + } + + /** * 导出代理商经纪列表 */ diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductArticleController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductArticleController.java index f33af00..6c9d30c 100644 --- a/bs-admin/src/main/java/com/bs/df/controller/DfProductArticleController.java +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductArticleController.java @@ -169,6 +169,13 @@ public class DfProductArticleController extends BaseController { @Log(title = "产品文章删除", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable List ids) { + List list = dfProductArticleService.list(new LambdaQueryWrapper() + .in(DfProductArticle::getId, ids)); + for (DfProductArticle dfProductArticle : list) { + if ("1".equals(dfProductArticle.getStatus())) { + return AjaxResult.warn("该产品文章已经上架,请先下架再删除"); + } + } return toAjax(dfProductArticleService.removeBatchByIds(ids)); } diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductInfoController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductInfoController.java index acb1f2d..6430b5f 100644 --- a/bs-admin/src/main/java/com/bs/df/controller/DfProductInfoController.java +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductInfoController.java @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; import com.bs.common.annotation.Anonymous; import com.bs.common.core.domain.entity.SysUser; +import com.bs.common.utils.SecurityUtils; import com.bs.df.domain.*; import com.bs.df.service.*; import com.bs.df.utils.HtmlUtils; @@ -69,7 +70,18 @@ public class DfProductInfoController extends BaseController { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); String brokerIds = dfProductInfo.getBrokerIds(); if ("1".equals(dfProductInfo.getSelectByBroker())) { - queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_broker_product where broker_id in (" + brokerIds + ") and del_flag = '0'"); + queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_broker_product where broker_id in (" + brokerIds + ") and del_flag = '0' and staus = '1'"); + } + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId(); + if (productIdsByBrokerId.size() == 0) { + productIdsByBrokerId.add(0L); + } + if (!"1".equals(dfProductInfo.getSelectByBroker())) { + queryWrapper.in(DfProductInfo::getId, productIdsByBrokerId) + .or() + .in(DfProductInfo::getCreateDept, SecurityUtils.getDeptId()); + } } condition(queryWrapper,dfProductInfo); List list = dfProductInfoService.list(queryWrapper); @@ -98,32 +110,19 @@ public class DfProductInfoController extends BaseController { cityMap.put(city.getAreaId(), city.getName()); } Map brokerProductMap = new HashMap<>(); + DfBroker byId = null; if ("1".equals(dfProductInfo.getSelectByBroker())) { - List listBroker = dfBrokerService.list(); - Map brokerMap = new HashMap<>(); - for (DfBroker broker : listBroker) { - brokerMap.put(broker.getId(), broker.getBrokerName()); - } - List listBrokerProduct = dfBrokerProductService.list(); - for (DfBrokerProduct brokerProduct : listBrokerProduct) { - String brokerName = brokerMap.get(brokerProduct.getBrokerId()); - brokerProduct.setBrokerName(brokerName); - } - for (DfBrokerProduct brokerProduct : listBrokerProduct) { - brokerProductMap.put(brokerProduct.getProductId(), brokerProduct.getBrokerName()); - } + byId = dfBrokerService.getById(brokerIds); } for (DfProductInfo productInfo : list) { productInfo.setInterestRate(productInfo.getInterestRateBegin() + "%-" + productInfo.getInterestRateEnd() + "%"); productInfo.setProductIntro(HtmlUtils.stripHtmlTags(productInfo.getProductIntro())); productInfo.setProductDetail(HtmlUtils.stripHtmlTags(productInfo.getProductDetail())); - // 获取原始的城市ID字符串 String businessCity = productInfo.getBusinessCity(); if (Validator.isNotEmpty(businessCity)) { String[] cityIds = businessCity.split(","); StringBuilder translatedCities = new StringBuilder(); for (String cityId : cityIds) { - // 从 Map 中获取城市名称 String cityName = cityMap.get(cityId); if (cityName != null) { translatedCities.append(cityName).append(","); @@ -135,7 +134,8 @@ public class DfProductInfoController extends BaseController { productInfo.setBusinessCity(translatedCities.toString()); } if ("1".equals(dfProductInfo.getSelectByBroker())) { - productInfo.setBrokerName(brokerProductMap.get(productInfo.getId())); + productInfo.setBrokerName(byId.getBrokerName()); +// productInfo.setBrokerName(brokerProductMap.get(productInfo.getId())); } } return getDataTable(list); @@ -158,6 +158,57 @@ public class DfProductInfoController extends BaseController { return success(list); } + + /** + * 根据代理商经纪id查询产品信息列表 + */ + @ApiOperation("根据代理商经纪id查询产品信息列表") + @GetMapping("/listByBroker") + public AjaxResult listByBroker(DfProductInfo dfProductInfo) { +// Long userId = SecurityUtils.getUserId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + DfBroker broker = dfBrokerService.getById(dfProductInfo.getBrokerId()); + if (Validator.isEmpty(broker.getParentId())) { + List listBrokerProduct = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, broker.getId()) + .eq(DfBrokerProduct::getStaus, "1")); + List productIds = listBrokerProduct.stream() + .map(DfBrokerProduct::getProductId) + .collect(Collectors.toList()); + productIds.removeIf(id -> id.equals(dfProductInfo.getId())); + if (null != productIds && productIds.size() == 0) { + productIds.add(0L); + } + queryWrapper.notIn(DfProductInfo::getId, productIds); + } else { + List listBrokerProduct = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, broker.getParentId()) + .eq(DfBrokerProduct::getStaus, "1")); + List productIds = listBrokerProduct.stream() + .map(DfBrokerProduct::getProductId) + .collect(Collectors.toList()); + if (null != productIds && productIds.size() == 0) { + productIds.add(0L); + } + queryWrapper.in(DfProductInfo::getId, productIds); + List listProduct = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, broker.getId()) + .eq(DfBrokerProduct::getStaus, "1")); + List productIdsNew = listProduct.stream() + .map(DfBrokerProduct::getProductId) + .collect(Collectors.toList()); + productIdsNew.removeIf(id -> id.equals(dfProductInfo.getId())); + if (null != productIdsNew && productIdsNew.size() == 0) { + productIdsNew.add(0L); + } + queryWrapper.notIn(DfProductInfo::getId, productIdsNew); + } + queryWrapper.eq(DfProductInfo::getStatus, "1"); + condition(queryWrapper,dfProductInfo); + List list = dfProductInfoService.list(queryWrapper); + return success(list); + } + /** * 导出产品信息列表 */ @@ -237,6 +288,33 @@ public class DfProductInfoController extends BaseController { return success(byId); } + /** + * 根据代理商获取产品信息详细信息 + */ + @ApiOperation("根据代理商获取产品信息详细信息") + @PutMapping(value = "/getInfoByBroker") + @Anonymous + public AjaxResult getInfoByBroker(@RequestBody DfProductInfo dfProductInfo) { + DfProductInfo byId = dfProductInfoService.getById(dfProductInfo.getId()); + List list = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, dfProductInfo.getBrokerId()) + .eq(DfBrokerProduct::getProductId, dfProductInfo.getId())); + if (list.size() > 0 && list != null) { + byId.setBrokerId(list.get(0).getBrokerId()); + } + String businessCity = byId.getBusinessCity(); + if (Validator.isEmpty(businessCity)) { + return success(byId); + } + List businessCityList = Arrays.asList(businessCity.split(",")); + List douAreas = dfAreaService.listByIds(businessCityList); + String concatenatedNames = douAreas.stream() + .map(DfArea::getName) + .collect(Collectors.joining(",")); + byId.setBusinessCityByName(concatenatedNames); + return success(byId); + } + /** * 新增产品信息 */ @@ -268,9 +346,16 @@ public class DfProductInfoController extends BaseController { @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable List ids) { List list = dfProductPosterService.list(new LambdaQueryWrapper().in(DfProductPoster::getProductId, ids)); + List infos = dfProductInfoService.list(new LambdaQueryWrapper().in(DfProductInfo::getId, ids)); + for (DfProductInfo dfProductInfo : infos) { + if ("1".equals(dfProductInfo.getStatus())) { + return AjaxResult.warn("该产品已经上架,请先下架再删除"); + } + } if(list.size() > 0){ return AjaxResult.warn("该产品下有海报,请先删除海报"); } + return toAjax(dfProductInfoService.removeBatchByIds(ids)); } @@ -290,10 +375,35 @@ public class DfProductInfoController extends BaseController { dfProductInfoNew.setStatus(status); dfProductInfos.add(dfProductInfoNew); } + if ("0".equals(status)) { + List list = dfBrokerProductService.list(new LambdaQueryWrapper().in(DfBrokerProduct::getProductId, ids)); + for (DfBrokerProduct dfBrokerProduct : list) { + dfBrokerProduct.setStaus("0"); + } + dfBrokerProductService.updateBatchById(list); + } + if ("1".equals(dfProductInfo.getIsBroker())) { + if ("1".equals(status)) { + List list = dfBrokerProductService.list(new LambdaQueryWrapper().in(DfBrokerProduct::getProductId, ids)); + for (DfBrokerProduct dfBrokerProduct : list) { + dfBrokerProduct.setStaus("1"); + } + dfBrokerProductService.updateBatchById(list); + } + } return toAjax(dfProductInfoService.updateBatchById(dfProductInfos)); } - + /** + * 获取产品相关代理商数量 + */ + @ApiOperation("获取产品相关代理商数量") + @GetMapping(value = "/getBrokerNum/{ids}") + public AjaxResult getBrokerNum(@PathVariable("ids") List ids) { + List list = dfBrokerProductService.list(new LambdaQueryWrapper().in(DfBrokerProduct::getProductId, ids)); + list.size(); + return success(list.size()); + } /** @@ -305,12 +415,15 @@ public class DfProductInfoController extends BaseController { public AjaxResult editByBroker(@RequestBody DfProductInfo dfProductInfo) { Long productInfoId = dfProductInfo.getId(); Long brokerId = dfProductInfo.getBrokerId(); - List list = dfBrokerProductService.list(new LambdaQueryWrapper().eq(DfBrokerProduct::getProductId, productInfoId)); + List list = dfBrokerProductService.list(new LambdaQueryWrapper().eq(DfBrokerProduct::getProductId, productInfoId) + .eq(DfBrokerProduct::getBrokerId, brokerId)); if (list != null && list.size() > 0) { DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId).setId(list.get(0).getId()); + dfBrokerProduct.setStaus("1"); return toAjax(dfBrokerProductService.updateById(dfBrokerProduct)); } else { DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId); + dfBrokerProduct.setStaus("1"); return toAjax(dfBrokerProductService.save(dfBrokerProduct)); } } @@ -320,11 +433,24 @@ public class DfProductInfoController extends BaseController { */ @ApiOperation("移除代理产品权限") @Log(title = "代理产品权限移除", businessType = BusinessType.DELETE) - @DeleteMapping("/removeByBroker/{ids}") - public AjaxResult removeByBroker(@PathVariable List ids) { - return toAjax(dfBrokerProductService.remove(new LambdaQueryWrapper().in(DfBrokerProduct::getProductId, ids))); + @PutMapping("/removeByBroker") + public AjaxResult removeByBroker(@RequestBody DfProductInfo dfProductInfo) { + Long[] ids = dfProductInfo.getIds(); + Long brokerId = dfProductInfo.getBrokerId(); +// List list = dfBrokerService.list(new LambdaQueryWrapper().eq(DfBroker::getParentId, brokerId)); + List allSubordinates = dfBrokerService.findAllSubordinates(brokerId); +// List allSubordinates = findAllSubordinates(brokerId); + List brokerIds = allSubordinates.stream() + .map(DfBroker::getId) + .collect(Collectors.toList()); + brokerIds.add(brokerId); + boolean remove = dfBrokerProductService.remove(new LambdaQueryWrapper() + .in(DfBrokerProduct::getProductId, ids) + .in(DfBrokerProduct::getBrokerId, brokerIds)); + return toAjax(remove); } + /** * 条件设置 */ diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductMomentController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductMomentController.java index 97e1218..1af852e 100644 --- a/bs-admin/src/main/java/com/bs/df/controller/DfProductMomentController.java +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductMomentController.java @@ -162,6 +162,13 @@ public class DfProductMomentController extends BaseController { @Log(title = "产品朋友圈删除", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable List ids) { + List list = dfProductMomentService.list(new LambdaQueryWrapper() + .in(DfProductMoment::getId, ids)); + for (DfProductMoment dfProductMoment : list) { + if ("1".equals(dfProductMoment.getStatus())) { + return AjaxResult.warn("该产品朋友圈已经上架,请先下架再删除"); + } + } return toAjax(dfProductMomentService.removeBatchByIds(ids)); } diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductPosterController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductPosterController.java index 10c2fa2..a6211d4 100644 --- a/bs-admin/src/main/java/com/bs/df/controller/DfProductPosterController.java +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductPosterController.java @@ -9,7 +9,9 @@ import javax.servlet.http.HttpServletResponse; import com.bs.cm.domain.CmAttach; import com.bs.cm.service.ICmAttachService; +import com.bs.common.utils.SecurityUtils; import com.bs.df.domain.DfProductInfo; +import com.bs.df.service.IDfBrokerService; import com.bs.df.service.IDfProductInfoService; import com.github.yulichang.wrapper.MPJLambdaWrapper; import io.swagger.annotations.Api; @@ -52,6 +54,8 @@ public class DfProductPosterController extends BaseController { private IDfProductInfoService dfProductInfoService; @Autowired private ICmAttachService cmAttachService; + @Resource + private IDfBrokerService dfBrokerService;; /** * 分页查询产品海报列表 */ @@ -64,6 +68,13 @@ public class DfProductPosterController extends BaseController { .select(DfProductInfo::getProductName) .disableSubLogicDel() .leftJoin(DfProductInfo.class,DfProductInfo::getId,DfProductPoster::getProductId); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId(); + if (productIdsByBrokerId.size() == 0) { + productIdsByBrokerId.add(0L); + } + queryWrapper.in(DfProductPoster::getProductId, productIdsByBrokerId); + } conditionByMPJ(queryWrapper,dfProductPoster); List list = dfProductPosterService.list(queryWrapper); List attachVo = cmAttachService.list(); @@ -168,6 +179,12 @@ public class DfProductPosterController extends BaseController { @Log(title = "产品海报删除", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable List ids) { + List list = dfProductPosterService.list(new LambdaQueryWrapper().in(DfProductPoster::getId, ids)); + for (DfProductPoster dfProductPoster : list) { + if ("1".equals(dfProductPoster.getStatus())) { + return AjaxResult.warn("该海报已经上架,请先下架再删除"); + } + } return toAjax(dfProductPosterService.removeBatchByIds(ids)); } diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfBroker.java b/bs-admin/src/main/java/com/bs/df/domain/DfBroker.java index 07e1c59..60b23f1 100644 --- a/bs-admin/src/main/java/com/bs/df/domain/DfBroker.java +++ b/bs-admin/src/main/java/com/bs/df/domain/DfBroker.java @@ -106,4 +106,8 @@ public class DfBroker extends BaseEntity{ private List children; + @TableField(exist = false) + private Boolean isTopLevel; + + } diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfBrokerProduct.java b/bs-admin/src/main/java/com/bs/df/domain/DfBrokerProduct.java index 7d3d59f..a852aad 100644 --- a/bs-admin/src/main/java/com/bs/df/domain/DfBrokerProduct.java +++ b/bs-admin/src/main/java/com/bs/df/domain/DfBrokerProduct.java @@ -47,6 +47,11 @@ public class DfBrokerProduct extends BaseEntity{ @ApiModelProperty(value = "备注") private String remark; + /** 状态0草稿1上架 */ + + @ApiModelProperty(value = "状态") + private String staus; + @TableField(exist = false) private String brokerName; diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfProductInfo.java b/bs-admin/src/main/java/com/bs/df/domain/DfProductInfo.java index bff69d9..522cd38 100644 --- a/bs-admin/src/main/java/com/bs/df/domain/DfProductInfo.java +++ b/bs-admin/src/main/java/com/bs/df/domain/DfProductInfo.java @@ -2,6 +2,8 @@ package com.bs.df.domain; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import com.bs.common.annotation.Excel; import com.bs.common.core.domain.BaseEntity; @@ -170,5 +172,8 @@ public class DfProductInfo extends BaseEntity{ private Long[] ids; + //是否启动代理商权限 + @TableField(exist = false) + private String isBroker; } diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfBrokerService.java b/bs-admin/src/main/java/com/bs/df/service/IDfBrokerService.java index 4c3ef0e..b6765da 100644 --- a/bs-admin/src/main/java/com/bs/df/service/IDfBrokerService.java +++ b/bs-admin/src/main/java/com/bs/df/service/IDfBrokerService.java @@ -3,6 +3,8 @@ package com.bs.df.service; import com.github.yulichang.base.MPJBaseService; import com.bs.df.domain.DfBroker; +import java.util.List; + /** * 代理商经纪Service接口 * @@ -11,4 +13,22 @@ import com.bs.df.domain.DfBroker; */ public interface IDfBrokerService extends MPJBaseService{ + /** + * 通过用户id获取相对应的代理商权限 + * @return 代理商权限 + */ + public List filterByUser(); + + /** + * 通过代理商id获取相对应的子代理 + * @return 代理商权限 + */ + public List findAllSubordinates(Long brokerId); + + /** + * 通过用户id获取相对应的产品id + * @return 产品id + */ + public List getProductIdsByBrokerId(); + } diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerServiceImpl.java index 2eddff0..4e608e1 100644 --- a/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerServiceImpl.java +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerServiceImpl.java @@ -1,11 +1,23 @@ package com.bs.df.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.bs.common.core.domain.entity.SysUser; +import com.bs.common.utils.SecurityUtils; +import com.bs.df.domain.DfBrokerProduct; import com.bs.df.mapper.DfBrokerMapper; import com.bs.df.domain.DfBroker; +import com.bs.df.service.IDfBrokerProductService; import com.bs.df.service.IDfBrokerService; +import com.bs.system.service.ISysUserService; import com.github.yulichang.base.MPJBaseServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + /** * 代理商经纪Service业务层处理 * @@ -15,5 +27,44 @@ import org.springframework.transaction.annotation.Transactional; @Service @Transactional(rollbackFor = Exception.class) public class DfBrokerServiceImpl extends MPJBaseServiceImpl implements IDfBrokerService { + @Autowired + private ISysUserService userService; + @Autowired + private IDfBrokerService dfBrokerService; + @Autowired + private IDfBrokerProductService dfBrokerProductService; + public List filterByUser() { + SecurityUtils.getUserId(); + SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId()); + Long deptId = sysUser.getDeptId(); + List allSubordinates = findAllSubordinates(deptId); + List brokerIds = allSubordinates.stream() + .map(DfBroker::getId) + .collect(Collectors.toList()); + brokerIds.add(deptId); + return brokerIds; + } + + public List findAllSubordinates(Long brokerId) { + List result = new ArrayList<>(); + // 查询当前brokerId的所有下级 + List subordinates = dfBrokerService.list(new LambdaQueryWrapper().eq(DfBroker::getParentId, brokerId)); + result.addAll(subordinates); + for (DfBroker subordinate : subordinates) { + List subSubordinates = findAllSubordinates(subordinate.getId()); + result.addAll(subSubordinates); + } + return result; + } + + public List getProductIdsByBrokerId() { + List longs = filterByUser(); + List list = dfBrokerProductService.list(new LambdaQueryWrapper() + .in(DfBrokerProduct::getBrokerId, longs) + .eq(DfBrokerProduct::getStaus, "1")); + return list.stream().map(DfBrokerProduct::getProductId).collect(Collectors.toList()); + } + + } diff --git a/bs-admin/src/main/java/com/bs/web/controller/system/SysUserController.java b/bs-admin/src/main/java/com/bs/web/controller/system/SysUserController.java index 379111c..17e5660 100644 --- a/bs-admin/src/main/java/com/bs/web/controller/system/SysUserController.java +++ b/bs-admin/src/main/java/com/bs/web/controller/system/SysUserController.java @@ -77,7 +77,7 @@ public class SysUserController extends BaseController { /** * 获取用户列表 */ - @PreAuthorize("@ss.hasPermi('system:user:list')") + //@PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/list") public TableDataInfo list(SysUser user) { startPage(); @@ -93,6 +93,11 @@ public class SysUserController extends BaseController { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); if (user.getDeptIds()!=null) { wrapper.in(SysUser::getDeptId, user.getDeptIds()); + } else { + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List longs = dfBrokerService.filterByUser(); + wrapper.in(SysUser::getDeptId, longs); + } } condition(wrapper,user); List list = userService.list(wrapper); @@ -158,7 +163,7 @@ public class SysUserController extends BaseController { @Log(title = "用户管理", businessType = BusinessType.EXPORT) - @PreAuthorize("@ss.hasPermi('system:user:export')") + //@PreAuthorize("@ss.hasPermi('system:user:export')") @PostMapping("/export") public void export(HttpServletResponse response, SysUser user) { List list = userService.selectUserList(user); @@ -186,7 +191,7 @@ public class SysUserController extends BaseController { /** * 根据用户编号获取详细信息 */ - @PreAuthorize("@ss.hasPermi('system:user:query')") + //@PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping(value = {"/", "/{userId}"}) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { userService.checkUserDataScope(userId); @@ -251,7 +256,7 @@ public class SysUserController extends BaseController { /** * 新增用户 */ - @PreAuthorize("@ss.hasPermi('system:user:add')") + //@PreAuthorize("@ss.hasPermi('system:user:add')") @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysUser user) { @@ -282,7 +287,7 @@ public class SysUserController extends BaseController { /** * 修改用户 */ - @PreAuthorize("@ss.hasPermi('system:user:edit')") + //@PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysUser user) { @@ -310,7 +315,7 @@ public class SysUserController extends BaseController { /** * 删除用户 */ - @PreAuthorize("@ss.hasPermi('system:user:remove')") + //@PreAuthorize("@ss.hasPermi('system:user:remove')") @Log(title = "用户管理", businessType = BusinessType.DELETE) @DeleteMapping("/{userIds}") public AjaxResult remove(@PathVariable Long[] userIds) { @@ -326,7 +331,7 @@ public class SysUserController extends BaseController { /** * 重置密码 */ - @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") + //@PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping("/resetPwd") public AjaxResult resetPwd(@RequestBody SysUser user) { @@ -340,7 +345,7 @@ public class SysUserController extends BaseController { /** * 状态修改 */ - @PreAuthorize("@ss.hasPermi('system:user:edit')") + //@PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") public AjaxResult changeStatus(@RequestBody SysUser user) { @@ -353,7 +358,7 @@ public class SysUserController extends BaseController { /** * 根据用户编号获取授权角色 */ - @PreAuthorize("@ss.hasPermi('system:user:query')") + //@PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping("/authRole/{userId}") public AjaxResult authRole(@PathVariable("userId") Long userId) { AjaxResult ajax = AjaxResult.success(); @@ -367,7 +372,7 @@ public class SysUserController extends BaseController { /** * 用户授权角色 */ - @PreAuthorize("@ss.hasPermi('system:user:edit')") + //@PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.GRANT) @PutMapping("/authRole") public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { diff --git a/bs-ui/src/api/product/info.js b/bs-ui/src/api/product/info.js index d5e78f1..201b3e9 100644 --- a/bs-ui/src/api/product/info.js +++ b/bs-ui/src/api/product/info.js @@ -18,6 +18,15 @@ export function listInfo(query) { }) } +// 根据代理商经纪id查询产品信息列表 +export function listByBroker(query) { + return request({ + url: '/product/info/listByBroker', + method: 'get', + params: query + }) +} + // 查询产品信息详细 export function getInfo(id) { return request({ @@ -26,6 +35,14 @@ export function getInfo(id) { }) } +// 查询产品信息详细 +export function getBrokerNum(id) { + return request({ + url: '/product/info/getBrokerNum/' + id, + method: 'get' + }) +} + // 新增产品信息 export function addInfo(data) { return request({ @@ -72,14 +89,43 @@ export function delInfo(id) { }) } -// 移除代理产品权限 -export function delInfoByBroker(id) { +// // 移除代理产品权限 +// export function delInfoByBroker(id) { +// return request({ +// url: '/product/info/removeByBroker/' + id, +// method: 'delete' +// }) +// } + +// 修改产品信息 +// export function delInfoByBroker(data) { +// return request({ +// url: '/product/info/removeByBroker', +// method: 'put', +// data: data +// }) +// } + +// 根据代理商经纪id查询产品信息列表 +export function delInfoByBroker(data) { + return request({ + url: '/product/info/removeByBroker', + method: 'put', + data: data + }) +} + +// 根据代理商获取产品信息详细信息 +export function getInfoByBroker(data) { return request({ - url: '/product/info/removeByBroker/' + id, - method: 'delete' + url: '/product/info/getInfoByBroker', + method: 'put', + data: data }) } + + // 导出产品信息 export function exportInfo(query) { return request({ diff --git a/bs-ui/src/views/article/article/index.vue b/bs-ui/src/views/article/article/index.vue index 94d6c25..8b8a4dc 100644 --- a/bs-ui/src/views/article/article/index.vue +++ b/bs-ui/src/views/article/article/index.vue @@ -410,7 +410,7 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.id); - this.names = selection.map(item => item.id); + this.names = selection.map(item => item.articleTitle); this.single = selection.length !== 1; this.multiple = !selection.length; }, @@ -472,7 +472,7 @@ export default { handleDelete(row) { const ids = row.id || this.ids; const names = row.id || this.names; - this.$modal.confirm('是否确认删除产品文章为"' + names + '"的数据项?').then(function () { + this.$modal.confirm('是否确认删除文章标题为"' + names + '"的数据项?').then(function () { return delArticle(ids); }).then(() => { this.getList(); diff --git a/bs-ui/src/views/biz/clue/index.vue b/bs-ui/src/views/biz/clue/index.vue index 5fc3884..76f8c74 100644 --- a/bs-ui/src/views/biz/clue/index.vue +++ b/bs-ui/src/views/biz/clue/index.vue @@ -41,41 +41,41 @@ - - 新增 - - - - 修改 - - - - 删除 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 修改 删除 @@ -148,7 +148,7 @@ - diff --git a/bs-ui/src/views/broker/product/components/BrokerProduct.vue b/bs-ui/src/views/broker/product/components/BrokerProduct.vue index e05ea34..ff6ec5c 100644 --- a/bs-ui/src/views/broker/product/components/BrokerProduct.vue +++ b/bs-ui/src/views/broker/product/components/BrokerProduct.vue @@ -65,7 +65,7 @@ @click="handleAdd" :disabled="!brokerId" v-hasPermi="['product:info:add']" - >添加 + >选择 @@ -108,7 +108,7 @@ - + @@ -180,7 +180,7 @@ @@ -210,13 +210,14 @@ - + - + @@ -277,7 +278,7 @@ - + @@ -337,7 +338,7 @@ @@ -351,7 +352,7 @@
  • {{ city.name }} - +
  • @@ -375,7 +376,9 @@ import { updateInfo, listInfo, editByBroker, - delInfoByBroker + delInfoByBroker, + listByBroker, + getInfoByBroker, } from "@/api/product/info"; import {listArea} from "@/api/system/area"; import {listBrokerByTree} from "@/api/broker/broker"; @@ -395,6 +398,7 @@ export default { }, data() { return { + // isReadOnly: false, brokerList: [], infoListAll: [], brokerId: null, @@ -500,8 +504,8 @@ export default { // 当 rowData 变化时更新 row 的值并打印 this.rowDataNew = newVal; this.brokerId = this.rowDataNew.id; - const allIds = this.getAllIds(this.rowDataNew); - this.queryParams.brokerIds = allIds; + // const allIds = this.getAllIds(this.rowDataNew); + this.queryParams.brokerIds = this.brokerId; this.getList(); }, }, @@ -540,12 +544,13 @@ export default { this.getList(); }); }, - getAllInfo() { + getAllInfo(id) { var params = { selectByBroker: "1", - id: this.form.id, + brokerId: this.rowData.id, + id: id } - listInfo(params).then(response => { + listByBroker(params).then(response => { this.infoListAll = response.data; }); }, @@ -571,7 +576,6 @@ export default { let businessCities = this.form.businessCity.split(','); businessCities.forEach(cityId => { let matchedCity = this.cityList.find(city => city.areaId == cityId); - console.log(matchedCity); if (matchedCity) { selectedCities.push({ areaId: matchedCity.areaId, @@ -650,15 +654,13 @@ export default { }).catch(e => { this.loading = false; }); - } - , -// 取消按钮 + }, + // 取消按钮 cancel() { this.open = false; this.reset(); - } - , -// 表单重置 + }, + // 表单重置 reset() { this.form = { id: null, @@ -679,20 +681,17 @@ export default { maxAmountEnd: null, }; this.resetForm("form"); - } - , -//排序 + }, + //排序 handleSortChange(col) { this.$sortBy(col, this.queryParams); this.getList(); - } - , + }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1; this.getList(); - } - , + }, /** 重置按钮操作 */ resetQuery() { this.dateRange = []; @@ -701,16 +700,14 @@ export default { this.queryParams.maxAmountEnd = undefined; this.queryParams.interestRateEnd = undefined; this.handleQuery(); - } - , + }, // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.id); - this.names = selection.map(item => item.id); + this.names = selection.map(item => item.productName); this.single = selection.length !== 1; this.multiple = !selection.length; - } - , + }, /** 新增按钮操作 */ handleAdd() { this.reset(); @@ -718,22 +715,33 @@ export default { this.getbrokerList(); this.form.brokerId = this.brokerId; this.open = true; + // this.isReadOnly = false; this.title = "添加产品信息"; - } - , + }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); this.getbrokerList(); const id = row.id || this.ids; - getInfo(id).then(response => { + var param = { + id: id, + brokerId: this.brokerId + }; + getInfoByBroker(param).then(response => { this.form = response.data; - this.getAllInfo("edit"); + this.getAllInfo(id); this.open = true; this.title = "修改产品信息"; + // this.isReadOnly = true; }); - } - , + // getInfo(id).then(response => { + // this.form = response.data; + // this.form.brokerId = this.brokerId; + // this.getAllInfo(id); + // this.open = true; + // this.title = "修改产品信息"; + // }); + }, /** 提交按钮 */ submitForm() { this.$refs["form"].validate(valid => { @@ -749,21 +757,24 @@ export default { }); } }); - } - , + }, /** 删除按钮操作 */ handleDelete(row) { - const ids = row.id || this.ids; + const rowIds = Array.isArray(row.id) ? row.id : [row.id]; + const ids = [...rowIds, ...this.ids]; const names = row.id || this.names; + var param = { + ids: ids, + brokerId: this.brokerId + }; this.$modal.confirm('是否确认移除产品信息为"' + names + '"的数据项?').then(function () { - return delInfoByBroker(ids); + return delInfoByBroker(param); }).then(() => { this.getList(); this.$modal.msgSuccess("删除成功"); }).catch(() => { }); - } - , + }, /** 导出按钮操作 */ handleExport() { this.download('product/info/export', { diff --git a/bs-ui/src/views/broker/product/components/DfBroker.vue b/bs-ui/src/views/broker/product/components/DfBroker.vue index c5cce82..c023231 100644 --- a/bs-ui/src/views/broker/product/components/DfBroker.vue +++ b/bs-ui/src/views/broker/product/components/DfBroker.vue @@ -120,7 +120,7 @@ type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" - v-hasPermi="['broker:broker:edit']" + v-hasPermi="['system:broker:edit']" >修改 删除 @@ -148,7 +148,7 @@ - diff --git a/bs-ui/src/views/broker/product/index.vue b/bs-ui/src/views/broker/product/index.vue index ed97727..345b80a 100644 --- a/bs-ui/src/views/broker/product/index.vue +++ b/bs-ui/src/views/broker/product/index.vue @@ -25,7 +25,7 @@ export default { }, methods: { handleRowClick(row) { - this.rowData = row;// 在父组件中接收到子组件传递过来的 row 数据 + this.rowData = row; } } }; diff --git a/bs-ui/src/views/broker/user/components/DfBroker.vue b/bs-ui/src/views/broker/user/components/DfBroker.vue index c5cce82..c023231 100644 --- a/bs-ui/src/views/broker/user/components/DfBroker.vue +++ b/bs-ui/src/views/broker/user/components/DfBroker.vue @@ -120,7 +120,7 @@ type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" - v-hasPermi="['broker:broker:edit']" + v-hasPermi="['system:broker:edit']" >修改 删除 @@ -148,7 +148,7 @@ - diff --git a/bs-ui/src/views/moment/moment/index.vue b/bs-ui/src/views/moment/moment/index.vue index 12bfa56..353ff40 100644 --- a/bs-ui/src/views/moment/moment/index.vue +++ b/bs-ui/src/views/moment/moment/index.vue @@ -355,7 +355,7 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.id); - this.names = selection.map(item => item.id); + this.names = selection.map(item => item.momentTitle); this.single = selection.length !== 1; this.multiple = !selection.length; }, @@ -416,7 +416,7 @@ export default { handleDelete(row) { const ids = row.id || this.ids; const names = row.id || this.names; - this.$modal.confirm('是否确认删除产品朋友圈为"' + names + '"的数据项?').then(function () { + this.$modal.confirm('是否确认删除朋友圈标题为"' + names + '"的数据项?').then(function () { return delMoment(ids); }).then(() => { this.getList(); diff --git a/bs-ui/src/views/order/order/components/OrderUser.vue b/bs-ui/src/views/order/order/components/OrderUser.vue index 65fc1ec..a665b1d 100644 --- a/bs-ui/src/views/order/order/components/OrderUser.vue +++ b/bs-ui/src/views/order/order/components/OrderUser.vue @@ -401,6 +401,9 @@ export default { ], // 表单校验 rules: { + // roleIds: [ + // {required: true, message: "角色不能为空", trigger: "blur"} + // ], userName: [ {required: true, message: "用户名称不能为空", trigger: "blur"}, {min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur'} diff --git a/bs-ui/src/views/poster/poster/index.vue b/bs-ui/src/views/poster/poster/index.vue index 6bc5204..5414d62 100644 --- a/bs-ui/src/views/poster/poster/index.vue +++ b/bs-ui/src/views/poster/poster/index.vue @@ -405,7 +405,7 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.id); - this.names = selection.map(item => item.id); + this.names = selection.map(item => item.posterName); this.single = selection.length !== 1; this.multiple = !selection.length; }, diff --git a/bs-ui/src/views/product/info/index.vue b/bs-ui/src/views/product/info/index.vue index c2d3e79..081a6b5 100644 --- a/bs-ui/src/views/product/info/index.vue +++ b/bs-ui/src/views/product/info/index.vue @@ -293,7 +293,6 @@ - @@ -406,7 +405,6 @@ -

    已选择城市

      @@ -427,7 +425,7 @@