master
username 3 months ago
parent fcf94a7119
commit 744005e539

@ -0,0 +1,436 @@
package com.bs.df.controller;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject;
import com.bs.common.annotation.Anonymous;
import com.bs.common.constant.Constants;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.utils.SecurityUtils;
import com.bs.common.utils.ServletUtils;
import com.bs.df.domain.DfOrder;
import com.bs.df.domain.DfUserBroker;
import com.bs.df.mapper.DfBizClueMapper;
import com.bs.df.service.IDfUserBrokerService;
import com.bs.system.mapper.SysUserMapper;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfBizClue;
import com.bs.df.service.IDfBizClueService;
import javax.annotation.Resource;
/**
* 线Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "业务线索")
@RestController
@RequestMapping("/biz/clue")
public class DfBizClueController extends BaseController {
@Resource
private IDfBizClueService dfBizClueService;
@Resource
private DfBizClueMapper dfBizClueMapper;
@Resource
private ISysUserService userService;
@Resource
private SysUserMapper sysUserMapper;
@Resource
private IDfUserBrokerService dfUserBrokerService;
/**
* 线
*/
@ApiOperation("分页查询业务线索列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfBizClue dfBizClue) {
startPage();
LambdaQueryWrapper<DfBizClue> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBizClue);
queryWrapper.orderByDesc(DfBizClue::getBrowseTime);
boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
if (!admin) {
SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
if (!sysUser.getDeptId().equals(-1L)) {
SysUser byId = userService.getById(SecurityUtils.getUserId());
if ("jj".equals(byId.getUserType())) {
queryWrapper.eq(DfBizClue::getUserId,SecurityUtils.getUserId());
}
}
}
List<DfBizClue> list = dfBizClueService.list(queryWrapper);
for (DfBizClue clue : list) {
if (Validator.isNotEmpty(clue.getUserName())) {
clue.setNickName(clue.getUserName());
}
}
return getDataTable(list);
}
/**
* 线
*/
@ApiOperation("分页查询业务线索数量列表")
@GetMapping("/getVisitsNum")
public TableDataInfo getVisitsNum(DfBizClue dfBizClue) {
// startPage();
//condition(queryWrapper,dfBizClue);
Integer pageNum = ServletUtils.getParameterToInt(Constants.PAGE_NUM);
Integer pageSize = ServletUtils.getParameterToInt(Constants.PAGE_SIZE);
LambdaQueryWrapper<DfBizClue> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(DfBizClue::getDataType,dfBizClue.getDataType());
//传入hasOrder参数为1时查询出存在orderId的数据
SysUser sysUser = sysUserMapper.selectById(getUserId());
if (!sysUser.getDeptId().equals(-1L)) {
if (Validator.isNotEmpty(dfBizClue.getHasOrder())) {
queryWrapper.isNotNull(DfBizClue::getOrderId);
if (Validator.isNotEmpty(dfBizClue.getBrokerId())) {
queryWrapper.eq(DfBizClue::getShareUser,dfBizClue.getBrokerId());
} else {
queryWrapper.eq(DfBizClue::getShareUser,SecurityUtils.getUserId());
}
} else {
queryWrapper.eq(DfBizClue::getShareUser,SecurityUtils.getUserId());
}
}
queryWrapper.orderByDesc(DfBizClue::getBrowseTime);
List<DfBizClue> list = dfBizClueService.list(queryWrapper);
Map<String, Integer> visitsNum = new HashMap<>();
for (DfBizClue clue : list) {
String key = clue.getUnionId() + "_" + clue.getDataType();
int count = visitsNum.getOrDefault(key, 0) + 1;
visitsNum.put(key, count);
clue.setVisitsNum(count);
}
Map<String, DfBizClue> latestClues = new HashMap<>();
for (DfBizClue clue : list) {
String key = clue.getUnionId() + "_" + clue.getDataType();
if (!latestClues.containsKey(key) || clue.getBrowseTime().after(latestClues.get(key).getBrowseTime())) {
latestClues.put(key, clue);
}
}
List<DfBizClue> newList = new ArrayList<>(latestClues.values());
for (DfBizClue clue : newList) {
String key = clue.getUnionId() + "_" + clue.getDataType();
int visits = visitsNum.getOrDefault(key, 0);
clue.setVisitsNum(visits);
if (Validator.isNotEmpty(clue.getUserName())) {
clue.setNickName(clue.getUserName());
}
}
List<DfBizClue> sortedList = newList.stream()
.sorted((o1, o2) -> o2.getBrowseTime().compareTo(o1.getBrowseTime())) // 倒序
.collect(Collectors.toList());
Integer start = (pageNum - 1) * pageSize;
List<DfBizClue> result = sortedList.stream()
.skip(start)
.limit(pageSize)
.collect(Collectors.toList());
TableDataInfo data = getDataTable(result);
data.setTotal(sortedList.size());
return data;
// return getDataTable(newList);
}
/**
* 线
*/
@ApiOperation("查询业务线索列表")
@GetMapping("/list")
public AjaxResult list(DfBizClue dfBizClue) {
LambdaQueryWrapper<DfBizClue> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBizClue);
List<DfBizClue> list = dfBizClueService.list(queryWrapper);
for (DfBizClue clue : list) {
if (Validator.isNotEmpty(clue.getUserName())) {
clue.setNickName(clue.getUserName());
}
}
return success(list);
}
/**
* 线
*/
@ApiOperation("查询业务线索列表")
@GetMapping("/listByClassify")
@Anonymous
public AjaxResult listByClassify(DfBizClue dfBizClue) {
LambdaQueryWrapper<DfBizClue> queryWrapper = new LambdaQueryWrapper();
if ("0".equals(dfBizClue.getClassify())) {
queryWrapper.in(DfBizClue::getDataType, "0", "3");
} else if ("1".equals(dfBizClue.getClassify())) {
queryWrapper.in(DfBizClue::getDataType, "2", "4");
} else if ("2".equals(dfBizClue.getClassify())) {
queryWrapper.in(DfBizClue::getDataType, "1");
}
if (Validator.isNotEmpty(dfBizClue.getBusinessLinks())) {
queryWrapper.eq(DfBizClue::getBusinessLinks, dfBizClue.getBusinessLinks());
}
List<DfBizClue> list = dfBizClueService.list(queryWrapper);
for (DfBizClue clue : list) {
if (Validator.isNotEmpty(clue.getUserName())) {
clue.setNickName(clue.getUserName());
}
}
List<DfBizClue> uniqueList = list.stream()
.collect(Collectors.toMap(
DfBizClue::getUserId, // 指定键的抽取函数
dfBizClueVo -> dfBizClueVo, // 指定值的映射函数
(existing, replacement) -> existing // 处理重复键的方式,这里选择保留第一个出现的元素
))
.values()
.stream()
.collect(Collectors.toList());
List<String> avatarLinks = uniqueList.stream()
.map(DfBizClue::getAvatarLink) // 获取每个对象的 avatarLink
.limit(5) // 限制最多只取前 5 个
.collect(Collectors.toList());
DfBizClue dfBizClueByNum = new DfBizClue();
dfBizClueByNum.setAvatarLinks(avatarLinks);
dfBizClueByNum.setUserNum(uniqueList.size());
return success(dfBizClueByNum);
}
/**
* 线
*/
@ApiOperation("导出业务线索列表")
@Log(title = "业务线索导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfBizClue dfBizClue) {
LambdaQueryWrapper<DfBizClue> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBizClue);
List<DfBizClue> list = dfBizClueService.list(queryWrapper);
for (DfBizClue clue : list) {
if (Validator.isNotEmpty(clue.getUserName())) {
clue.setNickName(clue.getUserName());
}
}
ExcelUtil<DfBizClue> util = new ExcelUtil<DfBizClue>(DfBizClue. class);
util.exportExcel(response, list, "业务线索数据");
}
/**
* 线
*/
@ApiOperation("获取业务线索详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
DfBizClue byId = dfBizClueService.getById(id);
List<SysUser> list = userService.list(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, byId.getShareUser()));
if (!list.isEmpty()) {
String realName = list.get(0).getRealName();
if (Validator.isEmpty(realName)) {
if (Validator.isNotEmpty(list.get(0).getUserName())) {
list.get(0).setNickName(list.get(0).getUserName());
}
String nickName = list.get(0).getNickName();
if (Validator.isEmpty(nickName)) {
String userName = list.get(0).getUserName();
byId.setRealName(userName);
} else {
byId.setRealName(nickName);
}
} else {
byId.setRealName(realName);
}
}
return success(byId);
}
/**
* 线
*/
@ApiOperation("新增业务线索")
@Log(title = "业务线索新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfBizClue dfBizClue) {
return toAjax(dfBizClueService.save(dfBizClue));
}
/**
* 线
*
*/
@ApiOperation("新增业务线索")
@Log(title = "业务线索新增", businessType = BusinessType.INSERT)
@PostMapping("/addVisitor")
@Anonymous
public AjaxResult addVisitor(DfBizClue dfBizClue) {
Date date = new Date();
dfBizClue.setCreateTimeVo(date);
dfBizClue.setTenantId(0L);
// dfBizClue.setTenantId(SecurityUtils.getTenantId());
return toAjax(dfBizClueMapper.insertClue(dfBizClue));
}
/**
* 线
*/
@ApiOperation("修改业务线索")
@Log(title = "业务线索修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfBizClue dfBizClue) {
return toAjax(dfBizClueService.updateById(dfBizClue));
}
/**
* ID
*/
@ApiOperation("经纪人ID")
@PostMapping("/changeUserId")
public AjaxResult changeUserId(@RequestBody DfBizClue dfBizClue) {
List<DfBizClue> list = dfBizClueService.list(new LambdaQueryWrapper<DfBizClue>()
.eq(DfBizClue::getShareUser, dfBizClue.getOldUserId()));
if (list.size() > 0) {
for (DfBizClue dfBizClueNew : list) {
dfBizClueNew.setShareUser(dfBizClue.getNewUserId());
}
dfBizClueService.updateBatchById(list);
}
List<DfUserBroker> userBrokerList = dfUserBrokerService.list(new LambdaQueryWrapper<DfUserBroker>()
.eq(DfUserBroker::getBrokerId, dfBizClue.getOldUserId()));
if (userBrokerList.size() > 0) {
for (DfUserBroker dfUserBroker : userBrokerList) {
dfUserBroker.setBrokerId(Long.valueOf(dfBizClue.getNewUserId()));
}
dfUserBrokerService.updateBatchById(userBrokerList);
}
return toAjax(true);
}
/**
* 线
*/
@ApiOperation("删除业务线索")
@Log(title = "业务线索删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(dfBizClueService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfBizClue> queryWrapper,DfBizClue dfBizClue){
//id
if(Validator.isNotEmpty(dfBizClue.getId())){
queryWrapper.eq(DfBizClue::getId,dfBizClue.getId());
}
//数据类型0客户1经纪
if(Validator.isNotEmpty(dfBizClue.getDataType())){
queryWrapper.eq(DfBizClue::getDataType,dfBizClue.getDataType());
}
//线索类型
if(Validator.isNotEmpty(dfBizClue.getClueType())){
queryWrapper.eq(DfBizClue::getClueType,dfBizClue.getClueType());
}
//用户id
if(Validator.isNotEmpty(dfBizClue.getUserId())){
queryWrapper.eq(DfBizClue::getUserId,dfBizClue.getUserId());
}
//用户昵称
if(Validator.isNotEmpty(dfBizClue.getNickName())){
queryWrapper.like(DfBizClue::getNickName,dfBizClue.getNickName());
}
//头像链接
if(Validator.isNotEmpty(dfBizClue.getAvatarLink())){
queryWrapper.eq(DfBizClue::getAvatarLink,dfBizClue.getAvatarLink());
}
//手机号
if(Validator.isNotEmpty(dfBizClue.getPhone())){
queryWrapper.eq(DfBizClue::getPhone,dfBizClue.getPhone());
}
//浏览时间
if(Validator.isNotEmpty(dfBizClue.getBrowseTime())){
queryWrapper.eq(DfBizClue::getBrowseTime,dfBizClue.getBrowseTime());
}
if(Validator.isNotEmpty(dfBizClue.getParams().get("beginTime"))){
queryWrapper.ge(DfBizClue::getBrowseTime,dfBizClue.getParams().get("beginTime"));
}
if(Validator.isNotEmpty(dfBizClue.getParams().get("endTime"))){
queryWrapper.le(DfBizClue::getBrowseTime,dfBizClue.getParams().get("endTime"));
}
//创建部门
if(Validator.isNotEmpty(dfBizClue.getCreateDept())){
queryWrapper.eq(DfBizClue::getCreateDept,dfBizClue.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfBizClue.getCreateBy())){
queryWrapper.eq(DfBizClue::getCreateBy,dfBizClue.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfBizClue.getCreateTime())){
queryWrapper.eq(DfBizClue::getCreateTime,dfBizClue.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfBizClue.getUpdateBy())){
queryWrapper.eq(DfBizClue::getUpdateBy,dfBizClue.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfBizClue.getUpdateTime())){
queryWrapper.eq(DfBizClue::getUpdateTime,dfBizClue.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfBizClue.getDelFlag())){
queryWrapper.eq(DfBizClue::getDelFlag,dfBizClue.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfBizClue.getTenantId())){
queryWrapper.eq(DfBizClue::getTenantId,dfBizClue.getTenantId());
}
//${column.columnComment}
if(Validator.isNotEmpty(dfBizClue.getBusinessLinks())){
queryWrapper.eq(DfBizClue::getBusinessLinks,dfBizClue.getBusinessLinks());
}
}
}

