Jelajahi Sumber

功能完善

hlf 4 bulan lalu
induk
melakukan
d3634f5613

+ 4 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/dao/OrganizationEvaluationInfoMapper.java

@@ -1,8 +1,8 @@
 package com.ims.eval.dao;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ims.eval.config.permission.DataPermission;
 import com.ims.eval.entity.OrganizationEvaluationInfo;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
 import org.apache.ibatis.annotations.Param;
 
@@ -87,6 +87,9 @@ public interface OrganizationEvaluationInfoMapper extends BaseMapper<Organizatio
 																							  @Param("degreeYear") String degreeYear,
 																							  @Param("quarterlyMonth") String quarterlyMonth);
 
+	List<OrganizationEvaluationInfo> getIndicatorDictionaryList(@Param("organizationEvaluationId") String organizationEvaluationId,
+																@Param("indicatorId") String indicatorId);
+
 
 //	void updateEvaluationInfo(@Param("evaluationInfos")  List<OrganizationEvaluationInfo> evaluationInfos);
 

+ 48 - 29
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/IndicatorServiceImpl.java

@@ -159,6 +159,7 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
 			if (null == dto2.getChildCode() || "".equals(dto2.getChildCode().trim()) || null == dto2.getChildName() || "".equals(dto2.getChildName().trim())) {
 				throw new CustomException("子指标名或编码为空");
 			}
