Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/sztzjy/digital_credit/entity/StuScoreCenter.java
master
@t2652009480 10 months ago
commit 3ac4c2e28f

@ -1,5 +1,6 @@
package com.sztzjy.digital_credit;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -7,9 +8,10 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@Configuration
@MapperScan(basePackages = "com.sztzjy.digital_credit.mapper")
@EnableScheduling
@Slf4j
public class FinancialBigDataApplication {
public static void main(String[] args) {

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

@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("api/stu/userPortrait")
@Api(tags = "用户画像:用户画像")
@Api(tags = "用户画像")
public class StuUserPortraitController {
@ -37,6 +37,19 @@ public class StuUserPortraitController {
}
@ApiOperation("用户画像:重新实训")
@AnonymousAccess
@GetMapping("/reTraining")
public ResultEntity reTraining(String userId){
return userPortraitControllerService.reTraining(userId);
}

@ -0,0 +1,163 @@
package com.sztzjy.digital_credit.controller.task;
import cn.hutool.core.util.IdUtil;
import com.sztzjy.digital_credit.annotation.AnonymousAccess;
import com.sztzjy.digital_credit.entity.*;
import com.sztzjy.digital_credit.entity.dto.EducationAndBreachOfContractDTO;
import com.sztzjy.digital_credit.mapper.StuBreachOfContractTrainingMapper;
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.service.StuUserService;
import com.sztzjy.digital_credit.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Component
public class StuTaskController {
@Autowired
TchClassAverageScoreMapper tchClassAverageScoreMapper;
@Autowired
private StuUserMapper userMapper;
@Autowired
StuUserService userService;
// 计算每天每个班级的平均成绩 每天00.00执行
@Scheduled(cron = "0 0 0 * * ?")
public void getClassScore() {
log.info("定时任务:==================计算班级平均分======================");
// 算平均值,存表
//查出所有数据
List<String> classIdList = userMapper.selectClassId();
for (String classId : classIdList) {
BigDecimal avgScore = BigDecimal.ZERO;
BigDecimal count = BigDecimal.ZERO;
StuUserExample userExample = new StuUserExample();
userExample.createCriteria().andClassIdEqualTo(classId);
List<StuUser> stuUsersList = userMapper.selectByExample(userExample);
// 创建存储等级人数的Map
Map<String, Integer> gradeCounts = new HashMap<>();
gradeCounts.put("excellent", 0);
gradeCounts.put("good", 0);
gradeCounts.put("general", 0);
gradeCounts.put("fail", 0);
BigDecimal classMaxScore = BigDecimal.ZERO; // 最高分默认为0
BigDecimal classMinScore = null; // 最低分默认为null
String schoolId = "";
for (StuUser score : stuUsersList) {
//第一个比较对象
BigDecimal totalScore = score.getTotalScore();
if (totalScore == null) {
totalScore = BigDecimal.ZERO;
}
schoolId = score.getSchoolId();
// 计算最高分
if (totalScore.compareTo(classMaxScore) >= 0) {
classMaxScore = totalScore;
}
// 计算最低分
if (classMinScore == null || totalScore.compareTo(classMinScore) <= 0) {
classMinScore = totalScore;
}
count = count.add(BigDecimal.ONE);
avgScore = avgScore.add(totalScore);
// 计算等级人数
if (totalScore.compareTo(BigDecimal.valueOf(90)) >= 0 && totalScore.compareTo(BigDecimal.valueOf(100)) <= 0) {
gradeCounts.put("excellent", gradeCounts.get("excellent") + 1);
} else if (totalScore.compareTo(BigDecimal.valueOf(80)) >= 0 && totalScore.compareTo(BigDecimal.valueOf(89)) <= 0) {
gradeCounts.put("good", gradeCounts.get("good") + 1);
} else if (totalScore.compareTo(BigDecimal.valueOf(60)) >= 0 && totalScore.compareTo(BigDecimal.valueOf(79)) <= 0) {
gradeCounts.put("general", gradeCounts.get("general") + 1);
} else if (totalScore.compareTo(BigDecimal.valueOf(0)) >= 0 && totalScore.compareTo(BigDecimal.valueOf(59)) <= 0) {
gradeCounts.put("fail", gradeCounts.get("fail") + 1);
}
}
TchClassAverageScore tchClassAverageScore= new TchClassAverageScore();
//时间为年月日
LocalDate currentDate = LocalDate.now();
Date date = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
tchClassAverageScore.setSchoolId(schoolId);
tchClassAverageScore.setCreateTime(date);
tchClassAverageScore.setId(IdUtil.simpleUUID());
tchClassAverageScore.setClassMaxScore(classMaxScore);
tchClassAverageScore.setClassMinScore(classMinScore);
tchClassAverageScore.setExcellentCount(gradeCounts.get("excellent"));
tchClassAverageScore.setGoodCount(gradeCounts.get("good"));
tchClassAverageScore.setGeneralCount(gradeCounts.get("general"));
tchClassAverageScore.setFailCount(gradeCounts.get("fail"));
tchClassAverageScore.setClassId(classId);
StuUserExample stuUserExample1 = new StuUserExample();
stuUserExample1.createCriteria().andSchoolIdEqualTo(schoolId).andClassIdEqualTo(classId);
List<StuUser> userTables = userMapper.selectByExample(stuUserExample1);
StuUser userTable = userTables.get(0);
tchClassAverageScore.setClassName(userTable.getClassName());
if (count.compareTo(BigDecimal.ZERO) == 0) {
tchClassAverageScore.setClassAverageScore(BigDecimal.ZERO);
} else {
BigDecimal divideScore = avgScore.divide(count, 2, RoundingMode.HALF_UP);
tchClassAverageScore.setClassAverageScore(divideScore);
}
tchClassAverageScoreMapper.insert(tchClassAverageScore);
}
log.info("定时任务:==================执行结束======================");
}
@Scheduled(fixedDelay = 3600000)
public void updateUserRank(){
//先查询所有学校id
List<String> schoolIds=userMapper.selectSchool();
for (int i = 0; i < schoolIds.size(); i++) {
String schoolId = schoolIds.get(i);
userService.totalRank(schoolId);
}
}
}

@ -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, "成绩总览权重设置失败");
}
}

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

