Browse Source

Merge remote-tracking branch 'origin/master'

jiafei 4 months ago
parent
commit
a70296d28f
14 changed files with 731 additions and 376 deletions
  1. 48 0
      yudao-module-museum/yudao-module-museum-api/src/main/java/cn/iocoder/yudao/module/museum/enums/social/LogRecordConstants.java
  2. 261 261
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museumflow/MuseumFlowController.java
  3. 72 0
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museumflow/vo/MuseumFlowInfoVO.java
  4. 0 2
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museumflow/vo/MuseumFlowSaveVO.java
  5. 99 24
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/MuseumInfoController.java
  6. 3 2
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/vo/MuseumInfoRespVO.java
  7. 2 1
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/vo/MuseumInfoSaveVO.java
  8. 36 27
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/dal/mysql/museumflow/MuseumFlowMapper.java
  9. 46 7
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/dal/mysql/museuminfo/MuseumInfoMapper.java
  10. 16 10
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museumflow/MuseumFlowService.java
  11. 38 20
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museumflow/MuseumFlowServiceImpl.java
  12. 30 11
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museuminfo/MuseumInfoService.java
  13. 80 10
      yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museuminfo/MuseumInfoServiceImpl.java
  14. 0 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java

+ 48 - 0
yudao-module-museum/yudao-module-museum-api/src/main/java/cn/iocoder/yudao/module/museum/enums/social/LogRecordConstants.java

@@ -0,0 +1,48 @@
+package cn.iocoder.yudao.module.museum.enums.social;
+
+/**
+ * Museum 操作日志枚举
+ * 目的:统一管理,也减少 Service 里各种“复杂”字符串
+ *
+ * @author 芋道源码
+ */
+public interface LogRecordConstants {
+
+    // ======================= SYSTEM_USER 用户 =======================
+
+    String SYSTEM_USER_TYPE = "SYSTEM 用户";
+    String SYSTEM_USER_CREATE_SUB_TYPE = "创建用户";
+    String SYSTEM_USER_CREATE_SUCCESS = "创建了用户【{{#user.nickname}}】";
+    String SYSTEM_USER_UPDATE_SUB_TYPE = "更新用户";
+    String SYSTEM_USER_UPDATE_SUCCESS = "更新了用户【{{#user.nickname}}】: {_DIFF{#updateReqVO}}";
+    String SYSTEM_USER_DELETE_SUB_TYPE = "删除用户";
+    String SYSTEM_USER_DELETE_SUCCESS = "删除了用户【{{#user.nickname}}】";
+    String SYSTEM_USER_UPDATE_PASSWORD_SUB_TYPE = "重置用户密码";
+    String SYSTEM_USER_UPDATE_PASSWORD_SUCCESS = "将用户【{{#user.nickname}}】的密码从【{{#user.password}}】重置为【{{#newPassword}}】";
+
+    // ======================= SYSTEM_ROLE 角色 =======================
+
+    String SYSTEM_ROLE_TYPE = "SYSTEM 角色";
+    String SYSTEM_ROLE_CREATE_SUB_TYPE = "创建角色";
+    String SYSTEM_ROLE_CREATE_SUCCESS = "创建了角色【{{#role.name}}】";
+    String SYSTEM_ROLE_UPDATE_SUB_TYPE = "更新角色";
+    String SYSTEM_ROLE_UPDATE_SUCCESS = "更新了角色【{{#role.name}}】: {_DIFF{#updateReqVO}}";
+    String SYSTEM_ROLE_DELETE_SUB_TYPE = "删除角色";
+    String SYSTEM_ROLE_DELETE_SUCCESS = "删除了角色【{{#role.name}}】";
+
+    // 操作类型常量
+    String MUSEUM_TYPE = "MUSEUM 标本";
+    String CREATE_SUB_TYPE = "入库记录";
+    String CREATE_SUB_TYPE_SUCCESS = "标本【{{#sampleId.chineseName}}】入库成功";
+    String UPDATE_SUB_TYPE = "更新记录";
+    String UPDATE_SUB_TYPE_SUCCESS = "更新了标本【{{#sampleId.chineseName}}】: {_DIFF{#MuseumInfoSaveVO}}";
+    String DELETE_SUB_TYPE = "删除记录";
+    String DELETE_SUB_TYPE_SUCCESS = "删除了标本【{{#sampleId.chineseName}}】";
+    String OUT_MUSEUM_SUB_TYPE = "出库记录";
+    String OUT_MUSEUM_SUB_TYPE_SUCCESS = "标本【{{#sampleId.chineseName}}】出库成功 : {_DIFF{#MuseumInfoSaveVO}}";
+    String BACK_MUSEUM_SUB_TYPE = "回库记录";
+    String BACK_MUSEUM_SUB_TYPE_SUCCESS = "标本【{{#sampleId.chineseName}}】回库成功";
+
+
+
+}

+ 261 - 261
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museumflow/MuseumFlowController.java

@@ -5,20 +5,28 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.*;
 import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoPageReqVO;
+
 import cn.iocoder.yudao.module.museum.dal.database.museumflow.MuseumFlowDO;
 import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
-import cn.iocoder.yudao.module.museum.dal.mysql.museumflow.MuseumFlowMapper;
 import cn.iocoder.yudao.module.museum.service.museumflow.MuseumFlowService;
 import cn.iocoder.yudao.module.museum.service.museuminfo.MuseumInfoService;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper;
+import cn.iocoder.yudao.module.system.service.permission.PermissionService;
+import cn.iocoder.yudao.module.system.service.permission.RoleService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
 
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.*;
+
+
 @Tag(name = "博物馆-出回库管理")
 @RestController
 @RequestMapping("/museum/flow")
