|
|
@@ -2,6 +2,8 @@ package com.ytpm.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.text.CharSequenceUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
@@ -76,23 +78,6 @@ public class AgentAppServiceImpl implements AgentAppService {
|
|
|
if(CollUtil.isEmpty(views)){
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(new ArrayList<>()));
|
|
|
}
|
|
|
- List<String> appIds = views.stream().map(AgentAppView::getAppId).collect(Collectors.toList());
|
|
|
- ComprehensiveReportParam param = new ComprehensiveReportParam();
|
|
|
- param.setGroup_by(Collections.singletonList("app"));
|
|
|
- param.setStartdate(DateUtil.getDateNum(LocalDate.now().minusDays(7)));
|
|
|
- param.setEnddate(DateUtil.getDateNum(LocalDate.now()));
|
|
|
- param.setTime_zone("UTC-8");
|
|
|
- param.setApp_id_list(appIds);
|
|
|
- List<ComprehensiveAppReport> appReport = advertiseFeign.getAppReport(param);
|
|
|
- Map<String, ComprehensiveAppReport> reportMap = new HashMap<>();
|
|
|
- if(CollUtil.isNotEmpty(appReport)){
|
|
|
- reportMap = appReport.stream().collect(Collectors.toMap(
|
|
|
- s -> s.getApp().getId(), O -> O));
|
|
|
- }
|
|
|
- for (AgentAppView view : views) {
|
|
|
- if(!reportMap.containsKey(view.getAppId()))continue;
|
|
|
- BeanUtil.copyProperties(reportMap.get(view.getAppId()), view);
|
|
|
- }
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(views));
|
|
|
}
|
|
|
|
|
|
@@ -101,42 +86,21 @@ public class AgentAppServiceImpl implements AgentAppService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Result<?> saveApp(AppParam param, String userId) {
|
|
|
- //构造API对象
|
|
|
- AddAppParam addAppParam = new AddAppParam(param);
|
|
|
- Result<AddAppResponse> result = null;
|
|
|
- //调用广告平台API 增加应用
|
|
|
- try {
|
|
|
- result=advertiseFeign.saveApp(addAppParam);
|
|
|
- }catch (Exception e){
|
|
|
- log.error("参数错误{}",e);
|
|
|
- }
|
|
|
//数据库操作,有appId为修改, 没有时为新增
|
|
|
- changeDataAction(param,result,userId);
|
|
|
+ changeDataAction(param,userId);
|
|
|
return Result.resultOk(RepMessage.SAVE_SUCCESS);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 处理数据库数据变更操作
|
|
|
*/
|
|
|
- private void changeDataAction(AppParam param, Result<AddAppResponse> result, String userId) {
|
|
|
+ private void changeDataAction(AppParam param, String userId) {
|
|
|
YtApp app = new YtApp();
|
|
|
BeanUtil.copyProperties(param, app);
|
|
|
- if(StrUtil.isNotBlank(param.getAppId())){
|
|
|
- app.setScreenOrientation(param.getScreen_orientation());
|
|
|
- app.setPackageName(param.getPackage_name());
|
|
|
- app.setStoreOnSale(param.getStore_on_sale());
|
|
|
- app.setStoreUrl(param.getStore_url());
|
|
|
+ if(CharSequenceUtil.isNotBlank(param.getAppId())){
|
|
|
appMapper.updateOne(app);
|
|
|
}else{
|
|
|
- log.debug("result{}",result);
|
|
|
- AddAppResponse data = result.getData();
|
|
|
- BeanUtil.copyProperties(param, app);
|
|
|
- app.setScreenOrientation(param.getScreen_orientation());
|
|
|
- app.setPackageName(param.getPackage_name());
|
|
|
- app.setStoreOnSale(param.getStore_on_sale());
|
|
|
- app.setStoreUrl(param.getStore_url());
|
|
|
- app.setAppId(data.getUuid());
|
|
|
- app.setAppKey(data.getApp_key());
|
|
|
+ app.setAppId(IdUtil.fastSimpleUUID());
|
|
|
app.setUserId(userId);
|
|
|
app.setEnabled(1);
|
|
|
appMapper.insertOne(app);
|
|
|
@@ -152,7 +116,7 @@ public class AgentAppServiceImpl implements AgentAppService {
|
|
|
if(Objects.isNull(ytApp)|| !userId.equals(ytApp.getUserId())){
|
|
|
Result.resultErr(RepMessage.NOT_PERMIT);
|
|
|
}
|
|
|
- advertiseFeign.delApp(appId);
|
|
|
+// advertiseFeign.delApp(appId);
|
|
|
appMapper.deleteApp(appId);
|
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
|
}
|
|
|
@@ -167,7 +131,7 @@ public class AgentAppServiceImpl implements AgentAppService {
|
|
|
if(Objects.isNull(ytApp)){
|
|
|
Result.resultErr(RepMessage.OBJECT_NOT_EXIST);
|
|
|
}
|
|
|
- advertiseFeign.relativePlatform(param);
|
|
|
+// advertiseFeign.relativePlatform(param);
|
|
|
YtAppChannelRelative ytAppChannelRelative = new YtAppChannelRelative();
|
|
|
ytAppChannelRelative.setRelativeId(UUID.randomUUID().toString().replace("-",""));
|
|
|
ytAppChannelRelative.setAppId(param.getAppId());
|