| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | 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.DataConfigDto; |
| | | import com.yuanchu.mom.dto.DeviceDto; |
| | | import com.yuanchu.mom.dto.DeviceDto1; |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.yuanchu.mom.service.DataConfigService; |
| | | import com.yuanchu.mom.service.DeviceService; |
| | | import com.yuanchu.mom.utils.DataAcquisition; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @Value("${file.path}") |
| | | private String filePath; |
| | | |
| | | @Autowired |
| | | private DataConfigService dataConfigService; |
| | | |
| | | @ValueClassify("设备") |
| | | @ApiOperation(value = "查询设备详情列表") |
| | |
| | | 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("/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)); |
| | | // } |
| | | |
| | | @ValueAuth |
| | | @ApiModelProperty("/数采") |
| | | @GetMapping("/text") |
| | | public Result<?> text(HttpServletRequest request) { |
| | | return Result.success(DataAcquisition.dataAcquisitionEntrance(request, new Device())); |
| | | } |
| | | |
| | | @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)); |
| | | @PostMapping("/saveDataAcquisitionConfiguration") |
| | | public Result<?> saveDataAcquisitionConfiguration(@RequestBody DataConfigDto dataConfigList) { |
| | | dataConfigService.saveOrUpdateBatch(dataConfigList.getDataConfigList()); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify("设备") |
| | | @ApiOperation(value = "查询数采配置") |
| | | @GetMapping("/queryDataAcquisitionConfiguration") |
| | | public Result<?> queryDataAcquisitionConfiguration(@RequestParam("deviceId") Integer deviceId, @RequestParam("insProductItem") String insProductItem) { |
| | | List<DataConfig> list = dataConfigService.list(Wrappers.<DataConfig>lambdaQuery() |
| | | .eq(DataConfig::getDeviceId, deviceId) |
| | | .eq(DataConfig::getInsProductItem, insProductItem)); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | @ValueClassify("设备") |
| | | @ApiOperation(value = "删除数采配置") |
| | | @DeleteMapping("/deleteDataAcquisitionConfiguration") |
| | | public Result<?> deleteDataAcquisitionConfiguration(@RequestParam("id") Integer id) { |
| | | dataConfigService.removeById(id); |
| | | return Result.success(); |
| | | } |
| | | } |
| | | |