提交 751376de authored 作者: 吕本才's avatar 吕本才

1、增加分组保存、删除接口,2、优化之前的接口 3、

上级 db376f16
...@@ -74,7 +74,11 @@ ...@@ -74,7 +74,11 @@
<groupId>com.wangxiaolu.sfa</groupId> <groupId>com.wangxiaolu.sfa</groupId>
<artifactId>wangxiaolu-sfa-common-log</artifactId> <artifactId>wangxiaolu-sfa-common-log</artifactId>
</dependency> </dependency>
<!-- RuoYi Api System -->
<dependency>
<groupId>com.wangxiaolu.sfa</groupId>
<artifactId>wangxiaolu-sfa-api-system</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
......
package com.link.report.controller.core;
import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.service.CustomerGroupService;
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.*;
/**
* @author : liqiulin
* @date : 2024-12-04 15
* @describe : 自定义报表管理
*/
@RestController
@RequestMapping("/customer/core")
public class CustomerGroupCoreController {
@Autowired
CustomerGroupService groupService;
@RequiresPermissions("bi:supply:list")
@PostMapping("/group/insertOrUpdate")
public R save(@RequestBody CustomerReportAddVo customerReportAddVo) {
groupService.save(customerReportAddVo);
return R.ok();
}
@RequiresPermissions("bi:supply:list")
@DeleteMapping("/group/delete")
public R delete(CustomerReportAddVo customerReportAddVo) {
groupService.delete(customerReportAddVo);
return R.ok();
}
@RequiresPermissions("bi:supply:list")
@GetMapping("/group/convert")
public R convert() {
groupService.convert();
return R.ok();
}
}
package com.link.report.controller.query; package com.link.report.controller.query;
import com.link.report.pojo.request.ReportShareListVo;
import com.link.report.pojo.response.CustomerReportListDto; import com.link.report.pojo.response.CustomerReportListDto;
import com.link.report.service.CustomerReportService; import com.link.report.service.CustomerReportService;
import com.sfa.common.core.domain.R; import com.sfa.common.core.domain.R;
...@@ -25,8 +26,8 @@ public class CustomerReportQueryController { ...@@ -25,8 +26,8 @@ public class CustomerReportQueryController {
@RequiresPermissions("bi:supply:list") @RequiresPermissions("bi:supply:list")
@GetMapping("/list") @GetMapping("/list")
public R<List<CustomerReportListDto>> queryList() { public R<List<CustomerReportListDto>> queryList(ReportShareListVo reportShareListVo) {
List<CustomerReportListDto> customerReportListDtos = customerReportService.queryCustomerReportList(); List<CustomerReportListDto> customerReportListDtos = customerReportService.queryCustomerReportList(reportShareListVo);
return R.ok(customerReportListDtos); return R.ok(customerReportListDtos);
} }
} }
package com.link.report.domain.dao; package com.link.report.domain.dao;
import com.link.report.domain.wq.CustomerGroupQueryWq; import com.link.report.domain.wq.CustomerGroupQueryWq;
import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.pojo.response.CustomerGroupDto; import com.link.report.pojo.response.CustomerGroupDto;
import java.util.List; import java.util.List;
public interface CustomerGroupDao { public interface CustomerGroupDao {
List<CustomerGroupDto> queryList(CustomerGroupQueryWq wq); List<CustomerGroupDto> queryList(CustomerGroupQueryWq wq);
void insert(CustomerReportAddVo customerReportAddVo);
void update(CustomerReportAddVo customerReportAddVo);
void delete(String groupId);
} }
...@@ -2,15 +2,18 @@ package com.link.report.domain.dao; ...@@ -2,15 +2,18 @@ package com.link.report.domain.dao;
import com.link.report.domain.entity.CustomerReportGroup; import com.link.report.domain.entity.CustomerReportGroup;
import com.link.report.pojo.response.CustomerReportGroupQueryListDto; import com.link.report.pojo.response.CustomerReportGroupQueryListDto;
import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
@Mapper
public interface CustomerReportGroupDao { public interface CustomerReportGroupDao {
List<CustomerReportGroup> list();
List<CustomerReportGroupQueryListDto> queryList(); List<CustomerReportGroupQueryListDto> queryList();
void deleteByCreatorId(Long userId); void deleteByCreatorId(Long userId);
void batchInsert(List<CustomerReportGroup> items); void batchInsert(List<CustomerReportGroup> items);
void update(CustomerReportGroup customerReportGroup);
} }
...@@ -7,7 +7,9 @@ import com.link.report.domain.dao.CustomerGroupDao; ...@@ -7,7 +7,9 @@ import com.link.report.domain.dao.CustomerGroupDao;
import com.link.report.domain.entity.CustomerGroup; import com.link.report.domain.entity.CustomerGroup;
import com.link.report.domain.mapper.CustomerGroupMapper; import com.link.report.domain.mapper.CustomerGroupMapper;
import com.link.report.domain.wq.CustomerGroupQueryWq; import com.link.report.domain.wq.CustomerGroupQueryWq;
import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.pojo.response.CustomerGroupDto; import com.link.report.pojo.response.CustomerGroupDto;
import com.sfa.common.core.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -27,7 +29,9 @@ public class CustomerGroupDaoImpl implements CustomerGroupDao { ...@@ -27,7 +29,9 @@ public class CustomerGroupDaoImpl implements CustomerGroupDao {
public List<CustomerGroupDto> queryList(CustomerGroupQueryWq wq) { public List<CustomerGroupDto> queryList(CustomerGroupQueryWq wq) {
Wrapper<CustomerGroup> wraper = new LambdaQueryWrapper<CustomerGroup>() Wrapper<CustomerGroup> wraper = new LambdaQueryWrapper<CustomerGroup>()
.eq(ObjectUtil.isNotEmpty(wq.getCategoryName()), CustomerGroup::getCategoryName, wq.getCategoryName()); .eq(ObjectUtil.isNotEmpty(wq.getCreateUserId()), CustomerGroup::getCreateUserId, wq.getCreateUserId())
.eq(ObjectUtil.isNotEmpty(wq.getCategoryName()), CustomerGroup::getCategoryName, wq.getCategoryName())
.in(ObjectUtil.isNotEmpty(wq.getGroupIds()), CustomerGroup::getId, wq.getGroupIds());
List<CustomerGroup> customerGroups = groupMapper.selectList(wraper); List<CustomerGroup> customerGroups = groupMapper.selectList(wraper);
List<CustomerGroupDto> result = new ArrayList<>(); List<CustomerGroupDto> result = new ArrayList<>();
for (CustomerGroup customerGroup : customerGroups) { for (CustomerGroup customerGroup : customerGroups) {
...@@ -39,4 +43,27 @@ public class CustomerGroupDaoImpl implements CustomerGroupDao { ...@@ -39,4 +43,27 @@ public class CustomerGroupDaoImpl implements CustomerGroupDao {
} }
return result; return result;
} }
@Override
public void insert(CustomerReportAddVo customerReportAddVo) {
CustomerGroup customerGroup = BeanUtils.transitionDto(customerReportAddVo, CustomerGroup.class);
customerGroup.setName(customerReportAddVo.getGroupName());
customerGroup.setCategoryName(customerReportAddVo.getCategoryName());
groupMapper.insert(customerGroup);
}
@Override
public void update(CustomerReportAddVo customerReportAddVo) {
CustomerGroup customerGroup = BeanUtils.transitionDto(customerReportAddVo, CustomerGroup.class);
customerGroup.setId(customerReportAddVo.getGroupId());
customerGroup.setName(customerReportAddVo.getGroupName());
customerGroup.setCategoryName(customerReportAddVo.getCategoryName());
groupMapper.updateById(customerGroup);
}
@Override
public void delete(String groupId) {
groupMapper.deleteById(groupId);
}
} }
package com.link.report.domain.dao.impl; 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.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.link.report.domain.dao.CustomerReportDao; import com.link.report.domain.dao.CustomerReportDao;
...@@ -26,7 +27,6 @@ public class CustomerReportDaoImpl implements CustomerReportDao { ...@@ -26,7 +27,6 @@ public class CustomerReportDaoImpl implements CustomerReportDao {
@Override @Override
public void insert(CustomerReportAddWq wq) { public void insert(CustomerReportAddWq wq) {
CustomerReport entity = BeanUtils.transitionDto(wq, CustomerReport.class); CustomerReport entity = BeanUtils.transitionDto(wq, CustomerReport.class);
customerReportMapper.insert(entity); customerReportMapper.insert(entity);
} }
...@@ -39,7 +39,8 @@ public class CustomerReportDaoImpl implements CustomerReportDao { ...@@ -39,7 +39,8 @@ public class CustomerReportDaoImpl implements CustomerReportDao {
@Override @Override
public List<CustomerReportListDto> queryCustomerReportList(CustomerReportQueryWq wq) { public List<CustomerReportListDto> queryCustomerReportList(CustomerReportQueryWq wq) {
Wrapper<CustomerReport> qw = new LambdaQueryWrapper<>(); Wrapper<CustomerReport> qw = new LambdaQueryWrapper<CustomerReport>()
.eq(ObjectUtil.isNotEmpty(wq.getCategoryName()),CustomerReport::getCategoryName, wq.getCategoryName());
// 按照条件查询 // 按照条件查询
List<CustomerReport> customerReports = customerReportMapper.selectList(qw); List<CustomerReport> customerReports = customerReportMapper.selectList(qw);
List<CustomerReportListDto> list = new ArrayList<>(); List<CustomerReportListDto> list = new ArrayList<>();
......
...@@ -18,24 +18,33 @@ import java.util.List; ...@@ -18,24 +18,33 @@ import java.util.List;
public class CustomerReportGroupDaoImpl implements CustomerReportGroupDao { public class CustomerReportGroupDaoImpl implements CustomerReportGroupDao {
@Autowired @Autowired
private CustomerReportGroupMapper reportGroupMapper; private CustomerReportGroupMapper reportGroupMapper;
@Override @Override
public List<CustomerReportGroupQueryListDto> queryList() { public List<CustomerReportGroup> list() {
// 更加登录人id查询 // 更加登录人id查询
Long userId = SecurityUtils.getLoginUser().getUserid(); List<CustomerReportGroup> list = reportGroupMapper.selectList(new LambdaQueryWrapper<>());
List<CustomerReportGroupQueryListDto> list = reportGroupMapper.queryReportGroupList(String.valueOf(userId)); return list;
}
@Override
public List<CustomerReportGroupQueryListDto> queryList() {
Long userId = SecurityUtils.getUserId();
// 更加登录人id查询
List<CustomerReportGroupQueryListDto> list = reportGroupMapper.queryReportGroupList(userId);
return list; return list;
} }
@Override @Override
public void deleteByCreatorId(Long userId) { public void deleteByCreatorId(Long userId) {
reportGroupMapper.delete(new LambdaQueryWrapper<CustomerReportGroup>() reportGroupMapper.delete(new LambdaQueryWrapper<CustomerReportGroup>()
.eq(CustomerReportGroup::getCreateBy,userId)); .eq(CustomerReportGroup::getCreateUserId, userId));
} }
@Override @Override
public void batchInsert(List<CustomerReportGroup> items) { public void batchInsert(List<CustomerReportGroup> items) {
reportGroupMapper.batchInsert(items); reportGroupMapper.batchInsert(items);
} }
@Override
public void update(CustomerReportGroup customerReportGroup) {
reportGroupMapper.updateById(customerReportGroup);
}
} }
package com.link.report.domain.entity; package com.link.report.domain.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
...@@ -45,6 +46,7 @@ public class CustomerGroup { ...@@ -45,6 +46,7 @@ public class CustomerGroup {
/** /**
* 删除标识,0 表示正常,1 表示已删除 * 删除标识,0 表示正常,1 表示已删除
*/ */
@TableLogic
private Integer delFlag; private Integer delFlag;
/** /**
* 多租户标识 * 多租户标识
...@@ -54,4 +56,6 @@ public class CustomerGroup { ...@@ -54,4 +56,6 @@ public class CustomerGroup {
* 乐观锁版本 * 乐观锁版本
*/ */
private Integer updateCount; private Integer updateCount;
private Long createUserId;
private Long updateUserId;
} }
...@@ -9,6 +9,8 @@ import java.util.Date; ...@@ -9,6 +9,8 @@ import java.util.Date;
public class CustomerReport { public class CustomerReport {
private String id; private String id;
private String code; private String code;
private String categoryName;
private String name; private String name;
private String previewUrl; private String previewUrl;
private String remark; private String remark;
...@@ -22,4 +24,6 @@ public class CustomerReport { ...@@ -22,4 +24,6 @@ public class CustomerReport {
private Integer delFlag; private Integer delFlag;
private String tenantId; private String tenantId;
private Integer updateCount; private Integer updateCount;
private Long createUserId;
private Long updateUserId;
} }
...@@ -18,4 +18,6 @@ public class CustomerReportGroup { ...@@ -18,4 +18,6 @@ public class CustomerReportGroup {
private Integer delFlag; private Integer delFlag;
private String tenantId; private String tenantId;
private Integer updateCount; private Integer updateCount;
private Long createUserId;
private Long updateUserId;
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.link.report.domain.entity.CustomerReportGroup; import com.link.report.domain.entity.CustomerReportGroup;
import com.link.report.pojo.response.CustomerReportGroupQueryListDto; import com.link.report.pojo.response.CustomerReportGroupQueryListDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -12,5 +13,5 @@ public interface CustomerReportGroupMapper extends BaseMapper<CustomerReportGrou ...@@ -12,5 +13,5 @@ public interface CustomerReportGroupMapper extends BaseMapper<CustomerReportGrou
void batchInsert(List<CustomerReportGroup> items); void batchInsert(List<CustomerReportGroup> items);
List<CustomerReportGroupQueryListDto> queryReportGroupList(String userId); List<CustomerReportGroupQueryListDto> queryReportGroupList(@Param("userId") Long userId);
} }
...@@ -2,8 +2,12 @@ package com.link.report.domain.wq; ...@@ -2,8 +2,12 @@ package com.link.report.domain.wq;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class CustomerGroupQueryWq { public class CustomerGroupQueryWq {
private String categoryName; private String categoryName;
private List<String> groupIds;
private Long createUserId;
} }
...@@ -7,4 +7,5 @@ public class CustomerReportQueryWq { ...@@ -7,4 +7,5 @@ public class CustomerReportQueryWq {
private String id; private String id;
private String name; private String name;
private String previewUrl; private String previewUrl;
private String categoryName;
} }
package com.link.report.pojo.request;
import lombok.Data;
/**
* @author : lvbencai
* @date : 2025年03月19日12:09:19
* @describe : 自定义报表查询条件
*/
@Data
public class CustomerGroupAddVo {
private String id;
private String name;
}
...@@ -9,7 +9,12 @@ import lombok.Data; ...@@ -9,7 +9,12 @@ import lombok.Data;
*/ */
@Data @Data
public class CustomerReportAddVo { public class CustomerReportAddVo {
private String id; private String groupId;
private String name; private String groupName;
private String previewUrl; private String categoryName;
private Long createUserId;
private Long updateUserId;
private String createBy;
private String updateBy;
} }
...@@ -9,5 +9,5 @@ import lombok.Data; ...@@ -9,5 +9,5 @@ import lombok.Data;
*/ */
@Data @Data
public class CustomerReportQueryListVo { public class CustomerReportQueryListVo {
private String categoryName = "供应链报表"; private String categoryName ;
} }
...@@ -7,5 +7,4 @@ public class CustomerGroupDto { ...@@ -7,5 +7,4 @@ public class CustomerGroupDto {
private String groupId; private String groupId;
private String groupName; private String groupName;
private String catalogName; private String catalogName;
} }
package com.link.report.service;
import com.link.report.pojo.request.CustomerReportAddVo;
public interface CustomerGroupService {
void save(CustomerReportAddVo customerReportAddVo);
void delete(CustomerReportAddVo customerReportAddVo);
void convert();
}
package com.link.report.service; package com.link.report.service;
import com.link.report.pojo.request.CustomerReportAddVo; import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.pojo.request.ReportShareListVo;
import com.link.report.pojo.response.CustomerReportListDto; import com.link.report.pojo.response.CustomerReportListDto;
import java.util.List; import java.util.List;
...@@ -8,6 +9,5 @@ import java.util.List; ...@@ -8,6 +9,5 @@ import java.util.List;
public interface CustomerReportService { public interface CustomerReportService {
void save(CustomerReportAddVo customerReportAddVo); void save(CustomerReportAddVo customerReportAddVo);
List<CustomerReportListDto> queryCustomerReportList(ReportShareListVo reportShareListVo);
List<CustomerReportListDto> queryCustomerReportList();
} }
package com.link.report.service.impl;
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.CustomerReportAddVo;
import com.link.report.pojo.response.CustomerGroupDto;
import com.link.report.service.CustomerGroupService;
import com.sfa.common.core.constant.SecurityConstants;
import com.sfa.common.core.domain.R;
import com.sfa.common.security.utils.SecurityUtils;
import com.sfa.system.api.RemoteUserService;
import com.sfa.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 报表分享数据
*/
@Service
public class CustomerGroupServiceImpl implements CustomerGroupService {
@Autowired
private CustomerGroupDao groupDao;
@Autowired
private CustomerReportGroupDao reportGroupDao;
@Autowired
private RemoteUserService remoteUserService;
@Override
public void save(CustomerReportAddVo customerReportAddVo) {
Long userId = SecurityUtils.getUserId();
String userName = SecurityUtils.getUsername();
customerReportAddVo.setCreateBy(userName);
customerReportAddVo.setCreateUserId(userId);
customerReportAddVo.setUpdateBy(userName);
customerReportAddVo.setUpdateUserId(userId);
if (ObjectUtil.isNotEmpty(customerReportAddVo.getGroupId())) {
groupDao.update(customerReportAddVo);
} else {
groupDao.insert(customerReportAddVo);
}
}
@Override
public void delete(CustomerReportAddVo customerReportAddVo) {
groupDao.delete(customerReportAddVo.getGroupId());
}
@Override
public void convert() {
// 查询出当前有多少关联分组的
List<CustomerReportGroup> list = reportGroupDao.list();
List<String> groupIds = list.stream().map(CustomerReportGroup::getGroupId).collect(Collectors.toList());
// 根据groupIds
CustomerGroupQueryWq wq = new CustomerGroupQueryWq();
wq.setGroupIds(groupIds);
List<CustomerGroupDto> groupDtos = groupDao.queryList(wq);
// 转成map key 为groupid value 为CustomerGroupDto对象
Map<String, CustomerGroupDto> dtoMap = groupDtos.stream().collect(Collectors.toMap(CustomerGroupDto::getGroupId, item -> item));
// 创建 不同人的分组信息
for (int i = 0; i < list.size(); i++) {
//获取组id
CustomerReportGroup customerReportGroup = list.get(i);
String groupId = customerReportGroup.getGroupId();
// groupDtos中找到匹配的数据
CustomerGroupDto customerGroupDto = dtoMap.get(groupId);
if (ObjectUtil.isNotEmpty(customerGroupDto)) {
// 匹配到了
CustomerReportAddVo customerReportAddVo = new CustomerReportAddVo();
customerReportAddVo.setCategoryName(customerGroupDto.getCatalogName());
customerReportAddVo.setGroupName(customerGroupDto.getGroupName());
customerReportAddVo.setCreateBy(customerReportGroup.getCreateBy());
customerReportAddVo.setUpdateBy(customerReportGroup.getUpdateBy());
R<LoginUser> userResult =remoteUserService.getUserInfo(customerReportGroup.getCreateBy(), SecurityConstants.INNER) ;
Long userid = userResult.getData().getSysUser().getUserId();
customerReportAddVo.setCreateUserId(userid);
customerReportAddVo.setUpdateUserId(userid);
groupDao.insert(customerReportAddVo);
// 修改数据
customerReportGroup.setGroupId(customerReportAddVo.getGroupId());
// 更新 分组id
reportGroupDao.update(customerReportGroup);
}
}
}
}
...@@ -36,7 +36,8 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic ...@@ -36,7 +36,8 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic
@Override @Override
public List<CustomerReportGroupResDto> queryList(CustomerReportQueryListVo vo) { public List<CustomerReportGroupResDto> queryList(CustomerReportQueryListVo vo) {
CustomerGroupQueryWq wq = new CustomerGroupQueryWq(); CustomerGroupQueryWq wq = new CustomerGroupQueryWq();
wq.setCategoryName(vo.getCategoryName()); // wq.setCategoryName(vo.getCategoryName());
wq.setCreateUserId(SecurityUtils.getLoginUser().getUserid());
// 先查询分组 // 先查询分组
List<CustomerGroupDto> groupDtos = customerGroupDao.queryList(wq); List<CustomerGroupDto> groupDtos = customerGroupDao.queryList(wq);
List<CustomerReportGroupQueryListDto> list = customerReportGroupDao.queryList(); List<CustomerReportGroupQueryListDto> list = customerReportGroupDao.queryList();
...@@ -63,8 +64,6 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic ...@@ -63,8 +64,6 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic
resDto.setItems(itemsDtos); resDto.setItems(itemsDtos);
result.add(resDto); result.add(resDto);
} }
return result; return result;
} }
...@@ -77,7 +76,6 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic ...@@ -77,7 +76,6 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic
@Override @Override
public void save(List<CustomerReportGroupVo> customerReportGroupVo) { public void save(List<CustomerReportGroupVo> customerReportGroupVo) {
// 新增或者修改 先删除后新增 // 新增或者修改 先删除后新增
Long userId = SecurityUtils.getLoginUser().getUserid(); Long userId = SecurityUtils.getLoginUser().getUserid();
customerReportGroupDao.deleteByCreatorId(userId); customerReportGroupDao.deleteByCreatorId(userId);
...@@ -92,7 +90,10 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic ...@@ -92,7 +90,10 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic
dto.setGroupId(vo.getGroupId()); dto.setGroupId(vo.getGroupId());
dto.setReportId(item.getReportId()); dto.setReportId(item.getReportId());
dto.setReportType(item.getReportType()); dto.setReportType(item.getReportType());
dto.setCreateBy(String.valueOf(userId)); dto.setCreateBy(SecurityUtils.getUsername());
dto.setCreateUserId(userId);
dto.setUpdateBy(SecurityUtils.getUsername());
dto.setUpdateUserId(userId);
dto.setTenantId(String.valueOf(userId)); dto.setTenantId(String.valueOf(userId));
items.add(dto); items.add(dto);
} }
......
...@@ -5,6 +5,7 @@ import com.link.report.domain.dao.CustomerReportDao; ...@@ -5,6 +5,7 @@ import com.link.report.domain.dao.CustomerReportDao;
import com.link.report.domain.wq.CustomerReportAddWq; import com.link.report.domain.wq.CustomerReportAddWq;
import com.link.report.domain.wq.CustomerReportQueryWq; import com.link.report.domain.wq.CustomerReportQueryWq;
import com.link.report.pojo.request.CustomerReportAddVo; import com.link.report.pojo.request.CustomerReportAddVo;
import com.link.report.pojo.request.ReportShareListVo;
import com.link.report.pojo.response.CustomerReportListDto; import com.link.report.pojo.response.CustomerReportListDto;
import com.link.report.service.CustomerReportService; import com.link.report.service.CustomerReportService;
import com.sfa.common.core.utils.bean.BeanUtils; import com.sfa.common.core.utils.bean.BeanUtils;
...@@ -34,8 +35,9 @@ public class CustomerReportServiceImpl implements CustomerReportService { ...@@ -34,8 +35,9 @@ public class CustomerReportServiceImpl implements CustomerReportService {
} }
@Override @Override
public List<CustomerReportListDto> queryCustomerReportList( ) { public List<CustomerReportListDto> queryCustomerReportList(ReportShareListVo reportShareListVo) {
CustomerReportQueryWq wq = new CustomerReportQueryWq(); CustomerReportQueryWq wq = new CustomerReportQueryWq();
wq.setCategoryName(reportShareListVo.getCategoryName());
List<CustomerReportListDto> list = customerReportDao.queryCustomerReportList(wq); List<CustomerReportListDto> list = customerReportDao.queryCustomerReportList(wq);
return list; return list;
} }
......
...@@ -34,7 +34,7 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI { ...@@ -34,7 +34,7 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
*/ */
@Override @Override
public String getToken(HttpServletRequest request) { public String getToken(HttpServletRequest request) {
String token = ""; String token = "";
if (request != null) { if (request != null) {
token = request.getParameter("token"); token = request.getParameter("token");
if (ObjectUtil.isEmpty(token)) { if (ObjectUtil.isEmpty(token)) {
...@@ -66,10 +66,10 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI { ...@@ -66,10 +66,10 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
LoginUser loginUser = tokenService.getLoginUser(s); LoginUser loginUser = tokenService.getLoginUser(s);
Set<String> roles = loginUser.getRoles(); Set<String> roles = loginUser.getRoles();
// it可以设计任何报表 // it可以设计任何报表
if (!ObjectUtil.isAllNotEmpty( loginUser.getSysUser(),loginUser.getSysUser().getDept() if (!ObjectUtil.isAllNotEmpty(loginUser.getSysUser(), loginUser.getSysUser().getDept()
,loginUser.getSysUser().getDept().getDeptName()) && , loginUser.getSysUser().getDept().getDeptName()) &&
// 信息中心可以编辑所有报表 // 信息中心可以编辑所有报表
loginUser.getSysUser().getDept().getDeptName().contains("信息技术中心")) { loginUser.getSysUser().getDept().getDeptName().contains("信息技术中心")) {
roles.add("admin"); roles.add("admin");
} }
return roles.toArray(new String[0]); return roles.toArray(new String[0]);
...@@ -88,7 +88,6 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI { ...@@ -88,7 +88,6 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
} }
/** /**
* 自定义请求头 * 自定义请求头
*/ */
...@@ -117,16 +116,9 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI { ...@@ -117,16 +116,9 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
//都不具备则不能访问 //都不具备则不能访问
return "NO"; return "NO";
} }
//具备admin或者管理员权限才可访问所有报表
// if (SecurityUtils.isAdmin(loginUser.getUserid())
// || loginUser.getRoles().contains("it")
// // 信息中心可以编辑所有报表
// || loginUser.getSysUser().getDept().getDeptName().contains("信息技术中心")) {
// return "1";
// }
Long deptId = loginUser.getSysUser().getDept().getDeptId(); Long deptId = loginUser.getSysUser().getDept().getDeptId();
return String.valueOf(deptId); return String.valueOf(deptId);
} }
@Override @Override
public Map<String, Object> getUserInfo(String token) { public Map<String, Object> getUserInfo(String token) {
...@@ -154,12 +146,12 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI { ...@@ -154,12 +146,12 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
return new String[0]; return new String[0];
} }
Set<String> permissions = loginUser.getPermissions(); Set<String> permissions = loginUser.getPermissions();
if(ObjectUtil.isNotEmpty(permissions)){ if (ObjectUtil.isNotEmpty(permissions)) {
permissions.add("drag:datasource:testConnection"); permissions.add("drag:datasource:testConnection");
permissions.add("onl:drag:clear:recoverry"); permissions.add("onl:drag:clear:recoverry");
permissions.add("drag:analysis:sql"); permissions.add("drag:analysis:sql");
permissions.add("drag:design:getTotalData"); permissions.add("drag:design:getTotalData");
return permissions .toArray(new String[0]); return permissions.toArray(new String[0]);
} }
return new String[0]; return new String[0];
......
spring: spring:
profiles: profiles:
active: dev active: dev
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
report_type, report_type,
group_id, group_id,
create_by, create_by,
create_user_id,
create_time, create_time,
update_by, update_by,
update_user_id,
update_time, update_time,
del_flag, del_flag,
tenant_id, tenant_id,
...@@ -24,8 +26,10 @@ ...@@ -24,8 +26,10 @@
#{item.reportType}, #{item.reportType},
#{item.groupId}, #{item.groupId},
#{item.createBy}, #{item.createBy},
#{item.createUserId},
#{item.createTime}, #{item.createTime},
#{item.updateBy}, #{item.updateBy},
#{item.updateUserId},
#{item.updateTime}, #{item.updateTime},
#{item.delFlag}, #{item.delFlag},
#{item.tenantId}, #{item.tenantId},
...@@ -51,8 +55,9 @@ ...@@ -51,8 +55,9 @@
join customer_report cr on crg.report_id = cr.id and crg.report_type = cr.report_type join customer_report cr on crg.report_id = cr.id and crg.report_type = cr.report_type
<where> <where>
cg.del_flag = 0
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
AND crg.create_by = #{userId} AND cg.create_user_id = #{userId}
</if> </if>
</where> </where>
<!-- 积木报表关联 --> <!-- 积木报表关联 -->
...@@ -73,7 +78,7 @@ ...@@ -73,7 +78,7 @@
join jimu_report_share jrs on jr.id = jrs.report_id join jimu_report_share jrs on jr.id = jrs.report_id
<where> <where>
<if test="userId!= null and userId!= ''"> <if test="userId!= null and userId!= ''">
AND crg.create_by = #{userId} AND crg.create_user_id = #{userId}
</if> </if>
</where> </where>
) tmp ) tmp
......
...@@ -19,12 +19,6 @@ ...@@ -19,12 +19,6 @@
<select id="selectShareList" resultType="com.link.report.pojo.response.ReportShareBiListDto"> <select id="selectShareList" resultType="com.link.report.pojo.response.ReportShareBiListDto">
select jrs.id,jrs.report_id as reportId , select jrs.id,jrs.report_id as reportId ,
jrs.preview_url as previewUrl, 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 as reportName, jr.name as reportName,
1 as reportType 1 as reportType
from jimu_report_share jrs from jimu_report_share jrs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论