Newer
Older
huludao / src / main / java / com / newfiber / api / mobile / controller / ComplaintsStatisticsController.java
package com.newfiber.api.mobile.controller;

import com.newfiber.api.core.annotation.SysLog;
import com.newfiber.api.core.bean.ReqBodyObj;
import com.newfiber.api.core.bean.RespBodyObj;
import com.newfiber.api.mobile.model.domain.PatrolProblem;
import com.newfiber.api.mobile.model.domain.ProblemStatistical;
import com.newfiber.api.mobile.service.ComplaintsStatisticsService;
import com.newfiber.api.pc.model.EventsManage.Complaint;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018/12/12.
 */
@RestController
@RequestMapping("/ComplaintsStatistics")
public class ComplaintsStatisticsController {
    @Autowired
    private ComplaintsStatisticsService complaintsStatisticsService;
    /**
     * 统计本级河湖对应时间段的各类投诉问题
     * @author chenhonggang
     * @date 2018-12-12
     * @param params
     * @return
     */
    @PostMapping("problemStatistics")
    @SysLog(value="查询",actionType="4")
    public RespBodyObj<List<ProblemStatistical>> problemStatistics(@RequestBody ReqBodyObj<Map<String,Object>> params, HttpServletRequest request){
        Map<String,Object> map = params.getData();
        map.put("sid",request.getHeader("sid"));
        List<ProblemStatistical> result = complaintsStatisticsService.problemStatistics(map);
        return RespBodyObj.ok(result);
    }


    /**
     * 统计下级河湖对应时间段的各类投诉问题
     * @author chenhonggang
     * @date 2018-12-12
     * @param params
     * @return
     */
    @PostMapping("problenStatisticsSubordinate")
    @SysLog(value="查询",actionType="4")
    public RespBodyObj<List<ProblemStatistical>> problenStatisticsSubordinate(@RequestBody ReqBodyObj<Map<String,Object>> params,HttpServletRequest request){
        Map<String,Object> map = params.getData();
        map.put("sid",request.getHeader("sid"));
        List<ProblemStatistical> result = complaintsStatisticsService.problenStatisticsSubordinate(map);
        return RespBodyObj.ok(result);
    }

    /**
     * 本级河长投诉事件统计
     * @author chenhonggang
     * @date 2018-12-12
     * @param params
     * @return
     */
    @PostMapping("EventStatisticsThisLevel")
    @SysLog(value="查询",actionType="4")
    public RespBodyObj<Map<String,Object>> EventStatisticsThisLevel(@RequestBody ReqBodyObj<Map<String,Object>> params,HttpServletRequest request){
        Map<String,Object> map = params.getData();
        map.put("sid",request.getHeader("sid"));
        Map<String,Object> result = complaintsStatisticsService.InspectEvent(map);
        return RespBodyObj.ok(result);
    }

    /**
     * 对应下级区域投诉事件统计
     * @author chenhonggang
     * @date 2018-12-12
     * @param params
     * @return
     */
    @PostMapping("EventStatisticsNextLevel")
    @SysLog(value="查询",actionType="4")
    public RespBodyObj<Map<String,Object>> EventStatisticsNextLevel(@RequestBody ReqBodyObj<Map<String,Object>> params,HttpServletRequest request){
        Map<String,Object> map = params.getData();
        map.put("sid",request.getHeader("sid"));
        Map<String,Object> result = complaintsStatisticsService.InspectEventSubordinate(map);
        return RespBodyObj.ok(result);
    }

    /**
     * 查询河流的投诉事件列表
     * @author chenhonggang
     * @param params 起始时间  河流编号
     * @return
     */
    @PostMapping("queryByRiver")
    @SysLog(value="查询",actionType="4")
    public RespBodyObj<List<PatrolProblem>> queryByRiver(@RequestBody ReqBodyObj<Map<String,Object>> params){
        Map<String,Object> map = params.getData();
        List<PatrolProblem> reuslt = complaintsStatisticsService.queryListByRiver(map);
        return RespBodyObj.ok(reuslt);
    }

    /**
     * 查询河流的投诉事件列表
     * @author chenhonggang
     * @param params 起始时间  区域编号
     * @return
     */
    @PostMapping("problemTotalOfArea")
    @SysLog(value="查询",actionType="4")
    public RespBodyObj<List<ProblemStatistical>> problemTotalOfArea(@RequestBody ReqBodyObj<Map<String,Object>> params){
        Map<String,Object> map = params.getData();
        try {
            List<ProblemStatistical> reuslt = complaintsStatisticsService.problemTotalOfArea(map);
            return RespBodyObj.ok(reuslt);
        }catch (Exception e){
            e.printStackTrace();
            return RespBodyObj.error("请求失败,日期格式问题");
        }
    }

    /** 根据行政区划编号获取投诉信息表列表 */
    @PostMapping("listByDivision")
    @SysLog(value="查询列表",actionType="4")
    public RespBodyObj<List<Complaint>> listByDivision(@RequestBody ReqBodyObj<Map<String,Object>> params){
        Map<String,Object> map = params.getData();
        try {
            List<Complaint> complaintList = complaintsStatisticsService.getComplainListByDivisionNo(map);
            return RespBodyObj.ok(complaintList);
        }catch (Exception e){
            e.printStackTrace();
            return RespBodyObj.error("请求失败!");
        }
    }

    /** 根据河流编号获取投诉信息列表 */
    @PostMapping("listByRiver")
    @SysLog(value="查询列表",actionType="4")
    public RespBodyObj<List<Complaint>> listByRiver(@RequestBody ReqBodyObj<Map<String,Object>> params){
        Map<String,Object> map = params.getData();
        try {
            List<Complaint> complaintList = complaintsStatisticsService.getComplainListByRiverNo(map);
            return RespBodyObj.ok(complaintList);
        }catch (Exception e){
            e.printStackTrace();
            return RespBodyObj.error("请求失败!");
        }
    }
}