|
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
@RequestMapping("repair")
|
|
|
@Api(tags = "学生维修服务")
|
|
@@ -107,13 +108,10 @@ public class RepairController extends BaseController {
|
|
|
@ApiOperation("获取维修记录详情")
|
|
|
@GetMapping(value = "/getRepairInfo")
|
|
|
public HttpResponseResult getRepairInfo(Integer id,Integer studentId) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if ((sysUser == null || sysUser.getId() ==null) && studentId == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
- if(sysUser.getId() != null){
|
|
|
- studentId = sysUser.getId();
|
|
|
- }
|
|
|
+ Optional.ofNullable(studentId)
|
|
|
+ .map(sysUserFeignService::queryUserById)
|
|
|
+ .orElseThrow(() -> new BizException("用户信息获取失败"));
|
|
|
+
|
|
|
StudentRepair repairInfo = studentRepairService.getRepairInfo(id);
|
|
|
if (!repairInfo.getStudentId().equals(studentId)) {
|
|
|
return failed("您的维修记录不存在");
|