|
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.zjugis.framework.common.pojo.CommonResult;
|
|
|
import com.zjugis.framework.common.pojo.PageResult;
|
|
|
import com.zjugis.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
+import com.zjugis.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import com.zjugis.module.adm.controller.admin.report.dto.report.ReportListQueryDTO;
|
|
|
import com.zjugis.module.adm.controller.admin.report.dto.report.ReportPageReqDTO;
|
|
|
import com.zjugis.module.adm.controller.admin.report.dto.report.ReportQueryDTO;
|
|
@@ -47,6 +48,8 @@ import com.zjugis.module.system.api.dept.DeptApi;
|
|
|
import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import com.zjugis.module.system.api.dict.DictDataApi;
|
|
|
import com.zjugis.module.system.api.dict.dto.DictDataRespDTO;
|
|
|
+import com.zjugis.module.system.api.permission.PermissionApi;
|
|
|
+import com.zjugis.module.system.api.permission.dto.DeptDataPermissionRespDTO;
|
|
|
import com.zjugis.module.system.api.user.AdminUserApi;
|
|
|
import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -122,6 +125,9 @@ public class ReportServiceImpl implements ReportService {
|
|
|
@Resource
|
|
|
private BusinessService businessService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private PermissionApi permissionApi;
|
|
|
+
|
|
|
/**
|
|
|
* 新增工作报告
|
|
|
*
|
|
@@ -168,6 +174,9 @@ public class ReportServiceImpl implements ReportService {
|
|
|
@Override
|
|
|
public PageResult<ReportRespVO> getReportPage(ReportPageReqDTO reqVO) {
|
|
|
PageResult<ReportRespVO> reportPageResult = ReportConvert.INSTANCE.convertPage(reportMapper.selectPage(reqVO));
|
|
|
+ if (reportPageResult.getTotal() == 0L) {
|
|
|
+ return reportPageResult;
|
|
|
+ }
|
|
|
List<ReportRespVO> reportList = reportPageResult.getList();
|
|
|
List<Long> reportIds = reportList.stream().map(ReportRespVO::getId).collect(Collectors.toList());
|
|
|
|
|
@@ -341,20 +350,22 @@ public class ReportServiceImpl implements ReportService {
|
|
|
*/
|
|
|
@Override
|
|
|
public PageResult<ReportStatisticRespVO> getReportStatistics(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
+ List<ReportStatisticRespVO> respList = this.getReportStatisticsList(reportStatisticReqDTO);
|
|
|
+ PageResult<ReportStatisticRespVO> pages = PageUtil.getPages(reportStatisticReqDTO.getPageNo(), reportStatisticReqDTO.getPageSize(), respList);
|
|
|
+ pages.setTotal(Long.valueOf(respList.size()));
|
|
|
+ return pages;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<ReportStatisticRespVO> getReportStatisticsList(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
Short year = reportStatisticReqDTO.getYear();
|
|
|
Short month = reportStatisticReqDTO.getMonth();
|
|
|
- List<AdminUserRespDTO> records = new ArrayList<>();
|
|
|
- //部门id及子部门id
|
|
|
- Set<String> deptIds = null;
|
|
|
- if (StringUtils.isNotBlank(reportStatisticReqDTO.getDeptId())) {
|
|
|
- deptIds = convertSet(deptApi.getChildDeptList(reportStatisticReqDTO.getDeptId()).getCheckedData(), DeptRespDTO::getId);
|
|
|
- //添加自身部门
|
|
|
- deptIds.add(reportStatisticReqDTO.getDeptId());
|
|
|
- records = adminUserApi.getUserListByDeptIds(deptIds).getData();
|
|
|
- } else {
|
|
|
- records = adminUserApi.getUserList().getData();
|
|
|
+ //获取部门及关联部门的用户
|
|
|
+ DeptDataPermissionRespDTO dto = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()).getCheckedData();
|
|
|
+ Set<String> deptIds = dto.getDeptIds();
|
|
|
+ if (CollectionUtils.isEmpty(deptIds)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
-
|
|
|
+ List<AdminUserRespDTO> records = adminUserApi.getUserListByDeptIds(deptIds).getData();
|
|
|
if (StrUtil.isNotBlank(reportStatisticReqDTO.getUserId())) {
|
|
|
records = records.stream().filter(user -> reportStatisticReqDTO.getUserId().equals(user.getId())).collect(Collectors.toList());
|
|
|
}
|
|
@@ -390,9 +401,16 @@ public class ReportServiceImpl implements ReportService {
|
|
|
respList.add(statisticRespVO);
|
|
|
}
|
|
|
respList = respList.stream().sorted(Comparator.comparing(c -> PinyinUtil.toFirstLetter(c.getDeptName()))).collect(Collectors.toList());
|
|
|
- PageResult<ReportStatisticRespVO> pages = PageUtil.getPages(reportStatisticReqDTO.getPageNo(), reportStatisticReqDTO.getPageSize(), respList);
|
|
|
- pages.setTotal(Long.valueOf(records.size()));
|
|
|
- return pages;
|
|
|
+ return respList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String sendFillRemind(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
+ List<ReportStatisticRespVO> reportStatisticsList = this.getReportStatisticsList(reportStatisticReqDTO);
|
|
|
+ List<String> userIdList = reportStatisticsList.stream().filter(c -> c.getFillRate() == null || new BigDecimal(c.getFillRate()).compareTo(BigDecimal.ZERO) == 0)
|
|
|
+ .map(ReportStatisticRespVO::getUserId).collect(Collectors.toList());
|
|
|
+ reportDingService.sendFillRemind(userIdList, reportStatisticReqDTO.getReportType(), reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth());
|
|
|
+
|
|
|
+ return "发送成功";
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -740,7 +758,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<ReportWorkloadIndexStatisticVO> getReportWorkloadStatistics(ReportWorkloadStatisticDTO rep) {
|
|
|
+ public List<ReportWorkloadIndexStatisticVO> getReportWorkloadStatistics(ReportWorkloadStatisticDTO rep) {
|
|
|
QueryWrapper<ReportWorkloadDO> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("REPORT.DELETED", 0);
|
|
|
queryWrapper.eq("WORKLOAD.DELETED", 0);
|
|
@@ -790,7 +808,6 @@ public class ReportServiceImpl implements ReportService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 检验报告是否存在
|
|
|
*
|