@ -0,0 +1,359 @@
package com.bs.df.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.mapper.DfBrokerMapper;
import com.bs.df.utils.HtmlUtils;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfBroker;
import com.bs.df.service.IDfBrokerService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "代理商经纪")
@RestController
@RequestMapping("/broker/broker")
public class DfBrokerController extends BaseController {
@Resource
private IDfBrokerService dfBrokerService;
@Resource
private ISysUserService sysUserService;
@Resource
private DfBrokerMapper dfBrokerMapper;
/**
*
*/
@ApiOperation("分页查询代理商经纪列表")
@GetMapping("/pageList")
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);
for (DfBroker broker : list) {
broker.setBrokerDesc(HtmlUtils.stripHtmlTags(broker.getBrokerDesc()));
}
// List<DfBroker> treeList = buildTree(list);
return getDataTable(list);
}
public List<DfBroker> buildTree(List<DfBroker> list) {
List<DfBroker> treeList = new ArrayList<>();
Map<Long, DfBroker> brokerMap = new HashMap<>();
// 遍历列表,将每个节点添加到 Map 中
for (DfBroker broker : list) {
brokerMap.put(broker.getId(), broker);
}
// 构建树形结构
for (DfBroker broker : list) {
if (broker.getParentId() == null) {
treeList.add(findChildren(broker, brokerMap));
}
}
return treeList;
}
private DfBroker findChildren(DfBroker parent, Map<Long, DfBroker> brokerMap) {
for (DfBroker broker : brokerMap.values()) {
if (parent.getId().equals(broker.getParentId())) {
if (parent.getChildren() == null) {
parent.setChildren(new ArrayList<>());
}
parent.getChildren().add(findChildren(broker, brokerMap));
}
}
return parent;
}
/**
*
*/
@ApiOperation("查询代理商经纪列表")
@GetMapping("/list")
public AjaxResult list(DfBroker dfBroker) {
LambdaQueryWrapper<DfBroker> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBroker);
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> longs = dfBrokerService.filterByUser();
queryWrapper.in(DfBroker::getId, longs);
}
List<DfBroker> list = dfBrokerService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("查询代理商经纪列表")
@GetMapping("/listByTree")
public AjaxResult listByTree(DfBroker dfBroker) {
LambdaQueryWrapper<DfBroker> queryWrapper = new LambdaQueryWrapper();
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;
}
/**
*
*/
@ApiOperation("导出代理商经纪列表")
@Log(title = "代理商经纪导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfBroker dfBroker) {
LambdaQueryWrapper<DfBroker> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBroker);
List<DfBroker> list = dfBrokerService.list(queryWrapper);
List<DfBroker> listAll = dfBrokerService.list();
Map<Long, DfBroker> brokerMap = new HashMap<>();
for (DfBroker broker : listAll) {
brokerMap.put(broker.getId(), broker);
}
for (DfBroker broker : list) {
broker.setBrokerDesc(HtmlUtils.stripHtmlTags(broker.getBrokerDesc()));
DfBroker parentBroker = brokerMap.get(broker.getParentId());
if (parentBroker != null) {
broker.setParentName(parentBroker.getBrokerName());
}
}
ExcelUtil<DfBroker> util = new ExcelUtil<DfBroker>(DfBroker. class);
util.exportExcel(response, list, "代理商经纪数据");
}
/**
*
*/
@Log(title = "代理商经纪状态修改", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody DfBroker dfBroker) {
dfBrokerService.updateById(dfBroker);
return toAjax(true);
}
/**
*
*/
@ApiOperation("获取代理商经纪详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(dfBrokerService.getById(id));
}
/**
*
*/
@ApiOperation("新增代理商经纪")
@Log(title = "代理商经纪新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfBroker dfBroker) {
return toAjax(dfBrokerService.save(dfBroker));
}
/**
*
*/
@ApiOperation("修改代理商经纪")
@Log(title = "代理商经纪修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfBroker dfBroker) {
if (null == dfBroker.getParentId()) {
dfBrokerMapper.updateByNull(dfBroker);
}
return toAjax(dfBrokerService.updateById(dfBroker));
}
/**
*
*/
@ApiOperation("删除代理商经纪")
@Log(title = "代理商经纪删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
LambdaQueryWrapper<DfBroker> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(DfBroker::getParentId,ids);
if(dfBrokerService.list(queryWrapper).size()>0){
return AjaxResult.warn("请先删除子节点");
}
LambdaQueryWrapper<SysUser> queryWrapperByUser = new LambdaQueryWrapper();
queryWrapperByUser.in(SysUser::getDeptId,ids);
queryWrapperByUser.eq(SysUser::getDelFlag,0);
queryWrapperByUser.eq(SysUser::getUserType,"jj");
if(sysUserService.list(queryWrapperByUser).size()>0){
return AjaxResult.warn("请先删除用户");
}
return toAjax(dfBrokerService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfBroker> queryWrapper,DfBroker dfBroker){
//id
if(Validator.isNotEmpty(dfBroker.getId())){
queryWrapper.eq(DfBroker::getId,dfBroker.getId());
}
//父级id
if(Validator.isNotEmpty(dfBroker.getParentId())){
queryWrapper.eq(DfBroker::getParentId,dfBroker.getParentId());
}
//代理商名称
if(Validator.isNotEmpty(dfBroker.getBrokerName())){
queryWrapper.like(DfBroker::getBrokerName,dfBroker.getBrokerName());
}
//地址
if(Validator.isNotEmpty(dfBroker.getBrokerAddress())){
queryWrapper.eq(DfBroker::getBrokerAddress,dfBroker.getBrokerAddress());
}
//简介
if(Validator.isNotEmpty(dfBroker.getBrokerDesc())){
queryWrapper.eq(DfBroker::getBrokerDesc,dfBroker.getBrokerDesc());
}
//显示顺序
if(Validator.isNotEmpty(dfBroker.getOrderNum())){
queryWrapper.eq(DfBroker::getOrderNum,dfBroker.getOrderNum());
}
//负责人
if(Validator.isNotEmpty(dfBroker.getChargePerson())){
queryWrapper.like(DfBroker::getChargePerson,dfBroker.getChargePerson());
}
//联系电话
if(Validator.isNotEmpty(dfBroker.getContactPhone())){
queryWrapper.like(DfBroker::getContactPhone,dfBroker.getContactPhone());
}
//邮箱
if(Validator.isNotEmpty(dfBroker.getEmail())){
queryWrapper.eq(DfBroker::getEmail,dfBroker.getEmail());
}
//是否机构
if(Validator.isNotEmpty(dfBroker.getIsInstitution())){
queryWrapper.eq(DfBroker::getIsInstitution,dfBroker.getIsInstitution());
}
//状态
if(Validator.isNotEmpty(dfBroker.getStaus())){
queryWrapper.eq(DfBroker::getStaus,dfBroker.getStaus());
}
//备注
if(Validator.isNotEmpty(dfBroker.getRemark())){
queryWrapper.eq(DfBroker::getRemark,dfBroker.getRemark());
}
//创建部门
if(Validator.isNotEmpty(dfBroker.getCreateDept())){
queryWrapper.eq(DfBroker::getCreateDept,dfBroker.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfBroker.getCreateBy())){
queryWrapper.eq(DfBroker::getCreateBy,dfBroker.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfBroker.getCreateTime())){
queryWrapper.eq(DfBroker::getCreateTime,dfBroker.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfBroker.getUpdateBy())){
queryWrapper.eq(DfBroker::getUpdateBy,dfBroker.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfBroker.getUpdateTime())){
queryWrapper.eq(DfBroker::getUpdateTime,dfBroker.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfBroker.getDelFlag())){
queryWrapper.eq(DfBroker::getDelFlag,dfBroker.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfBroker.getTenantId())){
queryWrapper.eq(DfBroker::getTenantId,dfBroker.getTenantId());
}
}
}

@ -0,0 +1,184 @@
package com.bs.df.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfBrokerProduct;
import com.bs.df.service.IDfBrokerProductService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "代理产品权限")
@RestController
@RequestMapping("/broker/product")
public class DfBrokerProductController extends BaseController {
@Resource
private IDfBrokerProductService dfBrokerProductService;
/**
*
*/
@ApiOperation("分页查询代理产品权限列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfBrokerProduct dfBrokerProduct) {
startPage();
LambdaQueryWrapper<DfBrokerProduct> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBrokerProduct);
List<DfBrokerProduct> list = dfBrokerProductService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询代理产品权限列表")
@GetMapping("/list")
public AjaxResult list(DfBrokerProduct dfBrokerProduct) {
LambdaQueryWrapper<DfBrokerProduct> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBrokerProduct);
List<DfBrokerProduct> list = dfBrokerProductService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出代理产品权限列表")
@Log(title = "代理产品权限导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfBrokerProduct dfBrokerProduct) {
LambdaQueryWrapper<DfBrokerProduct> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfBrokerProduct);
List<DfBrokerProduct> list = dfBrokerProductService.list(queryWrapper);
ExcelUtil<DfBrokerProduct> util = new ExcelUtil<DfBrokerProduct>(DfBrokerProduct. class);
util.exportExcel(response, list, "代理产品权限数据");
}
/**
*
*/
@ApiOperation("获取代理产品权限详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(dfBrokerProductService.getById(id));
}
/**
*
*/
@ApiOperation("新增代理产品权限")
@Log(title = "代理产品权限新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfBrokerProduct dfBrokerProduct) {
return toAjax(dfBrokerProductService.save(dfBrokerProduct));
}
/**
*
*/
@ApiOperation("修改代理产品权限")
@Log(title = "代理产品权限修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfBrokerProduct dfBrokerProduct) {
return toAjax(dfBrokerProductService.updateById(dfBrokerProduct));
}
/**
*
*/
@ApiOperation("删除代理产品权限")
@Log(title = "代理产品权限删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(dfBrokerProductService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfBrokerProduct> queryWrapper,DfBrokerProduct dfBrokerProduct){
//id
if(Validator.isNotEmpty(dfBrokerProduct.getId())){
queryWrapper.eq(DfBrokerProduct::getId,dfBrokerProduct.getId());
}
//代理id
if(Validator.isNotEmpty(dfBrokerProduct.getBrokerId())){
queryWrapper.eq(DfBrokerProduct::getBrokerId,dfBrokerProduct.getBrokerId());
}
//产品id
if(Validator.isNotEmpty(dfBrokerProduct.getProductId())){
queryWrapper.eq(DfBrokerProduct::getProductId,dfBrokerProduct.getProductId());
}
//备注
if(Validator.isNotEmpty(dfBrokerProduct.getRemark())){
queryWrapper.eq(DfBrokerProduct::getRemark,dfBrokerProduct.getRemark());
}
//创建部门
if(Validator.isNotEmpty(dfBrokerProduct.getCreateDept())){
queryWrapper.eq(DfBrokerProduct::getCreateDept,dfBrokerProduct.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfBrokerProduct.getCreateBy())){
queryWrapper.eq(DfBrokerProduct::getCreateBy,dfBrokerProduct.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfBrokerProduct.getCreateTime())){
queryWrapper.eq(DfBrokerProduct::getCreateTime,dfBrokerProduct.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfBrokerProduct.getUpdateBy())){
queryWrapper.eq(DfBrokerProduct::getUpdateBy,dfBrokerProduct.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfBrokerProduct.getUpdateTime())){
queryWrapper.eq(DfBrokerProduct::getUpdateTime,dfBrokerProduct.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfBrokerProduct.getDelFlag())){
queryWrapper.eq(DfBrokerProduct::getDelFlag,dfBrokerProduct.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfBrokerProduct.getTenantId())){
queryWrapper.eq(DfBrokerProduct::getTenantId,dfBrokerProduct.getTenantId());
}
}
}

