|
@@ -94,6 +94,9 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
@Resource
|
|
@Resource
|
|
private FinanceExcludeProjectMapper financeExcludeProjectMapper;
|
|
private FinanceExcludeProjectMapper financeExcludeProjectMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private DepartmentService departmentService;
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private ProjectMapper projectMapper;
|
|
private ProjectMapper projectMapper;
|
|
@Value(value = "${upload.path}")
|
|
@Value(value = "${upload.path}")
|
|
@@ -103,7 +106,11 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
public HttpRespMsg getByMonth(Integer companyId, String yearMonth,Integer deptId) {
|
|
public HttpRespMsg getByMonth(Integer companyId, String yearMonth,Integer deptId) {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
// List<Finance> financeList = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
// List<Finance> financeList = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
- List<Finance> financeList = financeMapper.selectListByDept(companyId, yearMonth,deptId);
|
|
|
|
|
|
+ //查看当前部门包括子部门的人员
|
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
|
+ deptId = deptId == null ? -1 : deptId;
|
|
|
|
+ List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
|
+ List<Finance> financeList = financeMapper.selectListByDept(companyId, yearMonth,deptIds);
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
//当前月是否有项目日报数据
|
|
//当前月是否有项目日报数据
|
|
List<Map<String, Object>> userList = reportMapper.selectFillReportUserList(companyId, yearMonth+"-01", yearMonth+"-31");
|
|
List<Map<String, Object>> userList = reportMapper.selectFillReportUserList(companyId, yearMonth+"-01", yearMonth+"-31");
|
|
@@ -777,7 +784,10 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
// List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
|
|
// List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
|
|
/**添加非分摊项目过滤*/
|
|
/**添加非分摊项目过滤*/
|
|
- List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId,deptId);
|
|
|
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
|
+ deptId = deptId == null ? -1 : deptId;
|
|
|
|
+ List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
|
+ List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId,deptIds);
|
|
//如果定义了可分摊项目的过滤,按照数据处理一下
|
|
//如果定义了可分摊项目的过滤,按照数据处理一下
|
|
CostProjectSetting setting = costProjectSettingMapper.selectOne(new QueryWrapper<CostProjectSetting>().eq("company_id", companyId));
|
|
CostProjectSetting setting = costProjectSettingMapper.selectOne(new QueryWrapper<CostProjectSetting>().eq("company_id", companyId));
|
|
if (setting != null && setting.getSettingType() > 0) {
|
|
if (setting != null && setting.getSettingType() > 0) {
|
|
@@ -819,7 +829,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
// List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
- List<Finance> finances = financeMapper.selectListByDept(companyId,yearMonth,deptId);
|
|
|
|
|
|
+ List<Finance> finances = financeMapper.selectListByDept(companyId, yearMonth,deptIds);
|
|
List<Finance> noProjectUser = new ArrayList<>();
|
|
List<Finance> noProjectUser = new ArrayList<>();
|
|
//计算无项目的人员
|
|
//计算无项目的人员
|
|
for (Finance f : finances) {
|
|
for (Finance f : finances) {
|
|
@@ -2006,7 +2016,10 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
// List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
|
|
// List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
|
|
/**添加非分摊项目过滤*/
|
|
/**添加非分摊项目过滤*/
|
|
- List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId,deptId);
|
|
|
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
|
+ deptId = deptId == null ? -1 : deptId;
|
|
|
|
+ List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
|
+ List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId,deptIds);
|
|
//如果定义了可分摊项目的过滤,按照数据处理一下
|
|
//如果定义了可分摊项目的过滤,按照数据处理一下
|
|
CostProjectSetting setting = costProjectSettingMapper.selectOne(new QueryWrapper<CostProjectSetting>().eq("company_id", companyId));
|
|
CostProjectSetting setting = costProjectSettingMapper.selectOne(new QueryWrapper<CostProjectSetting>().eq("company_id", companyId));
|
|
if (setting != null && setting.getSettingType() > 0) {
|
|
if (setting != null && setting.getSettingType() > 0) {
|
|
@@ -2046,7 +2059,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
// List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
- List<Finance> finances = financeMapper.selectListByDept(companyId,yearMonth,deptId);
|
|
|
|
|
|
+ List<Finance> finances = financeMapper.selectListByDept(companyId, yearMonth,deptIds);
|
|
//未投入项目的人员
|
|
//未投入项目的人员
|
|
ProjectSumItem noProjectItem = new ProjectSumItem();
|
|
ProjectSumItem noProjectItem = new ProjectSumItem();
|
|
List<Finance> noProjectUser = new ArrayList<>();
|
|
List<Finance> noProjectUser = new ArrayList<>();
|
|
@@ -2341,7 +2354,10 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
//获取月成本列表
|
|
//获取月成本列表
|
|
// List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
// List<Finance> finances = financeMapper.selectList(new QueryWrapper<Finance>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
- List<Finance> finances = financeMapper.selectListByDept(companyId,yearMonth,deptId);
|
|
|
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
|
+ deptId = deptId == null ? -1 : deptId;
|
|
|
|
+ List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
|
+ List<Finance> finances = financeMapper.selectListByDept(companyId, yearMonth,deptIds);
|
|
for (Finance f : finances) {
|
|
for (Finance f : finances) {
|
|
User user = userList.stream().filter(ul -> ul.getId().equals(f.getUserId())).findFirst().get();
|
|
User user = userList.stream().filter(ul -> ul.getId().equals(f.getUserId())).findFirst().get();
|
|
BigDecimal cost = f.getTotalCost();
|
|
BigDecimal cost = f.getTotalCost();
|