Commit 5e6cf03a by hzc

增加通过配置项查询指标或基础项单位接口

parent 547a31be
package com.keymobile.indicators.api.hytobacco; package com.keymobile.indicators.api.hytobacco;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.keymobile.indicators.model.entity.ConfigInfo;
import com.keymobile.indicators.service.ConfigInfoService;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.keymobile.indicators.constant.Constants; import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.indicators.BaseIndDef; import com.keymobile.indicators.model.entity.indicators.BaseIndDef;
...@@ -39,6 +41,8 @@ public class IndicatorsDefCtrl { ...@@ -39,6 +41,8 @@ public class IndicatorsDefCtrl {
private BaseIndDefVersionService baseIndDefVersionService; private BaseIndDefVersionService baseIndDefVersionService;
@Autowired @Autowired
private DriveIndDefVersionService driveIndDefVersionService; private DriveIndDefVersionService driveIndDefVersionService;
@Autowired
private ConfigInfoService configInfoService;
@ApiOperation(value = "根据基础指标id获取基础指标版本信息", notes = "根据基础指标id获取基础指标版本信息") @ApiOperation(value = "根据基础指标id获取基础指标版本信息", notes = "根据基础指标id获取基础指标版本信息")
@PostMapping(value = "/getBaseIndDefVersions") @PostMapping(value = "/getBaseIndDefVersions")
...@@ -183,4 +187,26 @@ public class IndicatorsDefCtrl { ...@@ -183,4 +187,26 @@ public class IndicatorsDefCtrl {
@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);
} }
@ApiOperation(value = "查询单位 1数据项单位,2指标单位", notes = "1数据项单位,2指标单位")
@GetMapping(value = "findUnits")
public List<String> findUnits(@ApiParam(value = "1数据项单位,2指标单位") @RequestParam("type") Integer type){
ConfigInfo configInfo = null;
if(type.intValue()==1){
configInfo = configInfoService.getConfigInfoById(Constants.BASE_IND_UNIT);
}else{
configInfo = configInfoService.getConfigInfoById(Constants.DRIVE_IND_UNIT);
}
List <String> value = new ArrayList<>();
if(configInfo!=null){
String cfValue = configInfo.getCfValue();
if (StringUtils.isNotBlank(cfValue)){
value = Arrays.asList(cfValue.split(Constants.SEP_COMMA));
}
}
return value;
}
} }
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