refactor(view): 市场活动模块优化

This commit is contained in:
mzr 2024-11-12 18:30:11 +08:00
parent d696a6c205
commit 7f823b4128
2 changed files with 262 additions and 507 deletions

View File

@ -2,27 +2,25 @@ package com.yb.lb.webapp.view;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yb.lb.common.core.AjaxResult;
import com.yb.lb.common.core.BaseController;
import com.yb.lb.common.utils.DateUtil; import com.yb.lb.common.utils.DateUtil;
import com.yb.lb.common.utils.ErrorUtils; import com.yb.lb.common.utils.ErrorUtils;
import com.yb.lb.common.utils.FINALCMD; import com.yb.lb.common.utils.FINALCMD;
import com.yb.lb.common.utils.ParameterUtils; import com.yb.lb.common.utils.ParameterUtils;
import com.yb.lb.webapp.archives.distributor.service.DistributorService; import com.yb.lb.webapp.archives.distributor.service.DistributorService;
import com.yb.lb.webapp.archives.marketingArea.service.MarketingAreaService; import com.yb.lb.webapp.archives.marketingArea.service.MarketingAreaService;
import com.yb.lb.webapp.audit.service.AuditService;
import com.yb.lb.webapp.random.service.RandomService; import com.yb.lb.webapp.random.service.RandomService;
import com.yb.lb.webapp.redis.service.RedisService; import com.yb.lb.webapp.redis.service.RedisService;
import com.yb.lb.webapp.system.authority.service.AccessService; import com.yb.lb.webapp.system.authority.service.AccessService;
import com.yb.lb.webapp.system.logger.utils.BusinessType; import com.yb.lb.webapp.system.logger.utils.BusinessType;
import com.yb.lb.webapp.system.logger.utils.Log; import com.yb.lb.webapp.system.logger.utils.Log;
import com.yb.lb.webapp.system.logger.utils.OperatorType; import com.yb.lb.webapp.system.logger.utils.OperatorType;
import com.yb.lb.webapp.thread.quote.ViewMeetingThread;
import com.yb.lb.webapp.utils.RoleDateUtils; import com.yb.lb.webapp.utils.RoleDateUtils;
import com.yb.lb.webapp.view.view.sevice.ViewMeetingService; import com.yb.lb.webapp.view.view.sevice.ViewMeetingService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -32,9 +30,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.Calendar;
import java.util.concurrent.ExecutorService; import java.util.Date;
import java.util.concurrent.Executors; import java.util.HashMap;
import java.util.Map;
/** /**
* @author TanChao * @author TanChao
@ -44,11 +43,7 @@ import java.util.concurrent.Executors;
@Controller @Controller
@RequestMapping("/api/meeting") @RequestMapping("/api/meeting")
@Api(tags = "app:市场活动") @Api(tags = "app:市场活动")
public class ViewMeetingApi { public class ViewMeetingApi extends BaseController {
/**
* 日志
*/
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
ViewMeetingService viewMeetingService; ViewMeetingService viewMeetingService;
@ -57,8 +52,6 @@ public class ViewMeetingApi {
@Autowired @Autowired
AccessService accessService; AccessService accessService;
@Autowired @Autowired
AuditService auditService;
@Autowired
RandomService randomService; RandomService randomService;
@Autowired @Autowired
DistributorService distributorService; DistributorService distributorService;
@ -97,9 +90,10 @@ public class ViewMeetingApi {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map params = new HashMap(); Map params = new HashMap();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.exists(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
Map tokenMap = redisService.hmget(token); Map tokenMap = redisService.hmget(token);
params = ParameterUtils.reqMapSeria(request.getParameterMap()); params = ParameterUtils.reqMapSeria(request.getParameterMap());
params.put("id", IdUtil.simpleUUID()); params.put("id", IdUtil.simpleUUID());
@ -114,41 +108,7 @@ public class ViewMeetingApi {
params.put("viewNo", randomService.randomUtils1(FINALCMD.VIEW_NO, tokenMap.get("companyId") + "")); params.put("viewNo", randomService.randomUtils1(FINALCMD.VIEW_NO, tokenMap.get("companyId") + ""));
// 状态:0待审核1审核通过2审核未通过3.审核中4.自由态 // 状态:0待审核1审核通过2审核未通过3.审核中4.自由态
params.put("status", "4"); params.put("status", "4");
boolean flag = viewMeetingService.addView(params, ".addView"); return toAjax(viewMeetingService.addView(params, ".addView"));
if (flag) {
result.put("data", true);
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
/*if (("1").equals(auditType)) {
result = new HashMap();
result = auditService.commitAudit(token, AuditTypeUtil.AUDITMEETING, params.get("id") + "", "市场活动", params.get("tranNo") + "", menuCode);
result.put("data", true);
}*/
//创建线程池 设置线程数量为1个
ExecutorService pool = Executors.newFixedThreadPool(1);
ViewMeetingThread viewMeetingThread = new ViewMeetingThread(params, marketingAreaService, distributorService);
//提交线程池执行
pool.submit(viewMeetingThread);
//结束线程
pool.shutdown();
} else {
result.put("data", false);
result.put("code", ErrorUtils.ERROR);
result.put("msg", "操作失败");
}
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动app-提交" + "操作异常:" + e.getMessage());
}
return result;
} }
/** /**
@ -179,50 +139,17 @@ public class ViewMeetingApi {
@ApiParam(required = false, value = "菜单编码(提交审核使用)") @RequestParam(required = false) String menuCode, @ApiParam(required = false, value = "菜单编码(提交审核使用)") @RequestParam(required = false) String menuCode,
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.exists(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
Map<String, String> params = ParameterUtils.reqMapSeria(request.getParameterMap()); Map<String, String> params = ParameterUtils.reqMapSeria(request.getParameterMap());
Map tokenMap = redisService.hmget(token); Map tokenMap = redisService.hmget(token);
params.put("staffId", tokenMap.get("archivesId") + ""); params.put("staffId", tokenMap.get("archivesId") + "");
params.put("staffName", tokenMap.get("realName") + ""); params.put("staffName", tokenMap.get("realName") + "");
params.put("semId", tokenMap.get("areaId") + ""); params.put("semId", tokenMap.get("areaId") + "");
params.put("ancestors", tokenMap.get("ancestors") + ""); params.put("ancestors", tokenMap.get("ancestors") + "");
boolean flag = viewMeetingService.updateView(params, ".updateView"); return toAjax(viewMeetingService.updateView(params, ".updateView"));
if (flag) {
result.put("data", true);
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
/*if (("1").equals(auditType)) {
result = new HashMap();
result = auditService.commitAudit(token, AuditTypeUtil.AUDITMEETING, params.get("id") + "", "市场活动", params.get("tranNo") + "", menuCode);
result.put("data", true);
}*/
//创建线程池 设置线程数量为1个
ExecutorService pool = Executors.newFixedThreadPool(1);
ViewMeetingThread viewMeetingThread = new ViewMeetingThread(params, marketingAreaService, distributorService);
//提交线程池执行
pool.submit(viewMeetingThread);
//结束线程
pool.shutdown();
} else {
result.put("data", false);
result.put("code", ErrorUtils.ERROR);
result.put("msg", "操作失败");
}
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动app-修改" + "操作异常:" + e.getMessage());
}
return result;
} }
/** /**
@ -250,17 +177,16 @@ public class ViewMeetingApi {
@ApiParam(required = true, value = "页码", defaultValue = "1") @RequestParam(required = true) String page, @ApiParam(required = true, value = "页码", defaultValue = "1") @RequestParam(required = true) String page,
@ApiParam(required = true, value = "显示数量", defaultValue = "10") @RequestParam(required = true) String pageSize, @ApiParam(required = true, value = "显示数量", defaultValue = "10") @RequestParam(required = true) String pageSize,
HttpServletRequest request) { HttpServletRequest request) {
String token = request.getHeader("token");
if (!redisService.exists(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, Object> paramsMap = new HashMap<>(); Map<String, Object> paramsMap = new HashMap<>();
try {
String token = request.getHeader("token");
if (redisService.exists(token)) {
paramsMap = roleDateUtils.roleUtiles(token, marketingAreaId, region, code); paramsMap = roleDateUtils.roleUtiles(token, marketingAreaId, region, code);
if ("0".equals(paramsMap.get("code"))) { if ("0".equals(paramsMap.get("code"))) {
result.put("data", ""); return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
result.put("msg", "无权查看"); }
result.put("code", ErrorUtils.USERNAME_POWER_ERROR);
} else {
paramsMap.put("typeName", typeName); paramsMap.put("typeName", typeName);
paramsMap.put("typeId", typeId); paramsMap.put("typeId", typeId);
paramsMap.put("activityContent", activityContent); paramsMap.put("activityContent", activityContent);
@ -274,35 +200,7 @@ public class ViewMeetingApi {
paramsMap.put("staffId", staffId); paramsMap.put("staffId", staffId);
paramsMap.put("page", page); paramsMap.put("page", page);
paramsMap.put("pageSize", pageSize); paramsMap.put("pageSize", pageSize);
PageInfo pageInfo = viewMeetingService.pageList(paramsMap, ".pageList"); return toPage(viewMeetingService.pageList(paramsMap, ".pageList"));
if (pageInfo != null) {
List list = pageInfo.getList();
result.put("data", list);
result.put("total", pageInfo.getTotal());
result.put("pageNum", pageInfo.getPageNum());
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
} else {
result.put("data", null);
result.put("pageNum", 0);
result.put("total", 0);
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
}
}
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动app-市场活动列表" + "操作异常:" + e.getMessage());
}
return result;
} }
/** /**
@ -318,28 +216,13 @@ public class ViewMeetingApi {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.exists(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params.put("id", id); params.put("id", id);
params.put("typeId", typeId); params.put("typeId", typeId);
Map map = viewMeetingService.oneView(params, ".pageList"); return AjaxResult.success(viewMeetingService.oneView(params, ".pageList"));
result.put("data", map);
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动app-市场活动详情" + "操作异常:" + e.getMessage());
}
return result;
} }
/** /**
@ -357,15 +240,13 @@ public class ViewMeetingApi {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.exists(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params = roleDateUtils.roleUtiles(token, marketingAreaId, region, code); params = roleDateUtils.roleUtiles(token, marketingAreaId, region, code);
if ("0".equals(params.get("code"))) { if ("0".equals(params.get("code"))) {
result.put("data", ""); return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
result.put("msg", "无权查看");
result.put("code", ErrorUtils.USERNAME_POWER_ERROR);
return result;
} }
Map map = new HashMap(); Map map = new HashMap();
// 本年度累计场数 // 本年度累计场数
@ -407,18 +288,6 @@ public class ViewMeetingApi {
result.put("data", map); result.put("data", map);
result.put("code", ErrorUtils.SUCCESS); result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功"); result.put("msg", "操作成功");
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动数据统计" + "操作异常:" + e.getMessage());
}
return result; return result;
} }
@ -442,15 +311,13 @@ public class ViewMeetingApi {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.exists(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code);
if ("0".equals(params.get("code"))) { if ("0".equals(params.get("code"))) {
result.put("data", ""); return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
result.put("msg", "无权查看");
result.put("code", ErrorUtils.USERNAME_POWER_ERROR);
return result;
} }
params.put("startDate", startDate); params.put("startDate", startDate);
params.put("endDate", endDate); params.put("endDate", endDate);
@ -476,18 +343,6 @@ public class ViewMeetingApi {
result.put("code", ErrorUtils.SUCCESS); result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "无数据"); result.put("msg", "无数据");
} }
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动报表-按照区域分组" + "操作异常:" + e.getMessage());
}
return result; return result;
} }
@ -512,15 +367,13 @@ public class ViewMeetingApi {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.exists(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code);
if ("0".equals(params.get("code"))) { if ("0".equals(params.get("code"))) {
result.put("data", ""); return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
result.put("msg", "无权查看");
result.put("code", ErrorUtils.USERNAME_POWER_ERROR);
return result;
} }
params.put("startDate", startDate); params.put("startDate", startDate);
params.put("endDate", endDate); params.put("endDate", endDate);
@ -546,18 +399,6 @@ public class ViewMeetingApi {
result.put("code", ErrorUtils.SUCCESS); result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "无数据"); result.put("msg", "无数据");
} }
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动报表-按照业务员分组" + "操作异常:" + e.getMessage());
}
return result; return result;
} }
} }

View File

@ -1,18 +1,15 @@
package com.yb.lb.webapp.view; package com.yb.lb.webapp.view;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yb.lb.common.core.AjaxResult;
import com.yb.lb.common.core.BaseController;
import com.yb.lb.common.utils.ErrorUtils; import com.yb.lb.common.utils.ErrorUtils;
import com.yb.lb.webapp.archives.dictionary.service.DictionaryiesService;
import com.yb.lb.webapp.random.service.RandomService;
import com.yb.lb.webapp.redis.service.RedisService; import com.yb.lb.webapp.redis.service.RedisService;
import com.yb.lb.webapp.system.authority.service.AccessService;
import com.yb.lb.webapp.utils.RoleDateUtils; import com.yb.lb.webapp.utils.RoleDateUtils;
import com.yb.lb.webapp.view.view.sevice.ViewMeetingService; import com.yb.lb.webapp.view.view.sevice.ViewMeetingService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -23,7 +20,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -34,22 +30,12 @@ import java.util.Map;
@Controller @Controller
@RequestMapping("/adminx/meeting") @RequestMapping("/adminx/meeting")
@Api(tags = "pc:市场活动") @Api(tags = "pc:市场活动")
public class ViewMeetingController { public class ViewMeetingController extends BaseController {
/**
* 日志
*/
private final Logger logger = LoggerFactory.getLogger(ViewMeetingController.class);
@Autowired @Autowired
ViewMeetingService viewMeetingService; ViewMeetingService viewMeetingService;
@Autowired @Autowired
RandomService randomService;
@Autowired
RedisService redisService; RedisService redisService;
@Autowired @Autowired
DictionaryiesService dictionaryiesService;
@Autowired
AccessService accessService;
@Autowired
RoleDateUtils roleDateUtils; RoleDateUtils roleDateUtils;
/** /**
@ -79,15 +65,14 @@ public class ViewMeetingController {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, Object> paramsMap = new HashMap<>(); Map<String, Object> paramsMap = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.isKey(token)) { if (!redisService.isKey(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
paramsMap = roleDateUtils.roleUtiles(token, marketingAreaId, region, code); paramsMap = roleDateUtils.roleUtiles(token, marketingAreaId, region, code);
if ("0".equals(paramsMap.get("code"))) { if ("0".equals(paramsMap.get("code"))) {
result.put("data", ""); return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
result.put("msg", "无权查看"); }
result.put("code", ErrorUtils.USERNAME_POWER_ERROR);
} else {
paramsMap.put("typeName", typeName); paramsMap.put("typeName", typeName);
paramsMap.put("typeId", typeId); paramsMap.put("typeId", typeId);
paramsMap.put("activityContent", activityContent); paramsMap.put("activityContent", activityContent);
@ -101,35 +86,7 @@ public class ViewMeetingController {
paramsMap.put("staffId", staffId); paramsMap.put("staffId", staffId);
paramsMap.put("page", page); paramsMap.put("page", page);
paramsMap.put("pageSize", pageSize); paramsMap.put("pageSize", pageSize);
PageInfo pageInfo = viewMeetingService.pageList(paramsMap, ".pageList"); return toPage(viewMeetingService.pageList(paramsMap, ".pageList"));
if (pageInfo != null) {
List list = pageInfo.getList();
result.put("data", list);
result.put("total", pageInfo.getTotal());
result.put("pageNum", pageInfo.getPageNum());
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
} else {
result.put("data", null);
result.put("pageNum", 0);
result.put("total", 0);
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
}
}
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("pc市场活动" + "操作异常:" + e.getMessage());
}
return result;
} }
/** /**
@ -145,28 +102,13 @@ public class ViewMeetingController {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.isKey(token)) { if (!redisService.isKey(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params.put("id", id); params.put("id", id);
params.put("typeId", typeId); params.put("typeId", typeId);
Map map = viewMeetingService.oneView(params, ".pageList"); return AjaxResult.success(viewMeetingService.oneView(params, ".pageList"));
result.put("data", map);
result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "操作成功");
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("pc市场活动-市场活动详情" + "操作异常:" + e.getMessage());
}
return result;
} }
/** /**
@ -189,15 +131,13 @@ public class ViewMeetingController {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.isKey(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code);
if ("0".equals(params.get("code"))) { if ("0".equals(params.get("code"))) {
result.put("data", ""); return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
result.put("msg", "无权查看");
result.put("code", ErrorUtils.USERNAME_POWER_ERROR);
return result;
} }
params.put("startDate", startDate); params.put("startDate", startDate);
params.put("endDate", endDate); params.put("endDate", endDate);
@ -222,18 +162,6 @@ public class ViewMeetingController {
result.put("code", ErrorUtils.SUCCESS); result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "无数据"); result.put("msg", "无数据");
} }
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动报表-按照区域分组" + "操作异常:" + e.getMessage());
}
return result; return result;
} }
@ -258,15 +186,13 @@ public class ViewMeetingController {
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
try {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (redisService.exists(token)) { if (!redisService.isKey(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code);
if ("0".equals(params.get("code"))) { if ("0".equals(params.get("code"))) {
result.put("data", ""); return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
result.put("msg", "无权查看");
result.put("code", ErrorUtils.USERNAME_POWER_ERROR);
return result;
} }
params.put("startDate", startDate); params.put("startDate", startDate);
params.put("endDate", endDate); params.put("endDate", endDate);
@ -292,18 +218,6 @@ public class ViewMeetingController {
result.put("code", ErrorUtils.SUCCESS); result.put("code", ErrorUtils.SUCCESS);
result.put("msg", "无数据"); result.put("msg", "无数据");
} }
} else {
result.put("data", false);
result.put("code", ErrorUtils.IS_NOT_LOGIN_ERROR);
result.put("msg", "用户未登录");
}
} catch (Exception e) {
e.printStackTrace();
result.put("data", false);
result.put("code", ErrorUtils.DEBUG);
result.put("msg", "操作异常");
logger.debug("市场活动报表-按照业务员分组" + "操作异常:" + e.getMessage());
}
return result; return result;
} }
} }