diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfBizClueController.java b/bs-admin/src/main/java/com/bs/df/controller/DfBizClueController.java new file mode 100644 index 0000000..4810b33 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfBizClueController.java @@ -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 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 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 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 list = dfBizClueService.list(queryWrapper); + Map 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 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 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 sortedList = newList.stream() + .sorted((o1, o2) -> o2.getBrowseTime().compareTo(o1.getBrowseTime())) // 倒序 + .collect(Collectors.toList()); + Integer start = (pageNum - 1) * pageSize; + List 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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBizClue); + List 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 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 list = dfBizClueService.list(queryWrapper); + for (DfBizClue clue : list) { + if (Validator.isNotEmpty(clue.getUserName())) { + clue.setNickName(clue.getUserName()); + } + } + List uniqueList = list.stream() + .collect(Collectors.toMap( + DfBizClue::getUserId, // 指定键的抽取函数 + dfBizClueVo -> dfBizClueVo, // 指定值的映射函数 + (existing, replacement) -> existing // 处理重复键的方式,这里选择保留第一个出现的元素 + )) + .values() + .stream() + .collect(Collectors.toList()); + List 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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBizClue); + List list = dfBizClueService.list(queryWrapper); + for (DfBizClue clue : list) { + if (Validator.isNotEmpty(clue.getUserName())) { + clue.setNickName(clue.getUserName()); + } + } + ExcelUtil util = new ExcelUtil(DfBizClue. class); + util.exportExcel(response, list, "业务线索数据"); + } + + /** + * 获取业务线索详细信息 + */ + @ApiOperation("获取业务线索详细信息") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + DfBizClue byId = dfBizClueService.getById(id); + List list = userService.list(new LambdaQueryWrapper().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 list = dfBizClueService.list(new LambdaQueryWrapper() + .eq(DfBizClue::getShareUser, dfBizClue.getOldUserId())); + if (list.size() > 0) { + for (DfBizClue dfBizClueNew : list) { + dfBizClueNew.setShareUser(dfBizClue.getNewUserId()); + } + dfBizClueService.updateBatchById(list); + } + List userBrokerList = dfUserBrokerService.list(new LambdaQueryWrapper() + .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 ids) { + return toAjax(dfBizClueService.removeBatchByIds(ids)); + } + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfBrokerController.java b/bs-admin/src/main/java/com/bs/df/controller/DfBrokerController.java new file mode 100644 index 0000000..0543562 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfBrokerController.java @@ -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 queryWrapper = new LambdaQueryWrapper(); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List longs = dfBrokerService.filterByUser(); + queryWrapper.in(DfBroker::getId, longs); + } + queryWrapper.orderByAsc(DfBroker::getOrderNum); + condition(queryWrapper,dfBroker); + List list = dfBrokerService.list(queryWrapper); + for (DfBroker broker : list) { + broker.setBrokerDesc(HtmlUtils.stripHtmlTags(broker.getBrokerDesc())); + } +// List treeList = buildTree(list); + return getDataTable(list); + } + + public List buildTree(List list) { + List treeList = new ArrayList<>(); + Map 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 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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBroker); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List longs = dfBrokerService.filterByUser(); + queryWrapper.in(DfBroker::getId, longs); + } + List list = dfBrokerService.list(queryWrapper); + return success(list); + } + + /** + * 查询代理商经纪树 + */ + @ApiOperation("查询代理商经纪列表") + @GetMapping("/listByTree") + public AjaxResult listByTree(DfBroker dfBroker) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBroker); + List list = dfBrokerService.list(queryWrapper); + List treeList = buildTree(list); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + List longs = dfBrokerService.filterByUser(); + treeList = filterTree(treeList, longs); +// queryWrapper.in(DfBroker::getId, longs); + } + return success(treeList); + } + + private List filterTree(List treeList, List idList) { + List filteredList = new ArrayList<>(); + for (DfBroker broker : treeList) { + // 如果当前节点的 ID 在列表中,则将其加入到结果列表中 + if (idList.contains(broker.getId())) { + filteredList.add(broker); + } + // 如果当前节点有子节点,则递归调用该方法对其子节点进行过滤 + if (broker.getChildren() != null && !broker.getChildren().isEmpty()) { + List children = filterTree(broker.getChildren(), idList); + // 如果子节点也被过滤掉了,则不加入到结果列表中 + if (!children.isEmpty()) { + broker.setChildren(children); + filteredList.add(broker); + } + } + } + return filteredList; + } + + + /** + * 导出代理商经纪列表 + */ + @ApiOperation("导出代理商经纪列表") + @Log(title = "代理商经纪导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfBroker dfBroker) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBroker); + List list = dfBrokerService.list(queryWrapper); + List listAll = dfBrokerService.list(); + Map 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 util = new ExcelUtil(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 ids) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.in(DfBroker::getParentId,ids); + if(dfBrokerService.list(queryWrapper).size()>0){ + return AjaxResult.warn("请先删除子节点"); + } + LambdaQueryWrapper 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 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfBrokerProductController.java b/bs-admin/src/main/java/com/bs/df/controller/DfBrokerProductController.java new file mode 100644 index 0000000..60612cb --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfBrokerProductController.java @@ -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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBrokerProduct); + List list = dfBrokerProductService.list(queryWrapper); + return getDataTable(list); + } + + /** + * 查询代理产品权限列表 + */ + @ApiOperation("查询代理产品权限列表") + @GetMapping("/list") + public AjaxResult list(DfBrokerProduct dfBrokerProduct) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBrokerProduct); + List list = dfBrokerProductService.list(queryWrapper); + return success(list); + } + + /** + * 导出代理产品权限列表 + */ + @ApiOperation("导出代理产品权限列表") + @Log(title = "代理产品权限导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfBrokerProduct dfBrokerProduct) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfBrokerProduct); + List list = dfBrokerProductService.list(queryWrapper); + ExcelUtil util = new ExcelUtil(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 ids) { + return toAjax(dfBrokerProductService.removeBatchByIds(ids)); + } + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfOrderController.java b/bs-admin/src/main/java/com/bs/df/controller/DfOrderController.java new file mode 100644 index 0000000..eb89141 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfOrderController.java @@ -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 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 list = dfOrderService.list(queryWrapper); + List 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 result = dfOrders.stream() + .skip(start) + .limit(pageSize) + .collect(Collectors.toList()); + TableDataInfo data = getDataTable(result); + data.setTotal(dfOrders.size()); + return data; + } + + public void applyOrderBy(LambdaQueryWrapper 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 setOrderList(List list) { + List userList = userService.list(); + Map userIdToRealNameMapVo = userList.stream() + .filter(user -> user != null && user.getUserId() != null && user.getRealName() != null) + .collect(Collectors.toMap(SysUser::getUserId, SysUser::getRealName)); + Map userIdToPhoneMapVo = userList.stream() + .filter(user -> user != null && user.getUserId() != null && user.getPhonenumber() != null) + .collect(Collectors.toMap(SysUser::getUserId, SysUser::getPhonenumber)); + Map userIdToNickNameMapVo = userList.stream() + .filter(user -> user != null && user.getUserId() != null && user.getNickName() != null) + .collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName)); + + Map 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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper, dfOrder); + queryWrapper.orderByDesc(DfOrder::getCreateTime); + List list = dfOrderService.list(queryWrapper); + return success(list); + } + + /** + * 导出客户订单列表 + */ + @ApiOperation("导出客户订单列表") + @Log(title = "客户订单导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfOrder dfOrder) { + LambdaQueryWrapper 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 list = dfOrderService.list(queryWrapper); + List 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 util = new ExcelUtil(DfOrder.class); + util.exportExcel(response, dfOrders, "客户订单数据"); + } + + /** + * 获取客户订单详细信息 + */ + @ApiOperation("获取客户订单详细信息") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + DfOrder byId = dfOrderService.getById(id); + List list = userService.list(new LambdaQueryWrapper().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 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 dfOrders = dfOrderService.list(new LambdaQueryWrapper().eq(DfOrder::getOrderNo, billNumber) + .orderByDesc(DfOrder::getCreateTime)); +// if (Validator.isNotEmpty(dfOrder.getShareUser())) { +// List list = dfBizClueService.list(new LambdaQueryWrapper().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 list = dfBizClueService.list(new LambdaQueryWrapper().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 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 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductArticleController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductArticleController.java new file mode 100644 index 0000000..4c47175 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductArticleController.java @@ -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 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 list = dfProductArticleService.list(queryWrapper); + for (DfProductArticle article : list) { + article.setArticleContent(HtmlUtils.stripHtmlTags(article.getArticleContent())); + } + List attachVo = cmAttachService.list(); + Map> 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 matchingAttachments = attachMap.get(String.valueOf(id)); + if (matchingAttachments != null) { + article.setFiles(matchingAttachments); + } + } + return getDataTable(list); + } + + /** + * 查询产品文章列表 + */ + @ApiOperation("查询产品文章列表") + @GetMapping("/list") + public AjaxResult list(DfProductArticle dfProductArticle) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductArticle); + List list = dfProductArticleService.list(queryWrapper); + return success(list); + } + + /** + * 导出产品文章列表 + */ + @ApiOperation("导出产品文章列表") + @Log(title = "产品文章导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfProductArticle dfProductArticle) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductArticle); + List list = dfProductArticleService.list(queryWrapper); + for (DfProductArticle article : list) { + //去除富文本中的HTML标签 + article.setArticleContent(HtmlUtils.stripHtmlTags(article.getArticleContent())); + } + ExcelUtil util = new ExcelUtil(DfProductArticle. class); + util.exportExcel(response, list, "产品文章数据"); + } + + /** + * 获取产品文章详细信息 + */ + @ApiOperation("获取产品文章详细信息") + @GetMapping(value = "/{id}") + @Anonymous + public AjaxResult getInfo(@PathVariable("id") String id) { + DfProductArticle byId = dfProductArticleService.getById(id); + List attachVo = cmAttachService.list(new LambdaQueryWrapper().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 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 ids) { + List list = dfProductArticleService.list(new LambdaQueryWrapper() + .in(DfProductArticle::getId, ids)); + for (DfProductArticle dfProductArticle : list) { + if ("1".equals(dfProductArticle.getStatus())) { + return AjaxResult.warn("该产品文章已经上架,请先下架再删除"); + } + } + return toAjax(dfProductArticleService.removeBatchByIds(ids)); + } + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductInfoController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductInfoController.java new file mode 100644 index 0000000..b87cda9 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductInfoController.java @@ -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 list = selectInfo(dfProductInfo,sysUser,false); + return getDataTable(list); + } + + /** + * 分页查询产品信息列表 + */ + @ApiOperation("分页查询产品信息列表") + @GetMapping("/pageListVo") + @Anonymous + public TableDataInfo pageListVo(DfProductInfo dfProductInfo) { + SysUser sysUser = sysUserMapper.selectById(dfProductInfo.getUserId()); + List list = selectInfo(dfProductInfo,sysUser,true); + return getDataTable(list); + } + + private List selectInfo(DfProductInfo dfProductInfo,SysUser sysUser,boolean isAnonymous) { + String reviewStatus = sysUser.getReviewStatus(); + if ("1".equals(reviewStatus)) { + return null; + } + LambdaQueryWrapper 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 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 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 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 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 list = dfProductInfoService.list(queryWrapper); + List dfOrders = dfOrderService.list(); + Map 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 cityMap = new HashMap<>(); + List 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 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 list = dfProductInfoService.list(queryWrapper); + return success(list); + } + + /** + * 根据userId查询产品信息列表 + */ + @ApiOperation("根据userId查询产品信息列表") + @GetMapping("/listByUserId") + public AjaxResult listByUserId(DfProductInfo dfProductInfo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + List 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 list = dfProductInfoService.list(queryWrapper); + Set idsToRemove = productIdsByBrokerIdByUserId.stream().collect(Collectors.toSet()); + List 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 dfProductRecommends = dfProductRecommendService.list(new LambdaQueryWrapper().eq(DfProductRecommend::getUserId, dfProductInfo.getUserId())); + List recommendProductIds = dfProductRecommends.stream() + .map(DfProductRecommend::getProductId) // 提取 String 类型的 productId + .map(Long::parseLong) // 将 String 转换为 Long + .collect(Collectors.toList()); // 收集为 List + recommendProductIds.add(0L); + List brokerProductIds = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfProductInfo.getUserId())); + List productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfProductInfo.getUserId())); + if (productIdsByBrokerIdByUserId.isEmpty()) { + productIdsByBrokerIdByUserId.add(0L); // 添加默认值避免空集合错误 + } + Set allProductIds = new HashSet<>(); + allProductIds.addAll(recommendProductIds); + allProductIds.addAll(brokerProductIds); + allProductIds.addAll(productIdsByBrokerIdByUserId); + allProductIds.add(0L); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.notIn(DfProductInfo::getId, recommendProductIds) // 排除推荐的产品 + .in(DfProductInfo::getId, allProductIds) // 包含经纪人产品和broker产品 + .or() + .eq(DfProductInfo::getId, dfProductInfo.getId()); // 或者直接匹配当前产品ID + + condition(queryWrapper, dfProductInfo); + List list = dfProductInfoService.list(queryWrapper); + return success(list); + } + + + /** + * 根据代理商经纪id查询产品信息列表 + */ + @ApiOperation("根据代理商经纪id查询产品信息列表") + @GetMapping("/listByBroker") + public AjaxResult listByBroker(DfProductInfo dfProductInfo) { +// Long userId = SecurityUtils.getUserId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + DfBroker broker = dfBrokerService.getById(dfProductInfo.getBrokerId()); + if (Validator.isEmpty(broker.getParentId())) { + List listBrokerProduct = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, broker.getId()) + .eq(DfBrokerProduct::getStaus, "1")); + List productIds = listBrokerProduct.stream() + .map(DfBrokerProduct::getProductId) + .collect(Collectors.toList()); + productIds.removeIf(id -> 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 listBrokerProduct = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, broker.getParentId()) + .eq(DfBrokerProduct::getStaus, "1")); + List productIds = listBrokerProduct.stream() + .map(DfBrokerProduct::getProductId) + .collect(Collectors.toList()); + if (null != productIds && productIds.size() == 0) { + productIds.add(0L); + } + queryWrapper.in(DfProductInfo::getId, productIds); + List listProduct = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, broker.getId()) + .eq(DfBrokerProduct::getStaus, "1")); + List productIdsNew = listProduct.stream() + .map(DfBrokerProduct::getProductId) + .collect(Collectors.toList()); + productIdsNew.removeIf(id -> id.equals(dfProductInfo.getId())); + if (null != productIdsNew && productIdsNew.size() == 0) { + productIdsNew.add(0L); + } + queryWrapper.notIn(DfProductInfo::getId, productIdsNew); + } + queryWrapper.eq(DfProductInfo::getStatus, "1"); + condition(queryWrapper,dfProductInfo); + List list = dfProductInfoService.list(queryWrapper); + return success(list); + } + + /** + * 导出产品信息列表 + */ + @ApiOperation("导出产品信息列表") + @Log(title = "产品信息导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfProductInfo dfProductInfo) { + Map cityMap = new HashMap<>(); + List allCities = dfAreaService.list(); + for (DfArea city : allCities) { + cityMap.put(city.getAreaId(), city.getName()); + } + Map brokerProductMap = new HashMap<>(); + List listBroker = dfBrokerService.list(); + Map brokerMap = new HashMap<>(); + for (DfBroker broker : listBroker) { + brokerMap.put(broker.getId(), broker.getBrokerName()); + } + List listBrokerProduct = dfBrokerProductService.list(); + for (DfBrokerProduct brokerProduct : listBrokerProduct) { + String brokerName = brokerMap.get(brokerProduct.getBrokerId()); + brokerProduct.setBrokerName(brokerName); + } + for (DfBrokerProduct brokerProduct : listBrokerProduct) { + brokerProductMap.put(brokerProduct.getProductId(), brokerProduct.getBrokerName()); + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductInfo); + List 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 util = new ExcelUtil(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 list = dfBrokerProductService.list(new LambdaQueryWrapper().eq(DfBrokerProduct::getProductId, id)); + List dfOrders = dfOrderService.list(); + Map 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 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 businessCityList = Arrays.asList(businessCity.split(",")); + List douAreas = dfAreaService.listByIds(businessCityList); + String concatenatedNames = douAreas.stream() + .map(DfArea::getName) + .collect(Collectors.joining(",")); + byId.setBusinessCityByName(concatenatedNames); + + + return success(byId); + } + + /** + * 根据经纪人获取产品信息详细信息 + */ + @ApiOperation("根据经纪人获取产品信息详细信息") + @GetMapping(value = "/getInfoByUserId/{id}") + @Anonymous + public AjaxResult getInfoByUserId(@PathVariable("id") Long id) { + List productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(id); + if (productIdsByBrokerIdByUserId.size() == 0) { + return success(null); + } + List list = dfProductInfoService.list(new LambdaQueryWrapper().in(DfProductInfo::getId, productIdsByBrokerIdByUserId)); + for (DfProductInfo productInfo : list) { + productInfo.setProductDetail(null); + } + List dfOrders = dfOrderService.list(); + Map 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 list = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getBrokerId, dfProductInfo.getBrokerId()) + .eq(DfBrokerProduct::getProductId, dfProductInfo.getId())); + if (list.size() > 0 && list != null) { + byId.setBrokerId(list.get(0).getBrokerId()); + } + String businessCity = byId.getBusinessCity(); + if (Validator.isEmpty(businessCity)) { + return success(byId); + } + List businessCityList = Arrays.asList(businessCity.split(",")); + List douAreas = dfAreaService.listByIds(businessCityList); + String concatenatedNames = douAreas.stream() + .map(DfArea::getName) + .collect(Collectors.joining(",")); + byId.setBusinessCityByName(concatenatedNames); + return success(byId); + } else { + DfProductInfo byId = dfProductInfoService.getById(dfProductInfo.getId()); + List list = dfBrokerProductService.list(new LambdaQueryWrapper() + .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 businessCityList = Arrays.asList(businessCity.split(",")); + List douAreas = dfAreaService.listByIds(businessCityList); + String concatenatedNames = douAreas.stream() + .map(DfArea::getName) + .collect(Collectors.joining(",")); + byId.setBusinessCityByName(concatenatedNames); + return success(byId); + } + + } + + /** + * 新增产品信息 + */ + @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 ids) { + List list = dfProductPosterService.list(new LambdaQueryWrapper().in(DfProductPoster::getProductId, ids)); + List infos = dfProductInfoService.list(new LambdaQueryWrapper().in(DfProductInfo::getId, ids)); + for (DfProductInfo dfProductInfo : infos) { + if ("1".equals(dfProductInfo.getStatus())) { + return AjaxResult.warn("该产品已经上架,请先下架再删除"); + } + } + if(list.size() > 0){ + return AjaxResult.warn("该产品下有海报,请先删除海报"); + } + + return toAjax(dfProductInfoService.removeBatchByIds(ids)); + } + + /** + * 修改产品状态 + */ + @ApiOperation("修改产品状态") + @Log(title = "修改产品状态", businessType = BusinessType.DELETE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody DfProductInfo dfProductInfo) { + Long[] ids = dfProductInfo.getIds(); + String status = dfProductInfo.getStatus(); + List 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 list = dfBrokerProductService.list(new LambdaQueryWrapper().in(DfBrokerProduct::getProductId, ids)); + for (DfBrokerProduct dfBrokerProduct : list) { + dfBrokerProduct.setStaus("0"); + } + dfBrokerProductService.updateBatchById(list); + } + if ("1".equals(dfProductInfo.getIsBroker())) { + if ("1".equals(status)) { + List list = dfBrokerProductService.list(new LambdaQueryWrapper().in(DfBrokerProduct::getProductId, ids)); + for (DfBrokerProduct dfBrokerProduct : list) { + dfBrokerProduct.setStaus("1"); + } + dfBrokerProductService.updateBatchById(list); + } + } + return toAjax(dfProductInfoService.updateBatchById(dfProductInfos)); + } + + /** + * 获取产品相关代理商数量 + */ + @ApiOperation("获取产品相关代理商数量") + @GetMapping(value = "/getBrokerNum/{ids}") + public AjaxResult getBrokerNum(@PathVariable("ids") List ids) { + List list = dfBrokerProductService.list(new LambdaQueryWrapper().in(DfBrokerProduct::getProductId, ids)); + list.size(); + return success(list.size()); + } + + + /** + * 修改代理产品权限 + */ + @ApiOperation("修改代理产品权限") + @Log(title = "代理产品权限修改", businessType = BusinessType.UPDATE) + @PutMapping("/editByBroker") + public AjaxResult editByBroker(@RequestBody DfProductInfo dfProductInfo) { + Long productInfoId = dfProductInfo.getId(); + Long brokerId = dfProductInfo.getBrokerId(); + List list = dfBrokerProductService.list(new LambdaQueryWrapper().eq(DfBrokerProduct::getProductId, productInfoId) + .eq(DfBrokerProduct::getBrokerId, brokerId)); + if (list != null && list.size() > 0) { + DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId).setId(list.get(0).getId()); + dfBrokerProduct.setStaus("1"); + return toAjax(dfBrokerProductService.updateById(dfBrokerProduct)); + } else { + DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId); + dfBrokerProduct.setStaus("1"); + return toAjax(dfBrokerProductService.save(dfBrokerProduct)); + } + } + + /** + * 修改代理产品权限 + */ + @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 list = dfBrokerProductService.list(new LambdaQueryWrapper() + .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 list = dfBrokerProductService.list(new LambdaQueryWrapper() + .eq(DfBrokerProduct::getProductId, productInfoId) + .eq(DfBrokerProduct::getBrokerId, brokerId)); + if (list != null && list.size() > 0) { + DfBrokerProduct dfBrokerProduct = new DfBrokerProduct().setBrokerId(brokerId).setProductId(productInfoId).setId(list.get(0).getId()); + dfBrokerProduct.setStaus("1"); + 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() + .in(DfBrokerProduct::getProductId, ids) + .in(DfBrokerProduct::getUserId, dfProductInfo.getUserId())); + return toAjax(remove); + } else { + List allSubordinates = dfBrokerService.findAllSubordinates(brokerId); + List brokerIds = allSubordinates.stream() + .map(DfBroker::getId) + .collect(Collectors.toList()); + brokerIds.add(brokerId); + boolean remove = dfBrokerProductService.remove(new LambdaQueryWrapper() + .in(DfBrokerProduct::getProductId, ids) + .in(DfBrokerProduct::getBrokerId, brokerIds)); + return toAjax(remove); + } + } + + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductMomentController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductMomentController.java new file mode 100644 index 0000000..9a6dcec --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductMomentController.java @@ -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 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 list = dfProductMomentService.list(queryWrapper); + List attachVo = cmAttachService.list(); + Map> 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 matchingAttachments = attachMap.get(String.valueOf(id)); + if (matchingAttachments != null) { + moment.setFiles(matchingAttachments); + } + } + return getDataTable(list); + } + + /** + * 查询产品朋友圈列表 + */ + @ApiOperation("查询产品朋友圈列表") + @GetMapping("/list") + public AjaxResult list(DfProductMoment dfProductMoment) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductMoment); + List list = dfProductMomentService.list(queryWrapper); + return success(list); + } + + /** + * 导出产品朋友圈列表 + */ + @ApiOperation("导出产品朋友圈列表") + @Log(title = "产品朋友圈导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfProductMoment dfProductMoment) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductMoment); + List list = dfProductMomentService.list(queryWrapper); + for (DfProductMoment moment : list) { + moment.setMomentContent(HtmlUtils.stripHtmlTags(moment.getMomentContent())); + } + ExcelUtil util = new ExcelUtil(DfProductMoment. class); + util.exportExcel(response, list, "产品朋友圈数据"); + } + + /** + * 获取产品朋友圈详细信息 + */ + @ApiOperation("获取产品朋友圈详细信息") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + DfProductMoment byId = dfProductMomentService.getById(id); + List attachVo = cmAttachService.list(new LambdaQueryWrapper().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 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 ids) { + List list = dfProductMomentService.list(new LambdaQueryWrapper() + .in(DfProductMoment::getId, ids)); + for (DfProductMoment dfProductMoment : list) { + if ("1".equals(dfProductMoment.getStatus())) { + return AjaxResult.warn("该产品朋友圈已经上架,请先下架再删除"); + } + } + return toAjax(dfProductMomentService.removeBatchByIds(ids)); + } + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductPosterController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductPosterController.java new file mode 100644 index 0000000..a181a64 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductPosterController.java @@ -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 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 productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId(); + List list = dfProductPosterService.list(new LambdaQueryWrapper() + .eq(DfProductPoster::getPosterType, "1")); + List 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 list = dfProductPosterService.list(queryWrapper); + List attachVo = cmAttachService.list(); + Map> attachMap = attachVo.stream() + .filter(cmAttach -> cmAttach.getFileId() != null) + .collect(Collectors.groupingBy(CmAttach::getFileId)); + for (DfProductPoster dfProductPosterVo : list) { + String id = dfProductPosterVo.getId(); + List 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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductPoster); + List list = dfProductPosterService.list(queryWrapper); + return success(list); + } + + /** + * 导出产品海报列表 + */ + @ApiOperation("导出产品海报列表") + @Log(title = "产品海报导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfProductPoster dfProductPoster) { + MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper(); + queryWrapper.selectAll(DfProductPoster.class) + .select(DfProductInfo::getProductName) + .disableSubLogicDel() + .leftJoin(DfProductInfo.class,DfProductInfo::getId,DfProductPoster::getProductId); + conditionByMPJ(queryWrapper,dfProductPoster); + List list = dfProductPosterService.list(queryWrapper); + ExcelUtil util = new ExcelUtil(DfProductPoster. class); + util.exportExcel(response, list, "产品海报数据"); + } + + /** + * 获取产品海报详细信息 + */ + @ApiOperation("获取产品海报详细信息") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + DfProductPoster byId = dfProductPosterService.getById(id); + List attachVo = cmAttachService.list(new LambdaQueryWrapper().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 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 ids) { + List list = dfProductPosterService.list(new LambdaQueryWrapper().in(DfProductPoster::getId, ids)); + for (DfProductPoster dfProductPoster : list) { + if ("1".equals(dfProductPoster.getStatus())) { + return AjaxResult.warn("该海报已经上架,请先下架再删除"); + } + } + return toAjax(dfProductPosterService.removeBatchByIds(ids)); + } + + private void conditionByMPJ (MPJLambdaWrapper 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 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfProductRecommendController.java b/bs-admin/src/main/java/com/bs/df/controller/DfProductRecommendController.java new file mode 100644 index 0000000..eb71783 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfProductRecommendController.java @@ -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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductRecommend); + List list = dfProductRecommendService.list(queryWrapper); + return getDataTable(list); + } + + /** + * 查询代理产品推荐列表 + */ + @ApiOperation("查询代理产品推荐列表") + @GetMapping("/list") + public AjaxResult list(DfProductRecommend dfProductRecommend) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductRecommend); + List list = dfProductRecommendService.list(queryWrapper); + return success(list); + } + + /** + * 导出代理产品推荐列表 + */ + @ApiOperation("导出代理产品推荐列表") + @Log(title = "代理产品推荐导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfProductRecommend dfProductRecommend) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfProductRecommend); + List list = dfProductRecommendService.list(queryWrapper); + ExcelUtil util = new ExcelUtil(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 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().in(DfProductRecommend::getProductId, dfProductRecommend.getIds()) + .eq(DfProductRecommend::getUserId, dfProductRecommend.getUserId())); + return toAjax(remove); + } + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/controller/DfUserBrokerController.java b/bs-admin/src/main/java/com/bs/df/controller/DfUserBrokerController.java new file mode 100644 index 0000000..3005c6f --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/controller/DfUserBrokerController.java @@ -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 queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfUserBroker); + List list = dfUserBrokerService.list(queryWrapper); + return getDataTable(list); + } + + /** + * 查询客户经纪列表 + */ + @ApiOperation("查询客户经纪列表") + @GetMapping("/list") + public AjaxResult list(DfUserBroker dfUserBroker) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfUserBroker); + List list = dfUserBrokerService.list(queryWrapper); + return success(list); + } + + /** + * 导出客户经纪列表 + */ + @ApiOperation("导出客户经纪列表") + @Log(title = "客户经纪导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DfUserBroker dfUserBroker) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,dfUserBroker); + List list = dfUserBrokerService.list(queryWrapper); + ExcelUtil util = new ExcelUtil(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 ids) { + return toAjax(dfUserBrokerService.removeBatchByIds(ids)); + } + + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper 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()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfBizClue.java b/bs-admin/src/main/java/com/bs/df/domain/DfBizClue.java new file mode 100644 index 0000000..266446a --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfBizClue.java @@ -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 avatarLinks; + + + /** + * 0产品、1名片、2文章 + * + * */ + + @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; + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfBroker.java b/bs-admin/src/main/java/com/bs/df/domain/DfBroker.java new file mode 100644 index 0000000..60b23f1 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfBroker.java @@ -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 children; + + + @TableField(exist = false) + private Boolean isTopLevel; + + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfBrokerProduct.java b/bs-admin/src/main/java/com/bs/df/domain/DfBrokerProduct.java new file mode 100644 index 0000000..3a4cd70 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfBrokerProduct.java @@ -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; + + + + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfOrder.java b/bs-admin/src/main/java/com/bs/df/domain/DfOrder.java new file mode 100644 index 0000000..ec74ff1 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfOrder.java @@ -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; + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfProductArticle.java b/bs-admin/src/main/java/com/bs/df/domain/DfProductArticle.java new file mode 100644 index 0000000..e449d2e --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfProductArticle.java @@ -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 files; + + @TableField(exist = false) + private String orderByColumn; + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfProductInfo.java b/bs-admin/src/main/java/com/bs/df/domain/DfProductInfo.java new file mode 100644 index 0000000..1bdb7d9 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfProductInfo.java @@ -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; + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfProductMoment.java b/bs-admin/src/main/java/com/bs/df/domain/DfProductMoment.java new file mode 100644 index 0000000..055d994 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfProductMoment.java @@ -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 files; + + @TableField(exist = false) + private String orderByColumn; + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfProductPoster.java b/bs-admin/src/main/java/com/bs/df/domain/DfProductPoster.java new file mode 100644 index 0000000..c266bec --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfProductPoster.java @@ -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 files; + + @TableField(exist = false) + private String orderByColumn; + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfProductRecommend.java b/bs-admin/src/main/java/com/bs/df/domain/DfProductRecommend.java new file mode 100644 index 0000000..8def8d4 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfProductRecommend.java @@ -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; + + +} diff --git a/bs-admin/src/main/java/com/bs/df/domain/DfUserBroker.java b/bs-admin/src/main/java/com/bs/df/domain/DfUserBroker.java new file mode 100644 index 0000000..7968546 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/domain/DfUserBroker.java @@ -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; + + + + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfBizClueMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfBizClueMapper.java new file mode 100644 index 0000000..b1c8eb3 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfBizClueMapper.java @@ -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 { + + Boolean insertClue(@Param("dfBizClue") DfBizClue dfBizClue); + + Boolean updateClue(@Param("dfBizClue") DfBizClue dfBizClue); + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfBrokerMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfBrokerMapper.java new file mode 100644 index 0000000..d4b1697 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfBrokerMapper.java @@ -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 { + + void updateByNull(@Param("dfBroker") DfBroker dfBroker); +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfBrokerProductMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfBrokerProductMapper.java new file mode 100644 index 0000000..deab8a6 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfBrokerProductMapper.java @@ -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 { + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfOrderMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfOrderMapper.java new file mode 100644 index 0000000..dfa8c17 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfOrderMapper.java @@ -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 { + + Boolean insertOrder(@Param("dfOrder")DfOrder dfOrder); + + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfProductArticleMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfProductArticleMapper.java new file mode 100644 index 0000000..bb254f5 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfProductArticleMapper.java @@ -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 { + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfProductInfoMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfProductInfoMapper.java new file mode 100644 index 0000000..db2645f --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfProductInfoMapper.java @@ -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 { + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfProductMomentMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfProductMomentMapper.java new file mode 100644 index 0000000..e84b1e6 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfProductMomentMapper.java @@ -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 { + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfProductPosterMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfProductPosterMapper.java new file mode 100644 index 0000000..1286a0d --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfProductPosterMapper.java @@ -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 { + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfProductRecommendMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfProductRecommendMapper.java new file mode 100644 index 0000000..94c7c65 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfProductRecommendMapper.java @@ -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 { + +} diff --git a/bs-admin/src/main/java/com/bs/df/mapper/DfUserBrokerMapper.java b/bs-admin/src/main/java/com/bs/df/mapper/DfUserBrokerMapper.java new file mode 100644 index 0000000..6a18008 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/mapper/DfUserBrokerMapper.java @@ -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 { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfBizClueService.java b/bs-admin/src/main/java/com/bs/df/service/IDfBizClueService.java new file mode 100644 index 0000000..bb30fc8 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfBizClueService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfBrokerProductService.java b/bs-admin/src/main/java/com/bs/df/service/IDfBrokerProductService.java new file mode 100644 index 0000000..5b7d1ac --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfBrokerProductService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfBrokerService.java b/bs-admin/src/main/java/com/bs/df/service/IDfBrokerService.java new file mode 100644 index 0000000..94d4316 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfBrokerService.java @@ -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{ + + /** + * 通过用户id获取相对应的代理商权限 + * @return 代理商权限 + */ + public List filterByUser(); + + /** + * 通过用户id获取相对应的代理商权限 + * @return 代理商权限 + */ + public List filterByUserId(Long userId); + + /** + * 通过代理商id获取相对应的子代理 + * @return 代理商权限 + */ + public List findAllSubordinates(Long brokerId); + + /** + * 通过用户id获取相对应的产品id + * @return 产品id + */ + public List getProductIdsByBrokerId(); + + /** + * 通过用户id获取相对应的产品id + * @return 产品id + */ + public List getProductIdsByBrokerIdByUserId(Long userId); + + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfOrderService.java b/bs-admin/src/main/java/com/bs/df/service/IDfOrderService.java new file mode 100644 index 0000000..f40be70 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfOrderService.java @@ -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{ + /** + * 获取单据流水号,单据前缀+日期+四位流水号,如:RK202310010001 + * @param billPrefix + * @return 单据流水号,如果billPrefix为空,返回日期+四位流水号 + */ + public String getBillNumber(String billPrefix); +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfProductArticleService.java b/bs-admin/src/main/java/com/bs/df/service/IDfProductArticleService.java new file mode 100644 index 0000000..18c4362 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfProductArticleService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfProductInfoService.java b/bs-admin/src/main/java/com/bs/df/service/IDfProductInfoService.java new file mode 100644 index 0000000..95d9d18 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfProductInfoService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfProductMomentService.java b/bs-admin/src/main/java/com/bs/df/service/IDfProductMomentService.java new file mode 100644 index 0000000..c08eddc --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfProductMomentService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfProductPosterService.java b/bs-admin/src/main/java/com/bs/df/service/IDfProductPosterService.java new file mode 100644 index 0000000..77edcc3 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfProductPosterService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfProductRecommendService.java b/bs-admin/src/main/java/com/bs/df/service/IDfProductRecommendService.java new file mode 100644 index 0000000..d3b4258 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfProductRecommendService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/IDfUserBrokerService.java b/bs-admin/src/main/java/com/bs/df/service/IDfUserBrokerService.java new file mode 100644 index 0000000..698534f --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/IDfUserBrokerService.java @@ -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{ + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfBizClueServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfBizClueServiceImpl.java new file mode 100644 index 0000000..6dd055e --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfBizClueServiceImpl.java @@ -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 implements IDfBizClueService { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerProductServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerProductServiceImpl.java new file mode 100644 index 0000000..4dde371 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerProductServiceImpl.java @@ -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 implements IDfBrokerProductService { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerServiceImpl.java new file mode 100644 index 0000000..78ab1cd --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfBrokerServiceImpl.java @@ -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 implements IDfBrokerService { + @Autowired + private ISysUserService userService; + @Autowired + private IDfBrokerService dfBrokerService; + @Autowired + private IDfBrokerProductService dfBrokerProductService; + public List filterByUser() { + //SecurityUtils.getUserId(); + SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId()); + Long deptId = sysUser.getDeptId(); + List allSubordinates = findAllSubordinates(deptId); + List brokerIds = allSubordinates.stream() + .map(DfBroker::getId) + .collect(Collectors.toList()); + brokerIds.add(deptId); + return brokerIds; + } + + public List filterByUserId(Long userId) { + SysUser sysUser = userService.selectUserById(userId); + Long deptId = sysUser.getDeptId(); + List allSubordinates = findAllSubordinates(deptId); + List brokerIds = allSubordinates.stream() + .map(DfBroker::getId) + .collect(Collectors.toList()); + brokerIds.add(deptId); + return brokerIds; + } + + public List findAllSubordinates(Long brokerId) { + List result = new ArrayList<>(); + // 查询当前brokerId的所有下级 + List subordinates = dfBrokerService.list(new LambdaQueryWrapper().eq(DfBroker::getParentId, brokerId)); + result.addAll(subordinates); + for (DfBroker subordinate : subordinates) { + List subSubordinates = findAllSubordinates(subordinate.getId()); + result.addAll(subSubordinates); + } + return result; + } + + public List getProductIdsByBrokerId() { + List longs = filterByUser(); + List list = dfBrokerProductService.list(new LambdaQueryWrapper() + .in(DfBrokerProduct::getBrokerId, longs) + .eq(DfBrokerProduct::getStaus, "1") + .or() + .in(DfBrokerProduct::getUserId, SecurityUtils.getUserId())); + return list.stream().map(DfBrokerProduct::getProductId).collect(Collectors.toList()); + } + + public List getProductIdsByBrokerIdByUserId(Long UserId) { + List longs = filterByUserId(UserId); + List list = dfBrokerProductService.list(new LambdaQueryWrapper() + .in(DfBrokerProduct::getBrokerId, longs) + .eq(DfBrokerProduct::getStaus, "1")); + return list.stream().map(DfBrokerProduct::getProductId).collect(Collectors.toList()); + } + + + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfOrderServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfOrderServiceImpl.java new file mode 100644 index 0000000..9d9a618 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfOrderServiceImpl.java @@ -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 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 lsBill = dfOrderService.list(new LambdaQueryWrapper().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; + } +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfProductArticleServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductArticleServiceImpl.java new file mode 100644 index 0000000..990be52 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductArticleServiceImpl.java @@ -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 implements IDfProductArticleService { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfProductInfoServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductInfoServiceImpl.java new file mode 100644 index 0000000..6a36241 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductInfoServiceImpl.java @@ -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 implements IDfProductInfoService { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfProductMomentServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductMomentServiceImpl.java new file mode 100644 index 0000000..dab1ac5 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductMomentServiceImpl.java @@ -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 implements IDfProductMomentService { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfProductPosterServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductPosterServiceImpl.java new file mode 100644 index 0000000..0882340 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductPosterServiceImpl.java @@ -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 implements IDfProductPosterService { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfProductRecommendServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductRecommendServiceImpl.java new file mode 100644 index 0000000..578da5c --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfProductRecommendServiceImpl.java @@ -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 implements IDfProductRecommendService { + +} diff --git a/bs-admin/src/main/java/com/bs/df/service/impl/DfUserBrokerServiceImpl.java b/bs-admin/src/main/java/com/bs/df/service/impl/DfUserBrokerServiceImpl.java new file mode 100644 index 0000000..9004d5f --- /dev/null +++ b/bs-admin/src/main/java/com/bs/df/service/impl/DfUserBrokerServiceImpl.java @@ -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 implements IDfUserBrokerService { + +} diff --git a/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java b/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java index 7491944..6246ad5 100644 --- a/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java +++ b/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java @@ -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);