@ -0,0 +1,577 @@
package com.bs.df.controller;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.annotation.TableField;
import com.bs.common.annotation.Anonymous;
import com.bs.common.constant.Constants;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.utils.SecurityUtils;
import com.bs.common.utils.ServletUtils;
import com.bs.df.domain.DfBizClue;
import com.bs.df.domain.DfBroker;
import com.bs.df.mapper.DfBizClueMapper;
import com.bs.df.mapper.DfOrderMapper;
import com.bs.df.service.IDfBizClueService;
import com.bs.df.service.IDfBrokerService;
import com.bs.system.mapper.SysUserMapper;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfOrder;
import com.bs.df.service.IDfOrderService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "客户订单")
@RestController
@RequestMapping("/order/order")
public class DfOrderController extends BaseController {
@Resource
private IDfOrderService dfOrderService;
@Resource
private IDfBrokerService dfBrokerService;
@Resource
private ISysUserService userService;
@Resource
private DfOrderMapper dfOrderMapper;
@Resource
private IDfBizClueService dfBizClueService;
@Resource
private DfBizClueMapper dfBizClueMapper;
@Autowired
private SysUserMapper sysUserMapper;
/**
*
*/
@ApiOperation("分页查询客户订单列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfOrder dfOrder) {
Integer pageNum = ServletUtils.getParameterToInt(Constants.PAGE_NUM);
Integer pageSize = ServletUtils.getParameterToInt(Constants.PAGE_SIZE);
SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
if (sysUser.getDeptId().equals(-1L)) {
dfOrder.setBrokerId(null);
}
LambdaQueryWrapper<DfOrder> queryWrapper = new LambdaQueryWrapper();
if (Validator.isEmpty(dfOrder.getOrderByColumn())) {
queryWrapper.orderByDesc(DfOrder::getSubmitTime);
}
if (Validator.isNotEmpty(dfOrder.getUserOrProduct())) {
queryWrapper.like(DfOrder::getUserName, dfOrder.getUserOrProduct())
.or()
.like(DfOrder::getProductName, dfOrder.getUserOrProduct());
}
condition(queryWrapper, dfOrder);
boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
if (!admin) {
if (!sysUser.getDeptId().equals(-1L)) {
SysUser byId = userService.getById(SecurityUtils.getUserId());
if ("jj".equals(byId.getUserType())) {
queryWrapper.eq(DfOrder::getBrokerId, SecurityUtils.getUserId());
}
}
}
String orderByColumn = dfOrder.getOrderByColumn();
String isAsc = dfOrder.getIsAsc();
if (StringUtils.isNotEmpty(orderByColumn) && StringUtils.isNotEmpty(isAsc)) {
applyOrderBy(queryWrapper, orderByColumn, isAsc);
}
List<DfOrder> list = dfOrderService.list(queryWrapper);
List<DfOrder> dfOrders = setOrderList(list);
if (StringUtils.isNotEmpty(dfOrder.getBrokerName())) {
dfOrders = dfOrders.stream()
.filter(info -> info.getBrokerName() != null && info.getBrokerName().contains(dfOrder.getBrokerName()))
.collect(Collectors.toList());
}
Integer start = (pageNum - 1) * pageSize;
List<DfOrder> result = dfOrders.stream()
.skip(start)
.limit(pageSize)
.collect(Collectors.toList());
TableDataInfo data = getDataTable(result);
data.setTotal(dfOrders.size());
return data;
}
public void applyOrderBy(LambdaQueryWrapper<DfOrder> queryWrapper, String orderName, String orderType) {
boolean isAsc = "ASC".equalsIgnoreCase(orderType);
switch (orderName) {
case "orderNo":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getOrderNo);
} else {
queryWrapper.orderByDesc(DfOrder::getOrderNo);
}
break;
case "userName":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getUserName);
} else {
queryWrapper.orderByDesc(DfOrder::getUserName);
}
break;
case "productName":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getProductName);
} else {
queryWrapper.orderByDesc(DfOrder::getProductName);
}
break;
case "submitTime":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getSubmitTime);
} else {
queryWrapper.orderByDesc(DfOrder::getSubmitTime);
}
break;
case "applyAmount":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getApplyAmount);
} else {
queryWrapper.orderByDesc(DfOrder::getApplyAmount);
}
break;
case "limitAmount":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getLimitAmount);
} else {
queryWrapper.orderByDesc(DfOrder::getLimitAmount);
}
break;
case "loanAmount":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getLoanAmount);
} else {
queryWrapper.orderByDesc(DfOrder::getLoanAmount);
}
break;
case "loanRate":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getLoanRate);
} else {
queryWrapper.orderByDesc(DfOrder::getLoanRate);
}
break;
case "loadMonth":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getLoadMonth);
} else {
queryWrapper.orderByDesc(DfOrder::getLoadMonth);
}
break;
case "isFirst":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getIsFirst);
} else {
queryWrapper.orderByDesc(DfOrder::getIsFirst);
}
break;
case "settleAmount":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getSettleAmount);
} else {
queryWrapper.orderByDesc(DfOrder::getSettleAmount);
}
break;
case "staus":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getStaus);
} else {
queryWrapper.orderByDesc(DfOrder::getStaus);
}
break;
case "remark":
if (isAsc) {
queryWrapper.orderByAsc(DfOrder::getRemark);
} else {
queryWrapper.orderByDesc(DfOrder::getRemark);
}
break;
default:
queryWrapper.orderByDesc(DfOrder::getSubmitTime);
break;
}
}
private List<DfOrder> setOrderList(List<DfOrder> list) {
List<SysUser> userList = userService.list();
Map<Long, String> userIdToRealNameMapVo = userList.stream()
.filter(user -> user != null && user.getUserId() != null && user.getRealName() != null)
.collect(Collectors.toMap(SysUser::getUserId, SysUser::getRealName));
Map<Long, String> userIdToPhoneMapVo = userList.stream()
.filter(user -> user != null && user.getUserId() != null && user.getPhonenumber() != null)
.collect(Collectors.toMap(SysUser::getUserId, SysUser::getPhonenumber));
Map<Long, String> userIdToNickNameMapVo = userList.stream()
.filter(user -> user != null && user.getUserId() != null && user.getNickName() != null)
.collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName));
Map<Long, String> userIdToNameMapVo = userList.stream()
.filter(user -> user != null && user.getUserId() != null && user.getUserName() != null)
.collect(Collectors.toMap(SysUser::getUserId, SysUser::getUserName));
list.forEach(order -> {
String realName = userIdToRealNameMapVo.get(order.getBrokerId());
String nickName = userIdToNickNameMapVo.get(order.getBrokerId());
String userName = userIdToNameMapVo.get(order.getBrokerId());
String phone = userIdToPhoneMapVo.get(order.getBrokerId());
if (Validator.isEmpty(realName)) {
if (Validator.isEmpty(nickName)) {
order.setBrokerName(userName);
} else {
order.setBrokerName(nickName);
}
} else {
order.setBrokerName(realName);
}
order.setBrokerPhone(phone);
});
return list;
}
/**
*
*/
@ApiOperation("查询客户订单列表")
@GetMapping("/list")
public AjaxResult list(DfOrder dfOrder) {
LambdaQueryWrapper<DfOrder> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper, dfOrder);
queryWrapper.orderByDesc(DfOrder::getCreateTime);
List<DfOrder> list = dfOrderService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出客户订单列表")
@Log(title = "客户订单导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfOrder dfOrder) {
LambdaQueryWrapper<DfOrder> queryWrapper = new LambdaQueryWrapper();
queryWrapper.orderByDesc(DfOrder::getSubmitTime);
condition(queryWrapper, dfOrder);
boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
if (!admin) {
SysUser byId = userService.getById(SecurityUtils.getUserId());
if ("jj".equals(byId.getUserType())) {
queryWrapper.eq(DfOrder::getBrokerId, SecurityUtils.getUserId());
}
}
List<DfOrder> list = dfOrderService.list(queryWrapper);
List<DfOrder> dfOrders = setOrderList(list);
dfOrders.forEach(order -> {
String isFirst = order.getIsFirst();
if (StringUtils.isNotEmpty(isFirst)) {
String isFirstDisplay = isFirst.equals("1") ? "是" : "否";
order.setIsFirst(isFirstDisplay);
}
});
if (StringUtils.isNotEmpty(dfOrder.getUserName())) {
dfOrders = dfOrders.stream()
.filter(info -> info.getUserName() != null && info.getUserName().contains(dfOrder.getUserName()))
.collect(Collectors.toList());
}
if (StringUtils.isNotEmpty(dfOrder.getBrokerName())) {
dfOrders = dfOrders.stream()
.filter(info -> info.getBrokerName() != null && info.getBrokerName().contains(dfOrder.getBrokerName()))
.collect(Collectors.toList());
}
if (StringUtils.isNotEmpty(dfOrder.getPhone())) {
dfOrders = dfOrders.stream()
.filter(info -> info.getPhone() != null && info.getPhone().contains(dfOrder.getPhone()))
.collect(Collectors.toList());
}
ExcelUtil<DfOrder> util = new ExcelUtil<DfOrder>(DfOrder.class);
util.exportExcel(response, dfOrders, "客户订单数据");
}
/**
*
*/
@ApiOperation("获取客户订单详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
DfOrder byId = dfOrderService.getById(id);
List<SysUser> list = userService.list(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, byId.getBrokerId()));
if (!list.isEmpty()) {
String realName = list.get(0).getRealName();
if (Validator.isEmpty(realName)) {
String nickName = list.get(0).getNickName();
if (Validator.isEmpty(nickName)) {
String userName = list.get(0).getUserName();
byId.setBrokerName(userName);
} else {
byId.setBrokerName(nickName);
}
} else {
byId.setBrokerName(realName);
}
String phonenumber = list.get(0).getPhonenumber();
byId.setBrokerPhone(phonenumber);
}
return success(byId);
}
/**
*
*/
@PostMapping
public AjaxResult add(@RequestBody DfOrder dfOrder) {
return toAjax(dfOrderService.save(dfOrder));
}
/**
*
*/
@ApiOperation("新增客户订单")
@PostMapping("/visitorAdd")
@Anonymous
public AjaxResult visitorAdd(@RequestBody DfOrder dfOrder) {
// SysUser sysUser = sysUserMapper.selectById(dfOrder.getShareUser());
// if (sysUser == null) {
// return AjaxResult.warn("链接有误");
// }
// List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfOrder.getShareUser()));
// Long productId = Long.valueOf(dfOrder.getProductId());
// if (!productIdsByBrokerId.contains(productId)) {
// return AjaxResult.warn("链接有误");
// }
Date date = new Date();
dfOrder.setCreateTimeVo(date);
String billNumber = dfOrderService.getBillNumber("RK");
dfOrder.setOrderNo(billNumber);
dfOrder.setTenantId(0L);
dfOrderMapper.insertOrder(dfOrder);
List<DfOrder> dfOrders = dfOrderService.list(new LambdaQueryWrapper<DfOrder>().eq(DfOrder::getOrderNo, billNumber)
.orderByDesc(DfOrder::getCreateTime));
// if (Validator.isNotEmpty(dfOrder.getShareUser())) {
// List<DfBizClue> list = dfBizClueService.list(new LambdaQueryWrapper<DfBizClue>().eq(DfBizClue::getShareUser, dfOrder.getShareUser())
// .isNull(DfBizClue::getOrderId));
// for (DfBizClue clue : list) {
// clue.setOrderId(dfOrders.get(0).getId().toString());
// clue.setPhone(dfOrder.getPhone());
// clue.setNickName(dfOrder.getUserName());
// dfBizClueMapper.updateClue(clue);
// }
// }
if (Validator.isNotEmpty(dfOrder.getUnionId())) {
List<DfBizClue> list = dfBizClueService.list(new LambdaQueryWrapper<DfBizClue>().eq(DfBizClue::getUnionId, dfOrder.getUnionId())
.isNull(DfBizClue::getOrderId));
for (DfBizClue clue : list) {
clue.setOrderId(dfOrders.get(0).getId().toString());
//clue.setNickName(dfOrder.getUserName());
if (Validator.isEmpty(clue.getUserName())) {
clue.setUserName(dfOrder.getUserName());
clue.setPhone(dfOrder.getPhone());
}
dfBizClueMapper.updateClue(clue);
}
}
// dfOrder.setTenantId(SecurityUtils.getTenantId());
// dfOrder.setCreateBy(SecurityUtils.getUserId());
// dfOrder.setCreateDept(SecurityUtils.getDeptId());
return toAjax(true);
}
/**
*
*/
@ApiOperation("修改客户订单")
@Log(title = "客户订单修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfOrder dfOrder) {
return toAjax(dfOrderService.updateById(dfOrder));
}
/**
*
*/
@ApiOperation("删除客户订单")
@Log(title = "客户订单删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(dfOrderService.removeBatchByIds(ids));
}
@ApiOperation("获取单据编号")
@GetMapping("/getBillNo/{billPrefix}")
public AjaxResult getBillNo(@PathVariable("billPrefix") String billPrefix) {
String billNumber = dfOrderService.getBillNumber(billPrefix);
return AjaxResult.success("获取成功", billNumber);
}
/**
*
*/
private void condition(LambdaQueryWrapper<DfOrder> queryWrapper, DfOrder dfOrder) {
//id
if (Validator.isNotEmpty(dfOrder.getId())) {
queryWrapper.eq(DfOrder::getId, dfOrder.getId());
}
//订单号
if (Validator.isNotEmpty(dfOrder.getOrderNo())) {
queryWrapper.like(DfOrder::getOrderNo, dfOrder.getOrderNo());
}
//客户id
if (Validator.isNotEmpty(dfOrder.getUserId())) {
queryWrapper.eq(DfOrder::getUserId, dfOrder.getUserId());
}
//经纪id
if (Validator.isNotEmpty(dfOrder.getBrokerId())) {
queryWrapper.eq(DfOrder::getBrokerId, dfOrder.getBrokerId());
}
//产品id
if (Validator.isNotEmpty(dfOrder.getProductId())) {
queryWrapper.eq(DfOrder::getProductId, dfOrder.getProductId());
}
//产品名称
if (Validator.isNotEmpty(dfOrder.getProductName())) {
queryWrapper.like(DfOrder::getProductName, dfOrder.getProductName());
}
if (Validator.isNotEmpty(dfOrder.getPhone())) {
queryWrapper.like(DfOrder::getPhone, dfOrder.getPhone());
}
if (Validator.isNotEmpty(dfOrder.getUserName())) {
queryWrapper.like(DfOrder::getUserName, dfOrder.getUserName());
}
//提交时间
if (Validator.isNotEmpty(dfOrder.getSubmitTime())) {
queryWrapper.eq(DfOrder::getSubmitTime, dfOrder.getSubmitTime());
}
if (Validator.isNotEmpty(dfOrder.getSubmitTimeBegin())) {
queryWrapper.ge(DfOrder::getSubmitTime, dfOrder.getSubmitTimeBegin());
}
if (Validator.isNotEmpty(dfOrder.getSubmitTimeEnd())) {
queryWrapper.le(DfOrder::getSubmitTime, dfOrder.getSubmitTimeEnd());
}
//申请额(万元)
if (Validator.isNotEmpty(dfOrder.getApplyAmount())) {
queryWrapper.eq(DfOrder::getApplyAmount, dfOrder.getApplyAmount());
}
//授信额(万元)
if (Validator.isNotEmpty(dfOrder.getLimitAmount())) {
queryWrapper.eq(DfOrder::getLimitAmount, dfOrder.getLimitAmount());
}
//放款额(万元)
if (Validator.isNotEmpty(dfOrder.getLoanAmount())) {
queryWrapper.eq(DfOrder::getLoanAmount, dfOrder.getLoanAmount());
}
//放款利率
if (Validator.isNotEmpty(dfOrder.getLoanRate())) {
queryWrapper.eq(DfOrder::getLoanRate, dfOrder.getLoanRate());
}
//贷款期限(月)
if (Validator.isNotEmpty(dfOrder.getLoadMonth())) {
queryWrapper.eq(DfOrder::getLoadMonth, dfOrder.getLoadMonth());
}
//是否首贷
if (Validator.isNotEmpty(dfOrder.getIsFirst())) {
queryWrapper.eq(DfOrder::getIsFirst, dfOrder.getIsFirst());
}
//可结算金额(万元)
if (Validator.isNotEmpty(dfOrder.getSettleAmount())) {
queryWrapper.eq(DfOrder::getSettleAmount, dfOrder.getSettleAmount());
}
//状态
if (Validator.isNotEmpty(dfOrder.getStaus())) {
queryWrapper.eq(DfOrder::getStaus, dfOrder.getStaus());
}
//备注
if (Validator.isNotEmpty(dfOrder.getRemark())) {
queryWrapper.eq(DfOrder::getRemark, dfOrder.getRemark());
}
//创建部门
if (Validator.isNotEmpty(dfOrder.getCreateDept())) {
queryWrapper.eq(DfOrder::getCreateDept, dfOrder.getCreateDept());
}
//创建人员
if (Validator.isNotEmpty(dfOrder.getCreateBy())) {
queryWrapper.eq(DfOrder::getCreateBy, dfOrder.getCreateBy());
}
//创建时间
if (Validator.isNotEmpty(dfOrder.getCreateTime())) {
queryWrapper.eq(DfOrder::getCreateTime, dfOrder.getCreateTime());
}
//修改人员
if (Validator.isNotEmpty(dfOrder.getUpdateBy())) {
queryWrapper.eq(DfOrder::getUpdateBy, dfOrder.getUpdateBy());
}
//修改时间
if (Validator.isNotEmpty(dfOrder.getUpdateTime())) {
queryWrapper.eq(DfOrder::getUpdateTime, dfOrder.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if (Validator.isNotEmpty(dfOrder.getDelFlag())) {
queryWrapper.eq(DfOrder::getDelFlag, dfOrder.getDelFlag());
}
//租户id
if (Validator.isNotEmpty(dfOrder.getTenantId())) {
queryWrapper.eq(DfOrder::getTenantId, dfOrder.getTenantId());
}
}
}

@ -0,0 +1,299 @@
package com.bs.df.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
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.utils.HtmlUtils;
import com.bs.system.mapper.SysUserMapper;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.service.IDfProductArticleService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "产品文章")
@RestController
@RequestMapping("/article/article")
public class DfProductArticleController extends BaseController {
@Resource
private IDfProductArticleService dfProductArticleService;
@Resource
private ICmAttachService cmAttachService;
@Resource
private ISysUserService userService;
@Autowired
private SysUserMapper sysUserMapper;
/**
*
*/
@ApiOperation("分页查询产品文章列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfProductArticle dfProductArticle) {
SysUser sysUser = sysUserMapper.selectById(getUserId());
startPage();
String reviewStatus = sysUser.getReviewStatus();
if ("1".equals(reviewStatus)) {
return null;
}
LambdaQueryWrapper<DfProductArticle> queryWrapper = new LambdaQueryWrapper();
boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
if (!admin) {
if (!sysUser.getDeptId().equals(-1L)) {
if ("-99".equals(dfProductArticle.getStatus())) {
} else {
SysUser byId = userService.getById(SecurityUtils.getUserId());
if ("jj".equals(byId.getUserType()) || "kh".equals(byId.getUserType())) {
queryWrapper.eq(DfProductArticle::getStatus, "1");
}
}
}
}
if (Validator.isEmpty(dfProductArticle.getOrderByColumn())) {
queryWrapper.last("ORDER BY CASE WHEN serial_number IS NULL THEN 1 ELSE 0 END, serial_number ASC");
}
condition(queryWrapper,dfProductArticle);
List<DfProductArticle> list = dfProductArticleService.list(queryWrapper);
for (DfProductArticle article : list) {
article.setArticleContent(HtmlUtils.stripHtmlTags(article.getArticleContent()));
}
List<CmAttach> attachVo = cmAttachService.list();
Map<String, List<CmAttach>> attachMap = attachVo.stream()
.filter(cmAttach -> cmAttach.getFileId() != null)
.collect(Collectors.groupingBy(CmAttach::getFileId));
for (DfProductArticle article : list) {
article.setArticleContent(HtmlUtils.stripHtmlTags(article.getArticleContent()));
String id = article.getId();
List<CmAttach> matchingAttachments = attachMap.get(String.valueOf(id));
if (matchingAttachments != null) {
article.setFiles(matchingAttachments);
}
}
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询产品文章列表")
@GetMapping("/list")
public AjaxResult list(DfProductArticle dfProductArticle) {
LambdaQueryWrapper<DfProductArticle> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductArticle);
List<DfProductArticle> list = dfProductArticleService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出产品文章列表")
@Log(title = "产品文章导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfProductArticle dfProductArticle) {
LambdaQueryWrapper<DfProductArticle> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductArticle);
List<DfProductArticle> list = dfProductArticleService.list(queryWrapper);
for (DfProductArticle article : list) {
//去除富文本中的HTML标签
article.setArticleContent(HtmlUtils.stripHtmlTags(article.getArticleContent()));
}
ExcelUtil<DfProductArticle> util = new ExcelUtil<DfProductArticle>(DfProductArticle. class);
util.exportExcel(response, list, "产品文章数据");
}
/**
*
*/
@ApiOperation("获取产品文章详细信息")
@GetMapping(value = "/{id}")
@Anonymous
public AjaxResult getInfo(@PathVariable("id") String id) {
DfProductArticle byId = dfProductArticleService.getById(id);
List<CmAttach> attachVo = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId, id));
byId.setFiles(attachVo);
return success(byId);
}
/**
*
*/
@ApiOperation("新增产品文章")
@Log(title = "产品文章新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfProductArticle dfProductArticle) {
return toAjax(dfProductArticleService.save(dfProductArticle));
}
/**
*
*/
@ApiOperation("修改产品文章")
@Log(title = "产品文章修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfProductArticle dfProductArticle) {
return toAjax(dfProductArticleService.updateById(dfProductArticle));
}
/**
*
*/
@ApiOperation("修改产品文章状态")
@Log(title = "修改产品文章状态", businessType = BusinessType.DELETE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody DfProductArticle dfProductArticle) {
String[] ids = dfProductArticle.getIds();
String status = dfProductArticle.getStatus();
List<DfProductArticle> dfProductArticles = new ArrayList<>();
for (String id : ids) {
DfProductArticle dfProductArticlerNew = new DfProductArticle();
dfProductArticlerNew.setId(id);
dfProductArticlerNew.setStatus(status);
dfProductArticles.add(dfProductArticlerNew);
}
return toAjax(dfProductArticleService.updateBatchById(dfProductArticles));
}
/**
*
*/
@ApiOperation("删除产品文章")
@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));
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfProductArticle> queryWrapper,DfProductArticle dfProductArticle){
//文章id
if(Validator.isNotEmpty(dfProductArticle.getId())){
queryWrapper.eq(DfProductArticle::getId,dfProductArticle.getId());
}
//文章分类0产品文章1经纪文章
if(Validator.isNotEmpty(dfProductArticle.getArticleType())){
queryWrapper.eq(DfProductArticle::getArticleType,dfProductArticle.getArticleType());
}
//文章类型
if(Validator.isNotEmpty(dfProductArticle.getArticleKind())){
queryWrapper.eq(DfProductArticle::getArticleKind,dfProductArticle.getArticleKind());
}
//文章标题
if(Validator.isNotEmpty(dfProductArticle.getArticleTitle())){
queryWrapper.like(DfProductArticle::getArticleTitle,dfProductArticle.getArticleTitle());
}
//发布时间
if(Validator.isNotEmpty(dfProductArticle.getPublishTime())){
queryWrapper.eq(DfProductArticle::getPublishTime,dfProductArticle.getPublishTime());
}
if(Validator.isNotEmpty(dfProductArticle.getPublishTimeBegin())){
queryWrapper.ge(DfProductArticle::getPublishTime,dfProductArticle.getPublishTimeBegin());
}
if(Validator.isNotEmpty(dfProductArticle.getPublishTimeEnd())){
queryWrapper.le(DfProductArticle::getPublishTime,dfProductArticle.getPublishTimeEnd());
}
//文章正文
if(Validator.isNotEmpty(dfProductArticle.getArticleContent())){
queryWrapper.eq(DfProductArticle::getArticleContent,dfProductArticle.getArticleContent());
}
//状态0草稿1上架
if(Validator.isNotEmpty(dfProductArticle.getStatus())){
queryWrapper.eq(DfProductArticle::getStatus,dfProductArticle.getStatus());
}
//备注
if(Validator.isNotEmpty(dfProductArticle.getRemark())){
queryWrapper.eq(DfProductArticle::getRemark,dfProductArticle.getRemark());
}
//创建部门
if(Validator.isNotEmpty(dfProductArticle.getCreateDept())){
queryWrapper.eq(DfProductArticle::getCreateDept,dfProductArticle.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfProductArticle.getCreateBy())){
queryWrapper.eq(DfProductArticle::getCreateBy,dfProductArticle.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfProductArticle.getCreateTime())){
queryWrapper.eq(DfProductArticle::getCreateTime,dfProductArticle.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfProductArticle.getUpdateBy())){
queryWrapper.eq(DfProductArticle::getUpdateBy,dfProductArticle.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfProductArticle.getUpdateTime())){
queryWrapper.eq(DfProductArticle::getUpdateTime,dfProductArticle.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfProductArticle.getDelFlag())){
queryWrapper.eq(DfProductArticle::getDelFlag,dfProductArticle.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfProductArticle.getTenantId())){
queryWrapper.eq(DfProductArticle::getTenantId,dfProductArticle.getTenantId());
}
}
}

