|
@@ -100,9 +100,10 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
private String path;
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getByMonth(Integer companyId, String yearMonth) {
|
|
|
+ public HttpRespMsg getByMonth(Integer companyId, String yearMonth,Integer deptId) {
|
|
|
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);
|
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
//当前月是否有项目日报数据
|
|
|
List<Map<String, Object>> userList = reportMapper.selectFillReportUserList(companyId, yearMonth+"-01", yearMonth+"-31");
|
|
@@ -655,7 +656,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportData(Integer groupByCategory,Integer onlyTotal, String yearMonth, Boolean assignNoProUser, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg exportData(Integer groupByCategory,Integer onlyTotal, String yearMonth, Boolean assignNoProUser, Integer deptId,HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
@@ -776,7 +777,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
// List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
|
|
|
/**添加非分摊项目过滤*/
|
|
|
- List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId);
|
|
|
+ List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId,deptId);
|
|
|
//如果定义了可分摊项目的过滤,按照数据处理一下
|
|
|
CostProjectSetting setting = costProjectSettingMapper.selectOne(new QueryWrapper<CostProjectSetting>().eq("company_id", companyId));
|
|
|
if (setting != null && setting.getSettingType() > 0) {
|
|
@@ -817,7 +818,8 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
userTime.get(creatorId).workingTime = userTime.get(creatorId).workingTime.add(new BigDecimal((Double)map.get("workingTime")));
|
|
|
}
|
|
|
}
|
|
|
- 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> noProjectUser = new ArrayList<>();
|
|
|
//计算无项目的人员
|
|
|
for (Finance f : finances) {
|
|
@@ -1990,7 +1992,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getTimeCost(String yearMonth, Boolean assignNoProUser, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg getTimeCost(String yearMonth,Integer deptId, Boolean assignNoProUser, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
@@ -2004,7 +2006,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
// List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
|
|
|
/**添加非分摊项目过滤*/
|
|
|
- List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId);
|
|
|
+ List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTimeNew(yearMonth,startDate, endDate, companyId,deptId);
|
|
|
//如果定义了可分摊项目的过滤,按照数据处理一下
|
|
|
CostProjectSetting setting = costProjectSettingMapper.selectOne(new QueryWrapper<CostProjectSetting>().eq("company_id", companyId));
|
|
|
if (setting != null && setting.getSettingType() > 0) {
|
|
@@ -2043,7 +2045,8 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
userTime.put(creatorId, d);
|
|
|
}
|
|
|
}
|
|
|
- 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);
|
|
|
//未投入项目的人员
|
|
|
ProjectSumItem noProjectItem = new ProjectSumItem();
|
|
|
List<Finance> noProjectUser = new ArrayList<>();
|
|
@@ -2216,7 +2219,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
resultMap.put("noProjectItem", noProjectItem);
|
|
|
resultMap.put("totalMoneyCost", totalMoneyCost);
|
|
|
if (missingFinanceUserIds.size() > 0) {
|
|
|
- List<Map<String, Object>> userList = userMapper.getSimpleNameList(new QueryWrapper<User>().in("id", missingFinanceUserIds));
|
|
|
+ List<Map<String, Object>> userList = userMapper.getSimpleNameList(new QueryWrapper<User>().in("id", missingFinanceUserIds).eq("department_id",deptId));
|
|
|
resultMap.put("missingFinanceUserList", userList);
|
|
|
} else {
|
|
|
resultMap.put("missingFinanceUserList", new ArrayList<>());
|
|
@@ -2286,7 +2289,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportFinance(String yearMonth, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg exportFinance(String yearMonth,Integer deptId, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
@@ -2337,7 +2340,8 @@ 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);
|
|
|
for (Finance f : finances) {
|
|
|
User user = userList.stream().filter(ul -> ul.getId().equals(f.getUserId())).findFirst().get();
|
|
|
BigDecimal cost = f.getTotalCost();
|