书评bug
This commit is contained in:
@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -120,12 +122,21 @@ public class UserBookClockInController {
|
||||
@RequestMapping(value = "/correctClockIn", method = RequestMethod.GET)
|
||||
public R correctClockIn(@RequestParam("bookId") Integer bookId,
|
||||
@RequestParam("userId") Integer userId,
|
||||
@RequestParam("day") Integer day) {
|
||||
@RequestParam("day") Integer day) throws ParseException {
|
||||
QueryWrapper<UserBookClockEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("book_id", bookId);
|
||||
queryWrapper.eq("user_id", userId);
|
||||
UserBookClockEntity userBookClock = userBookClockService.getOne(queryWrapper);
|
||||
String clocksStr = userBookClock.getClocks();
|
||||
|
||||
long time = userBookClock.getBeginDate().getTime();
|
||||
Date date = new Date();
|
||||
long time1 = date.getTime();
|
||||
int c = (int)(time1-time);
|
||||
int c_day = c/86400000;
|
||||
if(day<(c_day-7)){
|
||||
return R.error("不可补卡超过7天");
|
||||
}
|
||||
List<Integer> clockInDaysList = JSON.parseObject(clocksStr, new TypeReference<List<Integer>>() {
|
||||
});
|
||||
clockInDaysList.add(day);
|
||||
|
||||
Reference in New Issue
Block a user