Bläddra i källkod

fix on 2020.11.25

jiequan.bi 4 år sedan
förälder
incheckning
c39afd50f6

+ 19 - 2
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleSwitchController.java

@@ -2,6 +2,7 @@ package cn.com.ctop.alarm.modules.controller;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,14 +29,14 @@ public class RuleSwitchController {
         UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
         //开启预警
         if(switchType.equals("on")){
-            wrapper.set("landing_page",0);
+            wrapper.set("monitoring_link",0);
             wrapper.setEntity(userAllocation);
             boolean update = userAllocationService.update(wrapper);
             if(update){
                 result.success("监测链接预警开启成功");
             }
         }else if(switchType.equals("off")){
-            wrapper.set("landing_page",1);
+            wrapper.set("monitoring_link",1);
             wrapper.setEntity(userAllocation);
             boolean update = userAllocationService.update(wrapper);
             if(update){
@@ -76,4 +77,20 @@ public class RuleSwitchController {
         }
         return result;
     }
+
+    /**
+     *  开关预警配置回显
+     */
+    @PostMapping(value = "/echoSwitchStatus")
+    public Result<JSONObject> echoSwitchStatus(Long accountId){
+        Result<JSONObject> result =new Result<>();
+        JSONObject switchStatus= userAllocationService.getSwitchStatusByAccount(accountId);
+        if(switchStatus.isEmpty()){
+            result.error500("未找到该账户");
+        }else {
+            result.setResult(switchStatus);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -29,4 +29,6 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     Long getProjectIdByAccountId(@Param("accountId") Long accountId);
 
     UserAllocation getUserAllocation(@Param("accountId") Long accountId);
+
+    JSONObject getSwitchStatusByAccount(@Param("accountId") Long accountId);
 }

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -75,5 +75,15 @@
     limit 1
     </select>
 
+    <select id="getSwitchStatusByAccount" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            monitoring_link,
+            landing_page
+        FROM
+            ctop_user_allocation
+        WHERE
+            account_id = #{accountId}
+    </select>
+
 
 </mapper>

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -34,4 +34,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     List<JSONObject> getAccountIdListByUserId(Long userId);
 
     List<UserAllocation> getUserAllocations(String mediaId ,int switchType);
+
+    JSONObject getSwitchStatusByAccount(Long accountId);
 }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -129,4 +129,9 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         queryWrapper.orderByDesc("create_time");
         return this.list(queryWrapper);
     }
+
+    @Override
+    public JSONObject getSwitchStatusByAccount(Long accountId) {
+        return userAllocationMapper.getSwitchStatusByAccount(accountId);
+    }
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/RuleByteDanceAccountServiceImpl.java

@@ -37,7 +37,7 @@ public class RuleByteDanceAccountServiceImpl implements IRuleByteDanceAccountSer
             ruleDataAccount.setConvertCost(dataAccount.getBigDecimal("convert_cost"));
             ruleDataAccount.setNextDayOpenNum(dataAccount.getLong("next_day_open"));
             ruleDataAccount.setNextDayOpenCost(dataAccount.getBigDecimal("next_day_open_cost"));
-            ruleDataAccount.setNextDayOpenCost(dataAccount.getBigDecimal("next_day_open_rate"));
+            ruleDataAccount.setNextDayOpenRate(dataAccount.getBigDecimal("next_day_open_rate"));
 
             ruleDataAccountService.saveOrUpdate(ruleDataAccount);
         }