|  | @@ -14,6 +14,7 @@ import com.ym.mec.biz.service.StudentInstrumentService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  | +import com.ym.mec.util.date.DateUtil;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiImplicitParam;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiImplicitParams;
 | 
	
	
		
			
				|  | @@ -79,9 +80,74 @@ public class StudentInstrumentController extends BaseController {
 | 
	
		
			
				|  |  |          if (studentInstrument.getStudentId() == null) {
 | 
	
		
			
				|  |  |              return failed("学生id不能为空");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        if (studentInstrument.getStartTime() != null) {
 | 
	
		
			
				|  |  | +            studentInstrument.setStartTime(DateUtil.trunc(studentInstrument.getStartTime()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (studentInstrument.getEndTime() != null) {
 | 
	
		
			
				|  |  | +            studentInstrument.setEndTime(DateUtil.getLastTimeWithDay(studentInstrument.getEndTime()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        studentInstrument.setOperation(sysUser.getId());
 | 
	
		
			
				|  |  |          SysUser student = sysUserFeignService.queryUserById(studentInstrument.getStudentId());
 | 
	
		
			
				|  |  |          studentInstrument.setOrganId(student.getOrganId());
 | 
	
		
			
				|  |  |          return succeed(studentInstrumentService.addStudentInstrument(studentInstrument));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "获取乐保信息")
 | 
	
		
			
				|  |  | +    @GetMapping("/getInfo")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('studentInstrument/getInfo')")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<StudentInstrument> getInfo(Long id, Integer studentId) {
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null) {
 | 
	
		
			
				|  |  | +            return failed("用户信息获取失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        StudentInstrument studentInstrument = studentInstrumentService.get(id);
 | 
	
		
			
				|  |  | +        if (studentInstrument == null || !studentInstrument.getStudentId().equals(studentId)) {
 | 
	
		
			
				|  |  | +            return failed("学生乐器信息不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return succeed(studentInstrument);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "修改乐保信息")
 | 
	
		
			
				|  |  | +    @PostMapping("/update")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('studentInstrument/update')")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<StudentInstrument> update(StudentInstrument studentInstrument) {
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null) {
 | 
	
		
			
				|  |  | +            return failed("用户信息获取失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (studentInstrument.getStudentId() == null) {
 | 
	
		
			
				|  |  | +            return failed("学生id不能为空");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (studentInstrument.getStartTime() != null) {
 | 
	
		
			
				|  |  | +            studentInstrument.setStartTime(DateUtil.trunc(studentInstrument.getStartTime()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (studentInstrument.getEndTime() != null) {
 | 
	
		
			
				|  |  | +            studentInstrument.setEndTime(DateUtil.getLastTimeWithDay(studentInstrument.getEndTime()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        studentInstrument.setOperation(sysUser.getId());
 | 
	
		
			
				|  |  | +        SysUser student = sysUserFeignService.queryUserById(studentInstrument.getStudentId());
 | 
	
		
			
				|  |  | +        studentInstrument.setOrganId(student.getOrganId());
 | 
	
		
			
				|  |  | +        return succeed(studentInstrumentService.updateStudentInstrument(studentInstrument));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "删除学生乐器信息")
 | 
	
		
			
				|  |  | +    @PostMapping("/del")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('studentInstrument/del')")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<StudentInstrument> update(Long id, Integer studentId) {
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null) {
 | 
	
		
			
				|  |  | +            return failed("用户信息获取失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        StudentInstrument studentInstrument = studentInstrumentService.get(id);
 | 
	
		
			
				|  |  | +        if (studentInstrument == null || !studentInstrument.getStudentId().equals(studentId)) {
 | 
	
		
			
				|  |  | +            return failed("学生乐器信息不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        studentInstrument.setOperation(sysUser.getId());
 | 
	
		
			
				|  |  | +        studentInstrument.setDelFlag(1);
 | 
	
		
			
				|  |  | +        return succeed(studentInstrumentService.updateStudentInstrument(studentInstrument));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |