zhoutg 6 vuotta sitten
vanhempi
commit
b70bf460b9

+ 20 - 22
knowledgeman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -5,8 +5,6 @@ import org.springframework.security.access.AccessDeniedException;
 import org.springframework.security.access.ConfigAttribute;
 import org.springframework.security.authentication.InsufficientAuthenticationException;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.web.FilterInvocation;
 import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
 import org.springframework.stereotype.Service;
 
@@ -23,26 +21,26 @@ import java.util.Collection;
 public class UrlAccessDecisionManager implements AccessDecisionManager {
     @Override
     public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
-        HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
-        String url, method;
-        if (matchPermitAllUrl(request)) {
-            return;
-        }
-        if ("anonymousUser".equals(authentication.getPrincipal())) {
-            throw new AccessDeniedException("no right");
-        } else {
-            for (GrantedAuthority ga : authentication.getAuthorities()) {
-                String[] authority = ga.getAuthority().split(";");
-                url = authority[0];
-                method = authority[1];
-                if (matchers(url, request)) {
-                    if (method.equals(request.getMethod()) || "ALL".equals(method)) {
-                        return;
-                    }
-                }
-            }
-        }
-        throw new AccessDeniedException("no right");
+//        HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
+//        String url, method;
+//        if (matchPermitAllUrl(request)) {
+//            return;
+//        }
+//        if ("anonymousUser".equals(authentication.getPrincipal())) {
+//            throw new AccessDeniedException("no right");
+//        } else {
+//            for (GrantedAuthority ga : authentication.getAuthorities()) {
+//                String[] authority = ga.getAuthority().split(";");
+//                url = authority[0];
+//                method = authority[1];
+//                if (matchers(url, request)) {
+//                    if (method.equals(request.getMethod()) || "ALL".equals(method)) {
+//                        return;
+//                    }
+//                }
+//            }
+//        }
+//        throw new AccessDeniedException("no right");
     }
 
 

+ 32 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/ScaleContentDTO.java

@@ -0,0 +1,32 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 量表内容表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2019-04-08
+ */
+@Getter
+@Setter
+public class ScaleContentDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 0:文本,1:大数据接口填充
+     */
+    private Integer type;
+
+}

+ 25 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/ScaleContentIndexDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2019/5/6 15:59
+ */
+@Getter
+@Setter
+public class ScaleContentIndexDTO {
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 量表概念id
+     */
+    private Long conceptId;
+
+}

+ 32 - 11
knowledgeman-service/src/main/java/com/diagbot/facade/ScaleContentFacade.java

@@ -8,9 +8,12 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.ScaleContentDTO;
+import com.diagbot.dto.ScaleContentIndexDTO;
 import com.diagbot.dto.ScaleContentPageDTO;
 import com.diagbot.entity.ScaleContent;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.ScaleContentService;
@@ -20,7 +23,9 @@ import com.diagbot.util.DateUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.DeleteScaleVO;
+import com.diagbot.vo.ScaleContentIndexVO;
 import com.diagbot.vo.ScaleContentPageVO;
