package cn.com.tenlion.systembase.controller.testdata;

import cn.com.tenlion.systembase.pojo.dtos.testdata.*;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
import ink.wgink.mongo.module.dictionary.service.IMongoAreaService;
import ink.wgink.pojo.result.ErrorResult;
import io.swagger.annotations.*;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "综治中心接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/testdata")
public class TestDataCreatController {

    @Autowired
    private IMongoAreaService mongoAreaService;

    @ApiOperation(value = "综治中心详情", notes = "综治中心详情接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "comprehensiveCenterId", value = "综治中心ID", paramType = "path")
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("get")
    public List<AreaDTO> get() {
        List<AreaDTO> areaDTOList = new ArrayList<>();
        areaDTOList = getArea("110889", areaDTOList);
        List<TestDataDTO> testDataDTOS = new ArrayList<>();
        List<HouseDataDTO> houseDataDTOS = new ArrayList<>();
        List<HouseTypeDataDTO> houseTypeDataDTOS = new ArrayList<>();
        List<AreaHouseDataDTO> areaHouseDataDTOS = new ArrayList<>();
        for(AreaDTO areaDTO : areaDTOList) {
            List<AreaDTO> subAreaList1 = areaDTO.getSubArea();
            List<TestDataDTO> testDataDTOS1 = new ArrayList<>();
            List<HouseDataDTO> houseDataDTOS1 = new ArrayList<>();
            List<HouseTypeDataDTO> houseTypeDataDTOS1 = new ArrayList<>();
            List<AreaHouseDataDTO> areaHouseDataDTOS1 = new ArrayList<>();
            if(null != subAreaList1 && subAreaList1.size() > 0) {
                for (AreaDTO areaDTO1 : subAreaList1) {
                    List<AreaDTO> subAreaList2 = areaDTO1.getSubArea();
                    List<TestDataDTO> testDataDTOS2 = new ArrayList<>();
                    List<HouseDataDTO> houseDataDTOS2 = new ArrayList<>();
                    List<HouseTypeDataDTO> houseTypeDataDTOS2 = new ArrayList<>();
                    List<AreaHouseDataDTO> areaHouseDataDTOS2 = new ArrayList<>();
                    if(null != subAreaList2 && subAreaList2.size() > 0) {
                        for (AreaDTO areaDTO2 : subAreaList2) {
                            // 出租房数量
                            int czfSl = getRandomInt(0, 30);
                            // 总房屋数量
                            int fwsl = getRandomInt(500, 1200);
                            TestDataDTO testDataDTO = new TestDataDTO();
                            testDataDTO.setDqmc(areaDTO2.getAreaName());
                            testDataDTO.setDqbm(areaDTO2.getAreaCode());
                            testDataDTO.setDqjb(areaDTO2.getAreaLevel());
                            testDataDTO.setCzwzb(zhanbi(czfSl, fwsl));
                            testDataDTO.setCzwzs("" + czfSl);
                            testDataDTOS2.add(testDataDTO);

                            HouseDataDTO houseDataDTO = new HouseDataDTO();
                            houseDataDTO.setDjzf("" + fwsl);
                            houseDataDTO.setDqmc(areaDTO2.getAreaName());
                            houseDataDTO.setDqbm(areaDTO2.getAreaCode());
                            houseDataDTO.setDqjb(areaDTO2.getAreaLevel());
                            houseDataDTOS2.add(houseDataDTO);

                            String[] houseType = getHouseType();
                            for(String s: houseType) {
                                int sl = getRandomInt(0, 300);
                                HouseTypeDataDTO houseTypeDataDTO = new HouseTypeDataDTO();
                                houseTypeDataDTO.setDqmc(areaDTO2.getAreaName());
                                houseTypeDataDTO.setDqbm(areaDTO2.getAreaCode());
                                houseTypeDataDTO.setDqjb(areaDTO2.getAreaLevel());
                                houseTypeDataDTO.setTjlx(s);
                                houseTypeDataDTO.setZs("" + sl);
                                houseTypeDataDTOS2.add(houseTypeDataDTO);
                            }

                            AreaHouseDataDTO areaHouseDataDTO = new AreaHouseDataDTO();
                            areaHouseDataDTO.setDqmc(areaDTO2.getAreaName());
                            areaHouseDataDTO.setDqbm(areaDTO2.getAreaCode());
                            areaHouseDataDTO.setDqjb(areaDTO2.getAreaLevel());
                            areaHouseDataDTO.setFwzl("" + fwsl);
                            areaHouseDataDTOS2.add(areaHouseDataDTO);
                        }
                    }

                    int czfSl = getRandomInt(0, 30);
                    int levelCount = getRandomInt(0, 5000);
                    for(TestDataDTO testDataDTO: testDataDTOS2) {
                       czfSl += Integer.valueOf(testDataDTO.getCzwzs());
                    }
                    for(HouseDataDTO houseDataDTO: houseDataDTOS2) {
                        levelCount += Integer.valueOf(houseDataDTO.getDjzf());
                    }
                    int zzSl = getRandomInt(2000, 3500);
                    int hzSl = getRandomInt(0, 500);
                    int xzSl = getRandomInt(0, 50);
                    int dcSl = getRandomInt(0, 50);
                    for(HouseTypeDataDTO houseTypeDataDTO: houseTypeDataDTOS2) {
                        if(houseTypeDataDTO.getTjlx().equals("zz")) {
                            zzSl += Integer.valueOf(houseTypeDataDTO.getZs());
                        }
                        if(houseTypeDataDTO.getTjlx().equals("hz")) {
                            hzSl += Integer.valueOf(houseTypeDataDTO.getZs());
                        }
                        if(houseTypeDataDTO.getTjlx().equals("xz")) {
                            xzSl += Integer.valueOf(houseTypeDataDTO.getZs());
                        }
                        if(houseTypeDataDTO.getTjlx().equals("dc")) {
                            dcSl += Integer.valueOf(houseTypeDataDTO.getZs());
                        }
                    }
                    TestDataDTO testDataDTO = new TestDataDTO();
                    testDataDTO.setDqmc(areaDTO1.getAreaName());
                    testDataDTO.setDqbm(areaDTO1.getAreaCode());
                    testDataDTO.setDqjb(areaDTO1.getAreaLevel());
                    testDataDTO.setCzwzb(zhanbi(czfSl, levelCount));
                    testDataDTO.setCzwzs("" + czfSl);
                    testDataDTOS1.add(testDataDTO);

                    HouseDataDTO houseDataDTO = new HouseDataDTO();
                    houseDataDTO.setDjzf("" + levelCount);
                    houseDataDTO.setDqmc(areaDTO1.getAreaName());
                    houseDataDTO.setDqbm(areaDTO1.getAreaCode());
                    houseDataDTO.setDqjb(areaDTO1.getAreaLevel());
                    houseDataDTOS1.add(houseDataDTO);

                    String[] houseType = getHouseType();
                    for(String s: houseType) {
                        HouseTypeDataDTO houseTypeDataDTO = new HouseTypeDataDTO();
                        houseTypeDataDTO.setDqmc(areaDTO1.getAreaName());
                        houseTypeDataDTO.setDqbm(areaDTO1.getAreaCode());
                        houseTypeDataDTO.setDqjb(areaDTO1.getAreaLevel());
                        houseTypeDataDTO.setTjlx(s);
                        if(s.equals("zz")) {
                            houseTypeDataDTO.setZs("" + zzSl);
                        }
                        if(s.equals("hz")) {
                            houseTypeDataDTO.setZs("" + hzSl);
                        }
                        if(s.equals("xz")) {
                            houseTypeDataDTO.setZs("" + xzSl);
                        }
                        if(s.equals("dc")) {
                            houseTypeDataDTO.setZs("" + dcSl);
                        }
                        houseTypeDataDTOS1.add(houseTypeDataDTO);
                    }
                    AreaHouseDataDTO areaHouseDataDTO = new AreaHouseDataDTO();
                    areaHouseDataDTO.setDqmc(areaDTO1.getAreaName());
                    areaHouseDataDTO.setDqbm(areaDTO1.getAreaCode());
                    areaHouseDataDTO.setDqjb(areaDTO1.getAreaLevel());
                    areaHouseDataDTO.setFwzl("" + levelCount);
                    areaHouseDataDTOS1.add(areaHouseDataDTO);

                    testDataDTOS.addAll(testDataDTOS2);
                    houseDataDTOS.addAll(houseDataDTOS2);
                    houseTypeDataDTOS.addAll(houseTypeDataDTOS2);
                    areaHouseDataDTOS.addAll(areaHouseDataDTOS2);
                    testDataDTOS2 = new ArrayList<>();
                    houseDataDTOS2 = new ArrayList<>();
                    houseTypeDataDTOS2 = new ArrayList<>();
                    areaHouseDataDTOS2 = new ArrayList<>();
                }
            }
            int czfSl = getRandomInt(0, 30);
            int levelCount = getRandomInt(0, 5000);
            for(TestDataDTO testDataDTO: testDataDTOS1) {
                czfSl += Integer.valueOf(testDataDTO.getCzwzs());
            }
            for(HouseDataDTO houseDataDTO: houseDataDTOS1) {
                levelCount += Integer.valueOf(houseDataDTO.getDjzf());
            }
            int zzSl = getRandomInt(2000, 3500);
            int hzSl = getRandomInt(0, 500);
            int xzSl = getRandomInt(0, 50);
            int dcSl = getRandomInt(0, 50);
            for(HouseTypeDataDTO houseTypeDataDTO: houseTypeDataDTOS1) {
                if(houseTypeDataDTO.getTjlx().equals("zz")) {
                    zzSl += Integer.valueOf(houseTypeDataDTO.getZs());
                }
                if(houseTypeDataDTO.getTjlx().equals("hz")) {
                    hzSl += Integer.valueOf(houseTypeDataDTO.getZs());
                }
                if(houseTypeDataDTO.getTjlx().equals("xz")) {
                    xzSl += Integer.valueOf(houseTypeDataDTO.getZs());
                }
                if(houseTypeDataDTO.getTjlx().equals("dc")) {
                    dcSl += Integer.valueOf(houseTypeDataDTO.getZs());
                }
            }
            TestDataDTO testDataDTO = new TestDataDTO();
            testDataDTO.setDqmc(areaDTO.getAreaName());
            testDataDTO.setDqbm(areaDTO.getAreaCode());
            testDataDTO.setDqjb(areaDTO.getAreaLevel());
            testDataDTO.setCzwzb(zhanbi(czfSl, levelCount));
            testDataDTO.setCzwzs("" + czfSl);
            testDataDTOS.add(testDataDTO);

            HouseDataDTO houseDataDTO = new HouseDataDTO();
            houseDataDTO.setDjzf("" + levelCount);
            houseDataDTO.setDqmc(areaDTO.getAreaName());
            houseDataDTO.setDqbm(areaDTO.getAreaCode());
            houseDataDTO.setDqjb(areaDTO.getAreaLevel());
            houseDataDTOS.add(houseDataDTO);

            String[] houseType = getHouseType();
            for(String s: houseType) {
                HouseTypeDataDTO houseTypeDataDTO = new HouseTypeDataDTO();
                houseTypeDataDTO.setDqmc(areaDTO.getAreaName());
                houseTypeDataDTO.setDqbm(areaDTO.getAreaCode());
                houseTypeDataDTO.setDqjb(areaDTO.getAreaLevel());
                houseTypeDataDTO.setTjlx(s);
                if(s.equals("zz")) {
                    houseTypeDataDTO.setZs("" + zzSl);
                }
                if(s.equals("hz")) {
                    houseTypeDataDTO.setZs("" + hzSl);
                }
                if(s.equals("xz")) {
                    houseTypeDataDTO.setZs("" + xzSl);
                }
                if(s.equals("dc")) {
                    houseTypeDataDTO.setZs("" + dcSl);
                }
                houseTypeDataDTOS.add(houseTypeDataDTO);
            }
            AreaHouseDataDTO areaHouseDataDTO = new AreaHouseDataDTO();
            areaHouseDataDTO.setDqmc(areaDTO.getAreaName());
            areaHouseDataDTO.setDqbm(areaDTO.getAreaCode());
            areaHouseDataDTO.setDqjb(areaDTO.getAreaLevel());
            areaHouseDataDTO.setFwzl("" + levelCount);
            areaHouseDataDTOS.add(areaHouseDataDTO);

            testDataDTOS.addAll(testDataDTOS1);
            houseDataDTOS.addAll(houseDataDTOS1);
            houseTypeDataDTOS.addAll(houseTypeDataDTOS1);
            areaHouseDataDTOS.addAll(areaHouseDataDTOS1);

            testDataDTOS1 = new ArrayList<>();
            houseDataDTOS1 = new ArrayList<>();
            houseTypeDataDTOS1 = new ArrayList<>();
            areaHouseDataDTOS1 = new ArrayList<>();
        }
        setFile(testDataDTOS, houseDataDTOS, houseTypeDataDTOS, areaHouseDataDTOS);
        return areaDTOList;
    }

    @ApiOperation(value = "房屋类型占比", notes = "综治中心详情接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "comprehensiveCenterId", value = "综治中心ID", paramType = "path")
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("getkeyplace")
    public List<AreaDTO> getkeyplace() {
        List<AreaDTO> areaDTOList = new ArrayList<>();
        areaDTOList = getArea("110889", areaDTOList);
        List<KeyPlaceDataDTO> keyAreaDTOS = new ArrayList<>();
        List<KeyPlaceMonthDTO> keyAreaMonthDTOS = new ArrayList<>();
        for(AreaDTO areaDTO : areaDTOList) {
            List<AreaDTO> subAreaList1 = areaDTO.getSubArea();
            List<KeyPlaceDataDTO> keyAreaDTOS1 = new ArrayList<>();
            List<KeyPlaceMonthDTO> keyAreaMonthDTOS1 = new ArrayList<>();

            if(null != subAreaList1 && subAreaList1.size() > 0) {
                for (AreaDTO areaDTO1 : subAreaList1) {
                    List<AreaDTO> subAreaList2 = areaDTO1.getSubArea();
                    List<KeyPlaceDataDTO> keyAreaDTOS2 = new ArrayList<>();
                    List<KeyPlaceMonthDTO> keyAreaMonthDTOS2 = new ArrayList<>();

                    if(null != subAreaList2 && subAreaList2.size() > 0) {
                        for (AreaDTO areaDTO2 : subAreaList2) {
                            KeyPlaceDataDTO keyAreaDTO = new KeyPlaceDataDTO();
                            keyAreaDTO.setDqmc(areaDTO2.getAreaName());
                            keyAreaDTO.setDqbm(areaDTO2.getAreaCode());
                            keyAreaDTO.setDqjb(areaDTO2.getAreaLevel());
                            int aa = getRandomInt(0, 20);
                            keyAreaDTO.setZdcszs(String.valueOf(aa));
                            int bb = getRandomInt(0, 30);
                            keyAreaDTO.setXczs(String.valueOf(bb));
                            int cc = getRandomInt(0, 50);
                            int dd = getRandomInt(10, 90);
                            keyAreaDTO.setXczs_hb(String.valueOf(cc) + "." + String.valueOf(dd));
                            int ee = getRandomInt(0, 50);
                            int ff = getRandomInt(10, 90);
                            keyAreaDTO.setXczs_tb(String.valueOf(ee) + "." + String.valueOf(ff));
                            keyAreaDTOS2.add(keyAreaDTO);

                            String[] yearArr = getyear();
                            String[] tjlxArr = getTjlx();
                            for(int i=0;i<yearArr.length;i++) {
                                for(int j=0;j<tjlxArr.length;j++) {
                                    KeyPlaceMonthDTO keyAreaMonthDTO = new KeyPlaceMonthDTO();
                                    keyAreaMonthDTO.setDqmc(areaDTO2.getAreaName());
                                    keyAreaMonthDTO.setDqbm(areaDTO2.getAreaCode());
                                    keyAreaMonthDTO.setDqjb(areaDTO2.getAreaLevel());
                                    keyAreaMonthDTO.setNd(yearArr[i]);
                                    keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                                    if(tjlxArr[j].equals("zs")) {
                                        keyAreaMonthDTO.setM1(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM2(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM3(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM4(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM5(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM6(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM7(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM8(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM9(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM10(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM11(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM12(String.valueOf(getRandomInt(0, 5)));
                                    }else {
                                        keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                                    }
                                    keyAreaMonthDTOS2.add(keyAreaMonthDTO);
                                }
                            }
                        }
                    }

                    int keyPlaceCount = getRandomInt(0, 30);
                    int keyPlacePatrolCount = getRandomInt(0, 30);
                    for(KeyPlaceDataDTO keyPlaceDataDTO: keyAreaDTOS2) {
                        keyPlaceCount += Integer.valueOf(keyPlaceDataDTO.getZdcszs());
                        keyPlacePatrolCount += Integer.valueOf(keyPlaceDataDTO.getXczs());
                    }
                    int zsCount1_19 = getRandomInt(0, 5);
                    int zsCount2_19 = getRandomInt(0, 5);
                    int zsCount3_19 = getRandomInt(0, 5);
                    int zsCount4_19 = getRandomInt(0, 5);
                    int zsCount5_19 = getRandomInt(0, 5);
                    int zsCount6_19 = getRandomInt(0, 5);
                    int zsCount7_19 = getRandomInt(0, 5);
                    int zsCount8_19 = getRandomInt(0, 5);
                    int zsCount9_19 = getRandomInt(0, 5);
                    int zsCount10_19 = getRandomInt(0, 5);
                    int zsCount11_19 = getRandomInt(0, 5);
                    int zsCount12_19 = getRandomInt(0, 5);

                    int zsCount1_20 = getRandomInt(0, 5);
                    int zsCount2_20 = getRandomInt(0, 5);
                    int zsCount3_20 = getRandomInt(0, 5);
                    int zsCount4_20 = getRandomInt(0, 5);
                    int zsCount5_20 = getRandomInt(0, 5);
                    int zsCount6_20 = getRandomInt(0, 5);
                    int zsCount7_20 = getRandomInt(0, 5);
                    int zsCount8_20 = getRandomInt(0, 5);
                    int zsCount9_20 = getRandomInt(0, 5);
                    int zsCount10_20 = getRandomInt(0, 5);
                    int zsCount11_20 = getRandomInt(0, 5);
                    int zsCount12_20 = getRandomInt(0, 5);

                    int zsCount1_21 = getRandomInt(0, 5);
                    int zsCount2_21 = getRandomInt(0, 5);
                    int zsCount3_21 = getRandomInt(0, 5);
                    int zsCount4_21 = getRandomInt(0, 5);
                    int zsCount5_21 = getRandomInt(0, 5);
                    int zsCount6_21 = getRandomInt(0, 5);
                    int zsCount7_21 = getRandomInt(0, 5);
                    int zsCount8_21 = getRandomInt(0, 5);
                    int zsCount9_21 = getRandomInt(0, 5);
                    int zsCount10_21 = getRandomInt(0, 5);
                    int zsCount11_21 = getRandomInt(0, 5);
                    int zsCount12_21 = getRandomInt(0, 5);
                    for(KeyPlaceMonthDTO keyPlaceMonthDTO: keyAreaMonthDTOS2) {
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2019".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_19  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_19  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_19  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_19  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_19  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_19  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_19  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_19  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_19  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_19 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_19 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_19 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2020".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_20  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_20  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_20  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_20  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_20  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_20  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_20  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_20  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_20  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_20 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_20 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_20 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2021".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_21  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_21  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_21  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_21  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_21  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_21  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_21  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_21  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_21  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_21 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_21 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_21 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                    }
                    KeyPlaceDataDTO keyAreaDTO = new KeyPlaceDataDTO();
                    keyAreaDTO.setDqmc(areaDTO1.getAreaName());
                    keyAreaDTO.setDqbm(areaDTO1.getAreaCode());
                    keyAreaDTO.setDqjb(areaDTO1.getAreaLevel());
                    keyAreaDTO.setZdcszs(String.valueOf(keyPlaceCount));
                    keyAreaDTO.setXczs(String.valueOf(keyPlacePatrolCount));
                    int cc = getRandomInt(0, 50);
                    int dd = getRandomInt(10, 90);
                    keyAreaDTO.setXczs_hb(String.valueOf(cc) + "." + String.valueOf(dd));
                    int ee = getRandomInt(0, 50);
                    int ff = getRandomInt(10, 90);
                    keyAreaDTO.setXczs_tb(String.valueOf(ee) + "." + String.valueOf(ff));
                    keyAreaDTOS1.add(keyAreaDTO);

                    String[] yearArr = getyear();
                    String[] tjlxArr = getTjlx();
                    for(int i=0;i<yearArr.length;i++) {
                        for(int j=0;j<tjlxArr.length;j++) {
                            KeyPlaceMonthDTO keyAreaMonthDTO = new KeyPlaceMonthDTO();
                            keyAreaMonthDTO.setDqmc(areaDTO1.getAreaName());
                            keyAreaMonthDTO.setDqbm(areaDTO1.getAreaCode());
                            keyAreaMonthDTO.setDqjb(areaDTO1.getAreaLevel());
                            keyAreaMonthDTO.setNd(yearArr[i]);
                            keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                            if(tjlxArr[j].equals("zs")) {
                                if("2019".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_19));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_19));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_19));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_19));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_19));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_19));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_19));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_19));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_19));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_19));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_19));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_19));
                                }else if("2020".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_20));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_20));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_20));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_20));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_20));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_20));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_20));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_20));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_20));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_20));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_20));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_20));
                                }else if("2021".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_21));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_21));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_21));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_21));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_21));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_21));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_21));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_21));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_21));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_21));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_21));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_21));
                                }
                            }else {
                                keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                            }
                            keyAreaMonthDTOS1.add(keyAreaMonthDTO);
                        }
                    }
                    keyAreaDTOS.addAll(keyAreaDTOS2);
                    keyAreaMonthDTOS.addAll(keyAreaMonthDTOS2);
                    keyAreaDTOS2 = new ArrayList<>();
                    keyAreaMonthDTOS2 = new ArrayList<>();
                }
            }

            int keyPlaceCount = getRandomInt(0, 30);
            int keyPlacePatrolCount = getRandomInt(0, 30);
            for(KeyPlaceDataDTO keyPlaceDataDTO: keyAreaDTOS1) {
                keyPlaceCount += Integer.valueOf(keyPlaceDataDTO.getZdcszs());
                keyPlacePatrolCount += Integer.valueOf(keyPlaceDataDTO.getXczs());
            }
            int zsCount1_19 = getRandomInt(0, 5);
            int zsCount2_19 = getRandomInt(0, 5);
            int zsCount3_19 = getRandomInt(0, 5);
            int zsCount4_19 = getRandomInt(0, 5);
            int zsCount5_19 = getRandomInt(0, 5);
            int zsCount6_19 = getRandomInt(0, 5);
            int zsCount7_19 = getRandomInt(0, 5);
            int zsCount8_19 = getRandomInt(0, 5);
            int zsCount9_19 = getRandomInt(0, 5);
            int zsCount10_19 = getRandomInt(0, 5);
            int zsCount11_19 = getRandomInt(0, 5);
            int zsCount12_19 = getRandomInt(0, 5);

            int zsCount1_20 = getRandomInt(0, 5);
            int zsCount2_20 = getRandomInt(0, 5);
            int zsCount3_20 = getRandomInt(0, 5);
            int zsCount4_20 = getRandomInt(0, 5);
            int zsCount5_20 = getRandomInt(0, 5);
            int zsCount6_20 = getRandomInt(0, 5);
            int zsCount7_20 = getRandomInt(0, 5);
            int zsCount8_20 = getRandomInt(0, 5);
            int zsCount9_20 = getRandomInt(0, 5);
            int zsCount10_20 = getRandomInt(0, 5);
            int zsCount11_20 = getRandomInt(0, 5);
            int zsCount12_20 = getRandomInt(0, 5);

            int zsCount1_21 = getRandomInt(0, 5);
            int zsCount2_21 = getRandomInt(0, 5);
            int zsCount3_21 = getRandomInt(0, 5);
            int zsCount4_21 = getRandomInt(0, 5);
            int zsCount5_21 = getRandomInt(0, 5);
            int zsCount6_21 = getRandomInt(0, 5);
            int zsCount7_21 = getRandomInt(0, 5);
            int zsCount8_21 = getRandomInt(0, 5);
            int zsCount9_21 = getRandomInt(0, 5);
            int zsCount10_21 = getRandomInt(0, 5);
            int zsCount11_21 = getRandomInt(0, 5);
            int zsCount12_21 = getRandomInt(0, 5);
            for(KeyPlaceMonthDTO keyPlaceMonthDTO: keyAreaMonthDTOS1) {
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2019".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_19  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_19  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_19  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_19  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_19  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_19  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_19  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_19  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_19  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_19 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_19 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_19 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2020".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_20  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_20  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_20  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_20  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_20  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_20  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_20  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_20  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_20  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_20 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_20 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_20 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2021".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_21  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_21  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_21  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_21  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_21  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_21  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_21  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_21  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_21  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_21 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_21 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_21 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
            }
            KeyPlaceDataDTO keyAreaDTO = new KeyPlaceDataDTO();
            keyAreaDTO.setDqmc(areaDTO.getAreaName());
            keyAreaDTO.setDqbm(areaDTO.getAreaCode());
            keyAreaDTO.setDqjb(areaDTO.getAreaLevel());
            keyAreaDTO.setZdcszs(String.valueOf(keyPlaceCount));
            keyAreaDTO.setXczs(String.valueOf(keyPlacePatrolCount));
            int cc = getRandomInt(0, 50);
            int dd = getRandomInt(10, 90);
            keyAreaDTO.setXczs_hb(String.valueOf(cc) + "." + String.valueOf(dd));
            int ee = getRandomInt(0, 50);
            int ff = getRandomInt(10, 90);
            keyAreaDTO.setXczs_tb(String.valueOf(ee) + "." + String.valueOf(ff));
            keyAreaDTOS.add(keyAreaDTO);

            String[] yearArr = getyear();
            String[] tjlxArr = getTjlx();
            for(int i=0;i<yearArr.length;i++) {
                for(int j=0;j<tjlxArr.length;j++) {
                    KeyPlaceMonthDTO keyAreaMonthDTO = new KeyPlaceMonthDTO();
                    keyAreaMonthDTO.setDqmc(areaDTO.getAreaName());
                    keyAreaMonthDTO.setDqbm(areaDTO.getAreaCode());
                    keyAreaMonthDTO.setDqjb(areaDTO.getAreaLevel());
                    keyAreaMonthDTO.setNd(yearArr[i]);
                    keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                    if(tjlxArr[j].equals("zs")) {
                        if("2019".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_19));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_19));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_19));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_19));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_19));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_19));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_19));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_19));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_19));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_19));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_19));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_19));
                        }else if("2020".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_20));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_20));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_20));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_20));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_20));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_20));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_20));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_20));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_20));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_20));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_20));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_20));
                        }else if("2021".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_21));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_21));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_21));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_21));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_21));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_21));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_21));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_21));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_21));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_21));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_21));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_21));
                        }
                    }else {
                        keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                    }
                    keyAreaMonthDTOS.add(keyAreaMonthDTO);
                }
            }
            keyAreaDTOS.addAll(keyAreaDTOS1);
            keyAreaMonthDTOS.addAll(keyAreaMonthDTOS1);
            keyAreaDTOS1 = new ArrayList<>();
            keyAreaMonthDTOS1 = new ArrayList<>();
        }
        setFileKeyPlace(keyAreaDTOS, keyAreaMonthDTOS);
        return areaDTOList;
    }

    @ApiOperation(value = "房屋类型占比", notes = "综治中心详情接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "comprehensiveCenterId", value = "综治中心ID", paramType = "path")
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("getkeyarea")
    public List<AreaDTO> getkeyarea() {
        List<AreaDTO> areaDTOList = new ArrayList<>();
        areaDTOList = getArea("110889", areaDTOList);
        List<KeyAreaDataDTO> keyAreaDTOS = new ArrayList<>();
        List<KeyAreaMonthDTO> keyAreaMonthDTOS = new ArrayList<>();
        for(AreaDTO areaDTO : areaDTOList) {
            List<AreaDTO> subAreaList1 = areaDTO.getSubArea();
            List<KeyAreaDataDTO> keyAreaDTOS1 = new ArrayList<>();
            List<KeyAreaMonthDTO> keyAreaMonthDTOS1 = new ArrayList<>();

            if(null != subAreaList1 && subAreaList1.size() > 0) {
                for (AreaDTO areaDTO1 : subAreaList1) {
                    List<AreaDTO> subAreaList2 = areaDTO1.getSubArea();
                    List<KeyAreaDataDTO> keyAreaDTOS2 = new ArrayList<>();
                    List<KeyAreaMonthDTO> keyAreaMonthDTOS2 = new ArrayList<>();

                    if(null != subAreaList2 && subAreaList2.size() > 0) {
                        for (AreaDTO areaDTO2 : subAreaList2) {
                            KeyAreaDataDTO keyAreaDTO = new KeyAreaDataDTO();
                            keyAreaDTO.setDqmc(areaDTO2.getAreaName());
                            keyAreaDTO.setDqbm(areaDTO2.getAreaCode());
                            keyAreaDTO.setDqjb(areaDTO2.getAreaLevel());
                            int aa = getRandomInt(0, 20);
                            keyAreaDTO.setZdqyzs(String.valueOf(aa));
                            int bb = getRandomInt(0, 30);
                            keyAreaDTO.setXczs(String.valueOf(bb));
                            int cc = getRandomInt(0, 50);
                            int dd = getRandomInt(10, 90);
                            keyAreaDTO.setXczs_hb(String.valueOf(cc) + "." + String.valueOf(dd));
                            int ee = getRandomInt(0, 50);
                            int ff = getRandomInt(10, 90);
                            keyAreaDTO.setXczs_tb(String.valueOf(ee) + "." + String.valueOf(ff));
                            keyAreaDTOS2.add(keyAreaDTO);

                            String[] yearArr = getyear();
                            String[] tjlxArr = getTjlx();
                            for(int i=0;i<yearArr.length;i++) {
                                for(int j=0;j<tjlxArr.length;j++) {
                                    KeyAreaMonthDTO keyAreaMonthDTO = new KeyAreaMonthDTO();
                                    keyAreaMonthDTO.setDqmc(areaDTO2.getAreaName());
                                    keyAreaMonthDTO.setDqbm(areaDTO2.getAreaCode());
                                    keyAreaMonthDTO.setDqjb(areaDTO2.getAreaLevel());
                                    keyAreaMonthDTO.setNd(yearArr[i]);
                                    keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                                    if(tjlxArr[j].equals("zs")) {
                                        keyAreaMonthDTO.setM1(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM2(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM3(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM4(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM5(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM6(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM7(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM8(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM9(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM10(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM11(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM12(String.valueOf(getRandomInt(0, 5)));
                                    }else {
                                        keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                                    }
                                    keyAreaMonthDTOS2.add(keyAreaMonthDTO);
                                }
                            }
                        }
                    }

                    int keyPlaceCount = getRandomInt(0, 30);
                    int keyPlacePatrolCount = getRandomInt(0, 30);
                    for(KeyAreaDataDTO keyPlaceDataDTO: keyAreaDTOS2) {
                        keyPlaceCount += Integer.valueOf(keyPlaceDataDTO.getZdqyzs());
                        keyPlacePatrolCount += Integer.valueOf(keyPlaceDataDTO.getXczs());
                    }
                    int zsCount1_19 = getRandomInt(0, 5);
                    int zsCount2_19 = getRandomInt(0, 5);
                    int zsCount3_19 = getRandomInt(0, 5);
                    int zsCount4_19 = getRandomInt(0, 5);
                    int zsCount5_19 = getRandomInt(0, 5);
                    int zsCount6_19 = getRandomInt(0, 5);
                    int zsCount7_19 = getRandomInt(0, 5);
                    int zsCount8_19 = getRandomInt(0, 5);
                    int zsCount9_19 = getRandomInt(0, 5);
                    int zsCount10_19 = getRandomInt(0, 5);
                    int zsCount11_19 = getRandomInt(0, 5);
                    int zsCount12_19 = getRandomInt(0, 5);

                    int zsCount1_20 = getRandomInt(0, 5);
                    int zsCount2_20 = getRandomInt(0, 5);
                    int zsCount3_20 = getRandomInt(0, 5);
                    int zsCount4_20 = getRandomInt(0, 5);
                    int zsCount5_20 = getRandomInt(0, 5);
                    int zsCount6_20 = getRandomInt(0, 5);
                    int zsCount7_20 = getRandomInt(0, 5);
                    int zsCount8_20 = getRandomInt(0, 5);
                    int zsCount9_20 = getRandomInt(0, 5);
                    int zsCount10_20 = getRandomInt(0, 5);
                    int zsCount11_20 = getRandomInt(0, 5);
                    int zsCount12_20 = getRandomInt(0, 5);

                    int zsCount1_21 = getRandomInt(0, 5);
                    int zsCount2_21 = getRandomInt(0, 5);
                    int zsCount3_21 = getRandomInt(0, 5);
                    int zsCount4_21 = getRandomInt(0, 5);
                    int zsCount5_21 = getRandomInt(0, 5);
                    int zsCount6_21 = getRandomInt(0, 5);
                    int zsCount7_21 = getRandomInt(0, 5);
                    int zsCount8_21 = getRandomInt(0, 5);
                    int zsCount9_21 = getRandomInt(0, 5);
                    int zsCount10_21 = getRandomInt(0, 5);
                    int zsCount11_21 = getRandomInt(0, 5);
                    int zsCount12_21 = getRandomInt(0, 5);
                    for(KeyAreaMonthDTO keyPlaceMonthDTO: keyAreaMonthDTOS2) {
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2019".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_19  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_19  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_19  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_19  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_19  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_19  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_19  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_19  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_19  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_19 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_19 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_19 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2020".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_20  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_20  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_20  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_20  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_20  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_20  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_20  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_20  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_20  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_20 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_20 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_20 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2021".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_21  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_21  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_21  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_21  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_21  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_21  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_21  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_21  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_21  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_21 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_21 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_21 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                    }
                    KeyAreaDataDTO keyAreaDTO = new KeyAreaDataDTO();
                    keyAreaDTO.setDqmc(areaDTO1.getAreaName());
                    keyAreaDTO.setDqbm(areaDTO1.getAreaCode());
                    keyAreaDTO.setDqjb(areaDTO1.getAreaLevel());
                    keyAreaDTO.setZdqyzs(String.valueOf(keyPlaceCount));
                    keyAreaDTO.setXczs(String.valueOf(keyPlacePatrolCount));
                    int cc = getRandomInt(0, 50);
                    int dd = getRandomInt(10, 90);
                    keyAreaDTO.setXczs_hb(String.valueOf(cc) + "." + String.valueOf(dd));
                    int ee = getRandomInt(0, 50);
                    int ff = getRandomInt(10, 90);
                    keyAreaDTO.setXczs_tb(String.valueOf(ee) + "." + String.valueOf(ff));
                    keyAreaDTOS1.add(keyAreaDTO);

                    String[] yearArr = getyear();
                    String[] tjlxArr = getTjlx();
                    for(int i=0;i<yearArr.length;i++) {
                        for(int j=0;j<tjlxArr.length;j++) {
                            KeyAreaMonthDTO keyAreaMonthDTO = new KeyAreaMonthDTO();
                            keyAreaMonthDTO.setDqmc(areaDTO1.getAreaName());
                            keyAreaMonthDTO.setDqbm(areaDTO1.getAreaCode());
                            keyAreaMonthDTO.setDqjb(areaDTO1.getAreaLevel());
                            keyAreaMonthDTO.setNd(yearArr[i]);
                            keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                            if(tjlxArr[j].equals("zs")) {
                                if("2019".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_19));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_19));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_19));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_19));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_19));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_19));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_19));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_19));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_19));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_19));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_19));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_19));
                                }else if("2020".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_20));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_20));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_20));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_20));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_20));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_20));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_20));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_20));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_20));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_20));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_20));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_20));
                                }else if("2021".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_21));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_21));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_21));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_21));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_21));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_21));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_21));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_21));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_21));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_21));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_21));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_21));
                                }
                            }else {
                                keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                            }
                            keyAreaMonthDTOS1.add(keyAreaMonthDTO);
                        }
                    }
                    keyAreaDTOS.addAll(keyAreaDTOS2);
                    keyAreaMonthDTOS.addAll(keyAreaMonthDTOS2);
                    keyAreaDTOS2 = new ArrayList<>();
                    keyAreaMonthDTOS2 = new ArrayList<>();
                }
            }

            int keyPlaceCount = getRandomInt(0, 30);
            int keyPlacePatrolCount = getRandomInt(0, 30);
            for(KeyAreaDataDTO keyPlaceDataDTO: keyAreaDTOS1) {
                keyPlaceCount += Integer.valueOf(keyPlaceDataDTO.getZdqyzs());
                keyPlacePatrolCount += Integer.valueOf(keyPlaceDataDTO.getXczs());
            }
            int zsCount1_19 = getRandomInt(0, 5);
            int zsCount2_19 = getRandomInt(0, 5);
            int zsCount3_19 = getRandomInt(0, 5);
            int zsCount4_19 = getRandomInt(0, 5);
            int zsCount5_19 = getRandomInt(0, 5);
            int zsCount6_19 = getRandomInt(0, 5);
            int zsCount7_19 = getRandomInt(0, 5);
            int zsCount8_19 = getRandomInt(0, 5);
            int zsCount9_19 = getRandomInt(0, 5);
            int zsCount10_19 = getRandomInt(0, 5);
            int zsCount11_19 = getRandomInt(0, 5);
            int zsCount12_19 = getRandomInt(0, 5);

            int zsCount1_20 = getRandomInt(0, 5);
            int zsCount2_20 = getRandomInt(0, 5);
            int zsCount3_20 = getRandomInt(0, 5);
            int zsCount4_20 = getRandomInt(0, 5);
            int zsCount5_20 = getRandomInt(0, 5);
            int zsCount6_20 = getRandomInt(0, 5);
            int zsCount7_20 = getRandomInt(0, 5);
            int zsCount8_20 = getRandomInt(0, 5);
            int zsCount9_20 = getRandomInt(0, 5);
            int zsCount10_20 = getRandomInt(0, 5);
            int zsCount11_20 = getRandomInt(0, 5);
            int zsCount12_20 = getRandomInt(0, 5);

            int zsCount1_21 = getRandomInt(0, 5);
            int zsCount2_21 = getRandomInt(0, 5);
            int zsCount3_21 = getRandomInt(0, 5);
            int zsCount4_21 = getRandomInt(0, 5);
            int zsCount5_21 = getRandomInt(0, 5);
            int zsCount6_21 = getRandomInt(0, 5);
            int zsCount7_21 = getRandomInt(0, 5);
            int zsCount8_21 = getRandomInt(0, 5);
            int zsCount9_21 = getRandomInt(0, 5);
            int zsCount10_21 = getRandomInt(0, 5);
            int zsCount11_21 = getRandomInt(0, 5);
            int zsCount12_21 = getRandomInt(0, 5);
            for(KeyAreaMonthDTO keyPlaceMonthDTO: keyAreaMonthDTOS1) {
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2019".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_19  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_19  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_19  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_19  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_19  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_19  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_19  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_19  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_19  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_19 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_19 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_19 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2020".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_20  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_20  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_20  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_20  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_20  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_20  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_20  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_20  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_20  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_20 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_20 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_20 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2021".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_21  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_21  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_21  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_21  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_21  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_21  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_21  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_21  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_21  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_21 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_21 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_21 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
            }
            KeyAreaDataDTO keyAreaDTO = new KeyAreaDataDTO();
            keyAreaDTO.setDqmc(areaDTO.getAreaName());
            keyAreaDTO.setDqbm(areaDTO.getAreaCode());
            keyAreaDTO.setDqjb(areaDTO.getAreaLevel());
            keyAreaDTO.setZdqyzs(String.valueOf(keyPlaceCount));
            keyAreaDTO.setXczs(String.valueOf(keyPlacePatrolCount));
            int cc = getRandomInt(0, 50);
            int dd = getRandomInt(10, 90);
            keyAreaDTO.setXczs_hb(String.valueOf(cc) + "." + String.valueOf(dd));
            int ee = getRandomInt(0, 50);
            int ff = getRandomInt(10, 90);
            keyAreaDTO.setXczs_tb(String.valueOf(ee) + "." + String.valueOf(ff));
            keyAreaDTOS.add(keyAreaDTO);

            String[] yearArr = getyear();
            String[] tjlxArr = getTjlx();
            for(int i=0;i<yearArr.length;i++) {
                for(int j=0;j<tjlxArr.length;j++) {
                    KeyAreaMonthDTO keyAreaMonthDTO = new KeyAreaMonthDTO();
                    keyAreaMonthDTO.setDqmc(areaDTO.getAreaName());
                    keyAreaMonthDTO.setDqbm(areaDTO.getAreaCode());
                    keyAreaMonthDTO.setDqjb(areaDTO.getAreaLevel());
                    keyAreaMonthDTO.setNd(yearArr[i]);
                    keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                    if(tjlxArr[j].equals("zs")) {
                        if("2019".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_19));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_19));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_19));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_19));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_19));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_19));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_19));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_19));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_19));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_19));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_19));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_19));
                        }else if("2020".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_20));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_20));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_20));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_20));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_20));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_20));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_20));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_20));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_20));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_20));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_20));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_20));
                        }else if("2021".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_21));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_21));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_21));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_21));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_21));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_21));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_21));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_21));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_21));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_21));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_21));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_21));
                        }
                    }else {
                        keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                    }
                    keyAreaMonthDTOS.add(keyAreaMonthDTO);
                }
            }
            keyAreaDTOS.addAll(keyAreaDTOS1);
            keyAreaMonthDTOS.addAll(keyAreaMonthDTOS1);
            keyAreaDTOS1 = new ArrayList<>();
            keyAreaMonthDTOS1 = new ArrayList<>();
        }
        setFileKeyArea(keyAreaDTOS, keyAreaMonthDTOS);
        return areaDTOList;
    }

    @ApiOperation(value = "房屋类型占比", notes = "综治中心详情接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "comprehensiveCenterId", value = "综治中心ID", paramType = "path")
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("setFileKey")
    public List<AreaDTO> setFileKey() {
        List<AreaDTO> areaDTOList = new ArrayList<>();
        areaDTOList = getArea("110889", areaDTOList);
        List<KeyDataDTO> keyAreaDTOS = new ArrayList<>();
        List<KeyMonthDTO> keyAreaMonthDTOS = new ArrayList<>();
        for(AreaDTO areaDTO : areaDTOList) {
            List<AreaDTO> subAreaList1 = areaDTO.getSubArea();
            List<KeyDataDTO> keyAreaDTOS1 = new ArrayList<>();
            List<KeyMonthDTO> keyAreaMonthDTOS1 = new ArrayList<>();

            if(null != subAreaList1 && subAreaList1.size() > 0) {
                for (AreaDTO areaDTO1 : subAreaList1) {
                    List<AreaDTO> subAreaList2 = areaDTO1.getSubArea();
                    List<KeyDataDTO> keyAreaDTOS2 = new ArrayList<>();
                    List<KeyMonthDTO> keyAreaMonthDTOS2 = new ArrayList<>();

                    if(null != subAreaList2 && subAreaList2.size() > 0) {
                        for (AreaDTO areaDTO2 : subAreaList2) {
                            String[] getKeyTjlx = getKeyTjlx();
                            for(String s: getKeyTjlx) {
                                KeyDataDTO keyAreaDTO = new KeyDataDTO();
                                keyAreaDTO.setDqmc(areaDTO2.getAreaName());
                                keyAreaDTO.setDqbm(areaDTO2.getAreaCode());
                                keyAreaDTO.setDqjb(areaDTO2.getAreaLevel());
                                keyAreaDTO.setTjlx(s);
                                keyAreaDTO.setZs(String.valueOf(getRandomInt(0, 20)));
                                keyAreaDTO.setZs_hb(String.valueOf(getRandom(0, 1)));
                                keyAreaDTO.setZs_tb(String.valueOf(getRandom(0, 1)));
                                keyAreaDTOS.add(keyAreaDTO);
                                keyAreaDTOS2.add(keyAreaDTO);
                            }
                            String[] yearArr = getyear();
                            String[] tjlxArr = getTjlx();
                            for(int i=0;i<yearArr.length;i++) {
                                for(int j=0;j<tjlxArr.length;j++) {
                                    KeyMonthDTO keyAreaMonthDTO = new KeyMonthDTO();
                                    keyAreaMonthDTO.setDqmc(areaDTO2.getAreaName());
                                    keyAreaMonthDTO.setDqbm(areaDTO2.getAreaCode());
                                    keyAreaMonthDTO.setDqjb(areaDTO2.getAreaLevel());
                                    keyAreaMonthDTO.setNd(yearArr[i]);
                                    keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                                    if(tjlxArr[j].equals("zs")) {
                                        keyAreaMonthDTO.setM1(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM2(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM3(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM4(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM5(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM6(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM7(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM8(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM9(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM10(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM11(String.valueOf(getRandomInt(0, 5)));
                                        keyAreaMonthDTO.setM12(String.valueOf(getRandomInt(0, 5)));
                                    }else {
                                        keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                                        keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                                    }
                                    keyAreaMonthDTOS2.add(keyAreaMonthDTO);
                                }
                            }
                        }
                    }

                    int axsgCount = getRandomInt(0, 30);
                    int qtxsjCount = getRandomInt(0, 30);
                    int spaqsgCount = getRandomInt(0, 30);
                    int ygxsajCount = getRandomInt(0, 30);
                    int qtCount = getRandomInt(0, 30);
                    for(KeyDataDTO keyPlaceDataDTO: keyAreaDTOS2) {
                        if("axsg".equals(keyPlaceDataDTO.getTjlx())) {
                            axsgCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                        }
                        if("qtxsj".equals(keyPlaceDataDTO.getTjlx())) {
                            qtxsjCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                        }
                        if("spaqsg".equals(keyPlaceDataDTO.getTjlx())) {
                            spaqsgCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                        }
                        if("ygxsaj".equals(keyPlaceDataDTO.getTjlx())) {
                            ygxsajCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                        }
                        if("qt".equals(keyPlaceDataDTO.getTjlx())) {
                            qtCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                        }
                    }
                    int zsCount1_19 = getRandomInt(0, 5);
                    int zsCount2_19 = getRandomInt(0, 5);
                    int zsCount3_19 = getRandomInt(0, 5);
                    int zsCount4_19 = getRandomInt(0, 5);
                    int zsCount5_19 = getRandomInt(0, 5);
                    int zsCount6_19 = getRandomInt(0, 5);
                    int zsCount7_19 = getRandomInt(0, 5);
                    int zsCount8_19 = getRandomInt(0, 5);
                    int zsCount9_19 = getRandomInt(0, 5);
                    int zsCount10_19 = getRandomInt(0, 5);
                    int zsCount11_19 = getRandomInt(0, 5);
                    int zsCount12_19 = getRandomInt(0, 5);

                    int zsCount1_20 = getRandomInt(0, 5);
                    int zsCount2_20 = getRandomInt(0, 5);
                    int zsCount3_20 = getRandomInt(0, 5);
                    int zsCount4_20 = getRandomInt(0, 5);
                    int zsCount5_20 = getRandomInt(0, 5);
                    int zsCount6_20 = getRandomInt(0, 5);
                    int zsCount7_20 = getRandomInt(0, 5);
                    int zsCount8_20 = getRandomInt(0, 5);
                    int zsCount9_20 = getRandomInt(0, 5);
                    int zsCount10_20 = getRandomInt(0, 5);
                    int zsCount11_20 = getRandomInt(0, 5);
                    int zsCount12_20 = getRandomInt(0, 5);

                    int zsCount1_21 = getRandomInt(0, 5);
                    int zsCount2_21 = getRandomInt(0, 5);
                    int zsCount3_21 = getRandomInt(0, 5);
                    int zsCount4_21 = getRandomInt(0, 5);
                    int zsCount5_21 = getRandomInt(0, 5);
                    int zsCount6_21 = getRandomInt(0, 5);
                    int zsCount7_21 = getRandomInt(0, 5);
                    int zsCount8_21 = getRandomInt(0, 5);
                    int zsCount9_21 = getRandomInt(0, 5);
                    int zsCount10_21 = getRandomInt(0, 5);
                    int zsCount11_21 = getRandomInt(0, 5);
                    int zsCount12_21 = getRandomInt(0, 5);
                    for(KeyMonthDTO keyPlaceMonthDTO: keyAreaMonthDTOS2) {
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2019".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_19  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_19  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_19  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_19  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_19  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_19  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_19  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_19  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_19  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_19 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_19 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_19 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2020".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_20  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_20  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_20  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_20  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_20  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_20  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_20  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_20  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_20  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_20 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_20 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_20 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                        if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2021".equals(keyPlaceMonthDTO.getNd())) {
                            zsCount1_21  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                            zsCount2_21  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                            zsCount3_21  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                            zsCount4_21  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                            zsCount5_21  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                            zsCount6_21  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                            zsCount7_21  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                            zsCount8_21  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                            zsCount9_21  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                            zsCount10_21 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                            zsCount11_21 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                            zsCount12_21 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                        }
                    }
                    String[] getKeyTjlx = getKeyTjlx();
                    for(String s: getKeyTjlx) {
                        KeyDataDTO keyAreaDTO = new KeyDataDTO();
                        keyAreaDTO.setDqmc(areaDTO1.getAreaName());
                        keyAreaDTO.setDqbm(areaDTO1.getAreaCode());
                        keyAreaDTO.setDqjb(areaDTO1.getAreaLevel());
                        keyAreaDTO.setTjlx(s);
                        if("axsg".equals(s)) {
                            keyAreaDTO.setZs(String.valueOf(axsgCount));
                        }
                        if("qtxsj".equals(s)) {
                            keyAreaDTO.setZs(String.valueOf(qtxsjCount));
                        }
                        if("spaqsg".equals(s)) {
                            keyAreaDTO.setZs(String.valueOf(spaqsgCount));
                        }
                        if("ygxsaj".equals(s)) {
                            keyAreaDTO.setZs(String.valueOf(ygxsajCount));
                        }
                        if("qt".equals(s)) {
                            keyAreaDTO.setZs(String.valueOf(qtCount));
                        }
                        keyAreaDTO.setZs_hb(String.valueOf(getRandom(0, 1)));
                        keyAreaDTO.setZs_tb(String.valueOf(getRandom(0, 1)));
                        keyAreaDTOS.add(keyAreaDTO);
                        keyAreaDTOS1.add(keyAreaDTO);
                    }

                    String[] yearArr = getyear();
                    String[] tjlxArr = getTjlx();
                    for(int i=0;i<yearArr.length;i++) {
                        for(int j=0;j<tjlxArr.length;j++) {
                            KeyMonthDTO keyAreaMonthDTO = new KeyMonthDTO();
                            keyAreaMonthDTO.setDqmc(areaDTO1.getAreaName());
                            keyAreaMonthDTO.setDqbm(areaDTO1.getAreaCode());
                            keyAreaMonthDTO.setDqjb(areaDTO1.getAreaLevel());
                            keyAreaMonthDTO.setNd(yearArr[i]);
                            keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                            if(tjlxArr[j].equals("zs")) {
                                if("2019".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_19));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_19));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_19));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_19));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_19));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_19));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_19));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_19));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_19));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_19));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_19));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_19));
                                }else if("2020".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_20));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_20));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_20));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_20));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_20));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_20));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_20));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_20));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_20));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_20));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_20));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_20));
                                }else if("2021".equals(yearArr[i])) {
                                    keyAreaMonthDTO.setM1(String.valueOf(zsCount1_21));
                                    keyAreaMonthDTO.setM2(String.valueOf(zsCount2_21));
                                    keyAreaMonthDTO.setM3(String.valueOf(zsCount3_21));
                                    keyAreaMonthDTO.setM4(String.valueOf(zsCount4_21));
                                    keyAreaMonthDTO.setM5(String.valueOf(zsCount5_21));
                                    keyAreaMonthDTO.setM6(String.valueOf(zsCount6_21));
                                    keyAreaMonthDTO.setM7(String.valueOf(zsCount7_21));
                                    keyAreaMonthDTO.setM8(String.valueOf(zsCount8_21));
                                    keyAreaMonthDTO.setM9(String.valueOf(zsCount9_21));
                                    keyAreaMonthDTO.setM10(String.valueOf(zsCount10_21));
                                    keyAreaMonthDTO.setM11(String.valueOf(zsCount11_21));
                                    keyAreaMonthDTO.setM12(String.valueOf(zsCount12_21));
                                }
                            }else {
                                keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                                keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                            }
                            keyAreaMonthDTOS1.add(keyAreaMonthDTO);
                        }
                    }
                    keyAreaDTOS.addAll(keyAreaDTOS2);
                    keyAreaMonthDTOS.addAll(keyAreaMonthDTOS2);
                    keyAreaDTOS2 = new ArrayList<>();
                    keyAreaMonthDTOS2 = new ArrayList<>();
                }
            }

            int axsgCount = getRandomInt(0, 30);
            int qtxsjCount = getRandomInt(0, 30);
            int spaqsgCount = getRandomInt(0, 30);
            int ygxsajCount = getRandomInt(0, 30);
            int qtCount = getRandomInt(0, 30);
            for(KeyDataDTO keyPlaceDataDTO: keyAreaDTOS1) {
                if("axsg".equals(keyPlaceDataDTO.getTjlx())) {
                    axsgCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                }
                if("qtxsj".equals(keyPlaceDataDTO.getTjlx())) {
                    qtxsjCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                }
                if("spaqsg".equals(keyPlaceDataDTO.getTjlx())) {
                    spaqsgCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                }
                if("ygxsaj".equals(keyPlaceDataDTO.getTjlx())) {
                    ygxsajCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                }
                if("qt".equals(keyPlaceDataDTO.getTjlx())) {
                    qtCount += Integer.valueOf(keyPlaceDataDTO.getZs());
                }
            }
            int zsCount1_19 = getRandomInt(0, 5);
            int zsCount2_19 = getRandomInt(0, 5);
            int zsCount3_19 = getRandomInt(0, 5);
            int zsCount4_19 = getRandomInt(0, 5);
            int zsCount5_19 = getRandomInt(0, 5);
            int zsCount6_19 = getRandomInt(0, 5);
            int zsCount7_19 = getRandomInt(0, 5);
            int zsCount8_19 = getRandomInt(0, 5);
            int zsCount9_19 = getRandomInt(0, 5);
            int zsCount10_19 = getRandomInt(0, 5);
            int zsCount11_19 = getRandomInt(0, 5);
            int zsCount12_19 = getRandomInt(0, 5);

            int zsCount1_20 = getRandomInt(0, 5);
            int zsCount2_20 = getRandomInt(0, 5);
            int zsCount3_20 = getRandomInt(0, 5);
            int zsCount4_20 = getRandomInt(0, 5);
            int zsCount5_20 = getRandomInt(0, 5);
            int zsCount6_20 = getRandomInt(0, 5);
            int zsCount7_20 = getRandomInt(0, 5);
            int zsCount8_20 = getRandomInt(0, 5);
            int zsCount9_20 = getRandomInt(0, 5);
            int zsCount10_20 = getRandomInt(0, 5);
            int zsCount11_20 = getRandomInt(0, 5);
            int zsCount12_20 = getRandomInt(0, 5);

            int zsCount1_21 = getRandomInt(0, 5);
            int zsCount2_21 = getRandomInt(0, 5);
            int zsCount3_21 = getRandomInt(0, 5);
            int zsCount4_21 = getRandomInt(0, 5);
            int zsCount5_21 = getRandomInt(0, 5);
            int zsCount6_21 = getRandomInt(0, 5);
            int zsCount7_21 = getRandomInt(0, 5);
            int zsCount8_21 = getRandomInt(0, 5);
            int zsCount9_21 = getRandomInt(0, 5);
            int zsCount10_21 = getRandomInt(0, 5);
            int zsCount11_21 = getRandomInt(0, 5);
            int zsCount12_21 = getRandomInt(0, 5);
            for(KeyMonthDTO keyPlaceMonthDTO: keyAreaMonthDTOS1) {
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2019".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_19  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_19  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_19  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_19  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_19  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_19  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_19  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_19  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_19  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_19 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_19 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_19 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2020".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_20  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_20  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_20  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_20  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_20  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_20  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_20  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_20  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_20  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_20 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_20 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_20 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
                if("zs".equals(keyPlaceMonthDTO.getTjlx()) && "2021".equals(keyPlaceMonthDTO.getNd())) {
                    zsCount1_21  += Integer.valueOf(keyPlaceMonthDTO.getM1());
                    zsCount2_21  += Integer.valueOf(keyPlaceMonthDTO.getM2());
                    zsCount3_21  += Integer.valueOf(keyPlaceMonthDTO.getM3());
                    zsCount4_21  += Integer.valueOf(keyPlaceMonthDTO.getM4());
                    zsCount5_21  += Integer.valueOf(keyPlaceMonthDTO.getM5());
                    zsCount6_21  += Integer.valueOf(keyPlaceMonthDTO.getM6());
                    zsCount7_21  += Integer.valueOf(keyPlaceMonthDTO.getM7());
                    zsCount8_21  += Integer.valueOf(keyPlaceMonthDTO.getM8());
                    zsCount9_21  += Integer.valueOf(keyPlaceMonthDTO.getM9());
                    zsCount10_21 += Integer.valueOf(keyPlaceMonthDTO.getM10());
                    zsCount11_21 += Integer.valueOf(keyPlaceMonthDTO.getM11());
                    zsCount12_21 += Integer.valueOf(keyPlaceMonthDTO.getM12());
                }
            }
            String[] getKeyTjlx = getKeyTjlx();
            for(String s: getKeyTjlx) {
                KeyDataDTO keyAreaDTO = new KeyDataDTO();
                keyAreaDTO.setDqmc(areaDTO.getAreaName());
                keyAreaDTO.setDqbm(areaDTO.getAreaCode());
                keyAreaDTO.setDqjb(areaDTO.getAreaLevel());
                keyAreaDTO.setTjlx(s);
                if("axsg".equals(s)) {
                    keyAreaDTO.setZs(String.valueOf(axsgCount));
                }
                if("qtxsj".equals(s)) {
                    keyAreaDTO.setZs(String.valueOf(qtxsjCount));
                }
                if("spaqsg".equals(s)) {
                    keyAreaDTO.setZs(String.valueOf(spaqsgCount));
                }
                if("ygxsaj".equals(s)) {
                    keyAreaDTO.setZs(String.valueOf(ygxsajCount));
                }
                if("qt".equals(s)) {
                    keyAreaDTO.setZs(String.valueOf(qtCount));
                }
                keyAreaDTO.setZs_hb(String.valueOf(getRandom(0, 1)));
                keyAreaDTO.setZs_tb(String.valueOf(getRandom(0, 1)));
                keyAreaDTOS.add(keyAreaDTO);
                keyAreaDTOS1.add(keyAreaDTO);
            }

            String[] yearArr = getyear();
            String[] tjlxArr = getTjlx();
            for(int i=0;i<yearArr.length;i++) {
                for(int j=0;j<tjlxArr.length;j++) {
                    KeyMonthDTO keyAreaMonthDTO = new KeyMonthDTO();
                    keyAreaMonthDTO.setDqmc(areaDTO.getAreaName());
                    keyAreaMonthDTO.setDqbm(areaDTO.getAreaCode());
                    keyAreaMonthDTO.setDqjb(areaDTO.getAreaLevel());
                    keyAreaMonthDTO.setNd(yearArr[i]);
                    keyAreaMonthDTO.setTjlx(tjlxArr[j]);
                    if(tjlxArr[j].equals("zs")) {
                        if("2019".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_19));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_19));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_19));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_19));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_19));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_19));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_19));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_19));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_19));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_19));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_19));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_19));
                        }else if("2020".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_20));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_20));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_20));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_20));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_20));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_20));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_20));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_20));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_20));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_20));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_20));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_20));
                        }else if("2021".equals(yearArr[i])) {
                            keyAreaMonthDTO.setM1(String.valueOf(zsCount1_21));
                            keyAreaMonthDTO.setM2(String.valueOf(zsCount2_21));
                            keyAreaMonthDTO.setM3(String.valueOf(zsCount3_21));
                            keyAreaMonthDTO.setM4(String.valueOf(zsCount4_21));
                            keyAreaMonthDTO.setM5(String.valueOf(zsCount5_21));
                            keyAreaMonthDTO.setM6(String.valueOf(zsCount6_21));
                            keyAreaMonthDTO.setM7(String.valueOf(zsCount7_21));
                            keyAreaMonthDTO.setM8(String.valueOf(zsCount8_21));
                            keyAreaMonthDTO.setM9(String.valueOf(zsCount9_21));
                            keyAreaMonthDTO.setM10(String.valueOf(zsCount10_21));
                            keyAreaMonthDTO.setM11(String.valueOf(zsCount11_21));
                            keyAreaMonthDTO.setM12(String.valueOf(zsCount12_21));
                        }
                    }else {
                        keyAreaMonthDTO.setM1(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM2(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM3(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM4(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM5(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM6(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM7(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM8(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM9(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM10(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM11(String.valueOf(getRandom(0, 1)));
                        keyAreaMonthDTO.setM12(String.valueOf(getRandom(0, 1)));
                    }
                    keyAreaMonthDTOS1.add(keyAreaMonthDTO);
                }
            }
            keyAreaDTOS.addAll(keyAreaDTOS1);
            keyAreaMonthDTOS.addAll(keyAreaMonthDTOS1);
            keyAreaDTOS1 = new ArrayList<>();
            keyAreaMonthDTOS1 = new ArrayList<>();
        }
        setFileKey(keyAreaDTOS, keyAreaMonthDTOS);
        return areaDTOList;
    }

    @ApiOperation(value = "房屋类型占比", notes = "综治中心详情接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "comprehensiveCenterId", value = "综治中心ID", paramType = "path")
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("setFileZZ")
    public List<AreaDTO> setFileZZ() {
        List<AreaDTO> areaDTOList = new ArrayList<>();
        areaDTOList = getArea("110889", areaDTOList);
        List<ZZDataDTO> keyAreaDTOS = new ArrayList<>();
        for(AreaDTO areaDTO : areaDTOList) {
            List<AreaDTO> subAreaList1 = areaDTO.getSubArea();
            List<ZZDataDTO> zzDataDTOS1 = new ArrayList<>();

            if(null != subAreaList1 && subAreaList1.size() > 0) {
                for (AreaDTO areaDTO1 : subAreaList1) {
                    List<AreaDTO> subAreaList2 = areaDTO1.getSubArea();
                    List<ZZDataDTO> zzDataDTOS2 = new ArrayList<>();

                    if(null != subAreaList2 && subAreaList2.size() > 0) {
                        for (AreaDTO areaDTO2 : subAreaList2) {
                            String[] aa = getZZTjlx();
                            for(int i=0;i<aa.length;i++) {
                                ZZDataDTO keyAreaDTO = new ZZDataDTO();
                                keyAreaDTO.setDqmc(areaDTO2.getAreaName());
                                keyAreaDTO.setDqbm(areaDTO2.getAreaCode());
                                keyAreaDTO.setDqjb(areaDTO2.getAreaLevel());
                                keyAreaDTO.setTjlx(aa[i]);
                                if (keyAreaDTO.getTjlx().equals("zzdwzs")) {
                                    keyAreaDTO.setZs(String.valueOf(getRandomInt(0, 1)));
                                } else if(keyAreaDTO.getTjlx().equals("zzcyzs")) {
                                    keyAreaDTO.setZs(String.valueOf(getRandomInt(1, 3)));
                                } else if(keyAreaDTO.getTjlx().equals("wgzs")) {
                                    keyAreaDTO.setZs(String.valueOf(getRandomInt(2, 3)));
                                } else if(keyAreaDTO.getTjlx().equals("wgyzs")) {
                                    keyAreaDTO.setZs(String.valueOf(getRandomInt(1, 3)));
                                }else if(keyAreaDTO.getTjlx().equals("zzjgzs")){
                                    keyAreaDTO.setZs(String.valueOf(getRandomInt(1, 3)));
                                }else {
                                    keyAreaDTO.setZs(String.valueOf(getRandomInt(1, 3)));
                                }
                                zzDataDTOS2.add(keyAreaDTO);
                            }
                        }
                    }

                    int zzdwzs_count = getRandomInt(0, 1);
                    int zzcyzs_count = getRandomInt(1, 3);
                    int wgzs_count = getRandomInt(2, 3);
                    int wgyzs_count = getRandomInt(1, 3);
                    int zzjgzs_count = getRandomInt(1, 3);
                    int zgyzs_count = getRandomInt(1, 3);
                    for(ZZDataDTO zzDataDTO: zzDataDTOS2) {
                        if("zzdwzs".equals(zzDataDTO.getTjlx())) {
                            zzdwzs_count += Integer.valueOf(zzDataDTO.getZs());
                        }
                        if("zzcyzs".equals(zzDataDTO.getTjlx())) {
                            zzcyzs_count += Integer.valueOf(zzDataDTO.getZs());
                        }
                        if("wgzs".equals(zzDataDTO.getTjlx())) {
                            wgzs_count += Integer.valueOf(zzDataDTO.getZs());
                        }
                        if("wgyzs".equals(zzDataDTO.getTjlx())) {
                            wgyzs_count += Integer.valueOf(zzDataDTO.getZs());
                        }
                        if("zzjgzs".equals(zzDataDTO.getTjlx())) {
                            zzjgzs_count += Integer.valueOf(zzDataDTO.getZs());
                        }
                        if("zgyzs".equals(zzDataDTO.getTjlx())) {
                            zgyzs_count += Integer.valueOf(zzDataDTO.getZs());
                        }
                    }
                    String[] aa = getZZTjlx();
                    for(int i=0;i<aa.length;i++) {
                        ZZDataDTO keyAreaDTO = new ZZDataDTO();
                        keyAreaDTO.setDqmc(areaDTO1.getAreaName());
                        keyAreaDTO.setDqbm(areaDTO1.getAreaCode());
                        keyAreaDTO.setDqjb(areaDTO1.getAreaLevel());
                        keyAreaDTO.setTjlx(aa[i]);
                        if (keyAreaDTO.getTjlx().equals("zzdwzs")) {
                            keyAreaDTO.setZs(String.valueOf(zzdwzs_count));
                        } else if(keyAreaDTO.getTjlx().equals("zzcyzs")) {
                            keyAreaDTO.setZs(String.valueOf(zzcyzs_count));
                        } else if(keyAreaDTO.getTjlx().equals("wgzs")) {
                            keyAreaDTO.setZs(String.valueOf(wgzs_count));
                        } else if(keyAreaDTO.getTjlx().equals("wgyzs")) {
                            keyAreaDTO.setZs(String.valueOf(wgyzs_count));
                        }else if(keyAreaDTO.getTjlx().equals("zzjgzs")){
                            keyAreaDTO.setZs(String.valueOf(zzjgzs_count));
                        }else {
                            keyAreaDTO.setZs(String.valueOf(zgyzs_count));
                        }
                        zzDataDTOS1.add(keyAreaDTO);
                    }
                    keyAreaDTOS.addAll(zzDataDTOS2);
                    zzDataDTOS2 = new ArrayList<>();
                }
            }
            int zzdwzs_count = getRandomInt(0, 1);
            int zzcyzs_count = getRandomInt(1, 3);
            int wgzs_count = getRandomInt(2, 3);
            int wgyzs_count = getRandomInt(1, 3);
            int zzjgzs_count = getRandomInt(1, 3);
            int zgyzs_count = getRandomInt(1, 3);
            for(ZZDataDTO zzDataDTO: zzDataDTOS1) {
                if("zzdwzs".equals(zzDataDTO.getTjlx())) {
                    zzdwzs_count += Integer.valueOf(zzDataDTO.getZs());
                }
                if("zzcyzs".equals(zzDataDTO.getTjlx())) {
                    zzcyzs_count += Integer.valueOf(zzDataDTO.getZs());
                }
                if("wgzs".equals(zzDataDTO.getTjlx())) {
                    wgzs_count += Integer.valueOf(zzDataDTO.getZs());
                }
                if("wgyzs".equals(zzDataDTO.getTjlx())) {
                    wgyzs_count += Integer.valueOf(zzDataDTO.getZs());
                }
                if("zzjgzs".equals(zzDataDTO.getTjlx())) {
                    zzjgzs_count += Integer.valueOf(zzDataDTO.getZs());
                }
                if("zgyzs".equals(zzDataDTO.getTjlx())) {
                    zgyzs_count += Integer.valueOf(zzDataDTO.getZs());
                }
            }
            String[] aa = getZZTjlx();
            for(int i=0;i<aa.length;i++) {
                ZZDataDTO keyAreaDTO = new ZZDataDTO();
                keyAreaDTO.setDqmc(areaDTO.getAreaName());
                keyAreaDTO.setDqbm(areaDTO.getAreaCode());
                keyAreaDTO.setDqjb(areaDTO.getAreaLevel());
                keyAreaDTO.setTjlx(aa[i]);
                if (keyAreaDTO.getTjlx().equals("zzdwzs")) {
                    keyAreaDTO.setZs(String.valueOf(zzdwzs_count));
                } else if(keyAreaDTO.getTjlx().equals("zzcyzs")) {
                    keyAreaDTO.setZs(String.valueOf(zzcyzs_count));
                } else if(keyAreaDTO.getTjlx().equals("wgzs")) {
                    keyAreaDTO.setZs(String.valueOf(wgzs_count));
                } else if(keyAreaDTO.getTjlx().equals("wgyzs")) {
                    keyAreaDTO.setZs(String.valueOf(wgyzs_count));
                }else if(keyAreaDTO.getTjlx().equals("zzjgzs")){
                    keyAreaDTO.setZs(String.valueOf(zzjgzs_count));
                }else {
                    keyAreaDTO.setZs(String.valueOf(zgyzs_count));
                }
                keyAreaDTOS.add(keyAreaDTO);
            }
            keyAreaDTOS.addAll(zzDataDTOS1);
            zzDataDTOS1 = new ArrayList<>();
        }



        setFileKeyZZ(keyAreaDTOS);
        return areaDTOList;
    }

    private String[] getHouseType() {
        String[] aa = new String[] {"zz", "hz", "xz", "dc"};
        int rand = getRandomInt(0, 3);
        return aa;
    }

    private String[] getyear() {
        String[] aa = new String[] {"2019", "2020", "2021"};
        int rand = getRandomInt(0, 4);
        return aa;
    }

    private String getmonth() {
        String[] aa = new String[] {"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"};
        int rand = getRandomInt(0, 11);
        return aa[rand];
    }

    private String[] getKeyTjlx() {
        String[] aa = new String[] {"axsg", "qtxsj", "spaqsg", "ygxsaj", "qt"};
        int rand = getRandomInt(0, 4);
        return aa;
    }

    private String[] getTjlx() {
        String[] aa = new String[] {"zs", "hb", "tb"};
        int rand = getRandomInt(0, 15);
        return aa;
    }

    private String[] getZZTjlx() {
        String[] aa = new String[] {"zzdwzs", "zzcyzs", "wgzs", "wgyzs", "zzjgzs", "zgyzs"};
        int rand = getRandomInt(0, 1);
        return aa;
    }

    private List<AreaDTO> getArea(String id, List<AreaDTO> areaDTOList1) {
        List<AreaDTO> areaDTOList = mongoAreaService.listAllByParentId(id);
        /*for(AreaDTO areaDTO: areaDTOList) {
            getArea(areaDTO.getAreaId(), areaDTOList1);
        }
        areaDTOList1.addAll(areaDTOList);*/
        return areaDTOList;
    }


    public static int getRandomInt(int Min , int Max){
        Random rand = new Random();
        return rand.nextInt(Max - Min + 1) + Min;
    }

    private String zhanbi(int aa, int bb) {
        double cc = aa / (bb * 1.0) * 100;
        BigDecimal b = new BigDecimal(cc);
        return String.valueOf(b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
    }

    private static Double getRandom(int min, int max){
        int aa = getRandomInt(min, max);
        int bb = getRandomInt(0, 99);
        String cc = "" + aa + "." + bb;
        return Double.valueOf(cc);
    }

    public static void main(String[] args) {
        System.out.println(getRandom(0, 100));
    }

    private static void setFile(List<TestDataDTO> testDataDTOs, List<HouseDataDTO> houseDataDTOs,
                                List<HouseTypeDataDTO> houseTypeDataDTOS, List<AreaHouseDataDTO> areaHouseDataDTOS) {
        File file = new File("C:\\Users\\29492\\Desktop\\a_syshzl_rkfw_zfzl_czwzb.sql");
        File file1 = new File("C:\\Users\\29492\\Desktop\\a_syshzl_rkfw_zfzl_djzf.sql");
        File file2 = new File("C:\\Users\\29492\\Desktop\\a_syshzl_rkfw_zfzl_fwlxzb.sql");
        File file3 = new File("C:\\Users\\29492\\Desktop\\a_syshzl_rkfw_zfzl_qyfwfx.sql");
        try {
            if(!file.exists()) {
                file.createNewFile();
            } else {
                file.delete();
                file.createNewFile();
            }

            if(!file1.exists()) {
                file1.createNewFile();
            } else {
                file1.delete();
                file1.createNewFile();
            }

            if(!file2.exists()) {
                file2.createNewFile();
            } else {
                file2.delete();
                file2.createNewFile();
            }

            if(!file3.exists()) {
                file3.createNewFile();
            } else {
                file3.delete();
                file3.createNewFile();
            }

            FileWriter fw = new FileWriter(file, false);
            BufferedWriter bw = new BufferedWriter(fw);

            FileWriter fw1 = new FileWriter(file1, false);
            BufferedWriter bw1 = new BufferedWriter(fw1);

            FileWriter fw2 = new FileWriter(file2, false);
            BufferedWriter bw2 = new BufferedWriter(fw2);

            FileWriter fw3 = new FileWriter(file3, false);
            BufferedWriter bw3 = new BufferedWriter(fw3);

            String sql1 = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_rkfw_zfzl_czwzb\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_rkfw_zfzl_czwzb`;\n" +
                    "CREATE TABLE `a_syshzl_rkfw_zfzl_czwzb` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `czwzb` double(11,2) DEFAULT NULL COMMENT '出租屋占比',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='出租屋占比';\n";
            bw.write(sql1);
            bw.newLine();
            int i=0;
            for(TestDataDTO testDataDTO: testDataDTOs) {
                i++;
                String sqlWord = "INSERT INTO `a_syshzl_rkfw_zfzl_czwzb` VALUES ("+"'"+i+"'"+", "+"'"+testDataDTO.getDqmc()+"'"+", "+"'"+testDataDTO.getDqbm()+"'"+", "+"'"+testDataDTO.getDqjb()+"'"+", "+"'"+testDataDTO.getCzwzb()+"'"+");";
                bw.write(sqlWord);
                bw.newLine();
            }

            bw.flush();
            bw.close();
            fw.close();

            String sql2 = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_rkfw_zfzl_djzf\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_rkfw_zfzl_djzf`;\n" +
                    "CREATE TABLE `a_syshzl_rkfw_zfzl_djzf` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `djzf` int(11) DEFAULT NULL COMMENT '登记住房',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='登记住房';";
            bw1.write(sql2);
            bw1.newLine();
            int j=0;
            for(HouseDataDTO houseDataDTO : houseDataDTOs) {
                j++;
                String sqlWord1 = "INSERT INTO `a_syshzl_rkfw_zfzl_djzf` VALUES ("+"'"+j+"'"+", "+"'"+houseDataDTO.getDqmc()+"'"+", "+"'"+houseDataDTO.getDqbm()+"'"+", "+"'"+houseDataDTO.getDqjb()+"'"+", "+"'"+houseDataDTO.getDjzf()+"'"+");";
                bw1.write(sqlWord1);
                bw1.newLine();
            }
            bw1.flush();
            bw1.close();
            fw1.close();

            String sql3 = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_rkfw_zfzl_fwlxzb\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_rkfw_zfzl_fwlxzb`;\n" +
                    "CREATE TABLE `a_syshzl_rkfw_zfzl_fwlxzb` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `tjlx` varchar(20) DEFAULT NULL COMMENT '统计类型',\n" +
                    "  `zs` int(11) DEFAULT NULL COMMENT '总数',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`),\n" +
                    "  KEY `tjlx` (`tjlx`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='房屋类型占比';";
            bw2.write(sql3);
            bw2.newLine();
            int l=0;
            for(HouseTypeDataDTO houseTypeDataDTO : houseTypeDataDTOS) {
                l++;
                String sqlWord1 = "INSERT INTO `a_syshzl_rkfw_zfzl_fwlxzb` VALUES ("+"'"+l+"'"+", "+"'"+houseTypeDataDTO.getDqmc()+"'"+", "+"'"+houseTypeDataDTO.getDqbm()+"'"+", "+"'"+houseTypeDataDTO.getDqjb()+"'"+", "+"'"+houseTypeDataDTO.getTjlx()+"'"+", "+"'"+houseTypeDataDTO.getZs()+"'"+");";
                bw2.write(sqlWord1);
                bw2.newLine();
            }
            bw2.flush();
            bw2.close();
            fw2.close();

            String sql4 = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_rkfw_zfzl_qyfwfx\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_rkfw_zfzl_qyfwfx`;\n" +
                    "CREATE TABLE `a_syshzl_rkfw_zfzl_qyfwfx` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `fwzl` int(11) DEFAULT NULL COMMENT '房屋总量',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='区域房屋分析';";
            bw3.write(sql4);
            bw3.newLine();
            int k=0;
            for(AreaHouseDataDTO areaHouseDataDTO : areaHouseDataDTOS) {
                k++;
                String sqlWord1 = "INSERT INTO `a_syshzl_rkfw_zfzl_qyfwfx` VALUES ("+"'"+k+"'"+", "+"'"+areaHouseDataDTO.getDqmc()+"'"+", "+"'"+areaHouseDataDTO.getDqbm()+"'"+", "+"'"+areaHouseDataDTO.getDqjb()+"'"+", "+"'"+areaHouseDataDTO.getFwzl()+"'"+");";
                bw3.write(sqlWord1);
                bw3.newLine();
            }
            bw3.flush();
            bw3.close();
            fw3.close();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private static void setFileKeyPlace(List<KeyPlaceDataDTO> keyAreaDTOS, List<KeyPlaceMonthDTO> keyAreaMonthDTOS) {
        File file = new File("C:\\Users\\29492\\Desktop\\a_syshzl_zhzl_zdcsxc.sql");
        File file1 = new File("C:\\Users\\29492\\Desktop\\a_syshzl_zhzl_zdcsxcjl.sql");
        try {
            if(!file.exists()) {
                file.createNewFile();
            } else {
                file.delete();
                file.createNewFile();
            }

            if(!file1.exists()) {
                file1.createNewFile();
            } else {
                file1.delete();
                file1.createNewFile();
            }

            FileWriter fw = new FileWriter(file, false);
            BufferedWriter bw = new BufferedWriter(fw);

            FileWriter fw1 = new FileWriter(file1, false);
            BufferedWriter bw1 = new BufferedWriter(fw1);

            String sql = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_zhzl_zdcsxc\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_zhzl_zdcsxc`;\n" +
                    "CREATE TABLE `a_syshzl_zhzl_zdcsxc` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `zdcszs` int(11) DEFAULT NULL COMMENT '重点场所总数',\n" +
                    "  `xczs` int(11) DEFAULT NULL COMMENT '巡查总数',\n" +
                    "  `xczs_hb` double(11,2) DEFAULT NULL COMMENT '巡查总数环比',\n" +
                    "  `xczs_tb` double(11,2) DEFAULT NULL COMMENT '巡查总数同比',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='重点场所巡查';";
            bw.write(sql);
            bw.newLine();
            int i=0;
            for(KeyPlaceDataDTO keyAreaDTO: keyAreaDTOS) {
                i++;
                String sqlWord =
                        "INSERT INTO `a_syshzl_zhzl_zdcsxc` VALUES " +
                                "("+"'"+i+"'"+", "+"'"+keyAreaDTO.getDqmc()+"'"+", " +
                                ""+"'"+keyAreaDTO.getDqbm()+"'"+", "+"'"+keyAreaDTO.getDqjb()+"'"+", " +
                                ""+"'"+keyAreaDTO.getZdcszs()+"'"+", "+"'"+keyAreaDTO.getXczs()+"'"+", " +
                                ""+"'"+keyAreaDTO.getXczs_hb()+"'"+", "+"'"+keyAreaDTO.getXczs_tb()+"'"+");";
                bw.write(sqlWord);
                bw.newLine();
            }

            bw.flush();
            bw.close();
            fw.close();

            String sql1 = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_zhzl_zdcsxcjl\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_zhzl_zdcsxcjl`;\n" +
                    "CREATE TABLE `a_syshzl_zhzl_zdcsxcjl` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `nd` int(4) DEFAULT NULL COMMENT '年度',\n" +
                    "  `tjlx` varchar(20) DEFAULT NULL COMMENT '统计类型',\n" +
                    "  `m1` double(11,2) DEFAULT NULL COMMENT '1月',\n" +
                    "  `m2` double(11,2) DEFAULT NULL COMMENT '2月',\n" +
                    "  `m3` double(11,2) DEFAULT NULL COMMENT '3月',\n" +
                    "  `m4` double(11,2) DEFAULT NULL COMMENT '4月',\n" +
                    "  `m5` double(11,2) DEFAULT NULL COMMENT '5月',\n" +
                    "  `m6` double(11,2) DEFAULT NULL COMMENT '6月',\n" +
                    "  `m7` double(11,2) DEFAULT NULL COMMENT '7月',\n" +
                    "  `m8` double(11,2) DEFAULT NULL COMMENT '8月',\n" +
                    "  `m9` double(11,2) DEFAULT NULL COMMENT '9月',\n" +
                    "  `m10` double(11,2) DEFAULT NULL COMMENT '10月',\n" +
                    "  `m11` double(11,2) DEFAULT NULL COMMENT '11月',\n" +
                    "  `m12` double(11,2) DEFAULT NULL COMMENT '12月',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`),\n" +
                    "  KEY `nd` (`nd`),\n" +
                    "  KEY `tjlx` (`tjlx`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='重点场所巡查记录';";
            bw1.write(sql1);
            bw1.newLine();
            int j=0;
            for(KeyPlaceMonthDTO keyAreaMonthDTO : keyAreaMonthDTOS) {
                j++;
                String sqlWord1 = "INSERT INTO `a_syshzl_zhzl_zdcsxcjl` VALUES " +
                        "("+"'"+j+"'"+", "+"'"+keyAreaMonthDTO.getDqmc()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getDqbm()+"'"+", "+"'"+keyAreaMonthDTO.getDqjb()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getNd()+"'"+", "+"'"+keyAreaMonthDTO.getTjlx()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM1()+"'"+", "+"'"+keyAreaMonthDTO.getM2()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM3()+"'"+", "+"'"+keyAreaMonthDTO.getM4()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM5()+"'"+", "+"'"+keyAreaMonthDTO.getM6()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM7()+"'"+", "+"'"+keyAreaMonthDTO.getM8()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM9()+"'"+", "+"'"+keyAreaMonthDTO.getM10()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM11()+"'"+", "+"'"+keyAreaMonthDTO.getM12()+"'"+");";
                bw1.write(sqlWord1);
                bw1.newLine();
            }
            bw1.flush();
            bw1.close();
            fw1.close();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private static void setFileKeyArea(List<KeyAreaDataDTO> keyAreaDTOS, List<KeyAreaMonthDTO> keyAreaMonthDTOS) {
        File file = new File("C:\\Users\\29492\\Desktop\\a_syshzl_zhzl_zdqyxc.sql");
        File file1 = new File("C:\\Users\\29492\\Desktop\\a_syshzl_zhzl_zdqyxcjl.sql");
        try {
            if(!file.exists()) {
                file.createNewFile();
            } else {
                file.delete();
                file.createNewFile();
            }

            if(!file1.exists()) {
                file1.createNewFile();
            } else {
                file1.delete();
                file1.createNewFile();
            }

            FileWriter fw = new FileWriter(file, false);
            BufferedWriter bw = new BufferedWriter(fw);

            FileWriter fw1 = new FileWriter(file1, false);
            BufferedWriter bw1 = new BufferedWriter(fw1);

            String sql = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_zhzl_zdqyxc\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_zhzl_zdqyxc`;\n" +
                    "CREATE TABLE `a_syshzl_zhzl_zdqyxc` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `zdqyzs` int(11) DEFAULT NULL COMMENT '重点区域总数',\n" +
                    "  `xczs` int(11) DEFAULT NULL COMMENT '巡查总数',\n" +
                    "  `xczs_hb` double(11,2) DEFAULT NULL COMMENT '巡查总数环比',\n" +
                    "  `xczs_tb` double(11,2) DEFAULT NULL COMMENT '巡查总数同比',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='重点区域巡查';";
            bw.write(sql);
            bw.newLine();
            int i=0;
            for(KeyAreaDataDTO keyAreaDTO: keyAreaDTOS) {
                i++;
                String sqlWord =
                        "INSERT INTO `a_syshzl_zhzl_zdqyxc` VALUES " +
                                "("+"'"+i+"'"+", "+"'"+keyAreaDTO.getDqmc()+"'"+", " +
                                ""+"'"+keyAreaDTO.getDqbm()+"'"+", "+"'"+keyAreaDTO.getDqjb()+"'"+", " +
                                ""+"'"+keyAreaDTO.getZdqyzs()+"'"+", "+"'"+keyAreaDTO.getXczs()+"'"+", " +
                                ""+"'"+keyAreaDTO.getXczs_hb()+"'"+", "+"'"+keyAreaDTO.getXczs_tb()+"'"+");";
                bw.write(sqlWord);
                bw.newLine();
            }

            bw.flush();
            bw.close();
            fw.close();

            String sql1 = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_zhzl_zdqyxcjl\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_zhzl_zdqyxcjl`;\n" +
                    "CREATE TABLE `a_syshzl_zhzl_zdqyxcjl` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `nd` int(4) DEFAULT NULL COMMENT '年度',\n" +
                    "  `tjlx` varchar(20) DEFAULT NULL COMMENT '统计类型',\n" +
                    "  `m1` double(11,2) DEFAULT NULL COMMENT '1月',\n" +
                    "  `m2` double(11,2) DEFAULT NULL COMMENT '2月',\n" +
                    "  `m3` double(11,2) DEFAULT NULL COMMENT '3月',\n" +
                    "  `m4` double(11,2) DEFAULT NULL COMMENT '4月',\n" +
                    "  `m5` double(11,2) DEFAULT NULL COMMENT '5月',\n" +
                    "  `m6` double(11,2) DEFAULT NULL COMMENT '6月',\n" +
                    "  `m7` double(11,2) DEFAULT NULL COMMENT '7月',\n" +
                    "  `m8` double(11,2) DEFAULT NULL COMMENT '8月',\n" +
                    "  `m9` double(11,2) DEFAULT NULL COMMENT '9月',\n" +
                    "  `m10` double(11,2) DEFAULT NULL COMMENT '10月',\n" +
                    "  `m11` double(11,2) DEFAULT NULL COMMENT '11月',\n" +
                    "  `m12` double(11,2) DEFAULT NULL COMMENT '12月',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`),\n" +
                    "  KEY `nd` (`nd`),\n" +
                    "  KEY `tjlx` (`tjlx`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='重点区域巡查记录';";
            bw1.write(sql1);
            bw1.newLine();
            int j=0;
            for(KeyAreaMonthDTO keyAreaMonthDTO : keyAreaMonthDTOS) {
                j++;
                String sqlWord1 = "INSERT INTO `a_syshzl_zhzl_zdqyxcjl` VALUES " +
                        "("+"'"+j+"'"+", "+"'"+keyAreaMonthDTO.getDqmc()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getDqbm()+"'"+", "+"'"+keyAreaMonthDTO.getDqjb()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getNd()+"'"+", "+"'"+keyAreaMonthDTO.getTjlx()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM1()+"'"+", "+"'"+keyAreaMonthDTO.getM2()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM3()+"'"+", "+"'"+keyAreaMonthDTO.getM4()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM5()+"'"+", "+"'"+keyAreaMonthDTO.getM6()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM7()+"'"+", "+"'"+keyAreaMonthDTO.getM8()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM9()+"'"+", "+"'"+keyAreaMonthDTO.getM10()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM11()+"'"+", "+"'"+keyAreaMonthDTO.getM12()+"'"+");";
                bw1.write(sqlWord1);
                bw1.newLine();
            }
            bw1.flush();
            bw1.close();
            fw1.close();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private static void setFileKey(List<KeyDataDTO> keyAreaDTOS, List<KeyMonthDTO> keyAreaMonthDTOS) {
        File file = new File("C:\\Users\\29492\\Desktop\\a_syshzl_zhzl_zdsjfs.sql");
        File file1 = new File("C:\\Users\\29492\\Desktop\\a_syshzl_zhzl_zdsjfsjl.sql");
        try {
            if(!file.exists()) {
                file.createNewFile();
            } else {
                file.delete();
                file.createNewFile();
            }

            if(!file1.exists()) {
                file1.createNewFile();
            } else {
                file1.delete();
                file1.createNewFile();
            }

            FileWriter fw = new FileWriter(file, false);
            BufferedWriter bw = new BufferedWriter(fw);

            FileWriter fw1 = new FileWriter(file1, false);
            BufferedWriter bw1 = new BufferedWriter(fw1);

            String sql = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_zhzl_zdsjfs\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_zhzl_zdsjfs`;\n" +
                    "CREATE TABLE `a_syshzl_zhzl_zdsjfs` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `tjlx` varchar(20) DEFAULT NULL COMMENT '统计类型',\n" +
                    "  `zs` int(11) DEFAULT NULL COMMENT '总数',\n" +
                    "  `zs_hb` double(11,2) DEFAULT NULL COMMENT '总数环比',\n" +
                    "  `zs_tb` double(11,2) DEFAULT NULL COMMENT '总数同比',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='重大事件发生';";
            bw.write(sql);
            bw.newLine();
            int i=0;
            for(KeyDataDTO keyAreaDTO: keyAreaDTOS) {
                i++;
                String sqlWord =
                        "INSERT INTO `a_syshzl_zhzl_zdsjfs` VALUES " +
                                "("+"'"+i+"'"+", "+"'"+keyAreaDTO.getDqmc()+"'"+", " +
                                ""+"'"+keyAreaDTO.getDqbm()+"'"+", "+"'"+keyAreaDTO.getDqjb()+"'"+", " +
                                ""+"'"+keyAreaDTO.getTjlx()+"'"+", "+"'"+keyAreaDTO.getZs()+"'"+", " +
                                ""+"'"+keyAreaDTO.getZs_hb()+"'"+", "+"'"+keyAreaDTO.getZs_tb()+"'"+");";
                bw.write(sqlWord);
                bw.newLine();
            }

            bw.flush();
            bw.close();
            fw.close();

            String sql1 = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_zhzl_zdsjfsjl\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_zhzl_zdsjfsjl`;\n" +
                    "CREATE TABLE `a_syshzl_zhzl_zdsjfsjl` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `nd` int(4) DEFAULT NULL COMMENT '年度',\n" +
                    "  `tjlx` varchar(20) DEFAULT NULL COMMENT '统计类型',\n" +
                    "  `m1` double(11,2) DEFAULT NULL COMMENT '1月',\n" +
                    "  `m2` double(11,2) DEFAULT NULL COMMENT '2月',\n" +
                    "  `m3` double(11,2) DEFAULT NULL COMMENT '3月',\n" +
                    "  `m4` double(11,2) DEFAULT NULL COMMENT '4月',\n" +
                    "  `m5` double(11,2) DEFAULT NULL COMMENT '5月',\n" +
                    "  `m6` double(11,2) DEFAULT NULL COMMENT '6月',\n" +
                    "  `m7` double(11,2) DEFAULT NULL COMMENT '7月',\n" +
                    "  `m8` double(11,2) DEFAULT NULL COMMENT '8月',\n" +
                    "  `m9` double(11,2) DEFAULT NULL COMMENT '9月',\n" +
                    "  `m10` double(11,2) DEFAULT NULL COMMENT '10月',\n" +
                    "  `m11` double(11,2) DEFAULT NULL COMMENT '11月',\n" +
                    "  `m12` double(11,2) DEFAULT NULL COMMENT '12月',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`),\n" +
                    "  KEY `nd` (`nd`),\n" +
                    "  KEY `tjlx` (`tjlx`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='重大事件发生记录';";
            bw1.write(sql1);
            bw1.newLine();
            int j=0;
            for(KeyMonthDTO keyAreaMonthDTO : keyAreaMonthDTOS) {
                j++;
                String sqlWord1 = "INSERT INTO `a_syshzl_zhzl_zdsjfsjl` VALUES " +
                        "("+"'"+j+"'"+", "+"'"+keyAreaMonthDTO.getDqmc()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getDqbm()+"'"+", "+"'"+keyAreaMonthDTO.getDqjb()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getNd()+"'"+", "+"'"+keyAreaMonthDTO.getTjlx()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM1()+"'"+", "+"'"+keyAreaMonthDTO.getM2()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM3()+"'"+", "+"'"+keyAreaMonthDTO.getM4()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM5()+"'"+", "+"'"+keyAreaMonthDTO.getM6()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM7()+"'"+", "+"'"+keyAreaMonthDTO.getM8()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM9()+"'"+", "+"'"+keyAreaMonthDTO.getM10()+"'"+", " +
                        ""+"'"+keyAreaMonthDTO.getM11()+"'"+", "+"'"+keyAreaMonthDTO.getM12()+"'"+");";
                bw1.write(sqlWord1);
                bw1.newLine();
            }
            bw1.flush();
            bw1.close();
            fw1.close();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private static void setFileKeyZZ(List<ZZDataDTO> keyAreaDTOS) {
        File file = new File("C:\\Users\\29492\\Desktop\\a_syshzl_zhzl_zzzy.sql");
        try {
            if(!file.exists()) {
                file.createNewFile();
            } else {
                file.delete();
                file.createNewFile();
            }

            FileWriter fw = new FileWriter(file, false);
            BufferedWriter bw = new BufferedWriter(fw);

            String sql = "-- ----------------------------\n" +
                    "-- Table structure for a_syshzl_zhzl_zzzy\n" +
                    "-- ----------------------------\n" +
                    "DROP TABLE IF EXISTS `a_syshzl_zhzl_zzzy`;\n" +
                    "CREATE TABLE `a_syshzl_zhzl_zzzy` (\n" +
                    "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n" +
                    "  `dqmc` varchar(255) DEFAULT NULL COMMENT '地区名称',\n" +
                    "  `dqbm` varchar(255) DEFAULT NULL COMMENT '地区编码',\n" +
                    "  `dqjb` int(1) DEFAULT NULL COMMENT '地区级别',\n" +
                    "  `tjlx` varchar(20) DEFAULT NULL COMMENT '统计类型',\n" +
                    "  `zs` int(11) DEFAULT NULL COMMENT '总数',\n" +
                    "  PRIMARY KEY (`id`),\n" +
                    "  KEY `dqbm` (`dqbm`),\n" +
                    "  KEY `dqjb` (`dqjb`),\n" +
                    "  KEY `tjlx` (`tjlx`)\n" +
                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='综治资源';";
            bw.write(sql);
            bw.newLine();
            int i=0;
            for(ZZDataDTO keyAreaDTO: keyAreaDTOS) {
                i++;
                String sqlWord =
                        "INSERT INTO `a_syshzl_zhzl_zzzy` VALUES " +
                                "("+"'"+i+"'"+", "+"'"+keyAreaDTO.getDqmc()+"'"+", " +
                                ""+"'"+keyAreaDTO.getDqbm()+"'"+", "+"'"+keyAreaDTO.getDqjb()+"'"+", " +
                                ""+"'"+keyAreaDTO.getTjlx()+"'"+", "+"'"+keyAreaDTO.getZs()+"'"+");";
                bw.write(sqlWord);
                bw.newLine();
            }

            bw.flush();
            bw.close();
            fw.close();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }


}
