package com.yssh.service.impl;
|
|
import java.math.BigDecimal;
|
import java.math.RoundingMode;
|
import java.util.Calendar;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import com.yssh.dao.FeedbackMapper;
|
import com.yssh.dao.ThuAccuracyMapper;
|
import com.yssh.service.ICountService;
|
import com.yssh.utils.DateUtils;
|
|
@Service
|
public class CountServiceImpl implements ICountService {
|
|
@Autowired
|
private ThuAccuracyMapper thuAccuracyMapper;
|
|
@Autowired
|
private FeedbackMapper feedbackMapper;
|
|
@Override
|
public Map<String, Double> selectAccuracyAvg() {
|
Map<String, Double> result = new HashMap<String, Double>();
|
Date nowDate = DateUtils.getNowDate();
|
Long beginTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -7, Calendar.DATE)));
|
Double thuAccuracy = thuAccuracyMapper.selectSevenDayAccuracyAvg(beginTime);
|
Double tempForecast = thuAccuracy == null ? 0.0 : thuAccuracy;
|
result.put("forecastRate", new BigDecimal(tempForecast).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
Double practical = feedbackMapper.selectSevenDayAccuracyAvg(beginTime);
|
Double tempPractical = practical == null ? 0.0 : practical;
|
result.put("practicalRate", new BigDecimal(tempPractical * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
return result;
|
}
|
|
}
|