yzc hace 2 años
padre
commit
330317393b

+ 11 - 4
hx-oa/src/main/java/com/fjhx/oa/utils/Notice.java

@@ -16,6 +16,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import javax.annotation.PostConstruct;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 /**
@@ -25,7 +26,7 @@ import java.util.stream.Collectors;
 @Configuration
 @EnableScheduling
 public class Notice {
-    private static Map<Long, ScheduleInfo> scheduleInfoMap = new HashMap<>();
+    private static Map<Long, ScheduleInfo> scheduleInfoMap = new ConcurrentHashMap<>();
     private static SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
 
     @Autowired
@@ -56,18 +57,24 @@ public class Notice {
     public void sendNoticeTime() {
         TenantHolder.setIgnore(true);
         List<ScheduleInfo> scheduleInfos = new ArrayList<>();
-        for (Map.Entry<Long, ScheduleInfo> entry : scheduleInfoMap.entrySet()) {
+//        for (Map.Entry<Long, ScheduleInfo> entry : scheduleInfoMap.entrySet()) {
+        Iterator<Map.Entry<Long, ScheduleInfo>> it = scheduleInfoMap.entrySet().iterator();
+        while(it.hasNext()){
+            Map.Entry<Long, ScheduleInfo> entry = it.next();
+
             ScheduleInfo scheduleInfo = entry.getValue();
             Date startDate = scheduleInfo.getStartDate();
             Date date = new Date();
             long diff = startDate.getTime() - date.getTime();
             long min = (long) Math.ceil(diff / 60.0 / 1000.0);
             if (min < 0) {
-                scheduleInfoMap.remove(scheduleInfo.getId());
+//                scheduleInfoMap.remove(scheduleInfo.getId());
+                it.remove();
             }
             //根据类型判断提前多少分钟通知
             if (min == scheduleInfo.getNoticeType()) {
-                scheduleInfoMap.remove(scheduleInfo.getId());
+//                scheduleInfoMap.remove(scheduleInfo.getId());
+                it.remove();
                 scheduleInfos.add(scheduleInfo);
             }
         }

+ 4 - 0
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockJournalServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fjhx.wms.service.stock.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.wms.entity.stock.po.StockJournal;
@@ -59,6 +60,9 @@ public class StockJournalServiceImpl extends ServiceImpl<StockJournalMapper, Sto
         //如果为调参类型记录赋值目标仓库名称
         if(dto.getType()==3){
             List<Long> toWarehouseIds = records.stream().map(StockJournalVo::getToWarehouseId).collect(Collectors.toList());
+            if(ObjectUtils.isEmpty(toWarehouseIds)){
+                return page;
+            }
             List<Warehouse> warehouses = warehouseService.listByIds(toWarehouseIds);
             Map<Long, Warehouse> warehouseMap = warehouses.stream().collect(Collectors.groupingBy(Warehouse::getId,
                     Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));