+import com.diagbot.vo.ScaleContentParamVO;
 import com.diagbot.vo.ScaleContentSaveVO;
 import com.diagbot.vo.ScaleContentVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -86,6 +91,7 @@ public class ScaleContentFacade extends ScaleContentServiceImpl {
      * @return
      */
     public IPage<ScaleContentPageDTO> getListFac(ScaleContentPageVO scaleContentPageVO) {
+        scaleContentPageVO.setLibType(LexiconTypeEnum.GAUGE.getKey());
         IPage<ScaleContentPageDTO> res = this.getList(scaleContentPageVO);
         if (res.getTotal() <= 0) {
             return res;
@@ -98,17 +104,32 @@ public class ScaleContentFacade extends ScaleContentServiceImpl {
         }
         return res;
     }
-//
-//
-//    /**
-//     * 量表列表
-//     *
-//     * @param scaleId
-//     * @return
-//     */
-//    public List<ScaleContentDTO> getByParamFac(Long scaleId) {
-//        return this.getByParam(scaleId);
-//    }
+
+
+    /**
+     * 量表检索
+     *
+     * @param scaleContentIndexVO
+     * @return
+     */
+    public List<ScaleContentIndexDTO> indexFac(ScaleContentIndexVO scaleContentIndexVO) {
+        // 设置量表类型
+        scaleContentIndexVO.setLibType(LexiconTypeEnum.GAUGE.getKey());
+        return this.index(scaleContentIndexVO);
+    }
+
+
+
+
+    /**
+     * 量表内容
+     *
+     * @param scaleContentParamVO
+     * @return
+     */
+    public List<ScaleContentDTO> getByParamFac(ScaleContentParamVO scaleContentParamVO) {
+        return this.getByParam(scaleContentParamVO.getConceptId());
+    }
 
 
     /**

+ 23 - 9
knowledgeman-service/src/main/java/com/diagbot/mapper/ScaleContentMapper.java

@@ -2,10 +2,15 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.ScaleContentDTO;
+import com.diagbot.dto.ScaleContentIndexDTO;
 import com.diagbot.dto.ScaleContentPageDTO;
 import com.diagbot.entity.ScaleContent;
+import com.diagbot.vo.ScaleContentIndexVO;
 import com.diagbot.vo.ScaleContentPageVO;
 
+import java.util.List;
+
 /**
  * <p>
  * 量表内容表 Mapper 接口
@@ -23,13 +28,22 @@ public interface ScaleContentMapper extends BaseMapper<ScaleContent> {
      * @return
      */
     public IPage<ScaleContentPageDTO> getList(ScaleContentPageVO scaleContentPageVO);
-//
-//
-//    /**
-//     * 返回量表内容
-//     *
-//     * @param scaleId
-//     * @return
-//     */
-//    public List<ScaleContentDTO> getByParam(Long scaleId);
+
+
+    /**
+     * 量表检索
+     *
+     * @param scaleContentIndexVO
+     * @return
+     */
+    public List<ScaleContentIndexDTO> index(ScaleContentIndexVO scaleContentIndexVO);
+
+
+    /**
+     * 返回量表内容
+     *
+     * @param conceptId
+     * @return
+     */
+    public List<ScaleContentDTO> getByParam(Long conceptId);
 }

+ 23 - 9
knowledgeman-service/src/main/java/com/diagbot/service/ScaleContentService.java

@@ -2,10 +2,15 @@ package com.diagbot.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.ScaleContentDTO;
+import com.diagbot.dto.ScaleContentIndexDTO;
 import com.diagbot.dto.ScaleContentPageDTO;
 import com.diagbot.entity.ScaleContent;
+import com.diagbot.vo.ScaleContentIndexVO;
 import com.diagbot.vo.ScaleContentPageVO;
 
+import java.util.List;
+
 /**
  * <p>
  * 量表内容表 服务类
@@ -23,13 +28,22 @@ public interface ScaleContentService extends IService<ScaleContent> {
      * @return
      */
     IPage<ScaleContentPageDTO> getList(ScaleContentPageVO scaleContentPageVO);
-//
-//
-//    /**
-//     * 返回量表内容
-//     *
-//     * @param scaleId
-//     * @return
-//     */
-//    public List<ScaleContentDTO> getByParam(Long scaleId);
+
+
+    /**
+     * 量表检索
+     *
+     * @param scaleContentIndexVO
+     * @return
+     */
+    public List<ScaleContentIndexDTO> index(ScaleContentIndexVO scaleContentIndexVO);
+
+
+    /**
+     * 返回量表内容
+     *
+     * @param conceptId
+     * @return
+     */
+    public List<ScaleContentDTO> getByParam(Long conceptId);
 }

+ 15 - 5
knowledgeman-service/src/main/java/com/diagbot/service/impl/ScaleContentServiceImpl.java

@@ -2,13 +2,18 @@ package com.diagbot.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.ScaleContentDTO;
+import com.diagbot.dto.ScaleContentIndexDTO;
 import com.diagbot.dto.ScaleContentPageDTO;
 import com.diagbot.entity.ScaleContent;
 import com.diagbot.mapper.ScaleContentMapper;
 import com.diagbot.service.ScaleContentService;
+import com.diagbot.vo.ScaleContentIndexVO;
 import com.diagbot.vo.ScaleContentPageVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 量表内容表 服务实现类
@@ -25,9 +30,14 @@ public class ScaleContentServiceImpl extends ServiceImpl<ScaleContentMapper, Sca
         return baseMapper.getList(scaleContentPageVO);
     }
 
-//
-//    @Override
-//    public List<ScaleContentDTO> getByParam(Long scaleId) {
-//        return baseMapper.getByParam(scaleId);
-//    }
+    @Override
+    public List<ScaleContentIndexDTO> index(ScaleContentIndexVO scaleContentIndexVO) {
+        return baseMapper.index(scaleContentIndexVO);
+    }
+
+
+    @Override
+    public List<ScaleContentDTO> getByParam(Long conceptId) {
+        return baseMapper.getByParam(conceptId);
+    }
 }

+ 24 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/ScaleContentIndexVO.java

@@ -0,0 +1,24 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @description:
+ * @author: ztg
+ * @date: 2019/5/9 11:27
+ */
+@Getter
+@Setter
+public class ScaleContentIndexVO {
+    @ApiModelProperty(value = "量表名称")
+    @NotBlank(message="名称不能为空")
+    private String name;
+
+    @ApiModelProperty(value = "量表类型", hidden = true)
+    private int libType;
+
+}

+ 9 - 2
knowledgeman-service/src/main/java/com/diagbot/vo/ScaleContentPageVO.java

