完成教师端成绩总览所有功能

master
whb 11 months ago
parent 73ad74714a
commit b34a28edcf

@ -33,8 +33,6 @@ import java.util.List;
@Api(tags = "数字征信实验实训")
public class StuExperimentTrainByCreditController {
@Autowired
private StuExperimentTrainByCreditService experimentTrainByCreditService;

@ -51,11 +51,6 @@ public class StuTaskController {
private StuUserMapper userMapper;
@Autowired
private StuScoreCenterMapper scoreCenterMapper;
// 计算每天每个班级的平均成绩 每天00.00执行
@Scheduled(cron = "0 0 0 * * ?")
public void getClassScore() {

@ -0,0 +1,112 @@
package com.sztzjy.digital_credit.controller.tch;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
import com.sztzjy.digital_credit.annotation.AnonymousAccess;
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.TchModuleWeithMapper;
import com.sztzjy.digital_credit.service.StuUserService;
import com.sztzjy.digital_credit.util.ResultEntity;
import com.sztzjy.digital_credit.util.excel.FilePortUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
//教师端成绩总览
@RestController
@RequestMapping("/api/tch/generalView")
public class TchGeneralViewController {
@Autowired
StuUserService userService;
@Autowired
private TchModuleWeithMapper tchModuleWeithMapper;
// @Autowired
// ISysTchResultsOverviewWeightService resultsOverviewWeightService;
// @Autowired
// private ISysTchRankService rankService;
@PostMapping("/getGeneralViewList")
@AnonymousAccess
@ApiOperation("成绩总览展示(条件查询)")
public ResultEntity getGeneralViewList(@RequestBody ScoreOverviewParametesDTO parametes) {
PageInfo<TchGeneralViewDTO> pageInfo = userService.selectGeneralViewList(parametes);
return new ResultEntity(HttpStatus.OK, "成绩总览展示", pageInfo);
}
@AnonymousAccess
@GetMapping("/generalViewExport")
@ApiOperation("成绩总览导出")
public void generalViewExport(HttpServletResponse response, @RequestParam String schoolId) {
//导出的表名
String title = IdUtil.simpleUUID();
//表中第一行表头字段
String[] headers = {"姓名", "学号", "班级","征信画像成绩","个人征信成绩","企业征信成绩","综合案例成绩","总成绩","排名"};
//实际数据结果集
List<TchGeneralViewDTO> tchGeneralViewDTOS = userService.selectAllGeneralViewList(schoolId);
//具体需要写入excel需要哪些字段这些字段取自UserReward类也就是上面的实际数据结果集的泛型
List<String> listColumn = Arrays.asList("name", "studentId"
, "className", "creditPortraitScore","personalCreditScore",
"corporateCreditScore","comprehensiveCaseScore","totalScore","totalRank");
try {
FilePortUtil.exportExcel(response, title, headers, tchGeneralViewDTOS, listColumn);
} catch (Exception e) {
e.printStackTrace();
}
}
@ApiOperation("成绩总览权重回显")
@AnonymousAccess
@GetMapping("/getResultsOverviewWeight")
public ResultEntity getResultsOverviewWeight(@RequestParam String schoolId) {
//根据学校id 查询权重表中 学校成绩总览权重
TchModuleWeithExample tchModuleWeithExample = new TchModuleWeithExample();
tchModuleWeithExample.createCriteria().andSchoolIdEqualTo(schoolId);
List<TchModuleWeith> tchModuleWeithList = tchModuleWeithMapper.selectByExample(tchModuleWeithExample);
return new ResultEntity(HttpStatus.OK, "成绩总览权重回显", tchModuleWeithList.get(0));
}
@AnonymousAccess
@PostMapping("/setResultsOverviewWeight")
@ApiOperation("成绩总览权重设置")
public ResultEntity setResultsOverviewWeight(@RequestBody TchGeneralViewWeightDTO generalViewWeightDTO){
Boolean b = userService.updateWeight(generalViewWeightDTO);
userService.totalRank(generalViewWeightDTO.getSchoolId());
if (b == true) {
return new ResultEntity(HttpStatus.OK, "成绩总览权重设置成功");
}
return new ResultEntity(HttpStatus.BAD_REQUEST, "成绩总览权重设置失败");
}
}

@ -117,6 +117,32 @@ public class StuUser {
@ApiModelProperty("综合得分(学校)(乘完权重后)")
private BigDecimal totalScore;
public StuUser(StuUser stuUser, TchModuleWeith resultsOverviewWeight) {
this.userId=stuUser.getUserId();
//征信画像
BigDecimal creditPortraitScore =stuUser.getLoanCasesScore().add(stuUser.getPerSituationScore()).add(stuUser.getRepaymentBehaviorScore()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getCreditPortraitWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
//个人征信
BigDecimal personalCreditScore=stuUser.getPerInfluenceFactorScore().add(stuUser.getPerCreditOptimizationSocre()).add(stuUser.getPerCreditRatingSocre()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getPersonalCreditWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
//企业征信
BigDecimal corporateCreditScore=stuUser.getEntInfluenceFactorSocre().add(stuUser.getEntCreditOptimizationSocre()).add(stuUser.getEntCreditRatingSocre()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getEnterpriseCreditWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
//综合案例
BigDecimal comprehensiveCaseScore=stuUser.getCaseUserProfileSocre().add(stuUser.getCasePersonalCreditScore()).add(stuUser.getCaseCorporateCreditScore()).divide(BigDecimal.valueOf(3)).multiply(resultsOverviewWeight.getCaseStudyWeith()).setScale(2,BigDecimal.ROUND_HALF_UP);
this.totalScore= creditPortraitScore.add(personalCreditScore).add(corporateCreditScore)
.add(comprehensiveCaseScore).setScale(2,BigDecimal.ROUND_HALF_UP);
}
public StuUser() {
}
public String getUserId() {
return userId;
}

@ -6,7 +6,7 @@ import java.util.UUID;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @author tz
* @author whb
* tch_module_weith
*/
public class TchModuleWeith {
@ -52,6 +52,19 @@ public class TchModuleWeith {
@ApiModelProperty("案例-企业征信权重")
private BigDecimal caseCorporateCreditWeith;
@ApiModelProperty("征信画像成绩权重")
private BigDecimal creditPortraitWeith;
@ApiModelProperty("个人征信成绩权重")
private BigDecimal personalCreditWeith;
@ApiModelProperty("企业征信成绩权重")
private BigDecimal enterpriseCreditWeith;
@ApiModelProperty("综合案例成绩权重")
private BigDecimal caseStudyWeith;
public TchModuleWeith(){
}
@ -75,6 +88,7 @@ public class TchModuleWeith {
this.caseCorporateCreditWeith=BigDecimal.valueOf(0.3);
}
public Integer getId() {
return id;
}
@ -186,4 +200,36 @@ public class TchModuleWeith {
public void setCaseCorporateCreditWeith(BigDecimal caseCorporateCreditWeith) {
this.caseCorporateCreditWeith = caseCorporateCreditWeith;
}
public BigDecimal getCreditPortraitWeith() {
return creditPortraitWeith;
}
public void setCreditPortraitWeith(BigDecimal creditPortraitWeith) {
this.creditPortraitWeith = creditPortraitWeith;
}
public BigDecimal getPersonalCreditWeith() {
return personalCreditWeith;
}
public void setPersonalCreditWeith(BigDecimal personalCreditWeith) {
this.personalCreditWeith = personalCreditWeith;
}
public BigDecimal getEnterpriseCreditWeith() {
return enterpriseCreditWeith;
}
public void setEnterpriseCreditWeith(BigDecimal enterpriseCreditWeith) {
this.enterpriseCreditWeith = enterpriseCreditWeith;
}
public BigDecimal getCaseStudyWeith() {
return caseStudyWeith;
}
public void setCaseStudyWeith(BigDecimal caseStudyWeith) {
this.caseStudyWeith = caseStudyWeith;
}
}

@ -954,6 +954,246 @@ public class TchModuleWeithExample {
addCriterion("case_corporate_credit_weith not between", value1, value2, "caseCorporateCreditWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithIsNull() {
addCriterion("credit_portrait_weith is null");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithIsNotNull() {
addCriterion("credit_portrait_weith is not null");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithEqualTo(BigDecimal value) {
addCriterion("credit_portrait_weith =", value, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithNotEqualTo(BigDecimal value) {
addCriterion("credit_portrait_weith <>", value, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithGreaterThan(BigDecimal value) {
addCriterion("credit_portrait_weith >", value, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("credit_portrait_weith >=", value, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithLessThan(BigDecimal value) {
addCriterion("credit_portrait_weith <", value, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithLessThanOrEqualTo(BigDecimal value) {
addCriterion("credit_portrait_weith <=", value, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithIn(List<BigDecimal> values) {
addCriterion("credit_portrait_weith in", values, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithNotIn(List<BigDecimal> values) {
addCriterion("credit_portrait_weith not in", values, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("credit_portrait_weith between", value1, value2, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andCreditPortraitWeithNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("credit_portrait_weith not between", value1, value2, "creditPortraitWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithIsNull() {
addCriterion("personal_credit_weith is null");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithIsNotNull() {
addCriterion("personal_credit_weith is not null");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithEqualTo(BigDecimal value) {
addCriterion("personal_credit_weith =", value, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithNotEqualTo(BigDecimal value) {
addCriterion("personal_credit_weith <>", value, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithGreaterThan(BigDecimal value) {
addCriterion("personal_credit_weith >", value, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("personal_credit_weith >=", value, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithLessThan(BigDecimal value) {
addCriterion("personal_credit_weith <", value, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithLessThanOrEqualTo(BigDecimal value) {
addCriterion("personal_credit_weith <=", value, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithIn(List<BigDecimal> values) {
addCriterion("personal_credit_weith in", values, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithNotIn(List<BigDecimal> values) {
addCriterion("personal_credit_weith not in", values, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("personal_credit_weith between", value1, value2, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andPersonalCreditWeithNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("personal_credit_weith not between", value1, value2, "personalCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithIsNull() {
addCriterion("enterprise_credit_weith is null");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithIsNotNull() {
addCriterion("enterprise_credit_weith is not null");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithEqualTo(BigDecimal value) {
addCriterion("enterprise_credit_weith =", value, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithNotEqualTo(BigDecimal value) {
addCriterion("enterprise_credit_weith <>", value, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithGreaterThan(BigDecimal value) {
addCriterion("enterprise_credit_weith >", value, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("enterprise_credit_weith >=", value, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithLessThan(BigDecimal value) {
addCriterion("enterprise_credit_weith <", value, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithLessThanOrEqualTo(BigDecimal value) {
addCriterion("enterprise_credit_weith <=", value, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithIn(List<BigDecimal> values) {
addCriterion("enterprise_credit_weith in", values, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithNotIn(List<BigDecimal> values) {
addCriterion("enterprise_credit_weith not in", values, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("enterprise_credit_weith between", value1, value2, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andEnterpriseCreditWeithNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("enterprise_credit_weith not between", value1, value2, "enterpriseCreditWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithIsNull() {
addCriterion("case_study_weith is null");
return (Criteria) this;
}
public Criteria andCaseStudyWeithIsNotNull() {
addCriterion("case_study_weith is not null");
return (Criteria) this;
}
public Criteria andCaseStudyWeithEqualTo(BigDecimal value) {
addCriterion("case_study_weith =", value, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithNotEqualTo(BigDecimal value) {
addCriterion("case_study_weith <>", value, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithGreaterThan(BigDecimal value) {
addCriterion("case_study_weith >", value, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("case_study_weith >=", value, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithLessThan(BigDecimal value) {
addCriterion("case_study_weith <", value, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithLessThanOrEqualTo(BigDecimal value) {
addCriterion("case_study_weith <=", value, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithIn(List<BigDecimal> values) {
addCriterion("case_study_weith in", values, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithNotIn(List<BigDecimal> values) {
addCriterion("case_study_weith not in", values, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("case_study_weith between", value1, value2, "caseStudyWeith");
return (Criteria) this;
}
public Criteria andCaseStudyWeithNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("case_study_weith not between", value1, value2, "caseStudyWeith");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -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;
}

@ -36,4 +36,7 @@ public interface StuUserMapper {
@Select("select distinct(class_id),class_name from stu_user where school_id = #{schoolId}")
List<Map<String,String>> selectClassNameBySchoolId(@Param("schoolId") String schoolId);
//批量更新排名
void updateBatch(List<StuUser> list);
}

@ -3,10 +3,8 @@ package com.sztzjy.digital_credit.mapper;
import com.sztzjy.digital_credit.entity.TchModuleWeith;
import com.sztzjy.digital_credit.entity.TchModuleWeithExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TchModuleWeithMapper {
long countByExample(TchModuleWeithExample example);

@ -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);
}

@ -822,8 +822,6 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
@Override
public ResultEntity getFinancialDuPontAnalysisBySub(StuDuPontAnalysis duPontAnalysis) {
//判断是否为第一次提交
StuDuPontAnalysisExample duPontAnalysisExample = new StuDuPontAnalysisExample();
duPontAnalysisExample.createCriteria().andUserIdEqualTo(duPontAnalysis.getUserId());

@ -818,7 +818,6 @@ public class StuRateServiceImpl implements StuRateService {
//企业征信将成绩写入用户表,计算总成绩
public void enterScoreWriteUserByUserId(Object obj,String module,String userId) {
Class<?> aClass = obj.getClass();
@ -856,8 +855,6 @@ public class StuRateServiceImpl implements StuRateService {
map.put("评级结果",6);
Integer currentCount = map.get(module);
//获取正确得分
@ -867,8 +864,6 @@ public class StuRateServiceImpl implements StuRateService {
info = 0;
}
StuUser user = userMapper.selectByPrimaryKey(userId);
//获取用户 企业征信 客观成绩
BigDecimal caseCorporateCreditObjScore = user.getCaseCorporateCreditObjScore();

@ -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);
}
}

@ -2,7 +2,7 @@ spring:
datasource:
druid:
db-type: mysql
url: jdbc:mysql://${DB_HOST:118.31.7.2}:${DB_PORT:3306}/${DB_NAME:tz_digital_credit}?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false&useInformationSchema=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://${DB_HOST:118.31.7.2}:${DB_PORT:3306}/${DB_NAME:tz_digital_credit}?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false&useInformationSchema=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: ${DB_USER:root}
password: ${DB_PWD:sztzjy2017}
driver-class-name: com.mysql.cj.jdbc.Driver
@ -11,7 +11,7 @@ spring:
# 文件存储
file:
type: local
path: D:\home
path: D:\home\credit
# path: D:\home
# path: /usr/local/tianzeProject/blockFinance/uploadFile

@ -709,4 +709,115 @@
total_score = #{totalScore,jdbcType=DECIMAL}
where user_id = #{userId,jdbcType=VARCHAR}
</update>
<!-- 批量更新第一种方法通过接收传进来的参数list进行循环着组装sql -->
<update id="updateBatch" parameterType="java.util.List" >
<!-- <foreach collection="list" item="item" index="index" open="" close="" separator=";">-->
<foreach collection="list" item="item" separator=";">
update stu_user
<set>
<if test="item.name != null">
name = #{item.name,jdbcType=VARCHAR},
</if>
<if test="item.studentId != null">
student_id = #{item.studentId,jdbcType=VARCHAR},
</if>
<if test="item.major != null">
major = #{item.major,jdbcType=VARCHAR},
</if>
<if test="item.className != null">
class_name = #{item.className,jdbcType=VARCHAR},
</if>
<if test="item.classId != null">
class_id = #{item.classId,jdbcType=VARCHAR},
</if>
<if test="item.schoolId != null">
school_id = #{item.schoolId,jdbcType=VARCHAR},
</if>
<if test="item.schoolName != null">
school_name = #{item.schoolName,jdbcType=VARCHAR},
</if>
<if test="loanCasesScore != null">
loan_cases_score = #{loanCasesScore,jdbcType=DECIMAL},
</if>
<if test="perSituationScore != null">
per_situation_score = #{perSituationScore,jdbcType=DECIMAL},
</if>
<if test="repaymentBehaviorScore != null">
repayment_behavior_score = #{repaymentBehaviorScore,jdbcType=DECIMAL},
</if>
<if test="perInfluenceFactorScore != null">
per_influence_factor_score = #{perInfluenceFactorScore,jdbcType=DECIMAL},
</if>
<if test="perCreditOptimizationSocre != null">
per_credit_optimization_socre = #{perCreditOptimizationSocre,jdbcType=DECIMAL},
</if>
<if test="perCreditRatingSocre != null">
per_credit_rating_socre = #{perCreditRatingSocre,jdbcType=DECIMAL},
</if>
<if test="entInfluenceFactorSocre != null">
ent_influence_factor_socre = #{entInfluenceFactorSocre,jdbcType=DECIMAL},
</if>
<if test="entCreditOptimizationSocre != null">
ent_credit_optimization_socre = #{entCreditOptimizationSocre,jdbcType=DECIMAL},
</if>
<if test="entCreditRatingSocre != null">
ent_credit_rating_socre = #{entCreditRatingSocre,jdbcType=DECIMAL},
</if>
<if test="caseUserProfileSocre != null">
case_user_profile_socre = #{caseUserProfileSocre,jdbcType=DECIMAL},
</if>
<if test="casePersonalCreditScore != null">
case_personal_credit_score = #{casePersonalCreditScore,jdbcType=DECIMAL},
</if>
<if test="caseCorporateCreditScore != null">
case_corporate_credit_score = #{caseCorporateCreditScore,jdbcType=DECIMAL},
</if>
<if test="caseCorporateCreditSubScore != null">
case_corporate_credit_sub_score = #{caseCorporateCreditSubScore,jdbcType=DECIMAL},
</if>
<if test="caseCorporateCreditObjScore != null">
case_corporate_credit_obj_score = #{caseCorporateCreditObjScore,jdbcType=DECIMAL},
</if>
<if test="casePersonalCreditSubScore != null">
case_personal_credit_sub_score = #{casePersonalCreditSubScore,jdbcType=DECIMAL},
</if>
<if test="casePersonalCreditObjScore != null">
case_personal_credit_obj_score = #{casePersonalCreditObjScore,jdbcType=DECIMAL},
</if>
<if test="creditPortraitScore != null">
credit_portrait_score = #{creditPortraitScore,jdbcType=DECIMAL},
</if>
<if test="creditPortraitRank != null">
credit_portrait_rank = #{creditPortraitRank,jdbcType=INTEGER},
</if>
<if test="personalCreditScore != null">
personal_credit_score = #{personalCreditScore,jdbcType=DECIMAL},
</if>
<if test="personalCreditRank != null">
personal_credit_rank = #{personalCreditRank,jdbcType=INTEGER},
</if>
<if test="corporateCreditScore != null">
corporate_credit_score = #{corporateCreditScore,jdbcType=DECIMAL},
</if>
<if test="corporateCreditRank != null">
corporate_credit_rank = #{corporateCreditRank,jdbcType=INTEGER},
</if>
<if test="comprehensiveCaseScore != null">
comprehensive_case_score = #{comprehensiveCaseScore,jdbcType=DECIMAL},
</if>
<if test="comprehensiveCaseRank != null">
comprehensive_case_rank = #{comprehensiveCaseRank,jdbcType=INTEGER},
</if>
<if test="totalRank != null">
total_rank = #{totalRank,jdbcType=INTEGER},
</if>
<if test="totalScore != null">
total_score = #{totalScore,jdbcType=DECIMAL},
</if>
</set>
where user_id = #{item.userId,jdbcType=VARCHAR}
</foreach>
</update>
</mapper>

@ -16,6 +16,10 @@
<result column="case_user_profile_weith" jdbcType="DECIMAL" property="caseUserProfileWeith" />
<result column="case_personal_credit_weith" jdbcType="DECIMAL" property="casePersonalCreditWeith" />
<result column="case_corporate_credit_weith" jdbcType="DECIMAL" property="caseCorporateCreditWeith" />
<result column="credit_portrait_weith" jdbcType="DECIMAL" property="creditPortraitWeith" />
<result column="personal_credit_weith" jdbcType="DECIMAL" property="personalCreditWeith" />
<result column="enterprise_credit_weith" jdbcType="DECIMAL" property="enterpriseCreditWeith" />
<result column="case_study_weith" jdbcType="DECIMAL" property="caseStudyWeith" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -79,7 +83,8 @@
id, school_id, loan_cases_weight, per_situation_weiht, repayment_behavior_weiht,
per_influence_factor_weith, per_credit_optimization_weith, per_credit_rating_weith,
ent_influence_factor_weith, ent_credit_optimization_weith, ent_credit_rating_weith,
case_user_profile_weith, case_personal_credit_weith, case_corporate_credit_weith
case_user_profile_weith, case_personal_credit_weith, case_corporate_credit_weith,
credit_portrait_weith, personal_credit_weith, enterprise_credit_weith, case_study_weith
</sql>
<select id="selectByExample" parameterType="com.sztzjy.digital_credit.entity.TchModuleWeithExample" resultMap="BaseResultMap">
select
@ -118,14 +123,18 @@
per_credit_rating_weith, ent_influence_factor_weith,
ent_credit_optimization_weith, ent_credit_rating_weith,
case_user_profile_weith, case_personal_credit_weith,
case_corporate_credit_weith)
case_corporate_credit_weith, credit_portrait_weith,
personal_credit_weith, enterprise_credit_weith,
case_study_weith)
values (#{id,jdbcType=INTEGER}, #{schoolId,jdbcType=VARCHAR}, #{loanCasesWeight,jdbcType=DECIMAL},
#{perSituationWeiht,jdbcType=DECIMAL}, #{repaymentBehaviorWeiht,jdbcType=DECIMAL},
#{perInfluenceFactorWeith,jdbcType=DECIMAL}, #{perCreditOptimizationWeith,jdbcType=DECIMAL},
#{perCreditRatingWeith,jdbcType=DECIMAL}, #{entInfluenceFactorWeith,jdbcType=DECIMAL},
#{entCreditOptimizationWeith,jdbcType=DECIMAL}, #{entCreditRatingWeith,jdbcType=DECIMAL},
#{caseUserProfileWeith,jdbcType=DECIMAL}, #{casePersonalCreditWeith,jdbcType=DECIMAL},
#{caseCorporateCreditWeith,jdbcType=DECIMAL})
#{caseCorporateCreditWeith,jdbcType=DECIMAL}, #{creditPortraitWeith,jdbcType=DECIMAL},
#{personalCreditWeith,jdbcType=DECIMAL}, #{enterpriseCreditWeith,jdbcType=DECIMAL},
#{caseStudyWeith,jdbcType=DECIMAL})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.digital_credit.entity.TchModuleWeith">
insert into tch_module_weith
@ -172,6 +181,18 @@
<if test="caseCorporateCreditWeith != null">
case_corporate_credit_weith,
</if>
<if test="creditPortraitWeith != null">
credit_portrait_weith,
</if>
<if test="personalCreditWeith != null">
personal_credit_weith,
</if>
<if test="enterpriseCreditWeith != null">
enterprise_credit_weith,
</if>
<if test="caseStudyWeith != null">
case_study_weith,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -216,6 +237,18 @@
<if test="caseCorporateCreditWeith != null">
#{caseCorporateCreditWeith,jdbcType=DECIMAL},
</if>
<if test="creditPortraitWeith != null">
#{creditPortraitWeith,jdbcType=DECIMAL},
</if>
<if test="personalCreditWeith != null">
#{personalCreditWeith,jdbcType=DECIMAL},
</if>
<if test="enterpriseCreditWeith != null">
#{enterpriseCreditWeith,jdbcType=DECIMAL},
</if>
<if test="caseStudyWeith != null">
#{caseStudyWeith,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.digital_credit.entity.TchModuleWeithExample" resultType="java.lang.Long">
@ -269,6 +302,18 @@
<if test="record.caseCorporateCreditWeith != null">
case_corporate_credit_weith = #{record.caseCorporateCreditWeith,jdbcType=DECIMAL},
</if>
<if test="record.creditPortraitWeith != null">
credit_portrait_weith = #{record.creditPortraitWeith,jdbcType=DECIMAL},
</if>
<if test="record.personalCreditWeith != null">
personal_credit_weith = #{record.personalCreditWeith,jdbcType=DECIMAL},
</if>
<if test="record.enterpriseCreditWeith != null">
enterprise_credit_weith = #{record.enterpriseCreditWeith,jdbcType=DECIMAL},
</if>
<if test="record.caseStudyWeith != null">
case_study_weith = #{record.caseStudyWeith,jdbcType=DECIMAL},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -289,7 +334,11 @@
ent_credit_rating_weith = #{record.entCreditRatingWeith,jdbcType=DECIMAL},
case_user_profile_weith = #{record.caseUserProfileWeith,jdbcType=DECIMAL},
case_personal_credit_weith = #{record.casePersonalCreditWeith,jdbcType=DECIMAL},
case_corporate_credit_weith = #{record.caseCorporateCreditWeith,jdbcType=DECIMAL}
case_corporate_credit_weith = #{record.caseCorporateCreditWeith,jdbcType=DECIMAL},
credit_portrait_weith = #{record.creditPortraitWeith,jdbcType=DECIMAL},
personal_credit_weith = #{record.personalCreditWeith,jdbcType=DECIMAL},
enterprise_credit_weith = #{record.enterpriseCreditWeith,jdbcType=DECIMAL},
case_study_weith = #{record.caseStudyWeith,jdbcType=DECIMAL}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -336,6 +385,18 @@
<if test="caseCorporateCreditWeith != null">
case_corporate_credit_weith = #{caseCorporateCreditWeith,jdbcType=DECIMAL},
</if>
<if test="creditPortraitWeith != null">
credit_portrait_weith = #{creditPortraitWeith,jdbcType=DECIMAL},
</if>
<if test="personalCreditWeith != null">
personal_credit_weith = #{personalCreditWeith,jdbcType=DECIMAL},
</if>
<if test="enterpriseCreditWeith != null">
enterprise_credit_weith = #{enterpriseCreditWeith,jdbcType=DECIMAL},
</if>
<if test="caseStudyWeith != null">
case_study_weith = #{caseStudyWeith,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@ -353,7 +414,11 @@
ent_credit_rating_weith = #{entCreditRatingWeith,jdbcType=DECIMAL},
case_user_profile_weith = #{caseUserProfileWeith,jdbcType=DECIMAL},
case_personal_credit_weith = #{casePersonalCreditWeith,jdbcType=DECIMAL},
case_corporate_credit_weith = #{caseCorporateCreditWeith,jdbcType=DECIMAL}
case_corporate_credit_weith = #{caseCorporateCreditWeith,jdbcType=DECIMAL},
credit_portrait_weith = #{creditPortraitWeith,jdbcType=DECIMAL},
personal_credit_weith = #{personalCreditWeith,jdbcType=DECIMAL},
enterprise_credit_weith = #{enterpriseCreditWeith,jdbcType=DECIMAL},
case_study_weith = #{caseStudyWeith,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
Loading…
Cancel
Save