Browse Source

update: 考试记录及格分设置功能

zhongwei
liwen 6 months ago
parent
commit
3bba4b39ef
  1. 10
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java
  2. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java

10
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java

@ -60,11 +60,11 @@ public class TestEntity extends BaseEntity {
@ApiModelProperty("考试结束时间")
private Date testEndTime;
@NotNull
@Min(value = 0, message = "及格分必须大于等于0")
@Max(value = 100, message = "及格分必须小于等于100")
@ApiModelProperty("及格分")
private Integer passingScore;
// @NotNull
// @Min(value = 0, message = "及格分必须大于等于0")
// @Max(value = 100, message = "及格分必须小于等于100")
// @ApiModelProperty("及格分")
// private Integer passingScore;
@NotNull
@Size(max = 255, message = "考试地点字段长度不能超过255")

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java

@ -126,7 +126,7 @@ public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScore
public TestScoreSumVO testScoreSum(Long testId, String name) {
TestScoreSumVO testScoreSumVO = new TestScoreSumVO();
TestEntity testEntity = testMapper.selectById(testId);
testScoreSumVO.setPassingScore(testEntity.getPassingScore());
// testScoreSumVO.setPassingScore(testEntity.getPassingScore());
String peopleName = testEntity.getPeopleName();
if (StringUtils.isNotBlank(peopleName)) {
String[] split = peopleName.split(",");
@ -138,7 +138,7 @@ public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScore
list= list.stream().filter(s -> s.getScore() != null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
testScoreSumVO.setActualPeopleNum(list.size());
List<TestScoreEntity> passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList());
List<TestScoreEntity> passCollect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) {
double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue();
testScoreSumVO.setPercentage(result);

Loading…
Cancel
Save