|
@@ -13,6 +13,8 @@ import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
|
+import org.jeecg.modules.system.entity.SysCategory;
|
|
|
|
+import org.jeecg.modules.system.service.ISysCategoryService;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -30,6 +32,7 @@ import java.io.IOException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -40,6 +43,8 @@ import java.util.Map;
|
|
public class KuaishouAdvertiserController {
|
|
public class KuaishouAdvertiserController {
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouAdAccountService kuaishouAdAccountService;
|
|
private IKuaishouAdAccountService kuaishouAdAccountService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysCategoryService sysCategoryService;
|
|
/**
|
|
/**
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
* @param kuaishouAdAccount
|
|
* @param kuaishouAdAccount
|
|
@@ -56,7 +61,46 @@ public class KuaishouAdvertiserController {
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
HttpServletRequest req) {
|
|
HttpServletRequest req) {
|
|
Result<IPage<KuaishouAdAccount>> result = new Result<IPage<KuaishouAdAccount>>();
|
|
Result<IPage<KuaishouAdAccount>> result = new Result<IPage<KuaishouAdAccount>>();
|
|
- QueryWrapper<KuaishouAdAccount> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAdAccount, req.getParameterMap());
|
|
|
|
|
|
+ Map<String, String[]> paramMap = new HashMap<>(req.getParameterMap());
|
|
|
|
+ paramMap.remove("dataProcess");
|
|
|
|
+ paramMap.remove("industry");
|
|
|
|
+ paramMap.remove("name");
|
|
|
|
+ String industry = req.getParameter("industry");
|
|
|
|
+ String name = req.getParameter("name");
|
|
|
|
+ SysCategory sysCategory = sysCategoryService.getById(industry);
|
|
|
|
+ kuaishouAdAccount.setDataProcess(null);
|
|
|
|
+ kuaishouAdAccount.setIndustry(null);
|
|
|
|
+ QueryWrapper<KuaishouAdAccount> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAdAccount, paramMap);
|
|
|
|
+ String dataProcess = req.getParameter("dataProcess");
|
|
|
|
+ if (name != null) {
|
|
|
|
+ queryWrapper.like("name", "%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+ if (sysCategory != null) {
|
|
|
|
+ queryWrapper.eq("industry_category", sysCategory.getName()).or()
|
|
|
|
+ .eq("first_industry", sysCategory.getName()).or()
|
|
|
|
+ .eq("second_industry", sysCategory.getName());
|
|
|
|
+ }
|
|
|
|
+ if (dataProcess != null) {
|
|
|
|
+ if (dataProcess.equals("industry")) {
|
|
|
|
+ queryWrapper.isNull("industry_category").or().isNull("first_industry").or().isNull("second_industry").isNull("industry_category").or().isNull("first_industry").or().isNull("second_industry").or().eq("second_industry", "").or().eq("second_industry", "").or().eq("second_industry", "");
|
|
|
|
+ } else if (dataProcess.equals("company")) {
|
|
|
|
+ queryWrapper.isNull("company").or().eq("company", "");
|
|
|
|
+ } else if (dataProcess.equals("product")) {
|
|
|
|
+ queryWrapper.isNull("product").or().eq("product", "");
|
|
|
|
+ } else if (dataProcess.equals("full")) {
|
|
|
|
+ queryWrapper.isNotNull("industry_category");
|
|
|
|
+ queryWrapper.ne("industry_category", "");
|
|
|
|
+ queryWrapper.isNotNull("first_industry");
|
|
|
|
+ queryWrapper.ne("first_industry", "");
|
|
|
|
+ queryWrapper.isNotNull("second_industry");
|
|
|
|
+ queryWrapper.ne("second_industry", "");
|
|
|
|
+ queryWrapper.isNotNull("company");
|
|
|
|
+ queryWrapper.ne("company", "");
|
|
|
|
+ queryWrapper.isNotNull("product");
|
|
|
|
+ queryWrapper.ne("product", "");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
Page<KuaishouAdAccount> page = new Page<KuaishouAdAccount>(pageNo, pageSize);
|
|
Page<KuaishouAdAccount> page = new Page<KuaishouAdAccount>(pageNo, pageSize);
|
|
IPage<KuaishouAdAccount> pageList = kuaishouAdAccountService.page(page, queryWrapper);
|
|
IPage<KuaishouAdAccount> pageList = kuaishouAdAccountService.page(page, queryWrapper);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
@@ -75,6 +119,13 @@ public class KuaishouAdvertiserController {
|
|
public Result<KuaishouAdAccount> add(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
|
|
public Result<KuaishouAdAccount> add(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
|
|
Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
|
|
Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
|
|
try {
|
|
try {
|
|
|
|
+ String industry = kuaishouAdAccount.getIndustry();
|
|
|
|
+ SysCategory secondCategory = sysCategoryService.getById(industry);
|
|
|
|
+ kuaishouAdAccount.setSecondIndustry(secondCategory.getName());
|
|
|
|
+ SysCategory firstCategory = sysCategoryService.getById(secondCategory.getPid());
|
|
|
|
+ kuaishouAdAccount.setFirstIndustry(firstCategory.getName());
|
|
|
|
+ SysCategory industryCategory = sysCategoryService.getById(firstCategory.getPid());
|
|
|
|
+ kuaishouAdAccount.setIndustryCategory(industryCategory.getName());
|
|
kuaishouAdAccountService.save(kuaishouAdAccount);
|
|
kuaishouAdAccountService.save(kuaishouAdAccount);
|
|
result.success("添加成功!");
|
|
result.success("添加成功!");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -95,10 +146,21 @@ public class KuaishouAdvertiserController {
|
|
public Result<KuaishouAdAccount> edit(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
|
|
public Result<KuaishouAdAccount> edit(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
|
|
Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
|
|
Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
|
|
KuaishouAdAccount kuaishouAdAccountEntity = kuaishouAdAccountService.getById(kuaishouAdAccount.getKsid());
|
|
KuaishouAdAccount kuaishouAdAccountEntity = kuaishouAdAccountService.getById(kuaishouAdAccount.getKsid());
|
|
|
|
+
|
|
if(kuaishouAdAccountEntity==null) {
|
|
if(kuaishouAdAccountEntity==null) {
|
|
result.error500("未找到对应实体");
|
|
result.error500("未找到对应实体");
|
|
}else {
|
|
}else {
|
|
- boolean ok = kuaishouAdAccountService.updateById(kuaishouAdAccount);
|
|
|
|
|
|
+ String industry = kuaishouAdAccount.getIndustry();
|
|
|
|
+ SysCategory secondCategory = sysCategoryService.getById(industry);
|
|
|
|
+ kuaishouAdAccount.setSecondIndustry(secondCategory.getName());
|
|
|
|
+ SysCategory firstCategory = sysCategoryService.getById(secondCategory.getPid());
|
|
|
|
+ kuaishouAdAccount.setFirstIndustry(firstCategory.getName());
|
|
|
|
+ SysCategory industryCategory = sysCategoryService.getById(firstCategory.getPid());
|
|
|
|
+ kuaishouAdAccount.setIndustryCategory(industryCategory.getName());
|
|
|
|
+ QueryWrapper<KuaishouAdAccount> queryWrapper = new QueryWrapper<KuaishouAdAccount>();
|
|
|
|
+ queryWrapper.eq("ksid", kuaishouAdAccount.getKsid());
|
|
|
|
+ boolean ok = kuaishouAdAccountService.update(kuaishouAdAccount, queryWrapper);
|
|
|
|
+// boolean ok = kuaishouAdAccountService.updateById(kuaishouAdAccount);
|
|
//TODO 返回false说明什么?
|
|
//TODO 返回false说明什么?
|
|
if(ok) {
|
|
if(ok) {
|
|
result.success("修改成功!");
|
|
result.success("修改成功!");
|