@ -0,0 +1,900 @@
package com.bs.df.controller;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.common.annotation.Anonymous;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.core.domain.model.LoginUser;
import com.bs.common.utils.SecurityUtils;
import com.bs.df.domain.*;
import com.bs.df.service.*;
import com.bs.df.utils.HtmlUtils;
import com.bs.system.domain.DfArea;
import com.bs.system.mapper.SysUserMapper;
import com.bs.system.service.IDfAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.aspectj.weaver.patterns.IToken;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import static com.bs.common.utils.ServletUtils.getSession;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "产品信息")
@RestController
@RequestMapping("/product/info")
public class DfProductInfoController extends BaseController {
@Resource
private IDfProductInfoService dfProductInfoService;
@Resource
private IDfProductPosterService dfProductPosterService;
@Resource
private IDfAreaService dfAreaService;
@Resource
private IDfBrokerProductService dfBrokerProductService;
@Resource
private IDfBrokerService dfBrokerService;
@Resource
private IDfOrderService dfOrderService;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private IDfProductRecommendService dfProductRecommendService;
/**
*
*/
@ApiOperation("分页查询产品信息列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfProductInfo dfProductInfo) {
SysUser sysUser = sysUserMapper.selectById(getUserId());
List<DfProductInfo> list = selectInfo(dfProductInfo,sysUser,false);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("分页查询产品信息列表")
@GetMapping("/pageListVo")
@Anonymous
public TableDataInfo pageListVo(DfProductInfo dfProductInfo) {
SysUser sysUser = sysUserMapper.selectById(dfProductInfo.getUserId());
List<DfProductInfo> list = selectInfo(dfProductInfo,sysUser,true);
return getDataTable(list);
}
private List<DfProductInfo> selectInfo(DfProductInfo dfProductInfo,SysUser sysUser,boolean isAnonymous) {
String reviewStatus = sysUser.getReviewStatus();
if ("1".equals(reviewStatus)) {
return null;
}
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper();
if (Validator.isEmpty(dfProductInfo.getOrderByColumn())) {
queryWrapper.last("ORDER BY CASE WHEN serial_number IS NULL THEN 1 ELSE 0 END, serial_number ASC");
}
condition(queryWrapper,dfProductInfo);
String brokerIds = dfProductInfo.getBrokerIds();
if ("1".equals(dfProductInfo.getSelectByBroker())) {
if (Validator.isNotEmpty(dfProductInfo.getUserId())) {
if ("1".equals(dfProductInfo.getIsSelectBroker())) {
String userId = dfProductInfo.getUserId();
List<Long> productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(userId));
if (productIdsByBrokerIdByUserId == null || productIdsByBrokerIdByUserId.isEmpty()) {
productIdsByBrokerIdByUserId.add(0L);
}
queryWrapper.in(DfProductInfo::getId,productIdsByBrokerIdByUserId);
} else {
String userId = dfProductInfo.getUserId();
List<Long> productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(userId));
if (productIdsByBrokerIdByUserId == null || productIdsByBrokerIdByUserId.isEmpty()) {
productIdsByBrokerIdByUserId.add(0L);
}
if ("1".equals(dfProductInfo.getIsRecommend())) {
queryWrapper.and(wrapper ->
wrapper.in(DfProductInfo::getId, productIdsByBrokerIdByUserId)
.or()
.inSql(DfProductInfo::getId, "select product_id from df_broker_product where user_id in (" + dfProductInfo.getUserId() + ") and del_flag = '0' and staus = '1'")
);
queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_product_recommend where user_id in (" + userId + ") and del_flag = '0'");
} else {
queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_broker_product where user_id in (" + userId + ") and del_flag = '0' and staus = '1'");
}
}
} else {
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(sysUser.getUserId())) {
if (!sysUser.getDeptId().equals(-1L)) {
if (isAnonymous) {
List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerIdByUserId(sysUser.getUserId());
if (productIdsByBrokerId.size() == 0) {
productIdsByBrokerId.add(0L);
}
if (!"1".equals(dfProductInfo.getSelectByBroker())) {
queryWrapper.in(DfProductInfo::getId, productIdsByBrokerId)
.or()
.in(DfProductInfo::getCreateDept, SecurityUtils.getDeptId());
}
} else {
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());
}
}
}
}
startPage();
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
List<DfOrder> dfOrders = dfOrderService.list();
Map<Long, Integer> productOrderCounts = new HashMap<>();
// 计算申请人数
for (DfOrder order : dfOrders) {
if (!productOrderCounts.containsKey(order.getProductId())) {
productOrderCounts.put(order.getProductId(), 1000); // 从1000开始计数
} else {
productOrderCounts.put(order.getProductId(), productOrderCounts.get(order.getProductId()) + 1);
}
}
for (DfProductInfo productInfo : list) {
Long productId = productInfo.getId();
if (productOrderCounts.containsKey(productId)) {
productInfo.setApplicantNum(Long.valueOf(productOrderCounts.get(productId)));
} else {
productInfo.setApplicantNum(1000L);
}
}
//城市名称
Map<String, String> cityMap = new HashMap<>();
List<DfArea> allCities = dfAreaService.list();
for (DfArea city : allCities) {
cityMap.put(city.getAreaId(), city.getName());
}
DfBroker byId = null;
SysUser userInfo = null;
if ("1".equals(dfProductInfo.getSelectByBroker())) {
if (Validator.isNotEmpty(dfProductInfo.getUserId())) {
userInfo = sysUserMapper.selectById(dfProductInfo.getUserId());
} else {
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()));
String businessCity = productInfo.getBusinessCity();
if (Validator.isNotEmpty(businessCity)) {
String[] cityIds = businessCity.split(",");
StringBuilder translatedCities = new StringBuilder();
for (String cityId : cityIds) {
String cityName = cityMap.get(cityId);
if (cityName != null) {
translatedCities.append(cityName).append(",");
}
}
if (translatedCities.length() > 0) {
translatedCities.deleteCharAt(translatedCities.length() - 1);
}
productInfo.setBusinessCity(translatedCities.toString());
}
if ("1".equals(dfProductInfo.getSelectByBroker())) {
if (Validator.isNotEmpty(dfProductInfo.getUserId())) {
if ("1".equals(dfProductInfo.getIsSelectBroker())) {
Long deptId = userInfo.getDeptId();
DfBroker byIdNew = dfBrokerService.getById(deptId);
productInfo.setBrokerName(byIdNew.getBrokerName());
} else {
productInfo.setBrokerName(userInfo.getUserName());
}
} else {
productInfo.setBrokerName(byId.getBrokerName());
}
}
}
return list;
}
/**
*
*/
@ApiOperation("查询产品信息列表")
@GetMapping("/list")
public AjaxResult list(DfProductInfo dfProductInfo) {
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper();
if ("1".equals(dfProductInfo.getSelectByBroker())) {
queryWrapper.notInSql(DfProductInfo::getId,"select product_id from df_broker_product where del_flag = '0'")
.or()
.eq(DfProductInfo::getId,dfProductInfo.getId());
}
condition(queryWrapper,dfProductInfo);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
return success(list);
}
/**
* userId
*/
@ApiOperation("根据userId查询产品信息列表")
@GetMapping("/listByUserId")
public AjaxResult listByUserId(DfProductInfo dfProductInfo) {
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper();
List<Long> productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfProductInfo.getUserId()));
queryWrapper.notInSql(DfProductInfo::getId,
"select product_id from df_broker_product where del_flag = '0' and user_id = " + dfProductInfo.getUserId() + "")
.eq(DfProductInfo::getStatus, "1")
.or()
.eq(DfProductInfo::getId,dfProductInfo.getId())
.eq(DfProductInfo::getStatus, "1");
condition(queryWrapper,dfProductInfo);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
Set<Long> idsToRemove = productIdsByBrokerIdByUserId.stream().collect(Collectors.toSet());
List<DfProductInfo> filteredList = list.stream()
.filter(product -> !idsToRemove.contains(product.getId()))
.collect(Collectors.toList());
return success(filteredList);
}
/**
* userId
*/
@ApiOperation("根据userId查询产品信息列表")
@GetMapping("/listByRecommend")
public AjaxResult listByRecommend(DfProductInfo dfProductInfo) {
List<DfProductRecommend> dfProductRecommends = dfProductRecommendService.list(new LambdaQueryWrapper<DfProductRecommend>().eq(DfProductRecommend::getUserId, dfProductInfo.getUserId()));
List<Long> recommendProductIds = dfProductRecommends.stream()
.map(DfProductRecommend::getProductId) // 提取 String 类型的 productId
.map(Long::parseLong) // 将 String 转换为 Long
.collect(Collectors.toList()); // 收集为 List<Long>
recommendProductIds.add(0L);
List<Long> brokerProductIds = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfProductInfo.getUserId()));
List<Long> productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfProductInfo.getUserId()));
if (productIdsByBrokerIdByUserId.isEmpty()) {
productIdsByBrokerIdByUserId.add(0L); // 添加默认值避免空集合错误
}
Set<Long> allProductIds = new HashSet<>();
allProductIds.addAll(recommendProductIds);
allProductIds.addAll(brokerProductIds);
allProductIds.addAll(productIdsByBrokerIdByUserId);
allProductIds.add(0L);
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.notIn(DfProductInfo::getId, recommendProductIds) // 排除推荐的产品
.in(DfProductInfo::getId, allProductIds) // 包含经纪人产品和broker产品
.or()
.eq(DfProductInfo::getId, dfProductInfo.getId()); // 或者直接匹配当前产品ID
condition(queryWrapper, dfProductInfo);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
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 -> Objects.equals(id, dfProductInfo.getId()));
// 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);
}
/**
*
*/
@ApiOperation("导出产品信息列表")
@Log(title = "产品信息导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfProductInfo dfProductInfo) {
Map<String, String> cityMap = new HashMap<>();
List<DfArea> allCities = dfAreaService.list();
for (DfArea city : allCities) {
cityMap.put(city.getAreaId(), city.getName());
}
Map<Long, String> brokerProductMap = new HashMap<>();
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());
}
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductInfo);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
for (DfProductInfo productInfo : list) {
productInfo.setInterestRate(productInfo.getInterestRateBegin() + "%-" + productInfo.getInterestRateEnd() + "%");
productInfo.setProductIntro(HtmlUtils.stripHtmlTags(productInfo.getProductIntro()));
productInfo.setProductDetail(HtmlUtils.stripHtmlTags(productInfo.getProductDetail()));
String businessCity = productInfo.getBusinessCity(); // 获取原始的城市ID字符串
if (Validator.isNotEmpty(businessCity)) {
String[] cityIds = businessCity.split(","); // 按逗号分割城市ID
StringBuilder translatedCities = new StringBuilder();
for (String cityId : cityIds) {
String cityName = cityMap.get(cityId); // 从 Map 中获取城市名称
if (cityName != null) {
translatedCities.append(cityName).append(",");
}
}
if (translatedCities.length() > 0) {
translatedCities.deleteCharAt(translatedCities.length() - 1);
}
productInfo.setBusinessCity(translatedCities.toString());
productInfo.setBrokerName(brokerProductMap.get(productInfo.getId()));
}
}
ExcelUtil<DfProductInfo> util = new ExcelUtil<DfProductInfo>(DfProductInfo. class);
util.exportExcel(response, list, "产品信息数据");
}
/**
*
*/
@ApiOperation("获取产品信息详细信息")
@GetMapping(value = "/{id}")
@Anonymous
public AjaxResult getInfo(@PathVariable("id") Long id) {
Boolean isUser = true;
try {
LoginUser loginUser = getLoginUser();
} catch (Exception e) {
isUser = false;
// 捕获所有异常
e.printStackTrace(); // 或者记录日志等处理方式
}
DfProductInfo byId = dfProductInfoService.getById(id);
byId.setInterestRate(byId.getInterestRateBegin() + "%-" + byId.getInterestRateEnd() + "%");
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>().eq(DfBrokerProduct::getProductId, id));
List<DfOrder> dfOrders = dfOrderService.list();
Map<Long, Integer> productOrderCounts = new HashMap<>();
// 计算申请人数
for (DfOrder order : dfOrders) {
if (!productOrderCounts.containsKey(order.getProductId())) {
productOrderCounts.put(order.getProductId(), 1);
} else {
productOrderCounts.put(order.getProductId(), productOrderCounts.get(order.getProductId()) + 1);
}
}
Long productId = byId.getId();
if (productOrderCounts.containsKey(productId)) {
byId.setApplicantNum(Long.valueOf(productOrderCounts.get(productId)));
} else {
byId.setApplicantNum(0L);
}
if (list.size() > 0 && list != null) {
byId.setBrokerId(list.get(0).getBrokerId());
}
if (isUser == false) {
byId.setProductDetail(null);
} else {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId();
if (!productIdsByBrokerId.contains(id)) {
byId.setProductDetail(null);
}
SysUser sysUser = sysUserMapper.selectById(getUserId());
String reviewStatus = sysUser.getReviewStatus();
if ("1".equals(reviewStatus)) {
byId.setProductDetail(null);
}
}
}
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);
}
/**
*
*/
@ApiOperation("根据经纪人获取产品信息详细信息")
@GetMapping(value = "/getInfoByUserId/{id}")
@Anonymous
public AjaxResult getInfoByUserId(@PathVariable("id") Long id) {
List<Long> productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(id);
if (productIdsByBrokerIdByUserId.size() == 0) {
return success(null);
}
List<DfProductInfo> list = dfProductInfoService.list(new LambdaQueryWrapper<DfProductInfo>().in(DfProductInfo::getId, productIdsByBrokerIdByUserId));
for (DfProductInfo productInfo : list) {
productInfo.setProductDetail(null);
}
List<DfOrder> dfOrders = dfOrderService.list();
Map<Long, Integer> productOrderCounts = new HashMap<>();
// 计算申请人数
for (DfOrder order : dfOrders) {
if (!productOrderCounts.containsKey(order.getProductId())) {
productOrderCounts.put(order.getProductId(), 1);
} else {
productOrderCounts.put(order.getProductId(), productOrderCounts.get(order.getProductId()) + 1);
}
}
for (DfProductInfo productInfo : list) {
productInfo.setInterestRate(productInfo.getInterestRateBegin() + "%-" + productInfo.getInterestRateEnd() + "%");
Long productId = productInfo.getId();
if (productOrderCounts.containsKey(productId)) {
productInfo.setApplicantNum(Long.valueOf(productOrderCounts.get(productId)));
} else {
productInfo.setApplicantNum(0L);
}
}
return success(list);
}
/**
*
*/
@ApiOperation("根据代理商获取产品信息详细信息")
@PutMapping(value = "/getInfoByBroker")
@Anonymous
public AjaxResult getInfoByBroker(@RequestBody DfProductInfo dfProductInfo) {
if(Validator.isNotEmpty(dfProductInfo.getBrokerId())) {
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);
} else {
DfProductInfo byId = dfProductInfoService.getById(dfProductInfo.getId());
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
.eq(DfBrokerProduct::getUserId, dfProductInfo.getUserId())
.eq(DfBrokerProduct::getProductId, dfProductInfo.getId()));
if (list.size() > 0 && list != null) {
byId.setUserId(list.get(0).getUserId());
}
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);
}
}
/**
*
*/
@ApiOperation("新增产品信息")
@Log(title = "产品信息新增", businessType = BusinessType.INSERT)
@PostMapping
@Anonymous
public AjaxResult add(@RequestBody DfProductInfo dfProductInfo) {
return toAjax(dfProductInfoService.save(dfProductInfo));
}
/**
*
*/
@ApiOperation("修改产品信息")
@Log(title = "产品信息修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfProductInfo dfProductInfo) {
return toAjax(dfProductInfoService.updateById(dfProductInfo));
}
/**
*
*/
@ApiOperation("删除产品信息")
@Log(title = "产品信息删除", businessType = BusinessType.DELETE)
@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));
}
/**
*
*/
@ApiOperation("修改产品状态")
@Log(title = "修改产品状态", businessType = BusinessType.DELETE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody DfProductInfo dfProductInfo) {
Long[] ids = dfProductInfo.getIds();
String status = dfProductInfo.getStatus();
List<DfProductInfo> dfProductInfos = new ArrayList<>();
for (Long id : ids) {
DfProductInfo dfProductInfoNew = new DfProductInfo();
dfProductInfoNew.setId(id);
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());
}
/**
*
*/
@ApiOperation("修改代理产品权限")
@Log(title = "代理产品权限修改", businessType = BusinessType.UPDATE)
@PutMapping("/editByBroker")
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)
.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));
}
}
/**
*
*/
@ApiOperation("修改代理产品权限")
@Log(title = "代理产品权限修改", businessType = BusinessType.UPDATE)
@PutMapping("/editByBrokers")
public AjaxResult editByBrokers(@RequestBody DfProductInfo dfProductInfo) {
for (Long id : dfProductInfo.getIds()) {
if (Validator.isNotEmpty(dfProductInfo.getUserId())) {
Long productInfoId = id;
String userId = dfProductInfo.getUserId();
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
.eq(DfBrokerProduct::getProductId, productInfoId)
.eq(DfBrokerProduct::getBrokerId, userId));
if (list != null && list.size() > 0) {
DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setUserId(userId).setProductId(productInfoId).setId(list.get(0).getId());
dfBrokerProduct.setStaus("1");
dfBrokerProductService.updateById(dfBrokerProduct);
} else {
DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setUserId(userId).setProductId(productInfoId);
dfBrokerProduct.setStaus("1");
dfBrokerProductService.save(dfBrokerProduct);
}
} else {
Long productInfoId = id;
Long brokerId = dfProductInfo.getBrokerId();
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");
dfBrokerProductService.updateById(dfBrokerProduct);
} else {
DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId);
dfBrokerProduct.setStaus("1");
dfBrokerProductService.save(dfBrokerProduct);
}
}
}
return toAjax(true);
}
/**
*
*/
@ApiOperation("移除代理产品权限")
@Log(title = "代理产品权限移除", businessType = BusinessType.DELETE)
@PutMapping("/removeByBroker")
public AjaxResult removeByBroker(@RequestBody DfProductInfo dfProductInfo) {
Long[] ids = dfProductInfo.getIds();
Long brokerId = dfProductInfo.getBrokerId();
if (Validator.isNotEmpty(dfProductInfo.getUserId())) {
boolean remove = dfBrokerProductService.remove(new LambdaQueryWrapper<DfBrokerProduct>()
.in(DfBrokerProduct::getProductId, ids)
.in(DfBrokerProduct::getUserId, dfProductInfo.getUserId()));
return toAjax(remove);
} else {
List<DfBroker> allSubordinates = dfBrokerService.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);
}
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfProductInfo> queryWrapper,DfProductInfo dfProductInfo){
//产品id
if(Validator.isNotEmpty(dfProductInfo.getId())){
queryWrapper.eq(DfProductInfo::getId,dfProductInfo.getId());
}
//产品名称
if(Validator.isNotEmpty(dfProductInfo.getProductName())){
queryWrapper.like(DfProductInfo::getProductName,dfProductInfo.getProductName());
}
//产品简称
if(Validator.isNotEmpty(dfProductInfo.getSimpleName())){
queryWrapper.like(DfProductInfo::getSimpleName,dfProductInfo.getSimpleName());
}
//产品类型
if(Validator.isNotEmpty(dfProductInfo.getProductType())){
queryWrapper.eq(DfProductInfo::getProductType,dfProductInfo.getProductType());
}
//产品细类
if(Validator.isNotEmpty(dfProductInfo.getProductSubtype())){
queryWrapper.eq(DfProductInfo::getProductSubtype,dfProductInfo.getProductSubtype());
}
//最高额度(元)
if(Validator.isNotEmpty(dfProductInfo.getMaxAmount())){
queryWrapper.eq(DfProductInfo::getMaxAmount,dfProductInfo.getMaxAmount());
}
if(Validator.isNotEmpty(dfProductInfo.getMaxAmountBegin())){
queryWrapper.ge(DfProductInfo::getMaxAmount,dfProductInfo.getMaxAmountBegin());
}
if(Validator.isNotEmpty(dfProductInfo.getMaxAmountEnd())){
queryWrapper.le(DfProductInfo::getMaxAmount,dfProductInfo.getMaxAmountEnd());
}
//年利率(单利)
if(Validator.isNotEmpty(dfProductInfo.getInterestRateBegin())){
queryWrapper.ge(DfProductInfo::getInterestRateBegin,dfProductInfo.getInterestRateBegin());
}
if(Validator.isNotEmpty(dfProductInfo.getInterestRateEnd())){
queryWrapper.le(DfProductInfo::getInterestRateEnd,dfProductInfo.getInterestRateEnd());
}
//产品简介
if(Validator.isNotEmpty(dfProductInfo.getProductIntro())){
queryWrapper.eq(DfProductInfo::getProductIntro,dfProductInfo.getProductIntro());
}
//产品详情(富文本)
if(Validator.isNotEmpty(dfProductInfo.getProductDetail())){
queryWrapper.eq(DfProductInfo::getProductDetail,dfProductInfo.getProductDetail());
}
//上架时间起
if(Validator.isNotEmpty(dfProductInfo.getListBegin())){
queryWrapper.ge(DfProductInfo::getListBegin,dfProductInfo.getListBegin());
}
//上架时间止
if(Validator.isNotEmpty(dfProductInfo.getListEnd())){
queryWrapper.le(DfProductInfo::getListEnd,dfProductInfo.getListEnd());
}
if(Validator.isNotEmpty(dfProductInfo.getParams().get("beginTime"))){
queryWrapper.ge(DfProductInfo::getListBegin,dfProductInfo.getParams().get("beginTime"));
}
if(Validator.isNotEmpty(dfProductInfo.getParams().get("endTime"))){
queryWrapper.le(DfProductInfo::getListEnd,dfProductInfo.getParams().get("endTime"));
}
//还款周期
if(Validator.isNotEmpty(dfProductInfo.getRepaymentCycle())){
queryWrapper.eq(DfProductInfo::getRepaymentCycle,dfProductInfo.getRepaymentCycle());
}
//还款方式
if(Validator.isNotEmpty(dfProductInfo.getRepaymentMethod())){
queryWrapper.eq(DfProductInfo::getRepaymentMethod,dfProductInfo.getRepaymentMethod());
}
//展业城市
if(Validator.isNotEmpty(dfProductInfo.getBusinessCity())){
queryWrapper.eq(DfProductInfo::getBusinessCity,dfProductInfo.getBusinessCity());
}
//综合费率
if(Validator.isNotEmpty(dfProductInfo.getCombinedRates())){
queryWrapper.eq(DfProductInfo::getCombinedRates,dfProductInfo.getCombinedRates());
}
//状态0草稿1上架
if(Validator.isNotEmpty(dfProductInfo.getStatus())){
queryWrapper.eq(DfProductInfo::getStatus,dfProductInfo.getStatus());
}
//备注
if(Validator.isNotEmpty(dfProductInfo.getRemark())){
queryWrapper.eq(DfProductInfo::getRemark,dfProductInfo.getRemark());
}
//创建部门
if(Validator.isNotEmpty(dfProductInfo.getCreateDept())){
queryWrapper.eq(DfProductInfo::getCreateDept,dfProductInfo.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfProductInfo.getCreateBy())){
queryWrapper.eq(DfProductInfo::getCreateBy,dfProductInfo.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfProductInfo.getCreateTime())){
queryWrapper.eq(DfProductInfo::getCreateTime,dfProductInfo.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfProductInfo.getUpdateBy())){
queryWrapper.eq(DfProductInfo::getUpdateBy,dfProductInfo.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfProductInfo.getUpdateTime())){
queryWrapper.eq(DfProductInfo::getUpdateTime,dfProductInfo.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfProductInfo.getDelFlag())){
queryWrapper.eq(DfProductInfo::getDelFlag,dfProductInfo.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfProductInfo.getTenantId())){
queryWrapper.eq(DfProductInfo::getTenantId,dfProductInfo.getTenantId());
}
}
}

