Bladeren bron

缺失问题优化

chenjianhua 3 weken geleden
bovenliggende
commit
5cd72f9b2b

+ 3 - 0
service-base/src/main/java/com/simuwang/base/mapper/daq/FundNotMappingMapper.java

@@ -3,8 +3,11 @@ package com.simuwang.base.mapper.daq;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.simuwang.base.pojo.dos.FundNotMappingInfoDO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 @Mapper
 public interface FundNotMappingMapper extends BaseMapper<FundNotMappingInfoDO> {
     FundNotMappingInfoDO getFundNotMappingInfo(FundNotMappingInfoDO fundNotMappingInfoDO);
+
+    FundNotMappingInfoDO getFundNotMappingInfoByAliasId(@Param("fundAliasId") Integer fundAliasId);
 }

+ 2 - 0
service-base/src/main/resources/mapper/daq/FundAliasMapper.xml

@@ -160,6 +160,8 @@
         on alias.target_fund_id = info.fund_id and info.isvalid=1
         left join pvn_company_info c
         on c.company_id = info.trust_id and c.isvalid=1
+        join fund_not_mapping_info fnmi
+        on fnmi.fund_alias_id=alias.id and fnmi.isvalid=1
         where alias.isvalid=1
         <if test="fundName != null and fundName !=''">
             and (alias.source_fund_name like concat('%',#{fundName},'%') or alias.source_register_number like concat('%',#{fundName},'%') )

+ 4 - 0
service-base/src/main/resources/mapper/daq/FundNotMappingMapper.xml

@@ -29,5 +29,9 @@
         <if test="registerNumber == null">
             and register_number is null
         </if>
+        limit 1
+    </select>
+    <select id="getFundNotMappingInfoByAliasId" resultMap="BaseResultMap">
+        select * from fund_not_mapping_info where isvalid=1 and fund_alias_id=#{fundAliasId} limit 1
     </select>
 </mapper>

+ 29 - 25
service-manage/src/main/java/com/simuwang/manage/service/impl/DeletionServiceImpl.java

@@ -235,33 +235,37 @@ public class DeletionServiceImpl implements DeletionService {
     @Override
     public void computeDeletionTypeNum(List<FundDeletionTypeDO> fundDeletionTypeList) {
         for (FundDeletionTypeDO fundDeletionType : fundDeletionTypeList) {
-            String fundId = fundDeletionType.getFundId();
-            Integer deletionType = fundDeletionType.getDeletionType();
-            Integer channelId = fundDeletionType.getDeletionType();
-            Integer deletionNum = deletionInfoMapper.countChannelFundDeletion(fundId, deletionType, channelId, 1);
-            Integer processedNum = deletionInfoMapper.countChannelFundDeletion(fundId, deletionType, channelId, 0);
-            if(deletionNum == 0 && processedNum == 0){
-                continue;
-            }
-            String lastDeletionDate = deletionInfoMapper.getLastDeletionDate(fundId, deletionType, channelId);
-            DeletionTypeStatisticsDO deletionTypeStatisticsDO = new DeletionTypeStatisticsDO();
-            deletionTypeStatisticsDO.setFundId(fundId);
-            deletionTypeStatisticsDO.setIsvalid(1);
-            deletionTypeStatisticsDO.setChannelId(channelId);
-            deletionTypeStatisticsDO.setCreateTime(new Date());
-            deletionTypeStatisticsDO.setCreatorId(999999);
-            deletionTypeStatisticsDO.setUpdaterId(999999);
-            deletionTypeStatisticsDO.setUpdateTime(new Date());
-            deletionTypeStatisticsDO.setLastDeletionDate(lastDeletionDate);
-            deletionTypeStatisticsDO.setDeletionType(Integer.valueOf(deletionType));
-            deletionTypeStatisticsDO.setDeletionNum(deletionNum);
-            deletionTypeStatisticsDO.setProcessedNum(processedNum);
-            DeletionTypeStatisticsDO oldDeletionTypeStatisticsDO = deletionTypeStatisticsMapper.getDeletionTypeStatistics(fundId, deletionType,channelId);
-            if (oldDeletionTypeStatisticsDO != null) {
-                deletionTypeStatisticsDO.setId(oldDeletionTypeStatisticsDO.getId());
+            try{
+                String fundId = fundDeletionType.getFundId();
+                Integer deletionType = fundDeletionType.getDeletionType();
+                Integer channelId = fundDeletionType.getDeletionType();
+                Integer deletionNum = deletionInfoMapper.countChannelFundDeletion(fundId, deletionType, channelId, 1);
+                Integer processedNum = deletionInfoMapper.countChannelFundDeletion(fundId, deletionType, channelId, 0);
+                if(deletionNum == 0 && processedNum == 0){
+                    continue;
+                }
+                String lastDeletionDate = deletionInfoMapper.getLastDeletionDate(fundId, deletionType, channelId);
+                DeletionTypeStatisticsDO deletionTypeStatisticsDO = new DeletionTypeStatisticsDO();
+                deletionTypeStatisticsDO.setFundId(fundId);
+                deletionTypeStatisticsDO.setIsvalid(1);
+                deletionTypeStatisticsDO.setChannelId(channelId);
+                deletionTypeStatisticsDO.setCreateTime(new Date());
+                deletionTypeStatisticsDO.setCreatorId(999999);
+                deletionTypeStatisticsDO.setUpdaterId(999999);
                 deletionTypeStatisticsDO.setUpdateTime(new Date());
+                deletionTypeStatisticsDO.setLastDeletionDate(lastDeletionDate);
+                deletionTypeStatisticsDO.setDeletionType(deletionType);
+                deletionTypeStatisticsDO.setDeletionNum(deletionNum);
+                deletionTypeStatisticsDO.setProcessedNum(processedNum);
+                DeletionTypeStatisticsDO oldDeletionTypeStatisticsDO = deletionTypeStatisticsMapper.getDeletionTypeStatistics(fundId, deletionType,channelId);
+                if (oldDeletionTypeStatisticsDO != null) {
+                    deletionTypeStatisticsDO.setId(oldDeletionTypeStatisticsDO.getId());
+                    deletionTypeStatisticsDO.setUpdateTime(new Date());
+                }
+                deletionTypeStatisticsMapper.insertOrUpdate(deletionTypeStatisticsDO);
+            }catch (Exception e){
+                log.error(e.getMessage(),e);
             }
-            deletionTypeStatisticsMapper.insertOrUpdate(deletionTypeStatisticsDO);
         }
     }
 

+ 12 - 3
service-manage/src/main/java/com/simuwang/manage/service/impl/FundNotMappingServiceImpl.java

@@ -3,6 +3,9 @@ package com.simuwang.manage.service.impl;
 import com.simuwang.base.mapper.daq.FundNotMappingMapper;
 import com.simuwang.base.pojo.dos.FundNotMappingInfoDO;
 import com.simuwang.manage.service.FundNotMappingService;
+import com.simuwang.manage.task.FundDeletionTask;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -12,13 +15,19 @@ import java.util.List;
 public class FundNotMappingServiceImpl implements FundNotMappingService {
     @Autowired
     private FundNotMappingMapper fundNotMappingMapper;
+
+    private static final Logger log = LoggerFactory.getLogger(FundNotMappingServiceImpl.class);
     
     @Override
     public void batchInsert(List<FundNotMappingInfoDO> fundNotMappingInfoDOList) {
         for (FundNotMappingInfoDO fundNotMappingInfoDO : fundNotMappingInfoDOList) {
-            FundNotMappingInfoDO oldFundNotMappingInfoDO = fundNotMappingMapper.getFundNotMappingInfo(fundNotMappingInfoDO);
-            if(oldFundNotMappingInfoDO != null){
-                fundNotMappingInfoDO.setId(oldFundNotMappingInfoDO.getId());
+            try{
+                FundNotMappingInfoDO oldFundNotMappingInfoDO = fundNotMappingMapper.getFundNotMappingInfoByAliasId(fundNotMappingInfoDO.getFundAliasId());
+                if(oldFundNotMappingInfoDO != null){
+                    fundNotMappingInfoDO.setId(oldFundNotMappingInfoDO.getId());
+                }
+            }catch (Exception e){
+                log.error(e.getMessage(),e);
             }
         }
         fundNotMappingMapper.insertOrUpdate(fundNotMappingInfoDOList);

+ 1 - 0
service-manage/src/main/java/com/simuwang/manage/task/FundDeletionTask.java

@@ -45,6 +45,7 @@ public class FundDeletionTask {
             //统计缺失类型的处理数据量
             deletionTypeStatisticsMapper.truncateTable();
             List<FundDeletionTypeDO> fundDeletionTypeList = deletionService.getFundDeletionTypeMapList();
+            log.info("需要计算缺失的大小数量:"+fundDeletionTypeList.size());
             deletionService.computeDeletionTypeNum(fundDeletionTypeList);
         }catch (Exception e){
             log.error(e.getMessage(),e);