From c6ac9100d8e7767c91c90e0ac1a96a870554d1f8 Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Thu, 23 Mar 2023 08:13:11 +0000
Subject: [PATCH] 汇率管理

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysExchangeRateService.java           |   83 ++++++
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysExchangeRateRepository.java     |   28 ++
 eladmin-web-master/src/views/project/chart/subgroupTopHours.vue                                                      |    2 
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysGoalSettingController.java            |    4 
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysExchangeRate.java                   |   64 +++++
 eladmin-web-master/src/api/system/exchangeRate.js                                                                    |   35 ++
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysExchangeRateController.java           |   95 +++++++
 eladmin-web-master/src/views/system/exchangeRate/index.vue                                                           |  146 ++++++++++++
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateQueryCriteria.java |   33 ++
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateDto.java           |   45 +++
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysGoalSettingService.java            |    4 
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysExchangeRateServiceImpl.java  |  134 +++++++++++
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysExchangeRateMapper.java  |   32 ++
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysGoalSettingServiceImpl.java   |    6 
 14 files changed, 703 insertions(+), 8 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysExchangeRate.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysExchangeRate.java
new file mode 100644
index 0000000..a882c74
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysExchangeRate.java
@@ -0,0 +1,64 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.domain;
+
+import lombok.Data;
+import cn.hutool.core.bean.BeanUtil;
+import io.swagger.annotations.ApiModelProperty;
+import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.sql.Timestamp;
+import java.math.BigDecimal;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2023-03-23
+**/
+@Entity
+@Data
+@Table(name="sys_exchange_rate")
+public class SysExchangeRate extends BaseEntity implements Serializable {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "`id`")
+    @ApiModelProperty(value = "ID")
+    private Long id;
+
+    @Column(name = "`unit_currency`",nullable = false)
+    @NotBlank
+    @ApiModelProperty(value = "单价币种")
+    private String unitCurrency;
+
+    @Column(name = "`exchange_rate`",nullable = false)
+    @NotNull
+    @ApiModelProperty(value = "汇率")
+    private BigDecimal exchangeRate;
+
+    @Column(name = "`remarks`")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+    public void copy(SysExchangeRate source){
+        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+    }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysExchangeRateRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysExchangeRateRepository.java
new file mode 100644
index 0000000..7ae390c
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysExchangeRateRepository.java
@@ -0,0 +1,28 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.repository;
+
+import me.zhengjie.modules.system.domain.SysExchangeRate;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-03-23
+**/
+public interface SysExchangeRateRepository extends JpaRepository<SysExchangeRate, Long>, JpaSpecificationExecutor<SysExchangeRate> {
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysExchangeRateController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysExchangeRateController.java
new file mode 100644
index 0000000..34ed953
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysExchangeRateController.java
@@ -0,0 +1,95 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.system.domain.SysExchangeRate;
+import me.zhengjie.modules.system.service.SysExchangeRateService;
+import me.zhengjie.modules.system.service.dto.SysExchangeRateQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-03-23
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "汇率管理管理")
+@RequestMapping("/api/sysExchangeRate")
+public class SysExchangeRateController {
+
+    private final SysExchangeRateService sysExchangeRateService;
+
+    @Log("导出数据")
+    @ApiOperation("导出数据")
+    @GetMapping(value = "/download")
+    @PreAuthorize("@el.check('sysExchangeRate:download')")
+    public void exportSysExchangeRate(HttpServletResponse response, SysExchangeRateQueryCriteria criteria) throws IOException {
+        sysExchangeRateService.download(sysExchangeRateService.queryAll(criteria), response);
+    }
+
+    @GetMapping
+    @Log("查询汇率管理")
+    @ApiOperation("查询汇率管理")
+    @PreAuthorize("@el.check('sysExchangeRate:list')")
+    public ResponseEntity<Object> querySysExchangeRate(SysExchangeRateQueryCriteria criteria, Pageable pageable){
+        return new ResponseEntity<>(sysExchangeRateService.queryAll(criteria,pageable),HttpStatus.OK);
+    }
+
+    @GetMapping(value = "/all")
+    @Log("查询汇率管理")
+    @ApiOperation("查询汇率管理")
+    @PreAuthorize("@el.check('sysExchangeRate:list')")
+    public ResponseEntity<Object> querySysExchangeRate(SysExchangeRateQueryCriteria criteria){
+        return new ResponseEntity<>(sysExchangeRateService.queryAll(criteria),HttpStatus.OK);
+    }
+
+    @PostMapping
+    @Log("新增汇率管理")
+    @ApiOperation("新增汇率管理")
+    @PreAuthorize("@el.check('sysExchangeRate:add')")
+    public ResponseEntity<Object> createSysExchangeRate(@Validated @RequestBody SysExchangeRate resources){
+        return new ResponseEntity<>(sysExchangeRateService.create(resources),HttpStatus.CREATED);
+    }
+
+    @PutMapping
+    @Log("修改汇率管理")
+    @ApiOperation("修改汇率管理")
+    @PreAuthorize("@el.check('sysExchangeRate:edit')")
+    public ResponseEntity<Object> updateSysExchangeRate(@Validated @RequestBody SysExchangeRate resources){
+        sysExchangeRateService.update(resources);
+        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+    }
+
+    @DeleteMapping
+    @Log("删除汇率管理")
+    @ApiOperation("删除汇率管理")
+    @PreAuthorize("@el.check('sysExchangeRate:del')")
+    public ResponseEntity<Object> deleteSysExchangeRate(@RequestBody Long[] ids) {
+        sysExchangeRateService.deleteAll(ids);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysGoalSettingController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysGoalSettingController.java
index 61a2b83..0809be4 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysGoalSettingController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysGoalSettingController.java
@@ -71,7 +71,7 @@
     @Log("新增目标设定")
     @ApiOperation("新增目标设定")
     @PreAuthorize("@el.check('sysGoalSetting:add')")
-    public ResponseEntity<Object> createSysGoalSetting(@Validated @RequestBody SysGoalSetting resources) throws Exception{
+    public ResponseEntity<Object> createSysGoalSetting(@Validated @RequestBody SysGoalSetting resources){
         return new ResponseEntity<>(sysGoalSettingService.create(resources),HttpStatus.CREATED);
     }
 
@@ -79,7 +79,7 @@
     @Log("修改目标设定")
     @ApiOperation("修改目标设定")
     @PreAuthorize("@el.check('sysGoalSetting:edit')")
-    public ResponseEntity<Object> updateSysGoalSetting(@Validated @RequestBody SysGoalSetting resources) throws Exception{
+    public ResponseEntity<Object> updateSysGoalSetting(@Validated @RequestBody SysGoalSetting resources){
         sysGoalSettingService.update(resources);
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysExchangeRateService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysExchangeRateService.java
new file mode 100644
index 0000000..69dafb0
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysExchangeRateService.java
@@ -0,0 +1,83 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.service;
+
+import me.zhengjie.modules.system.domain.SysExchangeRate;
+import me.zhengjie.modules.system.service.dto.SysExchangeRateDto;
+import me.zhengjie.modules.system.service.dto.SysExchangeRateQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务接口
+* @author 赵士淞
+* @date 2023-03-23
+**/
+public interface SysExchangeRateService {
+
+    /**
+    * 查询数据分页
+    * @param criteria 条件
+    * @param pageable 分页参数
+    * @return Map<String,Object>
+    */
+    Map<String,Object> queryAll(SysExchangeRateQueryCriteria criteria, Pageable pageable);
+
+    /**
+    * 查询所有数据不分页
+    * @param criteria 条件参数
+    * @return List<SysExchangeRateDto>
+    */
+    List<SysExchangeRateDto> queryAll(SysExchangeRateQueryCriteria criteria);
+
+    /**
+     * 根据ID查询
+     * @param id ID
+     * @return SysExchangeRateDto
+     */
+    SysExchangeRateDto findById(Long id);
+
+    /**
+    * 创建
+    * @param resources /
+    * @return SysExchangeRateDto
+    */
+    SysExchangeRateDto create(SysExchangeRate resources);
+
+    /**
+    * 编辑
+    * @param resources /
+    */
+    void update(SysExchangeRate resources);
+
+    /**
+    * 多选删除
+    * @param ids /
+    */
+    void deleteAll(Long[] ids);
+
+    /**
+    * 导出数据
+    * @param all 待导出的数据
+    * @param response /
+    * @throws IOException /
+    */
+    void download(List<SysExchangeRateDto> all, HttpServletResponse response) throws IOException;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysGoalSettingService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysGoalSettingService.java
index e0d5589..0f1b333 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysGoalSettingService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysGoalSettingService.java
@@ -59,13 +59,13 @@
     * @param resources /
     * @return SysGoalSettingDto
     */
-    SysGoalSettingDto create(SysGoalSetting resources) throws Exception;
+    SysGoalSettingDto create(SysGoalSetting resources);
 
     /**
     * 编辑
     * @param resources /
     */
-    void update(SysGoalSetting resources) throws Exception;
+    void update(SysGoalSetting resources);
 
     /**
     * 多选删除
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateDto.java
new file mode 100644
index 0000000..5bfadfa
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateDto.java
@@ -0,0 +1,45 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.service.dto;
+
+import lombok.Data;
+import me.zhengjie.base.BaseDTO;
+
+import java.sql.Timestamp;
+import java.math.BigDecimal;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2023-03-23
+**/
+@Data
+public class SysExchangeRateDto extends BaseDTO implements Serializable {
+
+    /** ID */
+    private Long id;
+
+    /** 单价币种 */
+    private String unitCurrency;
+
+    /** 汇率 */
+    private BigDecimal exchangeRate;
+
+    /** 备注 */
+    private String remarks;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateQueryCriteria.java
new file mode 100644
index 0000000..7853b66
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysExchangeRateQueryCriteria.java
@@ -0,0 +1,33 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.service.dto;
+
+import lombok.Data;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-03-23
+**/
+@Data
+public class SysExchangeRateQueryCriteria{
+
+    /** 精确 */
+    @Query
+    private String unitCurrency;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysExchangeRateServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysExchangeRateServiceImpl.java
new file mode 100644
index 0000000..b69a13b
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysExchangeRateServiceImpl.java
@@ -0,0 +1,134 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.service.impl;
+
+import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.system.domain.SysExchangeRate;
+import me.zhengjie.modules.system.domain.SysGoalSetting;
+import me.zhengjie.modules.system.repository.DictDetailRepository;
+import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.system.repository.SysExchangeRateRepository;
+import me.zhengjie.modules.system.service.SysExchangeRateService;
+import me.zhengjie.modules.system.service.dto.SysExchangeRateDto;
+import me.zhengjie.modules.system.service.dto.SysExchangeRateQueryCriteria;
+import me.zhengjie.modules.system.service.mapstruct.SysExchangeRateMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import me.zhengjie.utils.PageUtil;
+import me.zhengjie.utils.QueryHelp;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author 赵士淞
+* @date 2023-03-23
+**/
+@Service
+@RequiredArgsConstructor
+public class SysExchangeRateServiceImpl implements SysExchangeRateService {
+
+    private final SysExchangeRateRepository sysExchangeRateRepository;
+    private final SysExchangeRateMapper sysExchangeRateMapper;
+    private final DictDetailRepository dictDetailRepository;
+
+    @Override
+    public Map<String,Object> queryAll(SysExchangeRateQueryCriteria criteria, Pageable pageable){
+        Page<SysExchangeRate> page = sysExchangeRateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+        return PageUtil.toPage(page.map(sysExchangeRateMapper::toDto));
+    }
+
+    @Override
+    public List<SysExchangeRateDto> queryAll(SysExchangeRateQueryCriteria criteria){
+        return sysExchangeRateMapper.toDto(sysExchangeRateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+    }
+
+    @Override
+    @Transactional
+    public SysExchangeRateDto findById(Long id) {
+        SysExchangeRate sysExchangeRate = sysExchangeRateRepository.findById(id).orElseGet(SysExchangeRate::new);
+        ValidationUtil.isNull(sysExchangeRate.getId(),"SysExchangeRate","id",id);
+        return sysExchangeRateMapper.toDto(sysExchangeRate);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public SysExchangeRateDto create(SysExchangeRate resources) {
+        createOrUpdateCheck(resources);
+        return sysExchangeRateMapper.toDto(sysExchangeRateRepository.save(resources));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void update(SysExchangeRate resources) {
+        SysExchangeRate sysExchangeRate = sysExchangeRateRepository.findById(resources.getId()).orElseGet(SysExchangeRate::new);
+        ValidationUtil.isNull( sysExchangeRate.getId(),"SysExchangeRate","id",resources.getId());
+        sysExchangeRate.copy(resources);
+        createOrUpdateCheck(sysExchangeRate);
+        sysExchangeRateRepository.save(sysExchangeRate);
+    }
+
+    @Override
+    public void deleteAll(Long[] ids) {
+        for (Long id : ids) {
+            sysExchangeRateRepository.deleteById(id);
+        }
+    }
+
+    @Override
+    public void download(List<SysExchangeRateDto> all, HttpServletResponse response) throws IOException {
+        List<Map<String, Object>> list = new ArrayList<>();
+        for (SysExchangeRateDto sysExchangeRate : all) {
+            String unitCurrency = sysExchangeRate.getUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_UNIT_CURRENCY, sysExchangeRate.getUnitCurrency()).getLabel() : "";
+            Map<String,Object> map = new LinkedHashMap<>();
+            map.put("单价币种", unitCurrency);
+            map.put("汇率", sysExchangeRate.getExchangeRate());
+            map.put("备注", sysExchangeRate.getRemarks());
+            map.put("创建者", sysExchangeRate.getCreateBy());
+            map.put("创建时间", sysExchangeRate.getCreateTime());
+            map.put("更新者", sysExchangeRate.getUpdateBy());
+            map.put("更新时间", sysExchangeRate.getUpdateTime());
+            list.add(map);
+        }
+        FileUtil.downloadExcel(list, response);
+    }
+
+    private void createOrUpdateCheck(SysExchangeRate resources) {
+        // 汇率检索类
+        SysExchangeRateQueryCriteria criteria = new SysExchangeRateQueryCriteria();
+        criteria.setUnitCurrency(resources.getUnitCurrency());
+        // 查询汇率数据
+        List<SysExchangeRateDto> sysExchangeRateDtoList = queryAll(criteria);
+        // 判断汇率数据
+        if (sysExchangeRateDtoList.size() > 1) {
+            throw new BadRequestException("此单价币种已有汇率数据!");
+        } else if (sysExchangeRateDtoList.size() == 1) {
+            if (sysExchangeRateDtoList.get(0).getId() != resources.getId()) {
+                throw new BadRequestException("此单价币种已有汇率数据!");
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysGoalSettingServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysGoalSettingServiceImpl.java
index aee6944..65ea7f1 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysGoalSettingServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysGoalSettingServiceImpl.java
@@ -79,14 +79,14 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public SysGoalSettingDto create(SysGoalSetting resources) throws Exception {
+    public SysGoalSettingDto create(SysGoalSetting resources) {
         createOrUpdateCheck(resources);
         return sysGoalSettingMapper.toDto(sysGoalSettingRepository.save(resources));
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void update(SysGoalSetting resources) throws Exception {
+    public void update(SysGoalSetting resources) {
         SysGoalSetting sysGoalSetting = sysGoalSettingRepository.findById(resources.getId()).orElseGet(SysGoalSetting::new);
         ValidationUtil.isNull( sysGoalSetting.getId(),"SysGoalSetting","id",resources.getId());
         sysGoalSetting.copy(resources);
@@ -122,7 +122,7 @@
         FileUtil.downloadExcel(list, response);
     }
 
-    private void createOrUpdateCheck(SysGoalSetting resources) throws Exception {
+    private void createOrUpdateCheck(SysGoalSetting resources) {
         // 日期格式化
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String targetYear = sdf.format(resources.getTargetYear());
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysExchangeRateMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysExchangeRateMapper.java
new file mode 100644
index 0000000..937082a
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysExchangeRateMapper.java
@@ -0,0 +1,32 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.system.domain.SysExchangeRate;
+import me.zhengjie.modules.system.service.dto.SysExchangeRateDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-03-23
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface SysExchangeRateMapper extends BaseMapper<SysExchangeRateDto, SysExchangeRate> {
+
+}
\ No newline at end of file
diff --git a/eladmin-web-master/src/api/system/exchangeRate.js b/eladmin-web-master/src/api/system/exchangeRate.js
new file mode 100644
index 0000000..e2b1483
--- /dev/null
+++ b/eladmin-web-master/src/api/system/exchangeRate.js
@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+  return request({
+    url: 'api/sysExchangeRate/all',
+    method: 'get',
+    params
+  })
+}
+
+export function add(data) {
+  return request({
+    url: 'api/sysExchangeRate',
+    method: 'post',
+    data
+  })
+}
+
+export function del(ids) {
+  return request({
+    url: 'api/sysExchangeRate/',
+    method: 'delete',
+    data: ids
+  })
+}
+
+export function edit(data) {
+  return request({
+    url: 'api/sysExchangeRate',
+    method: 'put',
+    data
+  })
+}
+
+export default { getAll, add, edit, del }
diff --git a/eladmin-web-master/src/views/project/chart/subgroupTopHours.vue b/eladmin-web-master/src/views/project/chart/subgroupTopHours.vue
index fcf07f8..e8b9255 100644
--- a/eladmin-web-master/src/views/project/chart/subgroupTopHours.vue
+++ b/eladmin-web-master/src/views/project/chart/subgroupTopHours.vue
@@ -65,7 +65,7 @@
 .leave-title {
   color: #55A4C4;
   width: 100%;
-  text-align: center;
+  text-align: left;
   font-size: 18px;
 }
 .leave-box {
diff --git a/eladmin-web-master/src/views/system/exchangeRate/index.vue b/eladmin-web-master/src/views/system/exchangeRate/index.vue
new file mode 100644
index 0000000..7641b89
--- /dev/null
+++ b/eladmin-web-master/src/views/system/exchangeRate/index.vue
@@ -0,0 +1,146 @@
+<template>
+  <div class="app-container">
+    <!--工具栏-->
+    <div class="head-container">
+      <div v-if="crud.props.searchToggle">
+        <!-- 搜索 -->
+        <el-select v-model="query.unitCurrency" filterable clearable placeholder="币种" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+          <el-option
+            v-for="item in dict[standardUnitCurrency]"
+            :key="item.id"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+        <rrOperation :crud="crud" />
+      </div>
+      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
+      <crudOperation :permission="permission" />
+      <!--表单组件-->
+      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
+        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
+          <el-form-item label="币种" prop="unitCurrency">
+            <el-select v-model="form.unitCurrency" filterable placeholder="请选择" style="width: 370px;">
+              <el-option
+                v-for="item in dict[standardUnitCurrency]"
+                :key="item.id"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="汇率" prop="exchangeRate">
+            <money-input :key="random" v-model="form.exchangeRate" :width="370" />
+            <div class="prompt-text">例:选择币种:美元。1美元≈6.87人民币。汇率:6.87。</div>
+          </el-form-item>
+          <el-form-item label="备注">
+            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" />
+          </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="text" @click="crud.cancelCU">取消</el-button>
+          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
+        </div>
+      </el-dialog>
+      <!--表格渲染-->
+      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+        <el-table-column type="selection" width="55" />
+        <el-table-column :show-overflow-tooltip="true" prop="unitCurrency" label="单价币种">
+          <template slot-scope="scope">
+            {{ dict.label[standardUnitCurrency][scope.row.unitCurrency] }}
+          </template>
+        </el-table-column>
+        <el-table-column :show-overflow-tooltip="true" prop="exchangeRate" label="汇率">
+          <template slot-scope="scope">
+            {{ crud.toMoney(scope.row.exchangeRate) }}
+          </template>
+        </el-table-column>
+        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" />
+        <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" />
+        <el-table-column v-if="checkPer(['admin','sysExchangeRate:edit','sysExchangeRate:del'])" label="操作" width="150px" align="center">
+          <template slot-scope="scope">
+            <udOperation
+              :data="scope.row"
+              :permission="permission"
+            />
+          </template>
+        </el-table-column>
+      </el-table>
+      <!--分页组件-->
+      <pagination />
+    </div>
+  </div>
+</template>
+
+<script>
+import crudSysExchangeRate from '@/api/system/exchangeRate'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+import constant from '../../../utils/constant'
+import moneyInput from '../../assembly/moneyInput/index.vue'
+
+const defaultForm = { id: null, unitCurrency: null, exchangeRate: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+  name: 'SysExchangeRate',
+  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
+  mixins: [presenter(), header(), form(defaultForm), crud()],
+  dicts: [constant.STANDARD_UNIT_CURRENCY],
+  cruds() {
+    return CRUD({ title: '汇率管理', url: 'api/sysExchangeRate', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysExchangeRate }})
+  },
+  data() {
+    // 汇率(千万内)验证
+    var rateValidate = (rule, value, callback) => {
+      if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 10000000)) {
+        callback(new Error('请输入 一千万 以内的正整数或两位小数'))
+      } else {
+        callback()
+      }
+    }
+    return {
+      permission: {
+        add: ['admin', 'sysExchangeRate:add'],
+        edit: ['admin', 'sysExchangeRate:edit'],
+        del: ['admin', 'sysExchangeRate:del'],
+        download: ['admin', 'sysExchangeRate:download']
+      },
+      rules: {
+        unitCurrency: [
+          { required: true, message: '币种不能为空', trigger: 'change' }
+        ],
+        exchangeRate: [
+          { required: true, message: '汇率不能为空', trigger: 'blur' },
+          { validator: rateValidate, trigger: 'blur' }
+        ]
+      },
+      queryTypeOptions: [
+        { key: 'unitCurrency', display_name: '币种' }
+      ],
+      // 字典:标准单价币种
+      standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY,
+      // 随机数
+      random: 0
+    }
+  },
+  methods: {
+    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+    [CRUD.HOOK.beforeRefresh]() {
+      return true
+    },
+    // 钩子: 开始 "新建/编辑" - 之前
+    [CRUD.HOOK.beforeToCU]() {
+      // 随机数
+      this.random = Math.random()
+    }
+  }
+}
+</script>
+
+<style scoped>
+.prompt-text {
+  font-size: 10px;
+}
+</style>

--
Gitblit v1.9.3