@ -0,0 +1,280 @@
package com.bs.df.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.utils.SecurityUtils;
import com.bs.df.domain.DfProductArticle;
import com.bs.df.domain.DfProductPoster;
import com.bs.df.utils.HtmlUtils;
import com.bs.system.mapper.SysUserMapper;
import com.bs.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfProductMoment;
import com.bs.df.service.IDfProductMomentService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "产品朋友圈")
@RestController
@RequestMapping("/moment/moment")
public class DfProductMomentController extends BaseController {
@Resource
private IDfProductMomentService dfProductMomentService;
@Resource
private ICmAttachService cmAttachService;
@Resource
private ISysUserService userService;
@Autowired
private SysUserMapper sysUserMapper;
/**
*
*/
@ApiOperation("分页查询产品朋友圈列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfProductMoment dfProductMoment) {
SysUser sysUser = sysUserMapper.selectById(getUserId());
startPage();
String reviewStatus = sysUser.getReviewStatus();
if ("1".equals(reviewStatus)) {
return null;
}
LambdaQueryWrapper<DfProductMoment> queryWrapper = new LambdaQueryWrapper();
if (Validator.isEmpty(dfProductMoment.getOrderByColumn())) {
queryWrapper.orderByDesc(DfProductMoment::getCreateTime);
}
condition(queryWrapper,dfProductMoment);
boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
if (!admin) {
if (!sysUser.getDeptId().equals(-1L)) {
if ("-99".equals(dfProductMoment.getStatus())) {
} else {
SysUser byId = userService.getById(SecurityUtils.getUserId());
if ("jj".equals(byId.getUserType()) || "kh".equals(byId.getUserType())) {
queryWrapper.eq(DfProductMoment::getStatus, "1");
}
}
}
}
List<DfProductMoment> list = dfProductMomentService.list(queryWrapper);
List<CmAttach> attachVo = cmAttachService.list();
Map<String, List<CmAttach>> attachMap = attachVo.stream()
.filter(cmAttach -> cmAttach.getFileId() != null)
.collect(Collectors.groupingBy(CmAttach::getFileId));
for (DfProductMoment moment : list) {
moment.setMomentContent(HtmlUtils.stripHtmlTags(moment.getMomentContent()));
String id = moment.getId();
List<CmAttach> matchingAttachments = attachMap.get(String.valueOf(id));
if (matchingAttachments != null) {
moment.setFiles(matchingAttachments);
}
}
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询产品朋友圈列表")
@GetMapping("/list")
public AjaxResult list(DfProductMoment dfProductMoment) {
LambdaQueryWrapper<DfProductMoment> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductMoment);
List<DfProductMoment> list = dfProductMomentService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出产品朋友圈列表")
@Log(title = "产品朋友圈导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfProductMoment dfProductMoment) {
LambdaQueryWrapper<DfProductMoment> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductMoment);
List<DfProductMoment> list = dfProductMomentService.list(queryWrapper);
for (DfProductMoment moment : list) {
moment.setMomentContent(HtmlUtils.stripHtmlTags(moment.getMomentContent()));
}
ExcelUtil<DfProductMoment> util = new ExcelUtil<DfProductMoment>(DfProductMoment. class);
util.exportExcel(response, list, "产品朋友圈数据");
}
/**
*
*/
@ApiOperation("获取产品朋友圈详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
DfProductMoment byId = dfProductMomentService.getById(id);
List<CmAttach> attachVo = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId, id));
byId.setFiles(attachVo);
return success(byId);
}
/**
*
*/
@ApiOperation("新增产品朋友圈")
@Log(title = "产品朋友圈新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfProductMoment dfProductMoment) {
return toAjax(dfProductMomentService.save(dfProductMoment));
}
/**
*
*/
@ApiOperation("修改产品朋友圈")
@Log(title = "产品朋友圈修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfProductMoment dfProductMoment) {
return toAjax(dfProductMomentService.updateById(dfProductMoment));
}
/**
*
*/
@ApiOperation("修改产品朋友圈状态")
@Log(title = "修改产品朋友圈状态", businessType = BusinessType.DELETE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody DfProductMoment dfProductMoment) {
String[] ids = dfProductMoment.getIds();
String status = dfProductMoment.getStatus();
List<DfProductMoment> dfProductMoments = new ArrayList<>();
for (String id : ids) {
DfProductMoment dfProductMomentNew = new DfProductMoment();
dfProductMomentNew.setId(id);
dfProductMomentNew.setStatus(status);
dfProductMoments.add(dfProductMomentNew);
}
return toAjax(dfProductMomentService.updateBatchById(dfProductMoments));
}
/**
*
*/
@ApiOperation("删除产品朋友圈")
@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));
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfProductMoment> queryWrapper,DfProductMoment dfProductMoment){
//朋友圈id
if(Validator.isNotEmpty(dfProductMoment.getId())){
queryWrapper.eq(DfProductMoment::getId,dfProductMoment.getId());
}
//朋友圈分类0产品朋友圈1经纪朋友圈
if(Validator.isNotEmpty(dfProductMoment.getMomentType())){
queryWrapper.eq(DfProductMoment::getMomentType,dfProductMoment.getMomentType());
}
//朋友圈类型
if(Validator.isNotEmpty(dfProductMoment.getMomentKind())){
queryWrapper.eq(DfProductMoment::getMomentKind,dfProductMoment.getMomentKind());
}
//朋友圈标题
if(Validator.isNotEmpty(dfProductMoment.getMomentTitle())){
queryWrapper.eq(DfProductMoment::getMomentTitle,dfProductMoment.getMomentTitle());
}
//朋友圈正文
if(Validator.isNotEmpty(dfProductMoment.getMomentContent())){
queryWrapper.eq(DfProductMoment::getMomentContent,dfProductMoment.getMomentContent());
}
//状态0草稿1上架
if(Validator.isNotEmpty(dfProductMoment.getStatus())){
queryWrapper.eq(DfProductMoment::getStatus,dfProductMoment.getStatus());
}
//备注
if(Validator.isNotEmpty(dfProductMoment.getRemark())){
queryWrapper.eq(DfProductMoment::getRemark,dfProductMoment.getRemark());
}
//创建部门
if(Validator.isNotEmpty(dfProductMoment.getCreateDept())){
queryWrapper.eq(DfProductMoment::getCreateDept,dfProductMoment.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfProductMoment.getCreateBy())){
queryWrapper.eq(DfProductMoment::getCreateBy,dfProductMoment.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfProductMoment.getCreateTime())){
queryWrapper.eq(DfProductMoment::getCreateTime,dfProductMoment.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfProductMoment.getUpdateBy())){
queryWrapper.eq(DfProductMoment::getUpdateBy,dfProductMoment.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfProductMoment.getUpdateTime())){
queryWrapper.eq(DfProductMoment::getUpdateTime,dfProductMoment.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfProductMoment.getDelFlag())){
queryWrapper.eq(DfProductMoment::getDelFlag,dfProductMoment.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfProductMoment.getTenantId())){
queryWrapper.eq(DfProductMoment::getTenantId,dfProductMoment.getTenantId());
}
}
}

