You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package com.example.demo.controller;
import com.example.demo.domain.entity.Admin; import com.example.demo.domain.entity.Statistics; import com.example.demo.domain.vo.TestRequest; import com.example.demo.domain.vo.WorkbenchCard; import com.example.demo.mapper.StatisticsMapper; import com.example.demo.service.GeneralService; import com.example.demo.service.StatisticsService; import com.example.demo.service.WorkbenchService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.*;
import java.util.Date; import java.util.List; import java.util.Map;
/** * @program: gold-java * @ClassName WorkbenchController * @description: 工作台相关 * @author: Ethan * @create: 2025−06-17 17:13 * @Version 1.0 **/
@RestController @RequestMapping("/workbench") @RequiredArgsConstructor @CrossOrigin @Slf4j public class WorkbenchController {
@Autowired private WorkbenchService workbenchService; @Autowired private StatisticsService statisticsService; @Autowired private GeneralService generalService; @Autowired private StatisticsMapper statisticsMapper;
/* 获取各地区工作台卡片的数据 */ @PostMapping("getCard") public ResponseEntity<WorkbenchCard> card1(@RequestBody WorkbenchCard workbench, @AuthenticationPrincipal Admin admin) throws Exception{ if (admin != null) { String account = admin.getAccount(); List<String> markets = generalService.getRoleMarket(account); WorkbenchCard result = workbenchService.getCard(markets); return ResponseEntity.ok(result); } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(null); } } /* 获取各地区工作台图表的数据 */ @PostMapping("getGraph") public ResponseEntity<WorkbenchCard> graph1(@RequestBody WorkbenchCard workbench){ WorkbenchCard result =workbenchService.getGraph(workbench.getStartDate(),workbench.getEndDate(),workbench.getMarkets()); return ResponseEntity.ok(result); } /* 更新统计表并获取卡片数据 */ /*@PostMapping("updateCard") public ResponseEntity<WorkbenchCard> updateCard(@RequestBody WorkbenchCard workbench){ statisticsService.runHourlyTaskPart1(); //更新余量数据
statisticsService.runHourlyTaskPart2(); //更新余量外数据
WorkbenchCard result =workbenchService.getCard(workbench.getMarkets()); //获取卡片数据
return ResponseEntity.ok(result); }*/ }
|