|
|
@@ -15,15 +15,16 @@ import org.sky.core.excel.util.ExcelUtil;
|
|
|
import org.sky.core.mp.support.Condition;
|
|
|
import org.sky.core.mp.support.Query;
|
|
|
import org.sky.core.secure.KdUser;
|
|
|
-import org.sky.core.secure.annotation.IsAdmin;
|
|
|
import org.sky.core.tool.api.R;
|
|
|
import org.sky.core.tool.utils.DateUtil;
|
|
|
import org.sky.core.tool.utils.Func;
|
|
|
-import org.sky.scientific.excel.ZcExcel;
|
|
|
-import org.sky.scientific.pojo.dto.ZcDTO;
|
|
|
-import org.sky.scientific.pojo.entity.ZcEntity;
|
|
|
-import org.sky.scientific.pojo.vo.ZcVO;
|
|
|
-import org.sky.scientific.service.IZcService;
|
|
|
+import org.sky.scientific.excel.AssetExcel;
|
|
|
+import org.sky.scientific.pojo.dto.AssetDTO;
|
|
|
+import org.sky.scientific.pojo.entity.AssetEntity;
|
|
|
+import org.sky.scientific.pojo.entity.XmAssetEntity;
|
|
|
+import org.sky.scientific.pojo.vo.AssetVO;
|
|
|
+import org.sky.scientific.service.IAssetService;
|
|
|
+import org.sky.scientific.service.IXmAssetService;
|
|
|
import org.sky.scientific.wrapper.ZcWrapper;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@@ -39,83 +40,94 @@ import java.util.Map;
|
|
|
*/
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
-@RequestMapping("/zc")
|
|
|
+@RequestMapping("/asset")
|
|
|
@Tag(name = "科研资产管理", description = "资产表接口")
|
|
|
-public class ZcController extends KdController {
|
|
|
+public class AssetController extends KdController {
|
|
|
|
|
|
- private final IZcService service;
|
|
|
+ private final IAssetService service;
|
|
|
+ private final IXmAssetService xmAssetService;
|
|
|
|
|
|
- /**
|
|
|
- * 资产表 详情
|
|
|
- */
|
|
|
@GetMapping("/detail")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@Operation(summary = "详情", description = "传入zc")
|
|
|
- public R<ZcVO> detail(ZcEntity zc) {
|
|
|
- ZcEntity detail = service.getOne(Condition.getQueryWrapper(zc));
|
|
|
+ public R<AssetVO> detail(AssetEntity zc) {
|
|
|
+ AssetEntity detail = service.getOne(Condition.getQueryWrapper(zc));
|
|
|
return R.data(ZcWrapper.build().entityVO(detail));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/simple/list")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@Operation(summary = "列表-所有不分页", description = "")
|
|
|
- public R<List<ZcEntity>> list() {
|
|
|
- List<ZcEntity> list = service.selectZcList();
|
|
|
+ public R<List<AssetEntity>> list() {
|
|
|
+ List<AssetEntity> list = service.selectAssetList();
|
|
|
return R.data(list);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/page")
|
|
|
@ApiOperationSupport(order = 3)
|
|
|
@Operation(summary = "分页", description = "传入zc")
|
|
|
- public R<IPage<ZcVO>> page(ZcVO zc, Query query) {
|
|
|
- IPage<ZcVO> pages = service.selectZcPage(Condition.getPage(query), zc);
|
|
|
+ public R<IPage<AssetVO>> page(AssetVO assetVO, Query query) {
|
|
|
+ IPage<AssetVO> pages = service.selectAssetPage(Condition.getPage(query), assetVO);
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/save")
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@Operation(summary = "新增", description = "传入zc")
|
|
|
- public R save(@Valid @RequestBody ZcEntity zc) {
|
|
|
- return R.status(service.save(zc));
|
|
|
+ public R save(@Valid @RequestBody AssetEntity asset) {
|
|
|
+ return R.status(service.save(asset));
|
|
|
}
|
|
|
|
|
|
@PostMapping("/update")
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
@Operation(summary = "修改", description = "传入zc")
|
|
|
- public R update(@Valid @RequestBody ZcEntity zc) {
|
|
|
- return R.status(service.updateById(zc));
|
|
|
+ public R update(@Valid @RequestBody AssetEntity asset) {
|
|
|
+ return R.status(service.updateById(asset));
|
|
|
}
|
|
|
|
|
|
@PostMapping("/remove")
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
- @Operation(summary = "逻辑删除", description = "传入ids")
|
|
|
+ @Operation(summary = "删除", description = "传入ids")
|
|
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
|
|
- return R.status(service.deleteLogic(Func.toLongList(ids)));
|
|
|
+ return R.status(service.physicalDeleteByIds(Func.toLongList(ids)));
|
|
|
}
|
|
|
|
|
|
@PostMapping("import")
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@Operation(summary = "导入", description = "传入excel")
|
|
|
- public R importZc(MultipartFile file, String yearAndMonth) {
|
|
|
- service.importZc(file, yearAndMonth);
|
|
|
+ public R importAsset(MultipartFile file, String yearAndMonth) {
|
|
|
+ service.importAsset(file, yearAndMonth);
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
@GetMapping("/fetchLastMonthData")
|
|
|
@ApiOperationSupport(order = 10)
|
|
|
@Operation(summary = "读取上个月资产名单", description = "传入选中的年月,比如2025-06,则读取2025-05的数据到06月")
|
|
|
- public R<Boolean> fetchLastMonthData(ZcDTO zc) {
|
|
|
- return R.status(service.fetchLastMonthData(zc));
|
|
|
+ public R<Boolean> fetchLastMonthData(AssetDTO asset) {
|
|
|
+ return R.status(service.fetchLastMonthData(asset));
|
|
|
}
|
|
|
|
|
|
- @IsAdmin
|
|
|
- @GetMapping("/export-zc")
|
|
|
+ @GetMapping("/export")
|
|
|
@ApiOperationSupport(order = 9)
|
|
|
@Operation(summary = "导出数据", description = "传入zc")
|
|
|
- public void exportZc(@Parameter(hidden = true) @RequestParam Map<String, Object> zc, KdUser kdUser, HttpServletResponse response) {
|
|
|
- QueryWrapper<ZcEntity> queryWrapper = Condition.getQueryWrapper(zc, ZcEntity.class);
|
|
|
- List<ZcExcel> list = service.exportZc(queryWrapper);
|
|
|
- ExcelUtil.export(response, "资产表数据" + DateUtil.time(), "资产表数据表", list, ZcExcel.class);
|
|
|
+ public void exportZc(@Parameter(hidden = true) @RequestParam Map<String, Object> asset, KdUser kdUser, HttpServletResponse response) {
|
|
|
+ QueryWrapper<AssetEntity> queryWrapper = Condition.getQueryWrapper(asset, AssetEntity.class);
|
|
|
+ List<AssetExcel> list = service.exportAsset(queryWrapper);
|
|
|
+ ExcelUtil.export(response, "资产表数据" + DateUtil.time(), "资产表数据表", list, AssetExcel.class);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/keyanyiqishebeimingxibiao/page")
|
|
|
+ @ApiOperationSupport(order = 20)
|
|
|
+ @Operation(summary = "科研仪器设备明细表-分页")
|
|
|
+ public R<IPage<XmAssetEntity>> pageXm(XmAssetEntity xmAsset, Query query) {
|
|
|
+ IPage<XmAssetEntity> pages = xmAssetService.keyanyiqishebeimingxibiao_fenye(Condition.getPage(query), xmAsset);
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/xm/fetchData")
|
|
|
+ @ApiOperationSupport(order = 21)
|
|
|
+ @Operation(summary = "科研仪器设备明细表-直接引用")
|
|
|
+ public R<Boolean> fetchData(String yearAndMonth) {
|
|
|
+ return R.status(service.keyanyiqishebeimingxibiao_zhijieyinyong(yearAndMonth));
|
|
|
+ }
|
|
|
}
|