@ -0,0 +1,402 @@
package com.bs.df.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.core.domain.entity.SysUser;
import com.bs.common.utils.SecurityUtils;
import com.bs.df.domain.DfOrder;
import com.bs.df.domain.DfProductArticle;
import com.bs.df.domain.DfProductInfo;
import com.bs.df.service.IDfBrokerService;
import com.bs.df.service.IDfProductInfoService;
import com.bs.system.mapper.SysUserMapper;
import com.bs.system.service.ISysUserService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfProductPoster;
import com.bs.df.service.IDfProductPosterService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "产品海报")
@RestController
@RequestMapping("/poster/poster")
public class DfProductPosterController extends BaseController {
@Resource
private IDfProductPosterService dfProductPosterService;
@Resource
private IDfProductInfoService dfProductInfoService;
@Autowired
private ICmAttachService cmAttachService;
@Resource
private IDfBrokerService dfBrokerService;;
@Resource
private ISysUserService userService;
@Autowired
private SysUserMapper sysUserMapper;
/**
*
*/
@ApiOperation("分页查询产品海报列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfProductPoster dfProductPoster) {
SysUser sysUser = sysUserMapper.selectById(getUserId());
String reviewStatus = sysUser.getReviewStatus();
if ("1".equals(reviewStatus)) {
return null;
}
MPJLambdaWrapper<DfProductPoster> queryWrapper = new MPJLambdaWrapper();
queryWrapper.selectAll(DfProductPoster.class)
.select(DfProductInfo::getProductName)
.disableSubLogicDel()
.leftJoin(DfProductInfo.class,DfProductInfo::getId,DfProductPoster::getProductId);
if (Validator.isEmpty(dfProductPoster.getOrderByColumn())) {
queryWrapper.last("ORDER BY CASE WHEN t.serial_number IS NULL THEN 1 ELSE 0 END, t.serial_number ASC");
}
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
if (!sysUser.getDeptId().equals(-1L)) {
if ("-99".equals(dfProductPoster.getStatus())) {
} else {
List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId();
List<DfProductPoster> list = dfProductPosterService.list(new LambdaQueryWrapper<DfProductPoster>()
.eq(DfProductPoster::getPosterType, "1"));
List<Long> productIds = list.stream()
.map(DfProductPoster::getProductId)
.collect(Collectors.toList());
if (productIdsByBrokerId.size() == 0) {
productIdsByBrokerId.add(0L);
}
productIdsByBrokerId.addAll(productIds);
queryWrapper.nested(wrapper -> wrapper.in(DfProductPoster::getProductId, productIdsByBrokerId)
.or()
.isNull(DfProductPoster::getProductId));
SysUser byId = userService.getById(SecurityUtils.getUserId());
if ("jj".equals(byId.getUserType()) || "kh".equals(byId.getUserType())) {
queryWrapper.eq(DfProductPoster::getStatus,"1");
}
}
}
}
conditionByMPJ(queryWrapper,dfProductPoster);
startPage();
List<DfProductPoster> list = dfProductPosterService.list(queryWrapper);
List<CmAttach> attachVo = cmAttachService.list();
Map<String, List<CmAttach>> attachMap = attachVo.stream()
.filter(cmAttach -> cmAttach.getFileId() != null)
.collect(Collectors.groupingBy(CmAttach::getFileId));
for (DfProductPoster dfProductPosterVo : list) {
String id = dfProductPosterVo.getId();
List<CmAttach> matchingAttachments = attachMap.get(String.valueOf(id));
if (matchingAttachments != null) {
dfProductPosterVo.setFiles(matchingAttachments);
}
if ("1".equals(dfProductPosterVo.getPosterType())) {
dfProductPosterVo.setProductName(null);
}
}
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询产品海报列表")
@GetMapping("/list")
public AjaxResult list(DfProductPoster dfProductPoster) {
LambdaQueryWrapper<DfProductPoster> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductPoster);
List<DfProductPoster> list = dfProductPosterService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出产品海报列表")
@Log(title = "产品海报导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfProductPoster dfProductPoster) {
MPJLambdaWrapper<DfProductPoster> queryWrapper = new MPJLambdaWrapper();
queryWrapper.selectAll(DfProductPoster.class)
.select(DfProductInfo::getProductName)
.disableSubLogicDel()
.leftJoin(DfProductInfo.class,DfProductInfo::getId,DfProductPoster::getProductId);
conditionByMPJ(queryWrapper,dfProductPoster);
List<DfProductPoster> list = dfProductPosterService.list(queryWrapper);
ExcelUtil<DfProductPoster> util = new ExcelUtil<DfProductPoster>(DfProductPoster. class);
util.exportExcel(response, list, "产品海报数据");
}
/**
*
*/
@ApiOperation("获取产品海报详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
DfProductPoster byId = dfProductPosterService.getById(id);
List<CmAttach> attachVo = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId, id));
byId.setFiles(attachVo);
return success(byId);
}
/**
*
*/
@ApiOperation("新增产品海报")
@Log(title = "产品海报新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfProductPoster dfProductPoster) {
if ("1".equals(dfProductPoster.getPosterType())) {
dfProductPoster.setProductId(-1L);
}
return toAjax(dfProductPosterService.save(dfProductPoster));
}
/**
*
*/
@ApiOperation("修改产品海报")
@Log(title = "产品海报修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfProductPoster dfProductPoster) {
if ("1".equals(dfProductPoster.getPosterType())) {
dfProductPoster.setProductId(-1L);
}
return toAjax(dfProductPosterService.updateById(dfProductPoster));
}
/**
*
*/
@ApiOperation("修改产品海报状态")
@Log(title = "修改产品海报状态", businessType = BusinessType.DELETE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody DfProductPoster dfProductPoster) {
String[] ids = dfProductPoster.getIds();
String status = dfProductPoster.getStatus();
List<DfProductPoster> dfProductPosters = new ArrayList<>();
for (String id : ids) {
DfProductPoster dfProductPosterNew = new DfProductPoster();
dfProductPosterNew.setId(id);
dfProductPosterNew.setStatus(status);
dfProductPosters.add(dfProductPosterNew);
}
return toAjax(dfProductPosterService.updateBatchById(dfProductPosters));
}
/**
*
*/
@ApiOperation("删除产品海报")
@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));
}
private void conditionByMPJ (MPJLambdaWrapper<DfProductPoster> queryWrapper,DfProductPoster dfProductPoster){
//海报id
if(Validator.isNotEmpty(dfProductPoster.getId())){
queryWrapper.eq(DfProductPoster::getId,dfProductPoster.getId());
}
//产品id
if(Validator.isNotEmpty(dfProductPoster.getProductId())){
queryWrapper.eq(DfProductPoster::getProductId,dfProductPoster.getProductId());
}
//产品名称
if(Validator.isNotEmpty(dfProductPoster.getProductName())){
queryWrapper.like(DfProductInfo::getProductName,dfProductPoster.getProductName());
}
//海报分类0产品海报1经纪海报
if(Validator.isNotEmpty(dfProductPoster.getPosterType())){
queryWrapper.eq(DfProductPoster::getPosterType,dfProductPoster.getPosterType());
}
//海报名称
if(Validator.isNotEmpty(dfProductPoster.getPosterName())){
queryWrapper.like(DfProductPoster::getPosterName,dfProductPoster.getPosterName());
}
//海报标签
if(Validator.isNotEmpty(dfProductPoster.getPosterTag())){
queryWrapper.eq(DfProductPoster::getPosterTag,dfProductPoster.getPosterTag());
}
//海报图片id
if(Validator.isNotEmpty(dfProductPoster.getPosterFileId())){
queryWrapper.eq(DfProductPoster::getPosterFileId,dfProductPoster.getPosterFileId());
}
//状态0草稿1上架
if(Validator.isNotEmpty(dfProductPoster.getStatus())){
queryWrapper.eq(DfProductPoster::getStatus,dfProductPoster.getStatus());
}
//备注
if(Validator.isNotEmpty(dfProductPoster.getRemark())){
queryWrapper.eq(DfProductPoster::getRemark,dfProductPoster.getRemark());
}
//创建部门
if(Validator.isNotEmpty(dfProductPoster.getCreateDept())){
queryWrapper.eq(DfProductPoster::getCreateDept,dfProductPoster.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfProductPoster.getCreateBy())){
queryWrapper.eq(DfProductPoster::getCreateBy,dfProductPoster.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfProductPoster.getCreateTime())){
queryWrapper.eq(DfProductPoster::getCreateTime,dfProductPoster.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfProductPoster.getUpdateBy())){
queryWrapper.eq(DfProductPoster::getUpdateBy,dfProductPoster.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfProductPoster.getUpdateTime())){
queryWrapper.eq(DfProductPoster::getUpdateTime,dfProductPoster.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfProductPoster.getDelFlag())){
queryWrapper.eq(DfProductPoster::getDelFlag,dfProductPoster.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfProductPoster.getTenantId())){
queryWrapper.eq(DfProductPoster::getTenantId,dfProductPoster.getTenantId());
}
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfProductPoster> queryWrapper,DfProductPoster dfProductPoster){
//海报id
if(Validator.isNotEmpty(dfProductPoster.getId())){
queryWrapper.eq(DfProductPoster::getId,dfProductPoster.getId());
}
//产品id
if(Validator.isNotEmpty(dfProductPoster.getProductId())){
queryWrapper.eq(DfProductPoster::getProductId,dfProductPoster.getProductId());
}
//海报分类0产品海报1经纪海报
if(Validator.isNotEmpty(dfProductPoster.getPosterType())){
queryWrapper.eq(DfProductPoster::getPosterType,dfProductPoster.getPosterType());
}
//海报名称
if(Validator.isNotEmpty(dfProductPoster.getPosterName())){
queryWrapper.eq(DfProductPoster::getPosterName,dfProductPoster.getPosterName());
}
//海报标签
if(Validator.isNotEmpty(dfProductPoster.getPosterTag())){
queryWrapper.eq(DfProductPoster::getPosterTag,dfProductPoster.getPosterTag());
}
//海报图片id
if(Validator.isNotEmpty(dfProductPoster.getPosterFileId())){
queryWrapper.eq(DfProductPoster::getPosterFileId,dfProductPoster.getPosterFileId());
}
//状态0草稿1上架
if(Validator.isNotEmpty(dfProductPoster.getStatus())){
queryWrapper.eq(DfProductPoster::getStatus,dfProductPoster.getStatus());
}
//备注
if(Validator.isNotEmpty(dfProductPoster.getRemark())){
queryWrapper.eq(DfProductPoster::getRemark,dfProductPoster.getRemark());
}
//创建部门
if(Validator.isNotEmpty(dfProductPoster.getCreateDept())){
queryWrapper.eq(DfProductPoster::getCreateDept,dfProductPoster.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfProductPoster.getCreateBy())){
queryWrapper.eq(DfProductPoster::getCreateBy,dfProductPoster.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfProductPoster.getCreateTime())){
queryWrapper.eq(DfProductPoster::getCreateTime,dfProductPoster.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfProductPoster.getUpdateBy())){
queryWrapper.eq(DfProductPoster::getUpdateBy,dfProductPoster.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfProductPoster.getUpdateTime())){
queryWrapper.eq(DfProductPoster::getUpdateTime,dfProductPoster.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfProductPoster.getDelFlag())){
queryWrapper.eq(DfProductPoster::getDelFlag,dfProductPoster.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfProductPoster.getTenantId())){
queryWrapper.eq(DfProductPoster::getTenantId,dfProductPoster.getTenantId());
}
}
}

