Browse Source

回库程序

BigLawn 4 weeks ago
parent
commit
4b7333f4ea

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

@@ -81,7 +81,7 @@ public class MuseumFlowController {
     }
 
     @GetMapping("/selectPage")
-    @Operation(summary = "获取关于标本标本库信息的分页")
+    @Operation(summary = "获取标本库信息的分页")
     public CommonResult<PageResult<MuseumInfoDO>> selectPage(@Valid MuseumInfoPageReqVO pageVO) {
         return CommonResult.success(museumInfoService.getMuseumInfoPage(pageVO));
     }
@@ -92,47 +92,6 @@ public class MuseumFlowController {
         return CommonResult.success(museumFlowService.selectPageMuseumFlowFormIntel(pageVO));
     }
 
-    @GetMapping("/getFormIntel")
-    @Operation(summary = "根据id查找标本出回库中的信息,并展示在标本库中的信息")
-    @PreAuthorize("@ss.hasPermission('system:role:operate')")
-    public CommonResult<MuseumFlowInfoVO> getFormIntel(@Valid MuseumInfoPageReqVO reqVO) {
-        Long UserId = getLoginUserId();
-        if (permissionService.hasAnyRoles(UserId, "operate")) {
-            List<MuseumInfoDO> museumInfoDO = new ArrayList<>();
-            MuseumFlowDO result = museumFlowService.selectMuseumFlowById(reqVO.getOutBoundId());
-            MuseumFlowInfoVO form = BeanUtils.toBean(result, MuseumFlowInfoVO.class);
-            if (form != null) {
-//                int State = form.getState();
-//                if (State == 2) {
-                for (String number : form.getNumber()) {
-                    reqVO.setSampleId(number);
-                    museumInfoDO.addAll(museumInfoService.getMuseumInfoPageList(reqVO));
-                }
-                form.setMuseumInfoList(museumInfoDO);
-                return CommonResult.success(form);
-//                } else {
-//                    return CommonResult.error(2, reqVO.getOutBoundId() + museumFlowService.isMuseumFlowStateForm(State));
-//                }
-            } else {
-                //TODO 错误信息要写得官方一点,比如说用户是不知道id是什么的
-                return CommonResult.error(2, "您选择的表单不存在");
-            }
-        } else {
-            return CommonResult.error(2, "您无此权限");
-        }
-    }
-
-//    @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 = "出库功能")
 //    @PreAuthorize("@ss.hasPermission('system:role:operate')")

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

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo;
 
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
+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.AllArgsConstructor;
@@ -82,4 +83,7 @@ public class MuseumFlowPageVO extends PageParam {
 
     @Schema(description = "状态 (0在库,1已出库,2审批中,3审批通过,4审批驳回)")
     private Integer state;
+
+    @Schema(description = "标本详情")
+    private List<MuseumInfoDO> museumInfoList;
 }

+ 92 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/vo/MuseumInfoListReqVO.java

