|
|
|
@ -5,29 +5,35 @@ import com.ruoyi.common.constant.Constants;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.core.domain.model.LoginBody;
|
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
|
import com.ruoyi.framework.web.service.SysLoginService;
|
|
|
|
|
import com.ruoyi.pt.entity.CaseInfo;
|
|
|
|
|
import com.ruoyi.pt.entity.CasesImport;
|
|
|
|
|
import com.ruoyi.pt.entity.Events;
|
|
|
|
|
import com.ruoyi.pt.entity.dto.AEventChangeIsReport;
|
|
|
|
|
import com.ruoyi.pt.entity.dto.AMassEventsRequest;
|
|
|
|
|
import com.ruoyi.pt.entity.dto.ASimilarRequest;
|
|
|
|
|
import com.ruoyi.pt.entity.response.ANew100PageResponse;
|
|
|
|
|
import com.ruoyi.pt.entity.response.FiveEventCountResponse;
|
|
|
|
|
import com.ruoyi.pt.service.AEventsService;
|
|
|
|
|
import com.ruoyi.pt.service.EventsService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
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 javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 事件控制层
|
|
|
|
|
*
|
|
|
|
|
* @author du
|
|
|
|
|
* @since 2024/9/2 10:20
|
|
|
|
|
*/
|
|
|
|
@ -40,10 +46,47 @@ public class AEventsController extends BaseController {
|
|
|
|
|
private AEventsService aEventsService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private EventsService eventsService;
|
|
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private SysLoginService sysLoginService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验
|
|
|
|
|
*
|
|
|
|
|
* @return 响应类
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/verify")
|
|
|
|
|
@ApiOperation(value = "登录获取token")
|
|
|
|
|
public AjaxResult verificationCode() {
|
|
|
|
|
LocalDate cacheObject = redisCache.getCacheObject("88888888");
|
|
|
|
|
if (cacheObject != null) {
|
|
|
|
|
return AjaxResult.success(true);
|
|
|
|
|
} else {
|
|
|
|
|
return AjaxResult.success(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据校验码校验
|
|
|
|
|
*
|
|
|
|
|
* @param verificationCode 校验码
|
|
|
|
|
* @return 响应类
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/verificationCode")
|
|
|
|
|
@ApiOperation(value = "根据校验码校验")
|
|
|
|
|
public AjaxResult verificationCode(String verificationCode) {
|
|
|
|
|
if (!"88888888".equals(verificationCode)) {
|
|
|
|
|
throw new ServiceException("试用码错误,请重试");
|
|
|
|
|
}
|
|
|
|
|
// 获取当前日期
|
|
|
|
|
LocalDate startDate = LocalDate.now();
|
|
|
|
|
LocalDate endDate = startDate.plusMonths(3);
|
|
|
|
|
long daysBetween = ChronoUnit.DAYS.between(startDate, endDate);
|
|
|
|
|
redisCache.setCacheObject(verificationCode, startDate, Math.toIntExact(daysBetween), TimeUnit.DAYS);
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录获取token
|
|
|
|
|
*/
|
|
|
|
|