Browse Source

修改代码逻辑

songyinghao 5 years ago
parent
commit
abeba2c4b6

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -143,7 +143,8 @@ public class ShiroConfig {
 		//爬虫接口
 		filterChainDefinitionMap.put("/graphql/video", "anon");
 		filterChainDefinitionMap.put("/ks/web/test", "anon");
-
+		filterChainDefinitionMap.put("/ctop/materialInfo/excellent/set", "anon");
+        filterChainDefinitionMap.put("/ctop/materialInfo/excellent/list", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
 
 		// 添加自己的过滤器并且取名为jwt

+ 4 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -73,7 +73,6 @@ public class MaterialInfoController {
     @GetMapping(value = "/report")
     public JSONObject report(String userId) {
         return materialInfoService.report(userId);
-
     }
 
 
@@ -94,10 +93,10 @@ public class MaterialInfoController {
         return result;
     }
 
-    @PostMapping("excellent/set")
-    public Result<Object> setExcellent(@RequestParam(name = "id") String id, @RequestParam(name = "excellent") Integer excellent) {
+    @GetMapping("excellent/set")
+    public Result<Object> setExcellent(@RequestParam(name = "id") String code, @RequestParam(name = "excellent") Integer excellent) {
         Result<Object> result = new Result<>();
-        materialInfoService.setExcellent(id, excellent);
+        materialInfoService.setExcellent(code, excellent);
         result.setCode(200);
         result.setSuccess(true);
         result.setMessage("设置成功");
@@ -117,7 +116,7 @@ public class MaterialInfoController {
     @Autowired
     private IProjectMemberService memberService;
 
-    @PostMapping("/excellent/list")
+    @GetMapping("/excellent/list")
     public Result<IPage<MaterialInfo>> excellentList(MaterialInfo materialInfo,
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Advertiser.java

@@ -47,6 +47,12 @@ public class Advertiser {
     @ApiModelProperty(value = "行业ID")
     private String industryId;
     /**
+     * 销售ID
+     */
+    @Excel(name = "销售ID", width = 15)
+    @ApiModelProperty(value = "销售ID")
+    private String saleId;
+    /**
      * 联系人姓名
      */
     @Excel(name = "联系人姓名", width = 15)

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java

@@ -72,6 +72,8 @@ public class BytedancePlanDailyReportLoadJob implements Job {
                             report.setMaterialType("大字报");
                         }else if(tag.contains("文字动画")){
                             report.setMaterialType("文字动画");
+                        }else if(tag.contains("采访形式")){
+                            report.setMaterialType("采访形式");
                         }else{
                             report.setMaterialType("其他");
                         }

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -105,7 +105,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://39.97.120.42:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver

+ 28 - 13
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -46,23 +46,20 @@ public class SampleTest {
     @Test
     public void getBytedancePlanReport(){
 
-        Date getDate = DateUtils.addDay(new Date(), -4);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条数据异常:为获取到可用的token");
-            return;
-        }
-        tokens.forEach(token -> {
-           //3:获取广告计划信息数据
-            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        });
-
-        //清洗关于作业帮数据
+        Date getDate = DateUtils.addDay(new Date(), -1);
         //1:查询作业帮相关的用户数据
         QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
         wrapper.eq("project_id",215);
         List<UserAllocation> allocations = userAllocationService.list(wrapper);
+        if(null!=allocations){
+            allocations.forEach(allocation->{
+                CtopOauthToken token = tokenService.getOauthTokenByAccountId(allocation.getAccountId()+"");
+                //3:获取广告计划信息数据
+                reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            });
+        }
+
+        //清洗关于作业帮数据
         if(null!=allocations&&allocations.size()>0){
             allocations.forEach(allocation->{
                 //根据accountId和时间,查询相关的日报表信息
@@ -90,6 +87,8 @@ public class SampleTest {
                             report.setMaterialType("大字报");
                         }else if(tag.contains("文字动画")){
                             report.setMaterialType("文字动画");
+                        }else if(tag.contains("采访形式")){
+                            report.setMaterialType("采访形式");
                         }else{
                             report.setMaterialType("其他");
                         }
@@ -100,6 +99,22 @@ public class SampleTest {
         }
     }
 
+
+    @Test
+    public void getBytedancePlanHourReport(){
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:为获取到可用的token");
+            return;
+        }
+        tokens.forEach(token -> {
+            //3:获取广告计划信息数据
+            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        });
+    }
+
     @Test
     public void loadRegistOrderData(){
 

+ 2 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -407,8 +407,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public void setExcellent(String id, Integer excellent) {
-        MaterialInfo info = this.getById(id);
+    public void setExcellent(String code, Integer excellent) {
+        MaterialInfo info = this.getMaterialInfoByCode(code);
         info.setExcellent(excellent);
         this.updateById(info);
     }

+ 2 - 2
module-report/pom.xml

@@ -46,10 +46,10 @@
             <version>2.0.2</version>
             <scope>compile</scope>
         </dependency>
-        <dependency>
+        <!--<dependency>
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-boot-base-common</artifactId>
-        </dependency>
+        </dependency>-->
     </dependencies>
 
     <build>