|
@@ -2,10 +2,11 @@ package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
|
import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
|
|
|
+import cn.com.ctop.common.module.entity.Advertiser;
|
|
|
import cn.com.ctop.common.module.entity.Project;
|
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
|
import cn.com.ctop.common.module.mapper.ProjectMapper;
|
|
|
-import cn.com.ctop.common.module.service.IProjectService;
|
|
|
+import cn.com.ctop.common.module.service.IProductService;
|
|
|
import cn.com.ctop.common.module.service.ISysRoleExtService;
|
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
import cn.com.ctop.common.module.utils.*;
|
|
@@ -28,14 +29,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
-import org.jeecg.modules.ctop.entity.Advertiser;
|
|
|
import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
|
|
|
import org.jeecg.modules.ctop.service.IAdvertiserService;
|
|
|
import org.jeecg.modules.excelutil.entity.*;
|
|
|
-import org.jeecg.modules.system.entity.SysCategory;
|
|
|
import org.jeecg.modules.system.entity.UserCompany;
|
|
|
import org.jeecg.modules.system.mapper.UserCompanyMapper;
|
|
|
-import org.jeecg.modules.system.service.ISysCategoryService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -61,8 +59,6 @@ public class AdvertiserController {
|
|
|
@Autowired
|
|
|
private IAdvertiserService advertiserService;
|
|
|
@Autowired
|
|
|
- private ISysCategoryService sysCategoryService;
|
|
|
- @Autowired
|
|
|
private UserCompanyMapper userCompanyMapper;
|
|
|
@Autowired
|
|
|
private ISysRoleExtService sysRoleService;
|
|
@@ -120,15 +116,16 @@ public class AdvertiserController {
|
|
|
@RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
|
|
|
HttpServletRequest req) {
|
|
|
Result<IPage<Advertiser>> result = new Result<>();
|
|
|
- String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
|
|
|
- String userId = advertiser.getUserId();
|
|
|
+ // String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
|
|
|
+ /* String userId = advertiser.getUserId();
|
|
|
if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
|
|
|
advertiser.setUserId(null);
|
|
|
- }
|
|
|
- String industryId = advertiser.getIndustryId();
|
|
|
- advertiser.setIndustryId(null);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ String name = advertiser.getName();
|
|
|
+ advertiser.setName(null);
|
|
|
QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());
|
|
|
- if ("kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
|
|
|
+ /* if ("kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
|
|
|
QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
|
|
|
userCompanyQueryWrapper.eq("user_id", userId);
|
|
|
userCompanyQueryWrapper.orderByDesc("create_time");
|
|
@@ -137,12 +134,9 @@ public class AdvertiserController {
|
|
|
if (!Check.isNull(userCompany)) {
|
|
|
queryWrapper.eq("company_id", userCompany.getCompanyId());
|
|
|
}
|
|
|
- }
|
|
|
- if (null != industryId && !"".equals(industryId.trim())) {
|
|
|
- SysCategory category = sysCategoryService.getById(industryId);
|
|
|
- if (null != category) {
|
|
|
- queryWrapper.likeRight("industry_code", category.getCode());
|
|
|
- }
|
|
|
+ }*/
|
|
|
+ if (!Check.isNull(name)) {
|
|
|
+ queryWrapper.like("name", name);
|
|
|
}
|
|
|
Page<Advertiser> page = new Page<>(pageNo, pageSize);
|
|
|
IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
|
|
@@ -184,14 +178,6 @@ public class AdvertiserController {
|
|
|
if (!Check.isNull(userCompany)) {
|
|
|
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);
|
|
|
result.success("添加成功!");
|
|
|
} catch (Exception e) {
|
|
@@ -207,8 +193,6 @@ public class AdvertiserController {
|
|
|
* @param advertiser
|
|
|
* @return
|
|
|
*/
|
|
|
- @Autowired
|
|
|
- private IProjectService projectService;
|
|
|
|
|
|
@AutoLog(value = "广告主信息表-编辑")
|
|
|
@ApiOperation(value = "广告主信息表-编辑", notes = "广告主信息表-编辑")
|
|
@@ -219,25 +203,7 @@ public class AdvertiserController {
|
|
|
if (advertiserEntity == null) {
|
|
|
result.error500("未找到对应实体");
|
|
|
} 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);
|
|
|
- QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
|
|
|
- projectQueryWrapper.eq("advertiser_id", advertiser.getId());
|
|
|
- Project updateProject = new Project();
|
|
|
- updateProject.setAdvertiserName(advertiser.getName());
|
|
|
- projectService.update(updateProject, projectQueryWrapper);
|
|
|
- QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
|
|
|
- userAllocationQueryWrapper.eq("advertiser_id", advertiser.getId());
|
|
|
- UserAllocation updateUserAllocation = new UserAllocation();
|
|
|
- updateUserAllocation.setAdvertiserName(advertiser.getName());
|
|
|
- userAllocationService.update(updateUserAllocation, userAllocationQueryWrapper);
|
|
|
if (ok) {
|
|
|
result.success("修改成功!");
|
|
|
}
|
|
@@ -252,6 +218,9 @@ public class AdvertiserController {
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Autowired
|
|
|
+ private IProductService productService;
|
|
|
+
|
|
|
@AutoLog(value = "广告主信息表-通过id删除")
|
|
|
@ApiOperation(value = "广告主信息表-通过id删除", notes = "广告主信息表-通过id删除")
|
|
|
@DeleteMapping(value = "/delete")
|
|
@@ -269,9 +238,14 @@ public class AdvertiserController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("project_id", project.getId());
|
|
|
projectMemberMapper.deleteByMap(map);
|
|
|
+ userAllocationService.removeByMap(map);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ Map<String, Object> productDeleteMap = new HashMap<>();
|
|
|
+ productDeleteMap.put("advertiser_id", id);
|
|
|
+ productService.removeByMap(productDeleteMap);
|
|
|
+
|
|
|
projectMapper.delete(queryWrapper);
|
|
|
boolean ok = advertiserService.removeById(id);
|
|
|
if (ok) {
|
|
@@ -456,11 +430,11 @@ public class AdvertiserController {
|
|
|
@RequestMapping("/exportKuaishouProjectInfo")
|
|
|
public void getKuaishouProjectInfo(@RequestBody KuaishouInfoDTO dto,
|
|
|
HttpServletRequest request,
|
|
|
- HttpServletResponse response)throws IOException {
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
Result<PageInfo<ProjectAccountDTO>> result = new Result<>();
|
|
|
result.setSuccess(true);
|
|
|
|
|
|
- if(dto.getPageSize() == 0){
|
|
|
+ if (dto.getPageSize() == 0) {
|
|
|
dto.setPageSize(100000);
|
|
|
}
|
|
|
OutputStream outputStream = response.getOutputStream();
|
|
@@ -468,36 +442,36 @@ public class AdvertiserController {
|
|
|
HttpUtils.setResponseHeader(response, "快手效果报表" + date + ".xlsx");
|
|
|
ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
|
|
|
String type = dto.getType();
|
|
|
- if(null!=type&&type.trim().equals("project")){
|
|
|
+ if (null != type && type.trim().equals("project")) {
|
|
|
SheetInfoVo projectSheetVo = this.getProjectSheetVo(dto, "项目报表");
|
|
|
- Sheet sheet = new Sheet( 1, 0, EffecfReportProjectEntity.class);
|
|
|
+ Sheet sheet = new Sheet(1, 0, EffecfReportProjectEntity.class);
|
|
|
sheet.setSheetName(projectSheetVo.getSheetName());
|
|
|
excelWriter.write(projectSheetVo.getDetails(), sheet);
|
|
|
}
|
|
|
- if(null!=type&&type.trim().equals("account")){
|
|
|
+ if (null != type && type.trim().equals("account")) {
|
|
|
SheetInfoVo accountSheetVo = this.getAccountSheetVo(dto, "账户报表");
|
|
|
- Sheet sheet = new Sheet( 1, 0, EffecfReportAccountEntity.class);
|
|
|
+ Sheet sheet = new Sheet(1, 0, EffecfReportAccountEntity.class);
|
|
|
sheet.setSheetName(accountSheetVo.getSheetName());
|
|
|
excelWriter.write(accountSheetVo.getDetails(), sheet);
|
|
|
}
|
|
|
|
|
|
- if(null!=type&&type.trim().equals("campaign")){
|
|
|
+ if (null != type && type.trim().equals("campaign")) {
|
|
|
SheetInfoVo planSheetVo = this.getPlanSheetVo(dto, "广告计划报表");
|
|
|
- Sheet sheet = new Sheet( 1, 0, EffecfReportPlanEntity.class);
|
|
|
+ Sheet sheet = new Sheet(1, 0, EffecfReportPlanEntity.class);
|
|
|
sheet.setSheetName(planSheetVo.getSheetName());
|
|
|
excelWriter.write(planSheetVo.getDetails(), sheet);
|
|
|
}
|
|
|
|
|
|
- if(null!=type&&type.trim().equals("group")){
|
|
|
+ if (null != type && type.trim().equals("group")) {
|
|
|
SheetInfoVo campaignSheetVo = this.getGroupSheetVo(dto, "广告组报表");
|
|
|
- Sheet sheet = new Sheet( 1, 0, EffecfReportGroupEntity.class);
|
|
|
+ Sheet sheet = new Sheet(1, 0, EffecfReportGroupEntity.class);
|
|
|
sheet.setSheetName(campaignSheetVo.getSheetName());
|
|
|
excelWriter.write(campaignSheetVo.getDetails(), sheet);
|
|
|
}
|
|
|
|
|
|
- if(null!=type&&type.trim().equals("creative")){
|
|
|
+ if (null != type && type.trim().equals("creative")) {
|
|
|
SheetInfoVo creativeSheetVo = this.getCreativeSheetVo(dto, "广告创意");
|
|
|
- Sheet sheet = new Sheet( 1, 0, EffecfReportCreativeEntity.class);
|
|
|
+ Sheet sheet = new Sheet(1, 0, EffecfReportCreativeEntity.class);
|
|
|
sheet.setSheetName(creativeSheetVo.getSheetName());
|
|
|
excelWriter.write(creativeSheetVo.getDetails(), sheet);
|
|
|
}
|
|
@@ -510,13 +484,13 @@ public class AdvertiserController {
|
|
|
private SheetInfoVo getCreativeSheetVo(KuaishouInfoDTO dto, String sheetName) {
|
|
|
SheetInfoVo vo = new SheetInfoVo<EffecfReportProjectEntity>();
|
|
|
vo.setSheetName(sheetName);
|
|
|
- PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCreativeInfoByUnitId(dto.getProjectList(), dto.getUnitId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
|
|
|
+ PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCreativeInfoByUnitId(dto.getProjectList(), dto.getUnitId(), dto.getStartDate(), dto.getEndDate(), dto.getPageSize(), dto.getPageNum(), dto.getYn());
|
|
|
List<KuaishouReportDailyAccountDTO> dtos = kuaishouCampaignInfoList.getList();
|
|
|
- if(null!=dtos&&!dtos.isEmpty()){
|
|
|
+ if (null != dtos && !dtos.isEmpty()) {
|
|
|
List<EffecfReportCreativeEntity> details = new ArrayList<>();
|
|
|
- for(KuaishouReportDailyAccountDTO dto1:dtos){
|
|
|
+ for (KuaishouReportDailyAccountDTO dto1 : dtos) {
|
|
|
EffecfReportCreativeEntity entity = new EffecfReportCreativeEntity();
|
|
|
- BeanUtils.copyProperties(dto1,entity);
|
|
|
+ BeanUtils.copyProperties(dto1, entity);
|
|
|
details.add(entity);
|
|
|
}
|
|
|
vo.setDetails(details);
|
|
@@ -527,13 +501,13 @@ public class AdvertiserController {
|
|
|
private SheetInfoVo getGroupSheetVo(KuaishouInfoDTO dto, String sheetName) {
|
|
|
SheetInfoVo vo = new SheetInfoVo<EffecfReportProjectEntity>();
|
|
|
vo.setSheetName(sheetName);
|
|
|
- PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouUnitInfoByCampaignId(dto.getProjectList(), dto.getCampaignId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
|
|
|
+ PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouUnitInfoByCampaignId(dto.getProjectList(), dto.getCampaignId(), dto.getStartDate(), dto.getEndDate(), dto.getPageSize(), dto.getPageNum(), dto.getYn());
|
|
|
List<KuaishouReportDailyAccountDTO> dtos = kuaishouCampaignInfoList.getList();
|
|
|
- if(null!=dtos&&!dtos.isEmpty()){
|
|
|
+ if (null != dtos && !dtos.isEmpty()) {
|
|
|
List<EffecfReportGroupEntity> details = new ArrayList<>();
|
|
|
- for(KuaishouReportDailyAccountDTO dto1:dtos){
|
|
|
+ for (KuaishouReportDailyAccountDTO dto1 : dtos) {
|
|
|
EffecfReportGroupEntity entity = new EffecfReportGroupEntity();
|
|
|
- BeanUtils.copyProperties(dto1,entity);
|
|
|
+ BeanUtils.copyProperties(dto1, entity);
|
|
|
details.add(entity);
|
|
|
}
|
|
|
vo.setDetails(details);
|
|
@@ -544,13 +518,13 @@ public class AdvertiserController {
|
|
|
private SheetInfoVo getPlanSheetVo(KuaishouInfoDTO dto, String sheetName) {
|
|
|
SheetInfoVo vo = new SheetInfoVo<EffecfReportProjectEntity>();
|
|
|
vo.setSheetName(sheetName);
|
|
|
- PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCampaignInfoByAccountId(dto.getProjectList(), dto.getAccountId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
|
|
|
+ PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCampaignInfoByAccountId(dto.getProjectList(), dto.getAccountId(), dto.getStartDate(), dto.getEndDate(), dto.getPageSize(), dto.getPageNum(), dto.getYn());
|
|
|
List<KuaishouReportDailyAccountDTO> dtos = kuaishouCampaignInfoList.getList();
|
|
|
- if(null!=dtos&&!dtos.isEmpty()){
|
|
|
+ if (null != dtos && !dtos.isEmpty()) {
|
|
|
List<EffecfReportPlanEntity> details = new ArrayList<>();
|
|
|
- for(KuaishouReportDailyAccountDTO dto1:dtos){
|
|
|
+ for (KuaishouReportDailyAccountDTO dto1 : dtos) {
|
|
|
EffecfReportPlanEntity entity = new EffecfReportPlanEntity();
|
|
|
- BeanUtils.copyProperties(dto1,entity);
|
|
|
+ BeanUtils.copyProperties(dto1, entity);
|
|
|
details.add(entity);
|
|
|
}
|
|
|
vo.setDetails(details);
|
|
@@ -561,13 +535,13 @@ public class AdvertiserController {
|
|
|
private SheetInfoVo getAccountSheetVo(KuaishouInfoDTO dto, String sheetName) {
|
|
|
SheetInfoVo vo = new SheetInfoVo<EffecfReportProjectEntity>();
|
|
|
vo.setSheetName(sheetName);
|
|
|
- PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouAccountInfoByProjectId(dto.getProjectId(),dto.getProjectList(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
|
|
|
+ PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouAccountInfoByProjectId(dto.getProjectId(), dto.getProjectList(), dto.getStartDate(), dto.getEndDate(), dto.getPageSize(), dto.getPageNum(), dto.getYn());
|
|
|
List<KuaishouReportDailyAccountDTO> dtos = kuaishouReportDailyAccountDTOList.getList();
|
|
|
- if(null!=dtos&&!dtos.isEmpty()){
|
|
|
+ if (null != dtos && !dtos.isEmpty()) {
|
|
|
List<EffecfReportAccountEntity> details = new ArrayList<>();
|
|
|
- for(KuaishouReportDailyAccountDTO dto1:dtos){
|
|
|
+ for (KuaishouReportDailyAccountDTO dto1 : dtos) {
|
|
|
EffecfReportAccountEntity entity = new EffecfReportAccountEntity();
|
|
|
- BeanUtils.copyProperties(dto1,entity);
|
|
|
+ BeanUtils.copyProperties(dto1, entity);
|
|
|
details.add(entity);
|
|
|
}
|
|
|
vo.setDetails(details);
|
|
@@ -578,13 +552,13 @@ public class AdvertiserController {
|
|
|
private SheetInfoVo getProjectSheetVo(KuaishouInfoDTO dto, String sheetName) {
|
|
|
SheetInfoVo vo = new SheetInfoVo<EffecfReportProjectEntity>();
|
|
|
vo.setSheetName(sheetName);
|
|
|
- PageInfo<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageSize(),dto.getPageNum(), "", dto.getYn());
|
|
|
+ PageInfo<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(), dto.getPageSize(), dto.getPageNum(), "", dto.getYn());
|
|
|
List<ProjectAccountDTO> dtos = projectAccountDTOList.getList();
|
|
|
- if(null!=dtos&&!dtos.isEmpty()){
|
|
|
+ if (null != dtos && !dtos.isEmpty()) {
|
|
|
List<EffecfReportProjectEntity> details = new ArrayList<>();
|
|
|
- for(ProjectAccountDTO dto1:dtos){
|
|
|
+ for (ProjectAccountDTO dto1 : dtos) {
|
|
|
EffecfReportProjectEntity entity = new EffecfReportProjectEntity();
|
|
|
- BeanUtils.copyProperties(dto1,entity);
|
|
|
+ BeanUtils.copyProperties(dto1, entity);
|
|
|
details.add(entity);
|
|
|
}
|
|
|
vo.setDetails(details);
|