package com.gyee.runeconomy.controller; import com.gyee.common.util.DateUtils; import com.gyee.runeconomy.dto.R; import com.gyee.runeconomy.dto.ResultMsg; import com.gyee.runeconomy.model.auto.ProEconBenchmarkingBetween; import com.gyee.runeconomy.service.auto.IProEconBenchmarkingBetweenService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.List; /** *

* 前端控制器 *

* * @author wang * @since 2023-02-03 */ @RestController @RequestMapping("//pro-econ-benchmarking-between") public class ProEconBenchmarkingBetweenController { @Autowired private IProEconBenchmarkingBetweenService proEconBenchmarkingBetweenService; /** * 值际损失电量 * * @param beginDate * @param endDate * @return */ @GetMapping("/zjwxssl") @ResponseBody @CrossOrigin(origins = "*", maxAge = 3600) public R zjwxssl(@RequestParam(value = "beginDate", required = true) String beginDate, @RequestParam(value = "endDate", required = true) String endDate) { Date begin = DateUtils.parseDate(beginDate); Date end = DateUtils.parseDate(endDate); List resultList = proEconBenchmarkingBetweenService.findByBeginAndEnd(begin, end); if (null != resultList) { return R.data(ResultMsg.ok(resultList)); } else { return R.error(ResultMsg.error()); } } /** * 保存值际对标 * * @param beginDate * @return */ @GetMapping("/savezjdb") @ResponseBody @CrossOrigin(origins = "*", maxAge = 3600) public R savezjdb(@RequestParam(value = "beginDate", required = true) String beginDate) throws Exception { Date begin = DateUtils.parseDate(beginDate); String date = DateUtils.toDate1(begin); proEconBenchmarkingBetweenService.saveBeanchmarkList(date, date); return R.data(ResultMsg.ok()); } }