+			List<IndicatorDictionary> indicatorDictionaryList = new ArrayList<>();
 			for (IndicatorDictionary i : dto2.getList()) {
 
 				IndicatorDictionary indicatorDictionary = new IndicatorDictionary();
@@ -167,40 +168,58 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
 				String formula = decode.replaceAll(" ", "+");
 
 				QueryWrapper<IndicatorDictionary> qw = new QueryWrapper<>();
-				qw.lambda().eq(IndicatorDictionary::getIndicatorId, dto.getId());
-				qw.lambda().eq(IndicatorDictionary::getChildCode, dto2.getChildCode());
-				qw.lambda().eq(IndicatorDictionary::getOptionCode, i.getOptionCode());
-				qw.lambda().eq(IndicatorDictionary::getDelFlag, "1");
-				List<IndicatorDictionary> list2 = indicatorDictionaryMapper.selectList(qw);
-
-				if (null != list2 && list2.size() > 0) {
-					if (null == i.getId()) {
+				if (null == i.getId() || "".equals(i.getId().trim())) {
+					qw.lambda().eq(IndicatorDictionary::getIndicatorId, dto.getId());
+					qw.lambda().eq(IndicatorDictionary::getChildCode, dto2.getChildCode());
+					qw.lambda().eq(IndicatorDictionary::getOptionCode, i.getOptionCode());
+					qw.lambda().eq(IndicatorDictionary::getFormula, i.getFormula());
+					qw.lambda().eq(IndicatorDictionary::getDelFlag, "1");
+					List<IndicatorDictionary> list = indicatorDictionaryMapper.selectList(qw);
+					if (list.size() > 0) {
 						throw new CustomException("当前属性code已存在");
 					} else {
-						for (IndicatorDictionary idic : list2){
-							idic.setDelFlag("0");
-							indicatorDictionaryService.updateById(idic);
+						indicatorDictionary.setIndicatorId(dto.getId());
+						indicatorDictionary.setChildName(dto2.getChildName());
+						indicatorDictionary.setChildCode(dto2.getChildCode());
+						indicatorDictionary.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
+						indicatorDictionary.setOptionCode(i.getOptionCode());
+						indicatorDictionary.setOptionOrder(i.getOptionOrder());
+						indicatorDictionary.setCreateTime(new Date());
+						indicatorDictionary.setFormula(formula);
+						indicatorDictionary.setIsShow(i.getIsShow());
+						indicatorDictionary.setIsQuantified(i.getIsQuantified());
+						indicatorDictionary.setDelFlag("1");
+						indicatorDictionaryList.add(indicatorDictionary);
+					}
+				} else {
+					qw.lambda().eq(IndicatorDictionary::getId, i.getId());
+					qw.lambda().eq(IndicatorDictionary::getDelFlag, "1");
+					List<IndicatorDictionary> list = indicatorDictionaryMapper.selectList(qw);
+					if (list.size() > 0) {
+						for (IndicatorDictionary idic : list) {
+							if (i.getIndicatorId().equals(idic.getIndicatorId()) && (!dto2.getChildCode().equals(idic.getChildCode()) || !i.getOptionCode().equals(idic.getOptionCode()) || !i.getFormula().equals(idic.getFormula()))) {
+								idic.setDelFlag("0");
+								indicatorDictionaryService.updateById(idic);
+								indicatorDictionary.setIndicatorId(dto.getId());
+								indicatorDictionary.setChildName(dto2.getChildName());
+								indicatorDictionary.setChildCode(dto2.getChildCode());
+								indicatorDictionary.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
+								indicatorDictionary.setOptionCode(i.getOptionCode());
+								indicatorDictionary.setOptionOrder(i.getOptionOrder());
+								indicatorDictionary.setCreateTime(new Date());
+								indicatorDictionary.setFormula(formula);
+								indicatorDictionary.setIsShow(i.getIsShow());
+								indicatorDictionary.setIsQuantified(i.getIsQuantified());
+								indicatorDictionary.setDelFlag("1");
+								indicatorDictionaryList.add(indicatorDictionary);
+							}
 						}
 					}
 				}
-
-				indicatorDictionary.setIndicatorId(dto.getId());
-				indicatorDictionary.setChildName(dto2.getChildName());
-				indicatorDictionary.setChildCode(dto2.getChildCode());
-				indicatorDictionary.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
-				indicatorDictionary.setOptionCode(i.getOptionCode());
-				indicatorDictionary.setOptionOrder(i.getOptionOrder());
-				indicatorDictionary.setDes(i.getDes());
-				indicatorDictionary.setCreateTime(new Date());
-				indicatorDictionary.setFormula(formula);
-				indicatorDictionary.setIsShow(i.getIsShow());
-				indicatorDictionary.setIsQuantified(i.getIsQuantified());
-				indicatorDictionary.setDelFlag("1");
-
-				b = indicatorDictionaryService.save(indicatorDictionary);
-				if (!b) {
-					throw new CustomException("指标明细存失败");
-				}
+			}
+			b = indicatorDictionaryService.saveBatch(indicatorDictionaryList);
+			if (!b) {
+				throw new CustomException("指标明细存失败");
 			}
 		}
 		return b;

+ 7 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationInfoServiceImpl.java

@@ -494,7 +494,13 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 
 		boolean titlemark = true;//标记生成标题
 		List<OrganizationEvaluationInfoResDTO> infoResDTOList = baseMapper.selectEvaluationInfoList(organizationEvaluationId, organizationShortName, indicatorId, binSection, binStage, "");
-		List<IndicatorDictionary> dictionaryList = indicatorDictionaryService.list("", indicatorId, "", "");
+		List<OrganizationEvaluationInfo> indicatorDictionaryIdList = baseMapper.getIndicatorDictionaryList(organizationEvaluationId, indicatorId);
+		List<IndicatorDictionary> dictionaryList = new ArrayList<>();
+		for (OrganizationEvaluationInfo oei : indicatorDictionaryIdList) {
+			IndicatorDictionary idic = indicatorDictionaryService.getById(oei.getIndicatorDictionaryId());
+			dictionaryList.add(idic);
+		}
+		//List<IndicatorDictionary> dictionaryList = indicatorDictionaryService.list("", indicatorId, "", "");
 		List<IndicatorDictionary> dictionaryList2 = dictionaryList.stream().filter(dl -> !"1642801934302707714".equals(dl.getIndicatorId()) || !"CZMAX".equals(dl.getOptionCode()) && !"CZMIN".equals(dl.getOptionCode())).collect(Collectors.toList());
 		Indicator indicator = indicatorService.getById(indicatorId);
 		//根据组织(公司)id分组

+ 8 - 0
ims-service/ims-eval/src/main/resources/mappers/OrganizationEvaluationInfoMapper.xml

@@ -437,5 +437,13 @@
         order by oei.organization_id asc
     </select>
 
+    <select id="getIndicatorDictionaryList" resultType="com.ims.eval.entity.OrganizationEvaluationInfo">
+        SELECT DISTINCT oei.indicator_dictionary_id,
+        idc.option_order
+        FROM organization_evaluation_info oei
+        LEFT JOIN indicator_dictionary idc ON idc.ID = oei.indicator_dictionary_id
+        WHERE oei.organization_evaluation_id = #{organizationEvaluationId} AND oei.indicator_id = #{indicatorId}
+        ORDER BY idc.option_order ASC
+    </select>
 
 </mapper>