郑永安
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
package com.gk.hotwork.doublePrevention.controller;
 
import com.gk.hotwork.Controller.Base.BaseController;
import com.gk.hotwork.Domain.co.ContextCacheUser;
import com.gk.hotwork.Domain.Vo.ResultVO;
import com.gk.hotwork.doublePrevention.entity.PreventRiskMap;
import com.gk.hotwork.doublePrevention.entity.dto.req.PreventRiskMapDeleteReqDTO;
import com.gk.hotwork.doublePrevention.entity.dto.req.PreventRiskMapQueryReqDTO;
import com.gk.hotwork.doublePrevention.entity.dto.req.PreventRiskMapSaveReqDTO;
import com.gk.hotwork.doublePrevention.entity.dto.req.PreventRiskMapUpdateReqDTO;
import com.gk.hotwork.doublePrevention.service.RiskService;
import com.gk.hotwork.doublePrevention.utils.CacheUserTransfer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("prevent/map")
public class PreventProduceMapController extends BaseController {
 
    @Autowired
    private RiskService riskService;
 
 
    /**
     * 风险分布图-分页查询详细信息
     */
    @PostMapping("/select/getRiskMapPage")
    public ResultVO<PreventRiskMap> getMapPage(@RequestBody PreventRiskMapQueryReqDTO riskMapQueryReqDTO) {
 
        return riskService.getMapPage(riskMapQueryReqDTO);
    }
 
    /**
     * 风险分布图-新增
     */
    @PostMapping("/insert/saveRiskMap")
    public ResultVO<PreventRiskMap> saveRiskMap(Authentication authentication, PreventRiskMapSaveReqDTO riskMapSaveReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.saveRiskMap(currentUser.getUid(), riskMapSaveReqDTO);
    }
 
    /**
     * 风险分布图-删除
     */
    @PostMapping("/delete/deleteRiskMap")
    public ResultVO<PreventRiskMap> deleteRiskMap(Authentication authentication, @RequestBody PreventRiskMapDeleteReqDTO riskMapDeleteReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.deleteRiskMap(currentUser.getUid(), riskMapDeleteReqDTO);
    }
 
    /**
     * 风险分布图-修改
     */
    @PostMapping("/update/updateRiskMap")
    public ResultVO<PreventRiskMap> updateRiskMap(Authentication authentication, @RequestBody PreventRiskMapUpdateReqDTO riskMapUpdateReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.updateRiskMap(currentUser.getUid(), riskMapUpdateReqDTO);
    }
 
 
    /**
     * 风险分布图-图
     */
    @PostMapping("/select/getMapImage")
    public ResultVO<PreventRiskMap> getMapImage(@RequestBody Long id) {
 
        return riskService.getMapImage(id);
    }
}