|
@@ -9,8 +9,13 @@ import com.template.annotation.PassToken;
|
|
|
import com.template.api.SmartEvaluateTeacherControllerAPI;
|
|
import com.template.api.SmartEvaluateTeacherControllerAPI;
|
|
|
import com.template.common.utils.ExcelUtils;
|
|
import com.template.common.utils.ExcelUtils;
|
|
|
import com.template.common.utils.UUIDUtil;
|
|
import com.template.common.utils.UUIDUtil;
|
|
|
|
|
+import com.template.common.utils.paramUtils;
|
|
|
import com.template.model.evaluate.teacher.*;
|
|
import com.template.model.evaluate.teacher.*;
|
|
|
|
|
+import com.template.model.pojo.SmartScore;
|
|
|
import com.template.model.pojo.SmartSemester;
|
|
import com.template.model.pojo.SmartSemester;
|
|
|
|
|
+import com.template.model.request.addChildScoreManageRequest;
|
|
|
|
|
+import com.template.model.request.addScoreManageRequest;
|
|
|
|
|
+import com.template.model.request.updateScoreManageRequest;
|
|
|
import com.template.model.result.CommonResult;
|
|
import com.template.model.result.CommonResult;
|
|
|
import com.template.model.result.PageUtils;
|
|
import com.template.model.result.PageUtils;
|
|
|
import com.template.model.vo.EvaluateTeacherVo;
|
|
import com.template.model.vo.EvaluateTeacherVo;
|
|
@@ -25,6 +30,7 @@ import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -48,6 +54,133 @@ public class SmartEvaluateTeacherController implements SmartEvaluateTeacherContr
|
|
|
SmartSemesterService smartSemesterService;
|
|
SmartSemesterService smartSemesterService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public CommonResult addScoreManage(addScoreManageRequest asmr, BindingResult bindingResult) {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ String st = paramUtils.getParamError(bindingResult);
|
|
|
|
|
+ return CommonResult.fail(st);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SmartSemester semester = smartSemesterService.getSmartById(asmr.getTermId());
|
|
|
|
|
+ if (semester == null) {
|
|
|
|
|
+ return CommonResult.fail("学期数据为空,添加评分项失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<SmartScoreManage> ssm = smartScoreManageService.queryDatasByTermId(asmr.getTermId());
|
|
|
|
|
+ if (ssm != null && ssm.size() > 0) {
|
|
|
|
|
+ long exist = ssm.stream().filter(e -> e.getParentId().intValue() == 0 && e.getScoreItem().equals(asmr.getScoreItem())).count();
|
|
|
|
|
+ if (exist > 0) {
|
|
|
|
|
+ return CommonResult.fail("存在重复主项");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SmartScoreManage parentData = new SmartScoreManage();
|
|
|
|
|
+ parentData.setTermId(asmr.getTermId());
|
|
|
|
|
+ parentData.setTerm(semester.getName());
|
|
|
|
|
+ parentData.setScoreItem(asmr.getScoreItem());
|
|
|
|
|
+ parentData.setParentId(0);
|
|
|
|
|
+ parentData.setScoreNum(asmr.getScoreNum());
|
|
|
|
|
+ int insertResult = smartScoreManageService.insertSmartScoreManage(parentData);
|
|
|
|
|
+ if (insertResult <= 0) {
|
|
|
|
|
+ return CommonResult.fail("添加项失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ SmartScoreManage childData = new SmartScoreManage();
|
|
|
|
|
+ childData.setTermId(asmr.getTermId());
|
|
|
|
|
+ childData.setTerm(semester.getName());
|
|
|
|
|
+ childData.setScoreItem(asmr.getScoreChildItem());
|
|
|
|
|
+ childData.setParentId(insertResult);
|
|
|
|
|
+ childData.setScoreNum(asmr.getScoreNum());
|
|
|
|
|
+ int insertChildResult = smartScoreManageService.insertSmartScoreManage(childData);
|
|
|
|
|
+ if (insertChildResult <= 0) {
|
|
|
|
|
+ return CommonResult.fail("添加子项失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ return CommonResult.ok("添加成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public CommonResult addChildScoreManage(addChildScoreManageRequest acsmr, BindingResult bindingResult) {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ String st = paramUtils.getParamError(bindingResult);
|
|
|
|
|
+ return CommonResult.fail(st);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SmartSemester semester = smartSemesterService.getSmartById(acsmr.getTermId());
|
|
|
|
|
+ if (semester == null) {
|
|
|
|
|
+ return CommonResult.fail("学期数据为空,添加评分项失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //根据父级ID获取父级下所有子级数据
|
|
|
|
|
+ List<SmartScoreManage> childDatas = smartScoreManageService.queryDatasByParentId(acsmr.getId());
|
|
|
|
|
+ if(childDatas != null && childDatas.size() > 0){
|
|
|
|
|
+ long exist = childDatas.stream().filter(e -> e.getScoreItem().equals(acsmr.getScoreItem())).count();
|
|
|
|
|
+ if(exist > 0){
|
|
|
|
|
+ return CommonResult.fail("存在重复子项");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SmartScoreManage parentData = new SmartScoreManage();
|
|
|
|
|
+ parentData.setTermId(acsmr.getTermId());
|
|
|
|
|
+ parentData.setTerm(semester.getName());
|
|
|
|
|
+ parentData.setScoreItem(acsmr.getScoreItem());
|
|
|
|
|
+ parentData.setParentId(acsmr.getId());
|
|
|
|
|
+ parentData.setScoreNum(acsmr.getScoreNum());
|
|
|
|
|
+ int insertResult = smartScoreManageService.insertSmartScoreManage(parentData);
|
|
|
|
|
+ if (insertResult <= 0) {
|
|
|
|
|
+ return CommonResult.fail("添加子项失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.ok("添加成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public CommonResult updateScoreManage(updateScoreManageRequest usmr, BindingResult bindingResult) {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ String st = paramUtils.getParamError(bindingResult);
|
|
|
|
|
+ return CommonResult.fail(st);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SmartScoreManage data = smartScoreManageService.getSmartScoreManageById(usmr.getId());
|
|
|
|
|
+ if(data == null){
|
|
|
|
|
+ return CommonResult.fail("数据已失效,编辑失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //根据父级ID获取父级下所有子级数据
|
|
|
|
|
+ List<SmartScoreManage> childDatas = smartScoreManageService.queryDatasByParentId(data.getParentId());
|
|
|
|
|
+ if(childDatas != null && childDatas.size() > 0){
|
|
|
|
|
+ long exist = childDatas.stream().filter(e -> e.getScoreItem().equals(usmr.getScoreItem()) && e.getId().intValue() != usmr.getId().intValue()).count();
|
|
|
|
|
+ if(exist > 0){
|
|
|
|
|
+ return CommonResult.fail("存在重复子项");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ data.setScoreItem(usmr.getScoreItem());
|
|
|
|
|
+ data.setScoreNum(usmr.getScoreNum());
|
|
|
|
|
+
|
|
|
|
|
+ int updateData = smartScoreManageService.updateSmartScoreManage(data);
|
|
|
|
|
+ if(updateData <= 0){
|
|
|
|
|
+ return CommonResult.fail("编辑失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.ok("编辑成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public CommonResult deleteScoreManage(int id) {
|
|
|
|
|
+ SmartScoreManage data = smartScoreManageService.getSmartScoreManageById(id);
|
|
|
|
|
+ if(data == null){
|
|
|
|
|
+ return CommonResult.fail("数据已失效,删除失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ int result = smartScoreManageService.deleteSmartScoreManageById(id);
|
|
|
|
|
+ if(result <= 0){
|
|
|
|
|
+ return CommonResult.fail("删除失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.ok("删除成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@PassToken
|
|
@PassToken
|
|
|
public CommonResult operateSmartScoreManage(JSONObject jsonObject) {
|
|
public CommonResult operateSmartScoreManage(JSONObject jsonObject) {
|
|
|
SimpleScore simpleScoreLists = null;
|
|
SimpleScore simpleScoreLists = null;
|
|
@@ -237,13 +370,13 @@ public class SmartEvaluateTeacherController implements SmartEvaluateTeacherContr
|
|
|
List<SmartEvaluateTdetail> updateDetails = new ArrayList<>();
|
|
List<SmartEvaluateTdetail> updateDetails = new ArrayList<>();
|
|
|
//查找明细smart_evaluate_tdetail
|
|
//查找明细smart_evaluate_tdetail
|
|
|
List<SmartEvaluateTdetail> tdetails = smartEvaluateTdetailService.queryTdetailsByTermUserId(teacher.getTermId(), teacher.getUserId());
|
|
List<SmartEvaluateTdetail> tdetails = smartEvaluateTdetailService.queryTdetailsByTermUserId(teacher.getTermId(), teacher.getUserId());
|
|
|
- for (SmartEvaluateTdetailList ssl:simpleEvaluateScore.getSimpleScoreList()) {
|
|
|
|
|
- for (SmartEvaluateTdetailList sc:ssl.getEvaluateList()) {
|
|
|
|
|
|
|
+ for (SmartEvaluateTdetailList ssl : simpleEvaluateScore.getSimpleScoreList()) {
|
|
|
|
|
+ for (SmartEvaluateTdetailList sc : ssl.getEvaluateList()) {
|
|
|
Optional<SmartEvaluateTdetail> oStdetail = tdetails.stream().filter(e -> e.getScoreManageId().equals(sc.getId())).findFirst();
|
|
Optional<SmartEvaluateTdetail> oStdetail = tdetails.stream().filter(e -> e.getScoreManageId().equals(sc.getId())).findFirst();
|
|
|
- if(oStdetail != null && oStdetail.isPresent()){
|
|
|
|
|
|
|
+ if (oStdetail != null && oStdetail.isPresent()) {
|
|
|
oStdetail.get().setOwnNum(sc.getOwnNum());
|
|
oStdetail.get().setOwnNum(sc.getOwnNum());
|
|
|
updateDetails.add(oStdetail.get());
|
|
updateDetails.add(oStdetail.get());
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
SmartEvaluateTdetail nDetail = new SmartEvaluateTdetail();
|
|
SmartEvaluateTdetail nDetail = new SmartEvaluateTdetail();
|
|
|
nDetail.setScoreManageId(sc.getId());
|
|
nDetail.setScoreManageId(sc.getId());
|
|
|
nDetail.setTermId(teacher.getTermId());
|
|
nDetail.setTermId(teacher.getTermId());
|
|
@@ -262,16 +395,16 @@ public class SmartEvaluateTeacherController implements SmartEvaluateTeacherContr
|
|
|
throw new Exception("教师评分数据更新失败!");
|
|
throw new Exception("教师评分数据更新失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(newDetails != null && newDetails.size() > 0){
|
|
|
|
|
|
|
+ if (newDetails != null && newDetails.size() > 0) {
|
|
|
boolean insertDetail = smartEvaluateTdetailService.saveBatch(newDetails);
|
|
boolean insertDetail = smartEvaluateTdetailService.saveBatch(newDetails);
|
|
|
- if(!insertDetail){
|
|
|
|
|
|
|
+ if (!insertDetail) {
|
|
|
return CommonResult.fail("评价明细数据添加失败");
|
|
return CommonResult.fail("评价明细数据添加失败");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(updateDetails != null && updateDetails.size() > 0){
|
|
|
|
|
|
|
+ if (updateDetails != null && updateDetails.size() > 0) {
|
|
|
boolean updateDetail = smartEvaluateTdetailService.updateBatchById(updateDetails);
|
|
boolean updateDetail = smartEvaluateTdetailService.updateBatchById(updateDetails);
|
|
|
- if(!updateDetail){
|
|
|
|
|
|
|
+ if (!updateDetail) {
|
|
|
return CommonResult.fail("评价明细数据更新失败");
|
|
return CommonResult.fail("评价明细数据更新失败");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|