瀏覽代碼

LY 多线程优化

ly 1 年之前
父節點
當前提交
37602ddfc0

+ 1 - 1
master/src/main/java/com/ruoyi/project/ehs/controller/TJobticketController.java

@@ -98,7 +98,7 @@ public class TJobticketController extends BaseController {
                 try {
                     latch.await(); //线程计数完毕后继续执行
                 } catch (InterruptedException e) {
-                    e.printStackTrace();
+                    logger.error("e" ,e);
                 }
                 executorService.shutdown();
             }

+ 6 - 1
master/src/main/java/com/ruoyi/project/invoice/controller/TInvoiceBookingworkticketController.java

@@ -511,7 +511,12 @@ public class TInvoiceBookingworkticketController extends BaseController {
         List<SysDictData> book_work_type = iSysDictTypeService.selectDictDataByType("book_work_type");
 
         List<TInvoiceWorkcontent> tInvoiceWorkcontentList = tInvoiceBookingworkticketService.selectTInvoiceWorkcontentList(tInvoiceBookingworkticket);
+//        List<TInvoiceWorkcontent> tInvoiceWorkcontentList = tInvoiceWorkcontentList2.subList(0, 100);
 
+        if (tInvoiceWorkcontentList.size() < 1 ) {
+            return AjaxResult.error("无导出内容");
+        }
+        logger.info("tInvoiceWorkcontentList::::::::::::::",tInvoiceWorkcontentList.size());
         ExecutorService executorService = Executors.newFixedThreadPool(20);
         final CountDownLatch latch = new CountDownLatch(tInvoiceWorkcontentList.size()); //相同线程数量的计数
         for (TInvoiceWorkcontent workcontent : tInvoiceWorkcontentList) {
@@ -684,7 +689,7 @@ public class TInvoiceBookingworkticketController extends BaseController {
                 rowIndex++;
                 contentUserWorkType.delete(0, contentUserWorkType.length());
             } catch (Exception e) {
-                logger.error(e.toString());
+                logger.error("e" , e);
             }
 
         }

+ 7 - 0
master/src/main/java/com/ruoyi/project/production/service/impl/TSaiApplyServiceImpl.java

@@ -7,6 +7,7 @@ import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.framework.security.LoginUser;
 import com.ruoyi.framework.security.service.TokenService;
+import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.page.PageDomain;
 import com.ruoyi.framework.web.page.TableSupport;
 import com.ruoyi.project.production.controller.vo.SaiApplyQueryVO;
@@ -21,6 +22,8 @@ import com.ruoyi.project.system.mapper.SysUserMapper;
 import com.ruoyi.project.system.mapper.SysUserRoleMapper;
 import com.ruoyi.project.system.service.ISysDictTypeService;
 import com.ruoyi.project.system.service.ISysUserService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -57,6 +60,8 @@ public class TSaiApplyServiceImpl implements ITSaiApplyService
     @Resource
     private ISysUserService userService;
 
+    protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
+
     /**
      * 查询SAI开项管理
      *
@@ -178,6 +183,8 @@ public class TSaiApplyServiceImpl implements ITSaiApplyService
                             }
                         }
                     }
+                }catch (Exception e) {
+                    logger.error("e:", e);
                 }finally {
                     latch.countDown(); //线程计数
                 }

+ 2 - 2
master/src/main/java/com/ruoyi/project/training/controller/TTrainingHisparticipantsController.java

@@ -199,7 +199,7 @@ public class TTrainingHisparticipantsController extends BaseController {
                     entity.setCreaterCode(userId.toString());
                     list.add(entity);
                 } catch (Exception e) {
-                    logger.error(JSON.toJSONString(e));
+                    logger.error("e", e);
                     failNumber.getAndIncrement();
                     failRow.add(finalI + 1);
                 } finally {
@@ -228,7 +228,7 @@ public class TTrainingHisparticipantsController extends BaseController {
                     tTrainingHisparticipantsMapper.insertTTrainingHisparticipants(t);
                     successNumber.getAndIncrement();
                 } catch (Exception e) {
-                    logger.error(JSON.toJSONString(e));
+                    logger.error("e", e);
                     failNumber.getAndIncrement();
                     failRow.add(Integer.parseInt(t.getRemark()));
                 }finally {

+ 3 - 1
master/src/main/java/com/ruoyi/project/training/newstaff/controller/TTnNewController.java

@@ -108,7 +108,9 @@ public class TTnNewController extends BaseController {
                     } else {
                         t.setPlanFinish("0");
                     }
-                } finally {
+                } catch (Exception e) {
+                    logger.error("e:", e);
+                }finally {
                     latch.countDown(); //线程计数
                 }
             });