From 7fb6472b19a66fae6b905d5b3fa8b2de01792ed5 Mon Sep 17 00:00:00 2001 From: Joshi <3040996759@qq.com> Date: Fri, 4 Jul 2025 10:40:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=B7=A5=E6=97=B6=E9=97=B4=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E6=96=B0=E5=A2=9E=E6=B1=87=E7=8E=87=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OaExchangeRateController.java | 32 +++++++++++++++++++ .../ruoyi/oa/domain/bo/OaProjectReportBo.java | 6 ++++ .../impl/OaProjectReportServiceImpl.java | 4 +++ 3 files changed, 42 insertions(+) create mode 100644 ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaExchangeRateController.java diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaExchangeRateController.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaExchangeRateController.java new file mode 100644 index 0000000..32b7330 --- /dev/null +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaExchangeRateController.java @@ -0,0 +1,32 @@ +package com.ruoyi.oa.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.oa.service.IExchangeRateService; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.math.BigDecimal; +import java.util.Date; + +@RestController +@Validated +@RequiredArgsConstructor +@RequestMapping("/oa/exchangeRate") +public class OaExchangeRateController extends BaseController { + private final IExchangeRateService oaExchangeRateService; + + /** + * 获取指定日期的美元兑人民币汇率 + */ + @GetMapping("/usd2cny") + public BigDecimal getUsd2CnyRate(@RequestParam(required = false) Date date) { + if (date == null) { + date = new Date(); + } + return oaExchangeRateService.getUsdExchangeRate(date); + } +} \ No newline at end of file diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/OaProjectReportBo.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/OaProjectReportBo.java index a7d09ab..909dec0 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/OaProjectReportBo.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/OaProjectReportBo.java @@ -84,6 +84,12 @@ public class OaProjectReportBo extends BaseEntity { */ private Long workType; + /** + * 修改创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date time; + // 新增:多用户ID和时间范围 private List userIds; @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaProjectReportServiceImpl.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaProjectReportServiceImpl.java index 98fb0a3..cdefd88 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaProjectReportServiceImpl.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaProjectReportServiceImpl.java @@ -130,6 +130,10 @@ public class OaProjectReportServiceImpl implements IOaProjectReportService { @Override public Boolean updateByBo(OaProjectReportBo bo) { OaProjectReport update = BeanUtil.toBean(bo, OaProjectReport.class); + // 如果time字段不为空,则用time覆盖createTime + if (bo.getTime() != null) { + update.setCreateTime(bo.getTime()); + } validEntityBeforeSave(update); return baseMapper.updateById(update) > 0; }