chenweida il y a 8 ans
Parent
commit
a1c3fab905

+ 2 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -212,12 +212,13 @@ public class CurrentDayAllQuotaJob implements Job {
            redisTemplate.expire(key, Integer.valueOf(currentExpire), TimeUnit.HOURS);//2小时过期
        }
        CachePool.addKeys(RedisStorage.keys);//缓存key
        RedisStorage.keys.clear();//清空Key
        //更新统计时间
        redisTemplate.opsForValue().set("quota:date", DateUtil.dateToStrLong(new Date()));
        //更新时间key
        redisTemplate.opsForValue().set("quota:timeKey", RedisStorage.timeKey);
        RedisStorage.keys.clear();//清空Key
    }
    private void computequota_37() {

+ 16 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/Constant.java

@ -227,6 +227,22 @@ public class Constant {
        String todayString = simpleDateFormat.format(today);
        String startDateString = (1900 + today.getYear()) + "-06-30";
        Date startDate = simpleDateFormat.parse(startDateString);
        if (simpleDateFormat.parse(todayString).after(startDate)) {
            return (1900 + today.getYear()) + "";
        } else {
            return (1900 + today.getYear() - 1) + "";
        }
    }
    public static String getNowYearByDate(String date) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date today = new Date();
        String todayString = simpleDateFormat.format(today);
        String startDateString = (1900 + today.getYear()) + "-06-30";
        Date startDate = simpleDateFormat.parse(startDateString);
        if (simpleDateFormat.parse(todayString).after(startDate)) {

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -91,8 +91,8 @@ public class StatisticsService extends BaseService {
     *
     * @return
     */
    public boolean peopleNumToRedis() throws Exception {
        List<PopulationBase> peopleNums = peopleNumDao.findByYear(Integer.valueOf(Constant.getNowYear()));
    public boolean peopleNumToRedis(String year) throws Exception {
        List<PopulationBase> peopleNums = peopleNumDao.findByYear(Integer.valueOf(year));
        for (PopulationBase peopleNum : peopleNums) {
            redisTemplate.opsForValue().set("people:num:" + peopleNum.getCode(), new JSONObject(peopleNum).toString());
@ -124,7 +124,7 @@ public class StatisticsService extends BaseService {
                "   and quota_date <= ? ";
        if (StringUtils.isNoneEmpty(startDate)) {
            sql += " and quota_date > '" + startDate + "'";
            sql += " and quota_date >= '" + startDate + "'";
        }
        if (level == 4) {

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -139,9 +139,9 @@ public class ManagerUtilController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/people_num_to_redis")
    public String peopleNumToRedis() {
    public String peopleNumToRedis(String year) {
        try {
            statisticsService.peopleNumToRedis();
            statisticsService.peopleNumToRedis(year);
            return write(200, "更新成功");
        } catch (Exception e) {
            return error(-1, "更新失败");

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -300,7 +300,7 @@ public class JobController extends BaseController {
     */
    public String peopleNumToRedis() {
        try {
            statisticsService.peopleNumToRedis();
            statisticsService.peopleNumToRedis(null);
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);

+ 14 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -254,7 +254,13 @@ public class StatisticsController extends BaseController {
            JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null, year);
            jsonArrays.add(jsonArray1);
            JSONArray jsonArray2 = statisticsService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
            JSONArray jsonArray2 = null;
            if (Constant.getNowYearByDate(endDate).equals(year)) {
                jsonArray2 = statisticsService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
            }else{
                String date=Integer.valueOf(year)+"-06-30";
                jsonArray2 = statisticsService.getLowLevelIncrementDetail(date, date, area, level, indexes[1], sort, lowLevel);
            }
            jsonArrays.add(jsonArray2);
            //遍历合并2个指标中key值一样的
@ -312,19 +318,20 @@ public class StatisticsController extends BaseController {
    /**
     * 指标期间      增长量
     * 如果是查找去年的 前端根据endDate来查看 2016年度 就传 2017-6-30
     *
     * @param endDate
     * @param area
     * @param level
     * @param index 6 7 8 15 16
     * @param index   6 7 8 15 16
     * @return
     */
    @RequestMapping("/leveltwo_increment")
    @ResponseBody
    public String getIndexLevelTwoIncrement(
                                            @RequestParam(required = true) String endDate,
                                            @RequestParam(required = true) String area,
                                            @RequestParam(required = true) int level,
                                            @RequestParam(required = true) String index) {
            @RequestParam(required = true) String endDate,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index) {
        try {
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
@ -340,7 +347,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取签约率、签约完成率
     * 获取签约率、签约完成率 续签率
     * t
     *
     * @param endDate 截止日期