Commit 51d94765 by zhangkb

考核指标添加短板规则字段

parent d66e8e93
......@@ -33,8 +33,8 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "新建基础指标", notes = "新建基础指标")
@PostMapping(value = "/createBaseInd")
public void createBaseInd(@RequestBody BaseIndDef baseIndDef,@RequestParam String catalogId,
@RequestParam String user) throws Exception{
baseIndDefService.saveOrUpdate(baseIndDef, catalogId, user);
@RequestParam String catalogIdPath,@RequestParam String user) throws Exception{
baseIndDefService.saveOrUpdate(baseIndDef, catalogId, catalogIdPath, user);
}
@ApiOperation(value = "删除基础指标", notes = "删除基础指标")
......@@ -45,16 +45,17 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "根据关键字查询基础指标", notes = "根据关键字查询基础指标")
@PostMapping(value = "/getByPageAndKeyword")
public Map<String,Object> getByPageAndKeyword(@RequestParam String catalogId,@RequestParam String keyword,
@RequestParam int page,@RequestParam int rows) throws Exception{
public Map<String,Object> getByPageAndKeyword(@RequestParam String 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);
}
@ApiOperation(value = "新建考核指标", notes = "新建考核指标")
@PostMapping(value = "/createDriveInd")
public void createDriveInd(@RequestBody DriveIndDef driveIndDef,@RequestParam String catalogId,
@RequestParam String user) throws Exception{
driveIndDefService.saveOrUpdate(driveIndDef, catalogId, user);
@RequestParam String catalogIdPath,@RequestParam String user) throws Exception{
driveIndDefService.saveOrUpdate(driveIndDef, catalogId, catalogIdPath, user);
}
@ApiOperation(value = "删除考核指标", notes = "删除考核指标")
......@@ -65,8 +66,9 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "根据关键字查询考核指标", notes = "根据关键字查询考核指标")
@PostMapping(value = "/getDriveByPageAndKeyword")
public Map<String,Object> getDriveByPageAndKeyword(@RequestParam String catalogId,@RequestParam String keyword,
@RequestParam int page,@RequestParam int rows) throws Exception{
public Map<String,Object> getDriveByPageAndKeyword(@RequestParam String 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);
}
......
......@@ -32,6 +32,8 @@ public class DriveIndDef {
private String version;//版本号
private String catalogId;//挂靠目录id
private String catalogIdPath;//挂靠目录idPath,方便用目录类别找到对应的挂靠指标
private String indShortboardRule;//短板规则
private String indShortboardRuleDesc;//短板规则描述
private String creater;
private Date createTime;
private String updater;
......
......@@ -19,7 +19,7 @@ public class BaseIndDefService {
@Autowired
private BaseIndDefVersionService baseIndDefVersionService;
public String saveOrUpdate(BaseIndDef baseIndDef,String catalogId,String user)
public String saveOrUpdate(BaseIndDef baseIndDef,String catalogId,String catalogIdPath,String user)
throws Exception{
if(StringUtils.isBlank(baseIndDef.getIndId())) {
return "indId can not be null";
......@@ -32,16 +32,18 @@ public class BaseIndDefService {
baseIndDef.setUpdateTime(new Date());
baseIndDef.setVersion("1.0");
baseIndDef.setCatalogId(catalogId);
baseIndDef.setCatalogIdPath(catalogIdPath);
baseIndDefMapper.insert(baseIndDef);
}else {
//生成版本
if(baseIndDefVersionService.save(baseIndDef)) {
String oldVersion = baseIndDef.getVersion();
if(baseIndDefVersionService.save(dbBaseIndDef)) {
String oldVersion = dbBaseIndDef.getVersion();
String newVersion = String.valueOf(Double.valueOf(oldVersion)+1);//旧版本+1
baseIndDef.setUpdater(user);
baseIndDef.setUpdateTime(new Date());
baseIndDef.setVersion(newVersion);
baseIndDef.setCatalogId(catalogId);
baseIndDef.setCatalogIdPath(catalogIdPath);
baseIndDefMapper.updateByPrimaryKey(baseIndDef);
}
}
......
......@@ -19,7 +19,7 @@ public class DriveIndDefService {
@Autowired
private DriveIndDefVersionService driveIndDefVersionService;
public String saveOrUpdate(DriveIndDef driveIndDef,String catalogId,String user)
public String saveOrUpdate(DriveIndDef driveIndDef,String catalogId,String catalogIdPath,String user)
throws Exception{
if(StringUtils.isBlank(driveIndDef.getIndId())) {
return "indId can not be null";
......@@ -32,16 +32,18 @@ public class DriveIndDefService {
driveIndDef.setUpdateTime(new Date());
driveIndDef.setVersion("1.0");
driveIndDef.setCatalogId(catalogId);
driveIndDef.setCatalogIdPath(catalogIdPath);
driveIndDefMapper.insert(driveIndDef);
}else {
//生成版本
if(driveIndDefVersionService.save(driveIndDef)) {
String oldVersion = driveIndDef.getVersion();
if(driveIndDefVersionService.save(dbBaseIndDef)) {
String oldVersion = dbBaseIndDef.getVersion();
String newVersion = String.valueOf(Double.valueOf(oldVersion)+1);//旧版本+1
driveIndDef.setUpdater(user);
driveIndDef.setUpdateTime(new Date());
driveIndDef.setVersion(newVersion);
driveIndDef.setCatalogId(catalogId);
driveIndDef.setCatalogIdPath(catalogIdPath);
driveIndDefMapper.updateByPrimaryKey(driveIndDef);
}
}
......
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