|
@@ -1,23 +1,18 @@
|
|
|
package cn.iocoder.yudao.module.museum.controller.admin.museuminfo;
|
|
|
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
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.museuminfo.vo.MuseumInfoPageReqVO;
|
|
|
-import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoRespVO;
|
|
|
-import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoSaveVO;
|
|
|
+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.service.museuminfo.MuseumInfoService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
-import java.time.LocalDateTime;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -82,8 +77,9 @@ public class MuseumInfoController {
|
|
|
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获取分页")
|
|
|
- public PageResult<MuseumInfoDO> getMuseumInfoPage(@Valid MuseumInfoPageReqVO pageReqVO){
|
|
|
- return museumInfoService.getMuseumInfoPage(pageReqVO);
|
|
|
+ public CommonResult<PageResult<MuseumInfoDO>> getPage(@Valid MuseumInfoPageReqVO pageReqVO){
|
|
|
+ PageResult<MuseumInfoDO> PageResult = museumInfoService.getMuseumInfoPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(PageResult, MuseumInfoDO.class));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -92,74 +88,85 @@ public class MuseumInfoController {
|
|
|
// 返回某种标本类型的List数组
|
|
|
// Integer
|
|
|
// Map<> 键值对
|
|
|
- @GetMapping("/sampleTypeCount")
|
|
|
- @Operation(summary = "标本类型计数")
|
|
|
- public CommonResult<HashMap<Integer,Integer>> getMap(@RequestParam("sampleType") Integer sampleType) {
|
|
|
- Integer result = museumInfoService.MuseumInfoBySampleType(sampleType);
|
|
|
-// 标本类型:矿石-1 岩石-2 矿物-3 陨石-4>
|
|
|
- HashMap<Integer, Integer> Sites = new HashMap<Integer, Integer>();
|
|
|
- Integer Type = sampleType;
|
|
|
- Sites.put(Type, result);
|
|
|
- return CommonResult.success(Sites);
|
|
|
-
|
|
|
- }
|
|
|
-// 1(初版)
|
|
|
-// public CommonResult<Map<String,Integer>> getMap(@RequestParam("sampleType") Integer sampleType){
|
|
|
-// Map<String,Integer> result =museumInfoService.MuseumInfoBySampleType(sampleType);
|
|
|
-// Integer Type = sampleType;
|
|
|
-// result.put("标本类型:",Type);
|
|
|
-// return CommonResult.success(result);
|
|
|
-
|
|
|
-
|
|
|
-// 2
|
|
|
// @GetMapping("/sampleTypeCount")
|
|
|
// @Operation(summary = "标本类型计数")
|
|
|
-// public CommonResult<HashMap<Integer,List<Integer>>> getMap(@RequestParam("sampleType") Integer sampleType){
|
|
|
-// List<Integer> result =museumInfoService.MuseumInfoBySampleType(sampleType);
|
|
|
-// HashMap<Integer,List<Integer>> Sites = new HashMap<Integer,List<Integer>>();
|
|
|
-// Sites.put(1,result);
|
|
|
-// Sites.put(2,result);
|
|
|
-// Sites.put(3,result);
|
|
|
-// Sites.put(4,result);
|
|
|
-// return CommonResult.success(Sites);
|
|
|
+// public CommonResult<HashMap<String,Integer>> getMap(@RequestParam("sampleType") Integer sampleType) {
|
|
|
+// Integer result = museumInfoService.MuseumInfoBySampleType(1);
|
|
|
+// Integer result2 = museumInfoService.MuseumInfoBySampleType(2);
|
|
|
+// Integer result3 = museumInfoService.MuseumInfoBySampleType(3);
|
|
|
+// Integer result4 = museumInfoService.MuseumInfoBySampleType(4);
|
|
|
//
|
|
|
-//}
|
|
|
-// 3
|
|
|
-//@GetMapping("/sampleTypeCount")
|
|
|
-//@Operation(summary = "标本类型计数")
|
|
|
-//public CommonResult<HashMap<Integer,Integer>> getMap(@RequestParam("sampleType") Integer sampleType) {
|
|
|
-// Integer result = museumInfoService.MuseumInfoBySampleType(sampleType);
|
|
|
//// 标本类型:矿石-1 岩石-2 矿物-3 陨石-4>
|
|
|
-// HashMap<Integer, Integer> Sites = new HashMap<Integer, Integer>();
|
|
|
-// Integer Type = sampleType;
|
|
|
-// Sites.put(Type, result);
|
|
|
-// return CommonResult.success(Sites);
|
|
|
+// HashMap<String, Integer> Sites = new HashMap<String, Integer>();
|
|
|
+// Sites.put("矿石", result);
|
|
|
+// Sites.put("岩石", result2);
|
|
|
+// Sites.put("矿物", result3);
|
|
|
+// Sites.put("陨石", result4);
|
|
|
+// return CommonResult.success(Sites);
|
|
|
+// }
|
|
|
|
|
|
+// @GetMapping("/sampleTypeCount")
|
|
|
+// @Operation(summary = "标本类型计数")
|
|
|
+// public CommonResult<HashMap<String,List<MuseuminfoTypeVO>>> getMap(@RequestParam("sampleType") Integer sampleType) {
|
|
|
+// List<MuseuminfoTypeVO> result = museumInfoService.MuseumInfoBySampleType(sampleType);
|
|
|
+//// 标本类型:矿石-1 岩石-2 矿物-3 陨石-4>
|
|
|
+// HashMap<String,List<MuseuminfoTypeVO>> Sites = new HashMap<String,List<MuseuminfoTypeVO>>();
|
|
|
+// Sites.put("矿石", result);
|
|
|
+// return CommonResult.success(Sites);
|
|
|
+// }
|
|
|
|
|
|
+ @GetMapping("/sampleTypeCount")
|
|
|
+ @Operation(summary = "标本类型计数")
|
|
|
+ public CommonResult<List<MuseuminfoTypeVO>> getMap(@RequestParam("sampleType") Integer sampleType) {
|
|
|
+ List<MuseuminfoTypeVO> result = museumInfoService.MuseumInfoBySampleType(sampleType);
|
|
|
+// 标本类型:矿石-1 岩石-2 矿物-3 陨石-4>
|
|
|
+ return CommonResult.success(result);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- @GetMapping("/saveCount")
|
|
|
- @Operation(summary = "标本出入库状态计数")
|
|
|
- public CommonResult<HashMap<Integer,Integer>> getSave(@RequestParam("save") Integer save){
|
|
|
- Integer result1 =museumInfoService.MuseumInfoBySave(save);
|
|
|
+// @GetMapping("/saveCount")
|
|
|
+// @Operation(summary = "标本出入库状态计数(每月)")
|
|
|
+// public CommonResult<HashMap<Integer,List<MuseuminfoMonthSaveVO>>> getSave(@RequestParam("save") Integer save){
|
|
|
+// List<MuseuminfoMonthSaveVO> result1 =museumInfoService.MuseumInfoBySave(save);
|
|
|
+//// 状态:在库-1 出库-0
|
|
|
+// HashMap<Integer, List<MuseuminfoMonthSaveVO>> result2 = new HashMap<Integer,List<MuseuminfoMonthSaveVO>>();
|
|
|
+//// Integer Condition = save;
|
|
|
+// result2.put(save,result1);
|
|
|
+// return CommonResult.success(result2);
|
|
|
+// }
|
|
|
+
|
|
|
+ @GetMapping("/joinSaveCount")
|
|
|
+ @Operation(summary = "标本出入库状态计数(每月)(入库)")
|
|
|
+ public CommonResult<List<MuseuminfoMonthSaveVO>> getJoinSave(@RequestParam("save") Integer save) {
|
|
|
+ List<MuseuminfoMonthSaveVO> result1 = museumInfoService.MuseumInfoBySaveJoin(save);
|
|
|
// 状态:在库-1 出库-0
|
|
|
- HashMap<Integer, Integer> result2 = new HashMap<Integer, Integer>();
|
|
|
- Integer Condition = save;
|
|
|
- result2.put(Condition,result1);
|
|
|
- return CommonResult.success(result2);
|
|
|
+// 构造 12 个月的数据,确保每个月都有数据(即使为 0)
|
|
|
+// List<MuseuminfoMonthSaveVO> result = new ArrayList<>();
|
|
|
+// for (int month = 1 ; month <= 1 ; month++){
|
|
|
+// String monthStr = String.format("%d-%2d",save, month);
|
|
|
+// Optional<MuseuminfoMonthSaveVO> found = MonthSave.stream()
|
|
|
+// filter(f ->f.getMonth().equals(monthStr))
|
|
|
+// .findFirst();
|
|
|
+// MuseuminfoMonthSaveVO vo = new MuseuminfoMonthSaveVO();
|
|
|
+// vo.setMonth(monthStr);
|
|
|
+// vo.setCount(found.map(MuseuminfoMonthSaveVO::getSave).orElse( other: 0)).
|
|
|
+// result.add(vo);
|
|
|
+ return CommonResult.success(result1);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/outSaveCount")
|
|
|
+ @Operation(summary = "标本出入库状态计数(每月)(出库)")
|
|
|
+ public CommonResult<List<MuseuminfoMonthSaveVO>> getOutSave(@RequestParam("save") Integer save) {
|
|
|
+ List<MuseuminfoMonthSaveVO> result1 = museumInfoService.MuseumInfoBySaveOut(save);
|
|
|
+ return CommonResult.success(result1);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/originCount")
|
|
|
@Operation(summary = "标本来源计数")
|
|
|
- public CommonResult<HashMap<Integer,Integer>> getOrigin(@RequestParam("origin") Integer origin){
|
|
|
- Integer result1 =museumInfoService.MuseumInfoByOrigin(origin);
|
|
|
-// 来源:采购-1 捐赠-2 采集-3
|
|
|
- HashMap<Integer, Integer> result2 = new HashMap<Integer, Integer>();
|
|
|
- Integer Origin = origin;
|
|
|
-// LocalDateTime SampleSaveTime = sampleSaveTime;
|
|
|
- result2.put(Origin, result1);
|
|
|
-
|
|
|
- return CommonResult.success(result2);
|
|
|
+ public CommonResult<List<MuseuminfoOriginVO>> getOrigin(@RequestParam("origin") Integer origin){
|
|
|
+ List<MuseuminfoOriginVO> result1 =museumInfoService.MuseumInfoByOrigin(origin);
|
|
|
+// 来源:采购-1 捐赠-2 采集-3 其他-4
|
|
|
+ return CommonResult.success(result1);
|
|
|
}
|
|
|
|
|
|
|