| | |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @PostMapping |
| | | @ApiOperation(value = "体检签到登记接口") |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | public AjaxResult addOrderAndDetail(@RequestBody TjOrder tjOrder) throws Exception { |
| | | public AjaxResult addOrderAndDetail(@RequestBody TjOrder tjOrder, HttpServletRequest request) throws Exception { |
| | | // 生成Token并保存到Session中 |
| | | String token = UUID.randomUUID().toString(); // 生成一个随机字符串作为Token |
| | | request.getSession().setAttribute("token", token); |
| | | |
| | | // 获取表单中的Token并与Session中的Token比较 |
| | | String formToken = request.getParameter("token"); |
| | | if (formToken != null && formToken.equals(request.getSession().getAttribute("token"))) { |
| | | System.out.printf("=================第一次提交"); |
| | | } else { |
| | | // 重复提交了表单信息 |
| | | System.out.printf("=============================重复了"); |
| | | } |
| | | |
| | | |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | | |