修改代理商产品

master
username 10 months ago
parent 7297c23585
commit 0a530dd5d5

@ -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<DfBroker> queryWrapper = new LambdaQueryWrapper();
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> longs = dfBrokerService.filterByUser();
queryWrapper.in(DfBroker::getId, longs);
}
queryWrapper.orderByAsc(DfBroker::getOrderNum);
condition(queryWrapper,dfBroker);
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);
List<DfBroker> list = dfBrokerService.list(queryWrapper);
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);
}
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)
@DeleteMapping("/{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));
}

@ -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<DfProductInfo> 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<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);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
@ -98,32 +110,19 @@ public class DfProductInfoController extends BaseController {
cityMap.put(city.getAreaId(), city.getName());
}
Map<Long, String> brokerProductMap = new HashMap<>();
DfBroker byId = null;
if ("1".equals(dfProductInfo.getSelectByBroker())) {
List<DfBroker> listBroker = dfBrokerService.list();
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());
}
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<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);
}
/**
*
*/
@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}")
public AjaxResult remove(@PathVariable List<Long> 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){
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<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));
}
/**
*
*/
@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) {
Long productInfoId = dfProductInfo.getId();
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) {
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<Long> ids) {
return toAjax(dfBrokerProductService.remove(new LambdaQueryWrapper<DfBrokerProduct>().in(DfBrokerProduct::getProductId, ids)));
@PutMapping("/removeByBroker")
public AjaxResult removeByBroker(@RequestBody DfProductInfo dfProductInfo) {
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)
@DeleteMapping("/{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));
}

@ -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<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId();
if (productIdsByBrokerId.size() == 0) {
productIdsByBrokerId.add(0L);
}
queryWrapper.in(DfProductPoster::getProductId, productIdsByBrokerId);
}
conditionByMPJ(queryWrapper,dfProductPoster);
List<DfProductPoster> list = dfProductPosterService.list(queryWrapper);
List<CmAttach> attachVo = cmAttachService.list();
@ -168,6 +179,12 @@ public class DfProductPosterController extends BaseController {
@Log(title = "产品海报删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{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));
}

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

@ -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;

@ -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;
}

@ -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<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;
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<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")
public TableDataInfo list(SysUser user) {
startPage();
@ -93,6 +93,11 @@ public class SysUserController extends BaseController {
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
if (user.getDeptIds()!=null) {
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);
List<SysUser> 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<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}"})
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) {

@ -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({

@ -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();

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

@ -420,6 +420,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'}

@ -120,7 +120,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['broker:broker:edit']"
v-hasPermi="['system:broker:edit']"
>修改
</el-button>
<el-button
@ -128,7 +128,7 @@
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['broker:broker:remove']"
v-hasPermi="['system:broker:remove']"
>删除
</el-button>
</template>
@ -148,7 +148,7 @@
<el-row>
<el-col :span="12">
<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" />
<!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">-->
<!-- <el-option-->

@ -65,7 +65,7 @@
@click="handleAdd"
:disabled="!brokerId"
v-hasPermi="['product:info:add']"
>添加
>选择
</el-button>
</el-col>
<el-col :span="1.5">
@ -108,7 +108,7 @@
<el-table v-loading="loading" :data="infoList" @sort-change="handleSortChange" :height="tableHeight - 150"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="所属代理商" align="center" prop="brokerName" fixed="left" width="100"/>
<el-table-column label="所属代理商" align="center" prop="brokerName" fixed="left" width="100"/>
<el-table-column label="产品名称" align="center" prop="productName" sortable='custom' fixed="left" width="100"/>
<el-table-column label="产品简称" align="center" prop="simpleName" sortable='custom' width="100"/>
<el-table-column label="产品类型" align="center" prop="productType" sortable='custom' width="100">
@ -180,7 +180,7 @@
<el-col :span="8">
<el-form-item label="所属代理商" prop="brokerId">
<treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true"
:defaultExpandLevel="Infinity"
:defaultExpandLevel="Infinity" disabled
placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/>
</el-form-item>
</el-col>
@ -210,13 +210,14 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品细类" prop="productSubtype" >
<el-form-item label="产品细类" prop="productSubtype">
<el-input v-model="form.productSubtype" placeholder="请输入产品细类" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<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-col>
</el-row>
@ -277,7 +278,7 @@
<el-col :span="12">
<el-form-item label="展业城市" prop="businessCityByName">
<el-input v-model="form.businessCityByName" placeholder="选择展业城市" style="width: 100%;" readonly>
<el-button slot="append" icon="el-icon-arrow-down" @click="openModal" ></el-button>
<el-button slot="append" icon="el-icon-arrow-down" @click="openModal"></el-button>
</el-input>
</el-form-item>
</el-col>
@ -337,7 +338,7 @@
<template v-slot="{ node, data }">
<div class="city-item">
<span>{{ node.label }}</span>
<!-- <el-button @click="selectCity(data)" type="text" size="mini" class="add-button">添加</el-button>-->
<!-- <el-button @click="selectCity(data)" type="text" size="mini" class="add-button">添加</el-button>-->
</div>
</template>
@ -351,7 +352,7 @@
<li v-for="(city, index) in selectedCities" :key="index">
<div class="selected-city-item">
{{ city.name }}
<!-- <el-button @click="removeCity(index)" type="text" size="mini">移除</el-button>-->
<!-- <el-button @click="removeCity(index)" type="text" size="mini">移除</el-button>-->
</div>
</li>
</ul>
@ -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', {

@ -120,7 +120,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['broker:broker:edit']"
v-hasPermi="['system:broker:edit']"
>修改
</el-button>
<el-button
@ -128,7 +128,7 @@
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['broker:broker:remove']"
v-hasPermi="['system:broker:remove']"
>删除
</el-button>
</template>
@ -148,7 +148,7 @@
<el-row>
<el-col :span="12">
<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" />
<!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">-->
<!-- <el-option-->

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

@ -120,7 +120,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['broker:broker:edit']"
v-hasPermi="['system:broker:edit']"
>修改
</el-button>
<el-button
@ -128,7 +128,7 @@
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['broker:broker:remove']"
v-hasPermi="['system:broker:remove']"
>删除
</el-button>
</template>
@ -148,7 +148,7 @@
<el-row>
<el-col :span="12">
<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" />
<!-- <el-select v-model="form.parentId" placeholder="选择上级代理商" style="width: 100%">-->
<!-- <el-option-->

@ -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();

@ -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'}

@ -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;
},

@ -293,7 +293,6 @@
<el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(元)" style="width: 100%;" :min="0"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="还款周期" prop="repaymentCycle">
<el-input v-model="form.repaymentCycle" placeholder="请输入还款周期"/>
@ -406,7 +405,6 @@
</el-tree>
</div>
</el-col>
<el-col :span="12">
<h3 class="section-title">已选择城市</h3>
<ul class="selected-city-list">
@ -427,7 +425,7 @@
</div>
</template>
<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 Treeselect from "@riophae/vue-treeselect";
@ -554,9 +552,30 @@ export default {
ids: ids,
status: "1"
}
changeStatus(param).then(response => {
this.getList();
this.$modal.msgSuccess("修改成功");
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 => {
this.getList();
this.$modal.msgSuccess("修改成功");
});
}
});
},
filterNode(value, data) {
@ -701,7 +720,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.productName);
this.single = selection.length !== 1;
this.multiple = !selection.length;
}
@ -743,21 +762,19 @@ 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 delInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
}
,
},
/** 导出按钮操作 */
handleExport() {
this.download('product/info/export', {
@ -765,8 +782,7 @@ export default {
}, `产品信息数据_${new Date().getTime()}.xlsx`)
}
}
}
;
};
</script>
<style scoped>
.add-button {

@ -16,7 +16,7 @@
</el-radio-group>
</el-form-item>
<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>
</el-form-item>
<el-form-item>

Loading…
Cancel
Save