From 6944ae7557a8f08fa0d5c9adc8e318882db844b4 Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Wed, 12 Apr 2023 03:37:37 +0000
Subject: [PATCH] 年度资金账户(现金流)
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountMoneyServiceImpl.java | 150 ++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyQueryCriteria.java | 42 ++
eladmin-web-master/src/api/capital/accountMoney.js | 35 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountMoneyService.java | 83 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountMoneyRepository.java | 38 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyDto.java | 57 +++
eladmin-web-master/src/views/capital/accountMoney/index.vue | 199 +++++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountMoneyMapper.java | 32 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountMoney.java | 84 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountMoneyController.java | 95 ++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/CapitalTask.java | 47 +++
11 files changed, 862 insertions(+), 0 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountMoney.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountMoney.java
new file mode 100644
index 0000000..e6b2942
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountMoney.java
@@ -0,0 +1,84 @@
+/*
+* 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.capital.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-04-12
+**/
+@Entity
+@Data
+@Table(name="capital_account_money")
+public class CapitalAccountMoney extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "ID")
+ private Long id;
+
+ @Column(name = "`account_name`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "账户名称")
+ private String accountName;
+
+ @Column(name = "`account_year`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "账户年度")
+ private Timestamp accountYear;
+
+ @Column(name = "`opening_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "期初金额")
+ private BigDecimal openingAmount;
+
+ @Column(name = "`warn_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "警戒金额")
+ private BigDecimal warnAmount;
+
+ @Column(name = "`account_amount`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "账户金额")
+ private BigDecimal accountAmount;
+
+ @Column(name = "`settlement_status`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "结算状态")
+ private String settlementStatus;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ public void copy(CapitalAccountMoney source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountMoneyRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountMoneyRepository.java
new file mode 100644
index 0000000..f542846
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountMoneyRepository.java
@@ -0,0 +1,38 @@
+/*
+* 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.capital.repository;
+
+import me.zhengjie.modules.capital.domain.CapitalAccountMoney;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-04-12
+**/
+public interface CapitalAccountMoneyRepository extends JpaRepository<CapitalAccountMoney, Long>, JpaSpecificationExecutor<CapitalAccountMoney> {
+
+ /**
+ * 根据账户年度查询
+ * @param accountYear
+ * @return
+ */
+ List<CapitalAccountMoney> findByAccountYear(Timestamp accountYear);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountMoneyController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountMoneyController.java
new file mode 100644
index 0000000..473c0fd
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountMoneyController.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.capital.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.capital.domain.CapitalAccountMoney;
+import me.zhengjie.modules.capital.service.CapitalAccountMoneyService;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyQueryCriteria;
+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-04-12
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "年度资金账户(现金流)管理")
+@RequestMapping("/api/capitalAccountMoney")
+public class CapitalAccountMoneyController {
+
+ private final CapitalAccountMoneyService capitalAccountMoneyService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('capitalAccountMoney:download')")
+ public void exportCapitalAccountMoney(HttpServletResponse response, CapitalAccountMoneyQueryCriteria criteria) throws IOException {
+ capitalAccountMoneyService.download(capitalAccountMoneyService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询年度资金账户(现金流)")
+ @ApiOperation("查询年度资金账户(现金流)")
+ @PreAuthorize("@el.check('capitalAccountMoney:list')")
+ public ResponseEntity<Object> queryCapitalAccountMoney(CapitalAccountMoneyQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(capitalAccountMoneyService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询年度资金账户(现金流)")
+ @ApiOperation("查询年度资金账户(现金流)")
+ @PreAuthorize("@el.check('capitalAccountMoney:list')")
+ public ResponseEntity<Object> queryCapitalAccountMoney(CapitalAccountMoneyQueryCriteria criteria){
+ return new ResponseEntity<>(capitalAccountMoneyService.queryAll(criteria),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增年度资金账户(现金流)")
+ @ApiOperation("新增年度资金账户(现金流)")
+ @PreAuthorize("@el.check('capitalAccountMoney:add')")
+ public ResponseEntity<Object> createCapitalAccountMoney(@Validated @RequestBody CapitalAccountMoney resources){
+ return new ResponseEntity<>(capitalAccountMoneyService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改年度资金账户(现金流)")
+ @ApiOperation("修改年度资金账户(现金流)")
+ @PreAuthorize("@el.check('capitalAccountMoney:edit')")
+ public ResponseEntity<Object> updateCapitalAccountMoney(@Validated @RequestBody CapitalAccountMoney resources){
+ capitalAccountMoneyService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除年度资金账户(现金流)")
+ @ApiOperation("删除年度资金账户(现金流)")
+ @PreAuthorize("@el.check('capitalAccountMoney:del')")
+ public ResponseEntity<Object> deleteCapitalAccountMoney(@RequestBody Long[] ids) {
+ capitalAccountMoneyService.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/capital/service/CapitalAccountMoneyService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountMoneyService.java
new file mode 100644
index 0000000..517ddca
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountMoneyService.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.capital.service;
+
+import me.zhengjie.modules.capital.domain.CapitalAccountMoney;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyDto;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyQueryCriteria;
+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-04-12
+**/
+public interface CapitalAccountMoneyService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(CapitalAccountMoneyQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<CapitalAccountMoneyDto>
+ */
+ List<CapitalAccountMoneyDto> queryAll(CapitalAccountMoneyQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return CapitalAccountMoneyDto
+ */
+ CapitalAccountMoneyDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return CapitalAccountMoneyDto
+ */
+ CapitalAccountMoneyDto create(CapitalAccountMoney resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(CapitalAccountMoney resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<CapitalAccountMoneyDto> all, HttpServletResponse response) throws IOException;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyDto.java
new file mode 100644
index 0000000..93ebba0
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyDto.java
@@ -0,0 +1,57 @@
+/*
+* 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.capital.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-04-12
+**/
+@Data
+public class CapitalAccountMoneyDto extends BaseDTO implements Serializable {
+
+ /** ID */
+ private Long id;
+
+ /** 账户名称 */
+ private String accountName;
+
+ /** 账户年度 */
+ private Timestamp accountYear;
+
+ /** 期初金额 */
+ private BigDecimal openingAmount;
+
+ /** 警戒金额 */
+ private BigDecimal warnAmount;
+
+ /** 账户金额 */
+ private BigDecimal accountAmount;
+
+ /** 结算状态 */
+ private String settlementStatus;
+
+ /** 备注 */
+ private String remarks;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyQueryCriteria.java
new file mode 100644
index 0000000..33864e5
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountMoneyQueryCriteria.java
@@ -0,0 +1,42 @@
+/*
+* 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.capital.service.dto;
+
+import lombok.Data;
+import java.sql.Timestamp;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@Data
+public class CapitalAccountMoneyQueryCriteria{
+
+ /** 模糊 */
+ @Query(type = Query.Type.INNER_LIKE)
+ private String accountName;
+
+ /** 精确 */
+ @Query
+ private String accountYear;
+
+ /** 精确 */
+ @Query
+ private String settlementStatus;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountMoneyServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountMoneyServiceImpl.java
new file mode 100644
index 0000000..35af95f
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountMoneyServiceImpl.java
@@ -0,0 +1,150 @@
+/*
+* 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.capital.service.impl;
+
+import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.capital.domain.CapitalAccountMoney;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.capital.repository.CapitalAccountMoneyRepository;
+import me.zhengjie.modules.capital.service.CapitalAccountMoneyService;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyDto;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyQueryCriteria;
+import me.zhengjie.modules.capital.service.mapstruct.CapitalAccountMoneyMapper;
+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-04-12
+**/
+@Service
+@RequiredArgsConstructor
+public class CapitalAccountMoneyServiceImpl implements CapitalAccountMoneyService {
+
+ private final CapitalAccountMoneyRepository capitalAccountMoneyRepository;
+ private final CapitalAccountMoneyMapper capitalAccountMoneyMapper;
+
+ @Override
+ public Map<String,Object> queryAll(CapitalAccountMoneyQueryCriteria criteria, Pageable pageable){
+ Page<CapitalAccountMoney> page = capitalAccountMoneyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ return PageUtil.toPage(page.map(capitalAccountMoneyMapper::toDto));
+ }
+
+ @Override
+ public List<CapitalAccountMoneyDto> queryAll(CapitalAccountMoneyQueryCriteria criteria){
+ return capitalAccountMoneyMapper.toDto(capitalAccountMoneyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public CapitalAccountMoneyDto findById(Long id) {
+ CapitalAccountMoney capitalAccountMoney = capitalAccountMoneyRepository.findById(id).orElseGet(CapitalAccountMoney::new);
+ ValidationUtil.isNull(capitalAccountMoney.getId(),"CapitalAccountMoney","id",id);
+ return capitalAccountMoneyMapper.toDto(capitalAccountMoney);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public CapitalAccountMoneyDto create(CapitalAccountMoney resources) {
+ // 拷贝后校验
+ copyAfterCheck(resources);
+ return capitalAccountMoneyMapper.toDto(capitalAccountMoneyRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(CapitalAccountMoney resources) {
+ CapitalAccountMoney capitalAccountMoney = capitalAccountMoneyRepository.findById(resources.getId()).orElseGet(CapitalAccountMoney::new);
+ ValidationUtil.isNull( capitalAccountMoney.getId(),"CapitalAccountMoney","id",resources.getId());
+ // 拷贝前校验
+ copyBeforeCheck(capitalAccountMoney);
+ capitalAccountMoney.copy(resources);
+ // 拷贝后校验
+ copyAfterCheck(capitalAccountMoney);
+ capitalAccountMoneyRepository.save(capitalAccountMoney);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ capitalAccountMoneyRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<CapitalAccountMoneyDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (CapitalAccountMoneyDto capitalAccountMoney : all) {
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("账户名称", capitalAccountMoney.getAccountName());
+ map.put("账户年度", capitalAccountMoney.getAccountYear());
+ map.put("期初金额", capitalAccountMoney.getOpeningAmount());
+ map.put("警戒金额", capitalAccountMoney.getWarnAmount());
+ map.put("账户金额", capitalAccountMoney.getAccountAmount());
+ map.put("结算状态", capitalAccountMoney.getSettlementStatus());
+ map.put("备注", capitalAccountMoney.getRemarks());
+ map.put("创建者", capitalAccountMoney.getCreateBy());
+ map.put("创建时间", capitalAccountMoney.getCreateTime());
+ map.put("更新者", capitalAccountMoney.getUpdateBy());
+ map.put("更新时间", capitalAccountMoney.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+
+ /**
+ * 拷贝前校验
+ * @param resources
+ */
+ private void copyBeforeCheck(CapitalAccountMoney resources) {
+ // 判断结算状态
+ if (Constant.SETTLEMENT_STATUS_SETTLED.equals(resources.getSettlementStatus())) {
+ throw new BadRequestException("已结算的现金流账户无法进行修改!");
+ }
+ }
+
+ /**
+ * 拷贝后校验
+ * @param resources
+ */
+ private void copyAfterCheck(CapitalAccountMoney resources) {
+ // 根据账户年度查询
+ List<CapitalAccountMoney> capitalAccountMoneyList = capitalAccountMoneyRepository.findByAccountYear(resources.getAccountYear());
+ // 判断结果集长度
+ if (capitalAccountMoneyList.size() > 1) {
+ throw new BadRequestException("每个年度只能有一个现金流账户!");
+ } else if (capitalAccountMoneyList.size() == 1) {
+ if (resources.getId() == null || capitalAccountMoneyList.get(0).getId().longValue() != resources.getId().longValue()) {
+ throw new BadRequestException("每个年度只能有一个现金流账户!");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountMoneyMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountMoneyMapper.java
new file mode 100644
index 0000000..f0bc323
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountMoneyMapper.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.capital.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.capital.domain.CapitalAccountMoney;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountMoneyDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface CapitalAccountMoneyMapper extends BaseMapper<CapitalAccountMoneyDto, CapitalAccountMoney> {
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/CapitalTask.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/CapitalTask.java
new file mode 100644
index 0000000..8ca938c
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/CapitalTask.java
@@ -0,0 +1,47 @@
+package me.zhengjie.modules.quartz.task;
+
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.modules.capital.domain.CapitalAccountMoney;
+import me.zhengjie.modules.capital.service.CapitalAccountMoneyService;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.quartz.utils.DateTimeUtil;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+/**
+ * 资金管理定时任务
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+@Async
+public class CapitalTask {
+
+ private final CapitalAccountMoneyService capitalAccountMoneyService;
+
+ // 年度资金账户(现金流)创建
+ public void accountMoneyCreate() {
+ // 日期类
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.MONTH, 0);
+ calendar.set(Calendar.DATE, 1);
+ calendar.set(Calendar.HOUR, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ // 实体类
+ CapitalAccountMoney resources = new CapitalAccountMoney();
+ resources.setAccountName(calendar.get(Calendar.YEAR) + "年度现金池");
+ resources.setAccountYear(DateTimeUtil.getTimestamp(calendar.getTime()));
+ resources.setOpeningAmount(new BigDecimal(0));
+ resources.setWarnAmount(new BigDecimal(0));
+ resources.setAccountAmount(new BigDecimal(0));
+ resources.setSettlementStatus(Constant.SETTLEMENT_STATUS_UNSETTLED);
+ // 创建
+ capitalAccountMoneyService.create(resources);
+ }
+}
diff --git a/eladmin-web-master/src/api/capital/accountMoney.js b/eladmin-web-master/src/api/capital/accountMoney.js
new file mode 100644
index 0000000..9babc4f
--- /dev/null
+++ b/eladmin-web-master/src/api/capital/accountMoney.js
@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/capitalAccountMoney',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/capitalAccountMoney',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/capitalAccountMoney/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/capitalAccountMoney',
+ method: 'put',
+ data
+ })
+}
+
+export default { getAll, add, edit, del }
diff --git a/eladmin-web-master/src/views/capital/accountMoney/index.vue b/eladmin-web-master/src/views/capital/accountMoney/index.vue
new file mode 100644
index 0000000..62315f9
--- /dev/null
+++ b/eladmin-web-master/src/views/capital/accountMoney/index.vue
@@ -0,0 +1,199 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div v-if="crud.props.searchToggle">
+ <!-- 搜索 -->
+ <el-input v-model="query.accountName" clearable placeholder="账户名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+ <el-date-picker v-model="query.accountYear" type="year" clearable placeholder="账户年度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+ <el-select v-model="query.settlementStatus" filterable clearable placeholder="结算状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in dict[settlementStatus]"
+ :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="accountName">
+ <el-input v-model="form.accountName" style="width: 370px;" :disabled="formDisabled" />
+ </el-form-item>
+ <el-form-item label="账户年度" prop="accountYear">
+ <el-date-picker v-model="form.accountYear" type="year" style="width: 370px;" :disabled="formDisabled" />
+ </el-form-item>
+ <el-form-item label="期初金额" prop="openingAmount">
+ <money-input :key="random" v-model="form.openingAmount" :width="370" :disabled="formDisabled" />
+ </el-form-item>
+ <el-form-item label="警戒金额" prop="warnAmount">
+ <money-input :key="random" v-model="form.warnAmount" :width="370" :disabled="formDisabled" />
+ </el-form-item>
+ <el-form-item label="账户金额" prop="accountAmount">
+ <money-input :key="random" v-model="form.accountAmount" :width="370" :disabled="formDisabled" />
+ </el-form-item>
+ <el-form-item label="结算状态" prop="settlementStatus">
+ <el-select v-model="form.settlementStatus" filterable placeholder="请选择" style="width: 370px;" :disabled="formDisabled">
+ <el-option
+ v-for="item in dict[settlementStatus]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="备注">
+ <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" :disabled="formDisabled" />
+ </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="accountName" label="账户名称" />
+ <el-table-column :show-overflow-tooltip="true" prop="accountYear" label="账户年度">
+ <template slot-scope="scope">
+ {{ crud.toYear(scope.row.accountYear) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="openingAmount" label="期初金额">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.openingAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="warnAmount" label="警戒金额">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.warnAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="accountAmount" label="账户金额">
+ <template slot-scope="scope">
+ {{ crud.toMoney(scope.row.accountAmount) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" label="结算状态">
+ <template slot-scope="scope">
+ <el-tag>{{ dict.label[settlementStatus][scope.row.settlementStatus] }}</el-tag>
+ </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','capitalAccountMoney:edit','capitalAccountMoney: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 crudCapitalAccountMoney from '@/api/capital/accountMoney'
+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, accountName: null, accountYear: null, openingAmount: null, warnAmount: null, accountAmount: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+ name: 'CapitalAccountMoney',
+ components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ dicts: [constant.SETTLEMENT_STATUS],
+ cruds() {
+ return CRUD({ title: '年度资金账户(现金流)', url: 'api/capitalAccountMoney', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalAccountMoney }})
+ },
+ data() {
+ // 金额(亿内)验证
+ var amountValidate = (rule, value, callback) => {
+ if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 100000000)) {
+ callback(new Error('请输入 一亿 以内的正整数或两位小数'))
+ } else {
+ callback()
+ }
+ }
+ return {
+ permission: {
+ add: ['admin', 'capitalAccountMoney:add'],
+ edit: ['admin', 'capitalAccountMoney:edit'],
+ del: ['admin', 'capitalAccountMoney:del']
+ },
+ rules: {
+ accountName: [
+ { required: true, message: '账户名称不能为空', trigger: 'blur' },
+ { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
+ ],
+ accountYear: [
+ { required: true, message: '账户年度不能为空', trigger: 'change' }
+ ],
+ openingAmount: [
+ { required: true, message: '期初金额不能为空', trigger: 'blur' },
+ { validator: amountValidate, trigger: 'blur' }
+ ],
+ warnAmount: [
+ { required: true, message: '警戒金额不能为空', trigger: 'blur' },
+ { validator: amountValidate, trigger: 'blur' }
+ ],
+ accountAmount: [
+ { required: true, message: '账户金额不能为空', trigger: 'blur' },
+ { validator: amountValidate, trigger: 'blur' }
+ ],
+ settlementStatus: [
+ { required: true, message: '结算状态不能为空', trigger: 'change' }
+ ]
+ },
+ queryTypeOptions: [
+ { key: 'accountName', display_name: '账户名称' },
+ { key: 'accountYear', display_name: '账户年度' },
+ { key: 'settlementStatus', display_name: '结算状态' }
+ ],
+ // 字典:结算状态
+ settlementStatus: constant.SETTLEMENT_STATUS,
+ // 随机数
+ random: 0,
+ // 表单禁用
+ formDisabled: false
+ }
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ return true
+ },
+ // 钩子: 开始 "新建/编辑" - 之前
+ [CRUD.HOOK.beforeToCU]() {
+ // 判断结算状态
+ if (this.crud.form.settlementStatus === constant.SETTLEMENT_STATUS_SETTLED) {
+ // 表单禁用
+ this.formDisabled = true
+ } else {
+ // 表单禁用
+ this.formDisabled = false
+ }
+ // 随机数
+ this.random = Math.random()
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.3