发表于: 2018-09-10 22:21:50
1 467
今天完成的事情:(一定要写非常细致的内容,比如说学会了盒子模型,了解了Margin)
今天改了很多接口,都是一点小问题,最坑的就是签到页面,到现在都没写出来。
package com.everest.academy.controller;
import com.everest.academy.business.vo.ResponseVo;
import com.everest.academy.service.SignService;
import com.everest.academy.util.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Min;
/**
* @ClassName SignController
* @Description TODO
* @Author 田野
* @Data 15:23
* @Version 1.0
**/
@Slf4j
@RestController
@RequestMapping("/a/student/signing")
@Api(tags = "SignController", description = "学生签到")
public class SignController {
@Autowired
SignService signService;
@ApiOperation(value = "首页点击签到", notes = "首页查看用户签到信息")
@ApiImplicitParam(name = "id", value = "用户id", paramType = "path", required = true, dataType = "Integer")
@GetMapping("{id}")
public ResponseVo findGainState(@Min(value = 0, message = "参数不能小于0") @PathVariable("id") Integer id) throws Exception {
return ResultUtil.success("查看用户签到信息成功" + signService.findSignById(id));
}
package com.everest.academy.service.impl;
import com.everest.academy.business.dto.SignDto;
import com.everest.academy.framework.exception.ResourceIsNullException;
import com.everest.academy.persistence.mapper.UserMapper;
import com.everest.academy.persistence.mapper.UserSignMapper;
import com.everest.academy.service.SignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @ClassName SignServiceImpl
* @Description 签到相关
* @Author 田野
* @Data 15:26
* @Version 1.0
**/
@Slf4j
@Service
public class SignServiceImpl implements SignService {
@Autowired
UserMapper userMapper;
@Autowired
UserSignMapper userSignMapper;
@Override
public SignDto findSignById(Integer id) throws ResourceIsNullException {
SignDto signDto = userMapper.selectSignById(id);
if (signDto == null) {
throw new ResourceIsNullException("该用户不存在");
}
String signInRecord = signDto.getSignInRecord();
long signInRecord1 = Long.parseLong(signInRecord);
String i = Long.toBinaryString(signInRecord1);
if(i.length()<31){
int n=31-i.length();
String temp="";
for (int k=0;k<n;k++){
temp=temp+"0";
}
i=i+temp;
}
signDto.setSignInRecord(i);
return signDto;
}
只写了一个接口,很烦。
明天计划的事情:跟前端一起改错,然后签到页面看能不能搞定吧。
遇到的问题:心态有点崩,签到感觉之前想的全有问题。
收获:知道修真院坑B贼多。
评论