123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package cn.efunbox.audio.controller.hag;
- import cn.efunbox.audio.service.hag.HagContentService;
- import cn.efunbox.audio.service.hag.HagOrderService;
- import cn.efunbox.audio.utils.BaseConstant;
- import cn.efunbox.audio.vo.hag.HagSkillReq;
- import cn.efunbox.audio.vo.hag.HagSkillResp;
- import com.alibaba.fastjson.JSON;
- 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.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.Objects;
- /**
- * HaOrderController
- * Created by xusq on 2019/12/25.
- */
- @Slf4j
- @RequestMapping("/api/hag/v1/auth")
- @RestController
- public class HagOrderController {
- @Autowired
- private HagOrderService hagOrderService;
- @Autowired
- private HagContentService hagContentService;
- @PostMapping
- public HagSkillResp sync(@RequestBody HagSkillReq skillReq) {
- log.info("HAG sync param : {}", JSON.toJSONString(skillReq));
- HagSkillResp hagSkillResp = new HagSkillResp();
- HagSkillReq.HagHeader header = skillReq.getHeader();
- if (Objects.isNull(header)) {
- return hagSkillResp;
- }
- if (Objects.equals(BaseConstant.HAG_SYNC_ORDER_TYPE,header.getType())) {
- hagSkillResp = hagOrderService.save(skillReq);
- } else {
- hagSkillResp = hagContentService.getResUrl(skillReq);
- }
- return hagSkillResp;
- }
- }
|