浏览代码

Merge branch 'test' into wuhp

wuhp 1 年之前
父节点
当前提交
66900e043f

+ 32 - 0
src/main/java/com/ydtech/modules/admin/constants/BusinessTypeEnum.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.admin.constants;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+
+/**
+ * 开关
+ */
+@AllArgsConstructor
+@Getter
+public enum BusinessTypeEnum {
+
+    BUSINESS_TYPE_1("1", "个体户"),
+    BUSINESS_TYPE_2("2", "小规模"),
+    BUSINESS_TYPE_3("3", "一般纳税");
+
+    private final String code;
+
+    private final String type;
+
+    public static String getBusinessType(String code) {
+        for (BusinessTypeEnum roleConstants : BusinessTypeEnum.values()) {
+            if (roleConstants.getCode().equals(code)) {
+                return roleConstants.type;
+            }
+        }
+        return null;
+    }
+
+}

+ 2 - 1
src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java

@@ -99,7 +99,8 @@ public class InvAccountIncoiceController {
         JSONObject outProfit = invAccountIncoice.getOutProfit();
         JSONObject entProfit = invAccountIncoice.getEntProfit();
 
-        isProfitFull(outProfit, entProfit);
+        isProfitFull(outProfit, entProfit, invAccountIncoice.getPayoutMoney());
+
 
         return this.invAccountIncoiceService.updateInvAccountIncoice(invAccountIncoice);
     }

+ 6 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java

@@ -52,6 +52,12 @@ public class InvAccountIncoice implements Serializable{
     @ExcelProperty("开票方")
     private String invoiceBy;
 
+    //营业性质
+    @ApiModelProperty(value = "营业性质")
+    @ExcelProperty("公司类型")
+    @TableField(exist = false)
+    private String businessQuality;
+
     //对方单位
     @ApiModelProperty(value = "对方单位")
     @ExcelProperty("对方单位")

+ 35 - 1
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java

@@ -11,6 +11,7 @@ import com.ydtech.constants.enums.inv.InvoiceTypeEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.constants.BusinessTypeEnum;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.inv.dao.InvAccountIncoiceMapper;
 import com.ydtech.modules.inv.model.*;
@@ -381,6 +382,11 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
                 invAccountIncoice.setRate(invAccountIncoice.getRate() + "%");
             }
         });
+
+        if (!StringUtils.isNullOrEmpty(invAccountIncoices) && invAccountIncoices.size() > 0) {
+            matchBusinessQuality(invAccountIncoices);
+        }
+
         File folder = new File(uploadFilePath);
         if (folder.exists()) {
             return EasyExcelUtils.downExcel(uploadFilePath, InvAccountIncoice.class, invAccountIncoices);
@@ -455,7 +461,9 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         lambdaQuery.orderByDesc(InvAccountIncoice::getInvoiceTime);
 
         Page<InvAccountIncoice> invAccountIncoicePage = page(page, lambdaQuery);
-
+        if (!StringUtils.isNullOrEmpty(invAccountIncoicePage.getRecords()) && invAccountIncoicePage.getRecords().size() > 0) {
+            invAccountIncoicePage.setRecords(matchBusinessQuality(invAccountIncoicePage.getRecords()));
+        }
         /**
          * 合计
          */
@@ -502,5 +510,31 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         return invAccountIncoiceMapper.selectList(lambdaQuery);
     }
 
+    public List<InvAccountIncoice> matchBusinessQuality(List<InvAccountIncoice> invAccountIncoices) {
+        List<String> accountIdList = invAccountIncoices
+                .stream()
+                .filter(account -> !StringUtils.isNullOrEmpty(account) && StringUtils.isNotEmpty(account.getAccountId()))
+                .map(InvAccountIncoice::getAccountId)
+                .distinct()
+                .collect(Collectors.toList());
+        LambdaQueryWrapper<InvAccount> invAccountIncoiceSQL = new LambdaQueryWrapper<InvAccount>()
+                .in(InvAccount::getAccountId, accountIdList);
+        List<InvAccount> invAccountList = invAccountService.list(invAccountIncoiceSQL);
+        invAccountIncoices
+                .stream()
+                .filter(invaccount -> !StringUtils.isNullOrEmpty(invaccount) && StringUtils.isNotEmpty(invaccount.getAccountId()))
+                .forEach(invaccount -> {
+                    invAccountList
+                            .stream()
+                            .filter(account -> !StringUtils.isNullOrEmpty(account) && StringUtils.isNotEmpty(account.getBusinessQuality()))
+                            .forEach(account -> {
+                                if (invaccount.getAccountId().equals(account.getAccountId())) {
+                                    invaccount.setBusinessQuality(BusinessTypeEnum.getBusinessType(account.getBusinessQuality()));
+                                }
+                            });
+                });
+        return invAccountIncoices;
+    }
+
 }
 

