|
|
@@ -879,46 +879,6 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
if (httpRespMsg.code.equals("error")) {
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
- //无项目工时人员的分配比例设置
|
|
|
- List<Map> noPUserDataList = new ArrayList<>();
|
|
|
- if (assignNoProUser != null && assignNoProUser && noProjectUser.size() > 0) {
|
|
|
- //检查是否已经设置好分配规则
|
|
|
- percentage = projectPercentageMapper.selectOne(new QueryWrapper<ProjectPercentage>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
|
- if (percentage == null) {
|
|
|
- //httpRespMsg.setError("请先设置无项目工时人员的分配比例");
|
|
|
- httpRespMsg.setError(MessageUtils.message("project.setPersonnelAllotment"));
|
|
|
- return httpRespMsg;
|
|
|
- } else {
|
|
|
- //获取设置的项目
|
|
|
- String data = percentage.getData();
|
|
|
- JSONArray parse = JSONArray.parseArray(data);
|
|
|
- //获取到无项目人员配置的项目
|
|
|
- financeProjects.forEach(f->{
|
|
|
- for (int i = 0; i < parse.size(); i++) {
|
|
|
- JSONObject json = parse.getJSONObject(i);
|
|
|
- String userId = json.getString("id");
|
|
|
- String username = json.getString("name");
|
|
|
- //获取各个项目的分配比例值
|
|
|
- HashMap userCostMap = new HashMap();
|
|
|
- userCostMap.put("creatorId", userId);
|
|
|
- userCostMap.put("workingTime", 0.0f);
|
|
|
- double percent = json.getDouble(f.getProjectId()+"");
|
|
|
- Optional<Finance> first = noProjectUser.stream().filter(no -> no.getUserId().equals(userId)).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- Finance finance = first.get();
|
|
|
- userCostMap.put("finance", finance);
|
|
|
- userCostMap.put("percent", percent);
|
|
|
- userCostMap.put("project", f.getProjectId());
|
|
|
- userCostMap.put("projectId", f.getProjectId());
|
|
|
- userCostMap.put("projectCode", f.getProjectCode());
|
|
|
- userCostMap.put("categoryName", f.getCategoryName());
|
|
|
- noPUserDataList.add(userCostMap);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
for (Map<String, Object> map : projectTimeList) {
|
|
|
Integer projectId = ((Long) map.get("projectId")).intValue();
|
|
|
@@ -1058,7 +1018,8 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
// System.out.println("财务数据中未找到用户:"+creatorId);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //无项目工时人员的分配比例设置
|
|
|
+ List<Map> noPUserDataList = new ArrayList<>();
|
|
|
//加上待分摊的无工时项目,如果当前项目列表没有的话
|
|
|
if (assignNoProUser != null && assignNoProUser) {
|
|
|
if (timeType.getFinanceTwiceAssign()) {
|
|
|
@@ -1148,6 +1109,43 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
+ if (noProjectUser.size() > 0) {
|
|
|
+ //检查是否已经设置好分配规则
|
|
|
+ percentage = projectPercentageMapper.selectOne(new QueryWrapper<ProjectPercentage>().eq("company_id", companyId).eq("ymonth", yearMonth));
|
|
|
+ if (percentage == null) {
|
|
|
+ //httpRespMsg.setError("请先设置无项目工时人员的分配比例");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("project.setPersonnelAllotment"));
|
|
|
+ return httpRespMsg;
|
|
|
+ } else {
|
|
|
+ //获取设置的项目
|
|
|
+ String data = percentage.getData();
|
|
|
+ JSONArray parse = JSONArray.parseArray(data);
|
|
|
+ //获取到无项目人员配置的项目
|
|
|
+ financeProjects.forEach(f->{
|
|
|
+ for (int i = 0; i < parse.size(); i++) {
|
|
|
+ JSONObject json = parse.getJSONObject(i);
|
|
|
+ String userId = json.getString("id");
|
|
|
+ String username = json.getString("name");
|
|
|
+ //获取各个项目的分配比例值
|
|
|
+ HashMap userCostMap = new HashMap();
|
|
|
+ userCostMap.put("creatorId", userId);
|
|
|
+ userCostMap.put("workingTime", 0.0f);
|
|
|
+ double percent = json.getDouble(f.getProjectId()+"");
|
|
|
+ Optional<Finance> first = noProjectUser.stream().filter(no -> no.getUserId().equals(userId)).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ Finance finance = first.get();
|
|
|
+ userCostMap.put("finance", finance);
|
|
|
+ userCostMap.put("percent", percent);
|
|
|
+ userCostMap.put("project", f.getProjectId());
|
|
|
+ userCostMap.put("projectId", f.getProjectId());
|
|
|
+ userCostMap.put("projectCode", f.getProjectCode());
|
|
|
+ userCostMap.put("categoryName", f.getCategoryName());
|
|
|
+ noPUserDataList.add(userCostMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
List<FinanceProjects> notInFPList = new ArrayList<FinanceProjects>();
|
|
|
financeProjects.forEach(f->{
|
|
|
if (!pList.stream().anyMatch(pItem->pItem.getProjectId().intValue() == f.getProjectId())) {
|
|
|
@@ -1379,6 +1377,9 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
DecimalFormat workTimeFormatter = new DecimalFormat("0.00");
|
|
|
if (groupByCategory == 0) {
|
|
|
for (ProjectSumItem p : pList) {
|
|
|
+// if (p.getCost().compareTo(new BigDecimal(0)) == 0) {
|
|
|
+// continue;//合计为0的,跳过; 实现排除生产其他和研发其他这两个项目
|
|
|
+// }
|
|
|
p.cost = p.cost.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
p.salary = p.salary.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
p.bonus = p.bonus.setScale(2, BigDecimal.ROUND_HALF_UP);
|