瀏覽代碼

聚划算报表

syh 4 年之前
父節點
當前提交
9d9e6d5cba

+ 236 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/JhsBakendDataController.java

@@ -0,0 +1,236 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.JhsBakendData;
+import org.jeecg.modules.ctop.service.IJhsBakendDataService;
+import org.jeecg.modules.excelutil.ExcelUtils;
+import org.jeecg.modules.excelutil.JhsBakendDataExcelListener;
+import org.jeecg.modules.excelutil.entity.JhsBakendDataEntity;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+ /**
+ * 聚划算后端数据
+ * @author jeecg-boot
+ * @date   2020-09-07
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="聚划算后端数据")
+@RestController
+@RequestMapping("/okr/jhsBakendData")
+public class JhsBakendDataController {
+	@Autowired
+	private IJhsBakendDataService jhsBakendDataService;
+
+	/**
+	  * 分页列表查询
+	 * @param jhsBakendData
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<JhsBakendData>> queryPageList(JhsBakendData jhsBakendData,
+													  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													  HttpServletRequest req) {
+		Result<IPage<JhsBakendData>> result = new Result<>();
+		QueryWrapper<JhsBakendData> queryWrapper = QueryGenerator.initQueryWrapper(jhsBakendData, req.getParameterMap());
+		Page<JhsBakendData> page = new Page<JhsBakendData>(pageNo, pageSize);
+		IPage<JhsBakendData> pageList = jhsBakendDataService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param jhsBakendData
+	 * @return
+	 */
+	@ApiOperation(value="聚划算后端数据-添加", notes="聚划算后端数据-添加")
+	@PostMapping(value = "/add")
+	public Result<JhsBakendData> add(@RequestBody JhsBakendData jhsBakendData) {
+		Result<JhsBakendData> result = new Result<>();
+		try {
+			jhsBakendDataService.save(jhsBakendData);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param jhsBakendData
+	 * @return
+	 */
+	@ApiOperation(value="聚划算后端数据-编辑", notes="聚划算后端数据-编辑")
+	@PutMapping(value = "/edit")
+	public Result<JhsBakendData> edit(@RequestBody JhsBakendData jhsBakendData) {
+		Result<JhsBakendData> result = new Result<JhsBakendData>();
+		JhsBakendData jhsBakendDataEntity = jhsBakendDataService.getById(jhsBakendData.getId());
+		if(jhsBakendDataEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = jhsBakendDataService.updateById(jhsBakendData);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="聚划算后端数据-通过id删除", notes="聚划算后端数据-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			jhsBakendDataService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="聚划算后端数据-批量删除", notes="聚划算后端数据-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<JhsBakendData> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<JhsBakendData> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.jhsBakendDataService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="聚划算后端数据-通过id查询", notes="聚划算后端数据-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<JhsBakendData> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<JhsBakendData> result = new Result<>();
+		JhsBakendData jhsBakendData = jhsBakendDataService.getById(id);
+		if(jhsBakendData==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(jhsBakendData);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<JhsBakendData> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              JhsBakendData jhsBakendData = JSON.parseObject(deString, JhsBakendData.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(jhsBakendData, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<JhsBakendData> pageList = jhsBakendDataService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "聚划算后端数据列表");
+      mv.addObject(NormalExcelConstants.CLASS, JhsBakendData.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("聚划算后端数据列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+	  //1.读Excel
+	  MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+	  Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+	  for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+		  FileInputStream fis = null;
+		  try {
+			  MultipartFile file = entity.getValue();
+			  fis = (FileInputStream) file.getInputStream();
+			  AnalysisEventListener listener = new JhsBakendDataExcelListener();
+			  Boolean flag = ExcelUtils.readExcel(fis, JhsBakendDataEntity.class, listener);
+			  System.out.println("导入是否成功:" + flag);
+		  } catch (Exception e) {
+			  e.printStackTrace();
+		  } finally {
+			  if (fis != null) {
+				  try {
+					  fis.close();
+				  } catch (IOException e) {
+					  e.printStackTrace();
+				  }
+			  }
+		  }
+	  }
+	  return Result.ok("文件导入成功!");
+  }
+
+}

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

@@ -0,0 +1,55 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.modules.excelutil.entity.JhsBakendDataEntity;
+
+import java.util.Date;
+
+/**
+ * 聚划算后端数据
+ * @author jeecg-boot
+ * @date   2020-09-07
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_jhs_bakend_data")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class JhsBakendData {
+
+	@TableId
+	private String id;
+	private String stateDate;
+	private String productLine;
+	private String taskName;
+	private String clientName;
+	private String channelId;
+	private String channelName;
+	private String adId;
+	private Long pageView;
+	private Long dealNumber;
+	private Date createTime;
+	private Date updateTime;
+
+	public JhsBakendData(JhsBakendDataEntity dataEntity) {
+		this.adId = dataEntity.getAdId();
+		this.stateDate = dataEntity.getStateDate();
+		this.productLine = dataEntity.getProductLine();
+		this.taskName = dataEntity.getTaskName();
+		this.clientName = dataEntity.getClientName();
+		this.channelId = dataEntity.getChannelId();
+		this.channelName = dataEntity.getChannelName();
+		this.pageView = dataEntity.getPageView();
+		this.dealNumber = dataEntity.getDealNumber();
+		this.updateTime = new Date();
+		this.createTime = new Date();
+		this.id = adId+stateDate;
+	}
+
+	public JhsBakendData() {
+	}
+}

+ 21 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/JhsBakendDataMapper.java

@@ -0,0 +1,21 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.ctop.entity.JhsBakendData;
+import org.jeecg.modules.excelutil.entity.JhsBakendDataEntity;
+
+import java.util.List;
+
+/**
+ * 聚划算后端数据
+ * @author: jeecg-boot
+ * @date:   2020-09-07
+ * @cersion: V1.0
+ */
+public interface JhsBakendDataMapper extends BaseMapper<JhsBakendData> {
+
+    void replaceData(@Param(value = "bakendData") JhsBakendData getData);
+
+    void replaceBatch(@Param(value = "datas")List<JhsBakendDataEntity> datas);
+}

+ 60 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/JhsBakendDataMapper.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.ctop.mapper.JhsBakendDataMapper">
+
+    <insert id="replaceData">
+        REPLACE INTO
+            ctop_jhs_bakend_data
+            (id,state_date,
+            product_line,
+            task_name,
+            client_name,
+            channel_id,
+            channel_name,
+            ad_id,
+            page_view,
+            deal_number)
+            VALUES(
+                #{bakendData.id},
+                #{bakendData.stateDate},
+                #{bakendData.productLine},
+                #{bakendData.taskName},
+                #{bakendData.clientName},
+                #{bakendData.channelId},
+                #{bakendData.channelName},
+                #{bakendData.adId},
+                #{bakendData.pageView},
+                #{bakendData.dealNumber}
+                )
+    </insert>
+    <insert id="replaceBatch">
+        REPLACE INTO
+        ctop_jhs_bakend_data
+        (id,state_date,
+        product_line,
+        task_name,
+        client_name,
+        channel_id,
+        channel_name,
+        ad_id,
+        page_view,
+        vistor,
+        deal_number)
+            values
+            <foreach collection="datas" item="bakendData" separator=",">
+                (
+                '${bakendData.adId}${bakendData.stateDate}${bakendData.clientName}${bakendData.channelId}',
+                #{bakendData.stateDate},
+                #{bakendData.productLine},
+                #{bakendData.taskName},
+                #{bakendData.clientName},
+                #{bakendData.channelId},
+                #{bakendData.channelName},
+                #{bakendData.adId},
+                #{bakendData.pageView},
+                #{bakendData.vistor},
+                #{bakendData.dealNumber}
+                )
+            </foreach>
+    </insert>
+</mapper>

+ 21 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IJhsBakendDataService.java

@@ -0,0 +1,21 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.JhsBakendData;
+import org.jeecg.modules.excelutil.entity.JhsBakendDataEntity;
+
+import java.util.List;
+
+/**
+ * @Description: 聚划算后端数据
+ * @Author: jeecg-boot
+ * @Date:   2020-09-07
+ * @Version: V1.0
+ */
+public interface IJhsBakendDataService extends IService<JhsBakendData> {
+    public void saveOrUpdateEntity(JhsBakendDataEntity dataEntity);
+
+    void replaceEntity(JhsBakendDataEntity dataEntity);
+
+    void replaceEntityList(List<JhsBakendDataEntity> datas);
+}

+ 58 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/JhsBakendDataServiceImpl.java

@@ -0,0 +1,58 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.JhsBakendData;
+import org.jeecg.modules.ctop.mapper.JhsBakendDataMapper;
+import org.jeecg.modules.ctop.service.IJhsBakendDataService;
+import org.jeecg.modules.excelutil.entity.JhsBakendDataEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 聚划算后端数据
+ * @author jeecg-boot
+ * @date   2020-09-07
+ * @version V1.0
+ */
+@Service
+public class JhsBakendDataServiceImpl extends ServiceImpl<JhsBakendDataMapper, JhsBakendData> implements IJhsBakendDataService {
+    @Autowired
+    private JhsBakendDataMapper bakendDataMapper;
+    @Override
+    public void saveOrUpdateEntity(JhsBakendDataEntity dataEntity) {
+        QueryWrapper<JhsBakendData> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("state_date", dataEntity.getStateDate());
+        queryWrapper.eq("ad_id", dataEntity.getAdId());
+        JhsBakendData getData = this.getOne(queryWrapper);
+        if (null == getData) {
+            getData = new JhsBakendData(dataEntity);
+            this.save(getData);
+        } else {
+            getData.setStateDate(dataEntity.getStateDate());
+            getData.setProductLine(dataEntity.getProductLine());
+            getData.setTaskName(dataEntity.getTaskName());
+            getData.setClientName(dataEntity.getClientName());
+            getData.setChannelId(dataEntity.getChannelId());
+            getData.setChannelName(dataEntity.getChannelName());
+            getData.setPageView(dataEntity.getPageView());
+            getData.setDealNumber(dataEntity.getDealNumber());
+            getData.setUpdateTime(new Date());
+            this.updateById(getData);
+        }
+    }
+
+    @Override
+    public void replaceEntity(JhsBakendDataEntity dataEntity) {
+        JhsBakendData getData = new JhsBakendData(dataEntity);
+        bakendDataMapper.replaceData(getData);
+    }
+
+    @Override
+    public void replaceEntityList(List<JhsBakendDataEntity> datas) {
+        bakendDataMapper.replaceBatch(datas);
+    }
+}

+ 29 - 18
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/JhsBakendDataExcelListener.java

@@ -4,8 +4,8 @@ import cn.com.ctop.common.module.utils.SpringUtils;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.alibaba.excel.event.AnalysisEventListener;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.service.impl.KuaishouChannelRegInfoServiceImpl;
-import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
+import org.jeecg.modules.ctop.service.impl.JhsBakendDataServiceImpl;
+import org.jeecg.modules.excelutil.entity.JhsBakendDataEntity;
 
 
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -13,35 +13,46 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
-public class JhsBakendDataExcelListener extends AnalysisEventListener {
+public class JhsBakendDataExcelListener extends AnalysisEventListener<JhsBakendDataEntity> {
     //自定义用于暂时存储data。
     //自定义用于暂时存储data。
     //可以通过实例获取该值
     //可以通过实例获取该值
-    private List<Object> datas = new ArrayList<>();
+    private List<JhsBakendDataEntity> datas = new ArrayList<>();
+    private static final int BATCH_COUNT = 200;
 
 
     @Override
     @Override
-    public void invoke(Object object, AnalysisContext context) {
+    public void invoke(JhsBakendDataEntity object, AnalysisContext context) {
         //数据存储到list,供批量处理,或后续自己业务逻辑处理。
         //数据存储到list,供批量处理,或后续自己业务逻辑处理。
+        String date = object.getStateDate();
+        String formatDate = date.substring(0,4)+"-"+date.substring(4,6)+"-"+date.substring(6,8);
+        object.setStateDate(formatDate);
+        object.setVistor(object.getTaskName().split("-")[1]);
         datas.add(object);
         datas.add(object);
-        //根据自己业务做处理
-        doSomething(object);
+        if(null!=datas&&datas.size()>=BATCH_COUNT){
+            saveDate();
+            datas.clear();
+        }
+    }
+
+    private void saveDate() {
+        JhsBakendDataServiceImpl dataService = SpringUtils.getApplicationContext().getBean(JhsBakendDataServiceImpl.class);
+        dataService.replaceEntityList(datas);
     }
     }
 
 
     private void doSomething(Object object) {
     private void doSomething(Object object) {
         //入库调用接口
         //入库调用接口
-        KuaishouChannelRegInfoEntity regInfo = (KuaishouChannelRegInfoEntity) object;
-        regInfo.setCreateTime(new Date());
-        regInfo.setUpdateTime(new Date());
-        regInfo.setChannelCode(regInfo.getChannelCode() + "_" + regInfo.getChildChannelCode());
-        String date = regInfo.getStateDate();
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
+        JhsBakendDataEntity dataEntity = (JhsBakendDataEntity) object;
+        dataEntity.setCreateTime(new Date());
+        dataEntity.setUpdateTime(new Date());
+        String date = dataEntity.getStateDate();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
         try {
         try {
             date = DateUtils.formatDate(dateFormat.parse(date));
             date = DateUtils.formatDate(dateFormat.parse(date));
         } catch (ParseException e) {
         } catch (ParseException e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-        regInfo.setStateDate(date);
-        KuaishouChannelRegInfoServiceImpl regInfoService = SpringUtils.getApplicationContext().getBean(KuaishouChannelRegInfoServiceImpl.class);
-        regInfoService.saveOrUpdateBychannelCodeAndDate(regInfo);
+        dataEntity.setStateDate(date);
+        JhsBakendDataServiceImpl dataService = SpringUtils.getApplicationContext().getBean(JhsBakendDataServiceImpl.class);
+        dataService.replaceEntity(dataEntity);
     }
     }
 
 
     @Override
     @Override
@@ -49,11 +60,11 @@ public class JhsBakendDataExcelListener extends AnalysisEventListener {
         // datas.clear();//解析结束销毁不用的资源
         // datas.clear();//解析结束销毁不用的资源
     }
     }
 
 
-    public List<Object> getDatas() {
+    public List<JhsBakendDataEntity> getDatas() {
         return datas;
         return datas;
     }
     }
 
 
-    public void setDatas(List<Object> datas) {
+    public void setDatas(List<JhsBakendDataEntity> datas) {
         this.datas = datas;
         this.datas = datas;
     }
     }
 }
 }

+ 12 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/JhsBakendDataEntity.java

@@ -21,12 +21,13 @@ public class JhsBakendDataEntity extends BaseRowModel {
     private String channelId;
     private String channelId;
     @ExcelProperty(index = 5, value = "渠道名称")
     @ExcelProperty(index = 5, value = "渠道名称")
     private String channelName;
     private String channelName;
-    @ExcelProperty(index = 5, value = "adid")
+    @ExcelProperty(index = 6, value = "adid")
     private String adId;
     private String adId;
-    @ExcelProperty(index = 5, value = "页面访问UV x")
+    @ExcelProperty(index = 7, value = "页面访问UV x")
     private Long pageView;
     private Long pageView;
-    @ExcelProperty(index = 5, value = "成交笔数 y")
+    @ExcelProperty(index = 8, value = "成交笔数 y")
     private Long dealNumber;
     private Long dealNumber;
+    private String vistor;
     private Date createTime;
     private Date createTime;
     private Date updateTime;
     private Date updateTime;
 
 
@@ -120,4 +121,12 @@ public class JhsBakendDataEntity extends BaseRowModel {
     public void setUpdateTime(Date updateTime) {
     public void setUpdateTime(Date updateTime) {
         this.updateTime = updateTime;
         this.updateTime = updateTime;
     }
     }
+
+    public String getVistor() {
+        return vistor;
+    }
+
+    public void setVistor(String vistor) {
+        this.vistor = vistor;
+    }
 }
 }

+ 2 - 2
jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties

@@ -1,9 +1,9 @@
 #mysql
 #mysql
 diver_name=com.mysql.jdbc.Driver
 diver_name=com.mysql.jdbc.Driver
-url=jdbc:mysql://139.186.27.96:3306/okr?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+url=jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
 username=hcst
 username=hcst
 password=test@20190531
 password=test@20190531
-database_name=okr
+database_name=jeecg-boot
 #oracle
 #oracle
 #diver_name=oracle.jdbc.driver.OracleDriver
 #diver_name=oracle.jdbc.driver.OracleDriver
 #url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL
 #url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL

+ 10 - 6
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -11,7 +11,6 @@ import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
@@ -42,15 +41,20 @@ public class SampleTest {
     @Autowired
     @Autowired
     private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
     private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
     @Autowired
     @Autowired
-    private IKuaiShouDailyAgentService kuaiShouDailyAgentService;
-    @Autowired
     private IReportService reportService;
     private IReportService reportService;
     @Autowired
     @Autowired
-    private IByteDanceAdvertiserDataService byteDanceAdvertiserDataService;
-
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
     @Test
     @Test
     public void loadBytedanceCreativeData() {
     public void loadBytedanceCreativeData() {
-        byteDanceAdvertiserDataService.advertiserList("2093115cd521740b024a5811d361712e0b5c3303");
+        List<UserAllocation>allocations = userAllocationService.getByParams(633L,null,0);
+        if(null!=allocations&&!allocations.isEmpty()){
+            for (UserAllocation allocation:allocations) {
+                CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
+                advertiserDataService.getAdvertiserPlan(token, "", null, null);
+            }
+        }
     }
     }
 
 
     @Autowired
     @Autowired