package com.zcloud.controller.eightwork;

import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.PageData;
import com.zcloud.logs.LogAnno;
import com.zcloud.service.corp.CorpInfoService;
import com.zcloud.service.eightwork.EightWorkService;
import com.zcloud.util.*;
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.*;

/**
 * 说明：有限空间台账
 * 作者：luoxiaobao
 * 时间：2021-04-02
 * 官网：www.zcloudchina.com
 */
@Controller
@RequestMapping("/eightWork")
public class EightWorkController extends BaseController {

	@Autowired
	private CorpInfoService corpInfoService;
	@Autowired
	private EightWorkService eightWorkService;

	/**新增
	 * @param
	 * @throws Exception
	 */
	@RequestMapping(value="/eightWorkBI")
	@ResponseBody
	public Object eightWorkBI() throws Exception{
		Map<String,Object> map = new HashMap<String,Object>();
		String errInfo = "success";
		PageData pd = new PageData();
		pd = this.getPageData();
		pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业
		PageData count = corpInfoService.eightWorkBI(pd);
		map.put("count", count);
		map.put("result", errInfo);
		return map;
	}

	/**持续改进企业报告
	 * @param
	 * @throws Exception
	 */
	@RequestMapping(value="/getDiagnosis")
	@ResponseBody
	public Object getDiagnosis() throws Exception{
		Map<String,Object> map = new HashMap<String,Object>();
		String errInfo = "success";
		PageData pd = new PageData();
		pd = this.getPageData();
		pd.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID());
		List<PageData> eightlist = eightWorkService.listAllForDiagnosis(pd);

		map.put("eightlist", eightlist);
		if(pd!=null) {
			errInfo = "success";
		}else {
			errInfo = "faild";
		}
		map.put("result", errInfo);
		return map;
	}
}
