Commit fea0c031 by zhangkb

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

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