李旭东
2023-11-03 a07b4b6ff1c98dcf81338bb45d59308db7c058a9
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java
@@ -12,6 +12,12 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Base64;
@RestController
@RequestMapping("face")
public class FaceController {
@@ -75,9 +81,40 @@
    }
    @RequestMapping("deleteNotify")
    @RequestMapping("/deleteNotify")
    public JSONObject deleteNotify(@RequestBody String mess){
        faceServer.deleteNotify(mess);
        faceServer.removeNotify(mess);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code",0);
        jsonObject.put("msg","OK");
        jsonObject.put("success",true);
        return jsonObject;
    }
    @RequestMapping("/showFaceImg")
    public void showFaceImg(String recordId, HttpServletResponse response){
        String oriStr = faceServer.queryOriStrById(recordId);
        byte[] bytes = Base64.getDecoder().decode(oriStr);
        OutputStream outputStream = null;
        try {
            outputStream = response.getOutputStream();
            outputStream.write(bytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                if (outputStream!=null) {
                    outputStream.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
    @RequestMapping("/allPerson")
    public JSONObject allPerson(@RequestBody String mess){
        faceServer.allPerson(mess);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code",0);
        jsonObject.put("msg","OK");