Просмотр исходного кода

1.资金申请时板块改为填写金额
2.修改费用管理所有查询排序为降序

y 2 лет назад
Родитель
Сommit
1c24b26b1a

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

@@ -77,6 +77,7 @@ public class InvAccountIncoiceController {
             lambdaQuery.ge(InvAccountIncoice::getInvoiceTime, invAccountIncoice.getInvoiceTimeStart().toString());
             lambdaQuery.le(InvAccountIncoice::getInvoiceTime, invAccountIncoice.getInvoiceTimeEnd().toString());
         }
+        lambdaQuery.orderByDesc(InvAccountIncoice::getInvoiceTime);
 
         Page<InvAccountIncoice> invAccountIncoicePage = this.invAccountIncoiceService.page(page, lambdaQuery);
 

+ 7 - 8
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountExcelServiceImpl.java

@@ -159,8 +159,8 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
             JSONObject outProfit = invAccountExcel.getOutProfit();
             JSONObject entProfit = invAccountExcel.getEntProfit();
 
-            outJsonUtil(invAccountExcel, outProfit, outAccount, outAccountCard,invAccountOperate.getAccountOperateId());
-            entJsonUtil(invAccountExcel, entProfit, enterAccount, enterAccountCard, invAccountOperate1.getAccountOperateId());
+            outJsonUtil(outProfit, outAccount, outAccountCard,invAccountOperate.getAccountOperateId());
+            entJsonUtil(entProfit, enterAccount, enterAccountCard, invAccountOperate1.getAccountOperateId());
 
         } else {
             //内转外部转账
@@ -173,19 +173,18 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
             invAccountOperate.setExcelAccountOperateId(invAccountExcel.getExcelAccountOperateId());
             insAccountOperateService.save(invAccountOperate);
             JSONObject outProfit = invAccountExcel.getOutProfit();
-            outJsonUtil(invAccountExcel, outProfit, outAccount, outAccountCard,invAccountOperate.getAccountOperateId());
-
+            outJsonUtil(outProfit, outAccount, outAccountCard,invAccountOperate.getAccountOperateId());
         }
         return HttpResult.ok("", insAccountExcelMapper.updateById(invAccountExcel));
     }
 