+ 2 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.constants.BusinessTypeEnum;
 import com.ydtech.modules.inv.dao.InvAccountMapper;
 import com.ydtech.modules.inv.model.*;
 import com.ydtech.modules.inv.model.dto.InvAccountCardQueryDto;
@@ -185,6 +186,7 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
                         invAccountN.setInvAccountCardList(null);
                     }
                 }
+                invAccountN.setBusinessQuality(BusinessTypeEnum.getBusinessType(invAccountN.getBusinessQuality()));
             });
             return HttpResult.ok("", insAccounts);
         }

+ 27 - 0
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -277,6 +277,33 @@ public class TransferUtils {
         }
         return true;
     }
+    /**
+     * 判断归属是否分配完毕
+     *
+     * @param outProfit
+     * @param entProfit
+     * @return
+     */
+    public static Boolean isProfitFull(JSONObject outProfit, JSONObject entProfit, String payoutMoney) {
+        BigDecimal outAmount = new BigDecimal(0);
+        BigDecimal entAmount = new BigDecimal(0);
+        for (Map.Entry<String, Object> entry : outProfit.entrySet()) {
+            outAmount = outAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        for (Map.Entry<String, Object> entry : entProfit.entrySet()) {
+            entAmount = entAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        String string = (new BigDecimal(String.valueOf(entAmount)).add(new BigDecimal(String.valueOf(outAmount)))).toString();
+
+        if (new BigDecimal(string).compareTo(BigDecimal.ZERO) != 0) {
+            throw new SystemException("金额未完全分配");
+        }
+        if ((entAmount.compareTo(new BigDecimal(payoutMoney)) != 0)
+                || (outAmount.abs().compareTo(new BigDecimal(payoutMoney)) != 0)) {
+            throw new SystemException("进账金额与板块总金额不匹配");
+        }
+        return true;
+    }
 
     /**
      * 转给私户扣除余额方法

+ 3 - 0
src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java

@@ -603,6 +603,9 @@ public class InsAreaCompany implements Serializable {
     @TableField(exist = false)
     private String jyPolicyNo;
 
+    @TableField(exist = false)
+    private String recorder;
+
     public InsAreaCompany(QuoteRespVo quoteRespVo, PtlAgreementAttribution ptlAgreementAttribution) {
         this.id = IdGenerate.nextId();
         this.orderno = quoteRespVo.getOrderno();

+ 8 - 3
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -259,9 +259,14 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             insOrders.setCompanyId(insAreaCompany.getCompanyId());
             insOrders.setInsCompany(insAreaCompany.getInscompany());
             insOrders.setInsureTime(insAreaCompany.getPayDate());
-            //已承保记录保费数据
-            saveFeeInfo(insAreaCompany);
-
+            String id = insAreaCompany.getId();
+            if (StringUtils.isNotEmpty(id)) {
+                List<SysPremiumDetails> sysPremiumDetails = sysPremiumDetailsMapper.selectList(new LambdaQueryWrapper<SysPremiumDetails>().eq(SysPremiumDetails::getCompanyId, id));
+                if ( sysPremiumDetails.size() == 0) {
+                    //已承保记录保费数据
+                    saveFeeInfo(insAreaCompany);
+                }
+            }
         }
 
         if (InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insOrders.getOrderstatus())) {

+ 2 - 1
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -3293,7 +3293,8 @@
         ifa.audittime,
         ifa.audituser as auditname,
         ifa.rejectinfo,
-        "1" as orderExternalStatus
+        "1" as orderExternalStatus,
+        iac.operator_name as recorder
         FROM
         ins_fee_audit ifa
         LEFT JOIN