@ -0,0 +1,175 @@
package com.bs.df.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bs.common.annotation.Anonymous;
import com.bs.df.domain.DfBrokerProduct;
import com.bs.df.domain.DfProductInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfProductRecommend;
import com.bs.df.service.IDfProductRecommendService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-09-16
*/
@Api(tags = "代理产品推荐")
@RestController
@RequestMapping("/product/recommend")
public class DfProductRecommendController extends BaseController {
@Resource
private IDfProductRecommendService dfProductRecommendService;
/**
*
*/
@ApiOperation("分页查询代理产品推荐列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfProductRecommend dfProductRecommend) {
startPage();
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductRecommend);
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询代理产品推荐列表")
@GetMapping("/list")
public AjaxResult list(DfProductRecommend dfProductRecommend) {
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductRecommend);
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出代理产品推荐列表")
@Log(title = "代理产品推荐导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfProductRecommend dfProductRecommend) {
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductRecommend);
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
ExcelUtil<DfProductRecommend> util = new ExcelUtil<DfProductRecommend>(DfProductRecommend. class);
util.exportExcel(response, list, "代理产品推荐数据");
}
/**
*
*/
@ApiOperation("获取代理产品推荐详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(dfProductRecommendService.getById(id));
}
/**
*
*/
@ApiOperation("修改代理产品推荐")
@Log(title = "代理产品推荐修改", businessType = BusinessType.UPDATE)
@PutMapping("/editByProducts")
public AjaxResult editByProducts(@RequestBody DfProductRecommend dfProductRecommend) {
for (Long productId : dfProductRecommend.getIds()) {
DfProductRecommend productRecommend = new DfProductRecommend();
productRecommend.setProductId(String.valueOf(productId));
productRecommend.setUserId(dfProductRecommend.getUserId());
dfProductRecommendService.save(productRecommend);
}
return toAjax(true);
}
/**
*
*/
@ApiOperation("新增代理产品推荐")
@Log(title = "代理产品推荐新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfProductRecommend dfProductRecommend) {
return toAjax(dfProductRecommendService.save(dfProductRecommend));
}
/**
*
*/
@ApiOperation("修改代理产品推荐")
@Log(title = "代理产品推荐修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfProductRecommend dfProductRecommend) {
return toAjax(dfProductRecommendService.updateById(dfProductRecommend));
}
/**
*
*/
@ApiOperation("删除代理产品推荐")
@Log(title = "代理产品推荐删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(dfProductRecommendService.removeBatchByIds(ids));
}
/**
*
*/
@ApiOperation("移除代理产品推荐")
@Log(title = "代理产品推荐移除", businessType = BusinessType.DELETE)
@PostMapping("/delInfoByRecommend")
public AjaxResult delInfoByRecommend(@RequestBody DfProductRecommend dfProductRecommend) {
boolean remove = dfProductRecommendService.remove(new LambdaQueryWrapper<DfProductRecommend>().in(DfProductRecommend::getProductId, dfProductRecommend.getIds())
.eq(DfProductRecommend::getUserId, dfProductRecommend.getUserId()));
return toAjax(remove);
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfProductRecommend> queryWrapper,DfProductRecommend dfProductRecommend){
//主键
if(Validator.isNotEmpty(dfProductRecommend.getId())){
queryWrapper.eq(DfProductRecommend::getId,dfProductRecommend.getId());
}
//用户id
if(Validator.isNotEmpty(dfProductRecommend.getUserId())){
queryWrapper.eq(DfProductRecommend::getUserId,dfProductRecommend.getUserId());
}
//产品id
if(Validator.isNotEmpty(dfProductRecommend.getProductId())){
queryWrapper.eq(DfProductRecommend::getProductId,dfProductRecommend.getProductId());
}
}
}

@ -0,0 +1,183 @@
package com.bs.df.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.bs.common.annotation.Anonymous;
import com.bs.common.core.domain.model.LoginBody;
import com.bs.web.utils.WeiXinUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfUserBroker;
import com.bs.df.service.IDfUserBrokerService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-04-06
*/
@Api(tags = "客户经纪")
@RestController
@RequestMapping("/user/broker")
public class DfUserBrokerController extends BaseController {
@Resource
private IDfUserBrokerService dfUserBrokerService;
/**
*
*/
@ApiOperation("分页查询客户经纪列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfUserBroker dfUserBroker) {
startPage();
LambdaQueryWrapper<DfUserBroker> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfUserBroker);
List<DfUserBroker> list = dfUserBrokerService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询客户经纪列表")
@GetMapping("/list")
public AjaxResult list(DfUserBroker dfUserBroker) {
LambdaQueryWrapper<DfUserBroker> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfUserBroker);
List<DfUserBroker> list = dfUserBrokerService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出客户经纪列表")
@Log(title = "客户经纪导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfUserBroker dfUserBroker) {
LambdaQueryWrapper<DfUserBroker> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfUserBroker);
List<DfUserBroker> list = dfUserBrokerService.list(queryWrapper);
ExcelUtil<DfUserBroker> util = new ExcelUtil<DfUserBroker>(DfUserBroker. class);
util.exportExcel(response, list, "客户经纪数据");
}
/**
*
*/
@ApiOperation("获取客户经纪详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(dfUserBrokerService.getById(id));
}
/**
*
*/
@ApiOperation("新增客户经纪")
@Log(title = "客户经纪新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfUserBroker dfUserBroker) {
return toAjax(dfUserBrokerService.save(dfUserBroker));
}
/**
*
*/
@ApiOperation("修改客户经纪")
@Log(title = "客户经纪修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfUserBroker dfUserBroker) {
return toAjax(dfUserBrokerService.updateById(dfUserBroker));
}
/**
*
*/
@ApiOperation("删除客户经纪")
@Log(title = "客户经纪删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(dfUserBrokerService.removeBatchByIds(ids));
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfUserBroker> queryWrapper,DfUserBroker dfUserBroker){
//id
if(Validator.isNotEmpty(dfUserBroker.getId())){
queryWrapper.eq(DfUserBroker::getId,dfUserBroker.getId());
}
//客户id
if(Validator.isNotEmpty(dfUserBroker.getUserId())){
queryWrapper.eq(DfUserBroker::getUserId,dfUserBroker.getUserId());
}
//经纪id
if(Validator.isNotEmpty(dfUserBroker.getBrokerId())){
queryWrapper.eq(DfUserBroker::getBrokerId,dfUserBroker.getBrokerId());
}
//创建部门
if(Validator.isNotEmpty(dfUserBroker.getCreateDept())){
queryWrapper.eq(DfUserBroker::getCreateDept,dfUserBroker.getCreateDept());
}
//创建人员
if(Validator.isNotEmpty(dfUserBroker.getCreateBy())){
queryWrapper.eq(DfUserBroker::getCreateBy,dfUserBroker.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(dfUserBroker.getCreateTime())){
queryWrapper.eq(DfUserBroker::getCreateTime,dfUserBroker.getCreateTime());
}
//修改人员
if(Validator.isNotEmpty(dfUserBroker.getUpdateBy())){
queryWrapper.eq(DfUserBroker::getUpdateBy,dfUserBroker.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(dfUserBroker.getUpdateTime())){
queryWrapper.eq(DfUserBroker::getUpdateTime,dfUserBroker.getUpdateTime());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(dfUserBroker.getDelFlag())){
queryWrapper.eq(DfUserBroker::getDelFlag,dfUserBroker.getDelFlag());
}
//租户id
if(Validator.isNotEmpty(dfUserBroker.getTenantId())){
queryWrapper.eq(DfUserBroker::getTenantId,dfUserBroker.getTenantId());
}
}
}

@ -0,0 +1,150 @@
package com.bs.df.domain;
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;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* 线 df_biz_clue
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_biz_clue")
@Data
public class DfBizClue extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 数据类型0客户1经纪 */
@Excel(name = "数据类型",dictType = "product_classify")
@ApiModelProperty(value = "数据类型")
private String dataType;
/** 线索类型 */
@Excel(name = "线索类型",dictType = "clue_type")
@ApiModelProperty(value = "线索类型")
private String clueType;
/** 用户id */
@ApiModelProperty(value = "用户id")
private Long userId;
/** 用户的唯一标识 */
@ApiModelProperty(value = "用户的唯一标识")
private String openId;
/** 公众号绑定id */
@ApiModelProperty(value = "公众号绑定id")
private String unionId;
@ApiModelProperty(value = "平台来源")
private String fromType;
/** 用户昵称 */
@Excel(name = "用户昵称")
@ApiModelProperty(value = "用户昵称")
private String nickName;
/** 用户名称 */
@ApiModelProperty(value = "用户名称")
private String userName;
/** 浏览时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "浏览时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "浏览时间")
private Date browseTime;
@Excel(name = "业务链接")
@ApiModelProperty(value = "业务链接")
private String businessLinks;
@Excel(name = "头像链接")
@ApiModelProperty(value = "头像链接")
private String avatarLink;
@Excel(name = "手机号")
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "分享用户")
private String shareUser;
@ApiModelProperty(value = "订单id")
private String orderId;
/** 访问数量 */
@TableField(exist = false)
private Integer visitsNum;
/** 客户数量 */
@TableField(exist = false)
private Integer userNum;
@TableField(exist = false)
private List<String> avatarLinks;
/**
* 012
*
* */
@TableField(exist = false)
private String classify;
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
private Date createTimeVo;
/**
* 1
*
* */
@TableField(exist = false)
private String hasOrder;
@TableField(exist = false)
private String oldUserId;
@TableField(exist = false)
private String newUserId;
@TableField(exist = false)
private Long brokerId;
@TableField(exist = false)
private String realName;
}

@ -0,0 +1,113 @@
package com.bs.df.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* df_broker
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_broker")
@Data
public class DfBroker extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 父级id */
//@Excel(name = "上级代理商")
@ApiModelProperty(value = "父级id")
private Long parentId;
@Excel(name = "上级代理商")
@ApiModelProperty(value = "代理商名称")
@TableField(exist = false)
private String parentName;
/** 代理商名称 */
@Excel(name = "代理商名称")
@ApiModelProperty(value = "代理商名称")
private String brokerName;
/** 地址 */
@Excel(name = "地址")
@ApiModelProperty(value = "地址")
private String brokerAddress;
/** 简介 */
@Excel(name = "简介")
@ApiModelProperty(value = "简介")
private String brokerDesc;
/** 显示顺序 */
@Excel(name = "显示顺序")
@ApiModelProperty(value = "显示顺序")
private Long orderNum;
/** 负责人 */
@Excel(name = "负责人")
@ApiModelProperty(value = "负责人")
private String chargePerson;
/** 联系电话 */
@Excel(name = "联系电话")
@ApiModelProperty(value = "联系电话")
private String contactPhone;
/** 邮箱 */
@Excel(name = "邮箱")
@ApiModelProperty(value = "邮箱")
private String email;
/** 是否机构 */
@Excel(name = "是否机构",dictType = "sys_yes_no")
@ApiModelProperty(value = "是否机构")
private String isInstitution;
/** 状态 */
@Excel(name = "状态",dictType = "df_broker_staus")
@ApiModelProperty(value = "状态")
private String staus;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
@TableField(exist = false)
private List<DfBroker> children;
@TableField(exist = false)
private Boolean isTopLevel;
}

@ -0,0 +1,73 @@
package com.bs.df.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* df_broker_product
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_broker_product")
@Data
public class DfBrokerProduct extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 代理id */
@Excel(name = "代理id")
@ApiModelProperty(value = "代理id")
private Long brokerId;
/** 产品id */
@Excel(name = "产品id")
@ApiModelProperty(value = "产品id")
private Long productId;
/** 用户id */
@Excel(name = "用户id")
@ApiModelProperty(value = "用户id")
private String userId;
/** 代理商类型 */
// @Excel(name = "代理商类型")
// @ApiModelProperty(value = "代理商类型")
// private String type;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
/** 状态0草稿1上架 */
@ApiModelProperty(value = "状态")
private String staus;
@TableField(exist = false)
private String brokerName;
}

@ -0,0 +1,186 @@
package com.bs.df.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* df_order
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_order")
@Data
public class DfOrder extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 订单号 */
@Excel(name = "订单号")
@ApiModelProperty(value = "订单号")
private String orderNo;
/** 客户id */
//@Excel(name = "客户id")
@ApiModelProperty(value = "客户id")
private Long userId;
// @ApiModelProperty(value = "访客id")
// private Long openId;
/** 客户id */
@Excel(name = "客户")
private String userName;
/** 经纪id */
//@Excel(name = "经纪id")
@ApiModelProperty(value = "经纪id")
private Long brokerId;
@Excel(name = "经纪人")
@TableField(exist = false)
private String brokerName;
@Excel(name = "经纪人电话")
@TableField(exist = false)
private String brokerPhone;
/** 产品id */
//@Excel(name = "产品id")
@ApiModelProperty(value = "产品id")
private Long productId;
/** 产品名称 */
@Excel(name = "产品名称")
@ApiModelProperty(value = "产品名称")
private String productName;
/** 提交时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "提交时间")
private Date submitTime;
/** 申请额(万元) */
@Excel(name = "申请额")
@ApiModelProperty(value = "申请额(万元)")
private BigDecimal applyAmount;
/** 授信额(万元) */
@Excel(name = "授信额")
@ApiModelProperty(value = "授信额(万元)")
private BigDecimal limitAmount;
/** 放款额(万元) */
@Excel(name = "放款额")
@ApiModelProperty(value = "放款额(万元)")
private BigDecimal loanAmount;
/** 放款利率 */
@Excel(name = "放款利率")
@ApiModelProperty(value = "放款利率")
private BigDecimal loanRate;
/** 贷款期限(月) */
@Excel(name = "贷款期限")
@ApiModelProperty(value = "贷款期限(月)")
private Long loadMonth;
/** 是否首贷 */
@Excel(name = "是否首贷")
@ApiModelProperty(value = "是否首贷")
private String isFirst;
/** 可结算金额(万元) */
@Excel(name = "可结算金额")
@ApiModelProperty(value = "可结算金额(万元)")
private Long settleAmount;
/** 状态 */
@Excel(name = "状态")
@ApiModelProperty(value = "状态")
private String staus;
/** 联系方式 */
@Excel(name = "联系方式")
@ApiModelProperty(value = "联系方式")
private String phone;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "分享用户")
private String shareUser;
/** 用户的唯一标识 */
@ApiModelProperty(value = "用户的唯一标识")
private String openId;
/** 公众号绑定id */
@ApiModelProperty(value = "公众号绑定id")
private String unionId;
@ApiModelProperty(value = "平台来源")
private String fromType;
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
private Date createTimeVo;
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField(exist = false)
private Date submitTimeBegin;
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField(exist = false)
private Date submitTimeEnd;
@TableField(exist = false)
private String orderByColumn;
@TableField(exist = false)
private String isAsc;
@TableField(exist = false)
private String userOrProduct;
}

