|
@@ -41,8 +41,17 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
|
|
@Slf4j
|
|
@Slf4j
|
|
public class TestController {
|
|
public class TestController {
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private CtopOauthTokenMapper tokenMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICtopOauthTokenService oauthTokenService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMaterialCutFrameService cutFrameService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IKuaiShouVideoGetService videoGetService;
|
|
|
|
+ @Autowired
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private CtopOauthTokenMapper oauthTokenMapper;
|
|
private CtopOauthTokenMapper oauthTokenMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -63,6 +72,7 @@ public class TestController {
|
|
static ExecutorService videoService = Executors.newFixedThreadPool(5);
|
|
static ExecutorService videoService = Executors.newFixedThreadPool(5);
|
|
static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
|
|
static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
|
|
|
|
|
|
|
|
+
|
|
@GetMapping(value = "/t")
|
|
@GetMapping(value = "/t")
|
|
public String test() {
|
|
public String test() {
|
|
Result<String> result = new Result<>();
|
|
Result<String> result = new Result<>();
|
|
@@ -83,26 +93,10 @@ public class TestController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private CtopOauthTokenMapper tokenMapper;
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private ICtopOauthTokenService oauthTokenService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private IMaterialCutFrameService cutFrameService;
|
|
|
|
- @Autowired
|
|
|
|
- IKuaiShouVideoGetService videoGetService;
|
|
|
|
-
|
|
|
|
|
|
|
|
@GetMapping(value = "/getSuZhao")
|
|
@GetMapping(value = "/getSuZhao")
|
|
public void getSuZhao() throws JobExecutionException {
|
|
public void getSuZhao() throws JobExecutionException {
|
|
-
|
|
|
|
try {
|
|
try {
|
|
-
|
|
|
|
//1:查询当日数据
|
|
//1:查询当日数据
|
|
QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.eq("media_id", 2);
|
|
queryWrapper.eq("media_id", 2);
|
|
@@ -113,9 +107,8 @@ public class TestController {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- executorService = Executors.newFixedThreadPool(8);
|
|
|
|
tokens.forEach(token -> {
|
|
tokens.forEach(token -> {
|
|
- executorService.submit(new Runnable() {
|
|
|
|
|
|
+ suzhaoService.submit(new Runnable() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
//1: 获取广告主信息数据
|
|
//1: 获取广告主信息数据
|
|
@@ -172,19 +165,15 @@ public class TestController {
|
|
|
|
|
|
@GetMapping(value = "/getVideo")
|
|
@GetMapping(value = "/getVideo")
|
|
public String getVideo(String startDate, String endDate) throws IOException {
|
|
public String getVideo(String startDate, String endDate) throws IOException {
|
|
-
|
|
|
|
try {
|
|
try {
|
|
-
|
|
|
|
Thread thread = new Thread() {
|
|
Thread thread = new Thread() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
|
|
List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
|
|
-
|
|
|
|
- executorService = Executors.newFixedThreadPool(8);
|
|
|
|
list.forEach(token -> {
|
|
list.forEach(token -> {
|
|
- executorService.submit(new Runnable() {
|
|
|
|
|
|
+ videoService.submit(new Runnable() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
try {
|
|
try {
|
|
@@ -223,9 +212,7 @@ public class TestController {
|
|
|
|
|
|
@GetMapping(value = "/getVideoByAccountId")
|
|
@GetMapping(value = "/getVideoByAccountId")
|
|
public String getVideoByAccountId(Long accountId) throws IOException {
|
|
public String getVideoByAccountId(Long accountId) throws IOException {
|
|
-
|
|
|
|
try {
|
|
try {
|
|
-
|
|
|
|
Thread thread = new Thread() {
|
|
Thread thread = new Thread() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
@@ -252,8 +239,6 @@ public class TestController {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
} finally {
|
|
} finally {
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
log.info("快手物料数据同步完成");
|
|
log.info("快手物料数据同步完成");
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -267,7 +252,6 @@ public class TestController {
|
|
|
|
|
|
@GetMapping(value = "/createCutTask")
|
|
@GetMapping(value = "/createCutTask")
|
|
public String createCutTask(String startDate, String endDate) throws IOException {
|
|
public String createCutTask(String startDate, String endDate) throws IOException {
|
|
-
|
|
|
|
List<MaterialInfo> materialInfos = materialInfoService.getListByDate(startDate, endDate);
|
|
List<MaterialInfo> materialInfos = materialInfoService.getListByDate(startDate, endDate);
|
|
if (!Check.isNull(materialInfos)) {
|
|
if (!Check.isNull(materialInfos)) {
|
|
for (MaterialInfo materialInfo : materialInfos) {
|
|
for (MaterialInfo materialInfo : materialInfos) {
|
|
@@ -281,11 +265,8 @@ public class TestController {
|
|
cutFrameService.getCutFrame(materialInfo.getUrl(), code, materialParameter.getSecond(), materialParameter.getHeight(), materialParameter.getWidth());
|
|
cutFrameService.getCutFrame(materialInfo.getUrl(), code, materialParameter.getSecond(), materialParameter.getHeight(), materialParameter.getWidth());
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return "Success";
|
|
return "Success";
|
|
}
|
|
}
|
|
@@ -320,7 +301,6 @@ public class TestController {
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
Date date1 = sim.parse(startDate);
|
|
Date date1 = sim.parse(startDate);
|
|
Date date2 = sim.parse(endDate);
|
|
Date date2 = sim.parse(endDate);
|
|
-
|
|
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
tokenQueryWrapper.eq("media_id", 2);
|
|
List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
|
|
List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
|
|
@@ -328,7 +308,6 @@ public class TestController {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
for (CtopOauthToken token : ctopOauthTokens) {
|
|
kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -372,14 +351,12 @@ public class TestController {
|
|
parameterService.update(updateMaterialParameter, parameterQueryWrapper);
|
|
parameterService.update(updateMaterialParameter, parameterQueryWrapper);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
List<String> codeList = iMaterialImageInfoService.getCodeList();
|
|
List<String> codeList = iMaterialImageInfoService.getCodeList();
|
|
if (!Check.isNull(codeList)) {
|
|
if (!Check.isNull(codeList)) {
|
|
for (int i = 0; i < codeList.size(); i++) {
|
|
for (int i = 0; i < codeList.size(); i++) {
|
|
String code = codeList.get(i);
|
|
String code = codeList.get(i);
|
|
QueryWrapper<MaterialImageInfo> materialImageInfoQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<MaterialImageInfo> materialImageInfoQueryWrapper = new QueryWrapper<>();
|
|
materialImageInfoQueryWrapper.eq("code", code);
|
|
materialImageInfoQueryWrapper.eq("code", code);
|
|
-
|
|
|
|
List<MaterialImageInfo> list2 = iMaterialImageInfoService.list(materialImageInfoQueryWrapper);
|
|
List<MaterialImageInfo> list2 = iMaterialImageInfoService.list(materialImageInfoQueryWrapper);
|
|
if (list2.size() > 1) {
|
|
if (list2.size() > 1) {
|
|
for (int j = 0; j < list2.size(); j++) {
|
|
for (int j = 0; j < list2.size(); j++) {
|
|
@@ -389,7 +366,6 @@ public class TestController {
|
|
MaterialImageInfo materialImageInfo = list2.get(j);
|
|
MaterialImageInfo materialImageInfo = list2.get(j);
|
|
iMaterialImageInfoService.removeById(String.valueOf(materialImageInfo.getId()));
|
|
iMaterialImageInfoService.removeById(String.valueOf(materialImageInfo.getId()));
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|