Forráskód Böngészése

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-cloud

zhaoxian 3 éve
szülő
commit
a8247e56e7
26 módosított fájl, 1548 hozzáadás és 16 törlés
  1. 1 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. 5 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  3. 19 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  4. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java
  5. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  6. 11 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java
  7. 8 3
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  8. 264 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/controller/ProjectMonitorWhiteListController.java
  9. 260 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/controller/TrackMonitorConfigureController.java
  10. 308 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/controller/TrackMonitorLogsController.java
  11. 57 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/entity/ProjectMonitorWhiteList.java
  12. 75 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/entity/TrackMonitorConfigure.java
  13. 69 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/entity/TrackMonitorLogs.java
  14. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/ProjectMonitorWhiteListMapper.java
  15. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/TrackMonitorConfigureMapper.java
  16. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/TrackMonitorLogsMapper.java
  17. 30 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/xml/ProjectMonitorWhiteListMapper.xml
  18. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/xml/TrackMonitorConfigureMapper.xml
  19. 23 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/xml/TrackMonitorLogsMapper.xml
  20. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/IProjectMonitorWhiteListService.java
  21. 16 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/ITrackMonitorConfigureService.java
  22. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/ITrackMonitorLogsService.java
  23. 50 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/impl/ProjectMonitorWhiteListServiceImpl.java
  24. 26 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/impl/TrackMonitorConfigureServiceImpl.java
  25. 223 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/impl/TrackMonitorLogsServiceImpl.java
  26. 3 3
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

