|
@@ -1365,7 +1365,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (project.getContractAmount() != null && project.getContractAmount() > 0) {
|
|
|
double profitAmt = project.getContractAmount() - totalFee;
|
|
|
data.add(profitAmt+"");
|
|
|
- data.add(new java.text.DecimalFormat("#.0").format((100*profitAmt/project.getContractAmount()))+"%");
|
|
|
+ data.add(new java.text.DecimalFormat("#0.0").format((100*profitAmt/project.getContractAmount()))+"%");
|
|
|
} else {
|
|
|
double profitAmt = -totalFee;
|
|
|
data.add(profitAmt+"");
|
|
@@ -1405,7 +1405,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (project.getContractAmount() != null && project.getContractAmount() > 0) {
|
|
|
double profitAmt = project.getContractAmount() - totalFee;
|
|
|
data.add(profitAmt+"");
|
|
|
- data.add(new java.text.DecimalFormat("#.0").format((100*profitAmt/project.getContractAmount()))+"%");
|
|
|
+ data.add(new java.text.DecimalFormat("#0.0").format((100*profitAmt/project.getContractAmount()))+"%");
|
|
|
} else {
|
|
|
double profitAmt = -totalFee;
|
|
|
data.add(profitAmt+"");
|
|
@@ -1430,7 +1430,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (child.getContractAmount() != null && child.getContractAmount() > 0) {
|
|
|
double profitAmt = child.getContractAmount() - totalFeeChild;
|
|
|
dataChild.add(profitAmt+"");
|
|
|
- dataChild.add(new java.text.DecimalFormat("#.0").format((100*profitAmt/project.getContractAmount()))+"%");
|
|
|
+ dataChild.add(new java.text.DecimalFormat("#0.0").format((100*profitAmt/project.getContractAmount()))+"%");
|
|
|
} else {
|
|
|
double profitAmt = -totalFeeChild;
|
|
|
dataChild.add(profitAmt+"");
|
|
@@ -1740,12 +1740,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
@Override
|
|
|
public HttpRespMsg getProjectStagesCost(Integer pageIndex, Integer pageSize, HttpServletRequest request) {
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
- Integer companyId = userMapper.selectById(token).getCompanyId();
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
int startIndex = (pageIndex-1)*pageSize;
|
|
|
int endIndex = pageSize*pageIndex;
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
Integer total = projectMapper.selectCount(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
List<ProjectWithStage> record = projectMapper.selectWithStage(companyId, startIndex, endIndex);
|
|
|
+ List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看阶段成本");
|
|
|
+ if (functionList.size() == 0) {
|
|
|
+ //去掉成本
|
|
|
+ record.forEach(re->{
|
|
|
+ re.getStageCostList().forEach(s->s.cost = 0.0);
|
|
|
+ });
|
|
|
+ }
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
map.put("records", record);
|
|
|
map.put("total", total);
|
|
@@ -1766,7 +1774,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
@Override
|
|
|
public HttpRespMsg exportProjectStagesCost(HttpServletRequest request) {
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
- Integer companyId = userMapper.selectById(token).getCompanyId();
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
List<ProjectWithStage> record = projectMapper.selectWithStage(companyId, null, null);
|
|
|
//获取全部的列
|
|
@@ -1779,6 +1788,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
titleList.addAll(stageList);
|
|
|
List<List<String>> dataList = new ArrayList<>();
|
|
|
dataList.add(titleList);
|
|
|
+ List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看阶段成本");
|
|
|
+ if (functionList.size() == 0) {
|
|
|
+ //去掉成本
|
|
|
+ record.forEach(re->{
|
|
|
+ re.getStageCostList().forEach(s->s.cost = 0.0);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#0.0");
|
|
|
//加完标题再增加数据行
|
|
|
record.forEach(r->{
|
|
|
List<String> data = new ArrayList<>();
|
|
@@ -1790,9 +1807,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<StageCost> stageCostList = r.stageCostList;
|
|
|
Optional<StageCost> first = stageCostList.stream().filter(s -> s.stageName.equals(curStage)).findFirst();
|
|
|
if (first.isPresent()) {
|
|
|
- data.add(first.get().workingTime+"");
|
|
|
+ data.add(decimalFormat.format(first.get().workingTime)+(functionList.size() == 0?"":("h/¥"+decimalFormat.format(first.get().cost))));
|
|
|
} else {
|
|
|
- data.add("0");
|
|
|
+ data.add("0h"+(functionList.size() == 0?"":"/¥0.0"));
|
|
|
}
|
|
|
}
|
|
|
dataList.add(data);
|