Browse Source

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

wangyu 6 years ago
parent
commit
d0385669bf

+ 6 - 0
config-server/src/main/resources/shared/icssman-service-dev.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 1MB
+      max-request-size: 1MB
+
   cloud:
     stream:
       bindings:

+ 6 - 0
config-server/src/main/resources/shared/icssman-service-local.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 1MB
+      max-request-size: 1MB
+
   cloud:
     stream:
       bindings:

+ 6 - 0
config-server/src/main/resources/shared/icssman-service-pro.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 1MB
+      max-request-size: 1MB
+
   cloud:
     stream:
       bindings:

+ 6 - 0
config-server/src/main/resources/shared/icssman-service-test.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 1MB
+      max-request-size: 1MB
+
   cloud:
     stream:
       bindings:

+ 1 - 0
icss-service/src/main/java/com/diagbot/web/DiseaseController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("/disease")
+@SuppressWarnings("unchecked")
 @Api(value = "诊断相关API", tags = { "诊断相关API" })
 public class DiseaseController {
 

+ 2 - 1
icssman-service/src/main/java/com/diagbot/exception/ServiceErrorCode.java

@@ -9,7 +9,8 @@ package com.diagbot.exception;
  */
 public enum ServiceErrorCode implements ErrorCode {
     FILE_UPLOAD_ERROE("12020001", "文件上传出错"),
-    FILE_DELETE_ERROR("12020002", "远程删除文件出错");
+    FILE_DELETE_ERROR("12020002", "远程删除文件出错"),
+    FILE_MAX_SIZE_LIMIT("12020003","文件大小超出限制");
 
     private String code;
     private String msg;

+ 5 - 2
icssman-service/src/main/java/com/diagbot/facade/DeptVitalFacade.java

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Component;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -111,8 +112,10 @@ public class DeptVitalFacade extends DeptVitalServiceImpl implements DeptVitalSe
         deptVitalQueryWrapper.eq("dept_id", deptId).
                 eq("is_deleted", IsDeleteEnum.N.getKey());
         List<DeptVital> deptVitalList = this.list(deptVitalQueryWrapper);
-        Map<Long, DeptVital> vitalIdsMap = EntityUtil.makeEntityMap(deptVitalList, "vitalId");
-        List<QuestionInfo> vitalList = Lists.newArrayList(questionInfoFacade.listByIds(vitalIdsMap.keySet()));
+        List<Long> vitalIds = deptVitalList.stream()
+                .map(deptVitals -> deptVitals.getVitalId())
+                .collect(Collectors.toList());
+        List<QuestionInfo> vitalList = Lists.newArrayList(questionInfoFacade.listByIds(vitalIds));
         return vitalList;
     }
 }

+ 12 - 8
icssman-service/src/main/java/com/diagbot/service/impl/UploadServiceImpl.java

@@ -26,12 +26,16 @@ public class UploadServiceImpl implements UploadService {
         if (file.isEmpty()) {
             throw new CommonException(ServiceErrorCode.FILE_UPLOAD_ERROE, "文件不能为空");
         }
+        //文件大小上限1M
+        if (file.getSize() > 1024 * 1024) {
+            throw new CommonException(ServiceErrorCode.FILE_MAX_SIZE_LIMIT, "文件上传失败,超出大小限制1MB");
+        }
         try {
             // Get the file and save it somewhere
             path = saveFile(file);
         } catch (Exception e) {
-            log.error("upload file failed", e);
-            throw new CommonException(ServiceErrorCode.FILE_UPLOAD_ERROE, "upload file failed");
+            log.error("文件上传失败", e);
+            throw new CommonException(ServiceErrorCode.FILE_UPLOAD_ERROE, "文件上传失败,请重新上传");
         }
         return path;
     }
@@ -57,12 +61,12 @@ public class UploadServiceImpl implements UploadService {
         try {
             fileAbsolutePath = FastDFSClient.upload(file);  //upload to fastdfs
         } catch (Exception e) {
-            log.error("upload file Exception!", e);
-            throw new CommonException(ServiceErrorCode.FILE_UPLOAD_ERROE, "upload file Exception");
+            log.error("文件上传异常", e);
+            throw new CommonException(ServiceErrorCode.FILE_UPLOAD_ERROE, "文件上传异常");
         }
         if (fileAbsolutePath == null) {
-            log.error("upload file failed,please upload again!");
-            throw new CommonException(ServiceErrorCode.FILE_UPLOAD_ERROE, "upload file failed,please upload again");
+            log.error("文件上传失败,请重新上传");
+            throw new CommonException(ServiceErrorCode.FILE_UPLOAD_ERROE, "文件上传失败,请重新上传");
         }
         String path = "/" + fileAbsolutePath[0] + "/" + fileAbsolutePath[1];
         return path;
@@ -85,8 +89,8 @@ public class UploadServiceImpl implements UploadService {
             FastDFSClient.deleteFile(groupName, fileName);
         } catch (Exception e) {
             log.error("", e);
-            throw new CommonException(ServiceErrorCode.FILE_DELETE_ERROR, "delete file failed");
+            throw new CommonException(ServiceErrorCode.FILE_DELETE_ERROR, "文件删除失败");
         }
         return true;
     }
-}
+}

+ 4 - 0
icssman-service/src/main/java/com/diagbot/web/DeptVitalController.java

@@ -10,6 +10,7 @@ import com.diagbot.vo.DeptVitalVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -40,6 +41,7 @@ public class DeptVitalController {
                     "vitalIds:查体标签ids,必填<br>")
     @PostMapping("/saveDeptVitals")
     @SysLogger("saveDeptVitals")
+    @Transactional
     public RespDTO<Boolean> saveDeptVitals(@RequestBody DeptVitalVO deptVitalVO) {
         Boolean data = deptVitalFacade.saveDeptVitals(deptVitalVO);
         return RespDTO.onSuc(data);
@@ -50,6 +52,7 @@ public class DeptVitalController {
                     "vitalIds:查体标签ids,必填<br>")
     @PostMapping("/delDeptVitalList")
     @SysLogger("delDeptVitalList")
+    @Transactional
     public RespDTO<Boolean> delDeptVitalList(@RequestBody DeptVitalVO deptVitalVO) {
         Boolean data = deptVitalFacade.delDeptVitalList(deptVitalVO);
         return RespDTO.onSuc(data);
@@ -59,6 +62,7 @@ public class DeptVitalController {
             notes = "deptId:科室ID,必填<br>")
     @PostMapping("/delAllDeptVitalList")
     @SysLogger("delAllDeptVitalList")
+    @Transactional
     public RespDTO<Boolean> delAllDeptVitalList(@RequestParam("deptId") Long deptId) {
         Boolean data = deptVitalFacade.delAllDeptVitalList(deptId);
         return RespDTO.onSuc(data);

+ 3 - 0
icssman-service/src/main/java/com/diagbot/web/IntroduceDetailController.java

@@ -8,6 +8,7 @@ import com.diagbot.facade.IntroduceDetailFacade;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -45,6 +46,7 @@ public class IntroduceDetailController {
             notes = "id: id,必填")
     @PostMapping("/deleteRecord")
     @SysLogger("deleteRecord")
+    @Transactional
     public RespDTO<Boolean> deleteRecord(@RequestParam Long id) {
         Boolean data = introduceDetailFacade.removeById(id);
         return RespDTO.onSuc(data);
@@ -54,6 +56,7 @@ public class IntroduceDetailController {
             notes = "ids: ids,必填")
     @PostMapping("/deleteRecords")
     @SysLogger("deleteRecords")
+    @Transactional
     public RespDTO<Boolean> deleteRecords(@RequestParam Long[] ids) {
         Boolean data = introduceDetailFacade.removeByIds(Arrays.asList(ids));
         return RespDTO.onSuc(data);

+ 4 - 0
icssman-service/src/main/java/com/diagbot/web/IntroduceInfoController.java

@@ -11,6 +11,7 @@ import com.diagbot.vo.IntroduceVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -50,6 +51,7 @@ public class IntroduceInfoController {
                     "position:显示位置<br>")
     @PostMapping("/saveIntroduce")
     @SysLogger("saveIntroduce")
+    @Transactional
     public RespDTO<Boolean> saveIntroduce(@RequestBody @Valid IntroduceVO introduceVO) {
         Boolean data = introduceInfoFacade.saveIntroduce(introduceVO);
         return RespDTO.onSuc(data);
@@ -59,6 +61,7 @@ public class IntroduceInfoController {
             notes = "id: id,必填")
     @PostMapping("/deleteRecord")
     @SysLogger("deleteRecord")
+    @Transactional
     public RespDTO<Boolean> deleteRecord(@RequestParam Long id) {
         Boolean data = introduceInfoFacade.deleteRecord(id);
         return RespDTO.onSuc(data);
@@ -68,6 +71,7 @@ public class IntroduceInfoController {
             notes = "ids: ids,必填")
     @PostMapping("/deleteRecords")
     @SysLogger("deleteRecords")
+    @Transactional
     public RespDTO<Boolean> deleteRecords(@RequestParam Long[] ids) {
         Boolean data = introduceInfoFacade.deleteRecords(ids);
         return RespDTO.onSuc(data);

+ 3 - 0
icssman-service/src/main/java/com/diagbot/web/IntroduceMapController.java

@@ -8,6 +8,7 @@ import com.diagbot.vo.IntroduceMapVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -36,6 +37,7 @@ public class IntroduceMapController {
                     "type: 标签类型,必填")
     @PostMapping("/saveIntroduceMap")
     @SysLogger("saveIntroduceMap")
+    @Transactional
     public RespDTO<Boolean> saveIntroduceMap(@RequestBody IntroduceMapVO introduceMapVO) {
         Boolean data = introduceMapFacade.saveIntroduceMap(introduceMapVO);
         return RespDTO.onSuc(data);
@@ -47,6 +49,7 @@ public class IntroduceMapController {
                     "type: 标签类型,必填")
     @PostMapping("/delIntroduceMap")
     @SysLogger("delIntroduceMap")
+    @Transactional
     public RespDTO<Boolean> delIntroduceMap(@RequestBody IntroduceMapVO introduceMapVO) {
         Boolean data = introduceMapFacade.delIntroduceMap(introduceMapVO);
         return RespDTO.onSuc(data);

+ 4 - 0
icssman-service/src/main/java/com/diagbot/web/ModuleInfoController.java

@@ -7,6 +7,7 @@ import com.diagbot.facade.ModuleInfoFacade;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("/moduleInfo")
+@SuppressWarnings("unchecked")
 @Api(value = "标签模板相关API", tags = { "标签模板相关API" })
 public class ModuleInfoController {
 
@@ -32,6 +34,7 @@ public class ModuleInfoController {
             notes = "")
     @PostMapping("/saveOrUpdate")
     @SysLogger("saveOrUpdate")
+    @Transactional
     public RespDTO<Boolean> saveOrUpdate() {
 
         return RespDTO.onSuc(true);
@@ -42,6 +45,7 @@ public class ModuleInfoController {
             notes = "")
     @PostMapping("/delete")
     @SysLogger("delete")
+    @Transactional
     public RespDTO<Boolean> delete(String ids) {
         moduleInfoFacade.deleteByIdsFac(ids);
         return RespDTO.onSuc(true);

+ 2 - 0
icssman-service/src/main/java/com/diagbot/web/QuestionInfoController.java

@@ -27,6 +27,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/questionInfo")
+@SuppressWarnings("unchecked")
 @Api(value = "标签相关API——数据谨慎操作", tags = { "标签相关API——数据谨慎操作" })
 public class QuestionInfoController {
 
@@ -37,6 +38,7 @@ public class QuestionInfoController {
             notes = "")
     @PostMapping("/saveOrUpdate")
     @SysLogger("saveOrUpdate")
+    @Transactional
     public RespDTO<Boolean> saveOrUpdate() {
 
         return RespDTO.onSuc(true);

+ 2 - 0
icssman-service/src/main/java/com/diagbot/web/RetrievalController.java

@@ -5,6 +5,7 @@ import java.util.List;
 import javax.validation.Valid;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -48,6 +49,7 @@ public class RetrievalController {
     @ApiOperation(value = "根据映射关系删除标签的同义词[by:rengb]")
 	@PostMapping("/delRetrievalsByMaps")
 	@SysLogger("delRetrievalsByMaps")
+	@Transactional
 	public RespDTO<List<Boolean>> delRetrievalsByMaps(@Valid @RequestBody DelRetrievalsByMapsVO delRetrievalsByMapsVO) {
 		return RespDTO.onSuc(retrievalFacede.delRetrievalsByMaps(delRetrievalsByMapsVO));
 	}

+ 4 - 0
icssman-service/src/main/java/com/diagbot/web/VitalOrderController.java

@@ -10,6 +10,7 @@ import com.diagbot.vo.VitalOrderVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -40,6 +41,7 @@ public class VitalOrderController {
                     "orderNo:查体排序号,必填<br>")
     @PostMapping("/saveAll")
     @SysLogger("saveAll")
+    @Transactional
     public RespDTO<Boolean> saveAll(@RequestBody List<VitalOrderVO> vitalOrderVOList) {
         Boolean data = vitalOrderFacade.saveAll(vitalOrderVOList);
         return RespDTO.onSuc(data);
@@ -57,6 +59,7 @@ public class VitalOrderController {
             notes = "vitalId:查体标签ID,必填<br>")
     @PostMapping("/deleteVitalOrder")
     @SysLogger("deleteVitalOrder")
+    @Transactional
     public RespDTO<Boolean> deleteVitalOrder(@RequestParam("vitalId") Long vitalId) {
         Boolean data = vitalOrderFacade.deleteVitalOrder(vitalId);
         return RespDTO.onSuc(data);
@@ -66,6 +69,7 @@ public class VitalOrderController {
             notes = "vitalIds:查体标签ID,必填<br>")
     @PostMapping("/deleteVitalOrders")
     @SysLogger("deleteVitalOrders")
+    @Transactional
     public RespDTO<Boolean> deleteVitalOrders(@RequestParam("vitalIds") Long[] vitalIds) {
         Boolean data = vitalOrderFacade.deleteVitalOrders(vitalIds);
         return RespDTO.onSuc(data);