+ 1 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -217,6 +217,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/estimatePeopleNumber/**", "anon");
 
         filterChainDefinitionMap.put("/exportReportController/**", "anon");
+        filterChainDefinitionMap.put("/monitor/trackMonitorLogs/**", "anon");
 
         filterChainDefinitionMap.put("/importPolicyController/importPolicyInit", "anon");
         //filterChainDefinitionMap.put("/settLementController/**", "anon");

+ 5 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -64,11 +64,14 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     List<Long> queryAutomaticAccounts(@Param("projectId") Long projectId);
 
 
+    Map<String, Object> getCwjsSettlementByAccountId(String accountId);
 
-    Map<String,Object>getCwjsSettlementByAccountId(String accountId);
     void updCwjsSettlementStatus(@Param("id") String id, @Param("status") Integer status);
 
-    List<UserAllocation> getAccountInfoBySalesId(@Param("sales")Set<String> sales,@Param("mediaId")String mediaId,@Param("advertiserId")String advertiserId,@Param("productId")String productId);
+    List<UserAllocation> getAccountInfoBySalesId(@Param("sales") Set<String> sales, @Param("mediaId") String mediaId, @Param("advertiserId") String advertiserId, @Param("productId") String productId);
 
+    List<JSONObject> getAccountListByProjectListV2(@Param("list") List list);
+
+    List<JSONObject> getAccountListByProjectAndUserId(@Param("projectId") Long projectId, @Param("userId") String userId);
     List<Long> getAccountListByProjectId(@Param("projectId") Long projectId);
 }

+ 19 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -46,8 +46,9 @@
     <select id="getAccountListByProject" resultType="com.alibaba.fastjson.JSONObject">
        select
        t1.account_id as 'accountId',
-       (select  realname  from sys_user where  id = t1.user_id ) as 'userName',
-       t1.auth_name as 'authName'
+       t1.user_name as 'userName',
+       t1.auth_name as 'authName',
+       t1.account_status as 'accountStatus'
        from ctop_user_allocation t1
        where t1.project_id = #{projectId}
        order by t1.create_time desc
@@ -246,12 +247,7 @@
           and account_id = #{accountId}
     </select>
 
-    <!-- 根据账户id 查看财务账户 -->
-    <select id="getAccountListByProjectId" resultType="java.lang.Long">
-        select account_id from ctop_user_allocation
-        WHERE account_status = 0
-          AND project_id = #{projectId}
-    </select>
+
 
     <select id="getAccountInfoBySalesId" resultType="cn.com.ctop.common.module.entity.UserAllocation">
         select cua.*
@@ -289,6 +285,21 @@
         and t1.account_status = 0
         order by t1.create_time desc
     </select>
+    <select id="getAccountListByProjectAndUserId" resultType="com.alibaba.fastjson.JSONObject">
+        select
+       t1.account_id as 'accountId',
+       t1.user_name as 'userName',
+       t1.auth_name as 'authName',
+       t1.account_status as 'accountStatus'
+       from ctop_user_allocation t1
+       where t1.project_id = #{projectId}
+        <if test="userId !=null and userId != '' ">
+            and t1.user_id = #{userId}
+        </if>
+       order by t1.create_time desc
+
+
+    </select>
     <!-- 修改状态 -->
     <update id="updCwjsSettlementStatus">
         UPDATE ctop_cwjs_settlement_info

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java

@@ -83,4 +83,6 @@ public interface IMessageTemplate {
     String getKuaiShouBidMessage(String projectName, Long advertiserId, Long unitId, String unit_name);
 
     String getCopyCampaignMessage(String oldName, String state);
+
+    String getTrackMessage(Long accountId, Long unitId);
 }

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -71,5 +71,8 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
     Result<UserAllocation> editUserAlloCation(UserAllocation userAllocation);
 
+    Map<Long, List<JSONObject>> getAccountListByProjectListV2(List<JSONObject> projectList);
+
+    List<JSONObject> getAccountListByProjectAndUserId(Long projectId, String userId);
     List<Long> getAccountListByProjectId(Long projectId);
 }

+ 11 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java

@@ -208,5 +208,16 @@ public class MessageTemplateImpl implements IMessageTemplate {
         return text.toString();
     }
 
+    @Override
+    public String getTrackMessage(Long accountId, Long unitId) {
+        StringBuilder text = new StringBuilder();
+        text.append("监测链接错误预警").append("<br/>")
+                .append("您的账户:").append(accountId + ",").append("<br/>")
+                .append("下的组:").append(unitId + ",").append("<br/>")
+                .append("监测链接设置错误。").append("<br/>")
+                .append("系统已执行暂停此组操作,请您及时查看!");
+        return text.toString();
+    }
+
 
 }

+ 8 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -218,6 +218,11 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
+    public List<JSONObject> getAccountListByProjectAndUserId(Long projectId, String userId) {
+        return userAllocationMapper.getAccountListByProjectAndUserId(projectId, userId);
+    }
+
+    @Override
     public List<JSONObject> getUserIdListByProductId(Long productId) {
         return userAllocationMapper.getUserIdListByProductId(productId);
     }
@@ -310,9 +315,9 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
             }
 
             //同步 财务结算 状态
-            Map<String,Object> cwjs = userAllocationMapper.getCwjsSettlementByAccountId(String.valueOf(userAllocationEntity.getAccountId()));
-            if (!Check.isNull(cwjs)){
-                userAllocationMapper.updCwjsSettlementStatus(cwjs.get("id").toString(),accountStatus);
+            Map<String, Object> cwjs = userAllocationMapper.getCwjsSettlementByAccountId(String.valueOf(userAllocationEntity.getAccountId()));
+            if (!Check.isNull(cwjs)) {
+                userAllocationMapper.updCwjsSettlementStatus(cwjs.get("id").toString(), accountStatus);
             }
             LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             SysLog sysLog = new SysLog();

+ 264 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/controller/ProjectMonitorWhiteListController.java

@@ -0,0 +1,264 @@
+package cn.com.ctop.kuaishou.modules.clean.controller;
+
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.clean.entity.ProjectMonitorWhiteList;
+import cn.com.ctop.kuaishou.modules.clean.service.IProjectMonitorWhiteListService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+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.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+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.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 监测链接预警-项目白名单
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-23
+ */
+@Slf4j
+@Api(tags = "监测链接预警-项目白名单")
+@RestController
+@RequestMapping("/monitor/projectMonitorWhiteList")
+public class ProjectMonitorWhiteListController {
+    @Autowired
+    private IProjectMonitorWhiteListService projectMonitorWhiteListService;
+
+
+    @GetMapping(value = "/getProjectAndAccountIds")
+    public Result<List<JSONObject>> getProjectAndAccountIds(String userId) {
+        Result<List<JSONObject>> result = new Result<>();
+        List<JSONObject> list = projectMonitorWhiteListService.getProjectAndAccountIds(userId);
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param projectMonitorWhiteList
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-项目白名单-分页列表查询", notes = "监测链接预警-项目白名单-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<ProjectMonitorWhiteList>> queryPageList(ProjectMonitorWhiteList projectMonitorWhiteList,
+                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                HttpServletRequest req) {
+        Result<IPage<ProjectMonitorWhiteList>> result = new Result<>();
+        QueryWrapper<ProjectMonitorWhiteList> queryWrapper = QueryGenerator.initQueryWrapper(projectMonitorWhiteList, req.getParameterMap());
+        Page<ProjectMonitorWhiteList> page = new Page<ProjectMonitorWhiteList>(pageNo, pageSize);
+        IPage<ProjectMonitorWhiteList> pageList = projectMonitorWhiteListService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param projectMonitorWhiteList
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-项目白名单-添加", notes = "监测链接预警-项目白名单-添加")
+    @PostMapping(value = "/add")
+    public Result<ProjectMonitorWhiteList> add(@RequestBody ProjectMonitorWhiteList projectMonitorWhiteList) {
+        Result<ProjectMonitorWhiteList> result = new Result<>();
+        try {
+            Long projectId = projectMonitorWhiteList.getProjectId();
+            QueryWrapper<ProjectMonitorWhiteList> monitorWhiteListQueryWrapper = new QueryWrapper<>();
+            monitorWhiteListQueryWrapper.eq("project_id", projectId);
+            monitorWhiteListQueryWrapper.last("limit 1");
+            ProjectMonitorWhiteList one = projectMonitorWhiteListService.getOne(monitorWhiteListQueryWrapper);
+            if (!Check.isNull(one)) {
+                result.error("该项目已在白名单中");
+                return result;
+            }
+            projectMonitorWhiteListService.save(projectMonitorWhiteList);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param projectMonitorWhiteList
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-项目白名单-编辑", notes = "监测链接预警-项目白名单-编辑")
+    @PutMapping(value = "/edit")
+    public Result<ProjectMonitorWhiteList> edit(@RequestBody ProjectMonitorWhiteList projectMonitorWhiteList) {
+        Result<ProjectMonitorWhiteList> result = new Result<ProjectMonitorWhiteList>();
+        ProjectMonitorWhiteList projectMonitorWhiteListEntity = projectMonitorWhiteListService.getById(projectMonitorWhiteList.getId());
+        if (projectMonitorWhiteListEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = projectMonitorWhiteListService.updateById(projectMonitorWhiteList);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-项目白名单-通过id删除", notes = "监测链接预警-项目白名单-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            projectMonitorWhiteListService.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<ProjectMonitorWhiteList> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<ProjectMonitorWhiteList> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.projectMonitorWhiteListService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-项目白名单-通过id查询", notes = "监测链接预警-项目白名单-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<ProjectMonitorWhiteList> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<ProjectMonitorWhiteList> result = new Result<>();
+        ProjectMonitorWhiteList projectMonitorWhiteList = projectMonitorWhiteListService.getById(id);
+        if (projectMonitorWhiteList == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(projectMonitorWhiteList);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<ProjectMonitorWhiteList> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                ProjectMonitorWhiteList projectMonitorWhiteList = JSON.parseObject(deString, ProjectMonitorWhiteList.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(projectMonitorWhiteList, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<ProjectMonitorWhiteList> pageList = projectMonitorWhiteListService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "监测链接预警-项目白名单列表");
+        mv.addObject(NormalExcelConstants.CLASS, ProjectMonitorWhiteList.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) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<ProjectMonitorWhiteList> listProjectMonitorWhiteLists = ExcelImportUtil.importExcel(file.getInputStream(), ProjectMonitorWhiteList.class, params);
+                projectMonitorWhiteListService.saveBatch(listProjectMonitorWhiteLists);
+                return Result.ok("文件导入成功!数据行数:" + listProjectMonitorWhiteLists.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 260 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/controller/TrackMonitorConfigureController.java

@@ -0,0 +1,260 @@
+package cn.com.ctop.kuaishou.modules.clean.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorConfigure;
+import cn.com.ctop.kuaishou.modules.clean.service.ITrackMonitorConfigureService;
+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.system.service.ISysRoleService;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+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.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 监测链接预警-配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-23
+ */
+@Slf4j
+@Api(tags = "监测链接预警-配置")
+@RestController
+@RequestMapping("/monitor/trackMonitorConfigure")
+public class TrackMonitorConfigureController {
+    @Autowired
+    private ITrackMonitorConfigureService trackMonitorConfigureService;
+    @Autowired
+    private ISysRoleService sysRoleService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param trackMonitorConfigure
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-配置-分页列表查询", notes = "监测链接预警-配置-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<TrackMonitorConfigure>> queryPageList(TrackMonitorConfigure trackMonitorConfigure,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<TrackMonitorConfigure>> result = new Result<>();
+
+        String userId = trackMonitorConfigure.getUserId();
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if (roleCode.equals("admin")) {
+            trackMonitorConfigure.setUserId(null);
+        }
+        QueryWrapper<TrackMonitorConfigure> queryWrapper = QueryGenerator.initQueryWrapper(trackMonitorConfigure, req.getParameterMap());
+        Page<TrackMonitorConfigure> page = new Page<TrackMonitorConfigure>(pageNo, pageSize);
+        IPage<TrackMonitorConfigure> pageList = trackMonitorConfigureService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param trackMonitorConfigure
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-配置-添加", notes = "监测链接预警-配置-添加")
+    @PostMapping(value = "/add")
+    public Result<TrackMonitorConfigure> add(@RequestBody TrackMonitorConfigure trackMonitorConfigure) {
+        Result<TrackMonitorConfigure> result = new Result<>();
+        try {
+            Long accountId = trackMonitorConfigure.getAccountId();
+            QueryWrapper<TrackMonitorConfigure> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.last("limit 1");
+            TrackMonitorConfigure one = trackMonitorConfigureService.getOne(queryWrapper);
+            if (!Check.isNull(one)) {
+                result.error500("该账户预警已绑定");
+                return result;
+            }
+            trackMonitorConfigureService.save(trackMonitorConfigure);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param trackMonitorConfigure
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-配置-编辑", notes = "监测链接预警-配置-编辑")
+    @PutMapping(value = "/edit")
+    public Result<TrackMonitorConfigure> edit(@RequestBody TrackMonitorConfigure trackMonitorConfigure) {
+        Result<TrackMonitorConfigure> result = new Result<TrackMonitorConfigure>();
+        TrackMonitorConfigure trackMonitorConfigureEntity = trackMonitorConfigureService.getById(trackMonitorConfigure.getId());
+        if (trackMonitorConfigureEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = trackMonitorConfigureService.updateById(trackMonitorConfigure);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-配置-通过id删除", notes = "监测链接预警-配置-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            trackMonitorConfigureService.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<TrackMonitorConfigure> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<TrackMonitorConfigure> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.trackMonitorConfigureService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-配置-通过id查询", notes = "监测链接预警-配置-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<TrackMonitorConfigure> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<TrackMonitorConfigure> result = new Result<>();
+        TrackMonitorConfigure trackMonitorConfigure = trackMonitorConfigureService.getById(id);
+        if (trackMonitorConfigure == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(trackMonitorConfigure);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<TrackMonitorConfigure> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                TrackMonitorConfigure trackMonitorConfigure = JSON.parseObject(deString, TrackMonitorConfigure.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(trackMonitorConfigure, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<TrackMonitorConfigure> pageList = trackMonitorConfigureService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "监测链接预警-配置列表");
+        mv.addObject(NormalExcelConstants.CLASS, TrackMonitorConfigure.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) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<TrackMonitorConfigure> listTrackMonitorConfigures = ExcelImportUtil.importExcel(file.getInputStream(), TrackMonitorConfigure.class, params);
+                trackMonitorConfigureService.saveBatch(listTrackMonitorConfigures);
+                return Result.ok("文件导入成功!数据行数:" + listTrackMonitorConfigures.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 308 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/controller/TrackMonitorLogsController.java

@@ -0,0 +1,308 @@
+package cn.com.ctop.kuaishou.modules.clean.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorConfigure;
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorLogs;
+import cn.com.ctop.kuaishou.modules.clean.service.ITrackMonitorConfigureService;
+import cn.com.ctop.kuaishou.modules.clean.service.ITrackMonitorLogsService;
+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.DateUtils;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+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.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 监测链接预警-日志
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-23
+ */
+@Slf4j
+@Api(tags = "监测链接预警-日志")
+@RestController
+@RequestMapping("/monitor/trackMonitorLogs")
+public class TrackMonitorLogsController {
+    @Autowired
+    private ITrackMonitorLogsService trackMonitorLogsService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private ITrackMonitorConfigureService trackMonitorConfigureService;
+
+    /**
+     * 分页列表查询
+     */
+
+    @GetMapping(value = "/monitorCreative")
+    public void monitorCreative(Long accountId) {
+        UserAllocation userAllocation = userAllocationService.getByAccountId(accountId);
+        if (Check.isNull(userAllocation)) {
+            log.error("未获取到账户分配信息,accountId:{}", accountId);
+            return;
+        }
+        if (userAllocation.getAccountStatus() == 1) {
+            log.error("该账户已暂停投放,accountId:{}", accountId);
+            return;
+        }
+
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        if (Check.isNull(token)) {
+            log.error("该账户未获取到token信息,accountId:{}", accountId);
+            return;
+        }
+        TrackMonitorConfigure configure = trackMonitorConfigureService.getByAccountId(accountId);
+        if (Check.isNull(configure)) {
+            log.error("该账户预警配置信息为空,accountId:{}", accountId);
+            return;
+        }
+
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        trackMonitorLogsService.monitorCreative(configure,accountId, token.getAccessToken(), userAllocation.getUserId(), nowDate, nowDate, 1);
+
+    }
+
+
+
+    @GetMapping(value = "/monitorProgramCreative")
+    public void monitorProgramCreative(Long accountId) {
+        UserAllocation userAllocation = userAllocationService.getByAccountId(accountId);
+        if (Check.isNull(userAllocation)) {
+            log.error("未获取到账户分配信息,accountId:{}", accountId);
+            return;
+        }
+        if (userAllocation.getAccountStatus() == 1) {
+            log.error("该账户已暂停投放,accountId:{}", accountId);
+            return;
+        }
+
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        if (Check.isNull(token)) {
+            log.error("该账户未获取到token信息,accountId:{}", accountId);
+            return;
+        }
+        TrackMonitorConfigure configure = trackMonitorConfigureService.getByAccountId(accountId);
+        if (Check.isNull(configure)) {
+            log.error("该账户预警配置信息为空,accountId:{}", accountId);
+            return;
+        }
+
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        trackMonitorLogsService.monitorProgramCreative(configure,accountId, token.getAccessToken(), userAllocation.getUserId(), nowDate, nowDate, 1);
+
+    }
+
+
+    @GetMapping(value = "/list")
+    public Result<IPage<TrackMonitorLogs>> queryPageList(TrackMonitorLogs trackMonitorLogs,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
+        Result<IPage<TrackMonitorLogs>> result = new Result<>();
+        QueryWrapper<TrackMonitorLogs> queryWrapper = QueryGenerator.initQueryWrapper(trackMonitorLogs, req.getParameterMap());
+        Page<TrackMonitorLogs> page = new Page<TrackMonitorLogs>(pageNo, pageSize);
+        IPage<TrackMonitorLogs> pageList = trackMonitorLogsService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param trackMonitorLogs
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-日志-添加", notes = "监测链接预警-日志-添加")
+    @PostMapping(value = "/add")
+    public Result<TrackMonitorLogs> add(@RequestBody TrackMonitorLogs trackMonitorLogs) {
+        Result<TrackMonitorLogs> result = new Result<>();
+        try {
+            trackMonitorLogsService.save(trackMonitorLogs);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param trackMonitorLogs
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-日志-编辑", notes = "监测链接预警-日志-编辑")
+    @PutMapping(value = "/edit")
+    public Result<TrackMonitorLogs> edit(@RequestBody TrackMonitorLogs trackMonitorLogs) {
+        Result<TrackMonitorLogs> result = new Result<TrackMonitorLogs>();
+        TrackMonitorLogs trackMonitorLogsEntity = trackMonitorLogsService.getById(trackMonitorLogs.getId());
+        if (trackMonitorLogsEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = trackMonitorLogsService.updateById(trackMonitorLogs);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-日志-通过id删除", notes = "监测链接预警-日志-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            trackMonitorLogsService.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<TrackMonitorLogs> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<TrackMonitorLogs> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.trackMonitorLogsService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "监测链接预警-日志-通过id查询", notes = "监测链接预警-日志-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<TrackMonitorLogs> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<TrackMonitorLogs> result = new Result<>();
+        TrackMonitorLogs trackMonitorLogs = trackMonitorLogsService.getById(id);
+        if (trackMonitorLogs == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(trackMonitorLogs);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<TrackMonitorLogs> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                TrackMonitorLogs trackMonitorLogs = JSON.parseObject(deString, TrackMonitorLogs.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(trackMonitorLogs, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<TrackMonitorLogs> pageList = trackMonitorLogsService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "监测链接预警-日志列表");
+        mv.addObject(NormalExcelConstants.CLASS, TrackMonitorLogs.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) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<TrackMonitorLogs> listTrackMonitorLogss = ExcelImportUtil.importExcel(file.getInputStream(), TrackMonitorLogs.class, params);
+                trackMonitorLogsService.saveBatch(listTrackMonitorLogss);
+                return Result.ok("文件导入成功!数据行数:" + listTrackMonitorLogss.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 57 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/entity/ProjectMonitorWhiteList.java

@@ -0,0 +1,57 @@
+package cn.com.ctop.kuaishou.modules.clean.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 监测链接预警-项目白名单
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-23
+ */
+@Data
+@TableName("ctop_project_monitor_white_list")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_project_monitor_white_list对象", description = "监测链接预警-项目白名单")
+public class ProjectMonitorWhiteList {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 操作人
+     */
+    @Excel(name = "操作人", width = 15)
+    @ApiModelProperty(value = "操作人")
+    private String userId;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 75 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/entity/TrackMonitorConfigure.java

@@ -0,0 +1,75 @@
+package cn.com.ctop.kuaishou.modules.clean.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 监测链接预警-配置
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-23
+ */
+@Data
+@TableName("ctop_track_monitor_configure")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_track_monitor_configure对象", description = "监测链接预警-配置")
+public class TrackMonitorConfigure {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long accountId;
+    /**
+     * 状态 0 开启 1 暂停
+     */
+    @Excel(name = "状态 0 开启 1 暂停", width = 15)
+    @ApiModelProperty(value = "状态 0 开启 1 暂停")
+    private Integer status;
+    /**
+     * 第三方点击检测链接
+     */
+    @Excel(name = "第三方点击检测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击检测链接")
+    private String clickTrackUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    @Excel(name = "第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * 操作人
+     */
+    @Excel(name = "操作人", width = 15)
+    @ApiModelProperty(value = "操作人")
+    private String userId;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 69 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/entity/TrackMonitorLogs.java

@@ -0,0 +1,69 @@
+package cn.com.ctop.kuaishou.modules.clean.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 监测链接预警-日志
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-23
+ */
+@Data
+@TableName("ctop_track_monitor_logs")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_track_monitor_logs对象", description = "监测链接预警-日志")
+public class TrackMonitorLogs {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long accountId;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long unitId;
+    /**
+     * 错误第三方点击检测链接
+     */
+    @Excel(name = "错误第三方点击检测链接	", width = 15)
+    @ApiModelProperty(value = "错误第三方点击检测链接	")
+    private String clickTrackUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    @Excel(name = "第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 20 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/ProjectMonitorWhiteListMapper.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.clean.mapper;
+
+import cn.com.ctop.kuaishou.modules.clean.entity.ProjectMonitorWhiteList;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 监测链接预警-项目白名单
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+public interface ProjectMonitorWhiteListMapper extends BaseMapper<ProjectMonitorWhiteList> {
+
+    List<JSONObject> getProjectIds(@Param("userId") String userId);
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/TrackMonitorConfigureMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.clean.mapper;
+
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorConfigure;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 监测链接预警-配置
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+public interface TrackMonitorConfigureMapper extends BaseMapper<TrackMonitorConfigure> {
+
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/TrackMonitorLogsMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.clean.mapper;
+
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorLogs;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 监测链接预警-日志
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+public interface TrackMonitorLogsMapper extends BaseMapper<TrackMonitorLogs> {
+
+    void replaceBatch(@Param("addList") TrackMonitorLogsMapper monitorLogsMapper);
+}

+ 30 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/xml/ProjectMonitorWhiteListMapper.xml

@@ -0,0 +1,30 @@
+<?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="cn.com.ctop.kuaishou.modules.clean.mapper.ProjectMonitorWhiteListMapper">
+
+    <select id="getProjectIds" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        project.id as 'projectId',
+        project.project_name as 'projectName'
+        FROM
+        (
+        SELECT
+        t1.project_id
+        FROM
+        ctop_project_monitor_white_list t1
+        INNER JOIN (
+        SELECT DISTINCT
+        project_id
+        FROM
+        ctop_project_member
+        WHERE 1 = 1
+        <if test="userId != null and userId != ''">
+            AND user_id = #{userId}
+        </if>
+
+        ) t2 ON t1.project_id = t2.project_id
+        ) white INNER JOIN ctop_project project
+        ON white.project_id = project.id
+
+    </select>
+</mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/xml/TrackMonitorConfigureMapper.xml

@@ -0,0 +1,5 @@
+<?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="cn.com.ctop.kuaishou.modules.clean.mapper.TrackMonitorConfigureMapper">
+
+</mapper>

+ 23 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/xml/TrackMonitorLogsMapper.xml

@@ -0,0 +1,23 @@
+<?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="cn.com.ctop.kuaishou.modules.clean.mapper.TrackMonitorLogsMapper">
+
+    <insert id="replaceBatch">
+        inseert into ctop_track_monitor_logs(
+        account_id,
+        unit_id,
+        click_track_url,
+        actionbar_click_url
+        )
+        values
+        <foreach collection="addList" item="add" separator=",">
+            (
+            #{add.accountId},
+            #{add.unitId},
+            #{add.clickTrackUrl},
+            #{add.actionbarClickurl}
+            )
+        </foreach>
+
+    </insert>
+</mapper>

+ 19 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/IProjectMonitorWhiteListService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.clean.service;
+
+import cn.com.ctop.kuaishou.modules.clean.entity.ProjectMonitorWhiteList;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 监测链接预警-项目白名单
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+public interface IProjectMonitorWhiteListService extends IService<ProjectMonitorWhiteList> {
+
+    List<JSONObject> getProjectAndAccountIds(String userId);
+}

+ 16 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/ITrackMonitorConfigureService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.kuaishou.modules.clean.service;
+
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorConfigure;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 监测链接预警-配置
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+public interface ITrackMonitorConfigureService extends IService<TrackMonitorConfigure> {
+
+    TrackMonitorConfigure getByAccountId(Long accountId);
+}

+ 19 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/ITrackMonitorLogsService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.clean.service;
+
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorConfigure;
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorLogs;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 监测链接预警-日志
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+public interface ITrackMonitorLogsService extends IService<TrackMonitorLogs> {
+
+    void monitorCreative(TrackMonitorConfigure configure,Long accountId, String accessToken, String userId, String startDate, String endDate, Integer page);
+
+    void monitorProgramCreative(TrackMonitorConfigure configure, Long accountId, String accessToken, String userId, String nowDate, String nowDate1, Integer page);
+}

+ 50 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/impl/ProjectMonitorWhiteListServiceImpl.java

@@ -0,0 +1,50 @@
+package cn.com.ctop.kuaishou.modules.clean.service.impl;
+
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.clean.entity.ProjectMonitorWhiteList;
+import cn.com.ctop.kuaishou.modules.clean.mapper.ProjectMonitorWhiteListMapper;
+import cn.com.ctop.kuaishou.modules.clean.service.IProjectMonitorWhiteListService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 监测链接预警-项目白名单
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+@Service
+public class ProjectMonitorWhiteListServiceImpl extends ServiceImpl<ProjectMonitorWhiteListMapper, ProjectMonitorWhiteList> implements IProjectMonitorWhiteListService {
+    @Autowired
+    private ProjectMonitorWhiteListMapper monitorWhiteListMapper;
+    @Autowired
+    private ISysRoleService sysRoleService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
+    @Override
+    public List<JSONObject> getProjectAndAccountIds(String userId) {
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if (roleCode.equals("admin")) {
+            userId = null;
+        }
+        List<JSONObject> projectIds = monitorWhiteListMapper.getProjectIds(userId);
+        if (Check.isNull(projectIds)) {
+            return null;
+        }
+        for (int i = 0; i < projectIds.size(); i++) {
+            JSONObject projectJson = projectIds.get(i);
+            Long projectId = projectJson.getLong("projectId");
+            List<JSONObject> accountListByProject = userAllocationService.getAccountListByProjectAndUserId(projectId, userId);
+            projectJson.put("accountIds", accountListByProject);
+        }
+        return projectIds;
+    }
+}

+ 26 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/impl/TrackMonitorConfigureServiceImpl.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.kuaishou.modules.clean.service.impl;
+
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorConfigure;
+import cn.com.ctop.kuaishou.modules.clean.mapper.TrackMonitorConfigureMapper;
+import cn.com.ctop.kuaishou.modules.clean.service.ITrackMonitorConfigureService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 监测链接预警-配置
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+@Service
+public class TrackMonitorConfigureServiceImpl extends ServiceImpl<TrackMonitorConfigureMapper, TrackMonitorConfigure> implements ITrackMonitorConfigureService {
+
+    @Override
+    public TrackMonitorConfigure getByAccountId(Long accountId) {
+        QueryWrapper<TrackMonitorConfigure> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        return this.getOne(queryWrapper);
+    }
+}

+ 223 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/service/impl/TrackMonitorLogsServiceImpl.java

@@ -0,0 +1,223 @@
+package cn.com.ctop.kuaishou.modules.clean.service.impl;
+
+import cn.com.ctop.common.module.service.IMessageTemplate;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorConfigure;
+import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorLogs;
+import cn.com.ctop.kuaishou.modules.clean.mapper.TrackMonitorLogsMapper;
+import cn.com.ctop.kuaishou.modules.clean.service.ITrackMonitorLogsService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 监测链接预警-日志
+ *
+ * @author jeecg-boot
+ * 2021-09-23
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMapper, TrackMonitorLogs> implements ITrackMonitorLogsService {
+    @Autowired
+    private IKuaiShouUpdateService updateService;
+    @Autowired
+    private ISendMessageService sendMessageService;
+    @Autowired
+    private IMessageTemplate messageTemplate;
+    @Autowired
+    private TrackMonitorLogsMapper monitorLogsMapper;
+
+
+    @Override
+    public void monitorCreative(TrackMonitorConfigure configure, Long accountId, String accessToken, String userId, String startDate, String endDate, Integer page) {
+        String clickTrackUrl = configure.getClickTrackUrl().trim();
+        String actionbarClickUrl = configure.getActionbarClickUrl().trim();
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", " application/json");
+        headers.put("Access-Token", accessToken);
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        Integer page_size = 500;
+        param.put("page_size", page_size);
+        param.put("page", page);
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        System.err.println(resultJson);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告创意返回结果为空,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", accountId, message);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            return;
+        }
+
+        Boolean doGet = true;
+        if (details.size() < page_size) {
+            doGet = false;
+        }
+        Map<Long, JSONObject> unitMap = new HashMap<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject creativeJson = details.getJSONObject(i);
+
+            Integer status = creativeJson.getInteger("status");
+            //   if (status == 52 || status == 41 || status == 19) { // 只检查创意状态为投放中、审核中
+            JSONObject unitJson = new JSONObject();
+            Boolean trueOrFalse = false;
+
+            String click_track_url = creativeJson.getString("click_track_url");
+            if (!Check.isNull(click_track_url)) {
+                if (!click_track_url.equals(clickTrackUrl)) {
+                    trueOrFalse = true;
+                    unitJson.put("click_track_url", click_track_url);
+                }
+            }
+
+            String actionbar_click_url = creativeJson.getString("actionbar_click_url");
+            if (!Check.isNull(actionbar_click_url)) {
+                if (!actionbar_click_url.equals(actionbarClickUrl)) {
+                    trueOrFalse = true;
+                    unitJson.put("actionbar_click_url", actionbar_click_url);
+                }
+            }
+
+            if (trueOrFalse) {
+                Long unit_id = creativeJson.getLong("unit_id");
+                unitMap.put(unit_id, unitJson);
+            }
+            // }
+        }
+
+        if (!Check.isNullMap(unitMap)) {
+            doOperation(accountId, accessToken, unitMap, userId);
+        }
+
+        if (doGet) {
+            monitorCreative(configure, accountId, accessToken, userId, startDate, endDate, page + 1);
+        }
+
+    }
+
+    @Override
+    public void monitorProgramCreative(TrackMonitorConfigure configure, Long accountId, String accessToken, String userId, String startDate, String endDate, Integer page) {
+        String clickTrackUrl = configure.getClickTrackUrl().trim();
+        String actionbarClickUrl = configure.getActionbarClickUrl().trim();
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.PROGRAM_LIST;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", " application/json");
+        headers.put("Access-Token", accessToken);
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        Integer page_size = 500;
+        param.put("page_size", page_size);
+        param.put("page", page);
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        System.err.println(resultJson);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告创意返回结果为空,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", accountId, message);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            return;
+        }
+
+        Boolean doGet = true;
+        if (details.size() < page_size) {
+            doGet = false;
+        }
+        Map<Long, JSONObject> unitMap = new HashMap<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject creativeJson = details.getJSONObject(i);
+
+            Integer status = creativeJson.getInteger("view_status");
+            if (status == 52 || status == 41 || status == 19) { // 只检查创意状态为投放中、审核中
+                JSONObject unitJson = new JSONObject();
+                Boolean trueOrFalse = false;
+
+                String click_track_url = creativeJson.getString("click_url");
+                if (!click_track_url.equals(clickTrackUrl)) {
+                    trueOrFalse = true;
+                    unitJson.put("click_track_url", click_track_url);
+                }
+                String actionbar_click_url = creativeJson.getString("actionbar_click_url");
+                if (!actionbar_click_url.equals(actionbarClickUrl)) {
+                    trueOrFalse = true;
+                    unitJson.put("actionbar_click_url", actionbar_click_url);
+                }
+
+                if (trueOrFalse) {
+                    Long unit_id = creativeJson.getLong("unit_id");
+                    unitMap.put(unit_id, unitJson);
+                }
+            }
+        }
+
+        if (!Check.isNullMap(unitMap)) {
+            doOperation(accountId, accessToken, unitMap, userId);
+        }
+
+        if (doGet) {
+            monitorCreative(configure, accountId, accessToken, userId, startDate, endDate, page + 1);
+        }
+    }
+
+    private void doOperation(Long accountId, String accessToken, Map<Long, JSONObject> unitMap, String userId) {
+        List<TrackMonitorLogs> trackMonitorLogs = new ArrayList<>();
+        for (Map.Entry<Long, JSONObject> entry : unitMap.entrySet()) {
+            Long unitId = entry.getKey();
+            JSONObject info = entry.getValue();
+            String trackMessage = messageTemplate.getTrackMessage(accountId, unitId);
+            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", trackMessage);
+            updateService.updateUnitStatus(accessToken, accountId, unitId, 2, "e9ca23d68d884d4ebb19d07889727dae");
+            TrackMonitorLogs logs = new TrackMonitorLogs();
+            logs.setAccountId(accountId);
+            logs.setUnitId(unitId);
+            String click_track_url = info.getString("click_track_url");
+            if (!Check.isNull(click_track_url)) {
+                logs.setClickTrackUrl(click_track_url);
+            }
+            String actionbar_click_url = info.getString("actionbar_click_url");
+            if (!Check.isNull(actionbar_click_url)) {
+                logs.setActionbarClickUrl(actionbar_click_url);
+            }
+            trackMonitorLogs.add(logs);
+        }
+        monitorLogsMapper.replaceBatch(monitorLogsMapper);
+    }
+}

+ 3 - 3
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

@@ -76,9 +76,9 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
-    username: hcst
-    password: hcst@2020
+    url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
+    username: data
+    password: hcst@2021
     driver-class-name: com.mysql.jdbc.Driver
     druid:
       stat-view-servlet: