jyy
2021-01-16 f638a35468d62ecead700fbce01a005079ba7c2a
zq-erp/src/main/java/com/matrix/system/hive/statistics/SysBusinessDataAction.java
@@ -3,15 +3,21 @@
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.DateUtil;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.hive.dao.SysBusinessDataDao;
import com.matrix.system.hiveErp.analysUtil.StatisticsTimeDaoParam;
import com.matrix.system.hiveErp.analysUtil.StatisticsTimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
@@ -44,5 +50,32 @@
        return result;
    }
    /**
     * 日销售汇总
     *
     * @param dailySaleVo
     * @param pageVo
     * @return
     */
    @RequestMapping(value = "/findDailySaleData")
    @ResponseBody
    public AjaxResult findDailySaleData(DailySaleVo dailySaleVo, PaginationVO pageVo) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, -pageVo.getOffset());
        String endTime = DateUtil.dateToString(calendar.getTime(), DateUtil.DATE_FORMAT_DD);
        calendar.add(Calendar.DATE, -pageVo.getLimit());
        String startTime = DateUtil.dateToString(calendar.getTime(), DateUtil.DATE_FORMAT_DD);
        List<Date> xAxis = StatisticsTimeUtil.getTimeSpace(startTime, endTime, "日");
        List<StatisticsTimeDaoParam> timeSpaceParam = StatisticsTimeUtil.buidParam(xAxis);
        List<StatisticsTimeDaoParam> statisticsTimeDaoParams = timeSpaceParam.subList(0, timeSpaceParam.size() - 2);
        List<DailySaleVo> dailySaleVos = sysBusinessDataDao.selectDailySaleData(statisticsTimeDaoParams, dailySaleVo.getShopId());
        List<DailySaleVo> result = new ArrayList<>();
        for (int i = dailySaleVos.size() - 1; i >= 0; i--) {
            result.add(dailySaleVos.get(i));
        }
        return AjaxResult.buildSuccessInstance(result);
    }
}