package com.dy.pipIrrStatistics.statistics; 
 | 
  
 | 
import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayMapper; 
 | 
import com.dy.pipIrrGlobal.daoSt.StClientAmountMonthMapper; 
 | 
import com.dy.pipIrrGlobal.daoSt.StClientAmountYearMapper; 
 | 
import com.dy.pipIrrGlobal.pojoSt.StClientAmountMonth; 
 | 
import com.dy.pipIrrGlobal.pojoSt.StClientAmountYear; 
 | 
import com.dy.pipIrrGlobal.voSt.VoClientAmountStatistics; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.stereotype.Component; 
 | 
import org.springframework.transaction.annotation.Transactional; 
 | 
  
 | 
import java.util.List; 
 | 
  
 | 
/** 
 | 
 * @Author: liurunyu 
 | 
 * @Date: 2024/7/24 16:28 
 | 
 * @Description 
 | 
 */ 
 | 
@Component 
 | 
public class StClientSv { 
 | 
  
 | 
    @Autowired 
 | 
    protected RmClientAmountDayMapper rmClientAmountDayDao; 
 | 
  
 | 
    @Autowired 
 | 
    protected StClientAmountMonthMapper stClientAmountMonthDao ; 
 | 
  
 | 
    @Autowired 
 | 
    protected StClientAmountYearMapper stClientAmountYearDao ; 
 | 
  
 | 
    /** 
 | 
     * 月统计---漏损 
 | 
     */ 
 | 
    @Transactional 
 | 
    protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth, Long statisticsStartId, Long statisticsEndId){ 
 | 
        List<VoClientAmountStatistics> list = rmClientAmountDayDao.statisticsByClient(statisticsStartId, statisticsEndId) ; 
 | 
        if(list != null && list.size() > 0){ 
 | 
            for(VoClientAmountStatistics vo : list){ 
 | 
                StClientAmountMonth po = new StClientAmountMonth() ; 
 | 
                po.clientId = vo.clientId ; 
 | 
                po.year = statisticsYear ; 
 | 
                po.month = statisticsMonth ; 
 | 
                po.amount = vo.amount; 
 | 
                stClientAmountMonthDao.insert(po) ; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 年统计---漏损 
 | 
     */ 
 | 
    @Transactional 
 | 
    protected void statisticsYear(Integer statisticsYear){ 
 | 
        List<VoClientAmountStatistics> list = stClientAmountMonthDao.statisticsByClient(statisticsYear) ; 
 | 
        if(list != null && list.size() > 0){ 
 | 
            for(VoClientAmountStatistics vo : list){ 
 | 
                StClientAmountYear po = new StClientAmountYear() ; 
 | 
                po.clientId = vo.clientId ; 
 | 
                po.year = statisticsYear ; 
 | 
                po.amount = vo.amount; 
 | 
                stClientAmountYearDao.insert(po) ; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
} 
 |