|
@@ -26,6 +26,7 @@ import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.text.DecimalFormat;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -735,7 +736,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
for (Map<String, Object> map : projectTimeList) {
|
|
for (Map<String, Object> map : projectTimeList) {
|
|
- Integer projectId = (Integer) map.get("projectId");
|
|
|
|
|
|
+ Integer projectId = ((Long) map.get("projectId")).intValue();
|
|
String curProjectCode = (String) map.get("projectCode");
|
|
String curProjectCode = (String) map.get("projectCode");
|
|
String categoryName = (String) map.get("categoryName");
|
|
String categoryName = (String) map.get("categoryName");
|
|
String curProject = (String) map.get("project");
|
|
String curProject = (String) map.get("project");
|
|
@@ -778,7 +779,8 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
// System.out.println("财务数据中未找到用户:"+creatorId);
|
|
// System.out.println("财务数据中未找到用户:"+creatorId);
|
|
}
|
|
}
|
|
|
|
|
|
- if (curProject.equals(item.project)) {
|
|
|
|
|
|
+ //改成按照projectId匹配,之前projectname可能存在重名问题。
|
|
|
|
+ if (projectId.equals(item.projectId)) {
|
|
item.workingTime += workingTime;
|
|
item.workingTime += workingTime;
|
|
item.cost = item.cost.add(cost);
|
|
item.cost = item.cost.add(cost);
|
|
item.salary = item.salary.add(salary);
|
|
item.salary = item.salary.add(salary);
|
|
@@ -839,7 +841,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
if (assignNoProUser != null && assignNoProUser) {
|
|
if (assignNoProUser != null && assignNoProUser) {
|
|
List<FinanceProjects> notInFPList = new ArrayList<FinanceProjects>();
|
|
List<FinanceProjects> notInFPList = new ArrayList<FinanceProjects>();
|
|
financeProjects.forEach(f->{
|
|
financeProjects.forEach(f->{
|
|
- if (!projectTimeList.stream().anyMatch(map->((Integer)map.get("projectId")).equals(f.getProjectId()))) {
|
|
|
|
|
|
+ if (!projectTimeList.stream().anyMatch(map->(((Long)map.get("projectId"))).intValue() == f.getProjectId())) {
|
|
notInFPList.add(f);
|
|
notInFPList.add(f);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -935,6 +937,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
//查找所有部门
|
|
//查找所有部门
|
|
List<Department> allDepartments = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
List<Department> allDepartments = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
//按项目名称分组
|
|
//按项目名称分组
|
|
|
|
+ DecimalFormat workTimeFormatter = new DecimalFormat("0.00");
|
|
if (groupByCategory == 0) {
|
|
if (groupByCategory == 0) {
|
|
pList.forEach(p->{
|
|
pList.forEach(p->{
|
|
p.cost = p.cost.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
p.cost = p.cost.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
@@ -958,7 +961,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
//部门空出来
|
|
//部门空出来
|
|
rowData.add("");
|
|
rowData.add("");
|
|
userCustoms.forEach(userCustom -> {rowData.add("");});
|
|
userCustoms.forEach(userCustom -> {rowData.add("");});
|
|
- rowData.add(p.workingTime+"");
|
|
|
|
|
|
+ rowData.add(workTimeFormatter.format(p.workingTime));
|
|
rowData.add(p.salary.toPlainString());
|
|
rowData.add(p.salary.toPlainString());
|
|
rowData.add(p.bonus.toPlainString());
|
|
rowData.add(p.bonus.toPlainString());
|
|
rowData.add(p.allowance.toPlainString());
|
|
rowData.add(p.allowance.toPlainString());
|
|
@@ -981,7 +984,10 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
//获取成员
|
|
//获取成员
|
|
for (Map<String, Object> membMap : projectTimeList) {
|
|
for (Map<String, Object> membMap : projectTimeList) {
|
|
- if (membMap.get("project").equals(p.project)) {
|
|
|
|
|
|
+// if (membMap.get("project").equals(p.project)) {
|
|
|
|
+ Integer projectId = ((Long) membMap.get("projectId")).intValue();
|
|
|
|
+ //修改为按照projectId匹配
|
|
|
|
+ if (projectId.equals(p.projectId)) {
|
|
//匹配到项目了
|
|
//匹配到项目了
|
|
List<String> membRowData = new ArrayList<String>();
|
|
List<String> membRowData = new ArrayList<String>();
|
|
membRowData.add(p.projectCode);
|
|
membRowData.add(p.projectCode);
|
|
@@ -1040,7 +1046,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- membRowData.add(workingTime+"");
|
|
|
|
|
|
+ membRowData.add(workTimeFormatter.format(workingTime));
|
|
membRowData.add(salary.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(salary.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(bonus.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(bonus.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(allowance.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(allowance.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
@@ -1126,7 +1132,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- membRowData.add(workingTime+"");
|
|
|
|
|
|
+ membRowData.add(workTimeFormatter.format(workingTime));
|
|
membRowData.add(salary.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(salary.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(bonus.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(bonus.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(allowance.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
membRowData.add(allowance.setScale(6, BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
@@ -1335,6 +1341,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
f.setHourCost(new BigDecimal(0));
|
|
f.setHourCost(new BigDecimal(0));
|
|
if (noProjectItem.project == null) {
|
|
if (noProjectItem.project == null) {
|
|
//noProjectItem.project = "无项目";
|
|
//noProjectItem.project = "无项目";
|
|
|
|
+ noProjectItem.projectId = 0;
|
|
noProjectItem.project = MessageUtils.message("entry.noProject");
|
|
noProjectItem.project = MessageUtils.message("entry.noProject");
|
|
noProjectItem.workingTime = 0;
|
|
noProjectItem.workingTime = 0;
|
|
noProjectItem.cost = new BigDecimal(0);
|
|
noProjectItem.cost = new BigDecimal(0);
|
|
@@ -1348,7 +1355,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
List<String> missingFinanceUserIds = new ArrayList<>();
|
|
List<String> missingFinanceUserIds = new ArrayList<>();
|
|
for (Map<String, Object> map : projectTimeList) {
|
|
for (Map<String, Object> map : projectTimeList) {
|
|
- Integer projectId = (Integer) map.get("projectId");
|
|
|
|
|
|
+ Integer projectId = ((Long) map.get("projectId")).intValue();
|
|
String curProject = (String) map.get("project");
|
|
String curProject = (String) map.get("project");
|
|
String creatorId = (String) map.get("creatorId");
|
|
String creatorId = (String) map.get("creatorId");
|
|
Optional<Finance> first = finances.stream().filter(f -> f.getUserId().equals(creatorId)).findFirst();
|
|
Optional<Finance> first = finances.stream().filter(f -> f.getUserId().equals(creatorId)).findFirst();
|
|
@@ -1365,7 +1372,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
if (curProject == null) {
|
|
if (curProject == null) {
|
|
System.out.println("projectId="+projectId+", creatorId="+creatorId);
|
|
System.out.println("projectId="+projectId+", creatorId="+creatorId);
|
|
}
|
|
}
|
|
- if (curProject.equals(item.project)) {
|
|
|
|
|
|
+ if (projectId.equals(item.projectId)) {
|
|
item.workingTime += workingTime;
|
|
item.workingTime += workingTime;
|
|
item.cost = item.cost.add(cost);
|
|
item.cost = item.cost.add(cost);
|
|
} else {
|
|
} else {
|
|
@@ -1429,7 +1436,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
|
|
|
List<FinanceProjects> notInFPList = new ArrayList<FinanceProjects>();
|
|
List<FinanceProjects> notInFPList = new ArrayList<FinanceProjects>();
|
|
financeProjects.forEach(f->{
|
|
financeProjects.forEach(f->{
|
|
- if (!projectTimeList.stream().anyMatch(map->((Integer)map.get("projectId")).equals(f.getProjectId()))) {
|
|
|
|
|
|
+ if (!projectTimeList.stream().anyMatch(map->(((Long)map.get("projectId"))).intValue() == f.getProjectId())) {
|
|
notInFPList.add(f);
|
|
notInFPList.add(f);
|
|
}
|
|
}
|
|
});
|
|
});
|