pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/statistics/StClientAmountDaySv.java
File was renamed from pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/statistics/StClientAmountSv.java
@@ -24,7 +24,7 @@
@Slf4j
@Service
public class StClientAmountSv {
public class StClientAmountDaySv {
    protected RmClientAmountDayMapper rmClientAmountDayDao;
@@ -40,8 +40,6 @@
        this.stClientAmountDayDao = dao;
    }
    private static final int[][] yearMonthGrp = {{2024, 9}, {2024, 10}, {2024, 11}, {2024, 12}, {2025, 1}, {2025, 2}, {2025, 3}, {2025, 4}};
    /**
     * 删除所有
     * @throws Exception
@@ -56,17 +54,18 @@
     * @throws Exception
     */
    public void transSaveClientAmountDay() throws Exception {
        //统计到昨天,今天的统计明日零晨定时任务统计
        Long yesterday = Long.parseLong(DateTime.lastXDay_yyyy_MM_dd(1).replaceAll("-", ""));
        Long atDay = Long.MAX_VALUE ;
        int endDayOfMonth = 0 ;
        for(int[] ym : yearMonthGrp) {
        for(int[] ym : StClientAmountConstant.yearMonthGrp) {
            endDayOfMonth = DateTime.endDayOfMonth(ym[0], ym[1]) ;
            for (int day = 1; day <= endDayOfMonth; day++) {
                atDay = Long.parseLong(ym[0] + "" + (ym[1] < 10?("0" + ym[1]):ym[1]) + "" + (day < 10?("0" + day):day)) ;
                if(atDay <= yesterday) {
                    Long statistics4DayStartId = IDLongGenerator.generateOneDayStartId(ym[0], ym[1], day);
                    Long statistics4DayEndId = IDLongGenerator.generateOneDayEndId(ym[0], ym[1], day);
                    this.statisticsDay(ym[0], ym[1], day, statistics4DayStartId, statistics4DayEndId);
                    this.doSome(ym[0], ym[1], day, statistics4DayStartId, statistics4DayEndId);
                }
            }
        }
@@ -74,23 +73,19 @@
    @Transactional
    protected void statisticsDay(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Long statisticsStartId, Long statisticsEndId){
    protected void doSome(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Long statisticsStartId, Long statisticsEndId){
        List<VoClientAmountStatistics> list = rmClientAmountDayDao.statisticsByClient(statisticsStartId, statisticsEndId) ;
        if(list != null && list.size() > 0){
            List<StClientAmountDay> listOfDay = stClientAmountDayDao.selectByYearAndMonthAndDay(statisticsYear, statisticsMonth) ;
            for(VoClientAmountStatistics vo : list){
                List<StClientAmountDay> listOfDay = stClientAmountDayDao.selectByClientIdAndYearAndMonthAndDay(vo.clientId, statisticsYear, statisticsMonth) ;
                StClientAmountDay po = null ;
                if(listOfDay != null && listOfDay.size() > 0){
                    //程序逻辑控制上,集合中只有一个对象
                    po = listOfDay.get(0) ;
                }
                StClientAmountDay po = this.getDataOfClient(listOfDay, vo.clientId) ;
                if(po == null){
                    po = new StClientAmountDay() ;
                    po.clientId = vo.clientId ;
                    po.year = statisticsYear ;
                    po.month = statisticsMonth ;
                }
                this.setValueOfDayOfMonth(statisticsDay, vo, po);
                this.setValue(statisticsDay, vo, po);
                if(po.id == null) {
                    stClientAmountDayDao.insert(po);
                }else{
@@ -100,7 +95,20 @@
        }
    }
    private void setValueOfDayOfMonth(Integer statisticsDay, VoClientAmountStatistics vo, StClientAmountDay po){
    private StClientAmountDay getDataOfClient(List<StClientAmountDay> list, Long clientId){
        if(list != null && list.size() > 0){
            for(StClientAmountDay vo : list){
                if(vo.clientId.longValue() == clientId.longValue()){
                    //程序逻辑控制上,集合中只有一个对象
                    return vo ;
                }
            }
        }
        return null ;
    }
    private void setValue(Integer statisticsDay, VoClientAmountStatistics vo, StClientAmountDay po){
        switch (statisticsDay) {
            case 1:
                po.amount1 = vo.amount;
@@ -260,62 +268,5 @@
        }
    }
    private void setValueOfMonthOfYear(Integer statisticsMonth, VoClientConsumeStatistics vo, StConsumeClientMonth po){
        switch (statisticsMonth) {
            case 1:
                po.amount1 = vo.amount;
                po.times1 = vo.times;
                break;
            case 2:
                po.amount2 = vo.amount;
                po.times2 = vo.times;
                break;
            case 3:
                po.amount3 = vo.amount;
                po.times3 = vo.times;
                break;
            case 4:
                po.amount4 = vo.amount;
                po.times4 = vo.times;
                break;
            case 5:
                po.amount5 = vo.amount;
                po.times5 = vo.times;
                break;
            case 6:
                po.amount6 = vo.amount;
                po.times6 = vo.times;
                break;
            case 7:
                po.amount7 = vo.amount;
                po.times7 = vo.times;
                break;
            case 8:
                po.amount8 = vo.amount;
                po.times8 = vo.times;
                break;
            case 9:
                po.amount9 = vo.amount;
                po.times9 = vo.times;
                break;
            case 10:
                po.amount10 = vo.amount;
                po.times10 = vo.times;
                break;
            case 11:
                po.amount11 = vo.amount;
                po.times11 = vo.times;
                break;
            case 12:
                po.amount12 = vo.amount;
                po.times12 = vo.times;
                break;
        }
    }
    private void setValueOfYear(VoClientConsumeStatistics vo, StConsumeClientYear po){
        po.amount = vo.amount;
        po.times = vo.times;
    }
}