|
|
@@ -16,6 +16,10 @@ 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.TechnicianExcel;
|
|
|
+import org.sky.scientific.excel.TechnicianImporter;
|
|
|
+import org.sky.scientific.pojo.dto.TechnicianDTO;
|
|
|
+import org.sky.scientific.pojo.dto.ZcDTO;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -28,6 +32,7 @@ import org.sky.core.boot.ctrl.KdController;
|
|
|
import java.util.Map;
|
|
|
import java.util.List;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
/**
|
|
|
* 资产表 控制器
|
|
|
@@ -38,10 +43,10 @@ import jakarta.servlet.http.HttpServletResponse;
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping("/zc")
|
|
|
-@Tag(name = "资产表", description = "资产表接口")
|
|
|
+@Tag(name = "科研资产管理", description = "资产表接口")
|
|
|
public class ZcController extends KdController {
|
|
|
|
|
|
- private final IZcService zcService;
|
|
|
+ private final IZcService service;
|
|
|
|
|
|
/**
|
|
|
* 资产表 详情
|
|
|
@@ -50,86 +55,68 @@ public class ZcController extends KdController {
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@Operation(summary = "详情", description = "传入zc")
|
|
|
public R<ZcVO> detail(ZcEntity zc) {
|
|
|
- ZcEntity detail = zcService.getOne(Condition.getQueryWrapper(zc));
|
|
|
+ ZcEntity detail = service.getOne(Condition.getQueryWrapper(zc));
|
|
|
return R.data(ZcWrapper.build().entityVO(detail));
|
|
|
}
|
|
|
- /**
|
|
|
- * 资产表 分页
|
|
|
- */
|
|
|
- @GetMapping("/list")
|
|
|
- @ApiOperationSupport(order = 2)
|
|
|
- @Operation(summary = "分页", description = "传入zc")
|
|
|
- public R<IPage<ZcVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> zc, Query query) {
|
|
|
- IPage<ZcEntity> pages = zcService.page(Condition.getPage(query), Condition.getQueryWrapper(zc, ZcEntity.class));
|
|
|
- return R.data(ZcWrapper.build().pageVO(pages));
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * 资产表 自定义分页
|
|
|
- */
|
|
|
@GetMapping("/page")
|
|
|
@ApiOperationSupport(order = 3)
|
|
|
@Operation(summary = "分页", description = "传入zc")
|
|
|
public R<IPage<ZcVO>> page(ZcVO zc, Query query) {
|
|
|
- IPage<ZcVO> pages = zcService.selectZcPage(Condition.getPage(query), zc);
|
|
|
+ IPage<ZcVO> pages = service.selectZcPage(Condition.getPage(query), zc);
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 资产表 新增
|
|
|
- */
|
|
|
@PostMapping("/save")
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@Operation(summary = "新增", description = "传入zc")
|
|
|
public R save(@Valid @RequestBody ZcEntity zc) {
|
|
|
- return R.status(zcService.save(zc));
|
|
|
+ return R.status(service.save(zc));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 资产表 修改
|
|
|
- */
|
|
|
@PostMapping("/update")
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
@Operation(summary = "修改", description = "传入zc")
|
|
|
public R update(@Valid @RequestBody ZcEntity zc) {
|
|
|
- return R.status(zcService.updateById(zc));
|
|
|
+ return R.status(service.updateById(zc));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 资产表 新增或修改
|
|
|
- */
|
|
|
@PostMapping("/submit")
|
|
|
@ApiOperationSupport(order = 6)
|
|
|
@Operation(summary = "新增或修改", description = "传入zc")
|
|
|
public R submit(@Valid @RequestBody ZcEntity zc) {
|
|
|
- return R.status(zcService.saveOrUpdate(zc));
|
|
|
+ return R.status(service.saveOrUpdate(zc));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 资产表 删除
|
|
|
- */
|
|
|
@PostMapping("/remove")
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
@Operation(summary = "逻辑删除", description = "传入ids")
|
|
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
|
|
- return R.status(zcService.deleteLogic(Func.toLongList(ids)));
|
|
|
+ return R.status(service.deleteLogic(Func.toLongList(ids)));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("import")
|
|
|
+ @ApiOperationSupport(order = 12)
|
|
|
+ @Operation(summary = "导入", description = "传入excel")
|
|
|
+ public R importZc(MultipartFile file, String yearAndMonth) {
|
|
|
+ service.importZc(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));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 导出数据
|
|
|
- */
|
|
|
@IsAdmin
|
|
|
@GetMapping("/export-zc")
|
|
|
@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);
|
|
|
- //if (!AuthUtil.isAdministrator()) {
|
|
|
- // queryWrapper.lambda().eq(Zc::getTenantId, kdUser.getTenantId());
|
|
|
- //}
|
|
|
- //queryWrapper.lambda().eq(ZcEntity::getIsDeleted, KdConstant.DB_NOT_DELETED);
|
|
|
- List<ZcExcel> list = zcService.exportZc(queryWrapper);
|
|
|
+ List<ZcExcel> list = service.exportZc(queryWrapper);
|
|
|
ExcelUtil.export(response, "资产表数据" + DateUtil.time(), "资产表数据表", list, ZcExcel.class);
|
|
|
}
|
|
|
|