package com.yingyangfly.app.controller; import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.yingyangfly.common.dto.ResultResponse; import com.yingyangfly.common.log.annotation.TraceLog; import com.yingyangfly.core.annotation.Log; import com.yingyangfly.core.domain.Face; import com.yingyangfly.core.dto.AppCurrentLoginUser; import com.yingyangfly.core.dto.CurrentLoginUser; import com.yingyangfly.core.enums.OperatorType; import com.yingyangfly.core.security.util.TokenUtil; import com.yingyangfly.core.service.FaceService; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; @Slf4j @RestController @Api(tags = "人脸照片") @RequestMapping("/face") public class FaceController { @Resource private FaceService faceService; @Autowired private TokenUtil tokenUtil; @TraceLog @PostMapping("/getHumanFace") public ResultResponse getHumanFace() { AppCurrentLoginUser appCurrentLoginUser = tokenUtil.getAppCurrentLoginUser(); List faces = faceService.selectByUserId(appCurrentLoginUser.getId()); if (faces.size()>0) { return ResultResponse.success(faces.get(0).getFaceBase()); } return ResultResponse.success(); } @Log(title = "人脸照片删除",operatorType = OperatorType.MOBILE) @PostMapping("/deleteHumanFace") @TraceLog public ResultResponse deleteHumanFace(String faceUrl) throws TencentCloudSDKException { AppCurrentLoginUser appCurrentLoginUser = tokenUtil.getAppCurrentLoginUser(); return ResultResponse.success(faceService.deleteFaceUrl(appCurrentLoginUser.getId(),faceUrl)); } }