Bladeren bron

兼容快手数据,初版调试

zhaoxian 4 jaren geleden
bovenliggende
commit
e334dfa382

+ 3 - 1
module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java

@@ -183,7 +183,9 @@ public class MatchLogic {
                 append("预警账户:").append(accountId).append(",授权名称:").append(accountName).append("<br/>");
         if ("plan".equals(type)) {
             buf.append("预警计划:").append(codes).append("<br/>");
-        } else if ("creative".equals(type)) {
+        } else if ("unit".equals(type)) {
+            buf.append("预警组:").append(codes).append("<br/>");
+        }else if ("creative".equals(type)) {
             buf.append("预警创意:").append(codes).append("<br/>");
         }
         if (isNull) {

+ 26 - 4
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java

@@ -97,6 +97,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
 
     private JSONObject userObj = null;
     private final static String ACCOUNT = "account";
+    private final static String UNIT = "unit";
     private final static String PLAN = "plan";
     private final static String CREATIVE = "creative";
 
@@ -401,9 +402,9 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     }
                     break;
                 }
-            } else if ("group".equals(ruleBase.getRuleDimension())) {
+            } else if (UNIT.equals(ruleBase.getRuleDimension())) {
                 groupDatas = getOKData(groupDatas, dimensionData, ruleBase, indicator, threshold);
-                if (Check.isNull(targetDatas)) {
+                if (Check.isNull(groupDatas)) {
                     if (!Check.isNull(accountDatas)) {
                         accountDatas = null;
                     }
@@ -474,6 +475,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
         }
         JSONObject user = getUserByAccountId(accountId);
         StringJoiner creativeJoiner = new StringJoiner(",");
+        StringJoiner unitJoiner = new StringJoiner(",");
         StringJoiner planJoiner = new StringJoiner(",");
         StringJoiner isNullCreativeJoiner = new StringJoiner(",");
         StringJoiner isNullPlanJoiner = new StringJoiner(",");
@@ -515,6 +517,15 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                         creativeJoiner = new StringJoiner(",");
                         creativeJoiner.add(obj.getString("creativeId"));
                     }
+                } else if (!Check.isNull(obj.getLong("unitId"))) {
+                    if (unitJoiner.toString().getBytes().length <= 1800) {
+                        unitJoiner.add(obj.getString("unitId"));
+                    } else {
+                        String msg = MatchLogic.getMessage(ruleGroup.getGroupName(), accountId, accountName, UNIT, unitJoiner.toString(), isNull);
+                        sendMsg(msg, ruleGroup, user, UNIT, unitJoiner.toString(), accountId, mediaType);
+                        unitJoiner = new StringJoiner(",");
+                        unitJoiner.add(obj.getString("unitId"));
+                    }
                 } else if (!Check.isNull(obj.getLong("planId"))) {
                     if (planJoiner.toString().getBytes().length <= 1800) {
                         planJoiner.add(obj.getString("planId"));
@@ -534,6 +545,10 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
             String creativeMsg = MatchLogic.getMessage(ruleGroup.getGroupName(), accountId, accountName, CREATIVE, creativeJoiner.toString(), false);
             sendMsg(creativeMsg, ruleGroup, user, CREATIVE, creativeJoiner.toString(), accountId, mediaType);
         }
+        if (!Check.isNull(unitJoiner.toString())) {
+            String creativeMsg = MatchLogic.getMessage(ruleGroup.getGroupName(), accountId, accountName, UNIT, unitJoiner.toString(), false);
+            sendMsg(creativeMsg, ruleGroup, user, UNIT, unitJoiner.toString(), accountId, mediaType);
+        }
         if (!Check.isNull(planJoiner.toString())) {
             String planMsg = MatchLogic.getMessage(ruleGroup.getGroupName(), accountId, accountName, PLAN, planJoiner.toString(), false);
             sendMsg(planMsg, ruleGroup, user, PLAN, planJoiner.toString(), accountId, mediaType);
@@ -600,9 +615,11 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                 send.setGroupId(ruleGroup.getId());
                 send.setGroupName(ruleGroup.getGroupName());
                 if (CREATIVE.equals(type)) {
-                    send.setRuleDimension(CREATIVE);
+                    send.setRuleDimension(type);
                 } else if (PLAN.equals(type)) {
-                    send.setRuleDimension(PLAN);
+                    send.setRuleDimension(type);
+                } else if (UNIT.equals(type)) {
+                    send.setRuleDimension(type);
                 } else {
                     send.setRuleDimension(ACCOUNT);
                 }
@@ -651,6 +668,11 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     if (!(boolean) updateMap.get("success")) {
                         msg = msg.replace(id, id + "(F)");
                     }
+                } else if (UNIT.equals(type)) {
+                    updateMap = kuaiShouUpdateService.updateUnitStatus(token.getAccessToken(), accountId, Long.valueOf(id), NoEn.NO2.valueInt(), userId);
+                    if (!(boolean) updateMap.get("success")) {
+                        msg = msg.replace(id, id + "(F)");
+                    }
                 } else if (PLAN.equals(type)) {
                     updateMap = kuaiShouUpdateService.updateCampaignStatus(token.getAccessToken(), accountId, Long.valueOf(id), NoEn.NO2.valueInt(), userId);
                     if (!(boolean) updateMap.get("success")) {

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/RuleDataAccountKuaishouServiceImpl.java

@@ -47,7 +47,7 @@ public class RuleDataAccountKuaishouServiceImpl extends ServiceImpl<RuleDataAcco
         List<RuleDataAccountKuaishou> accountList = ruleDataAccountKuaishouMapper.selectByMap(map);
         obj.put("account", accountList);
         List<RuleDateUnitKuaishou> unitKuaishous = ruleDateUnitKuaishouMapper.selectByMap(map);
-        obj.put("group", unitKuaishous);
+        obj.put("unit", unitKuaishous);
         List<RuleDataTargetKuaishou> targetKuaishous = ruleDataTargetKuaishouMapper.selectByMap(map);
         obj.put("target", targetKuaishous);
         List<RuleDatePlanKuaishou> planKuaishous = ruleDatePlanKuaishouMapper.selectByMap(map);

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouUpdateService.java

@@ -58,7 +58,7 @@ public interface IKuaiShouUpdateService {
      * @param token
      * @param advertiserId
      * @param unitId
-     * @param putStatus
+     * @param putStatus 1-投放、2-暂停、3-删除,传其他数字非法
      * @return
      */
     Map<String, Object> updateUnitStatus(String token, Long advertiserId, Long unitId, int putStatus, String loginId);