|
@@ -1,10 +1,15 @@
|
|
|
package org.jeecg.modules.bytedance.advertise.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.sun.mail.util.QEncoderStream;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.modules.bytedance.advertise.dockapi.marketing;
|
|
|
import org.jeecg.modules.bytedance.advertise.entity.AiBytedanceAdDplinkInfo;
|
|
@@ -28,10 +33,12 @@ import org.jeecg.modules.bytedance.common.service.ICtopOauthTokenService;
|
|
|
import org.jeecg.modules.bytedance.common.service.IMaterialImageInfoService;
|
|
|
import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
|
|
|
import org.jeecg.modules.bytedance.common.utils.Check;
|
|
|
+import org.simpleframework.xml.strategy.Strategy;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.transaction.Transactional;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -138,8 +145,32 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- public Result updStaById(String id,String state) {
|
|
|
- aiBytedanceAdvertiserStrategyMapper.updStaById(id,state);
|
|
|
+ @Transactional
|
|
|
+ public Result updStaById(String id,String state,String accountId) {
|
|
|
+ //开启
|
|
|
+ if (StringUtils.equals(state,"0")){
|
|
|
+ //修改状态为开启
|
|
|
+ aiBytedanceAdvertiserStrategyMapper.updStaById(id,state);
|
|
|
+ //关闭 账户下 其他数据信息(不包含本条id信息) 状态为 关闭
|
|
|
+ aiBytedanceAdvertiserStrategyMapper.updStaByAccountId(accountId,"1",id);
|
|
|
+ }
|
|
|
+ //关闭
|
|
|
+ if (StringUtils.equals(state,"1")){
|
|
|
+ //查询是否有 状态为 开启 其他数据信息(不包含本id数据信息)
|
|
|
+ QueryWrapper<AiBytedanceAdvertiserStrategy> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("account_id", accountId);
|
|
|
+ queryWrapper.eq("status", "0");
|
|
|
+ queryWrapper.ne("id", id);
|
|
|
+ List<AiBytedanceAdvertiserStrategy> list = aiBytedanceAdvertiserStrategyMapper.selectList(queryWrapper);
|
|
|
+ //list 空 代表 只有当前数据 状态为 开启 则 状态 无法修改 为 关闭
|
|
|
+ if (Check.isNull(list)){
|
|
|
+ return Result.successMsg("无法关闭,同一账户下有且仅有一条配置信息状态数据为【开启】", null);
|
|
|
+ }
|
|
|
+ // 修改 账户下 状态 为关闭 (不包含本条数据信息)
|
|
|
+ aiBytedanceAdvertiserStrategyMapper.updStaByAccountId(accountId,state,id);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return Result.successMsg("状态修改成功---》"+(state.equals("0") ? "开" : "关"), null);
|
|
|
}
|
|
|
|