修改代理商产品

master
username 11 months ago
parent 7297c23585
commit 0a530dd5d5

@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.bs.common.core.domain.entity.SysUser; import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.utils.SecurityUtils;
import com.bs.df.domain.DfProductPoster; import com.bs.df.domain.DfProductPoster;
import com.bs.df.utils.HtmlUtils; import com.bs.df.utils.HtmlUtils;
import com.bs.system.service.ISysUserService; import com.bs.system.service.ISysUserService;
@ -57,6 +58,10 @@ public class DfBrokerController extends BaseController {
public TableDataInfo pageList(DfBroker dfBroker) { public TableDataInfo pageList(DfBroker dfBroker) {
startPage(); startPage();
LambdaQueryWrapper<DfBroker> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<DfBroker> queryWrapper = new LambdaQueryWrapper();
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> longs = dfBrokerService.filterByUser();
queryWrapper.in(DfBroker::getId, longs);
}
queryWrapper.orderByAsc(DfBroker::getOrderNum); queryWrapper.orderByAsc(DfBroker::getOrderNum);
condition(queryWrapper,dfBroker); condition(queryWrapper,dfBroker);
List<DfBroker> list = dfBrokerService.list(queryWrapper); List<DfBroker> 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); condition(queryWrapper,dfBroker);
List<DfBroker> list = dfBrokerService.list(queryWrapper); List<DfBroker> list = dfBrokerService.list(queryWrapper);
List<DfBroker> treeList = buildTree(list); List<DfBroker> treeList = buildTree(list);
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> longs = dfBrokerService.filterByUser();
treeList = filterTree(treeList, longs);
// queryWrapper.in(DfBroker::getId, longs);
}
return success(treeList); return success(treeList);
} }
private List<DfBroker> filterTree(List<DfBroker> treeList, List<Long> idList) {
List<DfBroker> filteredList = new ArrayList<>();
for (DfBroker broker : treeList) {
// 如果当前节点的 ID 在列表中,则将其加入到结果列表中
if (idList.contains(broker.getId())) {
filteredList.add(broker);
}
// 如果当前节点有子节点,则递归调用该方法对其子节点进行过滤
if (broker.getChildren() != null && !broker.getChildren().isEmpty()) {
List<DfBroker> children = filterTree(broker.getChildren(), idList);
// 如果子节点也被过滤掉了,则不加入到结果列表中
if (!children.isEmpty()) {
broker.setChildren(children);
filteredList.add(broker);
}
}
}
return filteredList;
}
/** /**
* *
*/ */

@ -169,6 +169,13 @@ public class DfProductArticleController extends BaseController {
@Log(title = "产品文章删除", businessType = BusinessType.DELETE) @Log(title = "产品文章删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<String> ids) { public AjaxResult remove(@PathVariable List<String> ids) {
List<DfProductArticle> list = dfProductArticleService.list(new LambdaQueryWrapper<DfProductArticle>()
.in(DfProductArticle::getId, ids));
for (DfProductArticle dfProductArticle : list) {
if ("1".equals(dfProductArticle.getStatus())) {
return AjaxResult.warn("该产品文章已经上架,请先下架再删除");
}
}
return toAjax(dfProductArticleService.removeBatchByIds(ids)); return toAjax(dfProductArticleService.removeBatchByIds(ids));
} }

@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.bs.common.annotation.Anonymous; import com.bs.common.annotation.Anonymous;
import com.bs.common.core.domain.entity.SysUser; import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.utils.SecurityUtils;
import com.bs.df.domain.*; import com.bs.df.domain.*;
import com.bs.df.service.*; import com.bs.df.service.*;
import com.bs.df.utils.HtmlUtils; import com.bs.df.utils.HtmlUtils;
@ -69,7 +70,18 @@ public class DfProductInfoController extends BaseController {
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper();
String brokerIds = dfProductInfo.getBrokerIds(); String brokerIds = dfProductInfo.getBrokerIds();
if ("1".equals(dfProductInfo.getSelectByBroker())) { 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<Long> 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); condition(queryWrapper,dfProductInfo);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper); List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
@ -98,32 +110,19 @@ public class DfProductInfoController extends BaseController {
cityMap.put(city.getAreaId(), city.getName()); cityMap.put(city.getAreaId(), city.getName());
} }
Map<Long, String> brokerProductMap = new HashMap<>(); Map<Long, String> brokerProductMap = new HashMap<>();
DfBroker byId = null;
if ("1".equals(dfProductInfo.getSelectByBroker())) { if ("1".equals(dfProductInfo.getSelectByBroker())) {
List<DfBroker> listBroker = dfBrokerService.list(); byId = dfBrokerService.getById(brokerIds);
Map<Long, String> brokerMap = new HashMap<>();
for (DfBroker broker : listBroker) {
brokerMap.put(broker.getId(), broker.getBrokerName());
}
List<DfBrokerProduct> 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());
}
} }
for (DfProductInfo productInfo : list) { for (DfProductInfo productInfo : list) {
productInfo.setInterestRate(productInfo.getInterestRateBegin() + "%-" + productInfo.getInterestRateEnd() + "%"); productInfo.setInterestRate(productInfo.getInterestRateBegin() + "%-" + productInfo.getInterestRateEnd() + "%");
productInfo.setProductIntro(HtmlUtils.stripHtmlTags(productInfo.getProductIntro())); productInfo.setProductIntro(HtmlUtils.stripHtmlTags(productInfo.getProductIntro()));
productInfo.setProductDetail(HtmlUtils.stripHtmlTags(productInfo.getProductDetail())); productInfo.setProductDetail(HtmlUtils.stripHtmlTags(productInfo.getProductDetail()));
// 获取原始的城市ID字符串
String businessCity = productInfo.getBusinessCity(); String businessCity = productInfo.getBusinessCity();
if (Validator.isNotEmpty(businessCity)) { if (Validator.isNotEmpty(businessCity)) {
String[] cityIds = businessCity.split(","); String[] cityIds = businessCity.split(",");
StringBuilder translatedCities = new StringBuilder(); StringBuilder translatedCities = new StringBuilder();
for (String cityId : cityIds) { for (String cityId : cityIds) {
// 从 Map 中获取城市名称
String cityName = cityMap.get(cityId); String cityName = cityMap.get(cityId);
if (cityName != null) { if (cityName != null) {
translatedCities.append(cityName).append(","); translatedCities.append(cityName).append(",");
@ -135,7 +134,8 @@ public class DfProductInfoController extends BaseController {
productInfo.setBusinessCity(translatedCities.toString()); productInfo.setBusinessCity(translatedCities.toString());
} }
if ("1".equals(dfProductInfo.getSelectByBroker())) { if ("1".equals(dfProductInfo.getSelectByBroker())) {
productInfo.setBrokerName(brokerProductMap.get(productInfo.getId())); productInfo.setBrokerName(byId.getBrokerName());
// productInfo.setBrokerName(brokerProductMap.get(productInfo.getId()));
} }
} }
return getDataTable(list); return getDataTable(list);
@ -158,6 +158,57 @@ public class DfProductInfoController extends BaseController {
return success(list); return success(list);
} }
/**
* id
*/
@ApiOperation("根据代理商经纪id查询产品信息列表")
@GetMapping("/listByBroker")
public AjaxResult listByBroker(DfProductInfo dfProductInfo) {
// Long userId = SecurityUtils.getUserId();
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper();
DfBroker broker = dfBrokerService.getById(dfProductInfo.getBrokerId());
if (Validator.isEmpty(broker.getParentId())) {
List<DfBrokerProduct> listBrokerProduct = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
.eq(DfBrokerProduct::getBrokerId, broker.getId())
.eq(DfBrokerProduct::getStaus, "1"));
List<Long> 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<DfBrokerProduct> listBrokerProduct = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
.eq(DfBrokerProduct::getBrokerId, broker.getParentId())
.eq(DfBrokerProduct::getStaus, "1"));
List<Long> productIds = listBrokerProduct.stream()
.map(DfBrokerProduct::getProductId)
.collect(Collectors.toList());
if (null != productIds && productIds.size() == 0) {
productIds.add(0L);
}
queryWrapper.in(DfProductInfo::getId, productIds);
List<DfBrokerProduct> listProduct = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
.eq(DfBrokerProduct::getBrokerId, broker.getId())
.eq(DfBrokerProduct::getStaus, "1"));
List<Long> 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<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
return success(list);
}
/** /**
* *
*/ */
@ -237,6 +288,33 @@ public class DfProductInfoController extends BaseController {
return success(byId); return success(byId);
} }
/**
*
*/
@ApiOperation("根据代理商获取产品信息详细信息")
@PutMapping(value = "/getInfoByBroker")
@Anonymous
public AjaxResult getInfoByBroker(@RequestBody DfProductInfo dfProductInfo) {
DfProductInfo byId = dfProductInfoService.getById(dfProductInfo.getId());
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
.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<String> businessCityList = Arrays.asList(businessCity.split(","));
List<DfArea> 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}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) { public AjaxResult remove(@PathVariable List<Long> ids) {
List<DfProductPoster> list = dfProductPosterService.list(new LambdaQueryWrapper<DfProductPoster>().in(DfProductPoster::getProductId, ids)); List<DfProductPoster> list = dfProductPosterService.list(new LambdaQueryWrapper<DfProductPoster>().in(DfProductPoster::getProductId, ids));
List<DfProductInfo> infos = dfProductInfoService.list(new LambdaQueryWrapper<DfProductInfo>().in(DfProductInfo::getId, ids));
for (DfProductInfo dfProductInfo : infos) {
if ("1".equals(dfProductInfo.getStatus())) {
return AjaxResult.warn("该产品已经上架,请先下架再删除");
}
}
if(list.size() > 0){ if(list.size() > 0){
return AjaxResult.warn("该产品下有海报,请先删除海报"); return AjaxResult.warn("该产品下有海报,请先删除海报");
} }
return toAjax(dfProductInfoService.removeBatchByIds(ids)); return toAjax(dfProductInfoService.removeBatchByIds(ids));
} }
@ -290,10 +375,35 @@ public class DfProductInfoController extends BaseController {
dfProductInfoNew.setStatus(status); dfProductInfoNew.setStatus(status);
dfProductInfos.add(dfProductInfoNew); dfProductInfos.add(dfProductInfoNew);
} }
if ("0".equals(status)) {
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>().in(DfBrokerProduct::getProductId, ids));
for (DfBrokerProduct dfBrokerProduct : list) {
dfBrokerProduct.setStaus("0");
}
dfBrokerProductService.updateBatchById(list);
}
if ("1".equals(dfProductInfo.getIsBroker())) {
if ("1".equals(status)) {
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>().in(DfBrokerProduct::getProductId, ids));
for (DfBrokerProduct dfBrokerProduct : list) {
dfBrokerProduct.setStaus("1");
}
dfBrokerProductService.updateBatchById(list);
}
}
return toAjax(dfProductInfoService.updateBatchById(dfProductInfos)); return toAjax(dfProductInfoService.updateBatchById(dfProductInfos));
} }
/**
*
*/
@ApiOperation("获取产品相关代理商数量")
@GetMapping(value = "/getBrokerNum/{ids}")
public AjaxResult getBrokerNum(@PathVariable("ids") List<Long> ids) {
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>().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) { public AjaxResult editByBroker(@RequestBody DfProductInfo dfProductInfo) {
Long productInfoId = dfProductInfo.getId(); Long productInfoId = dfProductInfo.getId();
Long brokerId = dfProductInfo.getBrokerId(); Long brokerId = dfProductInfo.getBrokerId();
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>().eq(DfBrokerProduct::getProductId, productInfoId)); List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>().eq(DfBrokerProduct::getProductId, productInfoId)
.eq(DfBrokerProduct::getBrokerId, brokerId));
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId).setId(list.get(0).getId()); DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId).setId(list.get(0).getId());
dfBrokerProduct.setStaus("1");
return toAjax(dfBrokerProductService.updateById(dfBrokerProduct)); return toAjax(dfBrokerProductService.updateById(dfBrokerProduct));
} else { } else {
DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId); DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId);
dfBrokerProduct.setStaus("1");
return toAjax(dfBrokerProductService.save(dfBrokerProduct)); return toAjax(dfBrokerProductService.save(dfBrokerProduct));
} }
} }
@ -320,11 +433,24 @@ public class DfProductInfoController extends BaseController {
*/ */
@ApiOperation("移除代理产品权限") @ApiOperation("移除代理产品权限")
@Log(title = "代理产品权限移除", businessType = BusinessType.DELETE) @Log(title = "代理产品权限移除", businessType = BusinessType.DELETE)
@DeleteMapping("/removeByBroker/{ids}") @PutMapping("/removeByBroker")
public AjaxResult removeByBroker(@PathVariable List<Long> ids) { public AjaxResult removeByBroker(@RequestBody DfProductInfo dfProductInfo) {
return toAjax(dfBrokerProductService.remove(new LambdaQueryWrapper<DfBrokerProduct>().in(DfBrokerProduct::getProductId, ids))); Long[] ids = dfProductInfo.getIds();
Long brokerId = dfProductInfo.getBrokerId();
// List<DfBroker> list = dfBrokerService.list(new LambdaQueryWrapper<DfBroker>().eq(DfBroker::getParentId, brokerId));
List<DfBroker> allSubordinates = dfBrokerService.findAllSubordinates(brokerId);
// List<DfBroker> allSubordinates = findAllSubordinates(brokerId);
List<Long> brokerIds = allSubordinates.stream()
.map(DfBroker::getId)
.collect(Collectors.toList());
brokerIds.add(brokerId);
boolean remove = dfBrokerProductService.remove(new LambdaQueryWrapper<DfBrokerProduct>()
.in(DfBrokerProduct::getProductId, ids)
.in(DfBrokerProduct::getBrokerId, brokerIds));
return toAjax(remove);
} }
/** /**
* *
*/ */

@ -162,6 +162,13 @@ public class DfProductMomentController extends BaseController {
@Log(title = "产品朋友圈删除", businessType = BusinessType.DELETE) @Log(title = "产品朋友圈删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<String> ids) { public AjaxResult remove(@PathVariable List<String> ids) {
List<DfProductMoment> list = dfProductMomentService.list(new LambdaQueryWrapper<DfProductMoment>()
.in(DfProductMoment::getId, ids));
for (DfProductMoment dfProductMoment : list) {
if ("1".equals(dfProductMoment.getStatus())) {
return AjaxResult.warn("该产品朋友圈已经上架,请先下架再删除");
}
}
return toAjax(dfProductMomentService.removeBatchByIds(ids)); return toAjax(dfProductMomentService.removeBatchByIds(ids));
} }

@ -9,7 +9,9 @@ import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach; import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService; import com.bs.cm.service.ICmAttachService;
import com.bs.common.utils.SecurityUtils;
import com.bs.df.domain.DfProductInfo; import com.bs.df.domain.DfProductInfo;
import com.bs.df.service.IDfBrokerService;
import com.bs.df.service.IDfProductInfoService; import com.bs.df.service.IDfProductInfoService;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -52,6 +54,8 @@ public class DfProductPosterController extends BaseController {
private IDfProductInfoService dfProductInfoService; private IDfProductInfoService dfProductInfoService;
@Autowired @Autowired
private ICmAttachService cmAttachService; private ICmAttachService cmAttachService;
@Resource
private IDfBrokerService dfBrokerService;;
/** /**
* *
*/ */
@ -64,6 +68,13 @@ public class DfProductPosterController extends BaseController {
.select(DfProductInfo::getProductName) .select(DfProductInfo::getProductName)
.disableSubLogicDel() .disableSubLogicDel()
.leftJoin(DfProductInfo.class,DfProductInfo::getId,DfProductPoster::getProductId); .leftJoin(DfProductInfo.class,DfProductInfo::getId,DfProductPoster::getProductId);
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId();
if (productIdsByBrokerId.size() == 0) {
productIdsByBrokerId.add(0L);
}
queryWrapper.in(DfProductPoster::getProductId, productIdsByBrokerId);
}
conditionByMPJ(queryWrapper,dfProductPoster); conditionByMPJ(queryWrapper,dfProductPoster);
List<DfProductPoster> list = dfProductPosterService.list(queryWrapper); List<DfProductPoster> list = dfProductPosterService.list(queryWrapper);
List<CmAttach> attachVo = cmAttachService.list(); List<CmAttach> attachVo = cmAttachService.list();
@ -168,6 +179,12 @@ public class DfProductPosterController extends BaseController {
@Log(title = "产品海报删除", businessType = BusinessType.DELETE) @Log(title = "产品海报删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<String> ids) { public AjaxResult remove(@PathVariable List<String> ids) {
List<DfProductPoster> list = dfProductPosterService.list(new LambdaQueryWrapper<DfProductPoster>().in(DfProductPoster::getId, ids));
for (DfProductPoster dfProductPoster : list) {
if ("1".equals(dfProductPoster.getStatus())) {
return AjaxResult.warn("该海报已经上架,请先下架再删除");
}
}
return toAjax(dfProductPosterService.removeBatchByIds(ids)); return toAjax(dfProductPosterService.removeBatchByIds(ids));
} }

@ -106,4 +106,8 @@ public class DfBroker extends BaseEntity{
private List<DfBroker> children; private List<DfBroker> children;
@TableField(exist = false)
private Boolean isTopLevel;
} }

@ -47,6 +47,11 @@ public class DfBrokerProduct extends BaseEntity{
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
/** 状态0草稿1上架 */
@ApiModelProperty(value = "状态")
private String staus;
@TableField(exist = false) @TableField(exist = false)
private String brokerName; private String brokerName;

@ -2,6 +2,8 @@ package com.bs.df.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.bs.common.annotation.Excel; import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity; import com.bs.common.core.domain.BaseEntity;
@ -170,5 +172,8 @@ public class DfProductInfo extends BaseEntity{
private Long[] ids; private Long[] ids;
//是否启动代理商权限
@TableField(exist = false)
private String isBroker;
} }

@ -3,6 +3,8 @@ package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService; import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfBroker; import com.bs.df.domain.DfBroker;
import java.util.List;
/** /**
* Service * Service
* *
@ -11,4 +13,22 @@ import com.bs.df.domain.DfBroker;
*/ */
public interface IDfBrokerService extends MPJBaseService<DfBroker>{ public interface IDfBrokerService extends MPJBaseService<DfBroker>{
/**
* id
* @return
*/
public List<Long> filterByUser();
/**
* id
* @return
*/
public List<DfBroker> findAllSubordinates(Long brokerId);
/**
* idid
* @return id
*/
public List<Long> getProductIdsByBrokerId();
} }

@ -1,11 +1,23 @@
package com.bs.df.service.impl; 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.mapper.DfBrokerMapper;
import com.bs.df.domain.DfBroker; import com.bs.df.domain.DfBroker;
import com.bs.df.service.IDfBrokerProductService;
import com.bs.df.service.IDfBrokerService; import com.bs.df.service.IDfBrokerService;
import com.bs.system.service.ISysUserService;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* Service * Service
* *
@ -15,5 +27,44 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class DfBrokerServiceImpl extends MPJBaseServiceImpl<DfBrokerMapper, DfBroker> implements IDfBrokerService { public class DfBrokerServiceImpl extends MPJBaseServiceImpl<DfBrokerMapper, DfBroker> implements IDfBrokerService {
@Autowired
private ISysUserService userService;
@Autowired
private IDfBrokerService dfBrokerService;
@Autowired
private IDfBrokerProductService dfBrokerProductService;
public List<Long> filterByUser() {
SecurityUtils.getUserId();
SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
Long deptId = sysUser.getDeptId();
List<DfBroker> allSubordinates = findAllSubordinates(deptId);
List<Long> brokerIds = allSubordinates.stream()
.map(DfBroker::getId)
.collect(Collectors.toList());
brokerIds.add(deptId);
return brokerIds;
}
public List<DfBroker> findAllSubordinates(Long brokerId) {
List<DfBroker> result = new ArrayList<>();
// 查询当前brokerId的所有下级
List<DfBroker> subordinates = dfBrokerService.list(new LambdaQueryWrapper<DfBroker>().eq(DfBroker::getParentId, brokerId));
result.addAll(subordinates);
for (DfBroker subordinate : subordinates) {
List<DfBroker> subSubordinates = findAllSubordinates(subordinate.getId());
result.addAll(subSubordinates);
}
return result;
}
public List<Long> getProductIdsByBrokerId() {
List<Long> longs = filterByUser();
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
.in(DfBrokerProduct::getBrokerId, longs)
.eq(DfBrokerProduct::getStaus, "1"));
return list.stream().map(DfBrokerProduct::getProductId).collect(Collectors.toList());
}
} }

@ -77,7 +77,7 @@ public class SysUserController extends BaseController {
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") //@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysUser user) { public TableDataInfo list(SysUser user) {
startPage(); startPage();
@ -93,6 +93,11 @@ public class SysUserController extends BaseController {
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
if (user.getDeptIds()!=null) { if (user.getDeptIds()!=null) {
wrapper.in(SysUser::getDeptId, user.getDeptIds()); wrapper.in(SysUser::getDeptId, user.getDeptIds());
} else {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> longs = dfBrokerService.filterByUser();
wrapper.in(SysUser::getDeptId, longs);
}
} }
condition(wrapper,user); condition(wrapper,user);
List<SysUser> list = userService.list(wrapper); List<SysUser> list = userService.list(wrapper);
@ -158,7 +163,7 @@ public class SysUserController extends BaseController {
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')") //@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysUser user) { public void export(HttpServletResponse response, SysUser user) {
List<SysUser> list = userService.selectUserList(user); List<SysUser> 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}"}) @GetMapping(value = {"/", "/{userId}"})
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
userService.checkUserDataScope(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) @Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user) { 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) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user) { 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) @Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] 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) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd") @PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user) { 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) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user) { 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}") @GetMapping("/authRole/{userId}")
public AjaxResult authRole(@PathVariable("userId") Long userId) { public AjaxResult authRole(@PathVariable("userId") Long userId) {
AjaxResult ajax = AjaxResult.success(); 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) @Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole") @PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {

@ -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) { export function getInfo(id) {
return request({ 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) { export function addInfo(data) {
return request({ 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({ return request({
url: '/product/info/removeByBroker/' + id, url: '/product/info/getInfoByBroker',
method: 'delete' method: 'put',
data: data
}) })
} }
// 导出产品信息 // 导出产品信息
export function exportInfo(query) { export function exportInfo(query) {
return request({ return request({

@ -410,7 +410,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id); 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.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
@ -472,7 +472,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
const names = row.id || this.names; const names = row.id || this.names;
this.$modal.confirm('是否确认删除产品文章为"' + names + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除文章标题为"' + names + '"的数据项?').then(function () {
return delArticle(ids); return delArticle(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();

@ -41,41 +41,41 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <!-- <el-col :span="1.5">-->
<el-button <!-- <el-button-->
type="primary" <!-- type="primary"-->
plain <!-- plain-->
icon="el-icon-plus" <!-- icon="el-icon-plus"-->
size="mini" <!-- size="mini"-->
@click="handleAdd" <!-- @click="handleAdd"-->
v-hasPermi="['biz:clue:add']" <!-- v-hasPermi="['biz:clue:add']"-->
>新增 <!-- >新增-->
</el-button> <!-- </el-button>-->
</el-col> <!-- </el-col>-->
<el-col :span="1.5"> <!-- <el-col :span="1.5">-->
<el-button <!-- <el-button-->
type="success" <!-- type="success"-->
plain <!-- plain-->
icon="el-icon-edit" <!-- icon="el-icon-edit"-->
size="mini" <!-- size="mini"-->
:disabled="single" <!-- :disabled="single"-->
@click="handleUpdate" <!-- @click="handleUpdate"-->
v-hasPermi="['biz:clue:edit']" <!-- v-hasPermi="['biz:clue:edit']"-->
>修改 <!-- >修改-->
</el-button> <!-- </el-button>-->
</el-col> <!-- </el-col>-->
<el-col :span="1.5"> <!-- <el-col :span="1.5">-->
<el-button <!-- <el-button-->
type="danger" <!-- type="danger"-->
plain <!-- plain-->
icon="el-icon-delete" <!-- icon="el-icon-delete"-->
size="mini" <!-- size="mini"-->
:disabled="multiple" <!-- :disabled="multiple"-->
@click="handleDelete" <!-- @click="handleDelete"-->
v-hasPermi="['biz:clue:remove']" <!-- v-hasPermi="['biz:clue:remove']"-->
>删除 <!-- >删除-->
</el-button> <!-- </el-button>-->
</el-col> <!-- </el-col>-->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"

@ -420,6 +420,9 @@ export default {
], ],
// //
rules: { rules: {
roleIds: [
{required: true, message: "角色不能为空", trigger: "blur"}
],
userName: [ userName: [
{required: true, message: "用户名称不能为空", trigger: "blur"}, {required: true, message: "用户名称不能为空", trigger: "blur"},
{min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur'} {min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur'}

@ -120,7 +120,7 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['broker:broker:edit']" v-hasPermi="['system:broker:edit']"
>修改 >修改
</el-button> </el-button>
<el-button <el-button
@ -128,7 +128,7 @@
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['broker:broker:remove']" v-hasPermi="['system:broker:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
@ -148,7 +148,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上级代理商" prop="parentId"> <el-form-item label="上级代理商" prop="parentId">
<treeselect v-model="form.parentId" :options="brokerOptions" props="lable" :show-count="true" :defaultExpandLevel="Infinity" <treeselect v-model="form.parentId" :options="brokerList" props="lable" :show-count="true" :defaultExpandLevel="Infinity"
placeholder="选择上级代理商" :normalizer="tenantIdnormalizer" /> placeholder="选择上级代理商" :normalizer="tenantIdnormalizer" />
<!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">--> <!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">-->
<!-- <el-option--> <!-- <el-option-->

@ -65,7 +65,7 @@
@click="handleAdd" @click="handleAdd"
:disabled="!brokerId" :disabled="!brokerId"
v-hasPermi="['product:info:add']" v-hasPermi="['product:info:add']"
>添加 >选择
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -180,7 +180,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="所属代理商" prop="brokerId"> <el-form-item label="所属代理商" prop="brokerId">
<treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true" <treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true"
:defaultExpandLevel="Infinity" :defaultExpandLevel="Infinity" disabled
placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/> placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -216,7 +216,8 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="最高额度(元)" prop="maxAmount"> <el-form-item label="最高额度(元)" prop="maxAmount">
<el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(元)" style="width: 100%;" :min="0" disabled/> <el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(元)" style="width: 100%;" :min="0"
disabled/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -375,7 +376,9 @@ import {
updateInfo, updateInfo,
listInfo, listInfo,
editByBroker, editByBroker,
delInfoByBroker delInfoByBroker,
listByBroker,
getInfoByBroker,
} from "@/api/product/info"; } from "@/api/product/info";
import {listArea} from "@/api/system/area"; import {listArea} from "@/api/system/area";
import {listBrokerByTree} from "@/api/broker/broker"; import {listBrokerByTree} from "@/api/broker/broker";
@ -395,6 +398,7 @@ export default {
}, },
data() { data() {
return { return {
// isReadOnly: false,
brokerList: [], brokerList: [],
infoListAll: [], infoListAll: [],
brokerId: null, brokerId: null,
@ -500,8 +504,8 @@ export default {
// rowData row // rowData row
this.rowDataNew = newVal; this.rowDataNew = newVal;
this.brokerId = this.rowDataNew.id; this.brokerId = this.rowDataNew.id;
const allIds = this.getAllIds(this.rowDataNew); // const allIds = this.getAllIds(this.rowDataNew);
this.queryParams.brokerIds = allIds; this.queryParams.brokerIds = this.brokerId;
this.getList(); this.getList();
}, },
}, },
@ -540,12 +544,13 @@ export default {
this.getList(); this.getList();
}); });
}, },
getAllInfo() { getAllInfo(id) {
var params = { var params = {
selectByBroker: "1", selectByBroker: "1",
id: this.form.id, brokerId: this.rowData.id,
id: id
} }
listInfo(params).then(response => { listByBroker(params).then(response => {
this.infoListAll = response.data; this.infoListAll = response.data;
}); });
}, },
@ -571,7 +576,6 @@ export default {
let businessCities = this.form.businessCity.split(','); let businessCities = this.form.businessCity.split(',');
businessCities.forEach(cityId => { businessCities.forEach(cityId => {
let matchedCity = this.cityList.find(city => city.areaId == cityId); let matchedCity = this.cityList.find(city => city.areaId == cityId);
console.log(matchedCity);
if (matchedCity) { if (matchedCity) {
selectedCities.push({ selectedCities.push({
areaId: matchedCity.areaId, areaId: matchedCity.areaId,
@ -650,14 +654,12 @@ export default {
}).catch(e => { }).catch(e => {
this.loading = false; this.loading = false;
}); });
} },
,
// //
cancel() { cancel() {
this.open = false; this.open = false;
this.reset(); this.reset();
} },
,
// //
reset() { reset() {
this.form = { this.form = {
@ -679,20 +681,17 @@ export default {
maxAmountEnd: null, maxAmountEnd: null,
}; };
this.resetForm("form"); this.resetForm("form");
} },
,
// //
handleSortChange(col) { handleSortChange(col) {
this.$sortBy(col, this.queryParams); this.$sortBy(col, this.queryParams);
this.getList(); this.getList();
} },
,
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
} },
,
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = [];
@ -701,16 +700,14 @@ export default {
this.queryParams.maxAmountEnd = undefined; this.queryParams.maxAmountEnd = undefined;
this.queryParams.interestRateEnd = undefined; this.queryParams.interestRateEnd = undefined;
this.handleQuery(); this.handleQuery();
} },
,
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id); 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.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
} },
,
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
@ -718,22 +715,33 @@ export default {
this.getbrokerList(); this.getbrokerList();
this.form.brokerId = this.brokerId; this.form.brokerId = this.brokerId;
this.open = true; this.open = true;
// this.isReadOnly = false;
this.title = "添加产品信息"; this.title = "添加产品信息";
} },
,
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.getbrokerList(); this.getbrokerList();
const id = row.id || this.ids; 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.form = response.data;
this.getAllInfo("edit"); this.getAllInfo(id);
this.open = true; this.open = true;
this.title = "修改产品信息"; 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() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
@ -749,21 +757,24 @@ export default {
}); });
} }
}); });
} },
,
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { 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; const names = row.id || this.names;
var param = {
ids: ids,
brokerId: this.brokerId
};
this.$modal.confirm('是否确认移除产品信息为"' + names + '"的数据项?').then(function () { this.$modal.confirm('是否确认移除产品信息为"' + names + '"的数据项?').then(function () {
return delInfoByBroker(ids); return delInfoByBroker(param);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { }).catch(() => {
}); });
} },
,
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('product/info/export', { this.download('product/info/export', {

@ -120,7 +120,7 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['broker:broker:edit']" v-hasPermi="['system:broker:edit']"
>修改 >修改
</el-button> </el-button>
<el-button <el-button
@ -128,7 +128,7 @@
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['broker:broker:remove']" v-hasPermi="['system:broker:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
@ -148,7 +148,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上级代理商" prop="parentId"> <el-form-item label="上级代理商" prop="parentId">
<treeselect v-model="form.parentId" :options="brokerOptions" props="lable" :show-count="true" :defaultExpandLevel="Infinity" <treeselect v-model="form.parentId" :options="brokerList" props="lable" :show-count="true" :defaultExpandLevel="Infinity"
placeholder="选择上级代理商" :normalizer="tenantIdnormalizer" /> placeholder="选择上级代理商" :normalizer="tenantIdnormalizer" />
<!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">--> <!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">-->
<!-- <el-option--> <!-- <el-option-->

@ -25,7 +25,7 @@ export default {
}, },
methods: { methods: {
handleRowClick(row) { handleRowClick(row) {
this.rowData = row;// row this.rowData = row;
} }
} }
}; };

@ -120,7 +120,7 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['broker:broker:edit']" v-hasPermi="['system:broker:edit']"
>修改 >修改
</el-button> </el-button>
<el-button <el-button
@ -128,7 +128,7 @@
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['broker:broker:remove']" v-hasPermi="['system:broker:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
@ -148,7 +148,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上级代理商" prop="parentId"> <el-form-item label="上级代理商" prop="parentId">
<treeselect v-model="form.parentId" :options="brokerOptions" props="lable" :show-count="true" :defaultExpandLevel="Infinity" <treeselect v-model="form.parentId" :options="brokerList" props="lable" :show-count="true" :defaultExpandLevel="Infinity"
placeholder="选择上级代理商" :normalizer="tenantIdnormalizer" /> placeholder="选择上级代理商" :normalizer="tenantIdnormalizer" />
<!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">--> <!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">-->
<!-- <el-option--> <!-- <el-option-->

@ -355,7 +355,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id); 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.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
@ -416,7 +416,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
const names = row.id || this.names; const names = row.id || this.names;
this.$modal.confirm('是否确认删除产品朋友圈为"' + names + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除朋友圈标题为"' + names + '"的数据项?').then(function () {
return delMoment(ids); return delMoment(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();

@ -401,6 +401,9 @@ export default {
], ],
// //
rules: { rules: {
// roleIds: [
// {required: true, message: "", trigger: "blur"}
// ],
userName: [ userName: [
{required: true, message: "用户名称不能为空", trigger: "blur"}, {required: true, message: "用户名称不能为空", trigger: "blur"},
{min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur'} {min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur'}

@ -405,7 +405,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id); 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.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },

@ -293,7 +293,6 @@
<el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(元)" style="width: 100%;" :min="0"/> <el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(元)" style="width: 100%;" :min="0"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="还款周期" prop="repaymentCycle"> <el-form-item label="还款周期" prop="repaymentCycle">
<el-input v-model="form.repaymentCycle" placeholder="请输入还款周期"/> <el-input v-model="form.repaymentCycle" placeholder="请输入还款周期"/>
@ -406,7 +405,6 @@
</el-tree> </el-tree>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<h3 class="section-title">已选择城市</h3> <h3 class="section-title">已选择城市</h3>
<ul class="selected-city-list"> <ul class="selected-city-list">
@ -427,7 +425,7 @@
</div> </div>
</template> </template>
<script> <script>
import {pageListInfo, getInfo, delInfo, addInfo, updateInfo,changeStatus} from "@/api/product/info"; import {pageListInfo, getInfo, delInfo, addInfo, updateInfo, changeStatus, getBrokerNum} from "@/api/product/info";
import {listArea} from "@/api/system/area"; import {listArea} from "@/api/system/area";
// import Treeselect from "@riophae/vue-treeselect"; // import Treeselect from "@riophae/vue-treeselect";
@ -554,10 +552,31 @@ export default {
ids: ids, ids: ids,
status: "1" status: "1"
} }
getBrokerNum(ids).then(response => {
if(response.data > 0){
this.$modal.confirm('代理产品权限是否也随之上架?').then(function () {
let paramVo = {
ids: ids,
status: "1",
isBroker: "1"
}
return changeStatus(paramVo);
}).then(() => {
this.getList();
this.$modal.msgSuccess("修改成功");
}).catch(() => {
changeStatus(param).then(response => {
this.getList();
this.$modal.msgSuccess("修改成功");
});
});
}else{
changeStatus(param).then(response => { changeStatus(param).then(response => {
this.getList(); this.getList();
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
}); });
}
});
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
@ -701,7 +720,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id); 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.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
} }
@ -743,21 +762,19 @@ export default {
} }
} }
}); });
} },
,
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
const names = row.id || this.names; const names = row.id || this.names;
this.$modal.confirm('是否确认删除产品信息为"' + names + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除产品名称为"' + names + '"的数据项?').then(function () {
return delInfo(ids); return delInfo(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { }).catch(() => {
}); });
} },
,
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('product/info/export', { this.download('product/info/export', {
@ -765,8 +782,7 @@ export default {
}, `产品信息数据_${new Date().getTime()}.xlsx`) }, `产品信息数据_${new Date().getTime()}.xlsx`)
} }
} }
} };
;
</script> </script>
<style scoped> <style scoped>
.add-button { .add-button {

@ -16,7 +16,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="二维码" prop="field"> <el-form-item label="二维码" prop="field">
<BannerUpload v-show="user.userId" :bannerId="user.userId" :maxLength="1"> <BannerUpload v-show="user.userId" :bannerId="'userId' + user.userId" :maxLength="1">
</BannerUpload> </BannerUpload>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>

Loading…
Cancel
Save