-    private void outJsonUtil(InvAccountExcel invAccountExcel, JSONObject outProfit, InvAccount outAccount, InvAccountCard outCard,String operateId) {
-        List<InvAccountOp> list = invAccountOutOpList(outProfit, outAccount, outCard, invAccountExcel.getApplyAmount(),operateId);
+    private void outJsonUtil( JSONObject outProfit, InvAccount outAccount, InvAccountCard outCard,String operateId) {
+        List<InvAccountOp> list = invAccountOutOpList(outProfit, outAccount, outCard,operateId);
         insAccountOpService.saveBatch(list);
     }
 
-    private void entJsonUtil(InvAccountExcel invAccountExcel, JSONObject outProfit, InvAccount entAccount, InvAccountCard entCard,String operateId) {
-        List<InvAccountOp> list = invAccountEntOpList(outProfit, entAccount, entCard, invAccountExcel.getApplyAmount(),operateId);
+    private void entJsonUtil( JSONObject outProfit, InvAccount entAccount, InvAccountCard entCard,String operateId) {
+        List<InvAccountOp> list = invAccountEntOpList(outProfit, entAccount, entCard,operateId);
         insAccountOpService.saveBatch(list);
     }
 

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

@@ -182,8 +182,8 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
 
                 //归属列表
                 List<InvAccountOp> list = new ArrayList<>();
-                List<InvAccountOp> list1 = invAccountEntOpList(entProfit, revInvAccount, entCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
-                List<InvAccountOp> list2 = invAccountOutOpList(outProfit, outInvAccount, outCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
+                List<InvAccountOp> list1 = invAccountEntOpList(entProfit, revInvAccount, entCard,invAccountOperateList.get(0).getAccountOperateId());
+                List<InvAccountOp> list2 = invAccountOutOpList(outProfit, outInvAccount, outCard,invAccountOperateList.get(0).getAccountOperateId());
                 //将发票id放入  防止撤销发票时对应归属没删掉
                 list1.forEach(invAccountOp -> {
                     invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
@@ -206,8 +206,8 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
 
                 //归属列表
                 List<InvAccountOp> list = new ArrayList<>();
-                List<InvAccountOp> list1 = invAccountEntOpList(entProfit, revInvAccount, entCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
-                List<InvAccountOp> list2 = invAccountOutOpList(outProfit, outInvAccount, outCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
+                List<InvAccountOp> list1 = invAccountEntOpList(entProfit, revInvAccount, entCard,invAccountOperateList.get(0).getAccountOperateId());
+                List<InvAccountOp> list2 = invAccountOutOpList(outProfit, outInvAccount, outCard,invAccountOperateList.get(0).getAccountOperateId());
                 //将发票id放入  防止撤销发票时对应归属没删掉
                 list1.forEach(invAccountOp -> {
                     invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());

+ 27 - 15
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -104,7 +104,7 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
         InvAccountCard entAccountCard = invAccountCardService.getById(invAccountOperate.getEnterCardId());
         InvAccountCard outAccountCard = invAccountCardService.getById(invAccountOperate.getOutCardId());
         InvAccount entAccount = invAccountService.getById(entAccountCard.getAccountId());
-        InvAccount outAccoun = invAccountService.getById(outAccountCard.getAccountId());
+        InvAccount outAccount = invAccountService.getById(outAccountCard.getAccountId());
         String applyAmount = invAccountOperate.getApplyAmount();
 
         JSONObject outProfit = invAccountOperate.getOutProfit();
@@ -116,7 +116,7 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
         if (entAccountCard.equals(outAccountCard)) {
             for (Map.Entry<String, Object> entry : outProfit.entrySet()) {
                 for (Map.Entry<String, Object> entry2 : entProfit.entrySet()) {
-                    if (Integer.parseInt(entry.getValue().toString()) != 0 && Integer.parseInt(entry2.getValue().toString()) != 0) {
+                    if (new BigDecimal(entry.getValue().toString()).compareTo(BigDecimal.ZERO) != 0 && new BigDecimal(entry2.getValue().toString()).compareTo(BigDecimal.ZERO) != 0) {
                         if (entry.getKey().equals(entry2.getKey())) {
                             throw new SystemException("无法向同公司同板块互相转账");
                         }
@@ -127,21 +127,33 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
 
 
         if (entAccount.getOuterFlag().equals("0") && !entAccountCard.getAccountId().equals(outAccountCard.getAccountId())) {
-            InvAccountCard invAccount = outsideTransfer(outAccountCard, outAccoun, entAccountCard, entAccount, applyAmount);
+            InvAccountCard invAccount = outsideTransfer(outAccountCard, outAccount, entAccountCard, entAccount, applyAmount);
             invAccountCardService.updateById(invAccount);
+            BaseController baseController = new BaseController();
+            invAccountOperate.setCreateTime(LocalDateTime.now());
+            invAccountOperate.setOutProfit(null);
+            invAccountOperate.setEnterCardNum(entAccountCard.getBankCardNum());
+            invAccountOperate.setCreateBy(baseController.getUserName());
+            invAccountOperate.setCreateId(baseController.getUserId());
+            invAccountOperateMapper.insert(invAccountOperate);
+        }
+
+        List<InvAccountOp> list = invAccountEntOpList(entProfit, entAccount, entAccountCard,invAccountOperate.getAccountOperateId());
+
+        if (!entAccountCard.getAccountId().equals(outAccountCard.getAccountId())){
+            list.forEach(invAccountOp -> {
+                invAccountOp.setInvoiceId(invAccountOperate.getAccountOperateId());
+            });
+        }else {
+            List<InvAccountOp> list1 = invAccountOutOpList(outProfit, outAccount, outAccountCard, invAccountOperate.getAccountOperateId());
+            list.forEach(invAccountOp -> {
+                invAccountOp.setInvoiceId(invAccountOperate.getAccountOperateId());
+            });
+            list1.forEach(invAccountOp -> {
+                invAccountOp.setInvoiceId(invAccountOperate.getAccountOperateId());
+            });
+            list.addAll(list1);
         }
-        BaseController baseController = new BaseController();
-        invAccountOperate.setCreateTime(LocalDateTime.now());
-        invAccountOperate.setOutProfit(null);
-        invAccountOperate.setEnterCardNum(entAccountCard.getBankCardNum());
-        invAccountOperate.setCreateBy(baseController.getUserName());
-        invAccountOperate.setCreateId(baseController.getUserId());
-        invAccountOperateMapper.insert(invAccountOperate);
-
-        List<InvAccountOp> list = invAccountEntOpList(entProfit, entAccount, entAccountCard, applyAmount,invAccountOperate.getAccountOperateId());
-        list.forEach(invAccountOp -> {
-            invAccountOp.setInvoiceId(invAccountOperate.getAccountOperateId());
-        });
         invAccountOpService.saveBatch(list);
 
         return HttpResult.ok("新增收入成功");

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

@@ -1,6 +1,7 @@
 package com.ydtech.modules.inv.service.impl;
 
 import com.alibaba.excel.util.ListUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
@@ -18,6 +19,7 @@ import com.ydtech.modules.inv.service.InvAccountProfitService;
 import com.ydtech.modules.inv.service.InvAccountService;
 import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.modules.inv.utils.LocalDateTimeUtils;
+import io.swagger.models.auth.In;
 import org.joda.time.LocalDateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -160,7 +162,9 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
     public HttpResult selectAccountExcel(InvAccountQueryVo invAccountQueryVo) {
         List<InvAccount> insAccounts = insAccountMapper.selectAccountsList(invAccountQueryVo);
         List<InvAccountProfit> invAccountProfitList = invAccountProfitService.list();
-        List<InvAccountOp> list = invAccountOpService.list();
+        LambdaQueryWrapper<InvAccountOp> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(InvAccountOp::getDelFlag,"0");
+        List<InvAccountOp> list = invAccountOpService.list(lambdaQueryWrapper);
 
         File folder = new File(uploadFilePath);
         if (folder.exists()) {
@@ -279,7 +283,9 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
 
 
         List<InvAccountProfit> invAccountProfitList = invAccountProfitService.list();
-        List<InvAccountOp> list = invAccountOpService.list();
+        LambdaQueryWrapper<InvAccountOp> queryWrapper = new LambdaQueryWrapper<InvAccountOp>();
+        queryWrapper.eq(InvAccountOp::getDelFlag,"0");
+        List<InvAccountOp> list = invAccountOpService.list(queryWrapper);
 
         List<Map<String, String>> head = head(invAccountProfitList);
         List<Map<String, String>> maps = dataList(insAccounts, list, invAccountProfitList);

+ 17 - 10
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -28,14 +28,13 @@ public class TransferUtils {
      * @param entProfit
      * @param entAccount
      * @param entAccountCard
-     * @param applyAmount
      * @return
      */
-    public static List<InvAccountOp> invAccountEntOpList(JSONObject entProfit, InvAccount entAccount, InvAccountCard entAccountCard, String applyAmount, String operateId) {
+    public static List<InvAccountOp> invAccountEntOpList(JSONObject entProfit, InvAccount entAccount, InvAccountCard entAccountCard, String operateId) {
         List<InvAccountOp> list = new ArrayList<>();
         if (entProfit != null) {
             for (Map.Entry<String, Object> entry : entProfit.entrySet()) {
-                if (Integer.parseInt(entry.getValue().toString()) != 0) {
+                if (new BigDecimal(entry.getValue().toString()).compareTo(BigDecimal.ZERO) != 0) {
                     InvAccountOp invAccountOp = new InvAccountOp();
                     invAccountOp.setAccountId(entAccount.getAccountId());
                     invAccountOp.setAccountName(entAccount.getAccountName());
@@ -43,7 +42,7 @@ public class TransferUtils {
                     invAccountOp.setCardName(entAccountCard.getBankName());
                     invAccountOp.setAccountOperateId(operateId);
                     invAccountOp.setProfit(entry.getKey());
-                    invAccountOp.setMoney(new BigDecimal(entry.getValue().toString()).multiply(new BigDecimal(applyAmount)).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).toString());
+                    invAccountOp.setMoney(entry.getValue().toString());
                     list.add(invAccountOp);
                 }
             }
@@ -58,13 +57,12 @@ public class TransferUtils {
      * @param outProfit
      * @param outAccount
      * @param outAccountCard
-     * @param applyAmount
      * @return
      */
-    public static List<InvAccountOp> invAccountOutOpList(JSONObject outProfit, InvAccount outAccount, InvAccountCard outAccountCard, String applyAmount, String operateId) {
+    public static List<InvAccountOp> invAccountOutOpList(JSONObject outProfit, InvAccount outAccount, InvAccountCard outAccountCard, String operateId) {
         List<InvAccountOp> list = new ArrayList<>();
         for (Map.Entry<String, Object> entry : outProfit.entrySet()) {
-            if (Integer.parseInt(entry.getValue().toString()) != 0) {
+            if (new BigDecimal(entry.getValue().toString()).compareTo(BigDecimal.ZERO) != 0) {
                 InvAccountOp invAccountOp = new InvAccountOp();
                 invAccountOp.setAccountId(outAccount.getAccountId());
                 invAccountOp.setAccountName(outAccount.getAccountName());
@@ -72,7 +70,7 @@ public class TransferUtils {
                 invAccountOp.setCardName(outAccountCard.getBankName());
                 invAccountOp.setProfit(entry.getKey());
                 invAccountOp.setAccountOperateId(operateId);
-                invAccountOp.setMoney(new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(applyAmount)).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).toString());
+                invAccountOp.setMoney(String.valueOf(entry.getValue()));
                 list.add(invAccountOp);
             }
         }
@@ -231,8 +229,14 @@ public class TransferUtils {
         for (Map.Entry<String, Object> entry : entProfit.entrySet()) {
             entAmount = entAmount.add(new BigDecimal(entry.getValue().toString()));
         }
-        if (!(new BigDecimal(String.valueOf(entAmount)).add(new BigDecimal(String.valueOf(outAmount)))).toString().equals("0")) {
-            throw new SystemException("金额未完全分配");
+        String string = (new BigDecimal(String.valueOf(entAmount)).add(new BigDecimal(String.valueOf(outAmount)))).toString();
+
+        if (!string.equals("0")) {
+            if (!string.equals("0.00")){
+                if (!string.equals("0.0")){
+                    throw new SystemException("金额未完全分配");
+                }
+            }
         }
         return true;
     }
@@ -367,6 +371,9 @@ public class TransferUtils {
                     if (enterAccountCard.getBalance().equals("0") || enterAccountCard.getBalance().equals("0.00")) {
                         throw new SystemException("账户余额不足");
                     }
+                    if (new BigDecimal(enterAccountCard.getBalance()).compareTo(invAccountExcelApplyAmount) < 0 ){
+                        throw new SystemException("账户余额不足");
+                    }
                 }
                 if (!enterAccountCard.getBalance().isEmpty()) {
                     enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());

+ 2 - 0
src/main/resources/mapper/modules/inv/InvAccountExcelMapper.xml

@@ -116,5 +116,7 @@
         <if test="insAccountExcel.payMethod!= null and insAccountExcel.payMethod!= ''">
             and pay_method = #{insAccountExcel.payMethod}
         </if>
+        order by create_time
+        desc
     </select>
 </mapper>

+ 4 - 0
src/main/resources/mapper/modules/inv/InvAccountOperateMapper.xml

@@ -71,6 +71,8 @@
         <if test="insAccountOperate.invoiceId != null and insAccountOperate.invoiceId != ''">
             and invoice_id like concat('%',#{insAccountOperate.invoiceId},'%')
         </if>
+        order by create_time
+        desc
     </select>
     <select id="selectInsAccountOperateList" resultMap="BaseResultMap">
         select
@@ -101,6 +103,8 @@
         <if test="insAccountOperate.createTime != null and insAccountOperate.createTime != ''">
             and create_time like concat('%',#{insAccountOperate.createTime},'%')
         </if>
+        order by create_time
+        desc
     </select>
     <select id="selectOperateList"  resultMap="BaseResultMap">
         select