|
|
@@ -0,0 +1,108 @@
|
|
|
+package com.management.platform.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.management.platform.entity.*;
|
|
|
+import com.management.platform.mapper.*;
|
|
|
+import com.management.platform.service.MainDbProjectService;
|
|
|
+import com.management.platform.service.ProjectService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Service
|
|
|
+@DS("main_db")
|
|
|
+public class MainDbProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements MainDbProjectService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ProjectMapper projectMapper;
|
|
|
+ @Resource
|
|
|
+ private ParticipationMapper participationMapper;
|
|
|
+ @Resource
|
|
|
+ private ProjectAuditorMapper projectAuditorMapper;
|
|
|
+ @Resource
|
|
|
+ private UserMapper userMapper;
|
|
|
+ @Resource
|
|
|
+ private ReportMapper reportMapper;
|
|
|
+ @Resource
|
|
|
+ private ReportLogMapper reportLogMapper;
|
|
|
+ @Resource
|
|
|
+ private ReportLogDetailMapper reportLogDetailMapper;
|
|
|
+ @Resource
|
|
|
+ private CompanyMapper companyMapper;
|
|
|
+ @Resource
|
|
|
+ private TimeTypeMapper timeTypeMapper;
|
|
|
+ @Resource
|
|
|
+ private SysRoleMapper sysRoleMapper;
|
|
|
+ @Resource
|
|
|
+ private SysRoleModuleMapper sysRoleModuleMapper;
|
|
|
+ @Resource
|
|
|
+ private SysRoleFunctionMapper sysRoleFunctionMapper;
|
|
|
+ @Resource
|
|
|
+ private DepartmentMapper departmentMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CompanyInfo getCompanyInfo(Integer companyId) {
|
|
|
+ CompanyInfo companyInfo = new CompanyInfo();
|
|
|
+ companyInfo.company = companyMapper.selectById(companyId);
|
|
|
+ companyInfo.timeType = timeTypeMapper.selectById(companyId);
|
|
|
+ companyInfo.sysRole = sysRoleMapper.selectList(new QueryWrapper<SysRole>().eq("company_id", companyId));
|
|
|
+ List<Integer> roleIds = companyInfo.sysRole.stream().map(SysRole::getId).collect(Collectors.toList());
|
|
|
+ companyInfo.sysRoleModule = sysRoleModuleMapper.selectList(new QueryWrapper<SysRoleModule>().in("role_id", roleIds));
|
|
|
+ companyInfo.sysRoleFunction = sysRoleFunctionMapper.selectList(new QueryWrapper<SysRoleFunction>().in("role_id", roleIds));
|
|
|
+ return companyInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Project> getMainDbProjectList(Integer companyId) {
|
|
|
+ return projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Participation> getMainDbProjectParticipations(Integer companyId) {
|
|
|
+ return participationMapper.getByCompanyId(companyId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProjectAuditor> getMainDbProjectAuditors(Integer companyId) {
|
|
|
+ return projectAuditorMapper.getByCompanyId(companyId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Department> getMainDbDepartmentList(Integer companyId) {
|
|
|
+ return departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<User> getMainDbUserList(Integer companyId) {
|
|
|
+ return userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Report> getMainDbReportList(Integer companyId, String startDate, String endDate) {
|
|
|
+ return reportMapper.selectList(new QueryWrapper<Report>().eq("company_id", companyId).between("create_date", startDate, endDate));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ReportLog> getMainDbReportLogList(Integer companyId, String startDate, String endDate) {
|
|
|
+ return reportLogMapper.selectList(new QueryWrapper<ReportLog>().eq("company_id", companyId).between("create_date", startDate, endDate));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ReportLogDetail> getMainDbReportLogDetailList(Integer companyId, String startDate, String endDate) {
|
|
|
+ return reportLogDetailMapper.selectList(new QueryWrapper<ReportLogDetail>().eq("company_id", companyId).between("work_date", startDate, endDate));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class CompanyInfo {
|
|
|
+ public Company company;
|
|
|
+ public TimeType timeType;
|
|
|
+ public List<SysRole> sysRole;
|
|
|
+ public List<SysRoleModule> sysRoleModule;
|
|
|
+ public List<SysRoleFunction> sysRoleFunction;
|
|
|
+ }
|
|
|
+}
|