Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

songyh 3 yıl önce
ebeveyn
işleme
057205f67c

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

@@ -1,9 +1,13 @@
 package cn.com.ctop.kuaishou.modules.clean.controller;
 
 
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISysUserService;
 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 cn.com.ctop.kuaishou.modules.clean.service.ITrackMonitorConfigureService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,6 +17,7 @@ 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.entity.SysUser;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -32,6 +37,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -49,11 +55,18 @@ import java.util.Map;
 public class ProjectMonitorWhiteListController {
     @Autowired
     private IProjectMonitorWhiteListService projectMonitorWhiteListService;
+    @Autowired
+    private ISysUserService userService;
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private ITrackMonitorConfigureService configureService;
 
 
-    @GetMapping(value = "/getProjectAndAccountIds")
-    public Result<List<JSONObject>> getProjectAndAccountIds(String userId) {
+    @PostMapping(value = "/getProjectAndAccountIds")
+    public Result<List<JSONObject>> getProjectAndAccountIds(@RequestBody JSONObject requestBody) {
         Result<List<JSONObject>> result = new Result<>();
+        String userId = requestBody.getString("userId");
         List<JSONObject> list = projectMonitorWhiteListService.getProjectAndAccountIds(userId);
         result.setSuccess(true);
         result.setResult(list);
@@ -80,6 +93,23 @@ public class ProjectMonitorWhiteListController {
         QueryWrapper<ProjectMonitorWhiteList> queryWrapper = QueryGenerator.initQueryWrapper(projectMonitorWhiteList, req.getParameterMap());
         Page<ProjectMonitorWhiteList> page = new Page<ProjectMonitorWhiteList>(pageNo, pageSize);
         IPage<ProjectMonitorWhiteList> pageList = projectMonitorWhiteListService.page(page, queryWrapper);
+        List<ProjectMonitorWhiteList> records = pageList.getRecords();
+        for (ProjectMonitorWhiteList whiteList : records) {
+            String userId = whiteList.getUserId();
+            Long projectId = whiteList.getProjectId();
+            SysUser user = userService.getById(userId);
+            if (!Check.isNull(user)) {
+                whiteList.setUserName(user.getRealname());
+            }
+            Project project = projectService.getById(projectId);
+            if (!Check.isNull(project)) {
+                whiteList.setProjectName(project.getProjectName());
+
+            }
+
+        }
+
+
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
@@ -147,7 +177,15 @@ public class ProjectMonitorWhiteListController {
     @DeleteMapping(value = "/delete")
     public Result<?> delete(@RequestParam(name = "id") String id) {
         try {
-            projectMonitorWhiteListService.removeById(id);
+            ProjectMonitorWhiteList byId = projectMonitorWhiteListService.getById(id);
+            if (!Check.isNull(byId)) {
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("project_id", byId.getProjectId());
+                configureService.removeByMap(deleteMap);
+                projectMonitorWhiteListService.removeById(id);
+            }
+
+
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");

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

@@ -1,5 +1,10 @@
 package cn.com.ctop.kuaishou.modules.clean.controller;
 
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISysUserService;
+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.service.ITrackMonitorConfigureService;
@@ -11,6 +16,7 @@ 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.entity.SysUser;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.system.service.ISysRoleService;
@@ -50,6 +56,13 @@ public class TrackMonitorConfigureController {
     private ITrackMonitorConfigureService trackMonitorConfigureService;
     @Autowired
     private ISysRoleService sysRoleService;
+    @Autowired
+    private IUserAllocationService allocationService;
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private ISysUserService userService;
+
 
     /**
      * 分页列表查询
@@ -76,6 +89,32 @@ public class TrackMonitorConfigureController {
         QueryWrapper<TrackMonitorConfigure> queryWrapper = QueryGenerator.initQueryWrapper(trackMonitorConfigure, req.getParameterMap());
         Page<TrackMonitorConfigure> page = new Page<TrackMonitorConfigure>(pageNo, pageSize);
         IPage<TrackMonitorConfigure> pageList = trackMonitorConfigureService.page(page, queryWrapper);
+        List<TrackMonitorConfigure> records = pageList.getRecords();
+        for (TrackMonitorConfigure configure : records) {
+            Long accountId = configure.getAccountId();
+            if (!Check.isNull(accountId)) {
+                UserAllocation userAllocation = allocationService.getByAccountId(accountId);
+                if (!Check.isNull(userAllocation)) {
+                    configure.setAccountName(userAllocation.getAuthName());
+                    configure.setAccountStatus(userAllocation.getAccountStatus());
+                }
+            }
+            Long projectId = configure.getProjectId();
+            if (!Check.isNull(projectId)) {
+                Project project = projectService.getById(projectId);
+                if (!Check.isNull(project)) {
+                    configure.setProjectName(project.getProjectName());
+                }
+            }
+            String createUserId = configure.getUserId();
+            if (!Check.isNull(createUserId)) {
+                SysUser user = userService.getById(createUserId);
+                if (!Check.isNull(user)) {
+                    configure.setUserName(user.getRealname());
+                }
+            }
+        }
+
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
@@ -101,6 +140,12 @@ public class TrackMonitorConfigureController {
                 result.error500("该账户预警已绑定");
                 return result;
             }
+            UserAllocation userAllocation = allocationService.getByAccountId(accountId);
+            if (Check.isNull(userAllocation)) {
+                result.error500("该账户未获取到关联项目");
+                return result;
+            }
+            trackMonitorConfigure.setProjectId(userAllocation.getProjectId());
             trackMonitorConfigureService.save(trackMonitorConfigure);
             result.success("添加成功!");
         } catch (Exception e) {
@@ -117,7 +162,7 @@ public class TrackMonitorConfigureController {
      * @return
      */
     @ApiOperation(value = "监测链接预警-配置-编辑", notes = "监测链接预警-配置-编辑")
-    @PutMapping(value = "/edit")
+    @PostMapping(value = "/edit")
     public Result<TrackMonitorConfigure> edit(@RequestBody TrackMonitorConfigure trackMonitorConfigure) {
         Result<TrackMonitorConfigure> result = new Result<TrackMonitorConfigure>();
         TrackMonitorConfigure trackMonitorConfigureEntity = trackMonitorConfigureService.getById(trackMonitorConfigure.getId());

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

@@ -39,6 +39,8 @@ import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 监测链接预警-日志
@@ -60,9 +62,11 @@ public class TrackMonitorLogsController {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private ITrackMonitorConfigureService trackMonitorConfigureService;
+    static ExecutorService creativeExecutorService = Executors.newFixedThreadPool(3);
+    static ExecutorService programCreativeExecutorService = Executors.newFixedThreadPool(3);
 
     /**
-     * 分页列表查询
+     * 自定义创意预警监测
      */
 
     @GetMapping(value = "/monitorCreative")
@@ -89,12 +93,20 @@ public class TrackMonitorLogsController {
         }
 
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        trackMonitorLogsService.monitorCreative(configure,accountId, token.getAccessToken(), userAllocation.getUserId(), nowDate, nowDate, 1);
-
+        creativeExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                trackMonitorLogsService.monitorCreative(configure, accountId, token.getAccessToken(), userAllocation.getUserId(), nowDate, nowDate, 1);
+            }
+        });
     }
 
 
-
+    /**
+     * 程序化创意预警监测
+     *
+     * @param accountId
+     */
     @GetMapping(value = "/monitorProgramCreative")
     public void monitorProgramCreative(Long accountId) {
         UserAllocation userAllocation = userAllocationService.getByAccountId(accountId);
@@ -119,7 +131,12 @@ public class TrackMonitorLogsController {
         }
 
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        trackMonitorLogsService.monitorProgramCreative(configure,accountId, token.getAccessToken(), userAllocation.getUserId(), nowDate, nowDate, 1);
+        programCreativeExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                trackMonitorLogsService.monitorProgramCreative(configure, accountId, token.getAccessToken(), userAllocation.getUserId(), nowDate, nowDate, 1);
+            }
+        });
 
     }
 

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.clean.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -54,4 +55,11 @@ public class ProjectMonitorWhiteList {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+
+    @TableField(exist = false)
+    private String projectName;
+
+    @TableField(exist = false)
+    private String userName;
 }

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.clean.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -37,6 +38,7 @@ public class TrackMonitorConfigure {
      */
     @Excel(name = "项目id", width = 15)
     @ApiModelProperty(value = "项目id")
+    private Long projectId;
     private Long accountId;
     /**
      * 状态 0 开启 1 暂停
@@ -72,4 +74,16 @@ public class TrackMonitorConfigure {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+    @TableField(exist = false)
+    private String accountName;
+
+    @TableField(exist = false)
+    private String userName;
+    @TableField(exist = false)
+    private String projectName;
+
+
+    @TableField(exist = false)
+    private Integer accountStatus;
 }

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

@@ -4,6 +4,8 @@ import cn.com.ctop.kuaishou.modules.clean.entity.TrackMonitorLogs;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * 监测链接预警-日志
  *
@@ -13,5 +15,7 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface TrackMonitorLogsMapper extends BaseMapper<TrackMonitorLogs> {
 
-    void replaceBatch(@Param("addList") TrackMonitorLogsMapper monitorLogsMapper);
+    void replaceBatch(@Param("addList") List<TrackMonitorLogs> addList);
+
+    Integer getCount(@Param("accountId") Long accountId, @Param("unitId") Long unit_id);
 }

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

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.clean.mapper.TrackMonitorLogsMapper">
 
     <insert id="replaceBatch">
-        inseert into ctop_track_monitor_logs(
+        insert into ctop_track_monitor_logs(
         account_id,
         unit_id,
         click_track_url,
@@ -15,9 +15,15 @@
             #{add.accountId},
             #{add.unitId},
             #{add.clickTrackUrl},
-            #{add.actionbarClickurl}
+            #{add.actionbarClickUrl}
             )
         </foreach>
 
     </insert>
+    <select id="getCount" resultType="java.lang.Integer">
+        select  count(1)  from ctop_track_monitor_logs
+        where  account_id = #{accountId}
+        and unit_id = #{unitId}
+
+    </select>
 </mapper>

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

@@ -43,7 +43,7 @@ public class ProjectMonitorWhiteListServiceImpl extends ServiceImpl<ProjectMonit
             JSONObject projectJson = projectIds.get(i);
             Long projectId = projectJson.getLong("projectId");
             List<JSONObject> accountListByProject = userAllocationService.getAccountListByProjectAndUserId(projectId, userId);
-            projectJson.put("accountIds", accountListByProject);
+            projectJson.put("accountList", accountListByProject);
         }
         return projectIds;
     }

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

@@ -6,7 +6,6 @@ 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;
@@ -34,8 +33,6 @@ import java.util.Map;
 @Service
 public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMapper, TrackMonitorLogs> implements ITrackMonitorLogsService {
     @Autowired
-    private IKuaiShouUpdateService updateService;
-    @Autowired
     private ISendMessageService sendMessageService;
     @Autowired
     private IMessageTemplate messageTemplate;
@@ -45,8 +42,15 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
 
     @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();
+        log.info("开始自定义创意监测链接预警,accountId:{}", accountId);
+        String clickTrackUrl = "";
+        if (!Check.isNull(configure.getClickTrackUrl())) {
+            clickTrackUrl = configure.getClickTrackUrl().trim();
+        }
+        String actionbarClickUrl = "";
+        if (!Check.isNull(configure.getActionbarClickUrl())) {
+            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");
@@ -58,10 +62,8 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
         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;
@@ -76,7 +78,6 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
         if (null == details || details.size() <= 0) {
             return;
         }
-
         Boolean doGet = true;
         if (details.size() < page_size) {
             doGet = false;
@@ -84,49 +85,56 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
         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);
+            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 (!Check.isNull(clickTrackUrl)) {
+                        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);
+                String actionbar_click_url = creativeJson.getString("actionbar_click_url");
+                if (!Check.isNull(actionbar_click_url)) {
+                    if (!Check.isNull(actionbarClickUrl)) {
+                        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");
+                    Integer count = monitorLogsMapper.getCount(accountId, unit_id);
+                    if (count <= 0 || count == null) {
+                        unitMap.put(unit_id, unitJson);
+                    }
                 }
             }
-
-            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();
+        log.info("开始程序化创意监测链接预警,accountId:{}", accountId);
+        String clickTrackUrl = "";
+        if (!Check.isNull(configure.getClickTrackUrl())) {
+            clickTrackUrl = configure.getClickTrackUrl().trim();
+        }
+        String actionbarClickUrl = "";
+        if (!Check.isNull(configure.getActionbarClickUrl())) {
+            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");
@@ -138,10 +146,8 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
         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;
@@ -156,7 +162,6 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
         if (null == details || details.size() <= 0) {
             return;
         }
-
         Boolean doGet = true;
         if (details.size() < page_size) {
             doGet = false;
@@ -166,32 +171,39 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
             JSONObject creativeJson = details.getJSONObject(i);
 
             Integer status = creativeJson.getInteger("view_status");
-            if (status == 52 || status == 41 || status == 19) { // 只检查创意状态为投放中、审核中
+            if (status == 52 || status == 41 || status == 19 || status == 62) { // 只检查创意状态为投放中、审核中、待送审
                 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);
+                if (!Check.isNull(click_track_url)) {
+                    if (!Check.isNull(clickTrackUrl)) {
+                        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 (!Check.isNull(actionbar_click_url)) {
+                    if (!Check.isNull(actionbarClickUrl)) {
+                        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);
+                    Integer count = monitorLogsMapper.getCount(accountId, unit_id);
+                    if (count <= 0 || count == null) {
+                        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);
         }
@@ -203,21 +215,72 @@ public class TrackMonitorLogsServiceImpl extends ServiceImpl<TrackMonitorLogsMap
             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);
+            sendMessageService.sendMessage(userId, trackMessage);
+            Map<String, Object> map = monitorUpdateUnitStatus(accessToken, accountId, unitId, 2, "e9ca23d68d884d4ebb19d07889727dae");
+            if (Check.isNullMap(map)) {
+                continue;
             }
-            String actionbar_click_url = info.getString("actionbar_click_url");
-            if (!Check.isNull(actionbar_click_url)) {
-                logs.setActionbarClickUrl(actionbar_click_url);
+            Integer code = (Integer) map.get("code");
+            if (code == 0) {
+                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(trackMonitorLogs);
+    }
+
+
+    private Map<String, Object> monitorUpdateUnitStatus(String token, Long advertiserId, Long unitId, int putStatus, String loginId) {
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.UPDATE_UNIT_STATUS;
+            Map<String, String> header = new HashMap<>();
+            header.put("Access-Token", token);
+            header.put("Content-Type", "application/json");
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", advertiserId);
+            params.put("unit_id", unitId);
+            params.put("put_status", putStatus);
+            String result = HttpUtils.httpPostRequest(url, params, header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    returnMap.put("code", 0);
+                    returnMap.put("success", true);
+                    returnMap.put("message", "修改成功");
+                    log.info("监测链接预警修改组状态成功,accountId:{}。unitId:{}", advertiserId, unitId);
+                } else {
+                    log.error("监测链接预警修改广告组状态失败,advertiserId:{},unitId:{},返回信息:{}", advertiserId, unitId, resultJson);
+                    returnMap.put("code", -1);
+                    returnMap.put("success", false);
+                    returnMap.put("message", resultJson.getString("message"));
+                }
+            } else {
+                log.error("监测链接预警修改广告组状态返回结果为空,advertiserId:{},unitId:{}", advertiserId, unitId);
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "修改广告组预算返回结果为空");
             }
-            trackMonitorLogs.add(logs);
+        } catch (Exception e) {
+            log.error("监测链接预警修改广告组状态异常,advertiserId:{},unitId:{}", advertiserId, unitId);
+            e.printStackTrace();
+            returnMap.put("code", -1);
+            returnMap.put("success", false);
+            returnMap.put("message", "修改广告组状态异常");
         }
-        monitorLogsMapper.replaceBatch(monitorLogsMapper);
+
+        return returnMap;
     }
+
 }

+ 27 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -57,6 +57,31 @@ public class ProjectController {
     @Autowired
     private IUserAllocationService userAllocationService;
 
+
+    @ApiOperation(value = "项目-分页列表查询", notes = "项目-分页列表查询")
+    @GetMapping(value = "/getProjectList")
+    public Result<IPage<Project>> getProjectList(Project project,
+                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                 HttpServletRequest req) {
+        Result<IPage<Project>> result = new Result<>();
+        String projectName = project.getProjectName();
+        project.setProjectName(null);
+        QueryWrapper<Project> queryWrapper = QueryGenerator.initQueryWrapper(project, req.getParameterMap());
+        if (!Check.isNull(projectName)) {
+            queryWrapper.like("project_name", projectName);
+        }
+        Page<Project> page = new Page<>(pageNo, pageSize);
+        IPage<Project> pageList = projectService.page(page, queryWrapper);
+        List<Project> records = pageList.getRecords();
+        records = transferAccountService.getTransferInfoListByList(records);
+        pageList.setRecords(records);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
     /**
      * @param advertiserId
      * @param mediaId
@@ -236,8 +261,8 @@ public class ProjectController {
         }
 
         //媒体类型 1、3 头条   2、4 快手
-        if (!Check.isNull(project.getMediaId())){
-            queryWrapper.in("media_id",Arrays.asList(project.getMediaId().split(",")));
+        if (!Check.isNull(project.getMediaId())) {
+            queryWrapper.in("media_id", Arrays.asList(project.getMediaId().split(",")));
         }
 
         queryWrapper.orderByDesc("create_time");