|
@@ -42,7 +42,7 @@ import java.util.UUID;
|
|
public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPopulationPackageMapper, KuaishouPopulationPackage> implements IKuaishouPopulationPackageService {
|
|
public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPopulationPackageMapper, KuaishouPopulationPackage> implements IKuaishouPopulationPackageService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private KuaishouPopulationPackageMapper KuaishouPopulationPackageMapper;
|
|
|
|
|
|
+ private KuaishouPopulationPackageMapper kuaishouPopulationPackageMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private KuaishouPopulationPackageRelMapper relMapper;
|
|
private KuaishouPopulationPackageRelMapper relMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -65,7 +65,7 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
|
|
wrapper.eq("orientation_name", kuaishouPopulationPackage.getOrientationName());
|
|
wrapper.eq("orientation_name", kuaishouPopulationPackage.getOrientationName());
|
|
wrapper.eq("data_status", 1);
|
|
wrapper.eq("data_status", 1);
|
|
wrapper.last("limit 1");
|
|
wrapper.last("limit 1");
|
|
- KuaishouPopulationPackage checkName = KuaishouPopulationPackageMapper.selectOne(wrapper);
|
|
|
|
|
|
+ KuaishouPopulationPackage checkName = kuaishouPopulationPackageMapper.selectOne(wrapper);
|
|
if (!Check.isNull(checkName)) {
|
|
if (!Check.isNull(checkName)) {
|
|
return Result.error("该项目下已存在人群包名,请重新输入!");
|
|
return Result.error("该项目下已存在人群包名,请重新输入!");
|
|
}
|
|
}
|
|
@@ -87,7 +87,7 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
|
|
queryWrapper.eq("signature", md5);
|
|
queryWrapper.eq("signature", md5);
|
|
queryWrapper.eq("data_status", 1);
|
|
queryWrapper.eq("data_status", 1);
|
|
queryWrapper.last("limit 1");
|
|
queryWrapper.last("limit 1");
|
|
- KuaishouPopulationPackage one = KuaishouPopulationPackageMapper.selectOne(queryWrapper);
|
|
|
|
|
|
+ KuaishouPopulationPackage one = kuaishouPopulationPackageMapper.selectOne(queryWrapper);
|
|
if (!Check.isNull(one)) {
|
|
if (!Check.isNull(one)) {
|
|
return Result.error("该项目已上传过此人群包,人群包名为:" + one.getOrientationName());
|
|
return Result.error("该项目已上传过此人群包,人群包名为:" + one.getOrientationName());
|
|
}
|
|
}
|
|
@@ -113,7 +113,7 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result<Object> push(JSONArray accountIds, Long id) {
|
|
public Result<Object> push(JSONArray accountIds, Long id) {
|
|
- KuaishouPopulationPackage pPackage = KuaishouPopulationPackageMapper.selectById(id);
|
|
|
|
|
|
+ KuaishouPopulationPackage pPackage = kuaishouPopulationPackageMapper.selectById(id);
|
|
if (Check.isNull(pPackage)) {
|
|
if (Check.isNull(pPackage)) {
|
|
return Result.error("没有获取到人群包");
|
|
return Result.error("没有获取到人群包");
|
|
}
|
|
}
|
|
@@ -237,12 +237,12 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result<Object> queryPageList(KuaishouPopulationPackage kuaishouPopulationPackage, Integer pageNo, Integer pageSize) {
|
|
public Result<Object> queryPageList(KuaishouPopulationPackage kuaishouPopulationPackage, Integer pageNo, Integer pageSize) {
|
|
- Long total = KuaishouPopulationPackageMapper.queryPageListTotal(kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
|
|
|
|
|
|
+ Long total = kuaishouPopulationPackageMapper.queryPageListTotal(kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
|
|
PageHelper.startPage(pageNo, pageSize, false);
|
|
PageHelper.startPage(pageNo, pageSize, false);
|
|
- List<JSONObject> list = KuaishouPopulationPackageMapper.queryPageList(kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
|
|
|
|
|
|
+ List<JSONObject> list = kuaishouPopulationPackageMapper.queryPageList(kuaishouPopulationPackage.getProjectId(), kuaishouPopulationPackage.getOrientationName());
|
|
if (!Check.isNull(list)) {
|
|
if (!Check.isNull(list)) {
|
|
for (JSONObject object : list) {
|
|
for (JSONObject object : list) {
|
|
- object.put("unitCount", KuaishouPopulationPackageMapper.queryUnitCount(object.getLong("id")));
|
|
|
|
|
|
+ object.put("unitCount", kuaishouPopulationPackageMapper.queryUnitCount(object.getLong("id")));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
PageInfo pageInfo = new PageInfo(list);
|
|
PageInfo pageInfo = new PageInfo(list);
|
|
@@ -270,16 +270,18 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result<Object> getRelatedGroups(Long id, Long accountId) {
|
|
public Result<Object> getRelatedGroups(Long id, Long accountId) {
|
|
- List<JSONObject> list = KuaishouPopulationPackageMapper.getRelatedGroups(id, accountId);
|
|
|
|
|
|
+ List<JSONObject> list = kuaishouPopulationPackageMapper.getRelatedGroups(id, accountId);
|
|
return Result.ok(new PageInfo<>(list));
|
|
return Result.ok(new PageInfo<>(list));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void crowdListQuery() {
|
|
public void crowdListQuery() {
|
|
- List<Long> accountIds = KuaishouPopulationPackageMapper.queryListByStatus();
|
|
|
|
|
|
+ List<JSONObject> objs = kuaishouPopulationPackageMapper.queryListByStatus();
|
|
for (int i = 0; i <= 7; i++) {
|
|
for (int i = 0; i <= 7; i++) {
|
|
if (i != 2) {
|
|
if (i != 2) {
|
|
- for (Long accountId : accountIds) {
|
|
|
|
|
|
+ for (JSONObject o : objs) {
|
|
|
|
+ Long accountId = o.getLong("account_id");
|
|
|
|
+ Long projectId = o.getLong("project_id");
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
if (!Check.isNull(token)) {
|
|
if (!Check.isNull(token)) {
|
|
JSONObject jsonObject = iKuaishouPopulationService.getPopulationList(accountId, token.getAccessToken(), i);
|
|
JSONObject jsonObject = iKuaishouPopulationService.getPopulationList(accountId, token.getAccessToken(), i);
|
|
@@ -290,8 +292,15 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
|
|
if (details.size() > 0) {
|
|
if (details.size() > 0) {
|
|
for (int j = 0; j < details.size(); j++) {
|
|
for (int j = 0; j < details.size(); j++) {
|
|
JSONObject obj = details.getJSONObject(j);
|
|
JSONObject obj = details.getJSONObject(j);
|
|
- KuaishouPopulationPackageRel rel = JSONObject.parseObject(obj.toJSONString(),KuaishouPopulationPackageRel.class);
|
|
|
|
- relMapper.updateStatus(rel);
|
|
|
|
|
|
+ KuaishouPopulationPackageRel rel = JSONObject.parseObject(obj.toJSONString(), KuaishouPopulationPackageRel.class);
|
|
|
|
+ if (Check.isNull(relMapper.queryByOrientationId(rel.getOrientationId(), rel.getAccountId()))) {
|
|
|
|
+ rel.setProjectId(projectId);
|
|
|
|
+ rel.setDataStatus(1);
|
|
|
|
+ rel.setStatDate(DateUtils.formatDate(new Date()));
|
|
|
|
+ relService.save(rel);
|
|
|
|
+ } else {
|
|
|
|
+ relMapper.updateStatus(rel);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -308,4 +317,18 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
|
|
return Result.ok(new PageInfo<>(list));
|
|
return Result.ok(new PageInfo<>(list));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Result<Object> checkPopulationPackage(String signature) {
|
|
|
|
+ KuaishouPopulationPackage ksPackage = kuaishouPopulationPackageMapper.checkPopulationPackage(signature);
|
|
|
|
+ if (Check.isNull(ksPackage)) {
|
|
|
|
+ return Result.ok("success");
|
|
|
|
+ } else {
|
|
|
|
+ Result<Object> r = new Result<>();
|
|
|
|
+ r.setCode(201);
|
|
|
|
+ r.setMessage("项目已保存过该人群包,名称为:" + ksPackage.getOrientationName());
|
|
|
|
+ r.setSuccess(true);
|
|
|
|
+ return r;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|