package jp.dip.arimodoki.cntl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import jp.dip.arimodoki.blogic.BlChartIf;
import jp.dip.arimodoki.common.CConst;
import jp.dip.arimodoki.common.JsonConvertIf;
import jp.dip.arimodoki.model.FormChartIf;
import jp.dip.arimodoki.model.JsonReqParamIf;
@Scope("prototype")
@RestController
public class DoughnutChart implements CConst {
@Autowired
private JsonConvertIf jsonConvert;
@Autowired
private FormChartIf formChart;
@Qualifier("BlChartMoc")
@Autowired
private BlChartIf blChart;
@Autowired
private JsonReqParamIf jsonReqParam;
@ModelAttribute("FormChart")
public FormChartIf setUpBindObject() {
this.blChart.setForm(this.formChart);
return this.formChart;
}
@RequestMapping(value = "/doughnutchart")
public ModelAndView doughnutchart() {
return new ModelAndView("chart");
}
@RequestMapping(value = "/doughnutchartdraw",
produces = MediaType.APPLICATION_JSON_UTF8_VALUE
)
public String doughnutchartdraw(
@RequestBody String jParam
) throws Exception {
jParam = jsonConvert.decode(jParam);
jsonReqParam = (JsonReqParamIf)jsonConvert.Deserialize(jParam, jsonReqParam);
formChart.setJsonReqParam(jsonReqParam);
blChart.getCharDoughnutData();
String resp_view= jsonConvert.Serialize(formChart.getChartDoughnutData());
logger.log_info(this, "resp_view["+resp_view+"]");
return resp_view;
}
}
|