提交 0b4301eb authored 作者: 吕本才's avatar 吕本才 提交者: Coding

Accept Merge Request #107: (qa -> main)

Merge Request: 修改优化供应链报表显示,增加财务报表 Created By: @吕本才 Accepted By: @吕本才 URL: https://g-pkkp8204.coding.net/p/wangxiaolu-sfa/d/wangxiaolu-link-report/git/merge/107?initial=true
......@@ -62,6 +62,7 @@
<artifactId>wangxiaolu-sfa-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.wangxiaolu.sfa</groupId>
......@@ -74,7 +75,14 @@
<artifactId>wangxiaolu-sfa-common-log</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
......
package com.link.report.config.mysql;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author : liqiulin
* @date : 2024-04-25 13
* @describe :
*/
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
}
package com.link.report.controller.core;
import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.service.CustomerReportService;
import com.sfa.common.core.domain.R;
import com.sfa.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author : liqiulin
* @date : 2024-12-04 15
* @describe : 自定义报表管理
*/
@RestController
@RequestMapping("/customer/core")
public class CustomerReportCoreController {
@Autowired
CustomerReportService customerReportService;
@RequiresPermissions("bi:supply:list")
@PostMapping("/save")
public R save(@RequestBody CustomerReportAddVo customerReportAddVo) {
customerReportService.save(customerReportAddVo);
return R.ok();
}
}
package com.link.report.controller.core;
import com.link.report.pojo.request.CustomerReportGroupVo;
import com.link.report.service.CustomerReportGroupService;
import com.sfa.common.core.domain.R;
import com.sfa.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-12-04 15
* @describe : 自定义报表管理
*/
@RestController
@RequestMapping("/customer/core")
public class CustomerReportGroupCoreController {
@Autowired
CustomerReportGroupService customerReportGroupService;
@RequiresPermissions("bi:supply:list")
@PostMapping("/group/save")
public R insertOrUpdate(@RequestBody List<CustomerReportGroupVo> vos) {
customerReportGroupService.save(vos);
return R.ok();
}
}
package com.link.report.controller.query;
import com.link.report.pojo.request.CustomerReportQueryListVo;
import com.link.report.pojo.response.CustomerReportGroupResDto;
import com.link.report.service.CustomerReportGroupService;
import com.sfa.common.core.domain.R;
import com.sfa.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-12-04 15
* @describe : 自定义报表管理
*/
@RestController
@RequestMapping("/customer/query")
public class CustomerReportGroupQueryController {
@Autowired
CustomerReportGroupService customerReportGroupService;
@RequiresPermissions("bi:supply:list")
@GetMapping("/group/list")
public R<List<CustomerReportGroupResDto>> queryList(CustomerReportQueryListVo vo) {
List<CustomerReportGroupResDto> dtos = customerReportGroupService.queryList(vo);
return R.ok(dtos);
}
}
package com.link.report.controller.query;
import com.link.report.pojo.response.CustomerReportListDto;
import com.link.report.service.CustomerReportService;
import com.sfa.common.core.domain.R;
import com.sfa.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-12-04 15
* @describe : 自定义报表管理
*/
@RestController
@RequestMapping("/customer/query")
public class CustomerReportQueryController {
@Autowired
CustomerReportService customerReportService;
@RequiresPermissions("bi:supply:list")
@GetMapping("/list")
public R<List<CustomerReportListDto>> queryList() {
List<CustomerReportListDto> customerReportListDtos = customerReportService.queryCustomerReportList();
return R.ok(customerReportListDtos);
}
}
......@@ -6,6 +6,7 @@ import com.link.report.service.ReportShareService;
import com.sfa.common.core.domain.R;
import com.sfa.common.core.web.controller.BaseController;
import com.sfa.common.datascope.annotation.DataScope;
import com.sfa.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -20,7 +21,7 @@ import java.util.List;
* @date 2024-12-19
*/
@RestController
@RequestMapping("/share")
@RequestMapping("/customer/share")
public class ReportShareQueryController extends BaseController {
@Autowired
......@@ -28,15 +29,16 @@ public class ReportShareQueryController extends BaseController {
/**
* 直播间分类的页面查询
*
* @param reportShareListVo
* @return
*/
// @RequiresPermissions("report:jimu:list")
@DataScope(deptAlias = "d", userAlias = "u")
@GetMapping("/list")
public R<List<ReportShareBiListDto>> selectList(ReportShareListVo reportShareListVo) {
@RequiresPermissions("bi:supply:list")
public R<List<ReportShareBiListDto>> selectList(ReportShareListVo reportShareListVo) {
List<ReportShareBiListDto> reportShareBiListDtos = reportShareService.selectList(reportShareListVo);
return R.ok(reportShareBiListDtos);
return R.ok(reportShareBiListDtos);
}
}
package com.link.report.domain.dao;
import com.link.report.domain.wq.CustomerGroupQueryWq;
import com.link.report.pojo.response.CustomerGroupDto;
import java.util.List;
public interface CustomerGroupDao {
List<CustomerGroupDto> queryList(CustomerGroupQueryWq wq);
}
package com.link.report.domain.dao;
import com.link.report.domain.wq.CustomerReportAddWq;
import com.link.report.domain.wq.CustomerReportQueryWq;
import com.link.report.pojo.response.CustomerReportListDto;
import java.util.List;
public interface CustomerReportDao {
void insert(CustomerReportAddWq wq);
void update(CustomerReportAddWq wq);
List<CustomerReportListDto> queryCustomerReportList(CustomerReportQueryWq wq);
}
package com.link.report.domain.dao;
import com.link.report.domain.entity.CustomerReportGroup;
import com.link.report.pojo.response.CustomerReportGroupQueryListDto;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CustomerReportGroupDao {
List<CustomerReportGroupQueryListDto> queryList();
void deleteByCreatorId(Long userId);
void batchInsert(List<CustomerReportGroup> items);
}
package com.link.report.domain.dao.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.link.report.domain.dao.CustomerGroupDao;
import com.link.report.domain.entity.CustomerGroup;
import com.link.report.domain.mapper.CustomerGroupMapper;
import com.link.report.domain.wq.CustomerGroupQueryWq;
import com.link.report.pojo.response.CustomerGroupDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* 报表分享数据
*/
@Component
public class CustomerGroupDaoImpl implements CustomerGroupDao {
@Autowired
private CustomerGroupMapper groupMapper;
@Override
public List<CustomerGroupDto> queryList(CustomerGroupQueryWq wq) {
Wrapper<CustomerGroup> wraper = new LambdaQueryWrapper<CustomerGroup>()
.eq(ObjectUtil.isNotEmpty(wq.getCategoryName()), CustomerGroup::getCategoryName, wq.getCategoryName());
List<CustomerGroup> customerGroups = groupMapper.selectList(wraper);
List<CustomerGroupDto> result = new ArrayList<>();
for (CustomerGroup customerGroup : customerGroups) {
CustomerGroupDto dto = new CustomerGroupDto();
dto.setGroupId(customerGroup.getId());
dto.setGroupName(customerGroup.getName());
dto.setCatalogName(customerGroup.getCategoryName());
result.add(dto);
}
return result;
}
}
package com.link.report.domain.dao.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.link.report.domain.dao.CustomerReportDao;
import com.link.report.domain.entity.CustomerReport;
import com.link.report.domain.mapper.CustomerReportMapper;
import com.link.report.domain.wq.CustomerReportAddWq;
import com.link.report.domain.wq.CustomerReportQueryWq;
import com.link.report.pojo.response.CustomerReportListDto;
import com.sfa.common.core.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* 报表分享数据
*/
@Component
public class CustomerReportDaoImpl implements CustomerReportDao {
@Autowired
private CustomerReportMapper customerReportMapper;
@Override
public void insert(CustomerReportAddWq wq) {
CustomerReport entity = BeanUtils.transitionDto(wq, CustomerReport.class);
customerReportMapper.insert(entity);
}
@Override
public void update(CustomerReportAddWq wq) {
CustomerReport entity = BeanUtils.transitionDto(wq, CustomerReport.class);
customerReportMapper.updateById(entity);
}
@Override
public List<CustomerReportListDto> queryCustomerReportList(CustomerReportQueryWq wq) {
Wrapper<CustomerReport> qw = new LambdaQueryWrapper<>();
// 按照条件查询
List<CustomerReport> customerReports = customerReportMapper.selectList(qw);
List<CustomerReportListDto> list = new ArrayList<>();
for (CustomerReport customerReport : customerReports) {
CustomerReportListDto dto = new CustomerReportListDto();
dto.setReportId(customerReport.getId());
dto.setReportName(customerReport.getName());
dto.setReportType(customerReport.getReportType());
dto.setPreviewUrl(customerReport.getPreviewUrl());
list.add(dto);
}
return list;
}
}
package com.link.report.domain.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.link.report.domain.dao.CustomerReportGroupDao;
import com.link.report.domain.entity.CustomerReportGroup;
import com.link.report.domain.mapper.CustomerReportGroupMapper;
import com.link.report.pojo.response.CustomerReportGroupQueryListDto;
import com.sfa.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 报表分享数据
*/
@Component
public class CustomerReportGroupDaoImpl implements CustomerReportGroupDao {
@Autowired
private CustomerReportGroupMapper reportGroupMapper;
@Override
public List<CustomerReportGroupQueryListDto> queryList() {
// 更加登录人id查询
Long userId = SecurityUtils.getLoginUser().getUserid();
List<CustomerReportGroupQueryListDto> list = reportGroupMapper.queryReportGroupList(String.valueOf(userId));
return list;
}
@Override
public void deleteByCreatorId(Long userId) {
reportGroupMapper.delete(new LambdaQueryWrapper<CustomerReportGroup>()
.eq(CustomerReportGroup::getCreateBy,userId));
}
@Override
public void batchInsert(List<CustomerReportGroup> items) {
reportGroupMapper.batchInsert(items);
}
}
......@@ -20,7 +20,6 @@ public class ReportShareDaoImpl implements ReportShareDao {
public List<ReportShareBiListDto> selectList(ReportShareListWq reportShareListWq) {
// 查询数据
List<ReportShareBiListDto> jimuReportShares = reportShareMapper.selectShareList(reportShareListWq);
// List<ReportShareBiListDto> dtos = BeanUtils.transitionDtos(jimuReportShares, ReportShareBiListDto.class);
return jimuReportShares;
}
}
package com.link.report.domain.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* 对应数据库自定义分组表 customer_group 的 Java Bean 类
*/
@TableName(value ="customer_group")
@Data
public class CustomerGroup {
/**
* 主键
*/
private String id;
/**
* 分组名称
*/
private String name;
/**
* 说明
*/
private String remark;
/**
* 分类名称
*/
private String categoryName;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改人
*/
private String updateBy;
/**
* 修改时间
*/
private Date updateTime;
/**
* 删除标识,0 表示正常,1 表示已删除
*/
private Integer delFlag;
/**
* 多租户标识
*/
private String tenantId;
/**
* 乐观锁版本
*/
private Integer updateCount;
}
package com.link.report.domain.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@TableName(value ="customer_report")
@Data
public class CustomerReport {
private String id;
private String code;
private String name;
private String previewUrl;
private String remark;
private Integer status;
// 报表类型,0自定义报表 1 积木报表
private Integer reportType;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private Integer delFlag;
private String tenantId;
private Integer updateCount;
}
package com.link.report.domain.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@TableName(value ="customer_report_group")
@Data
public class CustomerReportGroup {
private String id;
private String reportId;
private Integer reportType;
private String groupId;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private Integer delFlag;
private String tenantId;
private Integer updateCount;
}
package com.link.report.domain.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.link.report.domain.entity.CustomerGroup;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerGroupMapper extends BaseMapper<CustomerGroup> {
}
package com.link.report.domain.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.link.report.domain.entity.CustomerReportGroup;
import com.link.report.pojo.response.CustomerReportGroupQueryListDto;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CustomerReportGroupMapper extends BaseMapper<CustomerReportGroup> {
void batchInsert(List<CustomerReportGroup> items);
List<CustomerReportGroupQueryListDto> queryReportGroupList(String userId);
}
package com.link.report.domain.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.link.report.domain.entity.CustomerReport;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerReportMapper extends BaseMapper<CustomerReport> {
}
package com.link.report.domain.wq;
import lombok.Data;
@Data
public class CustomerGroupQueryWq {
private String categoryName;
}
package com.link.report.domain.wq;
import lombok.Data;
@Data
public class CustomerReportAddWq {
private String id;
private String name;
private String previewUrl;
}
package com.link.report.domain.wq;
import lombok.Data;
@Data
public class CustomerReportGroupWq {
private String reportId;
private String groupId;
}
package com.link.report.domain.wq;
import lombok.Data;
@Data
public class CustomerReportQueryWq {
private String id;
private String name;
private String previewUrl;
}
......@@ -13,6 +13,9 @@ import java.util.Map;
@Data
public class ReportShareListWq {
private String reportId;
private String categoryName;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
}
package com.link.report.pojo.request;
import lombok.Data;
/**
* @author : lvbencai
* @date : 2025年03月19日12:09:19
* @describe : 自定义报表查询条件
*/
@Data
public class CustomerReportAddVo {
private String id;
private String name;
private String previewUrl;
}
package com.link.report.pojo.request;
import com.link.report.pojo.response.ReportItemsDto;
import lombok.Data;
import java.util.List;
@Data
public class CustomerReportGroupVo {
private String groupId;
private String groupName;
private List<ReportItemsDto> items;
}
package com.link.report.pojo.request;
import lombok.Data;
/**
* @author : lvbencai
* @date : 2025年03月19日12:09:19
* @describe : 自定义报表查询条件
*/
@Data
public class CustomerReportQueryListVo {
private String categoryName = "供应链报表";
}
package com.link.report.pojo.request;
import com.sfa.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* @author : lvbencai
* @date : 2025年02月14日15:17:07
* @describe :
*/
@Data
public class ReportShareListVo extends BaseEntity {
/**
* 文件夹名称
*/
private String categoryName;
}
package com.link.report.pojo.response;
import lombok.Data;
@Data
public class CustomerGroupDto {
private String groupId;
private String groupName;
private String catalogName;
}
package com.link.report.pojo.response;
import lombok.Data;
@Data
public class CustomerReportGroupListDto {
private String id;
private String reportId;
private String groupId;
private String groupName;
private String reportName;
private Integer reportType;
}
package com.link.report.pojo.response;
import lombok.Data;
@Data
public class CustomerReportGroupQueryListDto {
private String groupId;
private String groupName;
private String reportId;
private String reportName;
private Integer reportType;
private String previewUrl;
}
package com.link.report.pojo.response;
import lombok.Data;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-12-04 15
* @describe : 首页-自定义报表+积木报表分组管理
*/
@Data
public class CustomerReportGroupResDto {
private String groupId;
private String groupName;
private List<ReportItemsDto> items;
}
package com.link.report.pojo.response;
import lombok.Data;
@Data
public class CustomerReportListDto {
private String reportId;
private String reportName;
private String previewUrl;
// 报表类型,0自定义报表 1 积木报表
private Integer reportType;
}
package com.link.report.pojo.response;
import lombok.Data;
/**
* @author : lvbencai
* @date : 2025年02月14日15:17:07
* @describe :自定义报表+积木报表
*/
@Data
public class ReportItemsDto {
private String reportId;
private String previewUrl;
private String reportName;
// 报表类型,0自定义报表 1 积木报表
private Integer reportType;
}
package com.link.report.pojo.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.Date;
/**
* @author : lvbencai
* @date : 2025年02月14日15:17:07
......@@ -11,15 +10,14 @@ import java.util.Date;
*/
@Data
public class ReportShareBiListDto {
// 报表分享的id
@JsonInclude(JsonInclude.Include.NON_NULL)
private String id;
private String reportId;
private String previewUrl;
private String previewLock;
private Date lastUpdateTime;
private String termOfValidity;
private String status;
private String previewLockStatus;
private String shareToken;
private String name;
private String reportName;
// 报表类型,0自定义报表 1 积木报表
private Integer reportType = 1;
}
package com.link.report.service;
import com.link.report.pojo.request.CustomerReportGroupVo;
import com.link.report.pojo.request.CustomerReportQueryListVo;
import com.link.report.pojo.response.CustomerReportGroupResDto;
import java.util.List;
public interface CustomerReportGroupService {
List<CustomerReportGroupResDto> queryList(CustomerReportQueryListVo vo);
void save(List<CustomerReportGroupVo> customerReportAddVo);
}
package com.link.report.service;
import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.pojo.response.CustomerReportListDto;
import java.util.List;
public interface CustomerReportService {
void save(CustomerReportAddVo customerReportAddVo);
List<CustomerReportListDto> queryCustomerReportList();
}
package com.link.report.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.link.report.domain.dao.CustomerGroupDao;
import com.link.report.domain.dao.CustomerReportGroupDao;
import com.link.report.domain.entity.CustomerReportGroup;
import com.link.report.domain.wq.CustomerGroupQueryWq;
import com.link.report.pojo.request.CustomerReportGroupVo;
import com.link.report.pojo.request.CustomerReportQueryListVo;
import com.link.report.pojo.response.CustomerGroupDto;
import com.link.report.pojo.response.CustomerReportGroupQueryListDto;
import com.link.report.pojo.response.CustomerReportGroupResDto;
import com.link.report.pojo.response.ReportItemsDto;
import com.link.report.service.CustomerReportGroupService;
import com.sfa.common.security.utils.SecurityUtils;
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;
/**
* 报表分享数据
*/
@Service
public class CustomerReportGroupServiceImpl implements CustomerReportGroupService {
@Autowired
private CustomerReportGroupDao customerReportGroupDao;
@Autowired
private CustomerGroupDao customerGroupDao;
@Override
public List<CustomerReportGroupResDto> queryList(CustomerReportQueryListVo vo) {
CustomerGroupQueryWq wq = new CustomerGroupQueryWq();
wq.setCategoryName(vo.getCategoryName());
// 先查询分组
List<CustomerGroupDto> groupDtos = customerGroupDao.queryList(wq);
List<CustomerReportGroupQueryListDto> list = customerReportGroupDao.queryList();
// 转换成list结构
List<CustomerReportGroupResDto> result = new ArrayList<>();
for (CustomerGroupDto dto : groupDtos) {
// 先看分组
CustomerReportGroupResDto resDto = new CustomerReportGroupResDto();
resDto.setGroupId(dto.getGroupId());
resDto.setGroupName(dto.getGroupName());
List<ReportItemsDto> itemsDtos = new ArrayList<>();
// 在看报表
for (CustomerReportGroupQueryListDto reportGroupQueryListDto : list) {
if (reportGroupQueryListDto.getGroupId().equals(dto.getGroupId())) {
// 转换成ReportShareBiListDto
ReportItemsDto itemsDto = new ReportItemsDto();
itemsDto.setReportId(reportGroupQueryListDto.getReportId());
itemsDto.setReportName(reportGroupQueryListDto.getReportName());
itemsDto.setPreviewUrl(reportGroupQueryListDto.getPreviewUrl());
itemsDto.setReportType(reportGroupQueryListDto.getReportType());
itemsDtos.add(itemsDto);
}
}
resDto.setItems(itemsDtos);
result.add(resDto);
}
return result;
}
/**
* 新增或者修改
*
* @param customerReportGroupVo
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void save(List<CustomerReportGroupVo> customerReportGroupVo) {
// 新增或者修改 先删除后新增
Long userId = SecurityUtils.getLoginUser().getUserid();
customerReportGroupDao.deleteByCreatorId(userId);
// 新增
List<CustomerReportGroup> items = new ArrayList<>();
for (CustomerReportGroupVo vo : customerReportGroupVo) {
List<ReportItemsDto> itemsDtos = vo.getItems();
for (ReportItemsDto item : itemsDtos) {
CustomerReportGroup dto = new CustomerReportGroup();
// 雪花算法生成id
dto.setId(IdUtil.getSnowflakeNextIdStr());
dto.setGroupId(vo.getGroupId());
dto.setReportId(item.getReportId());
dto.setReportType(item.getReportType());
dto.setCreateBy(String.valueOf(userId));
dto.setTenantId(String.valueOf(userId));
items.add(dto);
}
}
if(ObjectUtil.isNotEmpty(items)){
customerReportGroupDao.batchInsert(items);
}
}
}
package com.link.report.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.link.report.domain.dao.CustomerReportDao;
import com.link.report.domain.wq.CustomerReportAddWq;
import com.link.report.domain.wq.CustomerReportQueryWq;
import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.pojo.response.CustomerReportListDto;
import com.link.report.service.CustomerReportService;
import com.sfa.common.core.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 报表分享数据
*/
@Service
public class CustomerReportServiceImpl implements CustomerReportService {
@Autowired
private CustomerReportDao customerReportDao;
@Override
public void save(CustomerReportAddVo customerReportAddVo) {
CustomerReportAddWq wq = new CustomerReportAddWq();
BeanUtils.copyProperties(customerReportAddVo, wq);
if (ObjectUtil.isNotEmpty(wq.getId())) {
customerReportDao.update(wq);
} else {
customerReportDao.insert(wq);
}
}
@Override
public List<CustomerReportListDto> queryCustomerReportList( ) {
CustomerReportQueryWq wq = new CustomerReportQueryWq();
List<CustomerReportListDto> list = customerReportDao.queryCustomerReportList(wq);
return list;
}
}
......@@ -123,8 +123,9 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
|| loginUser.getSysUser().getDept().getDeptName().contains("信息技术中心")) {
return "1";
}
return loginUser.getSysUser().getDept().getDeptName();
}
Long deptId = loginUser.getSysUser().getDept().getDeptId();
return String.valueOf(deptId);
}
@Override
public Map<String, Object> getUserInfo(String token) {
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.link.report.domain.mapper.CustomerReportGroupMapper">
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO customer_report_group (
id,
report_id,
report_type,
group_id,
create_by,
create_time,
update_by,
update_time,
del_flag,
tenant_id,
update_count
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.id},
#{item.reportId},
#{item.reportType},
#{item.groupId},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.delFlag},
#{item.tenantId},
#{item.updateCount}
)
</foreach>
</insert>
<select id="queryReportGroupList" resultType="com.link.report.pojo.response.CustomerReportGroupQueryListDto">
<!-- 自定义报表关联 -->
select distinct groupId ,groupName,reportId,reportName,previewUrl,reportType from (
SELECT
cg.id as groupId,
cg.name as groupName,
crg.report_type as reportType,
crg.report_id as reportId,
cr.name as reportName,
cr.preview_url as previewUrl
FROM
customer_group cg
join customer_report_group crg on crg.group_id = cg.id and crg.report_type = 0
join customer_report cr on crg.report_id = cr.id and crg.report_type = cr.report_type
<where>
<if test="userId != null and userId != ''">
AND crg.create_by = #{userId}
</if>
</where>
<!-- 积木报表关联 -->
union
SELECT
cg.id as groupId,
cg.name as groupName,
crg.report_type as reportType,
jr.id as reportId,
jr.name as reportName,
jrs.preview_url as previewUrl
FROM
customer_group cg
join customer_report_group crg on crg.group_id = cg.id and crg.report_type = 1
join jimu_report jr on crg.report_id = jr.id
join jimu_report_share jrs on jr.id = jrs.report_id
<where>
<if test="userId!= null and userId!= ''">
AND crg.create_by = #{userId}
</if>
</where>
) tmp
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.link.report.domain.mapper.CustomerReportMapper">
<select id="selectById" resultType="com.link.report.domain.entity.CustomerReport">
SELECT
id,
code,
name,
preview_url,
remark,
status,
report_type,
create_by,
create_time,
update_by,
update_time,
del_flag,
tenant_id,
update_count
FROM
customer_report
WHERE
id = #{id}
</select>
</mapper>
......@@ -19,16 +19,30 @@
<select id="selectShareList" resultType="com.link.report.pojo.response.ReportShareBiListDto">
select jrs.id,jrs.report_id as reportId ,
jrs.preview_url as previewUrl,
jrs.preview_lock as previewLock,
jrs.last_update_time as lastUpdateTime,
jrs.term_of_validity as termOfValidity,
jrs.status as status,
jrs.preview_lock_status as previewLockStatus,
jrs.share_token as shareToken,
jr.name from jimu_report_share jrs
<!-- jrs.preview_lock as previewLock,
jrs.last_update_time as lastUpdateTime,
jrs.term_of_validity as termOfValidity,
jrs.status as status,
jrs.preview_lock_status as previewLockStatus,
jrs.share_token as shareToken,-->
jr.name as reportName,
1 as reportType
from jimu_report_share jrs
inner join jimu_report jr on jr.id = jrs.report_id and jr.del_flag =0
<if test="categoryName != null and categoryName != ''">
JOIN
jimu_report_category c1 ON jr.type = c1.id
LEFT JOIN
jimu_report_category c2 ON c1.parent_id = c2.id
LEFT JOIN
jimu_report_category c3 ON c2.parent_id = c3.id
</if>
<where>
<if test="categoryName != null and categoryName != ''">
c1.name = #{categoryName}
OR c2.name = #{categoryName}
OR c3.name = #{categoryName};
</if>
<if test="reportId != null and reportId != ''">
and report_id = #{reportId}
</if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论