Sfoglia il codice sorgente

考评规则优化

全业务考评 9 mesi fa
parent
commit
ca952b6b7c

+ 2 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/controller/EvaluateRuleInfoController.java

@@ -84,7 +84,8 @@ public class EvaluateRuleInfoController {
 	@ApiOperation(value = "删除", notes = "删除")
 	public R deleteAll(@PathVariable("ids") String ids) {
 		String[] strings = ids.split(",");
-		boolean b = evaluateRuleInfoService.removeByIds(Arrays.asList(strings));
+//		boolean b = evaluateRuleInfoService.removeByIds(Arrays.asList(strings));
+		boolean b = evaluateRuleInfoService.updateDeleteTime(Arrays.asList(strings));
 		if (b) {
 			return R.ok().data(b);
 		} else {

+ 7 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/EvaluateRuleInfo.java

@@ -1,5 +1,6 @@
 package com.ims.eval.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.util.Date;
@@ -89,4 +90,10 @@ public class EvaluateRuleInfo extends Model {
 	private Double maxScore;
 
 	private Double standardScore;
+
+	/**
+	 * 删除时间
+	 */
+	@TableField(updateStrategy = FieldStrategy.IGNORED, insertStrategy = FieldStrategy.IGNORED)
+	private Date deleteTime;
 }

+ 2 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IEvaluateRuleInfoService.java

@@ -24,4 +24,6 @@ public interface IEvaluateRuleInfoService extends IService<EvaluateRuleInfo> {
 
 	List<EvaluateRuleInfoIndicatorDTO> listByIndicatorInfo(List<String> ruleInfoIds);
 
+	boolean updateDeleteTime(List<String> ids);
+
 }

+ 35 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateRuleInfoServiceImpl.java

@@ -52,6 +52,25 @@ public class EvaluateRuleInfoServiceImpl extends ServiceImpl<EvaluateRuleInfoMap
 
 
 	@Override
+	public boolean updateDeleteTime(List<String> ids) {
+		int i = 0;
+		for (String id : ids) {
+			EvaluateRuleInfo info = baseMapper.selectById(id);
+			if (null != info) {
+				info.setDeleteTime(new Date());
+				i = baseMapper.updateById(info);
+
+				if (i == 0) {
+					return false;
+				}
+			}
+		}
+
+		return true;
+	}
+
+
+	@Override
 	public boolean saveOrUpdate(EvaluateRuleInfo entity) {
 
 		if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
@@ -59,8 +78,23 @@ public class EvaluateRuleInfoServiceImpl extends ServiceImpl<EvaluateRuleInfoMap
 			qw.lambda().eq(EvaluateRuleInfo::getEvaluateRuleId, entity.getEvaluateRuleId());
 			qw.lambda().eq(EvaluateRuleInfo::getIndicatorId, entity.getIndicatorId());
 			List<EvaluateRuleInfo> list = baseMapper.selectList(qw);
+
 			if (null != list && list.size() > 0) {
-				throw new CustomException("该指标已存在");
+				for(EvaluateRuleInfo upinfo:list){
+					if(null != upinfo.getDeleteTime()){
+						upinfo.setDeleteTime(null);
+						int i =  baseMapper.updateById(upinfo);
+						if(i<=0){
+							return false;
+						}else {
+							return true;
+						}
+					}else {
+						throw new CustomException("该指标已存在");
+					}
+
+
+				}
 			}
 			entity.setCreateTime(new Date());
 		} else {

+ 3 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/IndicatorServiceImpl.java

@@ -105,6 +105,9 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
 
 	@Override
 	public List<Indicator> listAll(String id, String indicatorName, String indicatorCode, String binSection, String binStage, String dept, String company,String evaluationCycle) {
+
+
+		evaluationCycle = evaluationCycle.replaceAll("ALL","");
 		List<Indicator> list = baseMapper.seleclistAll(id, indicatorName, indicatorCode, binSection, binStage, dept, company,evaluationCycle);
 		return list;
 	}

+ 3 - 0
ims-service/ims-eval/src/main/resources/mappers/EvaluateRuleInfoMapper.xml

@@ -34,6 +34,7 @@
         LEFT JOIN evaluate_rule r ON ri.evaluate_rule_id = r.ID
         LEFT JOIN indicator i on ri.indicator_id = i.id
         <where>
+            and  delete_time is  null
             <if test="id !=null and id !=''">
                 AND ri.id = #{id}
             </if>
@@ -54,6 +55,7 @@
             </if>
 
 
+
         </where>
 
         order by ri.order_num asc
@@ -75,6 +77,7 @@
         LEFT JOIN INDICATOR i on i.id = ri.indicator_id
         LEFT JOIN indicator_dictionary d ON i.ID = d.indicator_id
         <where>
+            AND ri.delete_time is null
             AND ri.id in
             <foreach item="item" collection="ruleInfoIds" separator="," open="(" close=")" index="">'${item}'</foreach>
         </where>

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

@@ -268,7 +268,7 @@
     <select id="selectEvaluationIndicatorList" resultType="java.util.Map">
 
         select  DISTINCT i.id,i.indicator_name,ri.order_num from organization_evaluation_info   ei
-        LEFT JOIN evaluate_rule_info ri on ei.evaluate_rule_info_id = ri.id
+            LEFT JOIN evaluate_rule_info ri on ei.evaluate_rule_info_id = ri.id
         LEFT JOIN evaluate_rule er on er.id = ri.evaluate_rule_id
         INNER JOIN indicator i on i.id = ri.indicator_id
         <where>