87 lines
2.7 KiB
Java
87 lines
2.7 KiB
Java
package com.rzyc.controller;
|
|
|
|
import com.common.utils.model.SingleResult;
|
|
import com.common.utils.verification.Verification;
|
|
import com.rzyc.service.PcBusinessService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.imageio.ImageIO;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.NotNull;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.OutputStream;
|
|
|
|
/**
|
|
* @author Xuwanxin
|
|
* @date 2022-10-10
|
|
*/
|
|
@Api(tags = "企业端公共接口")
|
|
@CrossOrigin("*")
|
|
@RequestMapping("common")
|
|
@Controller
|
|
@Validated
|
|
public class CommonController extends BaseController{
|
|
|
|
@Autowired
|
|
PcBusinessService pcBusinessService;
|
|
|
|
|
|
/**
|
|
* 验证码
|
|
* @param request
|
|
* @param response
|
|
* @throws Exception
|
|
*/
|
|
@ApiOperation(value = "验证码", notes = "验证码")
|
|
@GetMapping("/generateCode")
|
|
@ResponseBody
|
|
public void generateCode(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
try {
|
|
BufferedImage image = Verification.getVerify(constantsConfigure.getGenerateCodeKey(),request);
|
|
OutputStream out = response.getOutputStream();
|
|
ImageIO.write(image, "JPEG", out);
|
|
out.flush();
|
|
out.close();
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 验证企业用户电话
|
|
* @param mobile
|
|
* @param entUserId
|
|
* @return SingleResult
|
|
* @throws Exception
|
|
*/
|
|
@ApiOperation(value = "验证企业用户电话", notes = "验证企业用户电话")
|
|
@PostMapping(value = "/validEntUserMobile")
|
|
@ResponseBody
|
|
public SingleResult validEntUserMobile(@NotNull(message = "电话不能为null") String mobile, @NotNull(message = "用户id不能为null") String entUserId)throws Exception{
|
|
return pcBusinessService.validEntUserMobile(mobile,entUserId);
|
|
}
|
|
|
|
/**
|
|
* 验证企业用户名字
|
|
* @param name
|
|
* @param entUserId
|
|
* @return SingleResult
|
|
* @throws Exception
|
|
*/
|
|
@ApiOperation(value = "验证企业用户名字", notes = "验证企业用户名字")
|
|
@PostMapping(value = "/validEntUserName")
|
|
@ResponseBody
|
|
public SingleResult validEntUserName(@NotNull(message = "名字不能为null") String name, @NotNull(message = "用户id不能为null") String entUserId)throws Exception{
|
|
return pcBusinessService.validEntUserName(name,entUserId);
|
|
}
|
|
|
|
}
|