Commit 092bfafa by dengwei

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

parent 9c40d807
...@@ -214,4 +214,11 @@ public class IndicatorsDefCtrl { ...@@ -214,4 +214,11 @@ public class IndicatorsDefCtrl {
return value; 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 { ...@@ -45,6 +45,10 @@ public class TaskRuleIndicator extends BaseModel {
@ApiModelProperty("指标单位") @ApiModelProperty("指标单位")
private String indUnit; private String indUnit;
/**
* 父指标id
*/
@ApiModelProperty("父指标id")
private String parentIndId;
} }
package com.keymobile.indicators.model.entity.indicators; package com.keymobile.indicators.model.entity.indicators;
import java.util.Date; import java.util.Date;
import java.util.List;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient;
import com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator;
import lombok.Data; import lombok.Data;
/** /**
...@@ -44,4 +47,16 @@ public class DriveIndDef { ...@@ -44,4 +47,16 @@ public class DriveIndDef {
private Integer indNum;//指标序号 - 2021/8/17 hzc private Integer indNum;//指标序号 - 2021/8/17 hzc
private String checkType;//考核类型- 2021/8/17 hzc private String checkType;//考核类型- 2021/8/17 hzc
private String formulaInfo; 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> { ...@@ -20,6 +20,18 @@ public interface TaskRuleIndicatorMapper extends BaseMapper<TaskRuleIndicator> {
void deleteByRuleId(Integer ruleId); 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; ...@@ -10,8 +10,12 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.keymobile.indicators.constant.Constants; 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.entity.indicators.DriveIndCatalog;
import com.keymobile.indicators.model.mapper.indicators.TaskRuleIndicatorMapper;
import com.keymobile.indicators.model.mapper.indmapper.DriveIndCatalogMapper; import com.keymobile.indicators.model.mapper.indmapper.DriveIndCatalogMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -42,6 +46,8 @@ public class DriveIndDefService { ...@@ -42,6 +46,8 @@ public class DriveIndDefService {
private IndicatorsRelService indRelService; private IndicatorsRelService indRelService;
@Autowired @Autowired
private DriveIndCatalogMapper driveIndCatalogMapper; private DriveIndCatalogMapper driveIndCatalogMapper;
@Autowired
private TaskRuleIndicatorMapper taskRuleIndicatorMapper;
public String saveOrUpdate(DriveIndDef driveIndDef,String code,Integer catalogId,String catalogIdPath, public String saveOrUpdate(DriveIndDef driveIndDef,String code,Integer catalogId,String catalogIdPath,
String user,String isUpdate,String shortboardIds)throws Exception{ String user,String isUpdate,String shortboardIds)throws Exception{
...@@ -62,8 +68,8 @@ public class DriveIndDefService { ...@@ -62,8 +68,8 @@ public class DriveIndDefService {
} }
DriveIndCatalog driveIndCatalog = driveIndCatalogMapper.selectByPrimaryKey(catalogPid); DriveIndCatalog driveIndCatalog = driveIndCatalogMapper.selectByPrimaryKey(catalogPid);
driveIndDef.setIndLevel(driveIndCatalog.getCatalogName()); driveIndDef.setIndLevel(driveIndCatalog.getCatalogName());
DriveIndDef dbDriveIndDef = this.getById(driveIndDef.getIndId());
if("0".equals(isUpdate)) {//新建 if("0".equals(isUpdate)) {//新建
DriveIndDef dbDriveIndDef = this.getById(driveIndDef.getIndId());
if(dbDriveIndDef!=null) { if(dbDriveIndDef!=null) {
throw new Exception("指标编号存在,新增指标失败"); throw new Exception("指标编号存在,新增指标失败");
}else { }else {
...@@ -76,9 +82,9 @@ public class DriveIndDefService { ...@@ -76,9 +82,9 @@ public class DriveIndDefService {
driveIndDef.setCatalogId(catalogId); driveIndDef.setCatalogId(catalogId);
driveIndDef.setCatalogIdPath(catalogIdPath); driveIndDef.setCatalogIdPath(catalogIdPath);
driveIndDefMapper.insert(driveIndDef); driveIndDefMapper.insert(driveIndDef);
this.saveRuleIndicators(driveIndDef);
} }
}else { }else {
DriveIndDef dbDriveIndDef = this.getById(driveIndDef.getIndId());
if(dbDriveIndDef!=null) { if(dbDriveIndDef!=null) {
//生成版本 //生成版本
if(driveIndDefVersionService.save(dbDriveIndDef)) { if(driveIndDefVersionService.save(dbDriveIndDef)) {
...@@ -91,6 +97,8 @@ public class DriveIndDefService { ...@@ -91,6 +97,8 @@ public class DriveIndDefService {
driveIndDef.setCatalogId(catalogId); driveIndDef.setCatalogId(catalogId);
driveIndDef.setCatalogIdPath(catalogIdPath); driveIndDef.setCatalogIdPath(catalogIdPath);
driveIndDefMapper.updateByPrimaryKey(driveIndDef); driveIndDefMapper.updateByPrimaryKey(driveIndDef);
taskRuleIndicatorMapper.deleteByParentIndId(driveIndDef.getIndId());
this.saveRuleIndicators(driveIndDef);
} }
}else { }else {
throw new Exception("指标不存在,修改失败"); throw new Exception("指标不存在,修改失败");
...@@ -121,6 +129,27 @@ public class DriveIndDefService { ...@@ -121,6 +129,27 @@ public class DriveIndDefService {
indRelService.saveOrUpdate(driveIndDef.getIndId(), "1"); indRelService.saveOrUpdate(driveIndDef.getIndId(), "1");
return "success;driveIndId:"+driveIndDef.getIndId(); 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{ public DriveIndDef getById(String indId) throws Exception{
DriveIndDef driveIndDef = new DriveIndDef(); DriveIndDef driveIndDef = new DriveIndDef();
...@@ -253,4 +282,16 @@ public class DriveIndDefService { ...@@ -253,4 +282,16 @@ public class DriveIndDefService {
public List<DriveIndDef> getByIndFormatLike(String indId){ public List<DriveIndDef> getByIndFormatLike(String indId){
return driveIndDefMapper.getByIndFormatLike("%"+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 { ...@@ -458,7 +458,7 @@ public class IndScorecardService {
} }
avg = (sum * 1.0) / (current.size() * 1.0); 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); Map<String, Integer> sortValue = CalculateUtils.sortByValueAsc(rankValue);
String compareObj = currentCompareObjResult.getCompareObj(); String compareObj = currentCompareObjResult.getCompareObj();
...@@ -523,6 +523,17 @@ public class IndScorecardService { ...@@ -523,6 +523,17 @@ public class IndScorecardService {
List<RankScoreDef> minusScoreItem = gson. List<RankScoreDef> minusScoreItem = gson.
fromJson(scoreCard.getMinusScoreItemJson(), new TypeToken<List<RankScoreDef>>(){}.getType()); fromJson(scoreCard.getMinusScoreItemJson(), new TypeToken<List<RankScoreDef>>(){}.getType());
rank = currentDriveResult.size()-rank+1; 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) { for(RankScoreDef scoreDef : minusScoreItem) {
if(scoreDef.getRank()==rank) { if(scoreDef.getRank()==rank) {
value -= scoreDef.getScore(); value -= scoreDef.getScore();
......
...@@ -7,7 +7,12 @@ ...@@ -7,7 +7,12 @@
from data_enter_rule_ind from data_enter_rule_ind
where rule_id = #{ruleId} and state = 1 where rule_id = #{ruleId} and state = 1
</select> </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 id="deleteByRuleId" parameterType="java.lang.Integer">
update data_enter_rule_ind update data_enter_rule_ind
...@@ -15,6 +20,12 @@ ...@@ -15,6 +20,12 @@
where rule_id = #{ruleId} where rule_id = #{ruleId}
</update> </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 id="findIndRefByRuleIdIdAndDept" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndDef">
SELECT def.* SELECT def.*
from data_enter_rule_ind ind LEFT JOIN drive_ind_def def on ind.ind_id=def.ind_id 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