Forráskód Böngészése

获取最新的字典项

chenyongxing 6 éve
szülő
commit
e33ea88129

+ 31 - 8
src/main/java/com/yihu/hos/standard/controller/StdCenterEndPoint.java

@ -11,13 +11,18 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -43,9 +48,11 @@ public class StdCenterEndPoint extends BaseController {
    private StdRelationService stdRelationService;
    @Autowired
    private StandardService standardService;
    @Value("${org_code}")
    private String defaultOrgCode;
    @RequestMapping("/stdInfo/list")
    @RequestMapping(value="/stdInfo/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取版本列表",  produces = "application/json", notes = "获取版本列表")
    public String getStdInfo(@ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
                              @RequestParam(value = "filters", required = false) String filters) throws ParseException {
@ -55,7 +62,7 @@ public class StdCenterEndPoint extends BaseController {
    }
    @RequestMapping("/version/list")
    @RequestMapping(value="/version/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取版本号列表",  produces = "application/json", notes = "获取版本号列表")
    public String getVersions(@ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
                                 @RequestParam(value = "filters", required = false) String filters) throws ParseException {
@ -66,7 +73,7 @@ public class StdCenterEndPoint extends BaseController {
        return json.toString();
    }
    @RequestMapping("/dataset/list")
    @RequestMapping(value="/dataset/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取数据集列表",  produces = "application/json", notes = "获取数据集列表")
    public String getDatasetList(@ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
                             @RequestParam(value = "filters", required = false) String filters,
@ -77,7 +84,7 @@ public class StdCenterEndPoint extends BaseController {
        return json.toString();
    }
    @RequestMapping("/metadata/list")
    @RequestMapping(value="/metadata/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取数据元列表",  produces = "application/json", notes = "获取数据元列表")
    public String getMetadataList(@ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
                          @RequestParam(value = "filters", required = false) String filters,
@ -88,7 +95,7 @@ public class StdCenterEndPoint extends BaseController {
        return json.toString();
    }
    @RequestMapping("/dict/list")
    @RequestMapping(value="/dict/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取标准字典列表",  produces = "application/json", notes = "获取标准字典列表")
    public String getDictList(@ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
                                  @RequestParam(value = "filters", required = false) String filters,
@ -101,7 +108,7 @@ public class StdCenterEndPoint extends BaseController {
        return json.toString();
    }
    @RequestMapping("/dictItem/list")
    @RequestMapping(value="/dictItem/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取标准字典项列表",  produces = "application/json", notes = "获取标准字典项列表")
    public String getDictItemList(@ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
                                  @RequestParam(value = "filters", required = false) String filters,
@ -112,7 +119,7 @@ public class StdCenterEndPoint extends BaseController {
        return json.toString();
    }
    @RequestMapping("/datasetIndex/list")
    @RequestMapping(value="/datasetIndex/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取标准索引列表",  produces = "application/json", notes = "获取标准索引列表")
    public String getDatasetIndexList(@ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
                                  @RequestParam(value = "filters", required = false) String filters,
@ -123,7 +130,7 @@ public class StdCenterEndPoint extends BaseController {
        return json.toString();
    }
    @RequestMapping("/relation/list")
    @RequestMapping(value="/relation/list",method = RequestMethod.GET)
    @ApiOperation(value = "获取版本号列表",  produces = "application/json", notes = "获取版本号列表")
    public String getRelation(@ApiParam(name = "version", value = "版本", defaultValue = "")
                              @RequestParam(value = "version") String version,
@ -133,4 +140,20 @@ public class StdCenterEndPoint extends BaseController {
        JSONArray json = JSONArray.fromObject(list);
        return json.toString();
    }
    @RequestMapping(value="/lastDictItem/list",method = RequestMethod.GET)
    @ApiOperation(value = "根据字典code,获取健康之路最新的字典项",  produces = "application/json", notes = "根据字典code,获取健康之路最新的字典项")
    public List getLastDictItem(@ApiParam(name = "code", value = "字典code", defaultValue = "")
                              @RequestParam(value = "code") String code) throws IOException {
        List result = new ArrayList();
        String ver = standardService.getLastStandByOrgCode(defaultOrgCode);
        if(StringUtils.isNotBlank(ver)){
            List<StdDictionaryEntryModel> list = stdDictEntryService.searchPage(StdDictionaryEntryModel.class, StandardVersion.DictEntryTable,ver, "code="+code, null, null, null,true);
            if(CollectionUtils.isNotEmpty(list)){
                Long id = list.get(0).getId();
                result = stdDictEntryService.searchPage(StdDictionaryEntryModel.class, StandardVersion.DictEntryTable,ver, "dict_id="+id, null, null, null,true);
            }
        }
        return result;
    }
}

+ 1 - 0
src/main/resources/application.yml

@ -50,6 +50,7 @@ fast-dfs:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
org_code: jkzl
---
spring: