diff --git a/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java b/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java index ff970e8..8f08d75 100644 --- a/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java @@ -44,6 +44,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; @@ -724,6 +725,7 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl query.put("applyWorkTypeId",workerCatalog); List applyAuditStates = new ArrayList<>(); applyAuditStates.add("0"); + applyAuditStates.add("-1"); applyAuditStates.add("2"); query.put("applyAuditStates",applyAuditStates); List all = applyService.list(query); @@ -734,6 +736,16 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl query.put("applyAuditStates",applyAuditStates); List pass = applyService.list(query); res.put("signUpPassCounts",pass.size()); + // 计算通过率 + double ratio = 0L; + double x = Double.parseDouble(pass.size() + ""); + double y = Double.parseDouble(all.size() + ""); + if(y == 0L){ + res.put("ratio","0.00"); + } else { + BigDecimal bigDecimal = new BigDecimal(( x / y ) * 100); + res.put("ratio", bigDecimal.setScale(2,BigDecimal.ROUND_HALF_UP)); + } return res; } } \ No newline at end of file diff --git a/src/main/resources/static/route/classplan/list-signup.html b/src/main/resources/static/route/classplan/list-signup.html index e715221..9e9588c 100644 --- a/src/main/resources/static/route/classplan/list-signup.html +++ b/src/main/resources/static/route/classplan/list-signup.html @@ -38,8 +38,8 @@
- 总计人数 - - 人 + 通过率 + -
@@ -111,7 +111,9 @@ var loadIndex = layer.load(1); top.restAjax.get(top.restAjax.path('api/classplan/get-exam-check-type', []), {orgId: orgId, workerCatalog : workerCatalog}, null, function (code, data) { - if(data.checkType != '1'){ + if(data.checkType == '1'){ + $('#class-plan-btn-event').show(); + } else { $('#class-plan-btn-event').hide(); } layer.close(loadIndex); @@ -144,14 +146,13 @@ {orgId : orgId,workerCatalog : workerCatalog}, null, function (code, data) { var signUpCounts = data.signUpCounts; var signUpPassCounts = data.signUpPassCounts; + var ratio = data.ratio; $('#signUpCounts').html(signUpCounts + " 人"); $('#signUpPassCounts').html(signUpPassCounts + " 人"); if(typeof (workerCatalog) === 'undefined' || workerCatalog == ''){ - $('#totalSignUpUser').text('总计人数'); - $('#totalSignUpUserNumber').text(signUpCounts + signUpPassCounts + ' 人'); + $('#ratio').text(ratio + '%'); } else { - $('#totalSignUpUser').text('预计人数'); - $('#totalSignUpUserNumber').text('50 人'); + $('#ratio').text(ratio + '%'); } }, function (code, data) { top.dialog.msg(data.msg); @@ -337,6 +338,7 @@ height: $win.height() - 115, }); getExamCheckType(); + getSignUserCounts(); } // 初始化日期