@ -0,0 +1,99 @@
package com.bs.df.domain;
import java.util.Date;
import java.util.List;
import com.bs.cm.domain.CmAttach;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* df_product_article
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_product_article")
@Data
public class DfProductArticle extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 文章id */
@TableId(value = "id",type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "文章id")
private String id;
/** 文章分类0产品文章1经纪文章 */
@Excel(name = "文章分类",dictType = "product_classify")
@ApiModelProperty(value = "文章分类0产品文章1经纪文章")
private String articleType;
/** 文章类型 */
@Excel(name = "文章类型",dictType = "article_kind")
@ApiModelProperty(value = "文章类型")
private String articleKind;
/** 文章标题 */
@Excel(name = "文章标题")
@ApiModelProperty(value = "文章标题")
private String articleTitle;
/** 发布时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "发布时间")
private Date publishTime;
/** 文章正文 */
@Excel(name = "文章正文")
@ApiModelProperty(value = "文章正文")
private String articleContent;
/** 状态0草稿1上架 */
@Excel(name = "状态",dictType = "product_status")
@ApiModelProperty(value = "状态0草稿1上架")
private String status;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
@Excel(name = "序号")
@ApiModelProperty(value = "序号")
private String serialNumber;
@TableField(exist = false)
private String publishTimeBegin;
@TableField(exist = false)
private String publishTimeEnd;
@TableField(exist = false)
private String[] ids;
@TableField(exist = false)
private List<CmAttach> files;
@TableField(exist = false)
private String orderByColumn;
}

@ -0,0 +1,208 @@
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;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* df_product_info
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_product_info")
@Data
public class DfProductInfo extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 产品id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "产品id")
private Long id;
@Excel(name = "所属代理商")
@TableField(exist = false)
private String brokerName;
/** 产品名称 */
@Excel(name = "产品名称")
@ApiModelProperty(value = "产品名称")
private String productName;
/** 产品简称 */
@Excel(name = "产品简称")
@ApiModelProperty(value = "产品简称")
private String simpleName;
/** 产品类型 */
@Excel(name = "产品类型",dictType = "product_type")
@ApiModelProperty(value = "产品类型")
private String productType;
/** 产品细类 */
@Excel(name = "产品细类")
@ApiModelProperty(value = "产品细类")
private String productSubtype;
/** 贷款期限 */
@Excel(name = "贷款期限")
@ApiModelProperty(value = "贷款期限")
private String loanTerm;
/** 最高额度(元) */
@Excel(name = "最高额度(元)")
@ApiModelProperty(value = "最高额度(元)")
private Long maxAmount;
/** 年利率(单利) */
//@Excel(name = "年利率", readConverterExp = "单=利")
@ApiModelProperty(value = "年利率(单利)")
private BigDecimal interestRateBegin;
//@Excel(name = "年利率止", readConverterExp = "单=利")
@ApiModelProperty(value = "年利率(单利)")
private BigDecimal interestRateEnd;
@Excel(name = "年利率(单利)")
@TableField(exist = false)
private String interestRate;
/** 产品简介 */
@Excel(name = "产品简介")
@ApiModelProperty(value = "产品简介")
private String productIntro;
/** 产品详情(富文本) */
@Excel(name = "产品详情")
@ApiModelProperty(value = "产品详情(富文本)")
private String productDetail;
/** 上架时间起 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上架时间起", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "上架时间起")
private Date listBegin;
/** 上架时间止 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上架时间止", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "上架时间止")
private Date listEnd;
/** 还款周期 */
@Excel(name = "还款周期")
@ApiModelProperty(value = "还款周期")
private String repaymentCycle;
/** 还款方式 */
@Excel(name = "还款方式")
@ApiModelProperty(value = "还款方式")
private String repaymentMethod;
/** 展业城市 */
@Excel(name = "展业城市")
@ApiModelProperty(value = "展业城市")
private String businessCity;
/** 综合费率 */
@Excel(name = "综合费率")
@ApiModelProperty(value = "综合费率")
private String combinedRates;
/** 状态0草稿1上架 */
@Excel(name = "状态",dictType = "product_status")
@ApiModelProperty(value = "状态0草稿1上架")
private String status;
/** 申请链接 */
@Excel(name = "申请链接")
@ApiModelProperty(value = "申请链接")
private String applicationLink;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
@Excel(name = "序号")
@ApiModelProperty(value = "序号")
private String serialNumber;
@TableField(exist = false)
private Long maxAmountBegin;
@TableField(exist = false)
private Long maxAmountEnd;
@TableField(exist = false)
private String businessCityByName;
/** 判断是否根据代理商查询0为是 */
@TableField(exist = false)
private String selectByBroker;
@TableField(exist = false)
private String brokerIds;
//申请人数
@TableField(exist = false)
private Long applicantNum;
@TableField(exist = false)
private Long brokerId;
@TableField(exist = false)
private String userId;
@TableField(exist = false)
private Long[] ids;
//是否启动代理商权限
@TableField(exist = false)
private String isBroker;
@TableField(exist = false)
private String isSelectBroker;
@TableField(exist = false)
private String orderByColumn;
@TableField(exist = false)
private String isRecommend;
}

@ -0,0 +1,80 @@
package com.bs.df.domain;
import com.bs.cm.domain.CmAttach;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* df_product_moment
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_product_moment")
@Data
public class DfProductMoment extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 朋友圈id */
@TableId(value = "id",type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "朋友圈id")
private String id;
/** 朋友圈分类0产品朋友圈1经纪朋友圈 */
@Excel(name = "朋友圈分类",dictType = "product_classify")
@ApiModelProperty(value = "朋友圈分类0产品朋友圈1经纪朋友圈")
private String momentType;
/** 朋友圈类型 */
@Excel(name = "朋友圈类型",dictType = "moment_kind")
@ApiModelProperty(value = "朋友圈类型")
private String momentKind;
/** 朋友圈标题 */
@Excel(name = "朋友圈标题")
@ApiModelProperty(value = "朋友圈标题")
private String momentTitle;
/** 朋友圈正文 */
@Excel(name = "朋友圈正文")
@ApiModelProperty(value = "朋友圈正文")
private String momentContent;
/** 状态0草稿1上架 */
@Excel(name = "状态",dictType = "product_status")
@ApiModelProperty(value = "状态0草稿1上架")
private String status;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
@TableField(exist = false)
private String[] ids;
@TableField(exist = false)
private List<CmAttach> files;
@TableField(exist = false)
private String orderByColumn;
}

@ -0,0 +1,95 @@
package com.bs.df.domain;
import com.bs.cm.domain.CmAttach;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* df_product_poster
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_product_poster")
@Data
public class DfProductPoster extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 海报id */
@TableId(value = "id",type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "海报id")
private String id;
/** 产品id */
//@Excel(name = "产品id")
@ApiModelProperty(value = "产品id")
private Long productId;
@Excel(name = "产品名称")
@TableField(exist = false)
private String productName;
/** 海报分类0产品海报1经纪海报 */
@Excel(name = "海报分类",dictType = "product_classify")
@ApiModelProperty(value = "海报分类0产品海报1经纪海报")
private String posterType;
/** 海报名称 */
@Excel(name = "海报名称")
@ApiModelProperty(value = "海报名称")
private String posterName;
/** 海报标签 */
@Excel(name = "海报标签",dictType = "poster_tag")
@ApiModelProperty(value = "海报标签")
private String posterTag;
/** 海报图片id */
@Excel(name = "海报图片")
@ApiModelProperty(value = "海报图片id")
private String posterFileId;
/** 状态0草稿1上架 */
@Excel(name = "状态",dictType = "product_status")
@ApiModelProperty(value = "状态0草稿1上架")
private String status;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
@Excel(name = "序号")
@ApiModelProperty(value = "序号")
private String serialNumber;
@TableField(exist = false)
private String[] ids;
@TableField(exist = false)
private List<CmAttach> files;
@TableField(exist = false)
private String orderByColumn;
}

@ -0,0 +1,48 @@
package com.bs.df.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* df_product_recommend
*
* @author bs
* @date 2024-09-16
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_product_recommend")
@Data
public class DfProductRecommend extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "主键")
private Long id;
/** 用户id */
@Excel(name = "用户id")
@ApiModelProperty(value = "用户id")
private String userId;
/** 产品id */
@Excel(name = "产品id")
@ApiModelProperty(value = "产品id")
private String productId;
@TableField(exist = false)
private Long[] ids;
}

@ -0,0 +1,47 @@
package com.bs.df.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* df_user_broker
*
* @author bs
* @date 2024-04-06
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_user_broker")
@Data
public class DfUserBroker extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/** 客户id */
@Excel(name = "客户id")
@ApiModelProperty(value = "客户id")
private Long userId;
/** 经纪id */
@Excel(name = "经纪id")
@ApiModelProperty(value = "经纪id")
private Long brokerId;
}

@ -0,0 +1,20 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfBizClue;
import com.bs.df.domain.DfOrder;
import org.apache.ibatis.annotations.Param;
/**
* 线Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfBizClueMapper extends BaseMapperX<DfBizClue> {
Boolean insertClue(@Param("dfBizClue") DfBizClue dfBizClue);
Boolean updateClue(@Param("dfBizClue") DfBizClue dfBizClue);
}

@ -0,0 +1,16 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfBroker;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfBrokerMapper extends BaseMapperX<DfBroker> {
void updateByNull(@Param("dfBroker") DfBroker dfBroker);
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfBrokerProduct;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfBrokerProductMapper extends BaseMapperX<DfBrokerProduct> {
}

@ -0,0 +1,20 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfOrder;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfOrderMapper extends BaseMapperX<DfOrder> {
Boolean insertOrder(@Param("dfOrder")DfOrder dfOrder);
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfProductArticle;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfProductArticleMapper extends BaseMapperX<DfProductArticle> {
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfProductInfo;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfProductInfoMapper extends BaseMapperX<DfProductInfo> {
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfProductMoment;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfProductMomentMapper extends BaseMapperX<DfProductMoment> {
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfProductPoster;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfProductPosterMapper extends BaseMapperX<DfProductPoster> {
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfProductRecommend;
/**
* Mapper
*
* @author bs
* @date 2024-09-16
*/
public interface DfProductRecommendMapper extends BaseMapperX<DfProductRecommend> {
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfUserBroker;
/**
* Mapper
*
* @author bs
* @date 2024-04-06
*/
public interface DfUserBrokerMapper extends BaseMapperX<DfUserBroker> {
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfBizClue;
/**
* 线Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfBizClueService extends MPJBaseService<DfBizClue>{
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfBrokerProduct;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfBrokerProductService extends MPJBaseService<DfBrokerProduct>{
}

@ -0,0 +1,47 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfBroker;
import java.util.List;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfBrokerService extends MPJBaseService<DfBroker>{
/**
* id
* @return
*/
public List<Long> filterByUser();
/**
* id
* @return
*/
public List<Long> filterByUserId(Long userId);
/**
* id
* @return
*/
public List<DfBroker> findAllSubordinates(Long brokerId);
/**
* idid
* @return id
*/
public List<Long> getProductIdsByBrokerId();
/**
* idid
* @return id
*/
public List<Long> getProductIdsByBrokerIdByUserId(Long userId);
}

@ -0,0 +1,19 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfOrder;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfOrderService extends MPJBaseService<DfOrder>{
/**
* ++RK202310010001
* @param billPrefix
* @return billPrefix+
*/
public String getBillNumber(String billPrefix);
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfProductArticle;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfProductArticleService extends MPJBaseService<DfProductArticle>{
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfProductInfo;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfProductInfoService extends MPJBaseService<DfProductInfo>{
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfProductMoment;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfProductMomentService extends MPJBaseService<DfProductMoment>{
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfProductPoster;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfProductPosterService extends MPJBaseService<DfProductPoster>{
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfProductRecommend;
/**
* Service
*
* @author bs
* @date 2024-09-16
*/
public interface IDfProductRecommendService extends MPJBaseService<DfProductRecommend>{
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfUserBroker;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
public interface IDfUserBrokerService extends MPJBaseService<DfUserBroker>{
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfBizClueMapper;
import com.bs.df.domain.DfBizClue;
import com.bs.df.service.IDfBizClueService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 线Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfBizClueServiceImpl extends MPJBaseServiceImpl<DfBizClueMapper, DfBizClue> implements IDfBizClueService {
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfBrokerProductMapper;
import com.bs.df.domain.DfBrokerProduct;
import com.bs.df.service.IDfBrokerProductService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfBrokerProductServiceImpl extends MPJBaseServiceImpl<DfBrokerProductMapper, DfBrokerProduct> implements IDfBrokerProductService {
}

@ -0,0 +1,91 @@
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
*
* @author bs
* @date 2024-04-06
*/
@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<Long> filterByUserId(Long userId) {
SysUser sysUser = userService.selectUserById(userId);
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")
.or()
.in(DfBrokerProduct::getUserId, SecurityUtils.getUserId()));
return list.stream().map(DfBrokerProduct::getProductId).collect(Collectors.toList());
}
public List<Long> getProductIdsByBrokerIdByUserId(Long UserId) {
List<Long> longs = filterByUserId(UserId);
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());
}
}

@ -0,0 +1,44 @@
package com.bs.df.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.common.utils.DateUtils;
import com.bs.common.utils.StringUtils;
import com.bs.df.mapper.DfOrderMapper;
import com.bs.df.domain.DfOrder;
import com.bs.df.service.IDfOrderService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfOrderServiceImpl extends MPJBaseServiceImpl<DfOrderMapper, DfOrder> implements IDfOrderService {
@Resource
private IDfOrderService dfOrderService;
@Override
public String getBillNumber(String billPrefix) {
String billNo = "";
if (StringUtils.isBlank(billPrefix)) {
billPrefix = "DD";
}
String billDate = DateUtils.dateTimeNow("yyyyMMdd");
List<DfOrder> lsBill = dfOrderService.list(new LambdaQueryWrapper<DfOrder>().like(DfOrder::getOrderNo, billPrefix + billDate)
.orderByDesc(DfOrder::getId));
if (lsBill.size() == 0) {
billNo = billPrefix + billDate + String.format("%04d", 1);
return billNo;
}
Long id = lsBill.get(0).getId();
billNo = billPrefix + billDate + String.format("%04d", id + 1);
return billNo;
}
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfProductArticleMapper;
import com.bs.df.domain.DfProductArticle;
import com.bs.df.service.IDfProductArticleService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfProductArticleServiceImpl extends MPJBaseServiceImpl<DfProductArticleMapper, DfProductArticle> implements IDfProductArticleService {
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfProductInfoMapper;
import com.bs.df.domain.DfProductInfo;
import com.bs.df.service.IDfProductInfoService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfProductInfoServiceImpl extends MPJBaseServiceImpl<DfProductInfoMapper, DfProductInfo> implements IDfProductInfoService {
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfProductMomentMapper;
import com.bs.df.domain.DfProductMoment;
import com.bs.df.service.IDfProductMomentService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfProductMomentServiceImpl extends MPJBaseServiceImpl<DfProductMomentMapper, DfProductMoment> implements IDfProductMomentService {
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfProductPosterMapper;
import com.bs.df.domain.DfProductPoster;
import com.bs.df.service.IDfProductPosterService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfProductPosterServiceImpl extends MPJBaseServiceImpl<DfProductPosterMapper, DfProductPoster> implements IDfProductPosterService {
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfProductRecommendMapper;
import com.bs.df.domain.DfProductRecommend;
import com.bs.df.service.IDfProductRecommendService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-09-16
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfProductRecommendServiceImpl extends MPJBaseServiceImpl<DfProductRecommendMapper, DfProductRecommend> implements IDfProductRecommendService {
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfUserBrokerMapper;
import com.bs.df.domain.DfUserBroker;
import com.bs.df.service.IDfUserBrokerService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-04-06
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfUserBrokerServiceImpl extends MPJBaseServiceImpl<DfUserBrokerMapper, DfUserBroker> implements IDfUserBrokerService {
}

@ -68,7 +68,7 @@ public class SysRegisterController extends BaseController
public AjaxResult register(@RequestBody RegisterBody user)
{
// if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
// {1
// {
// return error("当前系统没有开启注册功能!");
// }
String msg = registerService.register(user);

Loading…
Cancel
Save