Commit fea0c031 by zhangkb

修改单位得分规则和短板筛选规则数据到mysql中

parent 92a0ee43
......@@ -57,7 +57,7 @@ public class DriveIndCalculateActor extends AbstractActor{
private String unit;
private String markType;
private Integer markType;
private String driveIndId;
......
......@@ -69,7 +69,7 @@ public class DriveIndCalculateRegionActor extends AbstractActor{
String value = driveIndAverageAndRankMsg.getDriveIndValue();
String id = String.valueOf(driveIndAverageAndRankMsg.getId());
String indType = driveIndAverageAndRankMsg.getIndType();
String markType = driveIndAverageAndRankMsg.getMarkType();//评分卡id
Integer markType = driveIndAverageAndRankMsg.getMarkType();//评分卡id
valueMap.put(id, value);
values.add(value);
compareObjs.add(driveIndAverageAndRankMsg.getCompareObj());
......@@ -114,7 +114,7 @@ public class DriveIndCalculateRegionActor extends AbstractActor{
//计算分数
Map<String,String> scoreMap = indScorecardService.calculateIndiScore(
driveIndCalResult.getIndId(), driveIndCalResult.getDate(),
driveIndCalResult.getCompareObj(), Integer.parseInt(markType),
driveIndCalResult.getCompareObj(), markType,
driveIndCalResult.getCompareId(),compareObjs);
driveIndCalResult.setScore(scoreMap.get("score"));
driveIndCalResult.setImproveScore(scoreMap.get("improveScore"));
......
......@@ -16,11 +16,11 @@ public class DriveIndAverageAndRankMsg implements Serializable{
private String driveIndValue;
private String unit;
private String indType;
private String markType;
private Integer markType;
private String indFormula;
public DriveIndAverageAndRankMsg(Integer id,String compareId,String driveIndId,String compareObj,
Integer date,String driveIndValue,String unit,String indType,String markType,String indFormula) {
Integer date,String driveIndValue,String unit,String indType,Integer markType,String indFormula) {
this.id = id;
this.compareId = compareId;
this.driveIndId = driveIndId;
......@@ -97,11 +97,11 @@ public class DriveIndAverageAndRankMsg implements Serializable{
this.indType = indType;
}
public String getMarkType() {
public Integer getMarkType() {
return markType;
}
public void setMarkType(String markType) {
public void setMarkType(Integer markType) {
this.markType = markType;
}
......
......@@ -32,7 +32,7 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "新建基础指标", notes = "新建基础指标")
@PostMapping(value = "/createBaseInd")
public void createBaseInd(@RequestBody BaseIndDef baseIndDef,@RequestParam String catalogId,
public void createBaseInd(@RequestBody BaseIndDef baseIndDef,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) throws Exception{
baseIndDefService.saveOrUpdate(baseIndDef, catalogId, catalogIdPath, user);
}
......@@ -45,7 +45,7 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "根据关键字查询基础指标", notes = "根据关键字查询基础指标")
@PostMapping(value = "/getByPageAndKeyword")
public Map<String,Object> getByPageAndKeyword(@RequestParam String catalogId,
public Map<String,Object> getByPageAndKeyword(@RequestParam Integer catalogId,
@RequestParam(required=false) String keyword,
@RequestParam(defaultValue = "0") int page,@RequestParam(defaultValue = "10") int rows) throws Exception{
return baseIndDefService.getByPageAndKeyword(catalogId, keyword, page, rows);
......@@ -53,7 +53,7 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "新建考核指标", notes = "新建考核指标")
@PostMapping(value = "/createDriveInd")
public void createDriveInd(@RequestBody DriveIndDef driveIndDef,@RequestParam String catalogId,
public void createDriveInd(@RequestBody DriveIndDef driveIndDef,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) throws Exception{
driveIndDefService.saveOrUpdate(driveIndDef, catalogId, catalogIdPath, user);
}
......@@ -66,7 +66,7 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "根据关键字查询考核指标", notes = "根据关键字查询考核指标")
@PostMapping(value = "/getDriveByPageAndKeyword")
public Map<String,Object> getDriveByPageAndKeyword(@RequestParam String catalogId,
public Map<String,Object> getDriveByPageAndKeyword(@RequestParam Integer catalogId,
@RequestParam(required=false) String keyword,
@RequestParam(defaultValue = "0") int page,@RequestParam(defaultValue = "10") int rows) throws Exception{
return driveIndDefService.getByPageAndKeyword(catalogId, keyword, page, rows);
......
......@@ -30,6 +30,6 @@ public class BaseIndDef {
private Integer defStaTime;
private Integer defEndTime;
private String version;//版本号
private String catalogId;//挂靠目录id
private Integer catalogId;//挂靠目录id
private String catalogIdPath;//挂靠目录idPath,方便用目录类别找到对应的挂靠指标
}
......@@ -25,12 +25,12 @@ public class DriveIndDef {
private String indFormatDesc;//指标公式描述
private String isCalScore;//是否计分 是:1 否:0
private String indRule;//指标正负属性:正向指标0 反向指标1
private String indCalScoreRule;//计分规则
private Integer indCalScoreRule;//计分规则
private String indCalScoreRuleDesc;//计分规则描述
private String isUnitCalScore;//是否参与单位得分计算 是:1 否:0
private String indFrequency;//指标频度
private String version;//版本号
private String catalogId;//挂靠目录id
private Integer catalogId;//挂靠目录id
private String catalogIdPath;//挂靠目录idPath,方便用目录类别找到对应的挂靠指标
private String creater;
private Date createTime;
......
......@@ -2,11 +2,14 @@ package com.keymobile.indicators.model.mapper.indmapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.keymobile.indicators.model.entity.shortboard.ShortboardDriveIndRel;
import feign.Param;
import tk.mybatis.mapper.common.BaseMapper;
@Mapper
public interface ShortboardDriveIndRelMapper extends BaseMapper<ShortboardDriveIndRel>{
List<ShortboardDriveIndRel> findByDriveIndDefId(@Param("driveIndDefId")String driveIndDefId);
}
......@@ -19,7 +19,7 @@ public class BaseIndDefService {
@Autowired
private BaseIndDefVersionService baseIndDefVersionService;
public String saveOrUpdate(BaseIndDef baseIndDef,String catalogId,String catalogIdPath,String user)
public String saveOrUpdate(BaseIndDef baseIndDef,Integer catalogId,String catalogIdPath,String user)
throws Exception{
if(StringUtils.isBlank(baseIndDef.getIndId())) {
return "indId can not be null";
......@@ -60,15 +60,11 @@ public class BaseIndDefService {
baseIndDefMapper.deleteByPrimaryKey(indId);
}
public Map<String,Object> getByPageAndKeyword(String catalogId,String keyword,
public Map<String,Object> getByPageAndKeyword(Integer catalogId,String keyword,
int page,int rows)throws Exception{
Map<String,Object> paramMap = new HashMap<>();
Map<String,Object> resultMap = new HashMap<>();
if(StringUtils.isBlank(catalogId)) {
paramMap.put("catalogId", null);
}else {
paramMap.put("catalogId", catalogId);
}
if(StringUtils.isBlank(keyword)) {
paramMap.put("keyword", null);
}else {
......
......@@ -30,14 +30,14 @@ public class DriveIndCatalogService {
//获取parentId拼接idPath
Integer parentId = driveIndCatalog.getParentId();
if(parentId==0) {//顶层节点
driveIndCatalog.setIdPath(String.valueOf(driveIndCatalog.getId()));
driveIndCatalog.setIdPath(String.valueOf(driveIndCatalog.getId())+";");
}else {
DriveIndCatalog parentDriveIndCatalog = driveIndCatalogMapper.selectByPrimaryKey(driveIndCatalog.getParentId());
if(parentDriveIndCatalog==null) {
throw new Exception("父节点不存在:parent catalog is not exist");
}else {
driveIndCatalog.setIdPath(parentDriveIndCatalog.getIdPath()+";"+
driveIndCatalog.getId());
driveIndCatalog.setIdPath(parentDriveIndCatalog.getIdPath()+
driveIndCatalog.getId()+";");
}
}
//保存
......
......@@ -28,7 +28,7 @@ public class DriveIndDefService {
@Autowired
private BaseIndDataService baseIndDataService;
public String saveOrUpdate(DriveIndDef driveIndDef,String catalogId,String catalogIdPath,String user)
public String saveOrUpdate(DriveIndDef driveIndDef,Integer catalogId,String catalogIdPath,String user)
throws Exception{
if(StringUtils.isBlank(driveIndDef.getIndId())) {
return "indId can not be null";
......@@ -69,15 +69,11 @@ public class DriveIndDefService {
driveIndDefMapper.deleteByPrimaryKey(indId);
}
public Map<String,Object> getByPageAndKeyword(String catalogId,String keyword,
public Map<String,Object> getByPageAndKeyword(Integer catalogId,String keyword,
int page,int rows)throws Exception{
Map<String,Object> paramMap = new HashMap<>();
Map<String,Object> resultMap = new HashMap<>();
if(StringUtils.isBlank(catalogId)) {
paramMap.put("catalogId", null);
}else {
paramMap.put("catalogId", catalogId);
}
if(StringUtils.isBlank(keyword)) {
paramMap.put("keyword", null);
}else {
......
......@@ -30,13 +30,13 @@ public class IndCatalogService {
//获取parentId拼接idPath
int parentId = indCatalog.getParentId();
if(parentId==0) {//顶层节点
indCatalog.setIdPath(String.valueOf(indCatalog.getId()));
indCatalog.setIdPath(String.valueOf(indCatalog.getId())+";");
}else {
IndCatalog parentIndCatalog = indCatalogMapper.selectByPrimaryKey(indCatalog.getParentId());
if(parentIndCatalog==null) {
throw new Exception("父节点不存在:parent catalog is not exist");
}else {
indCatalog.setIdPath(parentIndCatalog.getIdPath()+";"+indCatalog.getId());
indCatalog.setIdPath(parentIndCatalog.getIdPath()+indCatalog.getId()+";");
}
}
//保存
......
......@@ -4,12 +4,15 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef;
import com.keymobile.indicators.model.entity.shortboard.ShortboardDriveIndRel;
import com.keymobile.indicators.model.entity.shortboard.ShortboardItem;
......@@ -72,6 +75,7 @@ public class ShortboardRuleService {
public List<Map<String,String>> getObjShortboard(String compareId,int date,
List<String> compareObjs,List<String> driveIds){
List<Map<String,String>> result = new ArrayList<>();
Gson gson = new Gson();
for(String driveId : driveIds) {
//根据考核指标id获取关联的短板筛选规则id
List<ShortboardDriveIndRel> relations = shortboardDriveIndRelMapper.
......@@ -79,13 +83,16 @@ public class ShortboardRuleService {
for(ShortboardDriveIndRel rel : relations) {
ShortboardRule shortboardRule = this.getById(rel.getShortboardRuleId());
if(shortboardRule!=null) {
List<ShortboardItem> shortboardItems = shortboardRule.getShortboardItem();
if(StringUtils.isNotBlank(shortboardRule.getShortboardItemJson())) {
List<ShortboardItem> shortboardItems = gson.
fromJson(shortboardRule.getShortboardItemJson(), new TypeToken<List<ShortboardItem>>(){}.getType());
for(ShortboardItem item : shortboardItems) {
}
}
}
}
}
return result;
}
......
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