Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/com/sztzjy/digital_credit/entity/StuScoreCenter.javamaster
commit
3ac4c2e28f
@ -0,0 +1,78 @@
|
||||
package com.sztzjy.digital_credit.controller.tch;
|
||||
|
||||
import com.sztzjy.digital_credit.annotation.AnonymousAccess;
|
||||
import com.sztzjy.digital_credit.entity.dto.ClassAVGScoreVo;
|
||||
import com.sztzjy.digital_credit.entity.dto.TchAvgScoreByTimeDTO;
|
||||
import com.sztzjy.digital_credit.entity.dto.TchAvgScoreByTimeParentDTO;
|
||||
import com.sztzjy.digital_credit.entity.dto.TeaClassScoreDto;
|
||||
import com.sztzjy.digital_credit.mapper.StuUserMapper;
|
||||
import com.sztzjy.digital_credit.service.TchHomePageService;
|
||||
import com.sztzjy.digital_credit.util.ResultEntity;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 17803
|
||||
* @date 2024-04-30 11:41
|
||||
*/
|
||||
|
||||
@Api(tags = "教师端--首页")
|
||||
@RestController
|
||||
@RequestMapping("api/tch/home")
|
||||
public class TchHomePageController {
|
||||
|
||||
@Autowired
|
||||
private TchHomePageService tchHomePageService;
|
||||
|
||||
@Autowired
|
||||
private StuUserMapper userMapper;
|
||||
|
||||
|
||||
@ApiOperation("班级平均成绩走势图")
|
||||
@GetMapping("avgScoreTrendChart")
|
||||
@AnonymousAccess
|
||||
public ResultEntity<List<ClassAVGScoreVo>> avgScoreTrendChart(String schoolId){
|
||||
|
||||
List<ClassAVGScoreVo> info = tchHomePageService.avgScoreTrendChart(schoolId);
|
||||
return new ResultEntity<>(info);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@AnonymousAccess
|
||||
@GetMapping("/getClassScoreCount")
|
||||
@ApiOperation("班级成绩统计分析饼状图")
|
||||
public ResultEntity<TeaClassScoreDto> getClassAVGScore(@ApiParam("班级框为空时传") @RequestParam(required = false) String schoolId,
|
||||
@ApiParam("班级框不为空时传") @RequestParam(required = false) String classId,
|
||||
@ApiParam("年月日格式/yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") @RequestParam Date time) {
|
||||
return new ResultEntity<>(tchHomePageService.getClassScoreCount(schoolId, classId, time));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@AnonymousAccess
|
||||
@GetMapping("/getClassNameBySchoolId")
|
||||
@ApiOperation("班级下拉框")
|
||||
public ResultEntity<List<Map<String, String>>> getClassNameBySchoolId(@RequestParam String schoolId) {
|
||||
List<Map<String, String>> nameAndId = userMapper.selectClassNameBySchoolId(schoolId);
|
||||
return new ResultEntity<>(nameAndId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
package com.sztzjy.digital_credit.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
/**
|
||||
*
|
||||
* @author whb
|
||||
* tch_class_average_score
|
||||
*/
|
||||
public class TchClassAverageScore {
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("班级ID")
|
||||
private String classId;
|
||||
|
||||
@ApiModelProperty("班级名称")
|
||||
private String className;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("平均分")
|
||||
private Double aveScore;
|
||||
|
||||
@ApiModelProperty("优秀人数")
|
||||
private Integer excellentCount;
|
||||
|
||||
@ApiModelProperty("良好人数")
|
||||
private Integer goodCount;
|
||||
|
||||
@ApiModelProperty("一般人数")
|
||||
private Integer generalCount;
|
||||
|
||||
@ApiModelProperty("不及格人数")
|
||||
private Integer failCount;
|
||||
|
||||
@ApiModelProperty("班级最高分")
|
||||
private BigDecimal classMaxScore;
|
||||
|
||||
@ApiModelProperty("班级最低分")
|
||||
private BigDecimal classMinScore;
|
||||
|
||||
@ApiModelProperty("班级平均分")
|
||||
private BigDecimal classAverageScore;
|
||||
|
||||
@ApiModelProperty("学校ID")
|
||||
private String schoolId;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id == null ? null : id.trim();
|
||||
}
|
||||
|
||||
public String getClassId() {
|
||||
return classId;
|
||||
}
|
||||
|
||||
public void setClassId(String classId) {
|
||||
this.classId = classId == null ? null : classId.trim();
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className == null ? null : className.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Double getAveScore() {
|
||||
return aveScore;
|
||||
}
|
||||
|
||||
public void setAveScore(Double aveScore) {
|
||||
this.aveScore = aveScore;
|
||||
}
|
||||
|
||||
public Integer getExcellentCount() {
|
||||
return excellentCount;
|
||||
}
|
||||
|
||||
public void setExcellentCount(Integer excellentCount) {
|
||||
this.excellentCount = excellentCount;
|
||||
}
|
||||
|
||||
public Integer getGoodCount() {
|
||||
return goodCount;
|
||||
}
|
||||
|
||||
public void setGoodCount(Integer goodCount) {
|
||||
this.goodCount = goodCount;
|
||||
}
|
||||
|
||||
public Integer getGeneralCount() {
|
||||
return generalCount;
|
||||
}
|
||||
|
||||
public void setGeneralCount(Integer generalCount) {
|
||||
this.generalCount = generalCount;
|
||||
}
|
||||
|
||||
public Integer getFailCount() {
|
||||
return failCount;
|
||||
}
|
||||
|
||||
public void setFailCount(Integer failCount) {
|
||||
this.failCount = failCount;
|
||||
}
|
||||
|
||||
public BigDecimal getClassMaxScore() {
|
||||
return classMaxScore;
|
||||
}
|
||||
|
||||
public void setClassMaxScore(BigDecimal classMaxScore) {
|
||||
this.classMaxScore = classMaxScore;
|
||||
}
|
||||
|
||||
public BigDecimal getClassMinScore() {
|
||||
return classMinScore;
|
||||
}
|
||||
|
||||
public void setClassMinScore(BigDecimal classMinScore) {
|
||||
this.classMinScore = classMinScore;
|
||||
}
|
||||
|
||||
public BigDecimal getClassAverageScore() {
|
||||
return classAverageScore;
|
||||
}
|
||||
|
||||
public void setClassAverageScore(BigDecimal classAverageScore) {
|
||||
this.classAverageScore = classAverageScore;
|
||||
}
|
||||
|
||||
public String getSchoolId() {
|
||||
return schoolId;
|
||||
}
|
||||
|
||||
public void setSchoolId(String schoolId) {
|
||||
this.schoolId = schoolId == null ? null : schoolId.trim();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
package com.sztzjy.digital_credit.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class ClassAVGScoreVo {
|
||||
@ApiModelProperty("班级名称")
|
||||
private String className;
|
||||
|
||||
@ApiModelProperty("班级平均分")
|
||||
private List<BigDecimal> classAverageScore;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("最早得分日期")
|
||||
private List<Date> startTime;
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
package com.sztzjy.digital_credit.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class TeaClassScoreDto {
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("学校ID")
|
||||
private String schoolId;
|
||||
|
||||
@ApiModelProperty("班级ID")
|
||||
private String classId;
|
||||
|
||||
@ApiModelProperty("班级名称")
|
||||
private String className;
|
||||
|
||||
@ApiModelProperty("优秀人数")
|
||||
private Integer excellentCount;
|
||||
|
||||
@ApiModelProperty("良好人数")
|
||||
private Integer goodCount;
|
||||
|
||||
@ApiModelProperty("一般人数")
|
||||
private Integer generalCount;
|
||||
|
||||
@ApiModelProperty("不及格人数")
|
||||
private Integer failCount;
|
||||
|
||||
@ApiModelProperty("班级最高分")
|
||||
private BigDecimal classMaxScore;
|
||||
|
||||
@ApiModelProperty("班级最低分")
|
||||
private BigDecimal classMinScore;
|
||||
|
||||
@ApiModelProperty("班级平均分")
|
||||
private BigDecimal classAverageScore;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
@ApiModelProperty("得分日期")
|
||||
private Date startTime;
|
||||
|
||||
|
||||
@ApiModelProperty("学校优秀人数")
|
||||
private Integer schoolExcellentCount;
|
||||
@ApiModelProperty("学校良好人数")
|
||||
private Integer schoolGoodCount;
|
||||
@ApiModelProperty("学校一般人数")
|
||||
private Integer schoolGeneralCount;
|
||||
@ApiModelProperty("学校不及格人数")
|
||||
private Integer schoolFailCount;
|
||||
@ApiModelProperty("学校班级最高分")
|
||||
private BigDecimal schoolMaxScore;
|
||||
@ApiModelProperty("学校班级最低分")
|
||||
private BigDecimal schoolMinScore;
|
||||
@ApiModelProperty("学校班级平均分")
|
||||
private BigDecimal schoolAverageScore;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSchoolId() {
|
||||
return schoolId;
|
||||
}
|
||||
|
||||
public void setSchoolId(String schoolId) {
|
||||
this.schoolId = schoolId;
|
||||
}
|
||||
|
||||
public String getClassId() {
|
||||
return classId;
|
||||
}
|
||||
|
||||
public void setClassId(String classId) {
|
||||
this.classId = classId;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public Integer getExcellentCount() {
|
||||
return excellentCount;
|
||||
}
|
||||
|
||||
public void setExcellentCount(Integer excellentCount) {
|
||||
this.excellentCount = excellentCount;
|
||||
}
|
||||
|
||||
public Integer getGoodCount() {
|
||||
return goodCount;
|
||||
}
|
||||
|
||||
public void setGoodCount(Integer goodCount) {
|
||||
this.goodCount = goodCount;
|
||||
}
|
||||
|
||||
public Integer getGeneralCount() {
|
||||
return generalCount;
|
||||
}
|
||||
|
||||
public void setGeneralCount(Integer generalCount) {
|
||||
this.generalCount = generalCount;
|
||||
}
|
||||
|
||||
public Integer getFailCount() {
|
||||
return failCount;
|
||||
}
|
||||
|
||||
public void setFailCount(Integer failCount) {
|
||||
this.failCount = failCount;
|
||||
}
|
||||
|
||||
public BigDecimal getClassMaxScore() {
|
||||
return classMaxScore;
|
||||
}
|
||||
|
||||
public void setClassMaxScore(BigDecimal classMaxScore) {
|
||||
this.classMaxScore = classMaxScore;
|
||||
}
|
||||
|
||||
public BigDecimal getClassMinScore() {
|
||||
return classMinScore;
|
||||
}
|
||||
|
||||
public void setClassMinScore(BigDecimal classMinScore) {
|
||||
this.classMinScore = classMinScore;
|
||||
}
|
||||
|
||||
public BigDecimal getClassAverageScore() {
|
||||
return classAverageScore;
|
||||
}
|
||||
|
||||
public void setClassAverageScore(BigDecimal classAverageScore) {
|
||||
this.classAverageScore = classAverageScore;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Integer getSchoolExcellentCount() {
|
||||
return schoolExcellentCount;
|
||||
}
|
||||
|
||||
public void setSchoolExcellentCount(Integer schoolExcellentCount) {
|
||||
this.schoolExcellentCount = schoolExcellentCount;
|
||||
}
|
||||
|
||||
public Integer getSchoolGoodCount() {
|
||||
return schoolGoodCount;
|
||||
}
|
||||
|
||||
public void setSchoolGoodCount(Integer schoolGoodCount) {
|
||||
this.schoolGoodCount = schoolGoodCount;
|
||||
}
|
||||
|
||||
public Integer getSchoolGeneralCount() {
|
||||
return schoolGeneralCount;
|
||||
}
|
||||
|
||||
public void setSchoolGeneralCount(Integer schoolGeneralCount) {
|
||||
this.schoolGeneralCount = schoolGeneralCount;
|
||||
}
|
||||
|
||||
public Integer getSchoolFailCount() {
|
||||
return schoolFailCount;
|
||||
}
|
||||
|
||||
public void setSchoolFailCount(Integer schoolFailCount) {
|
||||
this.schoolFailCount = schoolFailCount;
|
||||
}
|
||||
|
||||
public BigDecimal getSchoolMaxScore() {
|
||||
return schoolMaxScore;
|
||||
}
|
||||
|
||||
public void setSchoolMaxScore(BigDecimal schoolMaxScore) {
|
||||
this.schoolMaxScore = schoolMaxScore;
|
||||
}
|
||||
|
||||
public BigDecimal getSchoolMinScore() {
|
||||
return schoolMinScore;
|
||||
}
|
||||
|
||||
public void setSchoolMinScore(BigDecimal schoolMinScore) {
|
||||
this.schoolMinScore = schoolMinScore;
|
||||
}
|
||||
|
||||
public BigDecimal getSchoolAverageScore() {
|
||||
return schoolAverageScore;
|
||||
}
|
||||
|
||||
public void setSchoolAverageScore(BigDecimal schoolAverageScore) {
|
||||
this.schoolAverageScore = schoolAverageScore;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.sztzjy.digital_credit.entity.tchdto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 17803
|
||||
* @date 2024-05-07 10:03
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ScoreOverviewParametesDTO {
|
||||
|
||||
private String schoolId;
|
||||
@ApiModelProperty("用户名")
|
||||
private String name;
|
||||
@ApiModelProperty("学号")
|
||||
private String studentId;
|
||||
private String className;
|
||||
|
||||
private Integer size;
|
||||
|
||||
private Integer index;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
package com.sztzjy.digital_credit.entity.tchdto;
|
||||
|
||||
|
||||
|
||||
import com.sztzjy.digital_credit.entity.StuUser;
|
||||
import com.sztzjy.digital_credit.entity.TchModuleWeith;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class TchGeneralViewDTO {
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("学校ID")
|
||||
private String schoolId;
|
||||
|
||||
@ApiModelProperty("学号")
|
||||
private String studentId;
|
||||
|
||||
@ApiModelProperty("班级名称")
|
||||
private String className;
|
||||
|
||||
@ApiModelProperty("贷款案例成绩")
|
||||
private BigDecimal loanCasesScore;
|
||||
|
||||
@ApiModelProperty("个人情况与违约成绩")
|
||||
private BigDecimal perSituationScore;
|
||||
|
||||
@ApiModelProperty("还款行为与违约成绩")
|
||||
private BigDecimal repaymentBehaviorScore;
|
||||
|
||||
@ApiModelProperty("个人征信-影响因素与分析成绩")
|
||||
private BigDecimal perInfluenceFactorScore;
|
||||
|
||||
@ApiModelProperty("个人征信-征信优化与分析成绩")
|
||||
private BigDecimal perCreditOptimizationSocre;
|
||||
|
||||
@ApiModelProperty("个人征信-征信评级模型成绩")
|
||||
private BigDecimal perCreditRatingSocre;
|
||||
|
||||
@ApiModelProperty("企业征信-影响因素与分析成绩")
|
||||
private BigDecimal entInfluenceFactorSocre;
|
||||
|
||||
@ApiModelProperty("企业征信-征信优化与分析成绩")
|
||||
private BigDecimal entCreditOptimizationSocre;
|
||||
|
||||
@ApiModelProperty("企业征信-征信评级模型成绩")
|
||||
private BigDecimal entCreditRatingSocre;
|
||||
|
||||
@ApiModelProperty("案例-用户画像成绩")
|
||||
private BigDecimal caseUserProfileSocre;
|
||||
|
||||
@ApiModelProperty("案例-个人征信总成绩")
|
||||
private BigDecimal casePersonalCreditScore;
|
||||
|
||||
@ApiModelProperty("案例-企业征信总成绩")
|
||||
private BigDecimal caseCorporateCreditScore;
|
||||
|
||||
@ApiModelProperty("案例-企业征信主观成绩")
|
||||
private BigDecimal caseCorporateCreditSubScore;
|
||||
|
||||
@ApiModelProperty("案例-企业征信客观成绩")
|
||||
private BigDecimal caseCorporateCreditObjScore;
|
||||
|
||||
@ApiModelProperty("案例-个人征信主观成绩")
|
||||
private BigDecimal casePersonalCreditSubScore;
|
||||
|
||||
@ApiModelProperty("案例-个人征信客观成绩")
|
||||
private BigDecimal casePersonalCreditObjScore;
|
||||
|
||||
@ApiModelProperty("征信画像成绩")
|
||||
private BigDecimal creditPortraitScore;
|
||||
|
||||
@ApiModelProperty("征信画像排名")
|
||||
private Integer creditPortraitRank;
|
||||
|
||||
@ApiModelProperty("个人征信总成绩")
|
||||
private BigDecimal personalCreditScore;
|
||||
|
||||
@ApiModelProperty("个人征信排名")
|
||||
private Integer personalCreditRank;
|
||||
|
||||
@ApiModelProperty("企业征信总成绩")
|
||||
private BigDecimal corporateCreditScore;
|
||||
|
||||
@ApiModelProperty("企业征信排名")
|
||||
private Integer corporateCreditRank;
|
||||
|
||||
@ApiModelProperty("综合案例总成绩")
|
||||
private BigDecimal comprehensiveCaseScore;
|
||||
|
||||
@ApiModelProperty("综合案例排名")
|
||||
private Integer comprehensiveCaseRank;
|
||||
|
||||
@ApiModelProperty("总排名(学校)")
|
||||
private Integer totalRank;
|
||||
|
||||
@ApiModelProperty("综合得分(学校)(乘完权重后)")
|
||||
private BigDecimal totalScore;
|
||||
|
||||
|
||||
@ApiModelProperty("征信画像成绩权重")
|
||||
private BigDecimal creditPortraitWeith;
|
||||
|
||||
@ApiModelProperty("个人征信成绩权重")
|
||||
private BigDecimal personalCreditWeith;
|
||||
|
||||
@ApiModelProperty("企业征信成绩权重")
|
||||
private BigDecimal enterpriseCreditWeith;
|
||||
|
||||
@ApiModelProperty("综合案例成绩权重")
|
||||
private BigDecimal caseStudyWeith;
|
||||
|
||||
|
||||
public TchGeneralViewDTO() {
|
||||
}
|
||||
|
||||
public TchGeneralViewDTO(StuUser stuUser, TchModuleWeith resultsOverviewWeight) {
|
||||
this.name=stuUser.getName();
|
||||
this.studentId=stuUser.getStudentId();
|
||||
this.className=stuUser.getClassName();
|
||||
|
||||
//征信画像
|
||||
this.creditPortraitScore=stuUser.getLoanCasesScore().add(stuUser.getPerSituationScore()).add(stuUser.getRepaymentBehaviorScore()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getCreditPortraitWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
this.creditPortraitWeith=resultsOverviewWeight.getCreditPortraitWeith();
|
||||
if(stuUser.getCreditPortraitRank()!=null){
|
||||
this.creditPortraitRank=stuUser.getCreditPortraitRank();
|
||||
}
|
||||
|
||||
//个人征信
|
||||
this.personalCreditScore=stuUser.getPerInfluenceFactorScore().add(stuUser.getPerCreditOptimizationSocre()).add(stuUser.getPerCreditRatingSocre()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getPersonalCreditWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
this.personalCreditWeith=resultsOverviewWeight.getPersonalCreditWeith();
|
||||
if(stuUser.getPersonalCreditRank()!=null){
|
||||
this.personalCreditRank=stuUser.getPersonalCreditRank();
|
||||
}
|
||||
|
||||
//企业征信
|
||||
this.corporateCreditScore=stuUser.getEntInfluenceFactorSocre().add(stuUser.getEntCreditOptimizationSocre()).add(stuUser.getEntCreditRatingSocre()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getEnterpriseCreditWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
this.enterpriseCreditWeith=resultsOverviewWeight.getEnterpriseCreditWeith();
|
||||
if(stuUser.getCorporateCreditRank()!=null){
|
||||
this.corporateCreditRank=stuUser.getCorporateCreditRank();
|
||||
}
|
||||
|
||||
//综合案例
|
||||
this.comprehensiveCaseScore=stuUser.getCaseUserProfileSocre().add(stuUser.getCasePersonalCreditScore()).add(stuUser.getCaseCorporateCreditScore()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getCaseStudyWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
this.caseStudyWeith=resultsOverviewWeight.getCaseStudyWeith();
|
||||
if(stuUser.getComprehensiveCaseRank()!=null){
|
||||
this.comprehensiveCaseRank=stuUser.getComprehensiveCaseRank();
|
||||
}
|
||||
|
||||
|
||||
this.totalScore=stuUser.getTotalScore();
|
||||
if(stuUser.getTotalRank()!=null){
|
||||
this.totalRank=stuUser.getTotalRank();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.sztzjy.digital_credit.entity.tchdto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class TchGeneralViewWeightDTO {
|
||||
|
||||
private String schoolId; //学校ID
|
||||
|
||||
@ApiModelProperty("征信画像成绩权重")
|
||||
private BigDecimal creditPortraitWeith;
|
||||
|
||||
@ApiModelProperty("个人征信成绩权重")
|
||||
private BigDecimal personalCreditWeith;
|
||||
|
||||
@ApiModelProperty("企业征信成绩权重")
|
||||
private BigDecimal enterpriseCreditWeith;
|
||||
|
||||
@ApiModelProperty("综合案例成绩权重")
|
||||
private BigDecimal caseStudyWeith;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.sztzjy.digital_credit.mapper;
|
||||
|
||||
import com.sztzjy.digital_credit.entity.TchClassAverageScore;
|
||||
import com.sztzjy.digital_credit.entity.TchClassAverageScoreExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface TchClassAverageScoreMapper {
|
||||
long countByExample(TchClassAverageScoreExample example);
|
||||
|
||||
int deleteByExample(TchClassAverageScoreExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(TchClassAverageScore record);
|
||||
|
||||
int insertSelective(TchClassAverageScore record);
|
||||
|
||||
List<TchClassAverageScore> selectByExample(TchClassAverageScoreExample example);
|
||||
|
||||
TchClassAverageScore selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") TchClassAverageScore record, @Param("example") TchClassAverageScoreExample example);
|
||||
|
||||
int updateByExample(@Param("record") TchClassAverageScore record, @Param("example") TchClassAverageScoreExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(TchClassAverageScore record);
|
||||
|
||||
int updateByPrimaryKey(TchClassAverageScore record);
|
||||
|
||||
//根据时间排序
|
||||
// List<TchClassAverageScore> selectByTime(@Param("className") String className);
|
||||
|
||||
@Select("select class_name from tch_class_average_score where school_id = #{schoolId} group by class_name")
|
||||
List<String> selectClassNameBySchool(@Param("schoolId")String schoolId);
|
||||
|
||||
List<TchClassAverageScore> selectAndOrderByTime(@Param("schoolId")String schoolId,@Param("className")String className);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.sztzjy.digital_credit.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sztzjy.digital_credit.entity.tchdto.ScoreOverviewParametesDTO;
|
||||
import com.sztzjy.digital_credit.entity.tchdto.TchGeneralViewDTO;
|
||||
import com.sztzjy.digital_credit.entity.tchdto.TchGeneralViewWeightDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 17803
|
||||
* @date 2024-05-07 9:57
|
||||
*/
|
||||
public interface StuUserService {
|
||||
|
||||
|
||||
/**
|
||||
* 成绩总览展示(条件查询)
|
||||
* @param parametes
|
||||
* @return
|
||||
*/
|
||||
|
||||
PageInfo<TchGeneralViewDTO> selectGeneralViewList(ScoreOverviewParametesDTO parametes);
|
||||
|
||||
List<TchGeneralViewDTO> selectAllGeneralViewList(String schoolId);
|
||||
|
||||
Boolean updateWeight(TchGeneralViewWeightDTO generalViewWeightDTO);
|
||||
|
||||
void totalRank(String schoolId);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.sztzjy.digital_credit.service;
|
||||
|
||||
import com.sztzjy.digital_credit.entity.dto.ClassAVGScoreVo;
|
||||
import com.sztzjy.digital_credit.entity.dto.TchAvgScoreByTimeParentDTO;
|
||||
import com.sztzjy.digital_credit.entity.dto.TeaClassScoreDto;
|
||||
import com.sztzjy.digital_credit.util.ResultEntity;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 17803
|
||||
* @date 2024-04-30 14:55
|
||||
*/
|
||||
public interface TchHomePageService {
|
||||
//班级平均成绩走势图
|
||||
List<ClassAVGScoreVo> avgScoreTrendChart(String schoolId);
|
||||
|
||||
/**
|
||||
* 班级成绩统计分析饼状图
|
||||
* @param schoolId
|
||||
* @param classId
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
|
||||
TeaClassScoreDto getClassScoreCount(String schoolId, String classId, Date time);
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
package com.sztzjy.digital_credit.service.impl;/**
|
||||
* @author 17803
|
||||
* @date 2024-05-07 9:58
|
||||
*/
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sztzjy.digital_credit.entity.StuUser;
|
||||
import com.sztzjy.digital_credit.entity.StuUserExample;
|
||||
import com.sztzjy.digital_credit.entity.TchModuleWeith;
|
||||
import com.sztzjy.digital_credit.entity.TchModuleWeithExample;
|
||||
import com.sztzjy.digital_credit.entity.tchdto.ScoreOverviewParametesDTO;
|
||||
import com.sztzjy.digital_credit.entity.tchdto.TchGeneralViewDTO;
|
||||
import com.sztzjy.digital_credit.entity.tchdto.TchGeneralViewWeightDTO;
|
||||
import com.sztzjy.digital_credit.mapper.StuUserMapper;
|
||||
import com.sztzjy.digital_credit.mapper.TchModuleWeithMapper;
|
||||
import com.sztzjy.digital_credit.service.StuUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class StuUserServiceImpl implements StuUserService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private TchModuleWeithMapper tchModuleWeithMapper;
|
||||
|
||||
@Autowired
|
||||
private StuUserMapper userMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 成绩总览展示(条件查询)
|
||||
*
|
||||
* @param parametes
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<TchGeneralViewDTO> selectGeneralViewList(ScoreOverviewParametesDTO parametes) {
|
||||
|
||||
//根据学校id 查询tch_results_overview_weight表中 学校成绩总览权重
|
||||
|
||||
TchModuleWeithExample tchModuleWeithExample = new TchModuleWeithExample();
|
||||
tchModuleWeithExample.createCriteria().andSchoolIdEqualTo(parametes.getSchoolId());
|
||||
List<TchModuleWeith> tchModuleWeithList = tchModuleWeithMapper.selectByExample(tchModuleWeithExample);
|
||||
if (tchModuleWeithList.isEmpty())
|
||||
{
|
||||
//创建默认权重数据
|
||||
TchModuleWeith tchModuleWeith=new TchModuleWeith(parametes.getSchoolId());
|
||||
tchModuleWeithMapper.insert(tchModuleWeith);
|
||||
}
|
||||
|
||||
|
||||
PageHelper.startPage(parametes.getIndex(), parametes.getSize());
|
||||
|
||||
StuUserExample example = new StuUserExample();
|
||||
StuUserExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andSchoolIdEqualTo(parametes.getSchoolId());
|
||||
if (StringUtils.isNotBlank(parametes.getName())) {
|
||||
// criteria.andNameEqualTo(viewShowDTO.getName());
|
||||
criteria.andNameLike("%" + parametes.getName() + "%");
|
||||
}
|
||||
if (StringUtils.isNotBlank(parametes.getStudentId())) {
|
||||
// criteria.andStudentIdEqualTo(viewShowDTO.getStudentId());
|
||||
criteria.andStudentIdLike("%" + parametes.getStudentId() + "%");
|
||||
}
|
||||
if (StringUtils.isNotBlank(parametes.getClassName())) {
|
||||
|
||||
criteria.andClassNameLike("%" + parametes.getClassName() + "%");
|
||||
}
|
||||
example.setOrderByClause("total_rank");
|
||||
List<StuUser> stuUsers = userMapper.selectByExample(example);
|
||||
PageInfo<StuUser> pageInfoTotalList = new PageInfo<>(stuUsers);
|
||||
List<TchGeneralViewDTO> list = new ArrayList();
|
||||
for (int i = 0; i < stuUsers.size(); i++) {
|
||||
TchGeneralViewDTO dto = new TchGeneralViewDTO(stuUsers.get(i), tchModuleWeithList.get(0));
|
||||
list.add(dto);
|
||||
}
|
||||
PageInfo<TchGeneralViewDTO> pageInfo = new PageInfo<>(list);
|
||||
pageInfo.setTotal(pageInfoTotalList.getTotal());
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TchGeneralViewDTO> selectAllGeneralViewList(String schoolId) {
|
||||
|
||||
//根据学校id 查询tch_results_overview_weight表中 学校成绩总览权重
|
||||
TchModuleWeithExample tchModuleWeithExample = new TchModuleWeithExample();
|
||||
tchModuleWeithExample.createCriteria().andSchoolIdEqualTo(schoolId);
|
||||
List<TchModuleWeith> tchModuleWeithList = tchModuleWeithMapper.selectByExample(tchModuleWeithExample);
|
||||
|
||||
StuUserExample example = new StuUserExample();
|
||||
StuUserExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andSchoolIdEqualTo(schoolId);
|
||||
example.setOrderByClause("total_rank ASC");
|
||||
List<StuUser> stuUsers = userMapper.selectByExample(example);
|
||||
List<TchGeneralViewDTO> list = new ArrayList();
|
||||
for (int i = 0; i < stuUsers.size(); i++) {
|
||||
TchGeneralViewDTO dto = new TchGeneralViewDTO(stuUsers.get(i), tchModuleWeithList.get(0));
|
||||
list.add(dto);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean updateWeight(TchGeneralViewWeightDTO generalViewWeightDTO) {
|
||||
TchModuleWeithExample tchModuleWeithExample = new TchModuleWeithExample();
|
||||
tchModuleWeithExample.createCriteria().andSchoolIdEqualTo(generalViewWeightDTO.getSchoolId());
|
||||
List<TchModuleWeith> tchModuleWeithList = tchModuleWeithMapper.selectByExample(tchModuleWeithExample);
|
||||
TchModuleWeith tchModuleWeith = tchModuleWeithList.get(0);
|
||||
tchModuleWeith.setCreditPortraitWeith(generalViewWeightDTO.getCreditPortraitWeith());
|
||||
tchModuleWeith.setPersonalCreditWeith(generalViewWeightDTO.getPersonalCreditWeith());
|
||||
tchModuleWeith.setEnterpriseCreditWeith(generalViewWeightDTO.getEnterpriseCreditWeith());
|
||||
tchModuleWeith.setCaseStudyWeith(generalViewWeightDTO.getCaseStudyWeith());
|
||||
int i = tchModuleWeithMapper.updateByPrimaryKeySelective(tchModuleWeith);
|
||||
return i == 1 ? true : false;
|
||||
}
|
||||
|
||||
//总排名 先获取改学校的权重 再获取user对象 算出权重后的成绩 更新到totalscore中 再根据totalscore排名
|
||||
@Override
|
||||
public void totalRank(String schoolId) {
|
||||
TchModuleWeithExample tchModuleWeithExample = new TchModuleWeithExample();
|
||||
tchModuleWeithExample.createCriteria().andSchoolIdEqualTo(schoolId);
|
||||
List<TchModuleWeith> tchModuleWeithList = tchModuleWeithMapper.selectByExample(tchModuleWeithExample);
|
||||
|
||||
StuUserExample example = new StuUserExample();
|
||||
StuUserExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andSchoolIdEqualTo(schoolId);
|
||||
List<StuUser> stuUsers = userMapper.selectByExample(example);
|
||||
List<StuUser> list = new ArrayList();
|
||||
for (int i = 0; i < stuUsers.size(); i++) {
|
||||
StuUser stuUser=new StuUser(stuUsers.get(i),tchModuleWeithList.get(0));
|
||||
list.add(stuUser);
|
||||
}
|
||||
Collections.sort(list, new Comparator<StuUser>() {
|
||||
@Override
|
||||
public int compare(StuUser s1, StuUser s2) {
|
||||
return s2.getTotalScore().compareTo(s1.getTotalScore());
|
||||
}
|
||||
});
|
||||
// 更新totalRank值
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setTotalRank(i + 1);
|
||||
// userMapper.updateByPrimaryKeySelective(list.get(i));
|
||||
}
|
||||
userMapper.updateBatch(list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,222 @@
|
||||
package com.sztzjy.digital_credit.service.impl;/**
|
||||
* @author 17803
|
||||
* @date 2024-04-30 14:55
|
||||
*/
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.sztzjy.digital_credit.entity.*;
|
||||
import com.sztzjy.digital_credit.entity.dto.ClassAVGScoreVo;
|
||||
import com.sztzjy.digital_credit.entity.dto.TchAvgScoreByTimeDTO;
|
||||
import com.sztzjy.digital_credit.entity.dto.TchAvgScoreByTimeParentDTO;
|
||||
import com.sztzjy.digital_credit.entity.dto.TeaClassScoreDto;
|
||||
import com.sztzjy.digital_credit.mapper.StuScoreCenterMapper;
|
||||
import com.sztzjy.digital_credit.mapper.StuUserMapper;
|
||||
import com.sztzjy.digital_credit.mapper.TchClassAverageScoreMapper;
|
||||
import com.sztzjy.digital_credit.mapper.TchModuleWeithMapper;
|
||||
import com.sztzjy.digital_credit.service.TchHomePageService;
|
||||
import com.sztzjy.digital_credit.util.ResultEntity;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
||||
public class TchHomePageServiceImpl implements TchHomePageService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private StuUserMapper userMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private StuScoreCenterMapper scoreCenterMapper;
|
||||
|
||||
@Autowired
|
||||
private TchClassAverageScoreMapper tchClassAverageScoreMapper;
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public ResultEntity<List<TchAvgScoreByTimeParentDTO>> avgScoreTrendChart(String schoolId) {
|
||||
//
|
||||
// List<TchAvgScoreByTimeParentDTO> tchAvgScoreByTimeParentDTOS = new ArrayList<TchAvgScoreByTimeParentDTO>();
|
||||
//
|
||||
// //每天平均成绩集合
|
||||
// List<Double> avgScoreListByDate = new ArrayList<>();
|
||||
//
|
||||
// //根据学校ID查询所有的班级列表 class_name
|
||||
// StuUserExample userExample = new StuUserExample();
|
||||
// userExample.createCriteria().andSchoolIdEqualTo(schoolId);
|
||||
//
|
||||
// //学校所有班级
|
||||
// List<StuUser> userList = userMapper.selectByExample(userExample);
|
||||
//
|
||||
// if (userList.isEmpty())
|
||||
// {
|
||||
// return new ResultEntity<>(HttpStatus.OK,"schoolId不存在");
|
||||
// }
|
||||
//
|
||||
// // 查询出所有班级名
|
||||
// List<String> distinctClassNames = userList.stream()
|
||||
// .map(item -> item.getClassName())
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// //遍历所有班级
|
||||
// for (String className : distinctClassNames) {
|
||||
// TchAvgScoreByTimeParentDTO tchAvgScoreByTimeParentDTO = new TchAvgScoreByTimeParentDTO();
|
||||
//
|
||||
// tchAvgScoreByTimeParentDTO.setClassList(className);
|
||||
//
|
||||
//
|
||||
// List<TchClassAverageScore> tchClassAverageScores = tchClassAverageScoreMapper.selectByTime(className);
|
||||
//
|
||||
// //成绩列表
|
||||
// List<Double> avgDoubleList = tchClassAverageScores.stream().map(TchClassAverageScore::getAveScore).collect(Collectors.toList());
|
||||
// //时间列表
|
||||
// List<Date> dateList = tchClassAverageScores.stream().map(TchClassAverageScore::getCreateTime).collect(Collectors.toList());
|
||||
//
|
||||
// ArrayList<String> stringArrayList = new ArrayList<>();
|
||||
//
|
||||
// dateList.forEach(item ->{
|
||||
// SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// String formattedDate = outputFormat.format(item);
|
||||
// stringArrayList.add(formattedDate);
|
||||
// });
|
||||
//
|
||||
// TchAvgScoreByTimeDTO tchAvgScoreByTimeDTO = new TchAvgScoreByTimeDTO();
|
||||
// tchAvgScoreByTimeDTO.setAvgScoreList(StringUtils.join(avgDoubleList, ","));
|
||||
// tchAvgScoreByTimeDTO.setDataList(StringUtils.join(stringArrayList, ","));
|
||||
//
|
||||
// tchAvgScoreByTimeParentDTO.setBaseInfo(tchAvgScoreByTimeDTO);
|
||||
//
|
||||
// tchAvgScoreByTimeParentDTOS.add(tchAvgScoreByTimeParentDTO);
|
||||
// avgScoreListByDate.clear();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return new ResultEntity<>(HttpStatus.OK,"查询成功",tchAvgScoreByTimeParentDTOS);
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* 班级平均成绩走势图
|
||||
* @param schoolId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ClassAVGScoreVo> avgScoreTrendChart(String schoolId) {
|
||||
List<String> classNameList = tchClassAverageScoreMapper.selectClassNameBySchool(schoolId);
|
||||
List<ClassAVGScoreVo> voList = new ArrayList<>();
|
||||
for (String className : classNameList) {
|
||||
ClassAVGScoreVo vo = new ClassAVGScoreVo();
|
||||
vo.setClassName(className);
|
||||
List<TchClassAverageScore> list = tchClassAverageScoreMapper.selectAndOrderByTime(schoolId, className);
|
||||
if (list.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
List<BigDecimal> scoreList = new ArrayList();
|
||||
List<Date> dateList = new ArrayList<>();
|
||||
for (TchClassAverageScore classScore : list) {
|
||||
scoreList.add(classScore.getClassAverageScore());
|
||||
dateList.add(classScore.getCreateTime());
|
||||
}
|
||||
vo.setClassAverageScore(scoreList);
|
||||
vo.setStartTime(dateList);
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 班级成绩统计分析饼状图
|
||||
* @param schoolId
|
||||
* @param classId
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public TeaClassScoreDto getClassScoreCount(String schoolId, String classId, Date time) {
|
||||
TchClassAverageScoreExample teaClassScoreExample = new TchClassAverageScoreExample();
|
||||
TchClassAverageScoreExample.Criteria criteria = teaClassScoreExample.createCriteria();
|
||||
Date startTime = null;
|
||||
//班级框为空 统计学校下的所有数据返回
|
||||
if (classId == null && schoolId != null) {
|
||||
criteria.andSchoolIdEqualTo(schoolId).andCreateTimeEqualTo(time);
|
||||
List<TchClassAverageScore> teaClassScores = tchClassAverageScoreMapper.selectByExample(teaClassScoreExample);
|
||||
int schoolExcellentCount = 0;
|
||||
int schoolGoodCount = 0;
|
||||
int schoolGeneralCount = 0;
|
||||
int schoolFailCount = 0;
|
||||
BigDecimal maxScoreBySchoolId = BigDecimal.ZERO;
|
||||
BigDecimal minScoreBySchoolId = BigDecimal.ZERO;
|
||||
BigDecimal avgScoreBySchoolId = BigDecimal.ZERO;
|
||||
for (TchClassAverageScore teaClassScore : teaClassScores) {
|
||||
schoolExcellentCount = schoolExcellentCount + teaClassScore.getExcellentCount();
|
||||
schoolGoodCount = schoolGoodCount + teaClassScore.getGoodCount();
|
||||
schoolGeneralCount = schoolGeneralCount + teaClassScore.getGeneralCount();
|
||||
schoolFailCount = schoolFailCount + teaClassScore.getFailCount();
|
||||
|
||||
BigDecimal maxScore = teaClassScore.getClassMaxScore();
|
||||
if (maxScore == null) {
|
||||
maxScore = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal minScore = teaClassScore.getClassMinScore();
|
||||
if (minScore == null) {
|
||||
minScore = BigDecimal.ZERO;
|
||||
}
|
||||
// 计算最高分
|
||||
if (maxScore.compareTo(maxScoreBySchoolId) >= 0) {
|
||||
maxScoreBySchoolId = maxScore;
|
||||
}
|
||||
// 计算最低分
|
||||
if (minScoreBySchoolId.compareTo(BigDecimal.ZERO) == 0 || minScore.compareTo(minScoreBySchoolId) <= 0) {
|
||||
minScoreBySchoolId = minScore;
|
||||
}
|
||||
//所有班级平均分累加
|
||||
avgScoreBySchoolId = avgScoreBySchoolId.add(teaClassScore.getClassAverageScore()).setScale(2, RoundingMode.HALF_UP);
|
||||
startTime = teaClassScore.getCreateTime();
|
||||
}
|
||||
TeaClassScoreDto teaClassScoreDto = new TeaClassScoreDto();
|
||||
teaClassScoreDto.setSchoolExcellentCount(schoolExcellentCount);
|
||||
teaClassScoreDto.setSchoolGoodCount(schoolGoodCount);
|
||||
teaClassScoreDto.setSchoolGeneralCount(schoolGeneralCount);
|
||||
teaClassScoreDto.setSchoolFailCount(schoolFailCount);
|
||||
teaClassScoreDto.setSchoolMaxScore(maxScoreBySchoolId);
|
||||
teaClassScoreDto.setSchoolMinScore(minScoreBySchoolId);
|
||||
teaClassScoreDto.setStartTime(startTime);
|
||||
if (teaClassScores.size() > 0) {
|
||||
BigDecimal finalAVGScore = avgScoreBySchoolId.divide(BigDecimal.valueOf(teaClassScores.size()), 2, RoundingMode.HALF_UP);
|
||||
teaClassScoreDto.setSchoolAverageScore(finalAVGScore);
|
||||
}
|
||||
return teaClassScoreDto;
|
||||
} else { //选中某个班级返回
|
||||
criteria.andClassIdEqualTo(classId).andCreateTimeEqualTo(time);
|
||||
List<TchClassAverageScore> teaClassScores = tchClassAverageScoreMapper.selectByExample(teaClassScoreExample);
|
||||
if (teaClassScores.isEmpty()) {
|
||||
return new TeaClassScoreDto();
|
||||
}
|
||||
TchClassAverageScore teaClassScore = teaClassScores.get(0);
|
||||
TeaClassScoreDto teaClassScoreDto = new TeaClassScoreDto();
|
||||
BeanUtils.copyProperties(teaClassScore, teaClassScoreDto);
|
||||
return teaClassScoreDto;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,360 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sztzjy.digital_credit.mapper.TchClassAverageScoreMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sztzjy.digital_credit.entity.TchClassAverageScore">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="class_id" jdbcType="VARCHAR" property="classId" />
|
||||
<result column="class_name" jdbcType="VARCHAR" property="className" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="ave_score" jdbcType="DOUBLE" property="aveScore" />
|
||||
<result column="excellent_count" jdbcType="INTEGER" property="excellentCount" />
|
||||
<result column="good_count" jdbcType="INTEGER" property="goodCount" />
|
||||
<result column="general_count" jdbcType="INTEGER" property="generalCount" />
|
||||
<result column="fail_count" jdbcType="INTEGER" property="failCount" />
|
||||
<result column="class_max_score" jdbcType="DECIMAL" property="classMaxScore" />
|
||||
<result column="class_min_score" jdbcType="DECIMAL" property="classMinScore" />
|
||||
<result column="class_average_score" jdbcType="DECIMAL" property="classAverageScore" />
|
||||
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, class_id, class_name, create_time, ave_score, excellent_count, good_count, general_count,
|
||||
fail_count, class_max_score, class_min_score, class_average_score, school_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.sztzjy.digital_credit.entity.TchClassAverageScoreExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from tch_class_average_score
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tch_class_average_score
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from tch_class_average_score
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.sztzjy.digital_credit.entity.TchClassAverageScoreExample">
|
||||
delete from tch_class_average_score
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.sztzjy.digital_credit.entity.TchClassAverageScore">
|
||||
insert into tch_class_average_score (id, class_id, class_name,
|
||||
create_time, ave_score, excellent_count,
|
||||
good_count, general_count, fail_count,
|
||||
class_max_score, class_min_score, class_average_score,
|
||||
school_id)
|
||||
values (#{id,jdbcType=VARCHAR}, #{classId,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{aveScore,jdbcType=DOUBLE}, #{excellentCount,jdbcType=INTEGER},
|
||||
#{goodCount,jdbcType=INTEGER}, #{generalCount,jdbcType=INTEGER}, #{failCount,jdbcType=INTEGER},
|
||||
#{classMaxScore,jdbcType=DECIMAL}, #{classMinScore,jdbcType=DECIMAL}, #{classAverageScore,jdbcType=DECIMAL},
|
||||
#{schoolId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.sztzjy.digital_credit.entity.TchClassAverageScore">
|
||||
insert into tch_class_average_score
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="classId != null">
|
||||
class_id,
|
||||
</if>
|
||||
<if test="className != null">
|
||||
class_name,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="aveScore != null">
|
||||
ave_score,
|
||||
</if>
|
||||
<if test="excellentCount != null">
|
||||
excellent_count,
|
||||
</if>
|
||||
<if test="goodCount != null">
|
||||
good_count,
|
||||
</if>
|
||||
<if test="generalCount != null">
|
||||
general_count,
|
||||
</if>
|
||||
<if test="failCount != null">
|
||||
fail_count,
|
||||
</if>
|
||||
<if test="classMaxScore != null">
|
||||
class_max_score,
|
||||
</if>
|
||||
<if test="classMinScore != null">
|
||||
class_min_score,
|
||||
</if>
|
||||
<if test="classAverageScore != null">
|
||||
class_average_score,
|
||||
</if>
|
||||
<if test="schoolId != null">
|
||||
school_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="classId != null">
|
||||
#{classId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="className != null">
|
||||
#{className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="aveScore != null">
|
||||
#{aveScore,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="excellentCount != null">
|
||||
#{excellentCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="goodCount != null">
|
||||
#{goodCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="generalCount != null">
|
||||
#{generalCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="failCount != null">
|
||||
#{failCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classMaxScore != null">
|
||||
#{classMaxScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="classMinScore != null">
|
||||
#{classMinScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="classAverageScore != null">
|
||||
#{classAverageScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="schoolId != null">
|
||||
#{schoolId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.sztzjy.digital_credit.entity.TchClassAverageScoreExample" resultType="java.lang.Long">
|
||||
select count(*) from tch_class_average_score
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update tch_class_average_score
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.classId != null">
|
||||
class_id = #{record.classId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.className != null">
|
||||
class_name = #{record.className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.aveScore != null">
|
||||
ave_score = #{record.aveScore,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="record.excellentCount != null">
|
||||
excellent_count = #{record.excellentCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.goodCount != null">
|
||||
good_count = #{record.goodCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.generalCount != null">
|
||||
general_count = #{record.generalCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.failCount != null">
|
||||
fail_count = #{record.failCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.classMaxScore != null">
|
||||
class_max_score = #{record.classMaxScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.classMinScore != null">
|
||||
class_min_score = #{record.classMinScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.classAverageScore != null">
|
||||
class_average_score = #{record.classAverageScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.schoolId != null">
|
||||
school_id = #{record.schoolId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update tch_class_average_score
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
class_id = #{record.classId,jdbcType=VARCHAR},
|
||||
class_name = #{record.className,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
ave_score = #{record.aveScore,jdbcType=DOUBLE},
|
||||
excellent_count = #{record.excellentCount,jdbcType=INTEGER},
|
||||
good_count = #{record.goodCount,jdbcType=INTEGER},
|
||||
general_count = #{record.generalCount,jdbcType=INTEGER},
|
||||
fail_count = #{record.failCount,jdbcType=INTEGER},
|
||||
class_max_score = #{record.classMaxScore,jdbcType=DECIMAL},
|
||||
class_min_score = #{record.classMinScore,jdbcType=DECIMAL},
|
||||
class_average_score = #{record.classAverageScore,jdbcType=DECIMAL},
|
||||
school_id = #{record.schoolId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.digital_credit.entity.TchClassAverageScore">
|
||||
update tch_class_average_score
|
||||
<set>
|
||||
<if test="classId != null">
|
||||
class_id = #{classId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="className != null">
|
||||
class_name = #{className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="aveScore != null">
|
||||
ave_score = #{aveScore,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="excellentCount != null">
|
||||
excellent_count = #{excellentCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="goodCount != null">
|
||||
good_count = #{goodCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="generalCount != null">
|
||||
general_count = #{generalCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="failCount != null">
|
||||
fail_count = #{failCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classMaxScore != null">
|
||||
class_max_score = #{classMaxScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="classMinScore != null">
|
||||
class_min_score = #{classMinScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="classAverageScore != null">
|
||||
class_average_score = #{classAverageScore,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="schoolId != null">
|
||||
school_id = #{schoolId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.sztzjy.digital_credit.entity.TchClassAverageScore">
|
||||
update tch_class_average_score
|
||||
set class_id = #{classId,jdbcType=VARCHAR},
|
||||
class_name = #{className,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
ave_score = #{aveScore,jdbcType=DOUBLE},
|
||||
excellent_count = #{excellentCount,jdbcType=INTEGER},
|
||||
good_count = #{goodCount,jdbcType=INTEGER},
|
||||
general_count = #{generalCount,jdbcType=INTEGER},
|
||||
fail_count = #{failCount,jdbcType=INTEGER},
|
||||
class_max_score = #{classMaxScore,jdbcType=DECIMAL},
|
||||
class_min_score = #{classMinScore,jdbcType=DECIMAL},
|
||||
class_average_score = #{classAverageScore,jdbcType=DECIMAL},
|
||||
school_id = #{schoolId,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
|
||||
<!-- <select id="selectByTime" parameterType="java.lang.String" resultMap="BaseResultMap">-->
|
||||
<!-- select-->
|
||||
<!-- <include refid="Base_Column_List" />-->
|
||||
<!-- from tch_class_average_score-->
|
||||
<!-- where-->
|
||||
<!-- <if test="className != null">-->
|
||||
<!-- class_name = #{className,jdbcType=VARCHAR}-->
|
||||
<!-- </if>-->
|
||||
<!-- AND create_time >= DATE_SUB(NOW(), INTERVAL 6 MONTH)-->
|
||||
<!-- order by create_time asc-->
|
||||
<!-- </select>-->
|
||||
<select id="selectAndOrderByTime" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tch_class_average_score
|
||||
where school_id = #{schoolId,jdbcType=VARCHAR}
|
||||
AND class_name = #{className}
|
||||
AND create_time >= DATE_SUB(NOW(), INTERVAL 6 MONTH)
|
||||
order by create_time
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue