Explorar el Código

Merge remote-tracking branch 'origin/master'

ControlDream hace 2 años
padre
commit
ac6506fa9c

+ 19 - 19
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/contract/service/impl/ContractServiceImpl.java

@@ -53,15 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -487,18 +479,26 @@ public class ContractServiceImpl extends BasicsServiceImpl<ContractMapper, Contr
             return null;
         }
         InterestRate interestRate = interestRateService.getNewFirst();
-        //货币类型
+        // 人民币,转换汇率=1
         if (StringUtils.equals(currencyType, CurrencyTypeEnum.CURRENCY_TYPE_USD.getKey())) {
-            //人民币,转换汇率=1
             return BigDecimal.ONE;
-        } else if (StringUtils.equals(currencyType, CurrencyTypeEnum.CURRENCY_TYPE_RMB.getKey())) {
-            //美元汇率,为空默认6.30
-            return Optional.ofNullable(interestRate.getDollarToRmb()).orElse(new BigDecimal(6.30));
-        } else if (StringUtils.equals(currencyType, CurrencyTypeEnum.CURRENCY_TYPE_EURO.getKey())) {
-            //欧元汇率,为空默认7.40
-            return Optional.ofNullable(interestRate.getEuroToRmb()).orElse(new BigDecimal(7.40));
-        }
-        return null;
+        }
+        // 美元汇率,为空默认6.30
+        else if (StringUtils.equals(currencyType, CurrencyTypeEnum.CURRENCY_TYPE_RMB.getKey())) {
+            return Optional.ofNullable(interestRate.getDollarToRmb()).orElse(new BigDecimal("6.30"));
+        }
+        // 欧元汇率,为空默认7.40
+        else if (StringUtils.equals(currencyType, CurrencyTypeEnum.CURRENCY_TYPE_EURO.getKey())) {
+            return Optional.ofNullable(interestRate.getEuroToRmb()).orElse(new BigDecimal("7.40"));
+        }
+        // 英镑汇率,为空默认8.30
+        else if (StringUtils.equals(currencyType, CurrencyTypeEnum.CURRENCY_TYPE_STERLING.getKey())) {
+            return Optional.ofNullable(interestRate.getSterlingToRmb()).orElse(new BigDecimal("8.30"));
+        }
+        // 其他默认1
+        else {
+            return BigDecimal.ONE;
+        }
     }
 
     /**

+ 2 - 7
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/fundAccount/controller/FundAccountController.java

@@ -32,12 +32,7 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 import java.util.List;
@@ -106,6 +101,7 @@ public class FundAccountController extends BladeController {
         fundAccount.setRmb(fundAccount.getRmbAmount());
         fundAccount.setEuro(fundAccount.getEuroAmount());
         fundAccount.setDollar(fundAccount.getDollarAmount());
+        fundAccount.setSterling(fundAccount.getSterlingAmount());
         fundAccount.setCreate();
         return R.status(fundAccountService.save(fundAccount));
     }
@@ -117,7 +113,6 @@ public class FundAccountController extends BladeController {
     @ApiOperation(value = "修改", notes = "传入fundAccount")
     public R update(@Valid @RequestBody FundAccount fundAccount) {
         fundAccountService.modify(fundAccount);
-
         return R.success();
     }
 

+ 15 - 0
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/fundAccount/entity/GetNewBalanceV2RewriteVo.java

@@ -84,6 +84,21 @@ public class GetNewBalanceV2RewriteVo {
          */
         private BigDecimal euroExpenditure;
 
+        /**
+         * 英镑余额
+         */
+        private BigDecimal sterlingAmount;
+
+        /**
+         * 英镑收入
+         */
+        private BigDecimal sterlingIncome;
+
+        /**
+         * 英镑支出
+         */
+        private BigDecimal sterlingExpenditure;
+
     }
 
 

+ 5 - 4
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/fundAccount/mapper/FundAccountMapper.xml

@@ -23,11 +23,12 @@
 
     <select id="getSumCurrMoney" resultType="com.fjhx.fundAccount.FundResult">
         SELECT
-            ifnull(SUM( rmb_amount),0) AS RMBBalance,
-            ifnull(SUM( dollar_amount ) ,0)AS DOLBalance,
-            ifnull(SUM( euro_amount ),0 )AS EUROBalance
+        ifnull(SUM( rmb_amount),0) AS RMBBalance,
+        ifnull(SUM( dollar_amount ) ,0)AS DOLBalance,
+        ifnull(SUM( euro_amount ),0 )AS EUROBalance,
+        ifnull(sum( sterling_amount ), 0) AS sterlingBalance
         FROM
-            t_erp_fund_account t1
+        t_erp_fund_account t1
         <include refid="sql_sum_condition"/>
     </select>
 

+ 75 - 34
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/fundAccount/service/impl/FundAccountDetailServiceImpl.java

@@ -353,26 +353,44 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
             throw new ServiceException("租户异常");
         }
         condition.put("tenantId", AuthUtil.getTenantId());
-        //查询出账户货币得总余额
+        // 查询出账户货币得总余额
         FundResult result = iFundAccountService.sumCurrMoney(condition);
-        //查询出收支总金额
+
+        // 查询出收支总金额
         List<FundAccountDetail> list = baseMapper.getSumMoneyGroupByCT(condition);
         for (FundAccountDetail f : list) {
-            if (f.getType() == FundDetailTypeEnum.INCOME.getKey()) {//收入
-                if (f.getCurrencyType() == CurrencyTypeEnum.RMB.getKey()) {//人民币
-                    result.setRMBIncome(f.getMoney());
-                } else if (f.getCurrencyType() == CurrencyTypeEnum.USA.getKey()) {//美元
-                    result.setDOLIncome(f.getMoney());
-                } else if (f.getCurrencyType() == CurrencyTypeEnum.EURO.getKey()) {//欧元
-                    result.setEUROIncome(f.getMoney());
+            // 收入
+            if (f.getType() == FundDetailTypeEnum.INCOME.getKey()) {
+                switch (CurrencyTypeEnum.getEnum(f.getCurrencyType())) {
+                    case RMB:
+                        result.setRMBIncome(f.getMoney());
+                        break;
+                    case USA:
+                        result.setDOLIncome(f.getMoney());
+                        break;
+                    case EURO:
+                        result.setEUROIncome(f.getMoney());
+                        break;
+                    case STERLING:
+                        result.setSterlingIncome(f.getMoney());
+                        break;
                 }
-            } else {//支出
-                if (f.getCurrencyType() == CurrencyTypeEnum.RMB.getKey()) {//人民币
-                    result.setRMBExpend(f.getMoney());
-                } else if (f.getCurrencyType() == CurrencyTypeEnum.USA.getKey()) {//美元
-                    result.setDOLExpend(f.getMoney());
-                } else if (f.getCurrencyType() == CurrencyTypeEnum.EURO.getKey()) {//欧元
-                    result.setEUROExpend(f.getMoney());
+            }
+            // 支出
+            else {
+                switch (CurrencyTypeEnum.getEnum(f.getCurrencyType())) {
+                    case RMB:
+                        result.setRMBExpend(f.getMoney());
+                        break;
+                    case USA:
+                        result.setDOLExpend(f.getMoney());
+                        break;
+                    case EURO:
+                        result.setEUROExpend(f.getMoney());
+                        break;
+                    case STERLING:
+                        result.setSterlingExpend(f.getMoney());
+                        break;
                 }
             }
         }
@@ -496,6 +514,10 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
                 if (Func.isEmpty(fundAccount.getEuroAmount()) || fundAccount.getEuroAmount().compareTo(detail.getMoney()) == -1) {
                     return false;
                 }
+            case 4:
+                if (Func.isEmpty(fundAccount.getSterlingAmount()) || fundAccount.getSterlingAmount().compareTo(detail.getMoney()) == -1) {
+                    return false;
+                }
 
         }
         return true;
@@ -1189,7 +1211,7 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
                 .eq(FundAccount::getTenantId, AuthUtil.getTenantId())
                 .eq(FundAccount::getDelFleg, 0)
                 .select(BasicsEntity::getId, FundAccount::getName, FundAccount::getAccountNumber,
-                        FundAccount::getRmbAmount, FundAccount::getDollarAmount, FundAccount::getEuroAmount));
+                        FundAccount::getRmbAmount, FundAccount::getDollarAmount, FundAccount::getEuroAmount,FundAccount::getSterlingAmount));
 
         if (accountList.size() == 0) {
             return new ArrayList<>();
@@ -1232,6 +1254,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
                     detail.setEuroAmount(item.getEuroAmount());
                     // detail.setEuroIncome(BigDecimal.ZERO);
                     // detail.setEuroExpenditure(BigDecimal.ZERO);
+
+                    detail.setSterlingAmount(item.getSterlingAmount());
+
                     detailList.add(detail);
 
                     yearMonthDay = DateUtil.offsetDay(yearMonthDay, -1);
@@ -1247,6 +1272,7 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
                     detail.setRmbAmount(item.getRmbAmount());
                     detail.setDollarAmount(item.getDollarAmount());
                     detail.setEuroAmount(item.getEuroAmount());
+                    detail.setSterlingAmount(item.getSterlingAmount());
                     // if (integerMapMap == null) {
                     //     detail.setRmbIncome(BigDecimal.ZERO);
                     //     detail.setRmbExpenditure(BigDecimal.ZERO);
@@ -1258,14 +1284,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
                     if (integerMapMap != null) {
                         // Map<收支类型(1:收入   2:支出),改变数量>
                         Map<Integer, BigDecimal> rmbMap = integerMapMap.get(CurrencyTypeEnum.RMB.getKey());
-                        // if (rmbMap == null) {
-                        //     detail.setRmbIncome(BigDecimal.ZERO);
-                        //     detail.setRmbExpenditure(BigDecimal.ZERO);
-                        // }
-
                         if (rmbMap != null) {
-                            BigDecimal expenditure = rmbMap.get(2);
                             BigDecimal income = rmbMap.get(1);
+                            BigDecimal expenditure = rmbMap.get(2);
 
                             detail.setRmbIncome(income);
                             detail.setRmbExpenditure(expenditure);
@@ -1284,13 +1305,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
 
                         // Map<收支类型(1:收入   2:支出),改变数量>
                         Map<Integer, BigDecimal> dollarMap = integerMapMap.get(CurrencyTypeEnum.USA.getKey());
-                        // if (dollarMap == null) {
-                        //     detail.setDollarIncome(BigDecimal.ZERO);
-                        //     detail.setRmbExpenditure(BigDecimal.ZERO);
-                        // }
                         if (dollarMap != null) {
-                            BigDecimal expenditure = dollarMap.get(2);
                             BigDecimal income = dollarMap.get(1);
+                            BigDecimal expenditure = dollarMap.get(2);
 
                             detail.setDollarIncome(income);
                             detail.setDollarExpenditure(expenditure);
@@ -1309,13 +1326,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
 
                         // Map<收支类型(1:收入   2:支出),改变数量>
                         Map<Integer, BigDecimal> euroMap = integerMapMap.get(CurrencyTypeEnum.EURO.getKey());
-                        // if (euroMap == null) {
-                        //     detail.setEuroIncome(BigDecimal.ZERO);
-                        //     detail.setEuroExpenditure(BigDecimal.ZERO);
-                        // }
                         if (euroMap != null) {
-                            BigDecimal expenditure = cn.hutool.core.util.ObjectUtil.defaultIfNull(euroMap.get(2), BigDecimal.ZERO);
-                            BigDecimal income = cn.hutool.core.util.ObjectUtil.defaultIfNull(euroMap.get(1), BigDecimal.ZERO);
+                            BigDecimal income = euroMap.get(1);
+                            BigDecimal expenditure = euroMap.get(2);
 
                             detail.setEuroIncome(income);
                             detail.setEuroExpenditure(expenditure);
@@ -1331,6 +1344,28 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
                                 item.setEuroAmount(euroAmount);
                             }
                         }
+
+                        // Map<收支类型(1:收入   2:支出),改变数量>
+                        Map<Integer, BigDecimal> sterlingMap = integerMapMap.get(CurrencyTypeEnum.STERLING.getKey());
+                        if (sterlingMap != null) {
+                            BigDecimal income = sterlingMap.get(1);
+                            BigDecimal expenditure = sterlingMap.get(2);
+
+                            detail.setSterlingIncome(income);
+                            detail.setSterlingExpenditure(expenditure);
+
+                            BigDecimal sterlingAmount = item.getEuroAmount();
+                            if (sterlingAmount != null) {
+                                if (income != null) {
+                                    sterlingAmount = sterlingAmount.subtract(income);
+                                }
+                                if (expenditure != null) {
+                                    sterlingAmount = sterlingAmount.add(expenditure);
+                                }
+                                item.setSterlingAmount(sterlingAmount);
+                            }
+                        }
+
                     }
                     detailList.add(detail);
                     yearMonthDay = DateUtil.offsetDay(yearMonthDay, -1);
@@ -1401,6 +1436,12 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
             if (euroAmountChange != null) {
                 fundAccount.setEuroAmount(fundAccount.getEuroAmount().add(euroAmountChange));
             }
+
+            BigDecimal sterlingAmountChange = itemMap.get(CurrencyTypeEnum.STERLING.getKey());
+            if (sterlingAmountChange != null) {
+                fundAccount.setSterlingAmount(fundAccount.getSterlingAmount().add(sterlingAmountChange));
+            }
+
         }
     }
 

+ 40 - 16
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/fundAccount/service/impl/FundAccountServiceImpl.java

@@ -90,21 +90,24 @@ public class FundAccountServiceImpl extends ServiceImpl<FundAccountMapper, FundA
             map.put("dollarSummary", new BigDecimal(0));
         }
 
-        //获取到欧元余额不等于null的数据
+        // 获取到欧元余额不等于null的数据
         List<FundAccount> euroAmountList = list.stream().filter(fundAccount -> ObjectUtil.isNotEmpty(fundAccount.getEuroAmount())).collect(Collectors.toList());
         if (euroAmountList.size() > 0) {
-
-            //资金账户管理:欧元汇总
+            // 资金账户管理:欧元汇总
             BigDecimal euroSummary = euroAmountList.stream().map(FundAccount::getEuroAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
             map.put("euroSummary", euroSummary);
         } else {
             map.put("euroSummary", new BigDecimal(0));
         }
 
+        // 赋值英镑数据
+        BigDecimal sterlingSummary = list.stream().map(FundAccount::getSterlingAmount).filter(ObjectUtil::isNotEmpty).reduce(BigDecimal.ZERO, BigDecimal::add);
+        map.put("sterlingSummary", sterlingSummary);
+
         if (CollectionUtils.isNotEmpty(list)) {
-            //公司ID集合
+            // 公司ID集合
             List<String> companyIds = list.stream().map(FundAccount::getCompanyId).distinct().collect(Collectors.toList());
-            //查询公司信息
+            // 查询公司信息
             Map<String, Company> companyMap = iCompanyService.getByIdsToMap(companyIds);
 
             for (FundAccount account : list) {
@@ -134,7 +137,7 @@ public class FundAccountServiceImpl extends ServiceImpl<FundAccountMapper, FundA
         if (ObjectUtil.isEmpty(detail.getType())) {
             throw new ServiceException("类型不能为空");
         }
-        if (detail.getMoney().compareTo(BigDecimal.ZERO) == -1 || detail.getMoney() == null) {
+        if (detail.getMoney().compareTo(BigDecimal.ZERO) < 0) {
             throw new ServiceException("金额不能小于0且不能为空");
         }
         if (StringUtils.isBlank(AuthUtil.getTenantId())) {
@@ -193,6 +196,7 @@ public class FundAccountServiceImpl extends ServiceImpl<FundAccountMapper, FundA
             fundAccount.setEuro(fundAccount.getEuroAmount());
             fundAccount.setDollar(fundAccount.getDollarAmount());
             fundAccount.setRmb(fundAccount.getRmbAmount());
+            fundAccount.setSterling(fundAccount.getSterling());
         }
         baseMapper.updateById(fundAccount);
     }
@@ -209,16 +213,21 @@ public class FundAccountServiceImpl extends ServiceImpl<FundAccountMapper, FundA
 
         switch (detail.getCurrencyType()) {
             case 1:
-                //人民币
+                // 人民币
                 c = (Func.isEmpty(fundAccount.getRmbAmount()) ? new BigDecimal(BigDecimal.ZERO.intValue()) : fundAccount.getRmbAmount()).add(detail.getMoney());
                 break;
             case 2:
-                //美元
+                // 美元
                 c = (Func.isEmpty(fundAccount.getDollarAmount()) ? new BigDecimal(BigDecimal.ZERO.intValue()) : fundAccount.getDollarAmount()).add(detail.getMoney());
                 break;
             case 3:
-                //欧元
+                // 欧元
                 c = (Func.isEmpty(fundAccount.getEuroAmount()) ? new BigDecimal(BigDecimal.ZERO.intValue()) : fundAccount.getEuroAmount()).add(detail.getMoney());
+                break;
+            case 4:
+                // 英镑
+                c = (Func.isEmpty(fundAccount.getSterlingAmount()) ? new BigDecimal(BigDecimal.ZERO.intValue()) : fundAccount.getSterlingAmount()).add(detail.getMoney());
+                break;
         }
         return c;
     }
@@ -236,23 +245,30 @@ public class FundAccountServiceImpl extends ServiceImpl<FundAccountMapper, FundA
         switch (detail.getCurrencyType()) {
             case 1:
                 //人民币
-                if (Func.isEmpty(fundAccount.getRmbAmount()) || fundAccount.getRmbAmount().compareTo(detail.getMoney()) == -1) {
+                if (Func.isEmpty(fundAccount.getRmbAmount()) || fundAccount.getRmbAmount().compareTo(detail.getMoney()) < 0) {
                     throw new ServiceException("人民币余额不足");
                 }
                 c = fundAccount.getRmbAmount().subtract(detail.getMoney());
                 break;
             case 2:
                 //美元
-                if (Func.isEmpty(fundAccount.getDollarAmount()) || fundAccount.getDollarAmount().compareTo(detail.getMoney()) == -1) {
+                if (Func.isEmpty(fundAccount.getDollarAmount()) || fundAccount.getDollarAmount().compareTo(detail.getMoney()) < 0) {
                     throw new ServiceException("美元余额不足");
                 }
                 c = fundAccount.getDollarAmount().subtract(detail.getMoney());
                 break;
             case 3:
-                if (Func.isEmpty(fundAccount.getEuroAmount()) || fundAccount.getEuroAmount().compareTo(detail.getMoney()) == -1) {
+                if (Func.isEmpty(fundAccount.getEuroAmount()) || fundAccount.getEuroAmount().compareTo(detail.getMoney()) < 0) {
                     throw new ServiceException("欧元余额不足");
                 }
                 c = fundAccount.getEuroAmount().subtract(detail.getMoney());
+                break;
+            case 4:
+                if (Func.isEmpty(fundAccount.getSterlingAmount()) || fundAccount.getSterlingAmount().compareTo(detail.getMoney()) < 0) {
+                    throw new ServiceException("英镑余额不足");
+                }
+                c = fundAccount.getSterlingAmount().subtract(detail.getMoney());
+                break;
         }
         return c;
     }
@@ -268,16 +284,21 @@ public class FundAccountServiceImpl extends ServiceImpl<FundAccountMapper, FundA
     public void updateAccount(FundAccountDetail detail, FundAccount submitFundAccount, FundAccount fundAccount, BigDecimal c) {
         switch (detail.getCurrencyType()) {
             case 1:
-                //人民币
+                // 人民币
                 submitFundAccount.setRmbAmount(c);
                 break;
             case 2:
-                //美元
+                // 美元
                 submitFundAccount.setDollarAmount(c);
                 break;
             case 3:
-                //欧元
+                // 欧元
                 submitFundAccount.setEuroAmount(c);
+                break;
+            case 4:
+                // 英镑
+                submitFundAccount.setSterlingAmount(c);
+                break;
         }
         submitFundAccount.setUpdate();
         if (ObjectUtil.isEmpty(submitFundAccount.getRmbAmount())) {
@@ -286,13 +307,16 @@ public class FundAccountServiceImpl extends ServiceImpl<FundAccountMapper, FundA
         if (ObjectUtil.isEmpty(submitFundAccount.getDollarAmount())) {
             submitFundAccount.setDollarAmount(fundAccount.getDollarAmount());
         }
-
         if (ObjectUtil.isEmpty(submitFundAccount.getEuroAmount())) {
             submitFundAccount.setEuroAmount(fundAccount.getEuroAmount());
         }
+        if (ObjectUtil.isEmpty(submitFundAccount.getSterlingAmount())) {
+            submitFundAccount.setSterlingAmount(fundAccount.getSterlingAmount());
+        }
         submitFundAccount.setEuro(fundAccount.getEuro());
         submitFundAccount.setRmb(fundAccount.getRmb());
         submitFundAccount.setDollar(fundAccount.getDollar());
+        submitFundAccount.setSterling(fundAccount.getSterling());
         submitFundAccount.setDollarExchange(fundAccount.getDollarExchange());
         submitFundAccount.setEuroExchange(fundAccount.getEuroExchange());
         submitFundAccount.setRemark(fundAccount.getRemark());

+ 5 - 0
bladex-saas-project/saas-entity/src/main/java/com/fjhx/InterestRate/entity/InterestRate.java

@@ -31,6 +31,11 @@ public class InterestRate extends BasicsEntity {
     private BigDecimal dollarToRmb;
 
     /**
+     * 英镑兑人民币
+     */
+    private BigDecimal sterlingToRmb;
+
+    /**
      * 税率
      */
     private BigDecimal taxRate;

+ 19 - 0
bladex-saas-project/saas-entity/src/main/java/com/fjhx/fundAccount/FundAccount.java

@@ -73,6 +73,12 @@ public class FundAccount extends BasicsEntity {
     private BigDecimal euroAmount;
 
     /**
+     * 英镑余额
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal sterlingAmount;
+
+    /**
      * 美元汇率
      */
     @TableField(updateStrategy = FieldStrategy.IGNORED)
@@ -85,6 +91,12 @@ public class FundAccount extends BasicsEntity {
     private BigDecimal euroExchange;
 
     /**
+     * 英镑汇率
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal sterlingExchange;
+
+    /**
      * 备注
      */
     @TableField(updateStrategy = FieldStrategy.IGNORED)
@@ -121,8 +133,15 @@ public class FundAccount extends BasicsEntity {
     private BigDecimal dollar;
 
     /**
+     * 英镑初始化
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal sterling;
+
+    /**
      * 公司名称
      */
     @TableField(exist = false)
     private String companyName;
+
 }

+ 17 - 5
bladex-saas-project/saas-entity/src/main/java/com/fjhx/fundAccount/FundResult.java

@@ -16,12 +16,7 @@
  */
 package com.fjhx.fundAccount;
 
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.reflections.serializers.Serializer;
-import org.springblade.core.mp.base.BasicsEntity;
 
 import java.math.BigDecimal;
 
@@ -47,6 +42,12 @@ public class FundResult {
      */
     private BigDecimal EUROBalance;
     /**
+     * 英镑总余额
+     */
+    private BigDecimal sterlingBalance;
+
+
+    /**
      * 人民币总收入
      */
     private BigDecimal RMBIncome;
@@ -59,6 +60,12 @@ public class FundResult {
      */
     private BigDecimal EUROIncome;
     /**
+     * 英镑总收入
+     */
+    private BigDecimal sterlingIncome;
+
+
+    /**
      * 人民币总支出
      */
     private BigDecimal RMBExpend;
@@ -70,4 +77,9 @@ public class FundResult {
      * 欧元总支出
      */
     private BigDecimal EUROExpend;
+    /**
+     * 英镑总支出
+     */
+    private BigDecimal sterlingExpend;
+
 }

+ 25 - 40
bladex-saas-project/saas-entity/src/main/java/com/fjhx/fundAccount/enums/CurrencyTypeEnum.java

@@ -1,65 +1,50 @@
 package com.fjhx.fundAccount.enums;
 
-import org.apache.commons.collections4.MapUtils;
-import org.springblade.core.tool.utils.StringPool;
+import cn.hutool.core.util.ObjectUtil;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 
-import java.util.LinkedHashMap;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 收支类型
  */
+@Getter
+@AllArgsConstructor
 public enum CurrencyTypeEnum {
-    RMB (1, "人民币"),
-    USA (2, "美元"),
-    EURO (3, "欧元")
-    ;
+    RMB(1, "人民币"),
+    USA(2, "美元"),
+    EURO(3, "欧元"),
+    STERLING(4, "英镑"),
 
-    private int key;
+    // 未知币种
+    UNKNOWN(99, "");
 
-    private String value;
+    private final int key;
 
-    private static LinkedHashMap<Integer, String> map = new LinkedHashMap<>();
+    private final String value;
 
-    CurrencyTypeEnum(int key, String value) {
-        this.key = key;
-        this.value = value;
+    private static final Map<Integer, CurrencyTypeEnum> map = new HashMap<>();
+
+    static {
+        for (CurrencyTypeEnum ms : values()) {
+            map.put(ms.key, ms);
+        }
     }
 
     /**
-     * 获取枚举map
-     *
-     * @return
+     * 获取枚举
      */
-    public static LinkedHashMap<Integer, String> getMap() {
-        if (MapUtils.isNotEmpty(map)) {
-            return map;
-        }
-        for (CurrencyTypeEnum ms : values()) {
-            map.put(ms.key, ms.value);
-        }
-        return map;
+    public static CurrencyTypeEnum getEnum(Integer key) {
+        return ObjectUtil.defaultIfNull(map.get(key), UNKNOWN);
     }
 
     /**
      * 通过key获取名称
-     *
-     * @param key
-     * @return
      */
     public static String getNameByKey(Integer key) {
-        if (key == null || key < 0) {
-            return StringPool.EMPTY;
-        }
-        LinkedHashMap<Integer, String> map = getMap();
-        return map.getOrDefault(key, StringPool.EMPTY);
-    }
-
-    public int getKey() {
-        return key;
-    }
-
-    public String getValue() {
-        return value;
+        return getEnum(key).getValue();
     }
 
 }

+ 4 - 3
bladex/blade-common/src/main/java/org/springblade/common/constant/CurrencyTypeEnum.java

@@ -9,9 +9,10 @@ import java.util.LinkedHashMap;
  * 货币类型枚举
  */
 public enum CurrencyTypeEnum {
-    CURRENCY_TYPE_USD("1", "¥"),//人民币
-    CURRENCY_TYPE_RMB("2", "$"),//美元
-    CURRENCY_TYPE_EURO("3", "€"),//欧元
+    CURRENCY_TYPE_USD("1", "¥"),// 人民币
+    CURRENCY_TYPE_RMB("2", "$"),// 美元
+    CURRENCY_TYPE_EURO("3", "€"),// 欧元
+    CURRENCY_TYPE_STERLING("4", "£"),// 欧元
     ;
 
     private String key;