package com.iailab.module.data.plan.item.controller.admin; import com.iailab.framework.apilog.core.annotation.ApiAccessLog; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.framework.excel.core.util.ExcelUtils; import com.iailab.module.data.api.dto.ApiPointValueQueryDTO; import com.iailab.module.data.plan.item.entity.PlanItemEntity; import com.iailab.module.data.plan.item.service.PlanItemService; import com.iailab.module.data.plan.item.vo.PlanItemPageReqVO; import com.iailab.module.data.plan.item.vo.PlanItemRespVO; import com.iailab.module.data.plan.item.vo.PlanItemSaveReqVO; import com.iailab.module.data.point.vo.PointValueExportVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年11月01日 */ @Tag(name = "数据平台 - 计划数据项") @RestController @RequestMapping("/data/plan-item") @Validated public class PlanItemController { @Autowired private PlanItemService planItemService; @GetMapping("/page") @Operation(summary = "获取计划项列表", description = "用于【计划项】界面") @PreAuthorize("@ss.hasPermission('data:plan-item:query')") public CommonResult> page(PlanItemPageReqVO reqVO) { PageResult page = planItemService.page(reqVO); PageResult result = BeanUtils.toBean(page, PlanItemRespVO.class); return success(result); } @PostMapping("/create") @Operation(summary = "创建计划项") @PreAuthorize("@ss.hasPermission('data:plan-item:create')") public CommonResult create(@Valid @RequestBody PlanItemSaveReqVO createReqVO) { planItemService.create(createReqVO); return success(true); } @PutMapping("/update") @Operation(summary = "修改计划项") @PreAuthorize("@ss.hasPermission('data:plan-item:update')") public CommonResult update(@Valid @RequestBody PlanItemSaveReqVO updateReqVO) { planItemService.update(updateReqVO); return success(true); } @DeleteMapping("/delete") @Operation(summary = "删除计划项") @Parameter(name = "id", description = "计划项编号", required= true, example = "1024") @PreAuthorize("@ss.hasPermission('data:plan-item:delete')") public CommonResult delete(@RequestParam("id") String id) { planItemService.delete(id); return success(true); } @GetMapping("/get") @Operation(summary = "获取计划项信息") @PreAuthorize("@ss.hasPermission('data:plan-item:query')") public CommonResult get(@RequestParam("id") String id) { PlanItemEntity entity = planItemService.get(id); PlanItemRespVO respVO = BeanUtils.toBean(entity, PlanItemRespVO.class); return success(respVO); } @GetMapping("/list") @Operation(summary = "获取计划项列表", description = "用于【计划项】界面") @PreAuthorize("@ss.hasPermission('data:plan-item:query')") public CommonResult> getList(PlanItemPageReqVO reqVO) { List list = planItemService.list(); return success(ConvertUtils.sourceToTarget(list, PlanItemRespVO.class)); } }