瀏覽代碼

代码修改

LAPTOP-KB9HII50\70708 1 年之前
父節點
當前提交
73fbd4ffe3

+ 1 - 1
common/common-entity/src/db/2023.sql

@ -214,7 +214,7 @@ BEGIN
    SET result = '0%';
  ELSEIF (denominator = 0 OR denominator is null) AND numerator > 0 THEN
    SET result = '100%';
  ELSEIF denominator IS NULL OR denominator IS NULL THEN
  ELSEIF denominator IS NULL THEN
    SET result = '0%';
ELSE
    SET result = CONCAT(ROUND((numerator / denominator) * 100, 2), '%');

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/ehr/resource/RsResource.java

@ -27,7 +27,7 @@ public class RsResource extends BaseAssignedEntity {
    private String grantType;
    // 描述
    private String description;
    // 资源类型
    // 资源类型 1档案数据 2指标统计
    private Integer dataSource;
    //指标视图展示类型
    private String echartType;

+ 2 - 2
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/resource/ResourceIntegratedController.java

@ -104,11 +104,11 @@ public class ResourceIntegratedController extends EnvelopRestEndpoint {
     * @return
     */
    @GetMapping("/metadata")
    public Envelop getMetadataList1(String categoryId, String filters) throws Exception {
    public Envelop getMetadataList1(String categoryId, String filters, String dataSource) throws Exception {
        String url = "/resource/api/v1.0/resources/integrated/metadata";
        //标准分类
//        long start = System.currentTimeMillis();
        List<Map<String, Object>> list = resourcesIntegratedService.metadata(categoryId,  filters);
        List<Map<String, Object>> list = resourcesIntegratedService.metadata(categoryId,  filters,dataSource);
//        List<Map<String, Object>> list = resourcesIntegratedService.intMetadata(categoryId, "*", "*", "standard", filters);
//        long end = System.currentTimeMillis();
//        System.out.println("newTime:"+(end-start));

+ 10 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/service/ResourceBrowseService.java

@ -505,6 +505,7 @@ public class ResourceBrowseService extends BaseJpaService {
        //获取资源编码列表
        List<String> codeList = (List<String>) objectMapper.readValue(resourcesCodes, List.class);
        String tableName = "";
        String paramSql = "";
        String where = "";
        Map<String,Integer> relationMap = new HashMap<>();//多视图关联
        Map<String,String> filedMap = new HashMap<>();//参数加别名
@ -514,6 +515,9 @@ public class ResourceBrowseService extends BaseJpaService {
            if (rsResources == null) {
                throw new ApiException( "无效的资源编码" + code,ErrorCode.BAD_REQUEST.value());
            }
            if(rsResources.getDataSource()==2&&codeList.size()>1){
                throw new ApiException("指标统计,只能选择当个指标");
            }
            List<RsResourceMetadata> resourceMetadataList = resourceBrowseMetadataDao.findResourceMetadata(code);
            for (RsResourceMetadata metadata:resourceMetadataList){
                filedMap.put(metadata.getMetadataId(),code);
@ -541,8 +545,14 @@ public class ResourceBrowseService extends BaseJpaService {
                            relationMap.put(re,1);
                        }
                    }
                }else if (param.getParamKey().equals("param")){
                    paramSql = param.getParamValue();
                }
            }
            if(!StringUtils.isEmpty(paramSql)){
                tableName = resourceBrowseDao.transforParam(paramSql,tableName);
            }
        }
        String code1 = codeList.get(0);
        int codeLength = codeList.size();

+ 17 - 10
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/service/ResourceIntegratedService.java

@ -82,21 +82,24 @@ public class ResourceIntegratedService extends BaseJpaService {
     * @return
     */
    @Transactional(readOnly = true)
    public List<RsResource> findFileMasterList(String categoryId, String ids, String filters, String categoryCode) {
    public List<RsResource> findFileMasterList(String categoryId, String ids, String filters, String categoryCode,String rs_interface) {
        if(rs_interface==null){
            rs_interface = "getMysqlData";
        }
        String sql;
        if (filters != null) {
            if (ids != null) {
                sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc  WHERE" +
                        " rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
                        "AND rr.category_id = '" + categoryId + "' " +
                        "AND rr.rs_interface = 'getMysqlData' " +
                        "AND rr.rs_interface = '"+rs_interface+"' " +
                        "AND (rr.id IN (" + ids + ")) " + "OR rr.grant_type = '0') " +
                        "AND rr.name like " + "'%" + filters + "%'";
            } else {
                sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc   WHERE" +
                        " rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
                        "AND rr.category_id = '" + categoryId + "'" +
                        "AND rr.rs_interface = 'getMysqlData' " +
                        "AND rr.rs_interface = '"+rs_interface+"' " +
                        "AND rr.name like " + "'%" + filters + "%'";
            }
        } else {
@ -104,13 +107,13 @@ public class ResourceIntegratedService extends BaseJpaService {
                sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc   WHERE" +
                        " rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
                        "AND rr.category_id = '" + categoryId + "'" +
                        "AND rr.rs_interface = 'getMysqlData' " +
                        "AND rr.rs_interface = '"+rs_interface+"' " +
                        "AND rr.id IN (" + ids + ")) " + "OR rr.grant_type = '0') ";
            } else {
                sql = "SELECT rr.id, rr.code, rr.name, rr.category_id, rr.rs_interface, rr.grant_type FROM rs_resource rr ,rs_resource_category rrc   WHERE" +
                        " rr.category_id=rrc.ID AND rrc. CODE = '" + categoryCode + "' " +
                        "AND rr.category_id = '" + categoryId + "'" +
                        "AND rr.rs_interface = 'getMysqlData'";
                        "AND rr.rs_interface = '"+rs_interface+"' ";
            }
        }
        RowMapper rowMapper = BeanPropertyRowMapper.newInstance(RsResource.class);
@ -383,9 +386,13 @@ public class ResourceIntegratedService extends BaseJpaService {
     * @return
     */
    @Transactional(readOnly = true)
    public List<Map<String, Object>> metadata(String categoryId, String filters) throws Exception {
    public List<Map<String, Object>> metadata(String categoryId, String filters,String dataSource) throws Exception {
        List<Map<String, Object>> resultList = new ArrayList<>();
        List<RsResource> rrList = findFileMasterList(categoryId, null, filters, "standard");
        String rs_interface = "getMysqlData";
        if("2".equals(dataSource)){
            rs_interface = "getMysqlStatistics";
        }
        List<RsResource> rrList = findFileMasterList(categoryId, null, filters, "standard",rs_interface);
        if (rrList != null) {
            for (RsResource rsResources : rrList) {
@ -427,7 +434,7 @@ public class ResourceIntegratedService extends BaseJpaService {
        List<Map<String, Object>> resultList = new ArrayList<>();
        List<RsResource> rrList;
        if (userResource.equals("*")) {
            rrList = findFileMasterList(categoryId, null, filters, categoryCode);
            rrList = findFileMasterList(categoryId, null, filters, categoryCode,null);
        } else {
            //授权资源
            List<String> userResourceList = objectMapper.readValue(userResource, List.class);
@ -439,9 +446,9 @@ public class ResourceIntegratedService extends BaseJpaService {
            }
            String ids = builder.toString();
            if (StringUtils.isEmpty(ids)) {
                rrList = findFileMasterList(categoryId, "''", filters, categoryCode);
                rrList = findFileMasterList(categoryId, "''", filters, categoryCode,null);
            } else {
                rrList = findFileMasterList(categoryId, ids.substring(0, ids.length() - 1), filters, categoryCode);
                rrList = findFileMasterList(categoryId, ids.substring(0, ids.length() - 1), filters, categoryCode,null);
            }
        }
        if (rrList != null) {