|
@@ -27,11 +27,9 @@ import org.jeecg.modules.ctop.service.IProjectService;
|
|
import org.jeecg.modules.ctop.vo.SheetInfoVo;
|
|
import org.jeecg.modules.ctop.vo.SheetInfoVo;
|
|
import org.jeecg.modules.excelutil.entity.KuaishouXxlEntity;
|
|
import org.jeecg.modules.excelutil.entity.KuaishouXxlEntity;
|
|
import org.jeecg.modules.system.entity.SysCategory;
|
|
import org.jeecg.modules.system.entity.SysCategory;
|
|
-import org.jeecg.modules.system.entity.SysUser;
|
|
|
|
import org.jeecg.modules.system.entity.UserCompany;
|
|
import org.jeecg.modules.system.entity.UserCompany;
|
|
import org.jeecg.modules.system.mapper.UserCompanyMapper;
|
|
import org.jeecg.modules.system.mapper.UserCompanyMapper;
|
|
import org.jeecg.modules.system.service.ISysCategoryService;
|
|
import org.jeecg.modules.system.service.ISysCategoryService;
|
|
-import org.jeecg.modules.system.service.ISysUserService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -114,13 +112,14 @@ public class AdvertiserController {
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
|
|
@RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
|
|
HttpServletRequest req) {
|
|
HttpServletRequest req) {
|
|
-
|
|
|
|
Result<IPage<Advertiser>> result = new Result<>();
|
|
Result<IPage<Advertiser>> result = new Result<>();
|
|
String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
|
|
String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
|
|
String userId = advertiser.getUserId();
|
|
String userId = advertiser.getUserId();
|
|
if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
|
|
if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
|
|
advertiser.setUserId(null);
|
|
advertiser.setUserId(null);
|
|
}
|
|
}
|
|
|
|
+ String industryId = advertiser.getIndustryId();
|
|
|
|
+ advertiser.setIndustryId(null);
|
|
QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());
|
|
QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());
|
|
if ("kuaishouOperationManager".equals(roleCode)) {
|
|
if ("kuaishouOperationManager".equals(roleCode)) {
|
|
QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
|
|
@@ -132,32 +131,19 @@ public class AdvertiserController {
|
|
queryWrapper.eq("company_id", userCompany.getCompanyId());
|
|
queryWrapper.eq("company_id", userCompany.getCompanyId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Page<Advertiser> page = new Page<>(pageNo, pageSize);
|
|
|
|
- IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
|
|
|
|
- if (pageList != null && pageList.getRecords() != null && !pageList.getRecords().isEmpty()) {
|
|
|
|
- List<Advertiser> list = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < pageList.getRecords().size(); i++) {
|
|
|
|
- Advertiser advertiserRecord = pageList.getRecords().get(i);
|
|
|
|
- SysCategory sysCategory = sysCategoryService.getById(advertiserRecord.getIndustryId());
|
|
|
|
- if (sysCategory != null) {
|
|
|
|
- advertiserRecord.setIndustryId(sysCategory.getName());
|
|
|
|
- }
|
|
|
|
- SysUser user = sysUserService.getById(advertiserRecord.getSaleId());
|
|
|
|
- if (null != user) {
|
|
|
|
- advertiserRecord.setSaleName(user.getRealname());
|
|
|
|
- }
|
|
|
|
- list.add(advertiserRecord);
|
|
|
|
|
|
+ if(null!=industryId&&!"".equals(industryId.trim())){
|
|
|
|
+ SysCategory category = sysCategoryService.getById(industryId);
|
|
|
|
+ if(null!=category){
|
|
|
|
+ queryWrapper.likeRight("industry_code",category.getCode());
|
|
}
|
|
}
|
|
- pageList.setRecords(list);
|
|
|
|
}
|
|
}
|
|
|
|
+ Page<Advertiser> page = new Page<>(pageNo, pageSize);
|
|
|
|
+ IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(pageList);
|
|
result.setResult(pageList);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private ISysUserService sysUserService;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 添加
|
|
* 添加
|
|
*
|
|
*
|
|
@@ -191,6 +177,14 @@ public class AdvertiserController {
|
|
if (!Check.isNull(userCompany)) {
|
|
if (!Check.isNull(userCompany)) {
|
|
advertiser.setCompanyId(userCompany.getCompanyId());
|
|
advertiser.setCompanyId(userCompany.getCompanyId());
|
|
}
|
|
}
|
|
|
|
+ String industryId = advertiser.getIndustryId();
|
|
|
|
+ if(null!=industryId&&!"".equals(industryId.trim())){
|
|
|
|
+ SysCategory category = sysCategoryService.getById(industryId);
|
|
|
|
+ if(null!=category){
|
|
|
|
+ advertiser.setIndustryId(category.getId());
|
|
|
|
+ advertiser.setIndustryCode(category.getCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
advertiserService.save(advertiser);
|
|
advertiserService.save(advertiser);
|
|
result.success("添加成功!");
|
|
result.success("添加成功!");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -218,6 +212,14 @@ public class AdvertiserController {
|
|
if (advertiserEntity == null) {
|
|
if (advertiserEntity == null) {
|
|
result.error500("未找到对应实体");
|
|
result.error500("未找到对应实体");
|
|
} else {
|
|
} else {
|
|
|
|
+ String industryId = advertiser.getIndustryId();
|
|
|
|
+ if(null!=industryId&&!"".equals(industryId.trim())){
|
|
|
|
+ SysCategory category = sysCategoryService.getById(industryId);
|
|
|
|
+ if(null!=category){
|
|
|
|
+ advertiser.setIndustryId(category.getId());
|
|
|
|
+ advertiser.setIndustryCode(category.getCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
boolean ok = advertiserService.updateById(advertiser);
|
|
boolean ok = advertiserService.updateById(advertiser);
|
|
QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
|
|
projectQueryWrapper.eq("advertiser_id", advertiser.getId());
|
|
projectQueryWrapper.eq("advertiser_id", advertiser.getId());
|