完成教师端成绩总览所有功能
parent
73ad74714a
commit
b34a28edcf
@ -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,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,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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue