|
@@ -0,0 +1,49 @@
|
|
|
+package com.sxtvs.open.api.odata.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.sxtvs.open.api.odata.dto.weibo.YMWeiboAccount;
|
|
|
+import com.sxtvs.open.api.odata.entity.WbYmAccount;
|
|
|
+import com.sxtvs.open.api.odata.mapper.WbYmAccountMapper;
|
|
|
+import com.sxtvs.open.api.odata.service.IWbYmAccountService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.sxtvs.open.api.youmei.service.YoumeiAccountServiceImpl;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author syj
|
|
|
+ * @since 2023-03-16
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class WbYmAccountServiceImpl extends ServiceImpl<WbYmAccountMapper, WbYmAccount> implements IWbYmAccountService {
|
|
|
+ @Resource
|
|
|
+ private YoumeiAccountServiceImpl youmeiAccountService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ObjectMapper objectMapper;
|
|
|
+
|
|
|
+ public void upsert(String networkGroupId) throws JsonProcessingException {
|
|
|
+ String accessToken = youmeiAccountService.getSxgdAccount().getAccessToken();
|
|
|
+ String body = HttpUtil.createPost("https://api-open.51wyq.cn/dataapp/api/umei/fw/open/network_group/get_weibo_user_info")
|
|
|
+ .form(Map.of("accessToken", accessToken, "network_group_ids", new String[]{networkGroupId}))
|
|
|
+ .execute().body();
|
|
|
+ YMWeiboAccount o = objectMapper.readValue(body, YMWeiboAccount.class);
|
|
|
+
|
|
|
+ WbYmAccount wbYmAccount = new WbYmAccount();
|
|
|
+ wbYmAccount.setGroupUid(o.getData().get(0).getGroupUid());
|
|
|
+ wbYmAccount.setNetworkGroupId(o.getData().get(0).getNetworkGroupId());
|
|
|
+ wbYmAccount.setNickName(o.getData().get(0).getUser().getName());
|
|
|
+ wbYmAccount.setGroupType(1);
|
|
|
+ wbYmAccount.setUpdateTime(LocalDateTime.now());
|
|
|
+ saveOrUpdate(wbYmAccount);
|
|
|
+ }
|
|
|
+}
|