提交 db0059f3 authored 作者: 邓砥奕's avatar 邓砥奕

修改bug

上级 ad4060d0
......@@ -5,6 +5,7 @@ import com.tykj.dev.device.library.repository.DeviceLogDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.vo.DeviceLogUserVo;
import com.tykj.dev.device.library.subject.vo.FileVo;
......@@ -180,13 +181,16 @@ public class MatchingDeviceController {
@ApiOperation(value = "查询配套装备详情", notes = "可以通过这个接口查询配套装备详情")
@GetMapping("/feature/detail/{id}")
public ResponseEntity getDetail(@PathVariable("id") int id) {
MacthingDeviceDetailVo macthingDeviceDetailVo = new MacthingDeviceDetailVo();
List<Object> list = new ArrayList<>();
//添加配套设备详情
MatchingDeviceLibrary m = matchingDeviceLibraryService.getOne(id);
macthingDeviceDetailVo.setMatchingDeviceLibrary(m);
list.add(m);
//添加关联装备详情
if (m.getDeviceId() != 0) {
macthingDeviceDetailVo.setDeviceLibrary(deviceLibraryService.getOne(m.getDeviceId()));
list.add(deviceLibraryService.getOne(m.getDeviceId()));
}
else {
list.add(new DeviceLibrary());
}
//添加设备履历日志
List<DeviceLogUserVo> deviceLogs = deviceLogDao.getAllByDeviceIdAndType(id, 1).stream()
......@@ -194,8 +198,8 @@ public class MatchingDeviceController {
.map(DeviceLogDto::toVo)
.sorted(Comparator.comparing(DeviceLogUserVo::getCreateTime))
.collect(Collectors.toList());
macthingDeviceDetailVo.setDeviceLogUserVos(deviceLogs);
return ResponseEntity.ok(macthingDeviceDetailVo);
list.add(deviceLogs);
return ResponseEntity.ok(list);
}
@ApiOperation(value = "更新配套设备", notes = "可以通过这个接口更新配套设备")
......@@ -251,4 +255,16 @@ public class MatchingDeviceController {
macthingDetailVo.setTaskLogUserVos(taskLogService.getByTaskId(taskBto.getId()));
return ResponseEntity.ok(macthingDetailVo);
}
@ApiOperation(value = "查询所有配套设备型号", notes = "查询所有配套设备型号")
@GetMapping(value = "/selectAllModel")
public ResponseEntity selectAllModel(){
return ResponseEntity.ok(matchingDeviceLibraryService.getAllModel());
}
@ApiOperation(value = "查询所有配套设备名称", notes = "查询所有配套设备名称")
@GetMapping(value = "/selectAllName")
public ResponseEntity selectAllName(){
return ResponseEntity.ok(matchingDeviceLibraryService.getAllName());
}
}
......@@ -4,6 +4,8 @@ import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author dengdiyi
*/
......
......@@ -5,6 +5,8 @@ import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -40,4 +42,14 @@ public interface MatchingDeviceLibraryService {
* 配套设备分页查询
*/
Page<MatchingDeviceLibrary> getPage(MatchingDeviceSelectVo matchingDeviceSelectVo, Pageable pageable);
/**
* @return 所有类型
*/
List<String> getAllModel();
/**
* @return 所有名称
*/
List<String> getAllName();
}
......@@ -18,8 +18,7 @@ import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -100,6 +99,26 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
}
}
/**
* @return 所有类型
*/
@Override
public List<String> getAllModel() {
Set<String> models = new HashSet<>();
matchingDeviceLibraryDao.findAll().forEach(matchingDeviceLibrary -> models.add(matchingDeviceLibrary.getModel()));
return new ArrayList<>(models);
}
/**
* @return 所有名称
*/
@Override
public List<String> getAllName() {
Set<String> names = new HashSet<>();
matchingDeviceLibraryDao.findAll().forEach(matchingDeviceLibrary -> names.add(matchingDeviceLibrary.getName()));
return new ArrayList<>(names);
}
/**
* @param matchingDeviceSelectVo 配套设备查询vo
* 创建通用查询条件筛选器
......
......@@ -2,16 +2,17 @@ package com.tykj.dev.device.repair.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.repair.service.RepairBillService;
import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo;
import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author dengdiyi
......@@ -30,4 +31,13 @@ public class RepairBillSelectController {
public ResponseEntity selectRepairBill(@RequestBody RepairBillSelectVo repairBillSelectVo) {
return ResultUtil.success(repairBillService.getPage(repairBillSelectVo, repairBillSelectVo.getPageable()));
}
@ApiOperation(value = "查询维修单详情", notes = "可以通过这个接口查询维修单详情")
@GetMapping(value = "/archives/repair/detail/{id}")
public ResponseEntity selectRepairBillDetail(@PathVariable("id") int id){
List<Object> list = new ArrayList<>();
//获取维修单
RepairBill repairBill = repairBillService.getOne(id);
return null;
}
}
......@@ -4,6 +4,7 @@ import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.task.subject.domin.TaskLog;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModelProperty;
......@@ -15,6 +16,7 @@ import org.modelmapper.ModelMapper;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author dengdiyi
......@@ -54,13 +56,26 @@ public class TaskLogBto {
this.fileVoList = new ArrayList<>();
}
public TaskLogBto(Integer taskId, String remark, Integer createUserId) {
this.taskId = taskId;
this.remark = remark;
this.createUserId = createUserId;
}
/**
* dto类转化为do类
*/
public TaskLog toDo() {
UserUtils userUtils = SpringUtils.getBean("userUtils");
TaskLog taskLog = new TaskLog();
taskLog.setTaskId(this.taskId);
taskLog.setRemark(this.remark);
if (this.createUserId!=null){
taskLog.setCreateUserId(this.createUserId);
}
else {
taskLog.setCreateUserId(Objects.requireNonNull(userUtils).getCurrentUserId());
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("Ǵ");
if (this.fileVoList != null && this.fileVoList.size() > 0) {
......
......@@ -58,7 +58,6 @@ public class TaskLog {
* 创建用户id
*/
@ApiModelProperty(value = "创建用户id")
@CreatedBy
private Integer createUserId;
/**
* 创建时间
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论