소스 검색

加入状态

yumeng 4 년 전
부모
커밋
531f295e0a

+ 28 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -1,5 +1,7 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.alarm.modules.entity.RuleAccountTemplate;
+import cn.com.ctop.alarm.modules.service.IRuleAccountTemplateService;
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
@@ -362,6 +364,9 @@ public class UserAllocationController {
      * @param userAllocation
      * @return
      */
+    @Autowired
+    private IRuleAccountTemplateService ruleAccountTemplateService;
+
     @AutoLog(value = "用户分配-编辑")
     @ApiOperation(value = "用户分配-编辑", notes = "用户分配-编辑")
     @PutMapping(value = "/edit")
@@ -372,6 +377,17 @@ public class UserAllocationController {
             result.error500("未找到对应实体");
         } else {
             boolean ok = userAllocationService.updateById(userAllocation);
+            Integer accountStatus = userAllocation.getAccountStatus();
+            if (!Check.isNull(accountStatus)) {
+                if (accountStatus == 1) {
+                    QueryWrapper<RuleAccountTemplate> ruleAccountTemplateQueryWrapper = new QueryWrapper<>();
+                    ruleAccountTemplateQueryWrapper.eq("account_id", userAllocationEntity.getAccountId());
+                    RuleAccountTemplate updateRuleAccountTemplate = new RuleAccountTemplate();
+                    updateRuleAccountTemplate.setTemplateStatus(1);
+                    ruleAccountTemplateService.update(updateRuleAccountTemplate, ruleAccountTemplateQueryWrapper);
+                }
+            }
+
             UserAllocation update = userAllocationService.getById(userAllocation.getId());
             QueryWrapper<ProjectMember> memberQueryWrapper = new QueryWrapper<>();
             memberQueryWrapper.eq("user_id", update.getUserId());
@@ -478,30 +494,30 @@ public class UserAllocationController {
     }
 
     /**
-     *  账户绑定是否开启删评论开关
+     * 账户绑定是否开启删评论开关
      */
     @PostMapping(value = "/onOrOffDeleteComment")
-    public Result<Object> onOrOffMonitoringLink(@RequestParam Long accountId, @RequestParam Integer switchType){
-        Result<Object> result=new Result<>();
-        UserAllocation userAllocation=new UserAllocation();
+    public Result<Object> onOrOffMonitoringLink(@RequestParam Long accountId, @RequestParam Integer switchType) {
+        Result<Object> result = new Result<>();
+        UserAllocation userAllocation = new UserAllocation();
         userAllocation.setAccountId(accountId);
-        UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
+        UpdateWrapper<UserAllocation> wrapper = new UpdateWrapper<>();
         //开启删评论
-        if(switchType==0){
-            wrapper.set("delete_comment",0);
+        if (switchType == 0) {
+            wrapper.set("delete_comment", 0);
             wrapper.setEntity(userAllocation);
             boolean update = userAllocationService.update(wrapper);
-            if(update){
+            if (update) {
                 result.success("删评论开启成功");
             }
-        }else if(switchType==1){
-            wrapper.set("delete_comment",1);
+        } else if (switchType == 1) {
+            wrapper.set("delete_comment", 1);
             wrapper.setEntity(userAllocation);
             boolean update = userAllocationService.update(wrapper);
-            if(update){
+            if (update) {
                 result.success("删评论关闭成功");
             }
-        }else {
+        } else {
             result.error500("未知操作");
         }
         return result;

+ 7 - 5
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -24,7 +24,6 @@ import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyServ
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
@@ -64,10 +63,12 @@ public class SampleTest {
     private IKuaishouInterfaceService iKuaishouInterfaceService;
 
     @Test
-    public void loadBytedanceCreativeData() {
+    public void loadBytedanceCreativeData() throws ParseException {
 
-        CtopOauthToken tokenByAccountId = oauthTokenService.getTokenByAccountId(9589905L);
-        iKuaishouInterfaceService.getGroupList(tokenByAccountId, null, null);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = simpleDateFormat.parse("2020-12-11");
+        CtopOauthToken tokenByAccountId = oauthTokenService.getTokenByAccountId(5982133L);
+        iKuaishouInterfaceService.getAdvertiserGroupReportDaily(tokenByAccountId, parse, parse);
 
       /*  QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("media_id", 2);
@@ -377,9 +378,10 @@ public class SampleTest {
 
     @Autowired
     private IRuleKuaiShouPlanService ruleKuaiShouPlanService;
+
     @Test
     public void execute() {
-        CtopOauthToken token= tokenService.getTokenByAccountId(9589905L);
+        CtopOauthToken token = tokenService.getTokenByAccountId(9589905L);
         ruleKuaiShouPlanService.cleanRuleDataTarget(token.getAccountId(), 1);
     }
 

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleAccountTemplate.java

@@ -44,6 +44,7 @@ public class RuleAccountTemplate {
     @Excel(name = "模板id", width = 15)
     @ApiModelProperty(value = "模板id")
     private Long templateId;
+    private Integer templateStatus;
 
     /**
      * createTime

+ 10 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/vo/TemplateAppliedVo.java

@@ -8,6 +8,7 @@ public class TemplateAppliedVo {
     private String templateName;
     private Long projectId;
     private String projectName;
+    private Integer templateStatus;
     private String userId;
     private String userName;
 
@@ -67,6 +68,14 @@ public class TemplateAppliedVo {
         this.projectName = projectName;
     }
 
+    public Integer getTemplateStatus() {
+        return templateStatus;
+    }
+
+    public void setTemplateStatus(Integer templateStatus) {
+        this.templateStatus = templateStatus;
+    }
+
     public String getUserId() {
         return userId;
     }
@@ -93,6 +102,7 @@ public class TemplateAppliedVo {
                 ", templateName='" + templateName + '\'' +
                 ", projectId=" + projectId +
                 ", projectName='" + projectName + '\'' +
+                ", templateStatus=" + templateStatus +
                 ", userId='" + userId + '\'' +
                 ", userName='" + userName + '\'' +
                 '}';

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleAccountTemplateMapper.xml

@@ -6,6 +6,7 @@
             resultType="cn.com.ctop.alarm.modules.entity.vo.TemplateAppliedVo">
         select
         t1.id id,
+        t1.template_status templateStatus,
         t1.account_id accountId,
         t2.auth_name authName,
         t1.template_id templateId,

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

@@ -506,6 +506,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
+        System.err.println(resultJson);
         Integer code = resultJson.getInteger("code");
         String message = resultJson.getString("message");
         if (null == code || code != 0) {