Quellcode durchsuchen

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu vor 5 Monaten
Ursprung
Commit
f3b86598fd

+ 14 - 3
mall-server-api/src/main/java/com/gree/mall/manager/logic/worker/WorkerWarrantyLogic.java

@@ -108,6 +108,7 @@ public class WorkerWarrantyLogic {
                     .count() > 0) {
                 throw new RemoteServiceException(user.getNickName()+"师傅已经添加过质保金");
             }
+
             WorkerWarranty workerWarranty = new WorkerWarranty();
             workerWarranty.setWebsitId(websitUser.getWebsitId());
             workerWarranty.setWebsitName(websitUser.getWebsitName());
@@ -120,9 +121,15 @@ public class WorkerWarrantyLogic {
             workerWarranty.setMobile(user.getMobile());
             workerWarranty.setEveryAmount(everyAmount);
             workerWarranty.setShouldAmount(shouldAmount);
+
+            if (workerWarranties.stream().filter(item -> item.getMobile().equals(workerWarranty.getMobile())).count() > 0) {
+                continue;
+            }
+
             workerWarranties.add(workerWarranty);
         }
 
+
         workerWarrantyService.saveBatch(workerWarranties);
     }
 
@@ -154,6 +161,8 @@ public class WorkerWarrantyLogic {
         //网点名称
         Map<String, User> userMap = userService.lambdaQuery()
                 .eq(User::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .isNotNull(User::getMobile)
+                .ne(User::getMobile,"")
                 .list().stream().collect(Collectors.toMap(User::getMobile, Function.identity()));
 
         for (int i = 0; i < objects.size(); i++) {
@@ -218,7 +227,7 @@ public class WorkerWarrantyLogic {
                 workerWarrantyPays.addAll(workerWarrantyPays1);
 
                 if (CollectionUtils.isNotEmpty(workerWarrantyListUp))
-                    workerWarranty.setPayableAmount(workerWarrantyListUp.get(0).getPayableAmount().add(workerWarranty.getPayableAmount()));
+                    workerWarranty.setPayableAmount(workerWarrantyListUp.get(0).getPayableAmount());
                 for (WorkerWarrantyPay workerWarrantyPay : workerWarrantyPays1) {
                     workerWarranty.setPayableAmount(workerWarrantyPay.getPayAmount().add(workerWarranty.getPayableAmount()));
                 }
@@ -245,8 +254,10 @@ public class WorkerWarrantyLogic {
         List<WorkerWarrantyPay> workerWarrantyPays = new ArrayList<>();
         //默认最多10个机型
         for (int i = 0; i < 24; i++) {
-            String payAmount = (String) row.get(2 * i + 12);
-            String payAmountTime = (String) row.get(2 * i + 13);
+            if (row.size() < (2 * i + 14))
+                break;
+            String payAmount = (String) row.get(2 * i + 13);
+            String payAmountTime = (String) row.get(2 * i + 14);
 
             if (StringUtils.isBlank(payAmount)) {
                 continue;