WebIndexController.java 7.66 KB
package com.lhcredit.project.webbusiness.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.lhcredit.framework.aspectj.lang.annotation.CheckToken;
import com.lhcredit.framework.web.domain.AjaxResult;
import com.lhcredit.project.business.BasicInformation.service.BasicInformationService;
import com.lhcredit.project.business.TianYC.entity.param.RequestParams;
import com.lhcredit.project.business.judicial.service.JudicialService;
import com.lhcredit.project.business.jycount.domain.Jycount;
import com.lhcredit.project.business.jycount.service.IJycountService;
import com.lhcredit.project.business.memberUnit.service.IMemberUnitService;
import com.lhcredit.project.business.organization.domain.Organization;
import com.lhcredit.project.business.organization.service.IOrganizationService;
import com.lhcredit.project.business.sfcount.domain.Sfcount;
import com.lhcredit.project.business.sfcount.service.ISfcountService;
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.*;
import java.util.stream.Collectors;

@Controller
@RequestMapping("/web/index")
public class WebIndexController {
    @Autowired
    IMemberUnitService memberUnitService;

    @Autowired
    IOrganizationService organizationService;

    @Autowired
    BasicInformationService basicInformationService;

    @Autowired
    private JudicialService judicialService;

    @Autowired
    private ISfcountService sfcountService;

    @Autowired
    private IJycountService jycountService;

    @RequestMapping("/baseinfo")
    @ResponseBody
    @CheckToken
    public AjaxResult baseinfo() {
        Map respData = new HashMap();
        List<Map> listLevel= organizationService.selectAllOrganizationGroupLevel();
        if(!listLevel.contains("D")){
            Map resp = new HashMap();
            resp.put("creditLevel","D");
            resp.put("count",0);
            listLevel.add(resp);
        }
        respData.put("level",listLevel);

        List<Map> listreg = organizationService.selectAllOrganizationGroupReg();
        respData.put("registCapi",listreg);

        List<Map> listOrgType=organizationService.selectAllOrganizationGroupOrgTyp();
        respData.put("orgType",listOrgType);

        List<Map> listScopeType=organizationService.selectAllOrganizationGroupScopeTyp();
        respData.put("scopeType",listScopeType);

        int orgCount=organizationService.selectAllOrganizationCount();
        respData.put("orgCount",orgCount);
        int memberCount=memberUnitService.selectMemberUnitCount();
        respData.put("memberCount",memberCount);

        return AjaxResult.success(respData);
    }

    @RequestMapping("/getJudiciary")
    @ResponseBody
    @CheckToken
    public AjaxResult getJudiciary() {
        Map respData = new HashMap();
        Sfcount sf=new Sfcount();
        sf.setStatus("0");
        List<Sfcount> list=sfcountService.selectSfcountList(sf);
        Map oneMap=new HashMap();
        Map twoMap=new HashMap();
        Map threeMap=new HashMap();
        Map fourMap=new HashMap();
        int count=0;

        for(Sfcount sfcount:list){
            count+=sfcount.getMs()+sfcount.getXs()+sfcount.getXz()+sfcount.getFsbq()+sfcount.getZx()+sfcount.getPc();


            oneMap.put("民事案件",sfcount.getMs());
            oneMap.put("刑事案件",sfcount.getXs());
            oneMap.put("行政案件",sfcount.getXz());
            oneMap.put("非诉保全案件",sfcount.getFsbq());
            oneMap.put("执行案件",sfcount.getZx());
            oneMap.put("破产案件",sfcount.getPc());

            twoMap.put("已结案",sfcount.getYja());
            twoMap.put("未结案",sfcount.getWja());

            threeMap.put("原告",sfcount.getYg());
            threeMap.put("被告",sfcount.getBg());
            threeMap.put("第三人",sfcount.getDsr());
            String ay=sfcount.getAy();
            Map<String,Integer> map = JSON.parseObject(ay, Map.class);
            if(map.size()>0){
                map.remove("未知");
            }
            List<Map.Entry<String, Integer>> listMap = new LinkedList<>(map.entrySet());
            Collections.sort(listMap,new Comparator<Map.Entry<String,Integer>>() {
                public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                    return o2.getValue()-o1.getValue();
                }
            });
            if(listMap.size()>10){
                List<Map.Entry<String, Integer>> newList=new LinkedList<>();
                for(int i=0;i<=9;i++){
                    newList.add(listMap.get(i));
                }
                fourMap.put("案由",newList);
            }else {
                fourMap.put("案由",listMap);
            }

        }
        respData.put("sfNum",count);
        respData.put("one",oneMap);
        respData.put("two",twoMap);
        respData.put("three",threeMap);
        respData.put("four",fourMap);

//        respData.put("SfcountList",list);

        return AjaxResult.success(respData);
    }

    @RequestMapping("/getOperate")
    @ResponseBody
    @CheckToken
    public AjaxResult getOperate() {
        Map respData = new HashMap();
        Jycount jy=new Jycount();
        jy.setStatus("0");
        List<Jycount> list=jycountService.selectJycountList(jy);
        int count=0;
        for(Jycount jycount:list){
            count+=jycount.getJyyc()+jycount.getXzcf()+jycount.getYzwf()+jycount.getGqcz()+jycount.getGqdj()+jycount.getQsgg()+jycount.getQsxx()+jycount.getDcdy()+jycount.getTddy()+jycount.getCcjc();
            respData.put("经营异常",jycount.getJyyc());
            respData.put("行政处罚",jycount.getXzcf());
            respData.put("严重违法",jycount.getYzwf());
            respData.put("股权出质",jycount.getGqcz());
            respData.put("股权冻结",jycount.getGqdj());
            respData.put("欠税公告",jycount.getQsgg());
            respData.put("清算信息",jycount.getQsxx());
            respData.put("动产抵押",jycount.getDcdy());
            respData.put("土地质押",jycount.getTddy());
            respData.put("抽查检查",jycount.getCcjc());
        }
        respData.put("jyNum",count);

        return AjaxResult.success(respData);
    }

    public static void main(String[] args) throws Exception {
        String str="{\"合同、准合同纠纷\":984,\"知识产权与竞争纠纷\":84,\"人格权纠纷\":24,\"物权纠纷\":54,\"商标行政管理(商标)\":2,\"水利行政管理(水利)\":2,\"侵权责任纠纷\":58,\"教育行政管理(教育)\":4,\"专利行政管理(专利)\":24,\"行政非诉执行\":2,\"债权纠纷\":2,\"乡政府\":2,\"劳动和社会保障行政管理(劳动、社会保障)\":12,\"其他行政管理\":18,\"其他案由\":8,\"未知\":596,\"民事\":470,\"劳动争议、人事争议\":120,\"与公司、证券、保险、票据等有关的民事纠纷\":6,\"非讼程序案件案由\":60}";
        Map<String,Integer> map = JSON.parseObject(str, Map.class);
        if(map.size()>0){
            map.remove("未知");
        }
        List<Map.Entry<String, Integer>> list = new LinkedList<>(map.entrySet());
        Collections.sort(list,new Comparator<Map.Entry<String,Integer>>() {
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                return o2.getValue()-o1.getValue();
            }
        });

        List<Map.Entry<String, Integer>> newList=new LinkedList<>();
        for(int i=0;i<10;i++){
            newList.add(list.get(i));
        }
        System.out.println(newList);
    }

}