Browse Source

BUG修复

wangliang 3 năm trước cách đây
mục cha
commit
61418ed751

+ 0 - 28
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsService.java

@@ -45,26 +45,6 @@ public interface TCStatisticsService extends IService<TCStatistics> {
                                        Long schoolId,
                                        Long userId);
 
-    /**
-     * 根据batchNo统计信息
-     *
-     * @param schoolId
-     * @param batchNo
-     * @param orgIds
-     * @return
-     */
-    public List<TCStatisticsDto> findByBatchNoCount(Long schoolId, String batchNo, Set<Long> orgIds);
-
-    /**
-     * 根据batchNo统计信息
-     *
-     * @param schoolId
-     * @param batchNo
-     * @param orgIds
-     * @return
-     */
-    public List<TCStatisticsDto> findByBatchNoCountJoin(Long schoolId, String batchNo, Set<Long> orgIds);
-
     /**
      * 导入关联数据
      *
@@ -82,14 +62,6 @@ public interface TCStatisticsService extends IService<TCStatistics> {
      */
     public void removeImportData(Long userId, Set<String> courseSet, Set<Long>... setCollections);
 
-    /**
-     * 刷新关联数据
-     *
-     * @param sysUser
-     * @param batchNoSet
-     */
-    public void freshenJoinData(SysUser sysUser, Set<String> batchNoSet);
-
     /**
      * 刷新数据
      *

+ 54 - 59
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsServiceImpl.java

@@ -68,32 +68,6 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
         return tcStatisticsMapper.list(iPage, collegeId, teachingRoomId, Objects.nonNull(status) ? status.name() : null, courseName, teacherName, schoolId, userId);
     }
 
-    /**
-     * 根据batchNo统计信息
-     *
-     * @param schoolId
-     * @param batchNo
-     * @param orgIds
-     * @return
-     */
-    @Override
-    public List<TCStatisticsDto> findByBatchNoCount(Long schoolId, String batchNo, Set<Long> orgIds) {
-        return tcStatisticsMapper.findByBatchNoCount(schoolId, batchNo, orgIds);
-    }
-
-    /**
-     * 根据batchNo统计信息
-     *
-     * @param schoolId
-     * @param batchNo
-     * @param orgIds
-     * @return
-     */
-    @Override
-    public List<TCStatisticsDto> findByBatchNoCountJoin(Long schoolId, String batchNo, Set<Long> orgIds) {
-        return tcStatisticsMapper.findByBatchNoCountJoin(schoolId, batchNo, orgIds);
-    }
-
     /**
      * 导入关联数据
      *
@@ -142,36 +116,6 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
         tcStatisticsTempService.remove(tcStatisticsTempQueryWrapper);
     }
 
-    /**
-     * 刷新关联数据
-     *
-     * @param sysUser
-     * @param batchNoSet
-     */
-    @Override
-    @Transactional
-    public void freshenJoinData(SysUser sysUser, Set<String> batchNoSet) {
-        TCStatisticsService tcStatisticsService = SpringContextHolder.getBean(TCStatisticsService.class);
-        for (String batchNo : batchNoSet) {
-            List<TCStatisticsTemp> tcStatisticsTempList = tcStatisticsTempService.findByBatchNoJoin(sysUser.getSchoolId(), batchNo);
-            if (Objects.nonNull(tcStatisticsTempList) && tcStatisticsTempList.size() > 0) {
-                QueryWrapper<TCStatisticsTemp> tcStatisticsTempQueryWrapper = new QueryWrapper<>();
-                tcStatisticsTempQueryWrapper.lambda().eq(TCStatisticsTemp::getBatchNo, batchNo);
-                tcStatisticsTempService.remove(tcStatisticsTempQueryWrapper);
-
-                String batchNoNew = SystemConstant.getUuid();
-                Set<Long> orgIds = this.joinDataGetOrgIds(sysUser, batchNoNew, tcStatisticsTempList);
-                List<TCStatisticsDto> tcStatisticsDtoList = this.findByBatchNoCountJoin(sysUser.getSchoolId(), batchNoNew, orgIds);
-                if (Objects.nonNull(tcStatisticsDtoList) && tcStatisticsDtoList.size() > 0) {
-                    QueryWrapper<TCStatistics> tcStatisticsQueryWrapper = new QueryWrapper<>();
-                    tcStatisticsQueryWrapper.lambda().eq(TCStatistics::getBatchNo, batchNo);
-                    tcStatisticsService.remove(tcStatisticsQueryWrapper);
-                    this.saveJoinData(sysUser, tcStatisticsDtoList);
-                }
-            }
-        }
-    }
-
     /**
      * 刷新数据
      *
@@ -180,11 +124,10 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
     @Override
     @Transactional
     public Result freshenData() {
-        TCStatisticsService tcStatisticsService = SpringContextHolder.getBean(TCStatisticsService.class);
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         QueryWrapper<TCStatistics> tcStatisticsQueryWrapper = new QueryWrapper<>();
         tcStatisticsQueryWrapper.select(" DISTINCT batch_no ").eq("create_id", sysUser.getId());
-        List<TCStatistics> tcStatisticsList = tcStatisticsService.list(tcStatisticsQueryWrapper);
+        List<TCStatistics> tcStatisticsList = this.list(tcStatisticsQueryWrapper);
         if (Objects.nonNull(tcStatisticsList) && tcStatisticsList.size() > 0) {
             Set<String> batchNoSet = tcStatisticsList.stream().map(s -> s.getBatchNo()).collect(Collectors.toSet());
             boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_BATCH_NO_PREFIX + Math.abs(batchNoSet.toString().hashCode()), SystemConstant.REDIS_LOCK_BATCH_NO_TIME_OUT);
@@ -192,7 +135,7 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
                 throw ExceptionResultEnum.ERROR.exception("正在刷新数据,请稍候再试!");
             }
             try {
-                tcStatisticsService.freshenJoinData(sysUser, batchNoSet);
+                this.freshenJoinData(sysUser, batchNoSet);
             } catch (Exception e) {
                 log.error("请求出错", e);
                 if (e instanceof ApiException) {
@@ -284,4 +227,56 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
         TCStatisticsService tcStatisticsService = SpringContextHolder.getBean(TCStatisticsService.class);
         tcStatisticsService.saveBatch(tcStatisticsList);
     }
+
+    /**
+     * 刷新关联数据
+     *
+     * @param sysUser
+     * @param batchNoSet
+     */
+    public void freshenJoinData(SysUser sysUser, Set<String> batchNoSet) {
+        TCStatisticsService tcStatisticsService = SpringContextHolder.getBean(TCStatisticsService.class);
+        for (String batchNo : batchNoSet) {
+            List<TCStatisticsTemp> tcStatisticsTempList = tcStatisticsTempService.findByBatchNoJoin(sysUser.getSchoolId(), batchNo);
+            if (Objects.nonNull(tcStatisticsTempList) && tcStatisticsTempList.size() > 0) {
+                QueryWrapper<TCStatisticsTemp> tcStatisticsTempQueryWrapper = new QueryWrapper<>();
+                tcStatisticsTempQueryWrapper.lambda().eq(TCStatisticsTemp::getBatchNo, batchNo);
+                tcStatisticsTempService.remove(tcStatisticsTempQueryWrapper);
+
+                String batchNoNew = SystemConstant.getUuid();
+                Set<Long> orgIds = this.joinDataGetOrgIds(sysUser, batchNoNew, tcStatisticsTempList);
+                List<TCStatisticsDto> tcStatisticsDtoList = this.findByBatchNoCountJoin(sysUser.getSchoolId(), batchNoNew, orgIds);
+                if (Objects.nonNull(tcStatisticsDtoList) && tcStatisticsDtoList.size() > 0) {
+                    QueryWrapper<TCStatistics> tcStatisticsQueryWrapper = new QueryWrapper<>();
+                    tcStatisticsQueryWrapper.lambda().eq(TCStatistics::getBatchNo, batchNo);
+                    tcStatisticsService.remove(tcStatisticsQueryWrapper);
+                    this.saveJoinData(sysUser, tcStatisticsDtoList);
+                }
+            }
+        }
+    }
+
+    /**
+     * 根据batchNo统计信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @param orgIds
+     * @return
+     */
+    public List<TCStatisticsDto> findByBatchNoCount(Long schoolId, String batchNo, Set<Long> orgIds) {
+        return tcStatisticsMapper.findByBatchNoCount(schoolId, batchNo, orgIds);
+    }
+
+    /**
+     * 根据batchNo统计信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @param orgIds
+     * @return
+     */
+    public List<TCStatisticsDto> findByBatchNoCountJoin(Long schoolId, String batchNo, Set<Long> orgIds) {
+        return tcStatisticsMapper.findByBatchNoCountJoin(schoolId, batchNo, orgIds);
+    }
 }