Commit 092bfafa by dengwei

1.多合一指标 2.指标管理增加指标权重维护功能 3.单位积分规则增加多层权重

parent 9c40d807
......@@ -214,4 +214,11 @@ public class IndicatorsDefCtrl {
return value;
}
@ApiOperation("根据id获取考核指标")
@GetMapping("getIndById")
public DriveIndDef getIndById(@ApiParam("indId") @RequestParam("indId")String indId) {
LogManager.logInfo(Constants.LOG_INDICATOR_DRIVE_INDI_API,"根据id获取考核指标,id:{}", indId);
return driveIndDefService.getIndById(indId, true);
}
}
......@@ -45,6 +45,10 @@ public class TaskRuleIndicator extends BaseModel {
@ApiModelProperty("指标单位")
private String indUnit;
/**
* 父指标id
*/
@ApiModelProperty("父指标id")
private String parentIndId;
}
package com.keymobile.indicators.model.entity.indicators;
import java.util.Date;
import java.util.List;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator;
import lombok.Data;
/**
......@@ -44,4 +47,16 @@ public class DriveIndDef {
private Integer indNum;//指标序号 - 2021/8/17 hzc
private String checkType;//考核类型- 2021/8/17 hzc
private String formulaInfo;
private String isMoreThanOneIndicators; //是否多合一指标 是:1 否:0 - 2023年1月31日11:07:59 邓威
@Transient
private List<TaskRuleIndicator> indicators; // 组内指标 - 2023年1月31日11:07:59 邓威
// 2023年2月1日15:18:33 邓威 -- 新增字段
private String twoSmokeArea; // 类别权重:两烟区
private String netSalesArea; // 类别权重:纯销区
private String comprehensiveEvaluation; // 指标权重:综合评价
private String improve; // 指标权重:改善提升
}
......@@ -20,6 +20,18 @@ public interface TaskRuleIndicatorMapper extends BaseMapper<TaskRuleIndicator> {
void deleteByRuleId(Integer ruleId);
/**
* 根据父指标id获取关联数据项
* @param parentIndId 父指标id
* @return 关联数据项
*/
List<TaskRuleIndicator> getByParentIndId(String parentIndId);
/**
* 根据父指标id删除关联数据项
* @param parentIndId 父指标id
*/
void deleteByParentIndId(String parentIndId);
/**
* 关联指标表查询出对应的指标信息
......
......@@ -10,8 +10,12 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.dataenter.TaskRule;
import com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator;
import com.keymobile.indicators.model.entity.indicators.DriveIndCatalog;
import com.keymobile.indicators.model.mapper.indicators.TaskRuleIndicatorMapper;
import com.keymobile.indicators.model.mapper.indmapper.DriveIndCatalogMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -42,6 +46,8 @@ public class DriveIndDefService {
private IndicatorsRelService indRelService;
@Autowired
private DriveIndCatalogMapper driveIndCatalogMapper;
@Autowired
private TaskRuleIndicatorMapper taskRuleIndicatorMapper;
public String saveOrUpdate(DriveIndDef driveIndDef,String code,Integer catalogId,String catalogIdPath,
String user,String isUpdate,String shortboardIds)throws Exception{
......@@ -62,8 +68,8 @@ public class DriveIndDefService {
}
DriveIndCatalog driveIndCatalog = driveIndCatalogMapper.selectByPrimaryKey(catalogPid);
driveIndDef.setIndLevel(driveIndCatalog.getCatalogName());
DriveIndDef dbDriveIndDef = this.getById(driveIndDef.getIndId());
if("0".equals(isUpdate)) {//新建
DriveIndDef dbDriveIndDef = this.getById(driveIndDef.getIndId());
if(dbDriveIndDef!=null) {
throw new Exception("指标编号存在,新增指标失败");
}else {
......@@ -76,9 +82,9 @@ public class DriveIndDefService {
driveIndDef.setCatalogId(catalogId);
driveIndDef.setCatalogIdPath(catalogIdPath);
driveIndDefMapper.insert(driveIndDef);
this.saveRuleIndicators(driveIndDef);
}
}else {
DriveIndDef dbDriveIndDef = this.getById(driveIndDef.getIndId());
if(dbDriveIndDef!=null) {
//生成版本
if(driveIndDefVersionService.save(dbDriveIndDef)) {
......@@ -91,6 +97,8 @@ public class DriveIndDefService {
driveIndDef.setCatalogId(catalogId);
driveIndDef.setCatalogIdPath(catalogIdPath);
driveIndDefMapper.updateByPrimaryKey(driveIndDef);
taskRuleIndicatorMapper.deleteByParentIndId(driveIndDef.getIndId());
this.saveRuleIndicators(driveIndDef);
}
}else {
throw new Exception("指标不存在,修改失败");
......@@ -121,6 +129,27 @@ public class DriveIndDefService {
indRelService.saveOrUpdate(driveIndDef.getIndId(), "1");
return "success;driveIndId:"+driveIndDef.getIndId();
}
/**
* 保存指标关联的数据项多合一指标
* @param driveIndDef 考核指标
*/
private void saveRuleIndicators(DriveIndDef driveIndDef) {
List<TaskRuleIndicator> indicators = driveIndDef.getIndicators();
if (CollectionUtils.isNotEmpty(indicators)) {
for (TaskRuleIndicator indicator : indicators) {
indicator.setId(null);
indicator.setRuleId(0);
indicator.setState(Constants.DATA_STATE_A);
indicator.setCreateTime(driveIndDef.getUpdateTime());
indicator.setCreator(driveIndDef.getUpdater());
indicator.setUpdater(driveIndDef.getUpdater());
indicator.setUpdateTime(driveIndDef.getUpdateTime());
indicator.setParentIndId(driveIndDef.getIndId());
taskRuleIndicatorMapper.insert(indicator);
}
}
}
public DriveIndDef getById(String indId) throws Exception{
DriveIndDef driveIndDef = new DriveIndDef();
......@@ -253,4 +282,16 @@ public class DriveIndDefService {
public List<DriveIndDef> getByIndFormatLike(String indId){
return driveIndDefMapper.getByIndFormatLike("%"+indId+";%");
}
// 根据指标id获取考核指标信息和组内指标关联项
public DriveIndDef getIndById(String indId, boolean needInd) {
DriveIndDef selectParam = new DriveIndDef();
selectParam.setIndId(indId);
DriveIndDef driveIndDef = driveIndDefMapper.selectOne(selectParam);
if (needInd) {
List<TaskRuleIndicator> indicators = taskRuleIndicatorMapper.getByParentIndId(indId);
driveIndDef.setIndicators(indicators);
}
return driveIndDef;
}
}
......@@ -458,7 +458,7 @@ public class IndScorecardService {
}
avg = (sum * 1.0) / (current.size() * 1.0);
// 排名
Map<String, Integer> rankValue = CalculateUtils.rankValue(valueMap, "0");
Map<String, Integer> rankValue = CalculateUtils.rankValue(valueMap, acsType);
// 排序
Map<String, Integer> sortValue = CalculateUtils.sortByValueAsc(rankValue);
String compareObj = currentCompareObjResult.getCompareObj();
......@@ -523,6 +523,17 @@ public class IndScorecardService {
List<RankScoreDef> minusScoreItem = gson.
fromJson(scoreCard.getMinusScoreItemJson(), new TypeToken<List<RankScoreDef>>(){}.getType());
rank = currentDriveResult.size()-rank+1;
int maxRank = 0 ;
for(DriveIndCalResultDef tempDriveIndCalResultDef : currentDriveResult) {
if(tempDriveIndCalResultDef.getRank()>maxRank){
maxRank = tempDriveIndCalResultDef.getRank() ;
}
}
if (rank == maxRank){
rank = 1 ;
}else {
rank = currentDriveResult.size() - rank + 1;
}
for(RankScoreDef scoreDef : minusScoreItem) {
if(scoreDef.getRank()==rank) {
value -= scoreDef.getScore();
......
......@@ -7,7 +7,12 @@
from data_enter_rule_ind
where rule_id = #{ruleId} and state = 1
</select>
<select id="getByParentIndId" parameterType="java.lang.String" resultType="com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator" >
select *
from data_enter_rule_ind
where parent_ind_id = #{parentIndId} and state = 1
</select>
<update id="deleteByRuleId" parameterType="java.lang.Integer">
update data_enter_rule_ind
......@@ -15,6 +20,12 @@
where rule_id = #{ruleId}
</update>
<update id="deleteByParentIndId" parameterType="java.lang.String">
update data_enter_rule_ind
set state = 3
where parent_ind_id = #{parentIndId}
</update>
<select id="findIndRefByRuleIdIdAndDept" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndDef">
SELECT def.*
from data_enter_rule_ind ind LEFT JOIN drive_ind_def def on ind.ind_id=def.ind_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment