|
|
@ -1,5 +1,7 @@
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@ -9,6 +11,7 @@ import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
import com.ibeetl.jlw.dao.HandsOnAchievementDao;
|
|
|
|
import com.ibeetl.jlw.dao.HandsOnAchievementDao;
|
|
|
|
import com.ibeetl.jlw.entity.HandsOnAchievement;
|
|
|
|
import com.ibeetl.jlw.entity.HandsOnAchievement;
|
|
|
|
|
|
|
|
import com.ibeetl.jlw.enums.HandsOnTaskEnum;
|
|
|
|
import com.ibeetl.jlw.web.query.HandsOnAchievementQuery;
|
|
|
|
import com.ibeetl.jlw.web.query.HandsOnAchievementQuery;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
@ -17,7 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
@ -30,7 +35,8 @@ import java.util.Map;
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public class HandsOnAchievementService extends CoreBaseService<HandsOnAchievement> {
|
|
|
|
public class HandsOnAchievementService extends CoreBaseService<HandsOnAchievement> {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired private HandsOnAchievementDao handsOnAchievementDao;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private HandsOnAchievementDao handsOnAchievementDao;
|
|
|
|
|
|
|
|
|
|
|
|
public PageQuery<HandsOnAchievement> queryByCondition(PageQuery query) {
|
|
|
|
public PageQuery<HandsOnAchievement> queryByCondition(PageQuery query) {
|
|
|
|
PageQuery ret = handsOnAchievementDao.queryByCondition(query);
|
|
|
|
PageQuery ret = handsOnAchievementDao.queryByCondition(query);
|
|
|
@ -71,7 +77,8 @@ public class HandsOnAchievementService extends CoreBaseService<HandsOnAchievemen
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
handsOnAchievementList.add(JSONObject.parseObject(handsOnAchievementQuery.getHandsOnAchievementJsonStr(), HandsOnAchievement.class));
|
|
|
|
handsOnAchievementList.add(JSONObject.parseObject(handsOnAchievementQuery.getHandsOnAchievementJsonStr(), HandsOnAchievement.class));
|
|
|
|
} catch (Exception e1) {}
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ToolUtils.deleteNullList(handsOnAchievementList);
|
|
|
|
ToolUtils.deleteNullList(handsOnAchievementList);
|
|
|
|
if (null != handsOnAchievementList && handsOnAchievementList.size() > 0) {
|
|
|
|
if (null != handsOnAchievementList && handsOnAchievementList.size() > 0) {
|
|
|
@ -152,6 +159,69 @@ public class HandsOnAchievementService extends CoreBaseService<HandsOnAchievemen
|
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String, Object>> getExcelValues(HandsOnAchievementQuery handsOnAchievementQuery) {
|
|
|
|
public List<Map<String, Object>> getExcelValues(HandsOnAchievementQuery handsOnAchievementQuery) {
|
|
|
|
return handsOnAchievementDao.getExcelValues(handsOnAchievementQuery);
|
|
|
|
return handsOnAchievementDao.getExcelValues(handsOnAchievementQuery);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setHandsOnAchievement(HandsOnAchievement handsOnAchievement, HandsOnTaskEnum handsOnTaskEnum) {
|
|
|
|
|
|
|
|
if (handsOnAchievement.getStudentId() == null || handsOnAchievement.getHandOnId() == null || handsOnAchievement.getClassId() == null || handsOnTaskEnum == null) {
|
|
|
|
|
|
|
|
throw new PlatformException("参数不完整");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<HandsOnAchievement> res = handsOnAchievementDao.createLambdaQuery()
|
|
|
|
|
|
|
|
.andEq(HandsOnAchievement::getStudentId, handsOnAchievement.getStudentId())
|
|
|
|
|
|
|
|
.andEq(HandsOnAchievement::getClassId, handsOnAchievement.getClassId())
|
|
|
|
|
|
|
|
.andEq(HandsOnAchievement::getHandOnId, handsOnAchievement.getHandOnId())
|
|
|
|
|
|
|
|
.andEq(HandsOnAchievement::getHandOnAchievementStatus, 1).select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(res)) {
|
|
|
|
|
|
|
|
handsOnAchievement.setAddTime(new Date());
|
|
|
|
|
|
|
|
handsOnAchievement.setHandOnAchievementStatus(1);
|
|
|
|
|
|
|
|
handsOnAchievement.setTotalScore(calTotalScore(handsOnAchievement).toPlainString());
|
|
|
|
|
|
|
|
handsOnAchievementDao.insert(handsOnAchievement);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
HandsOnAchievement last = res.get(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (handsOnTaskEnum) {
|
|
|
|
|
|
|
|
case TASK_PPT:
|
|
|
|
|
|
|
|
last.setPptScore(handsOnAchievement.getPptScore());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case TASK_VIDEO:
|
|
|
|
|
|
|
|
last.setVideoScore(handsOnAchievement.getVideoScore());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case TASK_THEORY:
|
|
|
|
|
|
|
|
last.setTheoryScore(handsOnAchievement.getTheoryScore());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case TASK_REPORT_WRITING:
|
|
|
|
|
|
|
|
last.setReportWritingScore(handsOnAchievement.getReportWritingScore());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case TASK_PRACTICAL_TRAINING:
|
|
|
|
|
|
|
|
last.setPracticalTrainingScore(handsOnAchievement.getPracticalTrainingScore());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
last.setTotalScore(calTotalScore(last).toPlainString());
|
|
|
|
|
|
|
|
handsOnAchievementDao.updateTemplateById(last);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BigDecimal calTotalScore(HandsOnAchievement handsOnAchievement) {
|
|
|
|
|
|
|
|
if (handsOnAchievement == null) {
|
|
|
|
|
|
|
|
throw new PlatformException("参数不完整");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BigDecimal pptScore = new BigDecimal(ObjectUtil.defaultIfNull(handsOnAchievement.getPptScore(), "0"));
|
|
|
|
|
|
|
|
BigDecimal theoryScore = new BigDecimal(ObjectUtil.defaultIfNull(handsOnAchievement.getTheoryScore(), "0"));
|
|
|
|
|
|
|
|
BigDecimal videoScore = new BigDecimal(ObjectUtil.defaultIfNull(handsOnAchievement.getVideoScore(), "0"));
|
|
|
|
|
|
|
|
BigDecimal reportWritingScore = new BigDecimal(ObjectUtil.defaultIfNull(handsOnAchievement.getReportWritingScore(), "0"));
|
|
|
|
|
|
|
|
BigDecimal practicalTrainingScore = new BigDecimal(ObjectUtil.defaultIfNull(handsOnAchievement.getPracticalTrainingScore(), "0"));
|
|
|
|
|
|
|
|
return pptScore.add(theoryScore).add(videoScore).add(reportWritingScore).add(practicalTrainingScore);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|