liujie
2023-08-10 03552ae04973a224b5ccfce34e64999ea6a13d44
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
package com.supersavedriving.driver.modular.system.api;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.supersavedriving.driver.core.common.annotion.ServiceLog;
import com.supersavedriving.driver.modular.system.model.SystemConfig;
import com.supersavedriving.driver.modular.system.service.ISystemConfigService;
import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
/**
* 系统配置
* @author pzb
* @Date 2023/2/25 11:53
*/
@RestController
@RequestMapping("")
public class SystemConfigController {
 
    @Autowired
    private ISystemConfigService systemConfigService;
 
 
 
 
    @ResponseBody
    @PostMapping("/base/config/queryTransferOrderConfig")
//    @ServiceLog(name = "获取转单提醒时间配置", url = "/base/config/queryTransferOrderConfig")
    @ApiOperation(value = "获取转单提醒时间配置", tags = {"司机端-服务中"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<Integer> queryTransferOrderConfig(){
        try {
            SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1));
            JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
            Integer num5 = jsonObject.getInteger("num5");
            return ResponseWarpper.success(num5);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/base/config/getIndexTimeConfig")
//    @ServiceLog(name = "获取转单提醒时间配置", url = "/base/config/queryTransferOrderConfig")
    @ApiOperation(value = "获取首页有效时间配置", tags = {"司机端-服务中"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<String> getIndexTimeConfig(){
        try {
            SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4));
            JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
            String num1 = jsonObject.getString("num1");
            String num2 = jsonObject.getString("num2");
            return ResponseWarpper.success(num1+"-"+num2);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
}