@@ -27,6 +35,13 @@ public class MuseumFlowController {
     @Resource
     private MuseumFlowService museumFlowService;
     private MuseumInfoService museumInfoService;
+    @Resource
+    private RoleService roleService;
+    @Resource
+    private UserRoleMapper userRoleMapper;
+    @Resource
+    private PermissionService permissionService;
+
 
     @PostMapping("/create")
     @Operation(summary = "新增表单")
@@ -36,351 +51,336 @@ public class MuseumFlowController {
 
     @PutMapping("/update")
     @Operation(summary = "更新表单")
-    public CommonResult<Boolean> updateMuseumFlow(@RequestBody MuseumFlowSaveVO saveVO){
-        museumFlowService.updateMuseumFlow(saveVO);
-        return CommonResult.success(true);
+    public CommonResult<Boolean> updateMuseumFlow(@RequestBody MuseumFlowSaveVO saveVO) {
+        Long UserId = getLoginUserId();
+        if (permissionService.hasAnyRoles(UserId, "operate")) {
+            museumFlowService.updateMuseumFlow(saveVO);
+            return CommonResult.success(true);
+        } else {
+            return CommonResult.error(200, "您无此权限");
+        }
     }
 
     @DeleteMapping("/delete")
     @Operation(summary = "删除表单")
-    public CommonResult<Boolean> deleteMuseumFlow(@RequestParam("id") Integer id){
-        museumFlowService.deleteMuseumFlow(id);
-        return CommonResult.success(true);
+    public CommonResult<Boolean> deleteMuseumFlow(@RequestParam("id") Integer id) {
+        Long UserId = getLoginUserId();
+        if (permissionService.hasAnyRoles(UserId, "operate")) {
+            museumFlowService.deleteMuseumFlow(id);
+            return CommonResult.success(true);
+        } else {
+            return CommonResult.error(200, "您无此权限");
+        }
     }
 
     @GetMapping("/get")
     @Operation(summary = "查找表单")
-    public CommonResult<MuseumFlowRespVO> getMuseumFlow(@RequestParam("id") Integer id){
+    public CommonResult<MuseumFlowRespVO> getMuseumFlow(@RequestParam("id") Integer id) {
         MuseumFlowDO result = museumFlowService.selectMuseumFlow(id);
-        MuseumFlowRespVO result1 = BeanUtils.toBean(result,MuseumFlowRespVO.class);
+        MuseumFlowRespVO result1 = BeanUtils.toBean(result, MuseumFlowRespVO.class);
         return CommonResult.success(result1);
     }
 
+    @GetMapping("/get-info")
+    @Operation(summary = "查找标本信息")
+    public CommonResult<List<MuseumFlowInfoVO>> getMuseumInfo(@RequestParam("number") List<String> number) {
+        Long UserId = getLoginUserId();
+        if (permissionService.hasAnyRoles(UserId, "operate")) {
+            List<MuseumFlowInfoVO> informationList = new ArrayList<>();
+            for (String number1 : number) {
+                MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(number1);
+                if (result == null) {
+                    return CommonResult.error(200, "标本不存在");
+                } else {
+                    MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number1);
+                    MuseumFlowInfoVO event1 = BeanUtils.toBean(event, MuseumFlowInfoVO.class);
+                    List<MuseumInfoDO> information = new ArrayList<>();
+                    information.add(result);
+                    event1.setMuseumInfoDO(information);
+                    informationList.add(event1);
+
+                }
+            }
+            return CommonResult.success(informationList);
+        } else {
+            return CommonResult.error(200, "您无此权限");
+        }
+    }
+
+
+    @GetMapping("/menId")
+    @Operation(summary = "查询身份信息")
+    public CommonResult<Boolean> hasAnyRoles() {
+        Long UserId = getLoginUserId();
+        if (permissionService.hasAnyRoles(UserId, "operate")) {
+            return CommonResult.success(true);
+        } else {
+            return CommonResult.error(200, "无权限");
+        }
+    }
+
     @PostMapping("/outbound")
     @Operation(summary = "添加出库单")
-    public CommonResult<Boolean>  createMuseumFlowOutbound(@RequestBody MuseumFlowSaveVO saveVO) {
-        String sample_id = saveVO.getNumber();
-        String number = saveVO.getNumber();
-        MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-        MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
+    public CommonResult<Boolean> createMuseumFlowOutbound(@RequestBody MuseumFlowSaveVO saveVO) {
+        Long UserId = getLoginUserId();
+        if (permissionService.hasAnyRoles(UserId, "operate")) {
+            String sample_id = saveVO.getNumber();
+            String number = saveVO.getNumber();
+            MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
+            MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
+            AdminUserDO userList = museumFlowService.selectAdminUserDOById(UserId);
 //             Save中 1现为未出库或已回库,0为已出库
 //             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-        //TODO 你这里上面获取了result和event的值再判断他为空,怎么可能为空 ,所以如果为空的话,上面两句就直接报错了
-        if (result == null) {
-            return CommonResult.error(200, "标本不存在");
-        }
-        else{
-            int Save = result.getSave();
-            if (Save == 1) {
-                if (event != null) {
+            if (result == null) {
+                return CommonResult.error(200, "标本不存在");
+            } else {
+                if (event == null) {
+                    int Save = result.getSave();
+                    if (Save == 1) {
+                        LocalDateTime applyTime = LocalDateTime.now();
+                        saveVO.setApplyTime(applyTime);
+                        String name = result.getChineseName();
+                        saveVO.setSampleName(name);//标本名称
+                        museumFlowService.createMuseumFlow(saveVO);
+                        museumFlowService.updateMuseumFlowStateOutbound2(saveVO);//状态2 审批中
+                        return CommonResult.success(true);
+                    }
+                } else {
                     int State = event.getState();
-                    if (State == 2) {
-                    return CommonResult.error(200, "标本正在审批");
+                    if (State == 0) {
+                        return CommonResult.error(200, "标本已回库");
+                    } else if (State == 1) {
+                        return CommonResult.error(200, "标本已出库");
+                    } else if (State == 2) {
+                        return CommonResult.error(200, "标本正在审批");
                     } else if (State == 3) {
                         return CommonResult.error(200, "标本审批已通过");
                     } else if (State == 4) {
                         return CommonResult.error(200, "标本已审批已驳回");
                     }
-                } else {
-                    String name = result.getChineseName();
-                    saveVO.setSampleName(name);
-                    museumFlowService.createMuseumFlow(saveVO);
-                    museumFlowService.updateMuseumFlowStateOutbound2(saveVO);
-                    return CommonResult.success(true);
+                    return CommonResult.error(200, "标本信息已存放在出入库的数据库中");
                 }
-            } else {
-                return CommonResult.error(200, "标本不在库中");
             }
+        } else {
+            return CommonResult.error(200, "您无此操作权限");
         }
         return CommonResult.success(true);
-//        List<String> sample_ids = saveVO.getNumber();
-//        List<String> errorList = new ArrayList<>();
-//        List<String> sample_names = new ArrayList<>();
-//////             Save中 1现为未出库或已回库,0为已出库
-//////             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-//        for (String sample_id : sample_ids) {
-//            MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-//            if (result == null) {
-//                errorList.add(sample_id+"标本不存在");
-//                return CommonResult.error(200, "标本不存在");
-//            }
-//            else {
-//                int save = result.getSave();
-//                String name = result.getChineseName();
-//                if (save == 0) {
-//                    errorList.add(sample_id+"标本不在库中");
-//                    return CommonResult.error(200, "标本不在库中");
-//                }else {
-//                    sample_names.add(name);
-//                }
-//            }
-//        }
-//        if (errorList.isEmpty()) {
-//            saveVO.setSampleName(sample_names);//设置标本名称
-//            museumFlowService.createMuseumFlow(saveVO);//创建表单
-//            museumFlowService.updateMuseumFlowStateOutbound2(saveVO);//更改标本状态为出库
-//
-////            museumFlowService.selectPageS(respVO);
-//            return CommonResult.success(true);
-//        }else {
-//            System.out.println(errorList);
-//            return CommonResult.error(200, "标本存在错误");
-//        }
     }
 
     @PostMapping("outboundEnd")
     @Operation(summary = "出库完成功能")
-    public CommonResult<Boolean> createMuseumFlowOutboundEnd(@RequestBody MuseumFlowReviewVO reviewVO){
-        List<String> sample_ids = reviewVO.getNumber();
-        List<String> errorList = new ArrayList<>();
-        List<String> sample_names = new ArrayList<>();
+    public CommonResult<Boolean> createMuseumFlowOutboundEnd(@RequestBody MuseumFlowReviewVO reviewVO) {
+        Long UserId = getLoginUserId();
+        if (permissionService.hasAnyRoles(UserId, "operate")) {
+            List<String> sample_ids = reviewVO.getNumber();
+            List<String> errorList = new ArrayList<>();
+            List<String> sample_names = new ArrayList<>();
 ////             Save中 1现为未出库或已回库,0为已出库
 ////             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-        for (String sample_id : sample_ids) {
-            MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-            MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(sample_id);
-            String name = result.getChineseName();
-            if (event != null) {
-                int State = event.getState();
-                if (State == 2) {
-                    errorList.add(sample_id+"标本正在审批");
-                }else if (State == 3) {
-                    sample_names.add(name);
-                }else if (State == 4) {
-                    errorList.add(sample_id+"标本审批已驳回");
+            for (String sample_id : sample_ids) {
+                MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(sample_id);
+                if (event != null) {
+                    int State = event.getState();
+                    if (State == 1) {
+                        errorList.add(sample_id + "标本已出库");
+                    } else if (State == 2) {
+                        errorList.add(sample_id + "标本正在审批");
+                    } else if (State == 3) {
+                        AdminUserDO userList = museumFlowService.selectAdminUserDOById(UserId);
+                        String name = event.getSampleName();
+                        sample_names.add(name);
+                        String reviewPerson = userList.getNickname();
+                        reviewVO.setReviewPerson(reviewPerson);
+                    } else if (State == 4) {
+                        errorList.add(sample_id + "标本审批已驳回");
+                    } else if (State == 0) {
+                        errorList.add(sample_id + "标本审批已回库");
+                    }
+                } else {
+                    errorList.add(sample_id + "标本未申请出库");
                 }
-            }else {
-                errorList.add(sample_id+"标本未申请出库");
             }
-        }
-        if (errorList.isEmpty()) {
-            for (String sample_id : sample_ids) {
-                String number = sample_id;
-                museumFlowService.updateMuseumFlowStateOutbound1(number);
+            if (errorList.isEmpty()) {
+                for (String sample_id : sample_ids) {
+                    museumFlowService.updateMuseumFlowStateOutbound1(sample_id);
+                    museumFlowService.updateMuseumFlowSave0(sample_id);
+                }
+                LocalDateTime outboundTime = LocalDateTime.now();
+                reviewVO.setOutboundTime(outboundTime);
+                reviewVO.setSampleName(sample_names);//设置标本名称
+                reviewVO.setState(1);
+                museumFlowService.createMuseumFlowReview(reviewVO);//创建表单
+                return CommonResult.success(true);
+            } else {
+                System.out.println(errorList);
+                return CommonResult.error(200, errorList.toString());
             }
-            reviewVO.setSampleName(sample_names);//设置标本名称
-            museumFlowService.createMuseumFlowReview(reviewVO);//创建表单
-            museumFlowService.updateMuseumFlowStateOutbounds1(reviewVO);//更改标本状态为出库
-
-//            museumFlowService.selectPageS(respVO);
-            return CommonResult.success(true);
-        }else {
-            System.out.println(errorList);
-            return CommonResult.error(200, errorList.toString());
+        } else {
+            return CommonResult.error(200, "您无此操作权限");
         }
     }
 
     @GetMapping("/selectPageS")
     @Operation(summary = "获取关于标本信息的分页")
-    public PageResult<MuseumInfoDO> selectPageS(@Valid MuseumInfoPageReqVO pageVO){
-           return museumInfoService.getMuseumInfoPage(pageVO);
+    public PageResult<MuseumInfoDO> selectPageS(@Valid MuseumInfoPageReqVO pageVO) {
+        return museumInfoService.getMuseumInfoPage(pageVO);
     }
 
     @GetMapping("/pagePerson")
     @Operation(summary = "获取关于出库员的分页")
-    public PageResult<MuseumFlowDO> selectMuseumFlowOutboundPerson(@Valid MuseumFlowPageVO pageVO){
-        return  museumFlowService.selectPageMuseumFlowOutboundPerson(pageVO);
+    public PageResult<MuseumFlowDO> selectMuseumFlowOutboundPerson(@Valid MuseumFlowPageVO pageVO) {
+        return museumFlowService.selectPageMuseumFlowOutboundPerson(pageVO);
     }
 
     @PostMapping("/review")
     @Operation(summary = "通过的审批单")
     public CommonResult<Boolean> createMuseumFlowReview(@RequestBody MuseumFlowReviewVO reviewVO) {
+        Long UserId = getLoginUserId();
         List<String> sample_ids = reviewVO.getNumber();
         List<String> errorList = new ArrayList<>();
         List<String> sample_names = new ArrayList<>();
 ////             Save中 1现为未出库或已回库,0为已出库
 ////             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-        for (String sample_id : sample_ids) {
-            MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-            MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(sample_id);
-            String name = result.getChineseName();
+        if (permissionService.hasAnyRoles(UserId, "leader")) {
+            for (String sample_id : sample_ids) {
+                MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
+                MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(sample_id);
+                String name = result.getChineseName();
                 if (event != null) {
                     int State = event.getState();
                     if (State == 2) {
                         sample_names.add(name);
-                    }else if (State == 3) {
-                        errorList.add(sample_id+"标本审批已通过");
-                    }else if (State == 4) {
-                        errorList.add(sample_id+"标本审批已驳回");
+                    } else if (State == 3) {
+                        errorList.add(sample_id + "标本审批已通过");
+                    } else if (State == 4) {
+                        errorList.add(sample_id + "标本审批已驳回");
+                    } else {
+                        if (State == 0) {
+                            errorList.add(sample_id + "标本审批已回库");
+                        } else if (State == 1) {
+                            errorList.add(sample_id + "标本已出库");
+                        }
                     }
-                }else {
-                    errorList.add(sample_id+"标本未申请出库");
+                } else {
+                    errorList.add(sample_id + "标本未申请出库");
                 }
-        }
-        if (errorList.isEmpty()) {
-            for (String sample_id : sample_ids) {
-                String number = sample_id;
-                museumFlowService.updateMuseumFlowStateReview3(number);
             }
-            reviewVO.setSampleName(sample_names);//设置标本名称
-            museumFlowService.createMuseumFlowReview(reviewVO);//创建表单
-            museumFlowService.updateMuseumFlowStateReviews3(reviewVO);//更改标本状态为出库
-
-//            museumFlowService.selectPageS(respVO);
-            return CommonResult.success(true);
-        }else {
-            System.out.println(errorList);
-            return CommonResult.error(200, errorList.toString());
+            if (errorList.isEmpty()) {
+                for (String sample_id : sample_ids) {
+                    museumFlowService.updateMuseumFlowStateReview3(sample_id);
+                }
+                AdminUserDO userList = museumFlowService.selectAdminUserDOById(UserId);
+                String reviewPerson = userList.getNickname();
+                reviewVO.setReviewPerson(reviewPerson);
+                reviewVO.setSampleName(sample_names);//设置标本名称
+                LocalDateTime reviewTime = LocalDateTime.now();
+                reviewVO.setReviewTime(reviewTime);
+                museumFlowService.createMuseumFlowReview(reviewVO);//创建表单
+                museumFlowService.updateMuseumFlowStateReviews3(reviewVO);//更改标本状态为3 审批通过
+                return CommonResult.success(true);
+            } else {
+                System.out.println(errorList);
+                return CommonResult.error(200, errorList.toString());
+            }
+        } else {
+            return CommonResult.error(200, "您无此操作权限");
         }
     }
-//        String sample_id = reviewVO.getNumber();
-//        String number = reviewVO.getNumber();
-//        MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-//        MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
-//
-//        int Save = result.getSave();
-//        int State = event.getState();
-////             Save中 0现为未出库或已回库,1为已出库
-////             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-//        //TODO 你这里上面获取了result和event的值再判断他为空,怎么可能为空 ,所以如果为空的话,上面两句就直接报错了
-//        if (result == null) {
-//            return CommonResult.error(200, "样品不存在");
-//        } else if (event == null) {
-//            return CommonResult.error(200, "样品在出入库的库中不存在");
-//        }
-//        else if (Save == 0) {
-//            return CommonResult.error(200, "样品并未申请出库");
-//        } else if (Save == 1) {
-//            if (State == 2) {
-//                museumFlowService.createMuseumFlowReview(reviewVO);
-//                museumFlowService.updateMuseumFlowStateReview3(reviewVO);
-//                return CommonResult.success(true);
-//            } else if (State == 3) {
-//                return CommonResult.error(200, "样品已审批通过");
-//            } else if (State == 4) {
-//                return CommonResult.error(200, "样品审批已被驳回");
-//            }
-//        } else {
-//            return CommonResult.error(200, "样品已审批通过并出库");
-//        }
 
     @PostMapping("/reject")
     @Operation(summary = "新增驳回的审批单")
     public CommonResult<Boolean> createMuseumFlowReject(@RequestBody MuseumFlowReviewVO reviewVO) {
+        Long UserId = getLoginUserId();
         List<String> sample_ids = reviewVO.getNumber();
         List<String> errorList = new ArrayList<>();
         List<String> sample_names = new ArrayList<>();
 ////             Save中 1现为未出库或已回库,0为已出库
 ////             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-        for (String sample_id : sample_ids) {
-            MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-            MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(sample_id);
-            String name = result.getChineseName();
-            if (event != null) {
-                int State = event.getState();
-                if (State == 2) {
-                    sample_names.add(name);
-                }else if (State == 3) {
-                    errorList.add(sample_id+"标本审批已通过");
-                }else if (State == 4) {
-                    errorList.add(sample_id+"标本审批已驳回");
-                }
-            }else {
-                errorList.add(sample_id+"标本未申请出库");
-            }
-        }
-        if (errorList.isEmpty()) {
+        if (permissionService.hasAnyRoles(UserId, "leader")) {
             for (String sample_id : sample_ids) {
-                String number = sample_id;
-                museumFlowService.updateMuseumFlowStateReview4(number);
+                MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
+                MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(sample_id);
+                String name = result.getChineseName();
+                if (event != null) {
+                    int State = event.getState();
+                    if (State == 2) {
+                        sample_names.add(name);
+                    } else if (State == 3) {
+                        errorList.add(sample_id + "标本审批已通过");
+                    } else if (State == 4) {
+                        errorList.add(sample_id + "标本审批已驳回");
+                    } else {
+                        if (State == 0) {
+                            errorList.add(sample_id + "标本审批已回库");
+                        } else if (State == 1) {
+                            errorList.add(sample_id + "标本已出库");
+                        }
+                    }
+                } else {
+                    errorList.add(sample_id + "标本未申请出库");
+                }
             }
-            reviewVO.setSampleName(sample_names);//设置标本名称
-            museumFlowService.createMuseumFlowReview(reviewVO);//创建表单
-            museumFlowService.updateMuseumFlowStateReviews4(reviewVO);//更改标本状态为出库
-
+            if (errorList.isEmpty()) {
+                for (String sample_id : sample_ids) {
+                    museumFlowService.updateMuseumFlowStateReview4(sample_id);
+                }
+                AdminUserDO userList = museumFlowService.selectAdminUserDOById(UserId);
+                String reviewPerson = userList.getNickname();
+                reviewVO.setReviewPerson(reviewPerson);
+                reviewVO.setSampleName(sample_names);//设置标本名称
+                LocalDateTime reviewTime = LocalDateTime.now();
+                reviewVO.setReviewTime(reviewTime);
+                museumFlowService.createMuseumFlowReview(reviewVO);//创建表单
+                museumFlowService.updateMuseumFlowStateReviews4(reviewVO);//更改标本状态为出库
 //            museumFlowService.selectPageS(respVO);
-            return CommonResult.success(true);
-        }else {
-            System.out.println(errorList);
-            return CommonResult.error(200, errorList.toString());
+                return CommonResult.success(true);
+            } else {
+                System.out.println(errorList);
+                return CommonResult.error(200, errorList.toString());
+            }
+        } else {
+            return CommonResult.error(200, "您无此操作权限");
         }
-//        for (String sample_id : sample_ids) {
-//            MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-//            if (result == null) {
-//                errorList.add(sample_id+"标本不存在");
-//            }
-//            else {
-//                int save = result.getSave();
-//                String name = result.getChineseName();
-//                if (save == 0) {
-//                    errorList.add(sample_id+"标本不在库中");
-//                }else {
-//                    sample_names.add(name);
-//                }
-//            }
-//        }
-//        if (errorList.isEmpty()) {
-//            reviewVO.setSampleName(sample_names);//设置标本名称
-//            museumFlowService.createMuseumFlowReview(reviewVO);//创建表单
-//            museumFlowService.updateMuseumFlowStateReview4(reviewVO);
-////            museumFlowService.selectPageS(respVO);
-//            return CommonResult.success(true);
-//        }else {
-//            System.out.println(errorList);
-//            return CommonResult.error(200, "标本存在错误");
-//        }
-//        String sample_id = reviewVO.getNumber();
-//        String number = reviewVO.getNumber();
-//        MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
-//        MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
-//        int Save = result.getSave();
-//        int State = event.getState();
-////             Save中 0现为未出库或已回库,1为已出库
-////             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-//        if (result == null) {
-//            return CommonResult.error(200, "样品不存在");
-//        } else if (event == null) {
-//            return CommonResult.error(200, "样品在出入库的库中不存在");
-//        }
-//        else if (Save == 1) {
-//            return CommonResult.error(200, "样品已出库");
-//        } else if (Save == 0) {
-//            if (State == 2) {
-//                museumFlowService.createMuseumFlowReview(reviewVO);
-//                museumFlowService.updateMuseumFlowStateReview4(reviewVO);
-//                return CommonResult.success(true);
-//            } else if (State == 3) {
-//                return CommonResult.error(200, "样品已审批通过");
-//            } else if (State == 4) {
-//                return CommonResult.error(200, "样品审批已被驳回");
-//            }
-//        } else {
-//            return CommonResult.error(200, "样品已审批通过并出库");
-//        }
-//        return CommonResult.success(true);
     }
 
     @PostMapping("/return")
-    @Operation(summary = "新建回库单")
+    @Operation(summary = "回库功能")
     public CommonResult<Boolean> createMuseumFlowReturn(@RequestBody MuseumFlowReturnVO returnVO) {
-        String sample_id = returnVO.getNumber();
+        Long UserId = getLoginUserId();
         String number = returnVO.getNumber();
-        MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
+        String sample_id = returnVO.getNumber();
         MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
-        int Save = result.getSave();
-        int State = event.getState();
-//             Save中 0现为未出库或已回库,1为已出库
+        MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
+//             Save中 1现为未出库或已回库,0为已出库
 //             State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
-        if (result == null) {
-            return CommonResult.error(200, "样品不存在");
-        } else if (event == null) {
-            return CommonResult.error(200, "样品在出入库的库中不存在");
-        }
-         if (Save == 1) {
-            return CommonResult.error(200, "样品已出库");
-        } else if (Save == 0) {
-            if (State == 2) {
-                museumFlowService.createMuseumFlowReturn(returnVO);
-                museumFlowService.updateMuseumFlowSave0(returnVO);
-                return CommonResult.success(true);
-            } else if (State == 3) {
-                return CommonResult.error(200, "样品已审批通过");
-            } else if (State == 4) {
-                return CommonResult.error(200, "样品审批已被驳回");
+        if (permissionService.hasAnyRoles(UserId, "operate")) {
+            if (event == null) {
+                return CommonResult.error(200, "标本未申请出库");
+            } else {
+                int Save = result.getSave();
+                if (Save == 0) {
+                    int State = event.getState();
+                    if (State == 0) {
+                        return CommonResult.error(200, "标本已返回库中");
+                    } else if (State == 1) {
+                        museumFlowService.updateMuseumFlowStateReturn1(returnVO);
+                        museumFlowService.updateMuseumFlowSave1(sample_id);
+                        LocalDateTime returnTime = LocalDateTime.now();
+                        returnVO.setReturnTime(returnTime);
+                    } else if (State == 2) {
+                        return CommonResult.error(200, "标本正在审批");
+                    } else if (State == 3) {
+                        return CommonResult.error(200, "标本审批已通过但未出库");
+                    } else if (State == 4) {
+                        return CommonResult.error(200, "标本审批已驳回");
+                    }
+                } else {
+                    return CommonResult.error(200, "标本还未出库");
+                }
             }
+            return CommonResult.success(true);
         } else {
-            return CommonResult.error(200, "样品已审批通过并出库");
+            return CommonResult.error(200, "您无此操作权限");
         }
-        return CommonResult.success(true);
     }
 }

+ 72 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museumflow/vo/MuseumFlowInfoVO.java

@@ -0,0 +1,72 @@
+package cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo;
+
+import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Schema(description = "博物馆-出库标本信息 info VO")
+@Data
+public class MuseumFlowInfoVO {
+
+    @TableId
+    @Schema(description = "样品ID")
+    private Integer id;
+
+    @Schema(description = "出库员")
+    private String outboundPerson;
+
+    @Schema(description = "出库时间")
+    private LocalDateTime outboundTime;
+
+    @Schema(description = "目的")
+    private String purpose;
+
+    @Schema(description = "出库附件")
+    private String annexOut;
+
+    @Schema(description = "申请人")
+    private String applyPerson;
+
+    @Schema(description = "申请单位")
+    private String applyUnit;
+
+    @Schema(description = "申请时间")
+    private LocalDateTime applyTime;
+
+    @Schema(description = "预计退还时间")
+    private String returnExpect;
+
+    @Schema(description = "审批人")
+    private String reviewPerson;
+
+    @Schema(description = "审批时间")
+    private LocalDateTime reviewTime;
+
+    @Schema(description = "拒绝原因")
+    private String rejectSeason;
+
+    @Schema(description = "退还员")
+    private String returnPerson;
+
+    @Schema(description = "退还时间")
+    private LocalDateTime returnTime;
+
+    @Schema(description = "点收人")
+    private String receivePerson;
+
+    @Schema(description = "回库附件")
+    private String annexReturn;
+
+    @Schema(description = "备注")
+    private String nots;
+
+    @Schema(description = "状态")
+    private Integer state;
+
+    @Schema(description = "标本详情")
+    private List<MuseumInfoDO> museumInfoDO;
+}

+ 0 - 2
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museumflow/vo/MuseumFlowSaveVO.java

@@ -72,6 +72,4 @@ public class MuseumFlowSaveVO {
     @Schema(description = "状态")
     private Integer state;
 
-    @Schema(description = "关联标本信息分页")
-    private List<MuseumInfoDO> museumInfoVO;
 }

+ 99 - 24
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/MuseumInfoController.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.museum.controller.admin.museuminfo;
 
+import cn.hutool.json.JSONArray;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@@ -12,6 +13,7 @@ import org.apache.ibatis.annotations.Param;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+
 import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.time.LocalDate;
@@ -19,7 +21,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
 @Tag(name = "博物馆-标本库")
@@ -34,22 +35,32 @@ public class MuseumInfoController {
     //TODO 判断标本编号是否重复
     @PostMapping("/create")
     @Operation(summary = "新增标本")
-    public CommonResult<Integer> createMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO) {
+    public CommonResult<Long> createMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO) {
         String sampleId = saveVO.getSampleId();
-        List<MuseumInfoDO> result = museumInfoService.getMuseumInfoBySampleId(sampleId);
+        String result = museumInfoService.getMuseumInfoBySampleId(sampleId);
         if (result != null) {
-            return CommonResult.error(1, "标本编号已存在");
+            return CommonResult.error(200, "标本编号已存在");
         } else {
             return CommonResult.success(museumInfoService.createMuseumInfo(saveVO));
         }
     }
-    @PostMapping("/update")
+    @PutMapping("/update")
     @Operation(summary = "更新标本")
-    public CommonResult<Boolean> updateMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
-        museumInfoService.updateMuseumInfo(saveVO);
-        return CommonResult.success(true);
-
-
+    public CommonResult<Boolean> updateSampleMuseumInfo(@Valid @RequestBody MuseumInfoSaveVO saveVO){
+        museumInfoService.updateSampleMuseumInfo(saveVO);
+        return success(true);
+    }
+    @PutMapping("/outSample")
+    @Operation(summary = "标本出库")
+    public CommonResult<Boolean> outSampleMuseumInfo(@RequestParam("id")Integer id){
+        museumInfoService.outSampleMuseumInfo(id);
+        return success(true);
+    }
+    @PutMapping("/backSample")
+    @Operation(summary = "标本出库")
+    public CommonResult<Boolean> backSampleMuseumInfo(@RequestParam("id")Integer id){
+        museumInfoService.backSampleMuseumInfo(id);
+        return success(true);
     }
 
     //TODO 需要提供原因,调用更新方法
@@ -57,11 +68,9 @@ public class MuseumInfoController {
     @Operation(summary = "删除标本")
     public CommonResult<Boolean> deleteMuseumInfo(@RequestParam("id") Integer id,@RequestParam("reason") String reason){
         museumInfoService.deleteMuseumInfo(id,reason);
-//        result.put("删除原因:",);
         return CommonResult.success(true);
     }
 
-
     @GetMapping("/get")
     @Operation(summary = "id查找")
     public CommonResult<MuseumInfoRespVO> selectMuseumInfo(@RequestParam("id") Integer id){
@@ -72,15 +81,15 @@ public class MuseumInfoController {
 
     @GetMapping("/getSampleId")
     @Operation(summary = "标本编号查寻")
-    public CommonResult<List<MuseumInfoRespVO>> getMuseumInfoList(@RequestParam("sampleId") String sampleId){
-        List<MuseumInfoDO> result = museumInfoService.getMuseumInfoBySampleId(sampleId);
-        List<MuseumInfoRespVO> result1 = BeanUtils.toBean(result,MuseumInfoRespVO.class);
+    public CommonResult<MuseumInfoRespVO>selectMuseumInfoBySampleId(@RequestParam("sampleId") String sampleId){
+        MuseumInfoDO result = museumInfoService.selectMuseumInfoBySampleId(sampleId);
+        MuseumInfoRespVO result1 = BeanUtils.toBean(result,MuseumInfoRespVO.class);
         return CommonResult.success(result1);
     }
 
     @GetMapping("/getSampleType")
     @Operation(summary = "标本类型查寻")
-    public CommonResult<List<MuseumInfoRespVO>> getMuseumInfoList(@RequestParam("sampleType") Integer sampleType){
+    public CommonResult<List<MuseumInfoRespVO>> selectMuseumInfoBySampleType(@RequestParam("sampleType") Integer sampleType){
         List<MuseumInfoDO> result = museumInfoService.selectMuseumInfoListBySampleType(sampleType);
         List<MuseumInfoRespVO> result1 = BeanUtils.toBean(result,MuseumInfoRespVO.class);
         return CommonResult.success(result1);
@@ -99,7 +108,7 @@ public class MuseumInfoController {
 //    TODO     1.2.3.代表哪种标本类型
 //            返回某种标本类型的List数组
 //            Integer
-//
+
     @GetMapping("/sampleTypeCount")
     @Operation(summary = "标本类型计数")
     public CommonResult<Map<String,Integer>> getMap() {
@@ -115,10 +124,6 @@ public class MuseumInfoController {
         map.put("陨石", count4);
         return CommonResult.success(map);
     }
-
-
-
-
     @GetMapping("/joinSaveCount")
     @Operation(summary = "标本出入库状态计数(每月)(入库)")
     public CommonResult<List<MuseuminfoMonthSaveVO>> getJoinSave() {
@@ -149,20 +154,90 @@ public class MuseumInfoController {
         int currentYear =date.getYear();
         List<MuseuminfoMonthSaveVO> result = new ArrayList<>();
         for (int month = 1 ; month <= 12 ; month++) {
-
-            Integer number =museumInfoService.MuseumInfoBySaveOut(month,currentYear);
+            int sample_number =0;
+            List<String> number =museumInfoService.MuseumInfoBySaveOut(month,currentYear);
             MuseuminfoMonthSaveVO  re = new MuseuminfoMonthSaveVO();
             re.setMonth(month);
+
             if (number == null) {
                 re.setCount(0);
             }else {
-                re.setCount(number);
+                for (String numberStr : number) {
+
+                    String[] groupElements = numberStr.split(",");
+                    // 累加元素数量(每个元素为一组)
+                    sample_number += groupElements.length;
+                }
+                re.setCount(sample_number);
             }
             result.add(re);
         }
         return CommonResult.success(result);
     }
 
+    @GetMapping("/backSaveCount")
+    @Operation(summary = "标本出入库状态计数(每月)(回库)")
+    public CommonResult<List<MuseuminfoMonthSaveVO>> getBackSave() {
+        LocalDate date = LocalDate.now();
+        int currentYear =date.getYear();
+
+        List<MuseuminfoMonthSaveVO> result = new ArrayList<>();
+        for (int month = 1 ; month <= 12 ; month++) {
+            int sample_number = countSampleNumbers(museumInfoService.MuseumInfoBySaveBack(month,currentYear));
+            MuseuminfoMonthSaveVO  re = new MuseuminfoMonthSaveVO();
+            re.setMonth(month);
+            re.setCount(sample_number);
+            result.add(re);
+        }
+        return CommonResult.success(result);
+    }
+
+    @GetMapping("/yearCount")
+    @Operation(summary = "历年标本数量统计")
+    public CommonResult<List<Map<Integer,Object>>> getYearSampleCount() {
+        List<Map<Integer, Object>> result = new ArrayList<>();
+        LocalDate date = LocalDate.now();
+        int currentYear = date.getYear();
+        int year1 = currentYear - 2;
+        for (int year = currentYear; year >= year1; year--) {
+
+            Integer number1 = museumInfoService.MuseumInfoYearJoin(year);
+            int sample_number2 = countSampleNumbers(museumInfoService.MuseumInfoYearOutBack(1, year));
+            int sample_number3 = countSampleNumbers(museumInfoService.MuseumInfoYearOutBack(0, year));
+                    Map<Integer,Object> map = new HashMap<>();
+                    Map<String, Integer> innerMap = new HashMap<>();
+                    innerMap.put("入库", number1);
+                    innerMap.put("回库", sample_number2);
+                    innerMap.put("出库", sample_number3);
+                    map.put(year,innerMap);
+                    result.add(map);
+                }
+        return CommonResult.success(result);
+    }
+
+    /**
+     * 统计样本数量
+     * @param number 包含样本信息的列表
+     * @return 样本数量
+     */
+    private int countSampleNumbers(List<String> number) {
+        if (number == null) {
+            return 0;
+        }
+        int count = 0;
+        for (String numberStr : number) {
+
+            String processedStr = numberStr.replaceAll("\\[|\\]","");
+            // 按逗号分割元素
+            String[] groupElements = processedStr.split(",");
+
+            count += groupElements.length;
+        }
+        return count;
+    }
+
+
+
     @GetMapping("/originCount")
     @Operation(summary = "标本来源计数")
     public CommonResult<List<Map<Integer,Object>>> getOrigin(){

+ 3 - 2
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/vo/MuseumInfoRespVO.java

@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
 import java.time.LocalDateTime;
+import java.util.List;
 
 @Schema(description = "博物馆-标本信息 Resp VO")
 @Data
@@ -13,7 +14,7 @@ public class MuseumInfoRespVO {
 //private Integer Ynumber;
 
     @Schema(description = "标本id")
-    private Integer id;
+    private Long id;
 
     @Schema(description = "标本编号")
     private String sampleId;
@@ -79,7 +80,7 @@ public class MuseumInfoRespVO {
     private String reason;
 
     @Schema(description = "标本图片")
-    private String picture;
+    private List<String> picture;
 
     @Schema(description = "备注")
     private String sampleTip;

+ 2 - 1
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/vo/MuseumInfoSaveVO.java

@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import javax.swing.*;
 import java.time.LocalDateTime;
 
 @Schema(description = "博物馆-标本信息 save VO")
@@ -10,7 +11,7 @@ import java.time.LocalDateTime;
 public class MuseumInfoSaveVO {
 
     @Schema(description = "标本id")
-    private Integer id;
+    private Long id;
 
     @Schema(description = "标本编号")
     private String sampleId;

+ 36 - 27
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/dal/mysql/museumflow/MuseumFlowMapper.java

@@ -3,21 +3,25 @@ package cn.iocoder.yudao.module.museum.dal.mysql.museumflow;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowInfoVO;
 import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowPageVO;
 import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowSaveVO;
 import cn.iocoder.yudao.module.museum.dal.database.museumflow.MuseumFlowDO;
 import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
+import org.jsoup.select.Evaluator;
 
 import java.util.List;
 
 @Mapper
 public interface MuseumFlowMapper extends BaseMapperX<MuseumFlowDO> {
 
-    @Update("UPDATE museum_outbound SET sample_type=#{sampleType}, place=#{place} WHERE id =#{id}")
+    @Update("UPDATE museum_outbound SET sample_name=#{sampleName}, outbound_person=#{outboundPerson}," +
+            " purpose=#{purpose} WHERE number =#{number}")
     void updateMuseumFlow(MuseumFlowDO museumFlowDO);
 
     @Update("UPDATE museum_outbound SET deleted=1  WHERE id =#{id}")
@@ -41,18 +45,20 @@ public interface MuseumFlowMapper extends BaseMapperX<MuseumFlowDO> {
     @Select("SELECT * FROM museum_outbound WHERE number = #{number} AND deleted = 0 ")
     MuseumFlowDO selectMuseumFlowByNumbers(@Param("number")List<String> number);
 
-/**出库功能
+/**出库功能 Save中 1现为未出库或已回库,0为已出库   State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
+
+
+    /**将总库中样品状态更新为0 已出库**/
+    @Update("UPDATE museum_info SET save=0  WHERE sample_id =#{sample_id} AND deleted =0 ")
+    void updateMuseumFlowSave0(String sample_id);
 
-    /**将主库样品状态更新为1 已出库**/
-    @Update("UPDATE museum_info SET save=1  WHERE sample_id = #{sample_id} AND deleted =0 ")
-    void updateMuseumFlowSave1(MuseumFlowDO museumFlowDO);
 
     /**将样品状态更新为1 已出库**/
-    @Update("UPDATE museum_info SET save=1  WHERE sample_id = #{sample_id} AND deleted =0 ")
+    @Update("UPDATE museum_outbound SET state=1  WHERE number = #{number} AND deleted =0 ")
     void updateMuseumFlowStateOutbound1(String number);
 
     /**将样品数组状态更新为1 已出库**/
-    @Update("UPDATE museum_info SET save=1  WHERE sample_id = #{sample_id} AND deleted =0 ")
+    @Update("UPDATE museum_outbound SET state=1  WHERE number = #{number} AND deleted =0 ")
     void updateMuseumFlowStateOutbounds1(MuseumFlowDO MuseumFlowDO);
 
 
@@ -60,22 +66,8 @@ public interface MuseumFlowMapper extends BaseMapperX<MuseumFlowDO> {
     @Update("UPDATE museum_outbound SET state=2  WHERE number =#{number} AND deleted =0 ")
     void updateMuseumFlowStateOutbound2(MuseumFlowDO MuseumFlowDO);
 
-//   default MuseumFlowDO selectPageMuseumFlowByPage(String number){return selectOne(MuseumFlowDO::getNumber,number);}
-/**分页**/
-
-//   default PageResult<MuseumInfoDO> selectPageS(MuseumFlowPageVO pageVO) {
-//       LambdaQueryWrapperX<MuseumInfoDO> queryWrapper = new LambdaQueryWrapperX<>();
-//       queryWrapper.inIfPresent(MuseumInfoDO::getSampleId, pageVO.getNumber())
-//               .orderByDesc(MuseumInfoDO::getId);
-//       return selectPage(pageVO, queryWrapper);
-//   }
-
-//       return selectPage(pageVO ,new LambdaQueryWrapperX<MuseumFlowDO>()
-//               .likeIfPresent(MuseumFlowDO::getNumber,pageVO.getNumber())
-//               .betweenIfPresent(MuseumFlowDO::getOutboundTime, pageVO.getOutboundTime())
-//               .eqIfPresent(MuseumFlowDO::getOutboundPerson,pageVO.getOutboundPerson())
-//               .inIfPresent(MuseumFlowDO::getId, id)
-//               .orderByDesc(MuseumFlowDO::getId));
+
+/**分页
 //        in 来指定多个值,如 in(w1,2,3);
 //        between..and 来指定遥感连续的范围, 如 between 1 and 10;
 //        like 是模糊查询;
@@ -92,6 +84,7 @@ public interface MuseumFlowMapper extends BaseMapperX<MuseumFlowDO> {
         return selectPage(pageVO, queryWrapper);
     }
 
+
 /**审批功能
 
 
@@ -112,9 +105,25 @@ public interface MuseumFlowMapper extends BaseMapperX<MuseumFlowDO> {
     void updateMuseumFlowStateReviews4(MuseumFlowDO MuseumFlowDO);
 
 
-/**回库功能
+/**回库功能 Save中 1现为未出库或已回库,0为已出库  flow中1
+
+
+    /**将主库样品状态更新为1 已出库**/
+    @Update("UPDATE museum_info SET save=1  WHERE sample_id = #{sample_id} AND deleted =0 ")
+    void updateMuseumFlowSave1(String sample_id);
+
+    /**将样品状态更新为0 已回库**/
+    @Update("UPDATE museum_outbound SET state=0  WHERE number = #{number} AND deleted =0 ")
+    void updateMuseumFlowStateReturn1(MuseumFlowDO MuseumFlowDO);
+
+/**身份查询功能
+
+    /**查询身份是否为操作员**/
+    @Select("SELECT * FROM system_users WHERE id = #{UserId} AND deleted =0 ")
+    AdminUserDO selectAdminUserDOById(Long UserId);
+
+//    /**根据编号在Flow库中进行查找*/
+//    @Select("SELECT * FROM museum_outbound WHERE number = #{number} AND deleted = 0 ")
+//    MuseumFlowDO selectMuseumFlowByNumber(@Param("number")String number);
 
-    /**将总库中样品状态更新为0 未出库或已回库**/
-    @Update("UPDATE museum_outbound SET save=0  WHERE number =#{number} AND deleted =0 ")
-    void updateMuseumFlowSave0(MuseumFlowDO MuseumFlowDO);
 }

+ 46 - 7
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/dal/mysql/museuminfo/MuseumInfoMapper.java

@@ -21,15 +21,23 @@ public interface MuseumInfoMapper extends BaseMapperX<MuseumInfoDO> {
     /**
      * 更新标本
      */
-    @Update("UPDATE museum_info SET sample_type=#{sampleType}, place=#{place},chinese_name=#{chineseName} WHERE id =#{id}")
+    @Update("UPDATE museum_info SET sample_id=#{sampleId},chinese_name=#{chineseName} WHERE id =#{id}")
     void updateMuseumInfo(MuseumInfoDO museumInfoDO);
-
+    /**
+     * 标本出库
+     */
+    @Update("UPDATE museum_info SET save=0  WHERE id =#{id}")
+    void outSampleMuseumInfo(@Param("id")Integer id);
+    /**
+     * 标本回库
+     */
+    @Update("UPDATE museum_info SET save=1  WHERE id =#{id}")
+    void backSampleMuseumInfo(@Param("id")Integer id);
     /**
      * 删除标本
      */
     @Update("UPDATE museum_info SET deleted=1,reason=#{reason}  WHERE id =#{id}")
-    void deleteMuseumInfo(Integer id, String reason);
-
+    void deleteMuseumInfo(@Param("id")Integer id,@Param("reason")String reason);
     /**
      * 查询标本
      */
@@ -40,7 +48,8 @@ public interface MuseumInfoMapper extends BaseMapperX<MuseumInfoDO> {
      * 查询标本编号
      */
     @Select("SELECT * FROM museum_info WHERE sample_id =#{sampleId} AND deleted =0")
-    List<MuseumInfoDO> getMuseumInfoBySampleId(@Param("sampleId") String sampleId);
+    String getMuseumInfoBySampleId(@Param("sampleId") String sampleId);
+    MuseumInfoDO selectMuseumInfoBySampleId(@Param("sampleId") String sampleId);
 
     /**
      * 查询标本类型
@@ -67,12 +76,42 @@ public interface MuseumInfoMapper extends BaseMapperX<MuseumInfoDO> {
      * 标本出库状态计数
      */
     @Select("SELECT" +
-            " COUNT(*)"+
+            " number"+
+            " FROM museum_outbound " +
+            " WHERE deleted =0"+
+            " AND state =0"+
+            " AND DATE_FORMAT(outbound_time,'%m') = #{month}"+
+            " AND DATE_FORMAT(outbound_time,'%Y') = #{currentYear}")
+    List<String> countMuseumInfoBySaveOut(@Param("month") Integer month,@Param("currentYear") Integer currentYear);
+    /**
+     * 标本回库状态计数
+     */
+    @Select("SELECT" +
+            " number"+
             " FROM museum_outbound " +
             " WHERE deleted =0 "+
+            " AND state =1"+
             " AND DATE_FORMAT(outbound_time,'%m') = #{month}"+
+            " AND DATE_FORMAT(outbound_time,'%Y') = #{currentYear}")
+    List<String> countMuseumInfoBySaveBack(@Param("month") Integer month,@Param("currentYear") Integer currentYear);
+    /**
+     * 历年标本数量统计
+     */
+    @Select("SELECT" +
+            " COUNT(*)"+
+            " FROM museum_info " +
+            " WHERE deleted =0 AND save =1"+
             " AND DATE_FORMAT(sample_save_time,'%Y') = #{currentYear}")
-    Integer countMuseumInfoBySaveOut(@Param("month") Integer month,@Param("currentYear") Integer currentYear);
+    Integer countMuseumInfoYearJoin(@Param("currentYear") Integer currentYear);
+
+    @Select("SELECT" +
+            " number"+
+            " FROM museum_outbound " +
+            " WHERE deleted =0 "+
+            " AND state = #{state}"+
+            " AND DATE_FORMAT(outbound_time,'%Y') = #{currentYear}")
+    List<String> countMuseumInfoYearOutBack(@Param("state") Integer state,@Param("currentYear") Integer currentYear);
+
 
     /**
      * 标本来源计数(年)

+ 16 - 10
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museumflow/MuseumFlowService.java

@@ -2,12 +2,10 @@ package cn.iocoder.yudao.module.museum.service.museumflow;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowPageVO;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowReturnVO;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowReviewVO;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowSaveVO;
+import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.*;
 import cn.iocoder.yudao.module.museum.dal.database.museumflow.MuseumFlowDO;
 import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 
 import java.util.List;
 
@@ -45,10 +43,10 @@ public interface MuseumFlowService {
     /**根据编号数组在Flow库中进行查找*/
     MuseumFlowDO selectMuseumFlowNumbers(List<String> number);
 
-/**出库功能
+/**出库功能 Save中 1现为未出库或已回库,0为已出库 flow中0
 
-    /**将主库中标本状态设置为1*/
-    void updateMuseumFlowSave1(MuseumFlowSaveVO saveVO);
+    /**将主库中标本状态设置为0*/
+    void updateMuseumFlowSave0(String sample_id);
 
     /**标本状态设置为1*/
     void updateMuseumFlowStateOutbound1(String number);
@@ -86,11 +84,19 @@ public interface MuseumFlowService {
     /**将标本数组状态设置为4 审批驳回*/
     void updateMuseumFlowStateReviews4(MuseumFlowReviewVO reviewVO);
 
-/**回库功能
+/**回库功能 Save中 1现为未出库或已回库,0为已出库 flow中1
 
     /**新建出库单**/
     Integer createMuseumFlowReturn(MuseumFlowReturnVO returnVO);
 
-    /**将主库中标本状态设置为1*/
-    void updateMuseumFlowSave0(MuseumFlowReturnVO returnVO);
+    /**将主库中标本状态设置为0*/
+    void updateMuseumFlowSave1(String sample_id);
+
+    /**将标本状态设置为1*/
+    void updateMuseumFlowStateReturn1(MuseumFlowReturnVO returnVO);
+
+/**身份查询功能
+
+    /**查询身份是否为操作员**/
+    AdminUserDO selectAdminUserDOById(Long  UserId);
 }

+ 38 - 20
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museumflow/MuseumFlowServiceImpl.java

@@ -3,13 +3,13 @@ package cn.iocoder.yudao.module.museum.service.museumflow;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowPageVO;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowReturnVO;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowReviewVO;
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowSaveVO;
+import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.*;
 import cn.iocoder.yudao.module.museum.dal.database.museumflow.MuseumFlowDO;
 import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
 import cn.iocoder.yudao.module.museum.dal.mysql.museumflow.MuseumFlowMapper;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+import com.alibaba.druid.sql.visitor.functions.If;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -61,7 +61,7 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
         return museumFlowMapper.selectMuseumFlowByNumbers(number);
     }
 
-/**出库功能
+/**出库功能 Save中 1现为未出库或已回库,0为已出库 flow中0
 
     /**创建出库单*/
     @Override
@@ -70,10 +70,10 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
         return museumFlowMapper.insert(result);
     }
 
-    /**将主库中样品状态设置为1*/
+    /**将主库中标本状态设置为0*/
     @Override
-    public void updateMuseumFlowSave1(MuseumFlowSaveVO saveVO){
-        museumFlowMapper.updateMuseumFlowSave1(BeanUtils.toBean(saveVO,MuseumFlowDO.class));
+    public void updateMuseumFlowSave0(String sample_id){
+        museumFlowMapper.updateMuseumFlowSave0(sample_id);
     }
 
     /**将样品状态设置为1 已出库*/
@@ -94,22 +94,20 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
     }
 
 
-
-    /**根据出库员进行分页查找*/
-    @Override
-    public PageResult<MuseumFlowDO> selectPageMuseumFlowOutboundPerson(MuseumFlowPageVO pageVO){
-        return museumFlowMapper.selectPageMuseumFlowByOutboundPerson(pageVO);
-    }
-
-
 /**分页功能
 
-    /**根据分页长度进行排序**/
+//    根据分页长度进行排序
 //    @Override
 //    public PageResult<MuseumFlowDO> selectPageS(MuseumFlowPageVO pageVO){
 //        return  museumFlowMapper.selectPageS(pageVO);
 //    }
 
+    /**根据出库员进行分页查找*/
+    @Override
+    public PageResult<MuseumFlowDO> selectPageMuseumFlowOutboundPerson(MuseumFlowPageVO pageVO){
+        return museumFlowMapper.selectPageMuseumFlowByOutboundPerson(pageVO);
+    }
+
 
 /**审批功能
 
@@ -143,7 +141,7 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
     }
 
 
-/**出库功能
+/**回库功能 Save中 1现为未出库或已回库,0为已出库 flow中1
 
     /**新建出库单**/
     @Override
@@ -154,7 +152,27 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
 
     /**将主库中样品状态设置为1*/
     @Override
-    public void updateMuseumFlowSave0(MuseumFlowReturnVO returnVO){
-        museumFlowMapper.updateMuseumFlowSave0(BeanUtils.toBean(returnVO,MuseumFlowDO.class));
+    public void updateMuseumFlowSave1(String sample_id){
+        museumFlowMapper.updateMuseumFlowSave1(sample_id);
+    }
+
+    /**将标本状态设置为1 已出库*/
+    @Override
+    public void updateMuseumFlowStateReturn1(MuseumFlowReturnVO returnVO){
+        museumFlowMapper.updateMuseumFlowStateReturn1(BeanUtils.toBean(returnVO,MuseumFlowDO.class));
+    }
+
+
+/**身份查询功能
+
+    /**根据角色编号在角色表中进行查找**/
+    @Override
+    public AdminUserDO selectAdminUserDOById(Long  UserId) {
+        return museumFlowMapper.selectAdminUserDOById(UserId);
     }
+
+//    /**根据编号在总表中进行查找**/
+//    public MuseumInfoDO selectMuseumFlowSampleId(String sample_id) {
+//        return museumFlowMapper.selectMuseumFlowBySampleId(sample_id);
+//    }
  }

+ 30 - 11
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museuminfo/MuseumInfoService.java

@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
 
+import javax.validation.Valid;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -15,13 +16,20 @@ public interface MuseumInfoService {
    /**
     * 创建标本
    * */
-   Integer createMuseumInfo(MuseumInfoSaveVO saveVO);
+   Long createMuseumInfo(MuseumInfoSaveVO saveVO);
 
    /**
     * 更新标本
     * */
-   void updateMuseumInfo(MuseumInfoSaveVO saveVO);
-
+   void updateSampleMuseumInfo(@Valid MuseumInfoSaveVO saveVO);
+   /**
+    * 标本出库
+    */
+   void outSampleMuseumInfo(Integer id);
+   /**
+    * 标本回库
+    */
+   void backSampleMuseumInfo(Integer id);
    /**
     * 删除标本(原因)
     * */
@@ -34,8 +42,11 @@ public interface MuseumInfoService {
    /**
     * 查询标本编号
     * */
-   List<MuseumInfoDO> getMuseumInfoBySampleId(String sampleId);
-
+   String getMuseumInfoBySampleId(String sampleId);
+   /**
+    * 查询标本编号1
+    * */
+   MuseumInfoDO selectMuseumInfoBySampleId(String sampleId);
    /**
    * 查询标本类型
    * */
@@ -52,14 +63,22 @@ public interface MuseumInfoService {
     * */
    Integer MuseumInfoBySampleType(Integer sampleType);
    /**
-    * 标本入库状态计数
+    * 标本入库状态计数
     * */
-//
     Integer MuseumInfoBySaveJoin(Integer month,Integer currentYear);
-
-
-   Integer MuseumInfoBySaveOut(Integer month,Integer currentYear);
-
+   /**
+    * 标本出库状态计数
+    * */
+   List<String> MuseumInfoBySaveOut(Integer month,Integer currentYear);
+   /**
+    * 标本回库状态计数
+    * */
+   List<String> MuseumInfoBySaveBack(Integer month,Integer currentYear);
+   /**
+    * 历年标本数量统计
+    */
+   Integer MuseumInfoYearJoin(Integer currentYear);
+   List<String> MuseumInfoYearOutBack(Integer state,Integer currentYear);
    /**
     * 标本来源计数(年)
     * */

+ 80 - 10
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museuminfo/MuseumInfoServiceImpl.java

@@ -1,10 +1,14 @@
 package cn.iocoder.yudao.module.museum.service.museuminfo;
 
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.*;
 import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
 import cn.iocoder.yudao.module.museum.dal.mysql.museuminfo.MuseumInfoMapper;
+import com.mzt.logapi.context.LogRecordContext;
+import com.mzt.logapi.service.impl.DiffParseFunction;
+import com.mzt.logapi.starter.annotation.LogRecord;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -14,10 +18,13 @@ import java.util.Map;
 import java.util.Set;
 
 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.singleton;
+import static cn.iocoder.yudao.module.system.enums.LogRecordConstants.*;
+import static cn.iocoder.yudao.module.museum.enums.social.LogRecordConstants.*;
 
 @Service
 public  class  MuseumInfoServiceImpl implements MuseumInfoService {
 
+
    @Resource
    private MuseumInfoMapper museumInfoMapper;
 
@@ -25,24 +32,60 @@ public  class  MuseumInfoServiceImpl implements MuseumInfoService {
     * 新增标本
     */
    @Override
-   public Integer createMuseumInfo(MuseumInfoSaveVO saveVO) {
-      return museumInfoMapper.insert(BeanUtils.toBean(saveVO, MuseumInfoDO.class));//insert(内置)
+   @LogRecord(type = MUSEUM_TYPE, subType = CREATE_SUB_TYPE, bizNo = "{{#sampleId.id}}",
+           success =  CREATE_SUB_TYPE_SUCCESS)
+   public Long createMuseumInfo(MuseumInfoSaveVO saveVO) {
+      MuseumInfoDO sampleId = BeanUtils.toBean(saveVO, MuseumInfoDO.class);
+      museumInfoMapper.insert(sampleId);
+      LogRecordContext.putVariable("sampleId", sampleId );
+      return sampleId.getId();
    }
-
    /**
     * 更新标本
     */
+
+   @LogRecord(type = MUSEUM_TYPE, subType = UPDATE_SUB_TYPE, bizNo = "{{#sampleId.id}}",
+           success = UPDATE_SUB_TYPE_SUCCESS)
    @Override
-   public void updateMuseumInfo(MuseumInfoSaveVO saveVO) {
-      museumInfoMapper.updateMuseumInfo(BeanUtils.toBean(saveVO, MuseumInfoDO.class));
+   public void updateSampleMuseumInfo(MuseumInfoSaveVO saveVO) {
+      MuseumInfoDO sampleId = BeanUtils.toBean(saveVO,MuseumInfoDO.class);
+      museumInfoMapper.updateMuseumInfo(sampleId);
+//      museumInfoMapper.updateById(sampleId);
+      LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(sampleId, MuseumInfoSaveVO.class));
+      LogRecordContext.putVariable("sampleId", sampleId );
+   }
+   /**
+    * 标本出库
+    */
+   @LogRecord(type = MUSEUM_TYPE, subType = OUT_MUSEUM_SUB_TYPE, bizNo = "{{#sampleId.id}}",
+           success = OUT_MUSEUM_SUB_TYPE_SUCCESS)
+   @Override
+   public void outSampleMuseumInfo(Integer id){
+      MuseumInfoDO sampleId = museumInfoMapper.selectMuseumInfoById(id);
+      museumInfoMapper.outSampleMuseumInfo(id);
+      LogRecordContext.putVariable("sampleId",sampleId);
+   }
+   /**
+    * 标本回库
+    */
+   @LogRecord(type = MUSEUM_TYPE, subType = BACK_MUSEUM_SUB_TYPE, bizNo = "{{#sampleId.id}}",
+           success = BACK_MUSEUM_SUB_TYPE_SUCCESS)
+   @Override
+   public void backSampleMuseumInfo(Integer id){
+      MuseumInfoDO sampleId = museumInfoMapper.selectMuseumInfoById(id);
+      museumInfoMapper.backSampleMuseumInfo(id);
+      LogRecordContext.putVariable("sampleId",sampleId);
    }
-
    /**
     * 删除标本
     */
    @Override
+   @LogRecord(type = MUSEUM_TYPE, subType = DELETE_SUB_TYPE, bizNo = "{{#sampleId.id}}",
+           success = DELETE_SUB_TYPE_SUCCESS)
    public void deleteMuseumInfo(Integer id,String reason) {
+      MuseumInfoDO sampleId = museumInfoMapper.selectMuseumInfoById(id);
       museumInfoMapper.deleteMuseumInfo(id,reason);
+      LogRecordContext.putVariable("sampleId", sampleId );
    }
    /**
     * 查询标本id
@@ -56,9 +99,16 @@ public  class  MuseumInfoServiceImpl implements MuseumInfoService {
     * 查询标本编号
     */
    @Override
-   public List<MuseumInfoDO> getMuseumInfoBySampleId (String sampleId) {
+   public String getMuseumInfoBySampleId (String sampleId) {
       return museumInfoMapper.getMuseumInfoBySampleId(sampleId);
    }
+   /**
+    * 查询标本编号1
+    */
+   @Override
+   public  MuseumInfoDO selectMuseumInfoBySampleId (String sampleId) {
+      return museumInfoMapper.selectMuseumInfoBySampleId(sampleId);
+   }
    /**
     * 查询标本类型
     */
@@ -81,17 +131,37 @@ public  class  MuseumInfoServiceImpl implements MuseumInfoService {
       return museumInfoMapper.countMuseumInfoBySampleType(sampleType);
    }
    /**
-    * 标本入库状态计数
+    * 标本入库状态计数
     * */
    @Override
    public Integer MuseumInfoBySaveJoin(Integer month,Integer currentYear) {
       return museumInfoMapper.countMuseumInfoBySaveJoin(month,currentYear);
    }
-
+   /**
+    * 标本出库状态计数
+    * */
    @Override
-   public Integer MuseumInfoBySaveOut(Integer month,Integer currentYear) {
+   public List<String> MuseumInfoBySaveOut(Integer month,Integer currentYear) {
       return museumInfoMapper.countMuseumInfoBySaveOut(month,currentYear);
    }
+   /**
+    * 标本回库状态计数
+    * */
+   @Override
+   public List<String> MuseumInfoBySaveBack(Integer month,Integer currentYear) {
+      return museumInfoMapper.countMuseumInfoBySaveBack(month,currentYear);
+   }
+   /**
+    * 历年标本数量统计
+    */
+   @Override
+   public Integer MuseumInfoYearJoin(Integer currentYear) {
+      return museumInfoMapper.countMuseumInfoYearJoin(currentYear);
+   }
+   @Override
+   public List<String> MuseumInfoYearOutBack(Integer state,Integer currentYear) {
+      return museumInfoMapper.countMuseumInfoYearOutBack(state,currentYear);
+   }
    /**
     * 标本来源计数(年)
     * */

+ 0 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java

@@ -199,7 +199,6 @@ public class PermissionServiceImpl implements PermissionService {
     public Set<Long> getMenuRoleIdListByMenuIdFromCache(Long menuId) {
         return convertSet(roleMenuMapper.selectListByMenuId(menuId), RoleMenuDO::getRoleId);
     }
-
     // ========== 用户-角色的相关方法  ==========
 
     @Override