package com.wb.permission.domain;

import com.ag.base.BaseService;
import com.ag.base.IRedisService;
import com.alibaba.fastjson.JSONObject;
import com.wb.util.WebUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by yangxh on 2022/5/6.
 */
@Service
public class HomeDataService extends BaseService {

    @Autowired
    private IRedisService redisService;

    public void getBaseData(org.json.JSONObject jsonObject, HttpServletResponse response, HttpServletRequest request){
        String data = redisService.getCustomizeKey(super.getTenancyId(jsonObject)+"_baseData");
        try {
            WebUtil.send(response, data);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void setBaseData(org.json.JSONObject jsonObject, HttpServletResponse response, HttpServletRequest request){
        JSONObject json = new JSONObject();
        json.put("home_nttl", 4081934);
        json.put("home_yttl", 139972);
        json.put("home_kcl", 95373);
        json.put("home_cbs", "11/6");
        redisService.putCustomizeKey(super.getTenancyId(jsonObject)+"_baseData", json.toString());
    }

}
