Merge remote-tracking branch 'origin/master'

master
xxssyyyyssxx 2021-11-30 13:28:01 +08:00
commit 0956883c35
11 changed files with 146 additions and 104 deletions

View File

@ -1,6 +1,7 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
* @author Yuanping Zhang
@ -42,11 +43,11 @@ public class FormerBean extends IncomeCostBean{
private BigDecimal netProfitMargin;
/**
* a
* */
*/
private BigDecimal saleIncomeCash;
/**
* b
* */
*/
private BigDecimal taxReturn;
/**
* c
@ -114,7 +115,10 @@ public class FormerBean extends IncomeCostBean{
if (null == grossProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
return grossProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100));
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return grossProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
@ -134,8 +138,10 @@ public class FormerBean extends IncomeCostBean{
if (null == contributionProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
return contributionProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100));
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return contributionProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
@ -155,7 +161,10 @@ public class FormerBean extends IncomeCostBean{
if (null == netProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
return netProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100));
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return netProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {

View File

@ -60,12 +60,12 @@ public class HumanCostController extends BaseController{
Admin admin = getAdmin();
int roleLevel = admin.getRoleLevel();
List<Project> selfProjects = projectRepository.findByCreator(admin.getId(), new Date());
if (roleLevel <= 2 || roleLevel == 4) {
if (roleLevel <= 3 || roleLevel == 6) {
model.put("deptVary", 1);
model.put("deptList", deptRepository.findAll());
model.put("projectList", projectRepository.findAll());
model.put("showSalary", 1);
} else if (roleLevel == 3) {
} else if (roleLevel == 4 || roleLevel == 5) {
model.put("deptVary", -1);
model.put("deptList", new ArrayList<>());
model.put("projectList", projectRepository.findByDeptId(admin.getDeptId()));

View File

@ -80,6 +80,7 @@ public class ProjectController extends BaseController {
//当前登录人的角色类型
model.put("keywords", keywords);
model.put("adminId", InterfaceUtil.getAdminId());
model.put("admin", InterfaceUtil.getAdmin());
model.put("deptList", deptService.findAll());
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("pager", projectService.list(searchInfo, pageNumber, pageSize));

View File

@ -122,8 +122,8 @@ public class HumanCostService {
Project project = projectRepository.findByProjectName(projectName);
if (project == null) {
throw new Exception(projectName + "不存在");
} else if (project.getStatus() != Project.STATUS_SETTLE || project.getApproveStatusSettle() == 1 || project.getApproveStatusSettle() == 2) {
throw new Exception(projectName + "不在项目结算的可编辑状态");
} else if (project.getStatus() == Project.STATUS_ESTIMATE || (project.getStatus() == Project.STATUS_ESTIMATE && project.getApproveStatusEstimate() != 2) || (project.getStatus() == Project.STATUS_FINAL && project.getApproveStatusFinal() == 2)) {
throw new Exception(projectName + "不在项目人力成本的可导入状态");
}
if (projectSet.contains(projectName)) {
throw new Exception("项目名称存在重复!");
@ -180,6 +180,11 @@ public class HumanCostService {
errorList.add(e.getMessage());
}
}
if (errorCount > 0) {
final ResponseMsg msg = ResponseMsg.buildSuccessMsg(String.format("失败:%d", errorCount));
msg.setData(errorList);
return msg;
}
for (String key : staffCost.keySet()) {
try {
if (staffCost.getOrDefault(key, BigDecimal.valueOf(0)).compareTo(BigDecimal.valueOf(1)) != 0) {
@ -195,10 +200,14 @@ public class HumanCostService {
int row = projectUserTimeRepository.deleteByTime(date);
logger.info("删除重复条目:" + row + "条");
projectUserTimeRepository.save(saveList);
}
final ResponseMsg msg = ResponseMsg.buildSuccessMsg(String.format("成功:%d, 失败:%d", successCount, errorCount));
msg.setData(errorList);
return msg;
} else {
final ResponseMsg msg = ResponseMsg.buildSuccessMsg(String.format("失败:%d", errorCount));
msg.setData(errorList);
return msg;
}
}
public String[] getHeaders(List<ProjectUserTime> staff) {
@ -241,11 +250,11 @@ public class HumanCostService {
}
Admin admin = InterfaceUtil.getAdmin();
List<Project> projectList = null;
if (admin.getRoleLevel() <= 2 || admin.getRoleLevel() == 4) {
String sql = "select proj.id, proj.name from project proj where (proj.status = ? or (proj.status = ? and proj.approve_status_budget = ?)) order by proj.id asc";
projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE, Project.STATUS_BUDGET, 2);
if (admin.getRoleLevel() <= 3 || admin.getRoleLevel() == 6) {
String sql = "select proj.id, proj.name from project proj where (proj.status = ? or (proj.status = ? and proj.approve_status_budget = ?) or (proj.status = ? and proj.approve_status_final <> ?)) order by proj.id asc";
projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE, Project.STATUS_BUDGET, 2, Project.STATUS_FINAL, 2);
} else {
String sql = "select proj.id, proj.name from project proj where (proj.status = ? or (proj.status = ? and proj.approve_status_budget = ?)) and " +
String sql = "select proj.id, proj.name from project proj where (proj.status = ? or (proj.status = ? and proj.approve_status_budget = ?) or (proj.status = ? and proj.approve_status_final <> ?)) and " +
" (proj.creator_id=? OR proj.id in (SELECT pv1.project_id FROM project_visible pv1 WHERE pv1.type=1 AND pv1.tid=? UNION SELECT pv2.project_id FROM project_visible pv2 WHERE pv2.type=2 AND pv2.tid=?)) order by proj.id asc";
//项目可见性根据角色和人员id
int roleId = admin.getRoleId();

View File

@ -2,32 +2,50 @@ function calculateFinal() {
$("input[name='incomeDeviceFinalTotal']").change(function () {
calIncomeFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='incomeEngineerFinalTotal']").change(function () {
calIncomeFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='incomeServiceFinalTotal']").change(function () {
calIncomeFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='costPurchaseDeviceFinalTotal']").change(function () {
calCostFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='costPurchaseBuildFinalTotal']").change(function () {
calCostFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='costPurchaseServiceFinalTotal']").change(function () {
calCostFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='costPurchaseOtherFinalTotal']").change(function () {
calCostFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='costProjectManageFinalTotal']").change(function () {
calCostFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
$("input[name='costOtherFinalTotal']").change(function () {
calCostFinalTotal();
calNetMarginFinalTotal();
calNetMarginProfitMargin();
});
@ -302,7 +320,7 @@ function calGrossProfitProfitMargin() {
var grossProfitProfitMargin = $("input[name='grossProfitProfitMargin']");
if (grossProfitFinalTotal && incomeFinalTotal) {
grossProfitProfitMargin.val(f2(grossProfitFinalTotal) / f2(incomeFinalTotal));
grossProfitProfitMargin.val(100 * grossProfitFinalTotal / incomeFinalTotal);
} else {
grossProfitProfitMargin.val("");
}
@ -334,7 +352,7 @@ function calContributionMarginProfitMargin() {
var contributionMarginProfitMargin = $("input[name='contributionMarginProfitMargin']");
if (contributionMarginFinalTotal && incomeFinalTotal) {
contributionMarginProfitMargin.val(f2(contributionMarginFinalTotal) / f2(incomeFinalTotal));
contributionMarginProfitMargin.val(100 * contributionMarginFinalTotal / incomeFinalTotal);
} else {
contributionMarginProfitMargin.val("");
}
@ -366,7 +384,7 @@ function calNetMarginProfitMargin() {
var netMarginProfitMargin = $("input[name='netMarginProfitMargin']");
if (netMarginFinalTotal && incomeFinalTotal) {
netMarginProfitMargin.val(f2(netMarginFinalTotal) / f2(incomeFinalTotal));
netMarginProfitMargin.val(100 * netMarginFinalTotal / incomeFinalTotal);
} else {
netMarginProfitMargin.val("");
}

View File

@ -201,21 +201,21 @@
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资利息</div>
<div class="am-u-sm-6 am-u-md-6">
<span>${project.advanceInterestAmount}</span>元
<span>${Utils.format(project.advanceInterestAmount)}</span>元
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资峰值</div>
<div class="am-u-sm-6 am-u-md-6">
<span>${project.advancePeakAmount}</span>元
<span>${Utils.format(project.advancePeakAmount)}</span>元
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>合同金额</div>
<div class="am-u-sm-6 am-u-md-6">
<span>${project.contractAmount}</span>元
<span>${Utils.format(project.contractAmount)}</span>元
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
@ -229,14 +229,14 @@
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>华智产品金额</div>
<div class="am-u-sm-6 am-u-md-6">
<span>${project.huazhiProductAmount!}</span>元
<span>${Utils.format(project.huazhiProductAmount)}</span>元
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>紫光其他产品金额</div>
<div class="am-u-sm-6 am-u-md-6">
<span>${project.ziguangOtherAmount!}</span>元
<span>${Utils.format(project.ziguangOtherAmount)}</span>元
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
@ -643,7 +643,7 @@
<div class="am-u-sm-10">
<div class="am-form am-form-inline">
<div class="am-form-group am-form-icon">
<input type="text" id="time" name="time" autocomplete="off" readonly value="${time!}">
<input type="text" id="time" name="time" autocomplete="off" data-am-datepicker readonly value="${time!}">
</div>
</div>
</div>
@ -1883,12 +1883,12 @@
<script>
var base = "${base}";
</script>
<#-- <script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_budget.js"></script>
<script src="${base}/assets/js/project_budget_income.js"></script>
<script src="${base}/assets/js/project_budget_cost.js"></script>
<script src="${base}/assets/js/project_budget_cost_project_manage.js"></script>
<script src="${base}/assets/js/project_budget_plan.js"></script>-->
<script src="${base}/assets/js/project_budget_plan.js"></script>
</@defaultLayout.layout>
<script>
@ -1911,7 +1911,6 @@
});
});
var completeTask = function (projectId) {
var message = $("#doc-vld-ta-2").val();
var type = $("input[name='docVlGender']:checked").val();

View File

@ -238,7 +238,7 @@
<#-- </@shiro.hasPermission>-->
<#-- 项目等于预算状态、预算审核等于通过状态 -->
<#if (list.status==5 && list.approveStatusBudget=2) || (list.status=10 && list.approveStatusSettle=2) >
<#if admin.getRoleLevel() == 6 && ((list.status==5 && list.approveStatusBudget=2) || (list.status=10 && list.approveStatusSettle=2)) >
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/settle/add?id=${list.id}'"><span
@ -247,7 +247,7 @@
</#if>
<#-- 项目等于结算状态、结算审核不等于待审核状态-->
<#if list.status==10 && list.approveStatusSettle!=1>
<#if admin.getRoleLevel() = 6 && list.status==10 && list.approveStatusSettle!=1>
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/settle/edit?id=${list.id}'"><span
@ -256,7 +256,7 @@
</#if>
<#-- 项目等于结算状态、结算审核等于通过状态 -->
<#if list.status== 10 && list.approveStatusSettle==2 >
<#if (admin.getRoleLevel() = 2 || admin.getRoleLevel() = 6) && (list.status== 10 && list.approveStatusSettle==2) >
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/final/add?id=${list.id}'"><span
@ -265,7 +265,7 @@
</#if>
<#-- 项目等于决算状态、决算审核不等于待审核状态、 决算审核不等于通过状态-->
<#if list.status== 15 && list.approveStatusFinal!=1 && list.approveStatusFinal!=2 >
<#if (admin.getRoleLevel() = 2 || admin.getRoleLevel() = 6) && list.status== 15 && list.approveStatusFinal!=1 && list.approveStatusFinal!=2 >
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/final/edit?id=${list.id}'"><span

View File

@ -25,7 +25,7 @@
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目结算表</strong> / <small>${project.name}</small></div>
</div>
<form method="post" class="am-form" id="pmsForm" action="${base}/project/settleAdd">
<form method="post" class="am-form" id="pmsForm" action="${base}/project/settleAdd" data-am-validator>
<!--选项卡tabsbegin-->
<div class="am-tabs am-margin" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">

View File

@ -25,7 +25,7 @@
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目结算表</strong> / <small>${project.name}</small></div>
</div>
<form method="post" class="am-form" id="pmsForm">
<form method="post" class="am-form" id="pmsForm" data-am-validator>
<!--选项卡tabsbegin-->
<div class="am-tabs am-margin" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">

View File

@ -36,14 +36,16 @@
<div class="am-g am-form-group am-margin-top" style="display: flex;">
<div class="am-u-sm-4 am-u-md-2 am-text-right">
<span style="color: red;">*</span>角色等级</div>
<span style="color: red;">*</span>角色类型</div>
<div class="am-u-sm-6 am-u-md-6">
<select data-am-selected="{btnWidth: '40%', btnSize: 'sm'" id="level" name="level">
<option value="1" <#if role.level! ==1>selected</#if> >一级</option>
<option value="2" <#if role.level! ==2>selected</#if> >二级</option>
<option value="3" <#if role.level! ==3>selected</#if> >三级</option>
<option value="4" <#if role.level! ==4>selected</#if> >四级</option>
<option value="5" <#if role.level! ==5>selected</#if> >五级</option>
<option value="1" <#if role.level! ==1>selected</#if> >执行董事</option>
<option value="2" <#if role.level! ==2>selected</#if> >财务总监</option>
<option value="3" <#if role.level! ==3>selected</#if> >总经理</option>
<option value="4" <#if role.level! ==4>selected</#if> >工程部主管</option>
<option value="5" <#if role.level! ==5>selected</#if> >集成部主管(管理员)</option>
<option value="6" <#if role.level! ==6>selected</#if> >财务人员</option>
<option value="7" <#if role.level! ==7>selected</#if> >普通员工</option>
</select>
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>

View File

@ -51,7 +51,7 @@
<th class="table-check">
<input type="checkbox" id="allCheck"></th>
<th class="table-title">角色名称</th>
<th class="table-title">角色等级</th>
<th class="table-title">角色类型</th>
<th class="table-title">是否启用</th>
<th class="table-date">创建日期</th>
<th class="table-date">最后更新日期</th>
@ -68,15 +68,19 @@
<td>${list.name!}</td>
<td>
<#if list.level ==1 >
一级
执行董事
<#elseif list.level ==2>
二级
财务总监
<#elseif list.level ==3>
三级
总经理
<#elseif list.level ==4>
四级
工程部主管
<#elseif list.level ==5>
五级
集成部主管(管理员)
<#elseif list.level ==6>
财务人员
<#elseif list.level ==7>
普通员工
</#if>
</td>
<td>