@ -2,6 +2,7 @@ package com.sztzjy.digital_credit.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class StuScoreCenterExample {
@ -1054,6 +1055,136 @@ public class StuScoreCenterExample {
addCriterion("number_of_training not between", value1, value2, "numberOfTraining");
return (Criteria) this;
}
public Criteria andCompletionTimeIsNull() {
addCriterion("completion_time is null");
return (Criteria) this;
}
public Criteria andCompletionTimeIsNotNull() {
addCriterion("completion_time is not null");
return (Criteria) this;
}
public Criteria andCompletionTimeEqualTo(Date value) {
addCriterion("completion_time =", value, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeNotEqualTo(Date value) {
addCriterion("completion_time <>", value, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeGreaterThan(Date value) {
addCriterion("completion_time >", value, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeGreaterThanOrEqualTo(Date value) {
addCriterion("completion_time >=", value, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeLessThan(Date value) {
addCriterion("completion_time <", value, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeLessThanOrEqualTo(Date value) {
addCriterion("completion_time <=", value, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeIn(List<Date> values) {
addCriterion("completion_time in", values, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeNotIn(List<Date> values) {
addCriterion("completion_time not in", values, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeBetween(Date value1, Date value2) {
addCriterion("completion_time between", value1, value2, "completionTime");
return (Criteria) this;
}
public Criteria andCompletionTimeNotBetween(Date value1, Date value2) {
addCriterion("completion_time not between", value1, value2, "completionTime");
return (Criteria) this;
}
public Criteria andClassNameIsNull() {
addCriterion("class_name is null");
return (Criteria) this;
}
public Criteria andClassNameIsNotNull() {
addCriterion("class_name is not null");
return (Criteria) this;
}
public Criteria andClassNameEqualTo(String value) {
addCriterion("class_name =", value, "className");
return (Criteria) this;
}
public Criteria andClassNameNotEqualTo(String value) {
addCriterion("class_name <>", value, "className");
return (Criteria) this;
}
public Criteria andClassNameGreaterThan(String value) {
addCriterion("class_name >", value, "className");
return (Criteria) this;
}
public Criteria andClassNameGreaterThanOrEqualTo(String value) {
addCriterion("class_name >=", value, "className");
return (Criteria) this;
}
public Criteria andClassNameLessThan(String value) {
addCriterion("class_name <", value, "className");
return (Criteria) this;
}
public Criteria andClassNameLessThanOrEqualTo(String value) {
addCriterion("class_name <=", value, "className");
return (Criteria) this;
}
public Criteria andClassNameLike(String value) {
addCriterion("class_name like", value, "className");
return (Criteria) this;
}
public Criteria andClassNameNotLike(String value) {
addCriterion("class_name not like", value, "className");
return (Criteria) this;
}
public Criteria andClassNameIn(List<String> values) {
addCriterion("class_name in", values, "className");
return (Criteria) this;
}
public Criteria andClassNameNotIn(List<String> values) {
addCriterion("class_name not in", values, "className");
return (Criteria) this;
}
public Criteria andClassNameBetween(String value1, String value2) {
addCriterion("class_name between", value1, value2, "className");
return (Criteria) this;
}
public Criteria andClassNameNotBetween(String value1, String value2) {
addCriterion("class_name not between", value1, value2, "className");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

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

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

@ -6,7 +6,7 @@ import java.util.UUID;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @author tz
* @author whb
* tch_module_weith
*/
public class TchModuleWeith {
@ -92,6 +92,7 @@ public class TchModuleWeith {
this.caseStudyWeith=BigDecimal.valueOf(0.25);
}
public Integer getId() {
return id;
}

@ -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,23 @@
package com.sztzjy.digital_credit.entity.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 17803
* @date 2024-04-30 14:57
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TchAvgScoreByTimeDTO {
//得分以逗号分隔例如2022-10-01,2022-10-02,2022-10-03
private String avgScoreList;
//日期列表以逗号分隔例如20,21,10
private String dataList;
}

@ -0,0 +1,26 @@
package com.sztzjy.digital_credit.entity.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author 17803
* @date 2024-04-30 14:57
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TchAvgScoreByTimeParentDTO {
private String classList;
//日期列表以逗号分隔例如20,21,10
private TchAvgScoreByTimeDTO baseInfo;
}

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

@ -3,10 +3,9 @@ package com.sztzjy.digital_credit.mapper;
import com.sztzjy.digital_credit.entity.StuScoreCenter;
import com.sztzjy.digital_credit.entity.StuScoreCenterExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
import org.apache.ibatis.annotations.Select;
public interface StuScoreCenterMapper {
long countByExample(StuScoreCenterExample example);

@ -3,7 +3,10 @@ package com.sztzjy.digital_credit.mapper;
import com.sztzjy.digital_credit.entity.StuUser;
import com.sztzjy.digital_credit.entity.StuUserExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
public interface StuUserMapper {
long countByExample(StuUserExample example);
@ -28,5 +31,15 @@ public interface StuUserMapper {
int updateByPrimaryKey(StuUser record);
@Select("select class_id from stu_user group By class_id")
List<String> selectClassId();
@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);
@Select("select school_id from stu_user group by school_id")
List<String> selectSchool();
}

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

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

@ -25,4 +25,5 @@ public interface StuUserPortraitControllerService {
Boolean userPortraitSubState(String userId);
ResultEntity reTraining(String userId);
}

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

@ -19,6 +19,7 @@ import com.sztzjy.digital_credit.entity.*;
import com.sztzjy.digital_credit.entity.dto.StuFinancialIndexDTO;
import com.sztzjy.digital_credit.mapper.*;
import com.sztzjy.digital_credit.service.StuEnterPriseByInfoEntryService;
import com.sztzjy.digital_credit.service.StuPersonalCreditService;
import com.sztzjy.digital_credit.service.StuRateService;
import com.sztzjy.digital_credit.util.ConvertUtil;
import com.sztzjy.digital_credit.util.MyExcelListener;
@ -65,6 +66,9 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
@Autowired
private StuOperatingCapacityMapper operatingCapacityMapper;
@Autowired
private StuPersonalCreditService stuPersonalCreditService;
@Autowired
@ -195,7 +199,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
stuBaseInfoMapper.updateByPrimaryKeySelective(stuBaseInfo);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(stuBaseInfo,"基本信息",stuBaseInfo.getUserId());
stuPersonalCreditService.scoreEntry(stuBaseInfo.getUserId(),"基本信息", BigDecimal.valueOf(24-stuBaseInfo.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",stuBaseInfo.getErrorNumber());
@ -208,7 +212,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
//插入数据库
stuBaseInfoMapper.insertSelective(stuBaseInfo);
stuRateService.enterScoreWriteUserByUserId(stuBaseInfo,"基本信息",stuBaseInfo.getUserId());
stuPersonalCreditService.scoreEntry(stuBaseInfo.getUserId(),"基本信息", BigDecimal.valueOf(24-stuBaseInfo.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",stuBaseInfo.getErrorNumber());
}
@ -312,8 +316,9 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
creditRecords.setUpdateTime(new Date());
creditRecordsMapper.updateByPrimaryKeySelective(creditRecords);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(creditRecords,"信贷记录",creditRecords.getUserId());
//计算分数写入用户表
stuPersonalCreditService.scoreEntry(creditRecords.getUserId(),"信贷记录", BigDecimal.valueOf(16-creditRecords.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",creditRecords.getErrorNumber());
@ -327,7 +332,8 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
creditRecords.setCreateTime(new Date());
creditRecordsMapper.insertSelective(creditRecords);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(creditRecords,"信贷记录",creditRecords.getUserId());
stuPersonalCreditService.scoreEntry(creditRecords.getUserId(),"信贷记录", BigDecimal.valueOf(16-creditRecords.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",creditRecords.getErrorNumber());
}
@ -489,7 +495,9 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
profitAbility.setId(profitAbilityList.get(0).getId());
profitAbilityMapper.updateByPrimaryKeySelective(profitAbility);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(profitAbility,"盈利能力",profitAbility.getUserId());
stuPersonalCreditService.scoreEntry(profitAbility.getUserId(),"盈利能力", BigDecimal.valueOf(7-profitAbility.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",profitAbility.getErrorNumber());
@ -502,7 +510,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
//插入数据库
profitAbilityMapper.insertSelective(profitAbility);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(profitAbility,"盈利能力",profitAbility.getUserId());
stuPersonalCreditService.scoreEntry(profitAbility.getUserId(),"盈利能力", BigDecimal.valueOf(7-profitAbility.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",profitAbility.getErrorNumber());
}
@ -577,8 +585,8 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
solvencyMapper.updateByPrimaryKeySelective(solvency);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(solvency,"偿债能力",solvency.getUserId());
stuPersonalCreditService.scoreEntry(solvency.getUserId(),"偿债能力", BigDecimal.valueOf(7-solvency.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",solvency.getErrorNumber());
}else {
@ -589,7 +597,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
solvencyMapper.insertSelective(solvency);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(solvency,"偿债能力",solvency.getUserId());
stuPersonalCreditService.scoreEntry(solvency.getUserId(),"偿债能力", BigDecimal.valueOf(7-solvency.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",solvency.getErrorNumber());
}
@ -663,7 +671,8 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
operatingCapacity.setId(operatingCapacityList.get(0).getId());
operatingCapacityMapper.updateByPrimaryKeySelective(operatingCapacity);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(operatingCapacity,"营运能力",operatingCapacity.getUserId());
stuPersonalCreditService.scoreEntry(operatingCapacity.getUserId(),"营运能力", BigDecimal.valueOf(8-operatingCapacity.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",operatingCapacity.getErrorNumber());
@ -675,7 +684,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
//插入数据库
operatingCapacityMapper.insertSelective(operatingCapacity);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(operatingCapacity,"营运能力",operatingCapacity.getUserId());
stuPersonalCreditService.scoreEntry(operatingCapacity.getUserId(),"营运能力", BigDecimal.valueOf(8-operatingCapacity.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",operatingCapacity.getErrorNumber());
}
@ -755,7 +764,9 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
growthAbilityMapper.updateByPrimaryKeySelective(growthAbility);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(growthAbility,"成长能力",growthAbility.getUserId());
stuPersonalCreditService.scoreEntry(growthAbility.getUserId(),"成长能力", BigDecimal.valueOf(1-growthAbility.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",growthAbility.getErrorNumber());
@ -767,7 +778,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
//插入数据库
growthAbilityMapper.insertSelective(growthAbility);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(growthAbility,"成长能力",growthAbility.getUserId());
stuPersonalCreditService.scoreEntry(growthAbility.getUserId(),"成长能力", BigDecimal.valueOf(1-growthAbility.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",growthAbility.getErrorNumber());
}
}
@ -822,8 +833,6 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
@Override
public ResultEntity getFinancialDuPontAnalysisBySub(StuDuPontAnalysis duPontAnalysis) {
//判断是否为第一次提交
StuDuPontAnalysisExample duPontAnalysisExample = new StuDuPontAnalysisExample();
duPontAnalysisExample.createCriteria().andUserIdEqualTo(duPontAnalysis.getUserId());
@ -844,7 +853,10 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
duPontAnalysis.setId(duPontAnalysisList.get(0).getId());
duPontAnalysisMapper.updateByPrimaryKeySelective(duPontAnalysis);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(duPontAnalysis,"杜邦分析",duPontAnalysis.getUserId());
stuPersonalCreditService.scoreEntry(duPontAnalysis.getUserId(),"杜邦分析", BigDecimal.valueOf(4-duPontAnalysis.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",duPontAnalysis.getErrorNumber());
@ -855,7 +867,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
//插入数据库
duPontAnalysisMapper.insertSelective(duPontAnalysis);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(duPontAnalysis,"杜邦分析",duPontAnalysis.getUserId());
stuPersonalCreditService.scoreEntry(duPontAnalysis.getUserId(),"杜邦分析", BigDecimal.valueOf(4-duPontAnalysis.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",duPontAnalysis.getErrorNumber());
}
}

@ -10,6 +10,7 @@ import com.sztzjy.digital_credit.entity.*;
import com.sztzjy.digital_credit.mapper.StuOperationAssetAnalysisModuleMapper;
import com.sztzjy.digital_credit.mapper.StuScoreModuleMapper;
import com.sztzjy.digital_credit.service.StuFinancialEarlyWarningService;
import com.sztzjy.digital_credit.service.StuPersonalCreditService;
import com.sztzjy.digital_credit.service.StuRateService;
import com.sztzjy.digital_credit.util.ResultEntity;
import org.springframework.beans.BeanUtils;
@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -34,6 +36,8 @@ public class StuFinancialEarlyWarningServiceImpl implements StuFinancialEarlyWar
@Autowired
private StuRateService stuRateService;
@Autowired
private StuPersonalCreditService stuPersonalCreditService;
/**
* Z
* @param userId
@ -147,7 +151,10 @@ public class StuFinancialEarlyWarningServiceImpl implements StuFinancialEarlyWar
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(scoreModule,"Z计分模型",scoreModule.getUserId());
stuPersonalCreditService.scoreEntry(scoreModule.getUserId(),"Z计分模型", BigDecimal.valueOf(12-scoreModule.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",scoreModule.getErrorNumber());
@ -161,7 +168,7 @@ public class StuFinancialEarlyWarningServiceImpl implements StuFinancialEarlyWar
//插入数据库
scoreModuleMapper.insertSelective(scoreModule);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(scoreModule,"Z计分模型",scoreModule.getUserId());
stuPersonalCreditService.scoreEntry(scoreModule.getUserId(),"Z计分模型", BigDecimal.valueOf(12-scoreModule.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",scoreModule.getErrorNumber());
@ -275,7 +282,11 @@ public class StuFinancialEarlyWarningServiceImpl implements StuFinancialEarlyWar
analysisModule.setId(moduleList.get(0).getId());
operationAssetAnalysisModuleMapper.updateByPrimaryKeySelective(analysisModule);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(analysisModule,"营运资产分析模型",analysisModule.getUserId());
stuPersonalCreditService.scoreEntry(analysisModule.getUserId(),"营运资产分析模型", BigDecimal.valueOf(10-analysisModule.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",analysisModule.getErrorNumber());
@ -288,7 +299,7 @@ public class StuFinancialEarlyWarningServiceImpl implements StuFinancialEarlyWar
//插入数据库
operationAssetAnalysisModuleMapper.insertSelective(analysisModule);
//计算分数写入用户表
stuRateService.enterScoreWriteUserByUserId(analysisModule,"营运资产分析模型",analysisModule.getUserId());
stuPersonalCreditService.scoreEntry(analysisModule.getUserId(),"营运资产分析模型", BigDecimal.valueOf(10-analysisModule.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",analysisModule.getErrorNumber());
}

@ -7,6 +7,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil;
import com.sztzjy.digital_credit.entity.*;
import com.sztzjy.digital_credit.mapper.*;
import com.sztzjy.digital_credit.service.StuPersonalCreditService;
import com.sztzjy.digital_credit.service.StuRateService;
import com.sztzjy.digital_credit.util.ResultEntity;
import org.springframework.beans.BeanUtils;
@ -69,6 +70,9 @@ public class StuRateServiceImpl implements StuRateService {
private StuScoreCenterMapper stuScoreCenterMapper;
@Autowired
private StuPersonalCreditService stuPersonalCreditService;
@ -178,7 +182,10 @@ public class StuRateServiceImpl implements StuRateService {
ratingModel.setId(stuRatingModelList.get(0).getId());
ratingModelMapper.updateByPrimaryKeySelective(ratingModel);
//计算分数写入用户表
enterScoreWriteUserByUserId(ratingModel,"评级模型",ratingModel.getUserId());
stuPersonalCreditService.scoreEntry(ratingModel.getUserId(),"评级模型", BigDecimal.valueOf(35-ratingModel.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",ratingModel.getErrorNumber());
@ -191,7 +198,7 @@ public class StuRateServiceImpl implements StuRateService {
//插入数据库
ratingModelMapper.insertSelective(ratingModel);
//计算分数写入用户表
enterScoreWriteUserByUserId(ratingModel,"评级模型",ratingModel.getUserId());
stuPersonalCreditService.scoreEntry(ratingModel.getUserId(),"评级模型", BigDecimal.valueOf(35-ratingModel.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",ratingModel.getErrorNumber());
}
@ -305,7 +312,10 @@ public class StuRateServiceImpl implements StuRateService {
ratingResult.setId(ratingResultList.get(0).getId());
resultMapper.updateByPrimaryKeySelective(ratingResult);
//计算分数写入用户表
enterScoreWriteUserByUserId(ratingResult,"评级结果",ratingResult.getUserId());
stuPersonalCreditService.scoreEntry(ratingResult.getUserId(),"评级结果", BigDecimal.valueOf(6-ratingResult.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",ratingResult.getErrorNumber());
@ -318,7 +328,7 @@ public class StuRateServiceImpl implements StuRateService {
//插入数据库
resultMapper.insertSelective(ratingResult);
//计算分数写入用户表
enterScoreWriteUserByUserId(ratingResult,"评级结果",ratingResult.getUserId());
stuPersonalCreditService.scoreEntry(ratingResult.getUserId(),"评级结果", BigDecimal.valueOf(6-ratingResult.getErrorNumber()));
return new ResultEntity<>(HttpStatus.OK,"保存成功!",ratingResult.getErrorNumber());
}
@ -469,11 +479,11 @@ public class StuRateServiceImpl implements StuRateService {
}
//获取用户画像总成绩 企业征信总成绩 个人征信总成绩 累加 写入实训案例总成绩
BigDecimal allScore = stuUser.getCasePersonalCreditScore().add(stuUser.getCaseCorporateCreditScore()).add(stuUser.getCaseUserProfileSocre());
//综合案例总成绩
stuUser.setComprehensiveCaseScore(allScore);
// //获取用户画像总成绩 企业征信总成绩 个人征信总成绩 累加 写入实训案例总成绩
//
// BigDecimal allScore = stuUser.getCasePersonalCreditScore().add(stuUser.getCaseCorporateCreditScore()).add(stuUser.getCaseUserProfileSocre());
// //综合案例总成绩
// stuUser.setComprehensiveCaseScore(allScore);
userMapper.updateByPrimaryKeySelective(stuUser);
@ -818,7 +828,6 @@ public class StuRateServiceImpl implements StuRateService {
//企业征信将成绩写入用户表,计算总成绩
public void enterScoreWriteUserByUserId(Object obj,String module,String userId) {
Class<?> aClass = obj.getClass();
@ -856,8 +865,6 @@ public class StuRateServiceImpl implements StuRateService {
map.put("评级结果",6);
Integer currentCount = map.get(module);
//获取正确得分
@ -867,10 +874,8 @@ public class StuRateServiceImpl implements StuRateService {
info = 0;
}
StuUser user = userMapper.selectByPrimaryKey(userId);
//获取用户企业征信客观成绩
//获取用户 企业征信 客观成绩
BigDecimal caseCorporateCreditObjScore = user.getCaseCorporateCreditObjScore();
if (user.getCaseCorporateCreditObjScore() == null){
caseCorporateCreditObjScore = BigDecimal.valueOf(0);
@ -884,7 +889,7 @@ public class StuRateServiceImpl implements StuRateService {
if (caseCorporateCreditScore == null){
caseCorporateCreditScore = BigDecimal.valueOf(0);
}
//赋值企业征信客观总的成绩
//赋值 企业征信客观总的成绩
user.setCaseCorporateCreditScore(caseCorporateCreditScore.add(BigDecimal.valueOf(info)));
userMapper.updateByPrimaryKeySelective(user);

@ -11,6 +11,7 @@ import com.sztzjy.digital_credit.entity.StuUserPortrait;
import com.sztzjy.digital_credit.entity.StuUserPortraitExample;
import com.sztzjy.digital_credit.mapper.StuUserMapper;
import com.sztzjy.digital_credit.mapper.StuUserPortraitMapper;
import com.sztzjy.digital_credit.service.StuPersonalCreditService;
import com.sztzjy.digital_credit.service.StuUserPortraitControllerService;
import com.sztzjy.digital_credit.util.ResultEntity;
import org.springframework.beans.BeanUtils;
@ -19,9 +20,9 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.rmi.ServerException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class StuUserPortraitControllerServiceImpl implements StuUserPortraitControllerService {
@ -33,6 +34,11 @@ public class StuUserPortraitControllerServiceImpl implements StuUserPortraitCont
@Autowired
private StuUserMapper userMapper;
@Autowired
private StuPersonalCreditService stuPersonalCreditService;
/**
* (module)
* @param userPortrait
@ -63,8 +69,10 @@ public class StuUserPortraitControllerServiceImpl implements StuUserPortraitCont
//根据model算正确分数
portrait = correctScoreCalculationByModule(portrait);
stuPersonalCreditService.scoreEntry(portrait.getUserId(),portrait.getModule(), BigDecimal.valueOf(portrait.getCorrectNumber()));
//将分数保存到用户表,如果重新实训将用户表数据删除
saveScoreToUser(portrait);
// saveScoreToUser(portrait);
}
userPortraitMapper.updateByPrimaryKeySelective(portrait);
@ -82,7 +90,8 @@ public class StuUserPortraitControllerServiceImpl implements StuUserPortraitCont
userPortrait = correctScoreCalculationByModule(userPortrait);
//将分数保存到用户表,如果重新实训将用户表数据删除
saveScoreToUser(userPortrait);
// saveScoreToUser(userPortrait);
stuPersonalCreditService.scoreEntry(userPortrait.getUserId(),userPortrait.getModule(), BigDecimal.valueOf(userPortrait.getCorrectNumber()));
}
userPortraitMapper.insertSelective(userPortrait);
@ -92,6 +101,9 @@ public class StuUserPortraitControllerServiceImpl implements StuUserPortraitCont
}
/**
*
* @param userId
@ -117,6 +129,26 @@ public class StuUserPortraitControllerServiceImpl implements StuUserPortraitCont
return false;
}
/**
*
* @param userId
* @return
*/
@Override
public ResultEntity reTraining(String userId) {
//重新实训 查询这张表里所有的数据 然后删除
StuUserPortraitExample portraitExample = new StuUserPortraitExample();
portraitExample.createCriteria().andUserIdEqualTo(userId);
userPortraitMapper.deleteByExample(portraitExample);
return new ResultEntity<>(HttpStatus.OK,"重新实训成功!");
}
//将分数保存到用户表,如果重新实训将用户表数据删除
private void saveScoreToUser(StuUserPortrait portrait) {

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

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

@ -66,7 +66,7 @@
<!-- <table tableName="tch_module_weith" domainObjectName="TchModuleWeith" />-->
<!-- <table tableName="tch_assessment_points" domainObjectName="TchAssessmentPoints" />-->
<!-- <table tableName="training_report" domainObjectName="TrainingReport" />-->
<table tableName="stu_breach_of_contract_training" domainObjectName="StuBreachOfContractTraining" />
<table tableName="tch_class_average_score" domainObjectName="TchClassAverageScore" />
</context>

@ -17,6 +17,8 @@
<result column="training_score_two" jdbcType="DECIMAL" property="trainingScoreTwo" />
<result column="training_score_three" jdbcType="DECIMAL" property="trainingScoreThree" />
<result column="number_of_training" jdbcType="INTEGER" property="numberOfTraining" />
<result column="completion_time" jdbcType="TIMESTAMP" property="completionTime" />
<result column="class_name" jdbcType="VARCHAR" property="className" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -79,7 +81,7 @@
<sql id="Base_Column_List">
id, learning_projects, training_duration, training_total_score, score_weight, training_score,
class_ranking, completion_status, user_id, module, ascription, training_score_one,
training_score_two, training_score_three, number_of_training
training_score_two, training_score_three, number_of_training, completion_time, class_name
</sql>
<select id="selectByExample" parameterType="com.sztzjy.digital_credit.entity.StuScoreCenterExample" resultMap="BaseResultMap">
select
@ -116,14 +118,14 @@
training_total_score, score_weight, training_score,
class_ranking, completion_status, user_id,
module, ascription, training_score_one,
training_score_two, training_score_three, number_of_training
)
training_score_two, training_score_three, number_of_training,
completion_time, class_name)
values (#{id,jdbcType=INTEGER}, #{learningProjects,jdbcType=VARCHAR}, #{trainingDuration,jdbcType=INTEGER},
#{trainingTotalScore,jdbcType=DECIMAL}, #{scoreWeight,jdbcType=DECIMAL}, #{trainingScore,jdbcType=DECIMAL},
#{classRanking,jdbcType=INTEGER}, #{completionStatus,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{module,jdbcType=VARCHAR}, #{ascription,jdbcType=VARCHAR}, #{trainingScoreOne,jdbcType=DECIMAL},
#{trainingScoreTwo,jdbcType=DECIMAL}, #{trainingScoreThree,jdbcType=DECIMAL}, #{numberOfTraining,jdbcType=INTEGER}
)
#{trainingScoreTwo,jdbcType=DECIMAL}, #{trainingScoreThree,jdbcType=DECIMAL}, #{numberOfTraining,jdbcType=INTEGER},
#{completionTime,jdbcType=TIMESTAMP}, #{className,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.digital_credit.entity.StuScoreCenter">
insert into stu_score_center
@ -173,6 +175,12 @@
<if test="numberOfTraining != null">
number_of_training,
</if>
<if test="completionTime != null">
completion_time,
</if>
<if test="className != null">
class_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -220,6 +228,12 @@
<if test="numberOfTraining != null">
#{numberOfTraining,jdbcType=INTEGER},
</if>
<if test="completionTime != null">
#{completionTime,jdbcType=TIMESTAMP},
</if>
<if test="className != null">
#{className,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.digital_credit.entity.StuScoreCenterExample" resultType="java.lang.Long">
@ -276,6 +290,12 @@
<if test="record.numberOfTraining != null">
number_of_training = #{record.numberOfTraining,jdbcType=INTEGER},
</if>
<if test="record.completionTime != null">
completion_time = #{record.completionTime,jdbcType=TIMESTAMP},
</if>
<if test="record.className != null">
class_name = #{record.className,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -297,7 +317,9 @@
training_score_one = #{record.trainingScoreOne,jdbcType=DECIMAL},
training_score_two = #{record.trainingScoreTwo,jdbcType=DECIMAL},
training_score_three = #{record.trainingScoreThree,jdbcType=DECIMAL},
number_of_training = #{record.numberOfTraining,jdbcType=INTEGER}
number_of_training = #{record.numberOfTraining,jdbcType=INTEGER},
completion_time = #{record.completionTime,jdbcType=TIMESTAMP},
class_name = #{record.className,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -347,6 +369,12 @@
<if test="numberOfTraining != null">
number_of_training = #{numberOfTraining,jdbcType=INTEGER},
</if>
<if test="completionTime != null">
completion_time = #{completionTime,jdbcType=TIMESTAMP},
</if>
<if test="className != null">
class_name = #{className,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@ -365,7 +393,9 @@
training_score_one = #{trainingScoreOne,jdbcType=DECIMAL},
training_score_two = #{trainingScoreTwo,jdbcType=DECIMAL},
training_score_three = #{trainingScoreThree,jdbcType=DECIMAL},
number_of_training = #{numberOfTraining,jdbcType=INTEGER}
number_of_training = #{numberOfTraining,jdbcType=INTEGER},
completion_time = #{completionTime,jdbcType=TIMESTAMP},
class_name = #{className,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -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="item.loanCasesScore != null">
loan_cases_score = #{item.loanCasesScore,jdbcType=DECIMAL},
</if>
<if test="item.perSituationScore != null">
per_situation_score = #{item.perSituationScore,jdbcType=DECIMAL},
</if>
<if test="item.repaymentBehaviorScore != null">
repayment_behavior_score = #{item.repaymentBehaviorScore,jdbcType=DECIMAL},
</if>
<if test="item.perInfluenceFactorScore != null">
per_influence_factor_score = #{item.perInfluenceFactorScore,jdbcType=DECIMAL},
</if>
<if test="item.perCreditOptimizationSocre != null">
per_credit_optimization_socre = #{item.perCreditOptimizationSocre,jdbcType=DECIMAL},
</if>
<if test="item.perCreditRatingSocre != null">
per_credit_rating_socre = #{item.perCreditRatingSocre,jdbcType=DECIMAL},
</if>
<if test="item.entInfluenceFactorSocre != null">
ent_influence_factor_socre = #{item.entInfluenceFactorSocre,jdbcType=DECIMAL},
</if>
<if test="item.entCreditOptimizationSocre != null">
ent_credit_optimization_socre = #{item.entCreditOptimizationSocre,jdbcType=DECIMAL},
</if>
<if test="item.entCreditRatingSocre != null">
ent_credit_rating_socre = #{item.entCreditRatingSocre,jdbcType=DECIMAL},
</if>
<if test="item.caseUserProfileSocre != null">
case_user_profile_socre = #{item.caseUserProfileSocre,jdbcType=DECIMAL},
</if>
<if test="item.casePersonalCreditScore != null">
case_personal_credit_score = #{item.casePersonalCreditScore,jdbcType=DECIMAL},
</if>
<if test="item.caseCorporateCreditScore != null">
case_corporate_credit_score = #{item.caseCorporateCreditScore,jdbcType=DECIMAL},
</if>
<if test="item.caseCorporateCreditSubScore != null">
case_corporate_credit_sub_score = #{item.caseCorporateCreditSubScore,jdbcType=DECIMAL},
</if>
<if test="item.caseCorporateCreditObjScore != null">
case_corporate_credit_obj_score = #{item.caseCorporateCreditObjScore,jdbcType=DECIMAL},
</if>
<if test="item.casePersonalCreditSubScore != null">
case_personal_credit_sub_score = #{item.casePersonalCreditSubScore,jdbcType=DECIMAL},
</if>
<if test="item.casePersonalCreditObjScore != null">
case_personal_credit_obj_score = #{item.casePersonalCreditObjScore,jdbcType=DECIMAL},
</if>
<if test="item.creditPortraitScore != null">
credit_portrait_score = #{item.creditPortraitScore,jdbcType=DECIMAL},
</if>
<if test="item.creditPortraitRank != null">
credit_portrait_rank = #{item.creditPortraitRank,jdbcType=INTEGER},
</if>
<if test="item.personalCreditScore != null">
personal_credit_score = #{item.personalCreditScore,jdbcType=DECIMAL},
</if>
<if test="item.personalCreditRank != null">
personal_credit_rank = #{item.personalCreditRank,jdbcType=INTEGER},
</if>
<if test="item.corporateCreditScore != null">
corporate_credit_score = #{item.corporateCreditScore,jdbcType=DECIMAL},
</if>
<if test="item.corporateCreditRank != null">
corporate_credit_rank = #{item.corporateCreditRank,jdbcType=INTEGER},
</if>
<if test="item.comprehensiveCaseScore != null">
comprehensive_case_score = #{item.comprehensiveCaseScore,jdbcType=DECIMAL},
</if>
<if test="item.comprehensiveCaseRank != null">
comprehensive_case_rank = #{item.comprehensiveCaseRank,jdbcType=INTEGER},
</if>
<if test="item.totalRank != null">
total_rank = #{item.totalRank,jdbcType=INTEGER},
</if>
<if test="item.totalScore != null">
total_score = #{item.totalScore,jdbcType=DECIMAL},
</if>
</set>
where user_id = #{item.userId,jdbcType=VARCHAR}
</foreach>
</update>
</mapper>

@ -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…
Cancel
Save