jinpengyong
2023-10-10 f0837ee21f7650d4413830d4ee90da02bcdd6d36
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
package com.moral.api.controller;
 
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.moral.api.entity.BenchmarkWindConfig;
import com.moral.api.pojo.dto.account.AccountDTO;
import com.moral.api.pojo.dto.account.AccountQueryDTO;
import com.moral.api.pojo.dto.accountRole.AccountRoleDTO;
import com.moral.api.pojo.form.account.AccountDeleteForm;
import com.moral.api.pojo.form.account.AccountInsertForm;
import com.moral.api.pojo.form.account.AccountQueryForm;
import com.moral.api.pojo.form.account.AccountUpdateForm;
import com.moral.api.pojo.form.accountRole.AccountRoleUpdateForm;
import com.moral.api.pojo.vo.account.AccountQueryVO;
import com.moral.api.service.BenchmarkWindConfigService;
import com.moral.api.service.ManageAccountRoleService;
import com.moral.api.service.ManageAccountService;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.Map;
 
 
@Slf4j
@Api(tags = {"风场模型基准信息"})
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/benchmarkWindConfig")
public class BenchmarkWindConfigController {
 
    @Resource
    private BenchmarkWindConfigService benchmarkWindConfigService;
 
    @PostMapping("insert")
    public ResultMessage insert(@RequestBody Map map) {
        if (ObjectUtils.isEmpty(map.get("name")) || ObjectUtils.isEmpty(map.get("benchmark")) || ObjectUtils.isEmpty(map.get("preservation")) || ObjectUtils.isEmpty(map.get("destinationTab")) || ObjectUtils.isEmpty(map.get("organizationId")) || ObjectUtils.isEmpty(map.get("regionCode"))){
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
 
        BenchmarkWindConfig benchmarkWindConfig = new BenchmarkWindConfig();
        benchmarkWindConfig.setName(map.get("name").toString());
        benchmarkWindConfig.setBenchmark(map.get("benchmark").toString());
        benchmarkWindConfig.setPreservation(map.get("preservation").toString());
        benchmarkWindConfig.setDestinationTab(map.get("destinationTab").toString());
        benchmarkWindConfig.setOrganizationId(Integer.parseInt(map.get("organizationId").toString()));
        benchmarkWindConfig.setRegionCode(map.get("regionCode").toString());
 
        Map<String, Object> resultMap = benchmarkWindConfigService.insert(benchmarkWindConfig);
        return ResultMessage.ok();
    }
 
 
 
}