郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package com.gk.hotwork.Controller;
 
import cn.hutool.json.JSONObject;
import com.gk.hotwork.Controller.Base.BaseController;
import com.gk.hotwork.Domain.FourColorMap2;
import com.gk.hotwork.Domain.Utils.Msg;
import com.gk.hotwork.Domain.dto.FourColorMapDto;
import com.gk.hotwork.Service.FourColorMap2Service;
import com.gk.hotwork.Service.FourColorMapService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
import java.util.Map;
 
@Api(tags = "四色图")
@RestController
@RequestMapping("fourColorMap")
public class FourColorMapController extends BaseController {
 
    @Autowired
    private FourColorMapService fourColorMapService;
    @Autowired
    private FourColorMap2Service fourColorMap2Service;
 
 
    @ApiOperation("新增四色图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "四色图ID"),
            @ApiImplicitParam(name = "etype",value = "企业类型 1 - 60万吨 , 2 - 130万吨"),
            @ApiImplicitParam(name = "type",value = "四色图类型"),
            @ApiImplicitParam(name = "name",value = "四色图名称"),
            @ApiImplicitParam(name = "shapeType",value = "四色图形状"),
            @ApiImplicitParam(name = "text",value = "四色图样式 - 显示文字"),
            @ApiImplicitParam(name = "clampToGround",value = "四色图样式 - clampToGround"),
            @ApiImplicitParam(name = "color",value = "四色图样式 - 颜色"),
            @ApiImplicitParam(name = "geoType",value = "绘图形状"),
            @ApiImplicitParam(name = "locations",value = "坐标数组数组")
    })
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Msg insertOneMap(@RequestBody FourColorMapDto mapDto){
        Msg msg = new Msg();
        String result = fourColorMapService.insertOneMapPoint(mapDto);
        if(result == null){
            msg.setCode("200");
        }else {
            msg.setCode("400");
            msg.setMessage(result);
        }
        return msg;
    }
 
    @RequestMapping(value = "/add2",method = RequestMethod.POST)
    public Msg insertOneMap2(@RequestBody com.alibaba.fastjson.JSONObject mapJson){
        fourColorMap2Service.addOne(mapJson,getUser());
        return success();
    }
 
    @RequestMapping(value = "/get/list2",method = RequestMethod.POST)
    public Msg getList2(Integer eType){
        List<FourColorMap2> list = fourColorMap2Service.getList2(eType);
        return success(list);
    }
 
 
    @RequestMapping(value = "/del2", method = RequestMethod.POST)
    public Msg del2(@RequestBody JSONObject delBody){
        Long id = delBody.getLong("id");
        fourColorMap2Service.delOne(id);
        return success();
    }
 
    @ApiOperation("删除四色图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "四色图ID")
    })
    @RequestMapping(value = "/del",method = RequestMethod.GET)
    public Msg deleteMap(@RequestParam String id){
        Msg msg = new Msg();
        if(fourColorMapService.deleteMap(id) == true){
            msg.setCode("200");
        }else {
            msg.setCode("400");
            msg.setMessage("删除失败");
        }
        return msg;
    }
 
    @ApiOperation("ID查找四色图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "四色图ID")
    })
    @RequestMapping(value = "/get/id",method = RequestMethod.GET)
    public Msg findById(@RequestParam String id){
        Msg msg = new Msg();
        JSONObject mapJson = fourColorMapService.getOnePointJsonById(id);
        if(mapJson!=null && !mapJson.isEmpty()){
            msg.setCode("200");
            msg.setResult(mapJson);
        }else {
            msg.setCode("201");
            msg.setMessage("未找到数据");
        }
        return msg;
    }
 
 
    @ApiOperation("查找全部四色图")
    @RequestMapping(value = "/get/list",method = RequestMethod.GET)
    public Msg findList(@RequestParam int etype){
        Msg msg = new Msg();
        List<JSONObject> mapDtoList = fourColorMapService.getPointListJson(etype);
        if(mapDtoList!=null && mapDtoList.size() > 0){
            msg.setCode("200");
            msg.setResult(mapDtoList);
        }else {
            msg.setCode("201");
            msg.setMessage("未找到数据");
        }
        return msg;
    }
}