Browse Source

Merge remote-tracking branch 'origin/dev/precSR' into dev/precSR

wangyu 6 years ago
parent
commit
252db2492c

+ 3 - 3
precman-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -26,10 +26,10 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .csrf().disable()
                 .authorizeRequests()
                 .regexMatchers(".*swagger.*", ".*v2.*", ".*webjars.*", "/druid.*", "/actuator.*", "/hystrix.*").permitAll()
-                .antMatchers("/file/uploadImage").permitAll()
-                .antMatchers("/dictionaryInfo/getList").permitAll()
+                .antMatchers("/file_prec/uploadImage").permitAll()
+                .antMatchers("/dictionaryInfo_prec/getList").permitAll()
                 .antMatchers("/**").authenticated();
-        //        .antMatchers("/**").permitAll();
+//                .antMatchers("/**").permitAll();
     }
 
 

+ 2 - 2
precman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -89,8 +89,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/druid/**", request)
                 || matchers("/actuator/**", request)
                 || matchers("/hystrix/**", request)
-                || matchers("/file/uploadImage", request)
-                || matchers("/dictionaryInfo/getList", request)
+                || matchers("/file_prec/uploadImage", request)
+                || matchers("/dictionaryInfo_prec/getList", request)
                 || matchers("/", request)) {
             return true;
         }

+ 11 - 1
precman-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -291,13 +291,23 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
             paramMap.put("ids", Arrays.asList(ids.split(",")));
             paramMap.put("gmtModified", now);
             paramMap.put("modifier", person);
+            // 映射关系删除校验,如果有父项关联,不能删除
+            List<QuestionInfo> questionInfoList = getParentQuestion(Long.parseLong(id));
+            if (ListUtil.isNotEmpty(questionInfoList)) {
+                StringBuffer sb = new StringBuffer();
+                sb.append("请先删除上级关联:");
+                for (QuestionInfo ques : questionInfoList) {
+                    sb.append("【" + ques.getTagName() + "】");
+                }
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        sb.toString());
+            }
             //删除自身
             this.deleteByIds(paramMap);
             //删除明细
             questionDetailFacade.deleteByQuestionIdFac(paramMap);
             //删除映射关系
             questionMappingFacade.deleteByIdsFac(paramMap);
-            //TODO 删除映射关系或检查抛异常
         }
         return true;
     }

+ 0 - 4
precman-service/src/main/resources/mapper/QuestionMappingMapper.xml

@@ -31,10 +31,6 @@
             <foreach item="id" collection="ids" open="(" separator="," close=")" >
                 #{id}
             </foreach>
-            or son_question in
-            <foreach item="id" collection="ids" open="(" separator="," close=")" >
-                #{id}
-            </foreach>
         )
     </delete>