| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.DeviceDto; |
| | | import com.yuanchu.mom.dto.DeviceDto1; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.yuanchu.mom.service.DeviceService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | if (!realpath.exists()) { |
| | | realpath.mkdirs(); |
| | | } |
| | | pathName = UUID.randomUUID() + "_" + file.getOriginalFilename(); |
| | | pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMdd")) + "-" + file.getOriginalFilename(); |
| | | urlString = realpath + "/" + pathName; |
| | | file.transferTo(new File(urlString)); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | |
| | | public Result selectDeviceByCode(String code) { |
| | | return Result.success(deviceService.selectDeviceByCode(code)); |
| | | } |
| | | |
| | | @ValueClassify("设备") |
| | | @ApiOperation(value = "查询数采配置") |
| | | @PostMapping("/getNumberCollect") |
| | | public Result<?> getNumberCollect(Integer id) { |
| | | DeviceDto1 deviceDto1 = new DeviceDto1(); |
| | | BeanUtils.copyProperties(deviceService.getById(id),deviceDto1); |
| | | return Result.success(deviceDto1); |
| | | } |
| | | |
| | | @ValueClassify("设备") |
| | | @ApiOperation(value = "维护数采配置") |
| | | @PostMapping("/numberCollect") |
| | | public Result<?> numberCollect(@RequestBody DeviceDto1 deviceDto1) { |
| | | Device device = new Device(); |
| | | BeanUtils.copyProperties(deviceDto1,device); |
| | | return Result.success(deviceService.updateById(device)); |
| | | } |
| | | } |
| | | |