@@ -1,6 +1,7 @@
 package com.diagbot.vo;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -12,6 +13,12 @@ import lombok.Setter;
 @Getter
 @Setter
 public class ScaleContentPageVO extends Page {
-    private String status; //状态值
-    private String name;   //量表名称
+    @ApiModelProperty(value = "状态值,已删除=Y,启用中=N")
+    private String status;
+
+    @ApiModelProperty(value = "量表名称")
+    private String name;
+
+    @ApiModelProperty(value = "量表类型", hidden = true)
+    private int libType;
 }

+ 21 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/ScaleContentParamVO.java

@@ -0,0 +1,21 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @description:
+ * @author: ztg
+ * @date: 2019/5/9 11:27
+ */
+@Getter
+@Setter
+public class ScaleContentParamVO {
+    @ApiModelProperty(value = "量表概念id")
+    @NotNull(message="量表概念id不能为空")
+    private Long conceptId;
+
+}

+ 26 - 5
knowledgeman-service/src/main/java/com/diagbot/web/ScaleContentController.java

@@ -4,10 +4,14 @@ package com.diagbot.web;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.ScaleContentDTO;
+import com.diagbot.dto.ScaleContentIndexDTO;
 import com.diagbot.dto.ScaleContentPageDTO;
 import com.diagbot.facade.ScaleContentFacade;
 import com.diagbot.vo.DeleteScaleVO;
+import com.diagbot.vo.ScaleContentIndexVO;
 import com.diagbot.vo.ScaleContentPageVO;
+import com.diagbot.vo.ScaleContentParamVO;
 import com.diagbot.vo.ScaleContentSaveVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * <p>
@@ -46,16 +51,32 @@ public class ScaleContentController {
     }
 
 
-    @ApiOperation(value = "知识库标准化-量表内容分页[by:zhoutg]",
-            notes = "")
-    @PostMapping("/list")
-    @SysLogger("list")
-    public RespDTO<IPage<ScaleContentPageDTO>> list(@RequestBody ScaleContentPageVO questionPageVO) {
+    @ApiOperation(value = "知识库标准化-量表内容分页[by:zhoutg]", notes = "")
+    @PostMapping("/page")
+    @SysLogger("page")
+    public RespDTO<IPage<ScaleContentPageDTO>> page(@RequestBody ScaleContentPageVO questionPageVO) {
         IPage<ScaleContentPageDTO> data = scaleContentFacade.getListFac(questionPageVO);
         return RespDTO.onSuc(data);
     }
 
 
+    @ApiOperation(value = "知识库标准化-量表内容检索[by:zhoutg]", notes = "")
+    @PostMapping("/index")
+    @SysLogger("index")
+    public RespDTO<List<ScaleContentIndexDTO>> index(@Valid @RequestBody ScaleContentIndexVO scaleContentIndexVO) {
+        List<ScaleContentIndexDTO> data = scaleContentFacade.indexFac(scaleContentIndexVO);
+        return RespDTO.onSuc(data);
+    }
+
+
+    @ApiOperation(value = "知识库标准化-根据量表概念id获取内容[by:zhoutg]", notes = "")
+    @PostMapping("/getByConceptId")
+    @SysLogger("getByConceptId")
+    public RespDTO<List<ScaleContentDTO>> getByConceptId(@Valid @RequestBody ScaleContentParamVO scaleContentParamVO) {
+        List<ScaleContentDTO> data = scaleContentFacade.getByParamFac(scaleContentParamVO);
+        return RespDTO.onSuc(data);
+    }
+
     @ApiOperation(value = "知识库标准化-量表内容删除|恢复[by:zhoutg]",
             notes = "ids:量表概念id<br>" +
                     "status: 删除传值'Y'<br>" +

+ 22 - 2
knowledgeman-service/src/main/resources/mapper/ScaleContentMapper.xml

@@ -19,8 +19,28 @@
         <if test="name != null and name != ''">
             and b.lib_name like concat('%',#{name} ,'%' )
         </if>
-        and b.lib_type = 48
-        ORDER BY a.is_deleted, a.gmt_modified
+        and b.lib_type = #{libType}
+        ORDER BY a.is_deleted, a.gmt_modified desc
+    </select>
+
+
+    <select id="index" resultType="com.diagbot.dto.ScaleContentIndexDTO">
+        SELECT a.lib_name name, a.id concept_id FROM `kl_concept` a
+        where a.is_deleted = 'N'
+        and a.lib_type = #{libType}
+        <if test="name != null and name != ''">
+            and a.lib_name like concat('%',#{name} ,'%' )
+        </if>
+        and not EXISTS(select 1 from kl_scale where a.id = concept_id)
+        order by a.gmt_modified desc
+    </select>
+
+
+    <select id="getByParam" resultType="com.diagbot.dto.ScaleContentDTO">
+        SELECT * FROM `kl_scale` a
+        where  a.is_deleted = 'N'
+        and a.concept_id = #{conceptId}
+        ORDER BY a.order_no
     </select>