|
|
@@ -7,6 +7,7 @@ import com.alibaba.excel.support.ExcelTypeEnum;
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
@@ -14,19 +15,15 @@ import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.ScoreTypeEnum;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.common.utils.excel.ExcelMergeUtil;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.mapper.BaseClassMapper;
|
|
|
-import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
|
|
|
-import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
|
|
|
-import com.xjrsoft.module.student.dto.CalssQuantitativeAssessmentPageDto;
|
|
|
-import com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto;
|
|
|
+import com.xjrsoft.module.evaluate.vo.ResultViewingPageVo;
|
|
|
+import com.xjrsoft.module.student.dto.*;
|
|
|
import com.xjrsoft.module.student.entity.*;
|
|
|
-import com.xjrsoft.module.student.mapper.BaseStudentAssessmentCategoryMapper;
|
|
|
-import com.xjrsoft.module.student.mapper.BaseStudentAssessmentClassRelationMapper;
|
|
|
-import com.xjrsoft.module.student.mapper.BaseStudentAssessmentInspectionMapper;
|
|
|
-import com.xjrsoft.module.student.mapper.BaseStudentAssessmentStudentRelationMapper;
|
|
|
+import com.xjrsoft.module.student.mapper.*;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentAssessmentInspectionService;
|
|
|
import com.xjrsoft.module.student.vo.*;
|
|
|
import com.xjrsoft.module.system.entity.File;
|
|
|
@@ -35,10 +32,17 @@ import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.script.ScriptEngine;
|
|
|
+import javax.script.ScriptEngineManager;
|
|
|
+import javax.script.ScriptException;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -61,6 +65,8 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
|
|
|
private final BaseClassMapper baseClassMapper;
|
|
|
|
|
|
+ private final BaseStudentSchoolRollMapper baseStudentSchoolRollMapper;
|
|
|
+
|
|
|
private final IFileService fileService;
|
|
|
|
|
|
@Override
|
|
|
@@ -94,11 +100,9 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
.selectAs(XjrUser::getName, BaseStudentAssessmentClassListVo::getTeacherName)
|
|
|
.selectAs(XjrUser::getMobile, BaseStudentAssessmentClassListVo::getMobile)
|
|
|
.select(BaseStudentAssessmentClassRelation.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentAssessmentClassRelation.class).contains(x.getProperty()))
|
|
|
-
|
|
|
);
|
|
|
result.setClassList(baseStudentAssessmentClassListVos);
|
|
|
|
|
|
-
|
|
|
// 获取学生信息
|
|
|
List<BaseStudentAssessmentStudentRelation> baseStudentAssessmentStudentRelations = assessmentStudentRelationMapper.selectList(
|
|
|
Wrappers.<BaseStudentAssessmentStudentRelation>query().lambda()
|
|
|
@@ -223,8 +227,8 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<CalssQuantitativeAssessmentPageVo> getCalssQuantitativeAssessmentPage(Page<CalssQuantitativeAssessmentPageDto> page, CalssQuantitativeAssessmentPageDto dto) {
|
|
|
- //以班级为数据的基础
|
|
|
+ public IPage<CalssQuantitativeAssessmentPageVo> getCalssQuantitativeAssessmentPage(Page<CalssQuantitativeAssessmentPageDto> page, CalssQuantitativeAssessmentPageDto dto) {
|
|
|
+ //以班级为数据的基础进行数据的填充
|
|
|
MPJLambdaWrapper<BaseClass> baseClassMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
baseClassMPJLambdaWrapper
|
|
|
.selectAs(BaseClass::getTeacherId, CalssQuantitativeAssessmentPageVo::getHeadTeacherId)
|
|
|
@@ -238,10 +242,89 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
.leftJoin(BaseClassMajorSet.class, BaseClassMajorSet::getClassId, BaseClass::getId)
|
|
|
.disableSubLogicDel();
|
|
|
|
|
|
- return null;
|
|
|
+ IPage<CalssQuantitativeAssessmentPageVo> resultPage = baseClassMapper.selectJoinPage(page, CalssQuantitativeAssessmentPageVo.class, baseClassMPJLambdaWrapper);
|
|
|
+
|
|
|
+ //当前数据记录班级id
|
|
|
+ List<Long> classIdList = new ArrayList<>();
|
|
|
+ for(CalssQuantitativeAssessmentPageVo c: resultPage.getRecords()){
|
|
|
+ classIdList.add(Long.parseLong(c.getClassId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(classIdList.size() > 0){
|
|
|
+ //学生个人行为
|
|
|
+ List<QuantitativeAssessmentSingleScoreVo> individualBehaviorList = assessmentInspectionMapper.getIndividualBehaviorList(new QuantitativeAssessmentSingleScoreDto(){{
|
|
|
+ setClassIdList(classIdList);
|
|
|
+ }});
|
|
|
+ Map<Long , QuantitativeAssessmentSingleScoreVo> individualBehaviorMap = new HashMap<>();
|
|
|
+ for (QuantitativeAssessmentSingleScoreVo q : individualBehaviorList) {
|
|
|
+ individualBehaviorMap.put(q.getClassId(), q);
|
|
|
+ }
|
|
|
+
|
|
|
+ //常规管理
|
|
|
+ List<QuantitativeAssessmentSingleScoreVo> conventionalManagementList = assessmentInspectionMapper.getConventionalManagementList(new QuantitativeAssessmentSingleScoreDto(){{
|
|
|
+ setClassIdList(classIdList);
|
|
|
+ }});
|
|
|
+ Map<Long , QuantitativeAssessmentSingleScoreVo> conventionalManagementMap = new HashMap<>();
|
|
|
+ for (QuantitativeAssessmentSingleScoreVo q : conventionalManagementList) {
|
|
|
+ conventionalManagementMap.put(q.getClassId(), q);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获奖及荣誉奖彰
|
|
|
+ List<QuantitativeAssessmentSingleScoreVo> awardsAndHonorableList = assessmentInspectionMapper.getAwardsAndHonorList(new QuantitativeAssessmentSingleScoreDto(){{
|
|
|
+ setClassIdList(classIdList);
|
|
|
+ }});
|
|
|
+ Map<Long , QuantitativeAssessmentSingleScoreVo> awardsAndHonorableMap = new HashMap<>();
|
|
|
+ for (QuantitativeAssessmentSingleScoreVo q : awardsAndHonorableList) {
|
|
|
+ awardsAndHonorableMap.put(q.getClassId(), q);
|
|
|
+ }
|
|
|
+
|
|
|
+ //准军事化考核
|
|
|
+ List<QuantitativeAssessmentSingleScoreVo> paramilitaryList = assessmentInspectionMapper.getParamilitaryList(new QuantitativeAssessmentSingleScoreDto(){{
|
|
|
+ setClassIdList(classIdList);
|
|
|
+ }});
|
|
|
+ Map<Long , QuantitativeAssessmentSingleScoreVo> paramilitaryMap = new HashMap<>();
|
|
|
+ for (QuantitativeAssessmentSingleScoreVo q : paramilitaryList) {
|
|
|
+ awardsAndHonorableMap.put(q.getClassId(), q);
|
|
|
+ }
|
|
|
+
|
|
|
+ //将结果写进对应的班级里
|
|
|
+ for(CalssQuantitativeAssessmentPageVo c: resultPage.getRecords()){
|
|
|
+ Long classId = Long.parseLong(c.getClassId());
|
|
|
+ if(individualBehaviorMap.get(classId) != null){
|
|
|
+ c.setStuPersonalBehaviorSubScore(individualBehaviorMap.get(classId).getScore());
|
|
|
+ ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
|
|
|
+ String geRenXingWeiGongShi = "sumSubScore/itemCount";
|
|
|
+ /*int totalScore = scoreBySubmitRecordId.get(mobileResultPageVo.getEvaluateSubmitRecordId()).getTotalScore();
|
|
|
+ int itemCount = scoreBySubmitRecordId.get(mobileResultPageVo.getEvaluateSubmitRecordId()).getItemCount();
|
|
|
+ double res = 0;
|
|
|
+ String newStr1 = zonghezhishu.replace("totalScore", ""+totalScore);
|
|
|
+ String newStr2 = newStr1.replace("itemCount", ""+itemCount);
|
|
|
+ try{
|
|
|
+ res = Double.parseDouble(engine.eval(newStr2).toString());
|
|
|
+ }catch (ScriptException s){
|
|
|
+
|
|
|
+ }
|
|
|
+ // 创建一个DecimalFormat对象,指定小数位数为两位
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.00");
|
|
|
+ // 格式化double值为字符串
|
|
|
+ String formattedNumber = decimalFormat.format(res);*/
|
|
|
+ }
|
|
|
+
|
|
|
+ if(conventionalManagementMap.get(classId) != null){
|
|
|
+ c.setClassConventionalManageSubScore(conventionalManagementMap.get(classId).getScore());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(awardsAndHonorableMap.get(classId) != null){
|
|
|
+ c.setHonorSumScore(awardsAndHonorableMap.get(classId).getScore());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return resultPage;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public Boolean dataHandle(Long id) {
|
|
|
//获取考核记录
|
|
|
BaseStudentAssessmentInspection baseStudentAssessmentInspection = this.getById(id);
|
|
|
@@ -263,7 +346,7 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
}});
|
|
|
}
|
|
|
}
|
|
|
- //同步数据到考核关联班级表
|
|
|
+ //同步数据到考核关联学生表
|
|
|
if(baseStudentAssessmentInspection.getAssessmentType() != null
|
|
|
&& baseStudentAssessmentInspection.getAssessmentType().equals("personal")
|
|
|
&& baseStudentAssessmentInspection.getStudentUserIds() != null
|
|
|
@@ -271,11 +354,20 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
String[] studentIds = baseStudentAssessmentInspection.getStudentUserIds().split(",");
|
|
|
for (String studentId: studentIds) {
|
|
|
assessmentStudentRelationMapper.insert(new BaseStudentAssessmentStudentRelation(){{
|
|
|
- setClassId(Long.parseLong(studentId));
|
|
|
+ MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ baseStudentSchoolRollMPJLambdaWrapper
|
|
|
+ .select(BaseStudentSchoolRoll::getId)
|
|
|
+ .select(BaseStudentSchoolRoll.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentSchoolRoll.class).contains(x.getProperty()))
|
|
|
+ .eq(BaseStudentSchoolRoll::getUserId, studentId);
|
|
|
+ BaseStudentSchoolRoll baseStudentSchoolRoll = baseStudentSchoolRollMapper.selectOne(baseStudentSchoolRollMPJLambdaWrapper);
|
|
|
+ if(baseStudentSchoolRoll != null){
|
|
|
+ setClassId(baseStudentSchoolRoll.getClassId());
|
|
|
+ }
|
|
|
+ setUserId(Long.parseLong(studentId));
|
|
|
setBaseStudentAssessmentInspectionId(baseStudentAssessmentInspection.getId());
|
|
|
- QueryWrapper<BaseStudentAssessmentClassRelation> queryWrapperSortcode = new QueryWrapper<>();
|
|
|
+ QueryWrapper<BaseStudentAssessmentStudentRelation> queryWrapperSortcode = new QueryWrapper<>();
|
|
|
queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
|
|
|
- BaseStudentAssessmentClassRelation b = assessmentClassRelationMapper.selectOne(queryWrapperSortcode);
|
|
|
+ BaseStudentAssessmentStudentRelation b = assessmentStudentRelationMapper.selectOne(queryWrapperSortcode);
|
|
|
setSortCode(b.getSortCode() + 1);
|
|
|
}});
|
|
|
}
|