新增接口给大模型调用,推送资讯到全量库
This commit is contained in:
parent
14456b8270
commit
e76ad82a95
|
|
@ -7,19 +7,19 @@ import com.aliyuncs.profile.DefaultProfile;
|
|||
import com.aliyuncs.profile.IClientProfile;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jinrui.reference.admin.model.dto.newsinfo.PublishNewsInfoDTO;
|
||||
import com.jinrui.reference.admin.model.dto.oss.CloseableAcsClient;
|
||||
import com.jinrui.reference.admin.model.entity.AdminUser;
|
||||
import com.jinrui.reference.admin.model.vo.oss.OssVO;
|
||||
import com.jinrui.reference.admin.service.AdminJwtService;
|
||||
import com.jinrui.reference.core.model.vo.ResultObject;
|
||||
import com.jinrui.reference.core.service.NewsInfoService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
|
|
@ -35,6 +35,7 @@ public class CommonController {
|
|||
private final String region;
|
||||
private final String bucketName;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final NewsInfoService newsInfoService;
|
||||
|
||||
public CommonController(@Value("${oss.sts.endPoint}") String stsEndPoint,
|
||||
@Value("${oss.ak}") String ak,
|
||||
|
|
@ -43,7 +44,8 @@ public class CommonController {
|
|||
@Value("${oss.endPoint}") String endPoint,
|
||||
@Value("${oss.region}") String region,
|
||||
@Value("${oss.bucketName}") String bucketName,
|
||||
ObjectMapper objectMapper) {
|
||||
ObjectMapper objectMapper,
|
||||
NewsInfoService newsInfoService) {
|
||||
this.stsEndPoint = stsEndPoint;
|
||||
this.ak = ak;
|
||||
this.sk = sk;
|
||||
|
|
@ -52,6 +54,7 @@ public class CommonController {
|
|||
this.region = region;
|
||||
this.bucketName = bucketName;
|
||||
this.objectMapper = objectMapper;
|
||||
this.newsInfoService = newsInfoService;
|
||||
}
|
||||
|
||||
@PostMapping("/uploadKey")
|
||||
|
|
@ -117,4 +120,14 @@ public class CommonController {
|
|||
}
|
||||
return ossVO;
|
||||
}
|
||||
|
||||
@GetMapping("/sync/{id}")
|
||||
public ResultObject<Void> sync(@PathVariable("id") String id) {
|
||||
try {
|
||||
log.info("path: /sync/sync, method: GET, request news id: {}", id);
|
||||
return newsInfoService.publish(id, 1L);
|
||||
} catch (Exception e) {
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue