refactor(view): 市场活动模块优化
This commit is contained in:
		
							parent
							
								
									d696a6c205
								
							
						
					
					
						commit
						7f823b4128
					
				|  | @ -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,58 +90,25 @@ 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); |  | ||||||
|                 params = ParameterUtils.reqMapSeria(request.getParameterMap()); |  | ||||||
|                 params.put("id", IdUtil.simpleUUID()); |  | ||||||
|                 params.put("createTime", DateUtil.getTime()); |  | ||||||
|                 params.put("companyId", tokenMap.get("companyId") + ""); |  | ||||||
|                 params.put("createUser", tokenMap.get("id") + ""); |  | ||||||
|                 params.put("staffId", tokenMap.get("archivesId") + ""); |  | ||||||
|                 params.put("staffName", tokenMap.get("realName") + ""); |  | ||||||
|                 params.put("semId", tokenMap.get("areaId") + ""); |  | ||||||
|                 params.put("ancestors", tokenMap.get("ancestors") + ""); |  | ||||||
|                 // 编码 |  | ||||||
|                 params.put("viewNo", randomService.randomUtils1(FINALCMD.VIEW_NO, tokenMap.get("companyId") + "")); |  | ||||||
|                 // 状态:0待审核1审核通过2审核未通过3.审核中4.自由态 |  | ||||||
|                 params.put("status", "4"); |  | ||||||
|                 boolean flag = 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; |         Map tokenMap = redisService.hmget(token); | ||||||
|  |         params = ParameterUtils.reqMapSeria(request.getParameterMap()); | ||||||
|  |         params.put("id", IdUtil.simpleUUID()); | ||||||
|  |         params.put("createTime", DateUtil.getTime()); | ||||||
|  |         params.put("companyId", tokenMap.get("companyId") + ""); | ||||||
|  |         params.put("createUser", tokenMap.get("id") + ""); | ||||||
|  |         params.put("staffId", tokenMap.get("archivesId") + ""); | ||||||
|  |         params.put("staffName", tokenMap.get("realName") + ""); | ||||||
|  |         params.put("semId", tokenMap.get("areaId") + ""); | ||||||
|  |         params.put("ancestors", tokenMap.get("ancestors") + ""); | ||||||
|  |         // 编码 | ||||||
|  |         params.put("viewNo", randomService.randomUtils1(FINALCMD.VIEW_NO, tokenMap.get("companyId") + "")); | ||||||
|  |         // 状态:0待审核1审核通过2审核未通过3.审核中4.自由态 | ||||||
|  |         params.put("status", "4"); | ||||||
|  |         return toAjax(viewMeetingService.addView(params, ".addView")); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -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 tokenMap = redisService.hmget(token); |  | ||||||
|                 params.put("staffId", tokenMap.get("archivesId") + ""); |  | ||||||
|                 params.put("staffName", tokenMap.get("realName") + ""); |  | ||||||
|                 params.put("semId", tokenMap.get("areaId") + ""); |  | ||||||
|                 params.put("ancestors", tokenMap.get("ancestors") + ""); |  | ||||||
|                 boolean flag = 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; |         Map<String, String> params = ParameterUtils.reqMapSeria(request.getParameterMap()); | ||||||
|  |         Map tokenMap = redisService.hmget(token); | ||||||
|  |         params.put("staffId", tokenMap.get("archivesId") + ""); | ||||||
|  |         params.put("staffName", tokenMap.get("realName") + ""); | ||||||
|  |         params.put("semId", tokenMap.get("areaId") + ""); | ||||||
|  |         params.put("ancestors", tokenMap.get("ancestors") + ""); | ||||||
|  |         return toAjax(viewMeetingService.updateView(params, ".updateView")); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -250,59 +177,30 @@ 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 { |         paramsMap = roleDateUtils.roleUtiles(token, marketingAreaId, region, code); | ||||||
|             String token = request.getHeader("token"); |         if ("0".equals(paramsMap.get("code"))) { | ||||||
|             if (redisService.exists(token)) { |             return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看"); | ||||||
|                 paramsMap = roleDateUtils.roleUtiles(token, marketingAreaId, region, code); |  | ||||||
|                 if ("0".equals(paramsMap.get("code"))) { |  | ||||||
|                     result.put("data", ""); |  | ||||||
|                     result.put("msg", "无权查看"); |  | ||||||
|                     result.put("code", ErrorUtils.USERNAME_POWER_ERROR); |  | ||||||
|                 } else { |  | ||||||
|                     paramsMap.put("typeName", typeName); |  | ||||||
|                     paramsMap.put("typeId", typeId); |  | ||||||
|                     paramsMap.put("activityContent", activityContent); |  | ||||||
|                     paramsMap.put("startDate", startDate); |  | ||||||
|                     paramsMap.put("endDate", endDate); |  | ||||||
|                     paramsMap.put("createStartDate", createStartDate); |  | ||||||
|                     paramsMap.put("createEndDate", createEndDate); |  | ||||||
|                     paramsMap.put("dealersId", dealersId); |  | ||||||
|                     paramsMap.put("distributorName", distributorName); |  | ||||||
|                     paramsMap.put("clientType", clientType); |  | ||||||
|                     paramsMap.put("staffId", staffId); |  | ||||||
|                     paramsMap.put("page", page); |  | ||||||
|                     paramsMap.put("pageSize", pageSize); |  | ||||||
|                     PageInfo pageInfo = 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; |         paramsMap.put("typeName", typeName); | ||||||
|  |         paramsMap.put("typeId", typeId); | ||||||
|  |         paramsMap.put("activityContent", activityContent); | ||||||
|  |         paramsMap.put("startDate", startDate); | ||||||
|  |         paramsMap.put("endDate", endDate); | ||||||
|  |         paramsMap.put("createStartDate", createStartDate); | ||||||
|  |         paramsMap.put("createEndDate", createEndDate); | ||||||
|  |         paramsMap.put("dealersId", dealersId); | ||||||
|  |         paramsMap.put("distributorName", distributorName); | ||||||
|  |         paramsMap.put("clientType", clientType); | ||||||
|  |         paramsMap.put("staffId", staffId); | ||||||
|  |         paramsMap.put("page", page); | ||||||
|  |         paramsMap.put("pageSize", pageSize); | ||||||
|  |         return toPage(viewMeetingService.pageList(paramsMap, ".pageList")); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -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("typeId", typeId); |  | ||||||
|                 Map map = 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; |         params.put("id", id); | ||||||
|  |         params.put("typeId", typeId); | ||||||
|  |         return AjaxResult.success(viewMeetingService.oneView(params, ".pageList")); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -357,68 +240,54 @@ 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); |  | ||||||
|                 if ("0".equals(params.get("code"))) { |  | ||||||
|                     result.put("data", ""); |  | ||||||
|                     result.put("msg", "无权查看"); |  | ||||||
|                     result.put("code", ErrorUtils.USERNAME_POWER_ERROR); |  | ||||||
|                     return result; |  | ||||||
|                 } |  | ||||||
|                 Map map = new HashMap(); |  | ||||||
|                 // 本年度累计场数 |  | ||||||
|                 // 获取当前年份 |  | ||||||
|                 String year = DateUtil.getYear(); |  | ||||||
|                 params.put("year", year); |  | ||||||
|                 Integer yearNum = viewMeetingService.countAll(params, ".countActivity"); |  | ||||||
|                 Integer participantsNum = viewMeetingService.countAll(params, ".viewNumPersion"); |  | ||||||
|                 map.put("yearNum", yearNum != null ? yearNum : 0); |  | ||||||
|                 // (年)累计参与人数 |  | ||||||
|                 map.put("participantsNum", participantsNum != null ? participantsNum : 0); |  | ||||||
| 
 |  | ||||||
|                 // 本季度新增场数 |  | ||||||
|                 // 获取当前季度 |  | ||||||
|                 Calendar calendar = Calendar.getInstance(); |  | ||||||
|                 calendar.setTime(new Date()); |  | ||||||
|                 int quarter = calendar.get(Calendar.MONTH) / 3 + 1; |  | ||||||
|                 params.remove("year"); |  | ||||||
| 
 |  | ||||||
|                 if (quarter == 1) { |  | ||||||
|                     // 第一季度:1月-3月 |  | ||||||
|                     params.put("laststart", year + "-01"); |  | ||||||
|                     params.put("lastend", year + "-03"); |  | ||||||
|                 } else if (quarter == 2) { |  | ||||||
|                     // 第二季度:4月-6月 |  | ||||||
|                     params.put("laststart", year + "-04"); |  | ||||||
|                     params.put("lastend", year + "-06"); |  | ||||||
|                 } else if (quarter == 3) { |  | ||||||
|                     // 第三季度:7月-9月 |  | ||||||
|                     params.put("laststart", year + "-07"); |  | ||||||
|                     params.put("lastend", year + "-09"); |  | ||||||
|                 } else if (quarter == 4) { |  | ||||||
|                     // 第四季度:10月-12月 |  | ||||||
|                     params.put("laststart", year + "-10"); |  | ||||||
|                     params.put("lastend", year + "-12"); |  | ||||||
|                 } |  | ||||||
|                 Integer quarterly = viewMeetingService.countAll(params, ".countActivity"); |  | ||||||
|                 map.put("quarterly", quarterly != null ? quarterly : 0); |  | ||||||
|                 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("市场活动数据统计" + "操作异常:" + e.getMessage()); |  | ||||||
|         } |         } | ||||||
|  |         params = roleDateUtils.roleUtiles(token, marketingAreaId, region, code); | ||||||
|  |         if ("0".equals(params.get("code"))) { | ||||||
|  |             return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看"); | ||||||
|  |         } | ||||||
|  |         Map map = new HashMap(); | ||||||
|  |         // 本年度累计场数 | ||||||
|  |         // 获取当前年份 | ||||||
|  |         String year = DateUtil.getYear(); | ||||||
|  |         params.put("year", year); | ||||||
|  |         Integer yearNum = viewMeetingService.countAll(params, ".countActivity"); | ||||||
|  |         Integer participantsNum = viewMeetingService.countAll(params, ".viewNumPersion"); | ||||||
|  |         map.put("yearNum", yearNum != null ? yearNum : 0); | ||||||
|  |         // (年)累计参与人数 | ||||||
|  |         map.put("participantsNum", participantsNum != null ? participantsNum : 0); | ||||||
|  | 
 | ||||||
|  |         // 本季度新增场数 | ||||||
|  |         // 获取当前季度 | ||||||
|  |         Calendar calendar = Calendar.getInstance(); | ||||||
|  |         calendar.setTime(new Date()); | ||||||
|  |         int quarter = calendar.get(Calendar.MONTH) / 3 + 1; | ||||||
|  |         params.remove("year"); | ||||||
|  | 
 | ||||||
|  |         if (quarter == 1) { | ||||||
|  |             // 第一季度:1月-3月 | ||||||
|  |             params.put("laststart", year + "-01"); | ||||||
|  |             params.put("lastend", year + "-03"); | ||||||
|  |         } else if (quarter == 2) { | ||||||
|  |             // 第二季度:4月-6月 | ||||||
|  |             params.put("laststart", year + "-04"); | ||||||
|  |             params.put("lastend", year + "-06"); | ||||||
|  |         } else if (quarter == 3) { | ||||||
|  |             // 第三季度:7月-9月 | ||||||
|  |             params.put("laststart", year + "-07"); | ||||||
|  |             params.put("lastend", year + "-09"); | ||||||
|  |         } else if (quarter == 4) { | ||||||
|  |             // 第四季度:10月-12月 | ||||||
|  |             params.put("laststart", year + "-10"); | ||||||
|  |             params.put("lastend", year + "-12"); | ||||||
|  |         } | ||||||
|  |         Integer quarterly = viewMeetingService.countAll(params, ".countActivity"); | ||||||
|  |         map.put("quarterly", quarterly != null ? quarterly : 0); | ||||||
|  |         result.put("data", map); | ||||||
|  |         result.put("code", ErrorUtils.SUCCESS); | ||||||
|  |         result.put("msg", "操作成功"); | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -442,51 +311,37 @@ 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); |         } | ||||||
|                 if ("0".equals(params.get("code"))) { |         params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); | ||||||
|                     result.put("data", ""); |         if ("0".equals(params.get("code"))) { | ||||||
|                     result.put("msg", "无权查看"); |             return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看"); | ||||||
|                     result.put("code", ErrorUtils.USERNAME_POWER_ERROR); |         } | ||||||
|                     return result; |         params.put("startDate", startDate); | ||||||
|                 } |         params.put("endDate", endDate); | ||||||
|                 params.put("startDate", startDate); |         params.put("createStartDate", createStartDate); | ||||||
|                 params.put("endDate", endDate); |         params.put("createEndDate", createEndDate); | ||||||
|                 params.put("createStartDate", createStartDate); |         params.put("page", page); | ||||||
|                 params.put("createEndDate", createEndDate); |         params.put("pageSize", pageSize); | ||||||
|                 params.put("page", page); |         PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNum"); | ||||||
|                 params.put("pageSize", pageSize); |         if (pageInfo != null) { | ||||||
|                 PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNum"); |             result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); | ||||||
|                 if (pageInfo != null) { |             // 合计数量 | ||||||
|                     result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); |             // result.put("totalData", viewMeetingService.listAll(params, ".countActivityTotalNum")); | ||||||
|                     // 合计数量 |             result.put("totalData", viewMeetingService.getActivityTotalNum(params)); | ||||||
|                     // result.put("totalData", viewMeetingService.listAll(params, ".countActivityTotalNum")); |             result.put("total", pageInfo.getTotal()); | ||||||
|                     result.put("totalData", viewMeetingService.getActivityTotalNum(params)); |             result.put("pageNum", pageInfo.getPageNum()); | ||||||
|                     result.put("total", pageInfo.getTotal()); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("pageNum", pageInfo.getPageNum()); |             result.put("msg", "操作成功"); | ||||||
|                     result.put("code", ErrorUtils.SUCCESS); |         } else { | ||||||
|                     result.put("msg", "操作成功"); |             result.put("data", null); | ||||||
|                 } else { |             result.put("totalData", null); | ||||||
|                     result.put("data", null); |             result.put("pageNum", 0); | ||||||
|                     result.put("totalData", null); |             result.put("total", 0); | ||||||
|                     result.put("pageNum", 0); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("total", 0); |             result.put("msg", "无数据"); | ||||||
|                     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("市场活动报表-按照区域分组" + "操作异常:" + e.getMessage()); |  | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  | @ -512,51 +367,37 @@ 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); |         } | ||||||
|                 if ("0".equals(params.get("code"))) { |         params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); | ||||||
|                     result.put("data", ""); |         if ("0".equals(params.get("code"))) { | ||||||
|                     result.put("msg", "无权查看"); |             return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看"); | ||||||
|                     result.put("code", ErrorUtils.USERNAME_POWER_ERROR); |         } | ||||||
|                     return result; |         params.put("startDate", startDate); | ||||||
|                 } |         params.put("endDate", endDate); | ||||||
|                 params.put("startDate", startDate); |         params.put("createStartDate", createStartDate); | ||||||
|                 params.put("endDate", endDate); |         params.put("createEndDate", createEndDate); | ||||||
|                 params.put("createStartDate", createStartDate); |         params.put("staffId", staffId); | ||||||
|                 params.put("createEndDate", createEndDate); |         params.put("page", page); | ||||||
|                 params.put("staffId", staffId); |         params.put("pageSize", pageSize); | ||||||
|                 params.put("page", page); |         PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNumByStaff"); | ||||||
|                 params.put("pageSize", pageSize); |         if (pageInfo != null) { | ||||||
|                 PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNumByStaff"); |             result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); | ||||||
|                 if (pageInfo != null) { |             // 合计数量 | ||||||
|                     result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); |             result.put("totalData", viewMeetingService.getActivityTotalNum(params)); | ||||||
|                     // 合计数量 |             result.put("total", pageInfo.getTotal()); | ||||||
|                     result.put("totalData", viewMeetingService.getActivityTotalNum(params)); |             result.put("pageNum", pageInfo.getPageNum()); | ||||||
|                     result.put("total", pageInfo.getTotal()); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("pageNum", pageInfo.getPageNum()); |             result.put("msg", "操作成功"); | ||||||
|                     result.put("code", ErrorUtils.SUCCESS); |         } else { | ||||||
|                     result.put("msg", "操作成功"); |             result.put("data", null); | ||||||
|                 } else { |             result.put("totalData", null); | ||||||
|                     result.put("data", null); |             result.put("pageNum", 0); | ||||||
|                     result.put("totalData", null); |             result.put("total", 0); | ||||||
|                     result.put("pageNum", 0); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("total", 0); |             result.put("msg", "无数据"); | ||||||
|                     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("市场活动报表-按照业务员分组" + "操作异常:" + e.getMessage()); |  | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -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,57 +65,28 @@ 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); |  | ||||||
|                 if ("0".equals(paramsMap.get("code"))) { |  | ||||||
|                     result.put("data", ""); |  | ||||||
|                     result.put("msg", "无权查看"); |  | ||||||
|                     result.put("code", ErrorUtils.USERNAME_POWER_ERROR); |  | ||||||
|                 } else { |  | ||||||
|                     paramsMap.put("typeName", typeName); |  | ||||||
|                     paramsMap.put("typeId", typeId); |  | ||||||
|                     paramsMap.put("activityContent", activityContent); |  | ||||||
|                     paramsMap.put("startDate", startDate); |  | ||||||
|                     paramsMap.put("createEndDate", createEndDate); |  | ||||||
|                     paramsMap.put("createStartDate", createStartDate); |  | ||||||
|                     paramsMap.put("endDate", endDate); |  | ||||||
|                     paramsMap.put("dealersId", dealersId); |  | ||||||
|                     paramsMap.put("distributorName", distributorName); |  | ||||||
|                     paramsMap.put("clientType", clientType); |  | ||||||
|                     paramsMap.put("staffId", staffId); |  | ||||||
|                     paramsMap.put("page", page); |  | ||||||
|                     paramsMap.put("pageSize", pageSize); |  | ||||||
|                     PageInfo pageInfo = 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; |         paramsMap = roleDateUtils.roleUtiles(token, marketingAreaId, region, code); | ||||||
|  |         if ("0".equals(paramsMap.get("code"))) { | ||||||
|  |             return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看"); | ||||||
|  |         } | ||||||
|  |         paramsMap.put("typeName", typeName); | ||||||
|  |         paramsMap.put("typeId", typeId); | ||||||
|  |         paramsMap.put("activityContent", activityContent); | ||||||
|  |         paramsMap.put("startDate", startDate); | ||||||
|  |         paramsMap.put("createEndDate", createEndDate); | ||||||
|  |         paramsMap.put("createStartDate", createStartDate); | ||||||
|  |         paramsMap.put("endDate", endDate); | ||||||
|  |         paramsMap.put("dealersId", dealersId); | ||||||
|  |         paramsMap.put("distributorName", distributorName); | ||||||
|  |         paramsMap.put("clientType", clientType); | ||||||
|  |         paramsMap.put("staffId", staffId); | ||||||
|  |         paramsMap.put("page", page); | ||||||
|  |         paramsMap.put("pageSize", pageSize); | ||||||
|  |         return toPage(viewMeetingService.pageList(paramsMap, ".pageList")); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -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("typeId", typeId); |  | ||||||
|                 Map map = 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; |         params.put("id", id); | ||||||
|  |         params.put("typeId", typeId); | ||||||
|  |         return AjaxResult.success(viewMeetingService.oneView(params, ".pageList")); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -189,50 +131,36 @@ 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.isKey(token)) { | ||||||
|             if (redisService.exists(token)) { |             return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录"); | ||||||
|                 params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); |         } | ||||||
|                 if ("0".equals(params.get("code"))) { |         params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); | ||||||
|                     result.put("data", ""); |         if ("0".equals(params.get("code"))) { | ||||||
|                     result.put("msg", "无权查看"); |             return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看"); | ||||||
|                     result.put("code", ErrorUtils.USERNAME_POWER_ERROR); |         } | ||||||
|                     return result; |         params.put("startDate", startDate); | ||||||
|                 } |         params.put("endDate", endDate); | ||||||
|                 params.put("startDate", startDate); |         params.put("createStartDate", createStartDate); | ||||||
|                 params.put("endDate", endDate); |         params.put("createEndDate", createEndDate); | ||||||
|                 params.put("createStartDate", createStartDate); |         params.put("page", page); | ||||||
|                 params.put("createEndDate", createEndDate); |         params.put("pageSize", pageSize); | ||||||
|                 params.put("page", page); |         PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNum"); | ||||||
|                 params.put("pageSize", pageSize); |         if (pageInfo != null) { | ||||||
|                 PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNum"); |             result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); | ||||||
|                 if (pageInfo != null) { |             // 合计数量 | ||||||
|                     result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); |             result.put("totalData", viewMeetingService.getActivityTotalNum(params)); | ||||||
|                     // 合计数量 |             result.put("total", pageInfo.getTotal()); | ||||||
|                     result.put("totalData", viewMeetingService.getActivityTotalNum(params)); |             result.put("pageNum", pageInfo.getPageNum()); | ||||||
|                     result.put("total", pageInfo.getTotal()); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("pageNum", pageInfo.getPageNum()); |             result.put("msg", "操作成功"); | ||||||
|                     result.put("code", ErrorUtils.SUCCESS); |         } else { | ||||||
|                     result.put("msg", "操作成功"); |             result.put("data", null); | ||||||
|                 } else { |             result.put("totalData", null); | ||||||
|                     result.put("data", null); |             result.put("pageNum", 0); | ||||||
|                     result.put("totalData", null); |             result.put("total", 0); | ||||||
|                     result.put("pageNum", 0); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("total", 0); |             result.put("msg", "无数据"); | ||||||
|                     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("市场活动报表-按照区域分组" + "操作异常:" + e.getMessage()); |  | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  | @ -258,51 +186,37 @@ 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.isKey(token)) { | ||||||
|             if (redisService.exists(token)) { |             return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录"); | ||||||
|                 params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); |         } | ||||||
|                 if ("0".equals(params.get("code"))) { |         params = roleDateUtils.roleUtiles(token, marketingAreaId, "", code); | ||||||
|                     result.put("data", ""); |         if ("0".equals(params.get("code"))) { | ||||||
|                     result.put("msg", "无权查看"); |             return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看"); | ||||||
|                     result.put("code", ErrorUtils.USERNAME_POWER_ERROR); |         } | ||||||
|                     return result; |         params.put("startDate", startDate); | ||||||
|                 } |         params.put("endDate", endDate); | ||||||
|                 params.put("startDate", startDate); |         params.put("createStartDate", createStartDate); | ||||||
|                 params.put("endDate", endDate); |         params.put("createEndDate", createEndDate); | ||||||
|                 params.put("createStartDate", createStartDate); |         params.put("staffId", staffId); | ||||||
|                 params.put("createEndDate", createEndDate); |         params.put("page", page); | ||||||
|                 params.put("staffId", staffId); |         params.put("pageSize", pageSize); | ||||||
|                 params.put("page", page); |         PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNumByStaff"); | ||||||
|                 params.put("pageSize", pageSize); |         if (pageInfo != null) { | ||||||
|                 PageInfo pageInfo = viewMeetingService.pageList(params, ".countActivityNumByStaff"); |             result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); | ||||||
|                 if (pageInfo != null) { |             // 合计数量 | ||||||
|                     result.put("data", viewMeetingService.countActivityNum(pageInfo.getList())); |             result.put("totalData", viewMeetingService.getActivityTotalNum(params)); | ||||||
|                     // 合计数量 |             result.put("total", pageInfo.getTotal()); | ||||||
|                     result.put("totalData", viewMeetingService.getActivityTotalNum(params)); |             result.put("pageNum", pageInfo.getPageNum()); | ||||||
|                     result.put("total", pageInfo.getTotal()); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("pageNum", pageInfo.getPageNum()); |             result.put("msg", "操作成功"); | ||||||
|                     result.put("code", ErrorUtils.SUCCESS); |         } else { | ||||||
|                     result.put("msg", "操作成功"); |             result.put("data", null); | ||||||
|                 } else { |             result.put("totalData", null); | ||||||
|                     result.put("data", null); |             result.put("pageNum", 0); | ||||||
|                     result.put("totalData", null); |             result.put("total", 0); | ||||||
|                     result.put("pageNum", 0); |             result.put("code", ErrorUtils.SUCCESS); | ||||||
|                     result.put("total", 0); |             result.put("msg", "无数据"); | ||||||
|                     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("市场活动报表-按照业务员分组" + "操作异常:" + e.getMessage()); |  | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue