package com.fdkankan.contro.controller; import cn.hutool.http.HttpUtil; import com.fdkankan.contro.annotation.SignVerification; import com.fdkankan.contro.common.Result; import com.fdkankan.contro.entity.ScenePlus; import com.fdkankan.contro.httpclient.MyClient; import com.fdkankan.contro.service.IInnerService; import com.fdkankan.contro.service.IScenePlusService; import com.fdkankan.contro.service.ILocalFdageLogService; import com.fdkankan.contro.vo.LocalfdageLogParamVo; import com.fdkankan.fyun.face.FYunFileServiceInterface; import com.fdkankan.model.constants.ConstantFilePath; import com.fdkankan.model.constants.UploadFilePath; import com.fdkankan.web.response.ResultData; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; /** * 场景文件上传模块 */ @Log4j2 @RestController @RequestMapping("/api/inner") public class InnerController { @Autowired private IInnerService innerService; @Autowired private IScenePlusService scenePlusService; @Autowired private ILocalFdageLogService localfdageLogService; @SignVerification @GetMapping("uploadArtificialResult") public ResultData uploadArtificialResult(String num) throws Exception { innerService.uploadArtificialResult(num); return ResultData.ok(); } /** * 内部用接口,修改场景为计算失败状态,app可以出发补拍重传 * @param num * @return * @throws Exception */ @GetMapping("updateSceneFail") public ResultData updateSceneFail(String num) throws Exception { innerService.updateSceneFail(num); return ResultData.ok(); } /** * 只是一个demo接口 * @param title * @param type * @return */ @GetMapping("listNewCameraScene") public ResultData listNewCameraScene(@RequestParam("title") String title, @RequestParam("type") String type){ List ScenePlusList = innerService.listNewCameraScene(title, type); return ResultData.ok(ScenePlusList); } /** * 只是一个demo接口 * @return */ @PostMapping("submit") public ResultData submit(String sxNum, String qjkkNum){ innerService.submit(sxNum, qjkkNum); return ResultData.ok(); } @SignVerification @PostMapping("noticeLocalfdageLogs") public ResultData noticeLocalfdageLogs(@RequestBody @Valid LocalfdageLogParamVo param) throws Exception { localfdageLogService.noticeLocalfdageLogs(param); return ResultData.ok(); } @Autowired FYunFileServiceInterface fYunFileServiceInterface; @Resource private MyClient myClient; @SignVerification @PostMapping("copyBuildScene") public ResultData copyBuildScene(@RequestBody List sources) throws Exception { Map result = new HashMap<>(); Map headerMap = new HashMap<>(); headerMap.put("X-UA", "123"); for (String source : sources) { String srcSource = source.replace("oss://4dkankan/", ""); String targetSource = srcSource.replace("linyanru", "home"); fYunFileServiceInterface.copyFileInBucketParallel(srcSource, targetSource); String dataSource = targetSource.replace("home", "/mnt/data"); String url = "https://www.4dkankan.com/api/scene/file/copyDataAndBuild?sceneVer=V4&sourceBucket=4dkankan&dataSource=" + dataSource; ResultData> resultData = myClient.get2(url, headerMap); if(resultData.getCode() == 0){ result.put(source, resultData.getData().get("code")); }else{ result.put(source, resultData.getMessage()); } } return ResultData.ok(result); } }