From dbfecd6423a625edac78aaafeea3d8a9bd2b0928 Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Wed, 12 Apr 2023 06:06:46 +0000
Subject: [PATCH] 年度资金账户(公司流)
---
eladmin-web-master/src/api/capital/accountMoney.js | 2
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountCompanyService.java | 83 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompany.java | 94 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanyDto.java | 63 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanyController.java | 95 +++++
eladmin-web-master/src/views/capital/accountCompany/index.vue | 262 ++++++++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountCompanyServiceImpl.java | 153 +++++++++
eladmin-web-master/src/api/capital/accountCompany.js | 35 ++
eladmin-web-master/src/utils/constant.js | 18 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountCompanyMapper.java | 32 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanyQueryCriteria.java | 50 +++
eladmin-web-master/src/views/capital/accountMoney/index.vue | 11
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanyRepository.java | 40 ++
13 files changed, 933 insertions(+), 5 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompany.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompany.java
new file mode 100644
index 0000000..89a9561
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompany.java
@@ -0,0 +1,94 @@
+/*
+* 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_company")
+public class CapitalAccountCompany extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "ID")
+ private Long id;
+
+ @Column(name = "`project_distinguish`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "项目区分")
+ private String projectDistinguish;
+
+ @Column(name = "`account_type`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "账户类型")
+ private String accountType;
+
+ @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(CapitalAccountCompany source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanyRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanyRepository.java
new file mode 100644
index 0000000..fcf2870
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanyRepository.java
@@ -0,0 +1,40 @@
+/*
+* 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.CapitalAccountCompany;
+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 CapitalAccountCompanyRepository extends JpaRepository<CapitalAccountCompany, Long>, JpaSpecificationExecutor<CapitalAccountCompany> {
+
+ /**
+ * 根据项目区分、账户类型、账户年度查询
+ * @param projectDistinguish
+ * @param accountType
+ * @param accountYear
+ * @return
+ */
+ List<CapitalAccountCompany> findByProjectDistinguishAndAccountTypeAndAccountYear(String projectDistinguish, String accountType, Timestamp accountYear);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanyController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanyController.java
new file mode 100644
index 0000000..99e67b9
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanyController.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.CapitalAccountCompany;
+import me.zhengjie.modules.capital.service.CapitalAccountCompanyService;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyQueryCriteria;
+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/capitalAccountCompany")
+public class CapitalAccountCompanyController {
+
+ private final CapitalAccountCompanyService capitalAccountCompanyService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('capitalAccountCompany:download')")
+ public void exportCapitalAccountCompany(HttpServletResponse response, CapitalAccountCompanyQueryCriteria criteria) throws IOException {
+ capitalAccountCompanyService.download(capitalAccountCompanyService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询年度资金账户(公司流)")
+ @ApiOperation("查询年度资金账户(公司流)")
+ @PreAuthorize("@el.check('capitalAccountCompany:list')")
+ public ResponseEntity<Object> queryCapitalAccountCompany(CapitalAccountCompanyQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(capitalAccountCompanyService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询年度资金账户(公司流)")
+ @ApiOperation("查询年度资金账户(公司流)")
+ @PreAuthorize("@el.check('capitalAccountCompany:list')")
+ public ResponseEntity<Object> queryCapitalAccountCompany(CapitalAccountCompanyQueryCriteria criteria){
+ return new ResponseEntity<>(capitalAccountCompanyService.queryAll(criteria),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增年度资金账户(公司流)")
+ @ApiOperation("新增年度资金账户(公司流)")
+ @PreAuthorize("@el.check('capitalAccountCompany:add')")
+ public ResponseEntity<Object> createCapitalAccountCompany(@Validated @RequestBody CapitalAccountCompany resources){
+ return new ResponseEntity<>(capitalAccountCompanyService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改年度资金账户(公司流)")
+ @ApiOperation("修改年度资金账户(公司流)")
+ @PreAuthorize("@el.check('capitalAccountCompany:edit')")
+ public ResponseEntity<Object> updateCapitalAccountCompany(@Validated @RequestBody CapitalAccountCompany resources){
+ capitalAccountCompanyService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除年度资金账户(公司流)")
+ @ApiOperation("删除年度资金账户(公司流)")
+ @PreAuthorize("@el.check('capitalAccountCompany:del')")
+ public ResponseEntity<Object> deleteCapitalAccountCompany(@RequestBody Long[] ids) {
+ capitalAccountCompanyService.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/CapitalAccountCompanyService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountCompanyService.java
new file mode 100644
index 0000000..dc30909
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountCompanyService.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.CapitalAccountCompany;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyQueryCriteria;
+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 CapitalAccountCompanyService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(CapitalAccountCompanyQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<CapitalAccountCompanyDto>
+ */
+ List<CapitalAccountCompanyDto> queryAll(CapitalAccountCompanyQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return CapitalAccountCompanyDto
+ */
+ CapitalAccountCompanyDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return CapitalAccountCompanyDto
+ */
+ CapitalAccountCompanyDto create(CapitalAccountCompany resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(CapitalAccountCompany resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<CapitalAccountCompanyDto> 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/CapitalAccountCompanyDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanyDto.java
new file mode 100644
index 0000000..5344e53
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanyDto.java
@@ -0,0 +1,63 @@
+/*
+* 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 CapitalAccountCompanyDto extends BaseDTO implements Serializable {
+
+ /** ID */
+ private Long id;
+
+ /** 项目区分 */
+ private String projectDistinguish;
+
+ /** 账户类型 */
+ private String accountType;
+
+ /** 账户名称 */
+ 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/CapitalAccountCompanyQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanyQueryCriteria.java
new file mode 100644
index 0000000..b3f8b0f
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanyQueryCriteria.java
@@ -0,0 +1,50 @@
+/*
+* 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 CapitalAccountCompanyQueryCriteria{
+
+ /** 精确 */
+ @Query
+ private String projectDistinguish;
+
+ /** 精确 */
+ @Query
+ private String accountType;
+
+ /** 模糊 */
+ @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/CapitalAccountCompanyServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountCompanyServiceImpl.java
new file mode 100644
index 0000000..e16dd4c
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountCompanyServiceImpl.java
@@ -0,0 +1,153 @@
+/*
+* 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.CapitalAccountCompany;
+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.CapitalAccountCompanyRepository;
+import me.zhengjie.modules.capital.service.CapitalAccountCompanyService;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyQueryCriteria;
+import me.zhengjie.modules.capital.service.mapstruct.CapitalAccountCompanyMapper;
+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 CapitalAccountCompanyServiceImpl implements CapitalAccountCompanyService {
+
+ private final CapitalAccountCompanyRepository capitalAccountCompanyRepository;
+ private final CapitalAccountCompanyMapper capitalAccountCompanyMapper;
+
+ @Override
+ public Map<String,Object> queryAll(CapitalAccountCompanyQueryCriteria criteria, Pageable pageable){
+ Page<CapitalAccountCompany> page = capitalAccountCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ return PageUtil.toPage(page.map(capitalAccountCompanyMapper::toDto));
+ }
+
+ @Override
+ public List<CapitalAccountCompanyDto> queryAll(CapitalAccountCompanyQueryCriteria criteria){
+ return capitalAccountCompanyMapper.toDto(capitalAccountCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public CapitalAccountCompanyDto findById(Long id) {
+ CapitalAccountCompany capitalAccountCompany = capitalAccountCompanyRepository.findById(id).orElseGet(CapitalAccountCompany::new);
+ ValidationUtil.isNull(capitalAccountCompany.getId(),"CapitalAccountCompany","id",id);
+ return capitalAccountCompanyMapper.toDto(capitalAccountCompany);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public CapitalAccountCompanyDto create(CapitalAccountCompany resources) {
+ // 拷贝后校验
+ copyAfterCheck(resources);
+ return capitalAccountCompanyMapper.toDto(capitalAccountCompanyRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(CapitalAccountCompany resources) {
+ CapitalAccountCompany capitalAccountCompany = capitalAccountCompanyRepository.findById(resources.getId()).orElseGet(CapitalAccountCompany::new);
+ ValidationUtil.isNull( capitalAccountCompany.getId(),"CapitalAccountCompany","id",resources.getId());
+ // 拷贝前校验
+ copyBeforeCheck(capitalAccountCompany);
+ capitalAccountCompany.copy(resources);
+ // 拷贝后校验
+ copyAfterCheck(capitalAccountCompany);
+ capitalAccountCompanyRepository.save(capitalAccountCompany);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ capitalAccountCompanyRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<CapitalAccountCompanyDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (CapitalAccountCompanyDto capitalAccountCompany : all) {
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("项目区分", capitalAccountCompany.getProjectDistinguish());
+ map.put("账户类型", capitalAccountCompany.getAccountType());
+ map.put("账户名称", capitalAccountCompany.getAccountName());
+ map.put("账户年度", capitalAccountCompany.getAccountYear());
+ map.put("期初金额", capitalAccountCompany.getOpeningAmount());
+ map.put("警戒金额", capitalAccountCompany.getWarnAmount());
+ map.put("账户金额", capitalAccountCompany.getAccountAmount());
+ map.put("结算状态", capitalAccountCompany.getSettlementStatus());
+ map.put("备注", capitalAccountCompany.getRemarks());
+ map.put("创建者", capitalAccountCompany.getCreateBy());
+ map.put("创建时间", capitalAccountCompany.getCreateTime());
+ map.put("更新者", capitalAccountCompany.getUpdateBy());
+ map.put("更新时间", capitalAccountCompany.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+
+ /**
+ * 拷贝前校验
+ * @param resources
+ */
+ private void copyBeforeCheck(CapitalAccountCompany resources) {
+ // 判断结算状态
+ if (Constant.SETTLEMENT_STATUS_SETTLED.equals(resources.getSettlementStatus())) {
+ throw new BadRequestException("已结算的公司流账户无法进行修改!");
+ }
+ }
+
+ /**
+ * 拷贝后校验
+ * @param resources
+ */
+ private void copyAfterCheck(CapitalAccountCompany resources) {
+ // 根据项目区分、账户类型、账户年度查询
+ List<CapitalAccountCompany> capitalAccountCompanyList = capitalAccountCompanyRepository.findByProjectDistinguishAndAccountTypeAndAccountYear(resources.getProjectDistinguish(), resources.getAccountType(), resources.getAccountYear());
+ // 判断结果集长度
+ if (capitalAccountCompanyList.size() > 1) {
+ throw new BadRequestException("每个年度同类型公司流账户只能有一个!");
+ } else if (capitalAccountCompanyList.size() == 1) {
+ if (resources.getId() == null || capitalAccountCompanyList.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/CapitalAccountCompanyMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountCompanyMapper.java
new file mode 100644
index 0000000..2aed73a
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountCompanyMapper.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.CapitalAccountCompany;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto;
+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 CapitalAccountCompanyMapper extends BaseMapper<CapitalAccountCompanyDto, CapitalAccountCompany> {
+
+}
\ No newline at end of file
diff --git a/eladmin-web-master/src/api/capital/accountCompany.js b/eladmin-web-master/src/api/capital/accountCompany.js
new file mode 100644
index 0000000..8e51629
--- /dev/null
+++ b/eladmin-web-master/src/api/capital/accountCompany.js
@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/capitalAccountCompany/all',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/capitalAccountCompany',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/capitalAccountCompany/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/capitalAccountCompany',
+ method: 'put',
+ data
+ })
+}
+
+export default { getAll, add, edit, del }
diff --git a/eladmin-web-master/src/api/capital/accountMoney.js b/eladmin-web-master/src/api/capital/accountMoney.js
index 9babc4f..4bb5b4f 100644
--- a/eladmin-web-master/src/api/capital/accountMoney.js
+++ b/eladmin-web-master/src/api/capital/accountMoney.js
@@ -2,7 +2,7 @@
export function getAll(params) {
return request({
- url: 'api/capitalAccountMoney',
+ url: 'api/capitalAccountMoney/all',
method: 'get',
params
})
diff --git a/eladmin-web-master/src/utils/constant.js b/eladmin-web-master/src/utils/constant.js
index 2a56772..6ad0a8d 100644
--- a/eladmin-web-master/src/utils/constant.js
+++ b/eladmin-web-master/src/utils/constant.js
@@ -324,6 +324,17 @@
// 合同费用类型:合同收入
export const CONTRACR_REVENUE = 'contract_revenue'
+// 账户类型
+export const ACCOUNT_TYPE = 'account_type'
+// 账户类型:起源
+export const ACCOUNT_TYPE_QIYUAN = 'account_type_qiyuan'
+// 账户类型:以恒
+export const ACCOUNT_TYPE_YIHENG = 'account_type_yiheng'
+// 账户类型:咨询
+export const ACCOUNT_TYPE_ZIXUN = 'account_type_zixun'
+// 账户类型:恒臻
+export const ACCOUNT_TYPE_HENGZHEN = 'account_type_hengzhen'
+
export default {
ROLE_LEVEL_SUPER,
ROLE_LEVEL_GENERAL,
@@ -470,5 +481,10 @@
CONTRACT_STATUS_IS_OVER,
CONTRACR_TYPE_COST,
CONTRACR_EXPENDITURE,
- CONTRACR_REVENUE
+ CONTRACR_REVENUE,
+ ACCOUNT_TYPE,
+ ACCOUNT_TYPE_QIYUAN,
+ ACCOUNT_TYPE_YIHENG,
+ ACCOUNT_TYPE_ZIXUN,
+ ACCOUNT_TYPE_HENGZHEN
}
diff --git a/eladmin-web-master/src/views/capital/accountCompany/index.vue b/eladmin-web-master/src/views/capital/accountCompany/index.vue
new file mode 100644
index 0000000..621112b
--- /dev/null
+++ b/eladmin-web-master/src/views/capital/accountCompany/index.vue
@@ -0,0 +1,262 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div v-if="crud.props.searchToggle">
+ <!-- 搜索 -->
+ <el-select v-model="query.projectDistinguish" filterable clearable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in dict[projectDistinguish]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ <el-select v-model="query.accountType" filterable clearable placeholder="账户类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in dict[accountType]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ <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="projectDistinguish">
+ <el-select v-model="form.projectDistinguish" filterable placeholder="请选择" style="width: 370px;" :disabled="formDisabled">
+ <el-option
+ v-for="item in dict[projectDistinguish]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="账户类型" prop="accountType">
+ <el-select v-model="form.accountType" filterable placeholder="请选择" style="width: 370px;" :disabled="formDisabled">
+ <el-option
+ v-for="item in dict[accountType]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item>
+ <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="请选择" :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="projectDistinguish" label="项目区分">
+ <template slot-scope="scope">
+ <el-tag>{{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="accountType" label="账户类型">
+ <template slot-scope="scope">
+ <el-tag>{{ dict.label[accountType][scope.row.accountType] }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="accountName" label="账户名称">
+ <template slot-scope="scope">
+ <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ scope.row.accountName }}</span>
+ </template>
+ </el-table-column>
+ <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">
+ <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ crud.toMoney(scope.row.accountAmount) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" label="结算状态">
+ <template slot-scope="scope">
+ {{ dict.label.settlement_status[scope.row.settlementStatus] }}
+ </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','capitalAccountCompany:edit','capitalAccountCompany: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 crudCapitalAccountCompany from '@/api/capital/accountCompany'
+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, projectDistinguish: null, accountType: 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: 'CapitalAccountCompany',
+ components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ dicts: [constant.PROJECT_DISTINGUISH, constant.ACCOUNT_TYPE, constant.SETTLEMENT_STATUS],
+ cruds() {
+ return CRUD({ title: '年度资金账户(公司流)', url: 'api/capitalAccountCompany', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalAccountCompany }})
+ },
+ 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', 'capitalAccountCompany:add'],
+ edit: ['admin', 'capitalAccountCompany:edit'],
+ del: ['admin', 'capitalAccountCompany:del'],
+ download: ['admin', 'capitalAccountCompany:download']
+ },
+ rules: {
+ projectDistinguish: [
+ { required: true, message: '项目区分不能为空', trigger: 'change' }
+ ],
+ accountType: [
+ { required: true, message: '账户类型不能为空', trigger: 'change' }
+ ],
+ 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: 'projectDistinguish', display_name: '项目区分' },
+ { key: 'accountType', display_name: '账户类型' },
+ { key: 'accountName', display_name: '账户名称' },
+ { key: 'accountYear', display_name: '账户年度' },
+ { key: 'settlementStatus', display_name: '结算状态' }
+ ],
+ // 字典:项目区分
+ projectDistinguish: constant.PROJECT_DISTINGUISH,
+ // 字典:账户类型
+ accountType: constant.ACCOUNT_TYPE,
+ // 字典:结算状态
+ 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>
diff --git a/eladmin-web-master/src/views/capital/accountMoney/index.vue b/eladmin-web-master/src/views/capital/accountMoney/index.vue
index 62315f9..f6ef8a3 100644
--- a/eladmin-web-master/src/views/capital/accountMoney/index.vue
+++ b/eladmin-web-master/src/views/capital/accountMoney/index.vue
@@ -58,7 +58,11 @@
<!--表格渲染-->
<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="accountName" label="账户名称">
+ <template slot-scope="scope">
+ <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ scope.row.accountName }}</span>
+ </template>
+ </el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="accountYear" label="账户年度">
<template slot-scope="scope">
{{ crud.toYear(scope.row.accountYear) }}
@@ -76,7 +80,7 @@
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="accountAmount" label="账户金额">
<template slot-scope="scope">
- {{ crud.toMoney(scope.row.accountAmount) }}
+ <span :style="{color: (scope.row.accountAmount <= scope.row.warnAmount ? 'red' : '')}">{{ crud.toMoney(scope.row.accountAmount) }}</span>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="settlementStatus" label="结算状态">
@@ -133,7 +137,8 @@
permission: {
add: ['admin', 'capitalAccountMoney:add'],
edit: ['admin', 'capitalAccountMoney:edit'],
- del: ['admin', 'capitalAccountMoney:del']
+ del: ['admin', 'capitalAccountMoney:del'],
+ download: ['admin', 'capitalAccountMoney:download']
},
rules: {
accountName: [
--
Gitblit v1.9.3