|
@@ -1,6 +1,9 @@
|
|
|
package com.ims.eval.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.ims.common.utils.StringUtils;
|
|
|
import com.ims.eval.config.CustomException;
|
|
|
+import com.ims.eval.entity.IndicatorDictionary;
|
|
|
import com.ims.eval.entity.OrganizationEvaluationInfo;
|
|
|
import com.ims.eval.dao.OrganizationEvaluationInfoMapper;
|
|
|
import com.ims.eval.entity.ResponsibilityIndicatorInfo;
|
|
@@ -9,6 +12,7 @@ import com.ims.eval.entity.dto.request.ResponsibilityIndicatorInfoUpdateDTO;
|
|
|
import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
|
|
|
import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
|
|
|
import com.ims.eval.service.ICalculateIndicatorItemInfoService;
|
|
|
+import com.ims.eval.service.IIndicatorDictionaryService;
|
|
|
import com.ims.eval.service.IOrganizationEvaluationInfoService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -37,6 +41,10 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
@Autowired
|
|
|
private ICalculateIndicatorItemInfoService iCalculateIndicatorItemInfoService;
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IIndicatorDictionaryService indicatorDictionaryService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map finishValueList(String organizationEvaluationId, String dept) {
|
|
|
|
|
@@ -50,25 +58,55 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean saveBatchDto(List<OrganizationEvaluationInfoUpdateDTO> evaluationInfoUpdateDTOS) throws Exception {
|
|
|
- for (OrganizationEvaluationInfoUpdateDTO entity : evaluationInfoUpdateDTOS) {
|
|
|
- OrganizationEvaluationInfo organizationEvaluationInfo = baseMapper.selectById(entity.getId());
|
|
|
-
|
|
|
- organizationEvaluationInfo.setQuantifiedValue(entity.getQuantifiedValue());//量化值
|
|
|
- organizationEvaluationInfo.setNonQuantifiedValue(entity.getNonQuantifiedValue());//非量化值
|
|
|
- organizationEvaluationInfo.setUpdateTime(new Date());//更新时间
|
|
|
- organizationEvaluationInfo.setUpdateBy(entity.getUpdateBy());//更新者
|
|
|
- organizationEvaluationInfo.setRemark(entity.getRemark());//备注
|
|
|
-
|
|
|
- boolean b = super.saveOrUpdate(organizationEvaluationInfo);
|
|
|
- if(!b){
|
|
|
- throw new CustomException("更新失败");
|
|
|
+ public boolean saveBatchDto(List<OrganizationEvaluationInfo> organizationEvaluationInfoList) throws Exception {
|
|
|
+ for (OrganizationEvaluationInfo entity : organizationEvaluationInfoList) {
|
|
|
+
|
|
|
+ if (null != entity && null != entity.getId() && !"".equals(entity.getId().trim())) {
|
|
|
+ OrganizationEvaluationInfo info = baseMapper.selectById(entity.getId());
|
|
|
+ info.setQuantifiedValue(entity.getQuantifiedValue());//量化值
|
|
|
+ info.setNonQuantifiedValue(entity.getNonQuantifiedValue());//非量化值
|
|
|
+ info.setUpdateTime(new Date());//更新时间
|
|
|
+ info.setUpdateBy(entity.getUpdateBy());//更新者
|
|
|
+ info.setRemark(entity.getRemark());//备注
|
|
|
+ info.setState(entity.getState());//初始状态
|
|
|
+ boolean b = super.saveOrUpdate(info);
|
|
|
+ if(!b){
|
|
|
+ throw new CustomException("更新失败");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ entity.setCreateTime(new Date());
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(entity.getIndicatorId())) {
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ List<IndicatorDictionary> dictionaryList = indicatorDictionaryService.list("",entity.getIndicatorId(),"","");
|
|
|
+ for(IndicatorDictionary d : dictionaryList){
|
|
|
+
|
|
|
+ OrganizationEvaluationInfo addinfo = new OrganizationEvaluationInfo();
|
|
|
+ addinfo.setOrganizationEvaluationId(entity.getOrganizationEvaluationId());
|
|
|
+ addinfo.setOrganizationEvaluationRuleId(entity.getOrganizationEvaluationRuleId());
|
|
|
+ addinfo.setIndicatorId(entity.getIndicatorId());
|
|
|
+ addinfo.setIndicatorDictionaryId(d.getId());
|
|
|
+ addinfo.setOptionCode(d.getOptionCode());
|
|
|
+ addinfo.setIsQuantified(entity.getIsQuantified());
|
|
|
+ addinfo.setQuantifiedValue(entity.getQuantifiedValue());
|
|
|
+ addinfo.setNonQuantifiedValue(entity.getNonQuantifiedValue());
|
|
|
+ addinfo.setState("-1");//初始状态
|
|
|
+ addinfo.setCreateTime(new Date());
|
|
|
+
|
|
|
+ boolean b = super.saveOrUpdate(addinfo);
|
|
|
+ if(!b){
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- OrganizationEvaluationInfo organizationEvaluationInfo = baseMapper.selectById(evaluationInfoUpdateDTOS.get(0).getId());
|
|
|
+// OrganizationEvaluationInfo organizationEvaluationInfo = baseMapper.selectById(organizationEvaluationInfoList.get(0).getId());
|
|
|
//查询本次考评所有考评指标明细
|
|
|
- List<OrganizationEvaluationInfo> organizationEvaluationInfos = baseMapper.selectByEvaluationInfoId(organizationEvaluationInfo.getOrganizationEvaluationId());
|
|
|
+ List<OrganizationEvaluationInfo> organizationEvaluationInfos = baseMapper.selectByEvaluationInfoId(organizationEvaluationInfoList.get(0).getOrganizationEvaluationId());
|
|
|
|
|
|
//调用需要计算指标项的方法
|
|
|
boolean calculate = calculateIdicatorItem(organizationEvaluationInfos);
|
|
@@ -123,7 +161,12 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
double wczValue = lrgxl.get(0).getQuantifiedValue();
|
|
|
double dbzvalue = zjrl.get(0).getQuantifiedValue();
|
|
|
if (dbzvalue == 0 || dbzvalue == 0.0){
|
|
|
- throw new CustomException("被除数不能为零");
|
|
|
+ dwqwlr.get(0).setQuantifiedValue(0);
|
|
|
+ dwqwlr.get(0).setCreateTime(new Date());
|
|
|
+ boolean b = super.saveOrUpdate(dwqwlr.get(0));
|
|
|
+ if(!b){
|
|
|
+ throw new CustomException("更新失败");
|
|
|
+ }
|
|
|
}else{
|
|
|
//double保留两位小数
|
|
|
double v = new BigDecimal(wczValue / dbzvalue).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|