@@ -0,0 +1,92 @@
+package cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
+
+@Schema(description = "博物馆-标本信息-分页 pageReq VO")
+@Data
+@ToString(callSuper = true)
+public class MuseumInfoListReqVO  {
+    @Schema(description = "出库单id")
+    private Integer outBoundId;
+
+    @Schema(description = "标本编号")
+    private List<String> sampleId;
+
+    @Schema(description = "标本类型")
+    private Integer sampleType;
+
+    @Schema(description = "存放位置")
+    private String place;
+
+    @Schema(description = "中文名称")
+    private String chineseName;
+
+    @Schema(description = "英文名称")
+    private String englishName;
+
+    @Schema(description = "国际名称")
+    private String internationName;
+
+    @Schema(description = "保存类型")
+    private Integer keepType;
+
+    @Schema(description = "成份")
+    private String element;
+
+    @Schema(description = "产地")
+    private String  local;
+
+    @Schema(description = "时代")
+    private String bronTime ;
+
+    @Schema(description = "保存地层")
+    private String stratum;
+
+    @Schema(description = "发现时间")
+//    @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
+    private LocalDateTime[] findTime;
+
+    @Schema(description = "尺寸")
+    private String size;
+
+    @Schema(description = "重量")
+    private BigDecimal weight;
+
+    @Schema(description = "来源")
+    private String origin;
+
+    @Schema(description = "描述")
+    private String bewrite;
+
+    @Schema(description = "馆藏状态")
+    private Integer store;
+
+    @Schema(description = "入库时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
+    private LocalDateTime[] storeTime;
+
+    @Schema(description = "用途")
+    private String way;
+
+    @Schema(description = "资产号")
+    private String fundId;
+
+    @Schema(description = "删除原因")
+    private String reason;
+
+    @Schema(description = "标本图片")
+    private List<String> picture;
+
+    @Schema(description = "备注")
+    private String sampleTip;
+}

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

@@ -23,30 +23,6 @@ import static java.util.Arrays.*;
 @Mapper
 public interface MuseumFlowMapper extends BaseMapperX<MuseumFlowDO> {
 
-    @Update("UPDATE museum_outbound SET sample_name=#{sampleName}," +
-            "number=#{number}," +
-            " outbound_person=#{outboundPerson}," +
-            "purpose=#{purpose}," +
-            "outbound_time=#{outboundTime}" +
-            "annex_out=#{annexOut}" +
-            "apply_person=#{applyPerson}" +
-            "apply_unit=#{applyUnit}" +
-            "apply_time=#{applyTime}" +
-            "return_expect=#{returnExpect}" +
-            "create_time=#{createTime}" +
-            "updater=#{updater}" +
-            "update_time=#{updateTime}" +
-            "deleted=#{deleted}" +
-            "review_person=#{reviewPerson}" +
-            "state=#{state}" +
-            "review_time=#{reviewTime}" +
-            "reject_season=#{rejectSeason}" +
-            "return_person=#{returnPerson}" +
-            "return_time=#{returnTime}" +
-            "receive_person=#{receivePerson}" +
-            "annex_return=#{annexReturn}" +
-            "nots=#{nots} WHERE id =#{id}")
-    void updateMuseumFlow(MuseumFlowDO museumFlowDO);
 
     @Select("SELECT * FROM museum_outbound WHERE id = #{id} AND deleted =0 ")
     MuseumFlowDO selectMuseumFlowById(@Param("id") Integer id);
@@ -64,8 +40,7 @@ public interface MuseumFlowMapper extends BaseMapperX<MuseumFlowDO> {
     MuseumFlowDO selectMuseumFlowFormById(@Param("id") Integer id);
 
     /**根据编号数组在Flow库中进行包含查询*/
-    @Select("SELECT * FROM museum_outbound WHERE JSON_CONTAINS(number, CAST(#{number} AS JSON)) AND deleted = 0  "
-//            "OR (number LIKE CONCAT('%, ', #{number}, ',%') OR number LIKE CONCAT('[', #{number}, ',%') OR number LIKE CONCAT('%, ', #{number}, ']')) AND deleted = 0"
+    @Select("SELECT * FROM museum_outbound WHERE JSON_CONTAINS(number, CAST(#{number} AS JSON)) AND deleted = 0 "
     )
     List<MuseumFlowDO> selectMuseumFlowByNumbersLike(@Param("number") String number);
 

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

@@ -180,11 +180,11 @@ public interface MuseumInfoMapper extends BaseMapperX<MuseumInfoDO> {
     /**
      * 分页(List)
      */
-    default List<MuseumInfoDO> selectPageList(MuseumInfoPageReqVO pageReqVO) {
+    default List<MuseumInfoDO> selectPageList(MuseumInfoListReqVO ListReqVO) {
         LambdaQueryWrapperX<MuseumInfoDO> queryWrapper = new LambdaQueryWrapperX<>();
-        queryWrapper.inIfPresent(MuseumInfoDO::getSampleId,pageReqVO.getSampleId())
-                .eqIfPresent(MuseumInfoDO::getSampleType, pageReqVO.getSampleType())
-                .likeIfPresent(MuseumInfoDO::getPlace, pageReqVO.getPlace())
+        queryWrapper.inIfPresent(MuseumInfoDO::getSampleId,ListReqVO.getSampleId())
+                .eqIfPresent(MuseumInfoDO::getSampleType, ListReqVO.getSampleType())
+                .likeIfPresent(MuseumInfoDO::getPlace, ListReqVO.getPlace())
                 .orderByDesc(MuseumInfoDO::getId);
         return selectList(queryWrapper);
     }

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

@@ -1,20 +1,25 @@
 package cn.iocoder.yudao.module.museum.service.museumflow;
 
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.hutool.core.lang.TypeReference;
+import cn.hutool.json.ObjectMapper;
 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.MuseumInfoListReqVO;
+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.dal.mysql.museuminfo.MuseumInfoMapper;
+import cn.iocoder.yudao.module.museum.service.museuminfo.MuseumInfoService;
 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserNickname;
@@ -25,7 +30,7 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
     @Resource
     private MuseumFlowMapper museumFlowMapper;
     @Resource
-    private MuseumInfoMapper MuseumInfoMapper;
+    private MuseumInfoService museumInfoService;
 
 //    @Override
 //    public Integer createMuseumFlow(MuseumFlowSaveVO saveVO){
@@ -35,7 +40,7 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
 
     @Override
     public void updateMuseumFlow(MuseumFlowSaveVO saveVO){
-        museumFlowMapper.updateMuseumFlow(BeanUtils.toBean(saveVO,MuseumFlowDO.class));
+        museumFlowMapper.updateById(BeanUtils.toBean(saveVO,MuseumFlowDO.class));
     }
 
     @Override
@@ -98,8 +103,6 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
         String userName = user.getUsername();
         saveVO.setOutboundTime(LocalDateTime.now()).setState(1).setOutboundPerson(userName);;
         museumFlowMapper.updateMuseumFlowOutbound(BeanUtils.toBean(saveVO,MuseumFlowDO.class));
-        //TODO 可以用系统自带的updateById方法
-        // museumFlowMapper.updateById(BeanUtils.toBean(saveVO,MuseumFlowDO.class));
     }
 
 
@@ -175,6 +178,20 @@ public class MuseumFlowServiceImpl implements MuseumFlowService {
     @Override
     public PageResult<MuseumFlowPageVO> selectPageMuseumFlowFormIntel(MuseumFlowPageVO pageVO){
         PageResult<MuseumFlowPageVO> result = BeanUtils.toBean(museumFlowMapper.selectPageMuseumFlowFormIntel(pageVO),MuseumFlowPageVO.class);
+        result.getList().forEach(re ->{
+
+            List<String> list =  Arrays.stream(re.getNumber().replaceAll("^\\[|]$", "").split(","))
+                    .map(String::trim)
+                    .filter(s -> !s.isEmpty()) // 过滤掉可能出现的空字符串
+                    .collect(Collectors.toList());
+
+            MuseumInfoListReqVO reqVO = new MuseumInfoListReqVO();
+            reqVO.setSampleId(list);
+            List<MuseumInfoDO> infoList = museumInfoService.getMuseumInfoPageList(reqVO);
+            if (infoList != null && !infoList.isEmpty()) {
+                re.setMuseumInfoList(infoList);
+            }
+        });
         return result;
     }
 

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

@@ -63,7 +63,7 @@ public interface MuseumInfoService {
    /**
     * 分页(List)
     */
-   List<MuseumInfoDO> getMuseumInfoPageList(MuseumInfoPageReqVO pageReqVO);
+   List<MuseumInfoDO> getMuseumInfoPageList(MuseumInfoListReqVO ListReqVO);
    /**
     * 标本类型计数
     * */

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

@@ -141,8 +141,8 @@ public  class  MuseumInfoServiceImpl implements MuseumInfoService {
     * 分页(List)
     */
    @Override
-   public List<MuseumInfoDO> getMuseumInfoPageList(MuseumInfoPageReqVO pageReqVO){
-      return museumInfoMapper.selectPageList(pageReqVO);
+   public List<MuseumInfoDO> getMuseumInfoPageList(MuseumInfoListReqVO ListReqVO){
+      return museumInfoMapper.selectPageList(ListReqVO);
    }
    /**
     * 标本类型计数