cjl
2023-07-10 315ec391b2a36a6d796a8726b57b7c2b8908db12
Merge remote-tracking branch 'origin/dev' into qa
11 files modified
324 ■■■■■ changed files
screen-api/src/main/java/com/moral/api/controller/DataDisplayController.java 6 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/form/dataDisplay/MonitorPointDataDisplayForm.java 91 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/DataDisplayServiceImpl.java 163 ●●●● patch | view | raw | blame | history
screen-api/src/main/resources/application-dev.yml 10 ●●●● patch | view | raw | blame | history
screen-api/src/main/resources/application-local.yml 4 ●●●● patch | view | raw | blame | history
screen-common/src/main/java/com/moral/util/AESUtils.java 4 ●●●● patch | view | raw | blame | history
screen-job/src/main/java/com/moral/api/controller/PubController.java 12 ●●●●● patch | view | raw | blame | history
screen-job/src/main/resources/application-dev.yml 8 ●●●● patch | view | raw | blame | history
screen-job/src/main/resources/application-qa.yml 2 ●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/controller/PubController.java 16 ●●●●● patch | view | raw | blame | history
screen-manage/src/main/resources/application-dev.yml 8 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/DataDisplayController.java
@@ -32,10 +32,10 @@
    @Autowired
    DataDisplayService dataDisplayService;
    @GetMapping("monitorPointDataDisplay")
    public ResultMessage monitorPointDataDisplay(MonitorPointDataDisplayForm form){
    @PostMapping("monitorPointDataDisplay")
    public ResultMessage monitorPointDataDisplay( @RequestBody MonitorPointDataDisplayForm form){
        //判断是否缺少参数
        if (!form.valid())
        if (form.getMacs()==null && form.getEndTime() ==null && form.getStartTime() ==null && form.getReportType()==null)
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
screen-api/src/main/java/com/moral/api/pojo/form/dataDisplay/MonitorPointDataDisplayForm.java
@@ -7,6 +7,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
 * @ClassName MonitorPointDataDisplayForm
@@ -20,21 +21,27 @@
    /*
     * 站点id
     * */
    private Integer monitorPointId;
     */
//    private Integer monitorPointId;
    /**
     * mac号
     */
    private List<String>  macs;
    /*
     * 开始时间
     * */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH")
    @JsonFormat(pattern = "yyyy-MM-dd HH", timezone = "GMT+8")
    private Date startTime;
    /*
     * 结束时间
     * */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH")
    @JsonFormat(pattern = "yyyy-MM-dd HH", timezone = "GMT+8")
    private Date endTime;
    /*
@@ -45,41 +52,41 @@
    /*
     * 检测数据是否有效
     * */
    public boolean valid() {
        if (monitorPointId == null)
            return false;
        if (reportType == null) {
            if (startTime == null || endTime == null)
                return false;
            //结束时间获取当天最后一个小时
            String endTimeStr = DateUtils.dateToDateString(endTime,"yyyy-MM-dd");
            endTimeStr+=" 23:59:59";
            endTime = DateUtils.getDate(endTimeStr,"yyyy-MM-dd HH:mm:ss");
        } else {
            if(startTime!=null&&endTime!=null)
                return false;
            if (reportType.equals(Constants.HOURLY_REPORT)) {
                //时报选项默认为上个小时的数据
                Date previousHour = DateUtils.getDateOfMin(new Date(), -60);
                startTime = DateUtils.getHourlyStartTime(previousHour);
            } else if (reportType.equals(Constants.DAILY_REPORT)) {
                //日报选项默认为昨天的数据
                Date yesterday = DateUtils.getDateOfDay(new Date(),-1);
                startTime = DateUtils.getDailyStartTime(yesterday);
            } else if (reportType.equals(Constants.WEEKLY_REPORT)) {
                //周报选项默认为上周的数据
                Date previous = DateUtils.getDateOfDay(new Date(),-7);
                startTime = DateUtils.getWeeklyStartTime(previous);
                endTime = DateUtils.getWeeklyEndTime(previous);
            } else if (reportType.equals(Constants.MONTHLY_REPORT)) {
                //月报选项默认为上月的数据
                Date lastMonthFirstDay = DateUtils.getFirstDayOfLastMonth();
                startTime = DateUtils.getMonthlyStartTime(lastMonthFirstDay);
                endTime = DateUtils.getMonthlyEndTime(lastMonthFirstDay);
            } else
                return false;
        }
        return true;
    }
//    public boolean valid() {
//        if (monitorPointId == null)
//           return false;
//        if (reportType == null) {
//            if (startTime == null || endTime == null)
//                return false;
//            //结束时间获取当天最后一个小时
//            String endTimeStr = DateUtils.dateToDateString(endTime,"yyyy-MM-dd");
//            endTimeStr+=" 23:59:59";
//            endTime = DateUtils.getDate(endTimeStr,"yyyy-MM-dd HH:mm:ss");
//        } else {
//            if(startTime!=null&&endTime!=null)
//                return false;
//            if (reportType.equals(Constants.HOURLY_REPORT)) {
//                //时报选项默认为上个小时的数据
//                Date previousHour = DateUtils.getDateOfMin(new Date(), -60);
//                startTime = DateUtils.getHourlyStartTime(previousHour);
//            } else if (reportType.equals(Constants.DAILY_REPORT)) {
//                //日报选项默认为昨天的数据
//                Date yesterday = DateUtils.getDateOfDay(new Date(),-1);
//                startTime = DateUtils.getDailyStartTime(yesterday);
//            } else if (reportType.equals(Constants.WEEKLY_REPORT)) {
//                //周报选项默认为上周的数据
//                Date previous = DateUtils.getDateOfDay(new Date(),-7);
//                startTime = DateUtils.getWeeklyStartTime(previous);
//                endTime = DateUtils.getWeeklyEndTime(previous);
//            } else if (reportType.equals(Constants.MONTHLY_REPORT)) {
//                //月报选项默认为上月的数据
//                Date lastMonthFirstDay = DateUtils.getFirstDayOfLastMonth();
//                startTime = DateUtils.getMonthlyStartTime(lastMonthFirstDay);
//                endTime = DateUtils.getMonthlyEndTime(lastMonthFirstDay);
//            } else
//                return false;
//        }
//        return true;
//    }
}
screen-api/src/main/java/com/moral/api/service/impl/DataDisplayServiceImpl.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moral.api.entity.*;
import com.moral.api.mapper.DeviceMapper;
import com.moral.api.mapper.HistoryMonthlyMapper;
import com.moral.api.pojo.dto.dataDisplay.MonitorPointDataDisplayDTO;
import com.moral.api.pojo.dto.dataDisplay.SensorComparisonDisplayDTO;
@@ -17,6 +18,8 @@
import org.springframework.util.ObjectUtils;
import java.util.*;
import static com.moral.util.DateUtils.dateToDateString;
/**
 * @ClassName DataDisplayServiceImpl
@@ -41,19 +44,27 @@
    @Autowired
    HistoryMonthlyService historyMonthlyService;
    @Autowired
    DeviceMapper deviceMapper;
    @Override
    public List<MonitorPointDataDisplayDTO> getMonitorPointDisplayData(MonitorPointDataDisplayForm form) {
        //取参
        Integer monitorPointId = form.getMonitorPointId();
//        Integer monitorPointId = form.getMacs();
        List<String> macs = form.getMacs();
        String reportType = form.getReportType();
        Date startTime = form.getStartTime();
        Date endTime = form.getEndTime();
        //根据站点id获取站点下所有的设备
        List<Device> devices = deviceService.getDevicesByMonitorPointId(monitorPointId);
//        List<Device> devices = deviceService.getDevicesByMonitorPointId(monitorPointId);
        QueryWrapper<Device> deviceQueryWrapper = new QueryWrapper<>();
        deviceQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        deviceQueryWrapper.in("mac", macs);
        List<Device> devices = deviceMapper.selectList(deviceQueryWrapper);
        Map<String, Device> deviceMap = new HashMap<>();
        List<String> macs = new ArrayList<>();
//        List<String> ListMacs = new ArrayList<>();
        devices.forEach(value -> {
            macs.add(value.getMac());
//            ListMacs.add(value.getMac());
            deviceMap.put(value.getMac(), value);
        });
        List<MonitorPointDataDisplayDTO> dtos = new ArrayList<>();
@@ -73,20 +84,26 @@
        }
        //处理小时报表请求,默认取上一个小时的值
        else if (reportType.equals(Constants.HOURLY_REPORT)) {
            Map<String, HistoryHourly> macDataMap = new HashMap<>();
            Map<String, List<HistoryHourly>> macDataMap = new HashMap<>();
            //获取数据
            macs.forEach(value -> {
                List<HistoryHourly> datas = historyHourlyService.getValueByMacAndTime(value, startTime, startTime);
                List<HistoryHourly> datas = historyHourlyService.getValueByMacAndTime(value, startTime, endTime);
                if (datas.size() != 0)
                    macDataMap.put(value, datas.get(0));
                    macDataMap.put(value,datas);
            });
            if (macDataMap.size() != 0)
                dtos = calculateReportData(macDataMap, deviceMap, reportType, startTime);
        }
        //处理日报请求,默认获取昨天的值
        else if (reportType.equals(Constants.DAILY_REPORT)) {
            Map<String, List<HistoryDaily>> macDataMap = new HashMap<>();
            //获取数据
            Map<String, HistoryDaily> macDataMap = historyDailyService.getHistoryDailyByMacsAndDate(macs, startTime);
            macs.forEach(value -> {
                List<HistoryDaily> datas = historyDailyService.getHistoryDailyByMacAndTimeSlot(value, startTime, endTime);
                if (datas.size() != 0)
                    macDataMap.put(value,datas);
            });
            if (macDataMap.size() != 0)
                dtos = calculateReportData(macDataMap, deviceMap, reportType, startTime);
        }
@@ -101,7 +118,15 @@
        else if (reportType.equals(Constants.MONTHLY_REPORT)) {
            //月报需要获取一个月每天的数据用来算综合指数,其他数据从月表中取出
            Map<String, List<HistoryDaily>> macDataDailyMap = new HashMap<>();
            Map<String, HistoryMonthly> macDataMonthlyMap = historyMonthlyService.getHistoryMonthlyByMacsAndDate(macs, startTime);
            Map<String, List<HistoryMonthly>> macDataMonthlyMap = new HashMap<>();
            macs.forEach(mac -> {
                QueryWrapper<HistoryMonthly> wrapper = new QueryWrapper<>();
                wrapper.eq("mac",mac);
                wrapper.between("time",startTime,endTime);
                List<HistoryMonthly> monthlyList = historyMonthlyMapper.selectList(wrapper);
                if (!ObjectUtils.isEmpty(monthlyList))
                    macDataMonthlyMap.put(mac, monthlyList);
            });
            macs.forEach(mac -> {
                List<HistoryDaily> dailyDatas = historyDailyService.getHistoryDailyByMacAndTimeSlot(mac, startTime, endTime);
                if (!ObjectUtils.isEmpty(dailyDatas))
@@ -533,35 +558,103 @@
     */
    private <T> List<MonitorPointDataDisplayDTO> calculateReportData(Map<String, T> macDataMap, Map<String, Device> deviceMap, String reportType, Date... date) {
        List<MonitorPointDataDisplayDTO> dtos = new ArrayList<>();
        macDataMap.forEach((key, valueObject) -> {
            MonitorPointDataDisplayDTO dto = new MonitorPointDataDisplayDTO();
            dto.setMac(key);
            //数据的map
            Map<String, Object> valueMap;
            //获取对象的value属性值
            Object valueO = ClassUtils.getPropertyValue(valueObject, "value");
            if (valueO == null)
                return;
            String value = (String) valueO;
            valueMap = JSON.parseObject(value, Map.class);
        Set<String> strings = macDataMap.keySet();
        for (String key : strings) {
            if (reportType.equals("0")){
                List<HistoryHourly> t = (List<HistoryHourly>)macDataMap.get(key);
                for (HistoryHourly historyHourly : t) {
                    MonitorPointDataDisplayDTO dto = new MonitorPointDataDisplayDTO();
                    String value = historyHourly.getValue();
                    Map map = JSON.parseObject(value, Map.class);
                    String time = DateUtils.dateToDateString(historyHourly.getTime(), "yyyy-MM-dd HH:00:00");
                    injectDataToDto(map, false, dto, reportType);
                    dto.setTime(time);
                    dto.setMac(key);
                    dto.setDeviceName(deviceMap.get(key).getName());
                    dtos.add(dto);
                }
            }
            if (reportType.equals("1")){
                List<HistoryDaily> t = (List<HistoryDaily>)macDataMap.get(key);
                for (HistoryDaily historyDaily : t) {
                    MonitorPointDataDisplayDTO dto = new MonitorPointDataDisplayDTO();
                    String value = historyDaily.getValue();
                    Map map = JSON.parseObject(value, Map.class);
                    String time = DateUtils.dateToDateString(historyDaily.getTime(), "yyyy-MM-dd");
                    injectDataToDto(map, false, dto, reportType);
                    dto.setTime(time);
                    dto.setMac(key);
                    dto.setDeviceName(deviceMap.get(key).getName());
                    dtos.add(dto);
                }
            }
            if (reportType.equals("2")){
                HistoryWeekly historyWeekly = (HistoryWeekly)macDataMap.get(key);
                    MonitorPointDataDisplayDTO dto = new MonitorPointDataDisplayDTO();
                    String value = historyWeekly.getValue();
                    Map map = JSON.parseObject(value, Map.class);
                    String time = DateUtils.dateToDateString(historyWeekly.getTime(), "yyyy-MM-dd");
                    injectDataToDto(map, false, dto, reportType);
                    dto.setTime(time);
                    dto.setMac(key);
                    dto.setDeviceName(deviceMap.get(key).getName());
                    dtos.add(dto);
            }
            if (reportType.equals("3")){
                List<HistoryMonthly> t = (List<HistoryMonthly>)macDataMap.get(key);
                for (HistoryMonthly historyMonthly : t) {
                    MonitorPointDataDisplayDTO dto = new MonitorPointDataDisplayDTO();
                    String value = historyMonthly.getValue();
                    Map map = JSON.parseObject(value, Map.class);
                    String time = DateUtils.dateToDateString(historyMonthly.getTime(), "yyyy-MM");
                    injectDataToDto(map, false, dto, reportType);
                    dto.setTime(time);
                    dto.setMac(key);
                    dto.setDeviceName(deviceMap.get(key).getName());
                    dtos.add(dto);
                }
            }
        }
//        macDataMap.forEach((key, valueObject) -> {
//            MonitorPointDataDisplayDTO dto = new MonitorPointDataDisplayDTO();
//            dto.setMac(key);
//            //数据的map
//            Map<String, Object> valueMap;
//            List<Map<String, Object>> list;
//            //获取对象的value属性值
//            Object valueO = ClassUtils.getPropertyValue(valueObject, "value");
//            if (valueO == null)
//                return;
//            String value = (String) valueO;
//            list = JSON.parseObject(value, List.class);
//            for (Map<String, Object> map : list) {
//                String o = map.get("value").toString();
//                valueMap = JSON.parseObject(o, Map.class);
//                injectDataToDto(valueMap, false, dto, reportType);
//                String deviceName = deviceMap.get(key).getName();
//                dto.setDeviceName(deviceName);
//                String startTime = DateUtils.dateToDateString((Date) map.get("time"), "yyyy-MM-dd HH:mm:ss");
//                dto.setTime(startTime);
//                dtos.add(dto);
//            }
            //获取设备名称
            String deviceName = deviceMap.get(key).getName();
            dto.setDeviceName(deviceName);
            //拼接时间,时报的时间需要精确到小时,日报精确到当天,周报需要含有开始和结束时间
            String startTime = "";
            if (valueObject instanceof HistoryHourly && date.length == 1)
                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM-dd HH:mm:ss");
            else if (valueObject instanceof HistoryDaily && date.length == 1)
                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM-dd");
            else if (valueObject instanceof HistoryWeekly && date.length == 2)
                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM-dd") + " -- " + DateUtils.dateToDateString(date[1], "yyyy-MM-dd");
            else if (valueObject instanceof HistoryMonthly && date.length == 1)
                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM");
            dto.setTime(startTime);
//            String startTime = "";
//            if (valueObject instanceof HistoryHourly && date.length == 1)
//                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM-dd HH:mm:ss");
//            else if (valueObject instanceof HistoryDaily && date.length == 1)
//                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM-dd");
//            else if (valueObject instanceof HistoryWeekly && date.length == 2)
//                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM-dd") + " -- " + DateUtils.dateToDateString(date[1], "yyyy-MM-dd");
//            else if (valueObject instanceof HistoryMonthly && date.length == 1)
//                startTime = DateUtils.dateToDateString(date[0], "yyyy-MM");
//            dto.setTime(startTime);
            //注入数据
            injectDataToDto(valueMap, false, dto, reportType);
            dtos.add(dto);
        });
//        });
        return dtos;
    }
screen-api/src/main/resources/application-dev.yml
@@ -19,7 +19,7 @@
  redis:
    host: r-bp1xdlb9wfc6zt0msp.redis.rds.aliyuncs.com
    port: 6379
    password: moral_123456
    password: moral_qx_12345
    timeout: 30000
    jedis:
      pool:
@@ -36,7 +36,7 @@
  tokenRedis:
    host: r-bp1xdlb9wfc6zt0msp.redis.rds.aliyuncs.com
    port: 6379
    password: moral_123456
    password: moral_qx_12345
    timeout: 30000
    database: 15
    pool:
@@ -54,9 +54,9 @@
    filters: stat
    type: com.alibaba.druid.pool.DruidDataSource
    max-wait: 60000
    url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: moral_123456
    url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsks.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: moral_qx
    password: moral_qx_12345
    test-on-borrow: false
    sql-script-encoding: utf-8
    pool-prepared-statements: true
screen-api/src/main/resources/application-local.yml
@@ -54,8 +54,8 @@
    type: com.alibaba.druid.pool.DruidDataSource
    max-wait: 60000
    url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk8o2.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: moral_123456
    username: moral_qx
    password: moral_qx_12345
    test-on-borrow: false
    sql-script-encoding: utf-8
    pool-prepared-statements: true
screen-common/src/main/java/com/moral/util/AESUtils.java
@@ -67,8 +67,8 @@
    //解密
    public static String decrypt(String content, String key) {
        try {
            SecretKeySpec skey = new SecretKeySpec(key.getBytes(), algorithm);
            IvParameterSpec iv = new IvParameterSpec(key.getBytes(), 0, offset);
            SecretKeySpec skey = new SecretKeySpec(key.getBytes("utf-8"), algorithm);
            IvParameterSpec iv = new IvParameterSpec(key.getBytes("utf-8"), 0, offset);
            Cipher cipher = Cipher.getInstance(transformation);
            cipher.init(Cipher.DECRYPT_MODE, skey, iv);// 初始化
            byte[] result = cipher.doFinal(new Base64().decode(content));
screen-job/src/main/java/com/moral/api/controller/PubController.java
@@ -1,6 +1,7 @@
package com.moral.api.controller;
import com.moral.api.service.HistoryDailyService;
import com.moral.api.service.HistoryFiveMinutelyService;
import com.moral.constant.ResultMessage;
import com.moral.util.DateUtils;
import io.swagger.annotations.Api;
@@ -29,6 +30,8 @@
public class PubController {
    @Autowired
    private HistoryDailyService historyDailyService;
    @Autowired
    private HistoryFiveMinutelyService historyFiveMinutelyService;
    @GetMapping("insertHistoryDaily")
    @ApiOperation(value = "天数据补录", notes = "天数据补录")
@@ -39,6 +42,15 @@
        return new ResultMessage();
    }
    @GetMapping("insertHistoryFiveMinutely")
    @ApiOperation(value = "5分钟数据", notes = "5分钟数据")
    public ResultMessage insertHistoryFiveMinutely() {
        historyFiveMinutelyService.insertHistoryFiveMinutely();
        return new ResultMessage();
    }
    public static void main(String[] args) {
        String s = "2023-9-01";
        Date d = DateUtils.getDate(s,"yyyy-MM-dd");
screen-job/src/main/resources/application-dev.yml
@@ -20,7 +20,7 @@
  redis:
    host: r-bp1xdlb9wfc6zt0msp.redis.rds.aliyuncs.com
    port: 6379
    password: moral_123456
    password: moral_qx_12345
    timeout: 30000
    jedis:
      pool:
@@ -37,7 +37,7 @@
  tokenRedis:
    host: r-bp1xdlb9wfc6zt0msp.redis.rds.aliyuncs.com
    port: 6379
    password: moral_123456
    password: moral_qx_12345
    timeout: 30000
    database: 14
    pool:
@@ -56,8 +56,8 @@
    type: com.alibaba.druid.pool.DruidDataSource
    max-wait: 60000
    url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: moral_123456
    username: moral_qx
    password: moral_qx_12345
    test-on-borrow: false
    sql-script-encoding: utf-8
    pool-prepared-statements: true
screen-job/src/main/resources/application-qa.yml
@@ -55,7 +55,7 @@
    filters: stat
    type: com.alibaba.druid.pool.DruidDataSource
    max-wait: 60000
    url: jdbc:mysql://121.199.44.85:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk8o2.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: moral_123456
    test-on-borrow: false
screen-manage/src/main/java/com/moral/api/controller/PubController.java
@@ -6,6 +6,7 @@
import com.moral.api.pojo.form.user.UserQueryForm;
import com.moral.api.pojo.form.user.UserUpdateForm;
import com.moral.api.pojo.vo.user.UserQueryVO;
import com.moral.api.service.DeviceAdjustValueService;
import com.moral.api.service.UserService;
import com.moral.api.util.CacheUtils;
import com.moral.constant.ResponseCodeEnum;
@@ -17,6 +18,9 @@
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;
/**
 * @ClassName UserController
@@ -32,6 +36,8 @@
public class PubController {
    @Autowired
    private CacheUtils cacheUtils;
    @Resource
    private DeviceAdjustValueService deviceAdjustValueService;
    @GetMapping("deviceAlarmInfo")
    @ApiOperation(value = "设备因子", notes = "设备因子")
@@ -54,4 +60,14 @@
        return new ResultMessage();
    }
    @GetMapping(value = "adjust")
    @ApiOperation(value = "adjust编码", notes = "adjust编码")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String")
    })
    public ResultMessage adjust() {
        Map<String,Object> resultMap = deviceAdjustValueService.refreshRedis();
        return new ResultMessage();
    }
}
screen-manage/src/main/resources/application-dev.yml
@@ -20,7 +20,7 @@
  redis:
      host: r-bp1xdlb9wfc6zt0msp.redis.rds.aliyuncs.com
      port: 6379
      password: moral_123456
      password: moral_qx_12345
      timeout: 30000
      jedis:
        pool:
@@ -37,7 +37,7 @@
  tokenRedis:
    host: r-bp1xdlb9wfc6zt0msp.redis.rds.aliyuncs.com
    port: 6379
    password: moral_123456
    password: moral_qx_12345
    timeout: 30000
    database: 14
    pool:
@@ -56,8 +56,8 @@
    type: com.alibaba.druid.pool.DruidDataSource
    max-wait: 60000
    url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: moral_123456
    username: moral_qx
    password: moral_qx_12345
    test-on-borrow: false
    sql-script-encoding: utf-8
    pool-prepared-statements: true