Exemplo n.º 1
0
  @Override
  protected void executeJob(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    if (isLock()) {
      return;
    }
    try {

      INotificationService notificationService =
          ServiceManager.getService(INotificationService.class);
      List<PromotionMsgJobDTO> jobDTOs = notificationService.getCurrentPromotionMsgJobDTO();
      if (CollectionUtil.isEmpty(jobDTOs)) {
        return;
      }
      IMessageService messageService = ServiceManager.getService(IMessageService.class);
      List<Long> jobIdList = new ArrayList<Long>();
      Result result = new Result();
      for (PromotionMsgJobDTO jobDTO : jobDTOs) {
        messageService.sendPromotionMsg(result, jobDTO.getMessageDTO());
        jobIdList.add(jobDTO.getId());
      }
      notificationService.updateFinishedPromotionMsgJob(jobIdList);
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
    } finally {
      lock = false;
    }
  }
Exemplo n.º 2
0
 @ResponseBody
 @RequestMapping(params = "method=updateCameraConfigs")
 public String updateCameraConfig(HttpServletRequest request, CameraConfigDTO cameraConfigDTO) {
   ICameraService cameraService = ServiceManager.getService(ICameraService.class);
   cameraService.updateCameraConfig(cameraConfigDTO);
   return "/camera/cameraRecordList";
 }
Exemplo n.º 3
0
 @Test
 public void testClientInfo() throws Exception {
   ModelMap model = new ModelMap();
   Long shopId = createShop();
   request.getSession().setAttribute("shopId", shopId);
   CustomerRecordDTO customerRecordDTO = new CustomerRecordDTO();
   CustomerDTO customer = new CustomerDTO();
   CustomerVehicleDTO customerVehicleDTO = new CustomerVehicleDTO();
   VehicleDTO vehicleDTO = new VehicleDTO();
   createCustomerDTO(customer, shopId);
   createCustomerRecordDTO(customerRecordDTO, shopId);
   createVehicleDTO(vehicleDTO, shopId);
   IUserService userService = ServiceManager.getService(IUserService.class);
   userService.createCustomerRecord(customerRecordDTO);
   CustomerDTO customerDTO = userService.createCustomer(customer);
   VehicleDTO vehicleDTO1 = userService.createVehicle(vehicleDTO);
   userService.addVehicleToCustomer(vehicleDTO1.getId(), customerDTO.getId());
   txnController.clientInfo(model, request, "MRS.SHAO", "15151774444", "phone", "2343545", "", "");
   CustomerRecordDTO customerRecordDTO2 = (CustomerRecordDTO) model.get("customerRecordDTO");
   Assert.assertEquals("MRS.SHAO", customerRecordDTO2.getName());
   Assert.assertEquals("", customerRecordDTO2.getContact());
   Assert.assertEquals("15151774444", customerRecordDTO2.getMobile());
   txnController.clientInfo(model, request, "邵磊", "15151774443", "", "", "小邵", "");
   CustomerRecordDTO customerRecordDTO3 = (CustomerRecordDTO) model.get("customerRecordDTO");
   Assert.assertEquals("邵磊", customerRecordDTO3.getName());
   Assert.assertEquals("15151774443", customerRecordDTO3.getMobile());
 }
Exemplo n.º 4
0
 @RequestMapping(params = "method=setCategoryPage")
 public void setCategoryPage(HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   String jsonStr = "[]";
   StringBuffer sb = new StringBuffer("[");
   Long shopId = WebUtil.getShopId(request);
   Long startPageNo = 1l;
   RFITxnService txnService = ServiceManager.getService(RFITxnService.class);
   CategoryServiceSearchDTO categoryServiceSearchDTO = new CategoryServiceSearchDTO();
   categoryServiceSearchDTO.setServiceDTOs(
       txnService.getServicesByCategory(
           shopId,
           categoryServiceSearchDTO.getServiceName(),
           categoryServiceSearchDTO.getCategoryName(),
           CategoryType.BUSINESS_CLASSIFICATION,
           startPageNo,
           PAGE_SIZE));
   for (ServiceDTO service : categoryServiceSearchDTO.getServiceDTOs()) {
     String name = service.getName() == null ? "" : service.getName();
     String id = service.getId() == null ? "" : service.getId().toString();
     sb.append("{\"name\":\"" + name + "\",");
     sb.append("\"id\":\"" + id + "\"},");
   }
   sb.replace(sb.length() - 1, sb.length(), "]");
   jsonStr = sb.toString();
   PrintWriter writer = response.getWriter();
   writer.write(jsonStr);
   writer.close();
 }
Exemplo n.º 5
0
 @Override
 public List<ProductCategoryDTO> getRecentlyUsedProductCategoryDTOList(Long shopId, Long userId) {
   List<ProductCategoryDTO> productCategoryDTOList = new ArrayList<ProductCategoryDTO>();
   if (shopId == null) return productCategoryDTOList;
   IRecentlyUsedDataService recentlyUsedDataService =
       ServiceManager.getService(IRecentlyUsedDataService.class);
   int maxSize = ConfigUtils.getRecentlyUsedProductCategoryNum();
   List<RecentlyUsedDataDTO> recentlyUsedDataDTOList =
       recentlyUsedDataService.getRecentlyUsedDataDTOList(
           shopId, userId, RecentlyUsedDataType.USED_PRODUCT_CATEGORY, maxSize);
   if (CollectionUtils.isNotEmpty(recentlyUsedDataDTOList)) {
     Set<Long> prouctCategoryIdSet = new HashSet<Long>();
     for (RecentlyUsedDataDTO recentlyUsedDataDTO : recentlyUsedDataDTOList) {
       prouctCategoryIdSet.add(recentlyUsedDataDTO.getDataId());
     }
     List<ProductCategoryDTO> productCategoryDTOs =
         getProductCategoryDTOByIds(prouctCategoryIdSet);
     fillProductCategoryDTOListInfo(productCategoryDTOs);
     Map<Long, ProductCategoryDTO> productCategoryDTOMap = new HashMap<Long, ProductCategoryDTO>();
     for (ProductCategoryDTO productCategoryDTO : productCategoryDTOs) {
       productCategoryDTOMap.put(productCategoryDTO.getId(), productCategoryDTO);
     }
     ProductCategoryDTO productCategoryDTO = null;
     for (RecentlyUsedDataDTO recentlyUsedDataDTO : recentlyUsedDataDTOList) {
       productCategoryDTO = productCategoryDTOMap.get(recentlyUsedDataDTO.getDataId());
       if (productCategoryDTO != null) {
         productCategoryDTOList.add(productCategoryDTO);
       }
     }
   }
   return productCategoryDTOList;
 }
Exemplo n.º 6
0
 public void sort(long shopVersionId, MenuDTO root) {
   if (MenuType.AUTO_ACCESSORY_ONLINE.name().equals(root.getMenuName())) {
     IPrivilegeService privilegeService = ServiceManager.getService(IPrivilegeService.class);
     if (privilegeService.verifierShopVersionResource(
         shopVersionId, ResourceType.logic, "WEB.VERSION.ONLINE_ORDER_CENTER")) {
       root.setLabel("订单中心");
     } else {
       root.setLabel("采购中心");
       if (root.hasChildren()) {
         for (MenuDTO m : root.getChildren()) {
           if (MenuType.AUTO_ACCESSORY_ONLINE_COMMODITYQUOTATIONS.name().equals(m.getMenuName())) {
             m.setSort(2);
           } else if (MenuType.AUTO_ACCESSORY_ONLINE_ORDER_CENTER.name().equals(m.getMenuName())) {
             m.setSort(1);
           } else if (MenuType.AUTO_ACCESSORY_ONLINE_SHOPPINGCART.name().equals(m.getMenuName())) {
             m.setSort(3);
           } else if (MenuType.AUTO_ACCESSORY_ONLINE_RETURN_ONLINE
               .name()
               .equals(m.getMenuName())) {
             m.setSort(4);
           }
         }
       }
     }
   }
 }
Exemplo n.º 7
0
 @ResponseBody
 @RequestMapping(params = "method=getPrinterSerialNo")
 public String getPrinterSerialNo(String cameraSerialNo) {
   ICameraService cameraService = ServiceManager.getService(ICameraService.class);
   CameraConfigDTO cameraConfigDTO = cameraService.getCameraConfigBySerialNo(cameraSerialNo);
   return cameraConfigDTO != null ? cameraConfigDTO.getPrinter_serial_no() : null;
 }
  @Override
  protected void executeJob(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.setFirstDayOfWeek(Calendar.MONDAY);
    int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
    if (dayOfWeek != Calendar.MONDAY && dayOfWeek != Calendar.THURSDAY) {
      return;
    }

    if (lock) {
      return;
    } else {
      lock = true;
      try {
        LOG.info("后台上周每个汽配店铺所关心的配件 汽修版的上周销量、入库量统计");
        LOG.info("开始时间:" + DateUtil.dateLongToStr(System.currentTimeMillis()));
        IPreciseRecommendService service =
            ServiceManager.getService(IPreciseRecommendService.class);
        service.salesInventoryMonthStat();

      } catch (Exception e) {
        LOG.error("/SalesInventoryWeekStatSchedule method=executeJob 上周销量、入库量统计失败");
        LOG.error(e.getMessage(), e);
      } finally {
        LOG.info("后台结束上周销量、入库量统计");
        lock = false;
        LOG.info("结束时间:" + DateUtil.dateLongToStr(System.currentTimeMillis()));
      }
    }
  }
Exemplo n.º 9
0
 @Override
 public void saveOrUpdateRecentlyUsedProductCategory(
     Long shopId, Long userId, Long productCategoryId) {
   if (shopId == null || productCategoryId == null) return;
   IRecentlyUsedDataService recentlyUsedDataService =
       ServiceManager.getService(IRecentlyUsedDataService.class);
   recentlyUsedDataService.saveOrUpdateRecentlyUsedData(
       shopId, userId, RecentlyUsedDataType.USED_PRODUCT_CATEGORY, productCategoryId);
 }
Exemplo n.º 10
0
 @RequestMapping(params = "method=toCameraConfigDetail")
 public Object toCameraConfig(HttpServletRequest request, String id, ModelMap model) {
   Map<String, Object> result = new HashMap<String, Object>();
   ICameraService cameraService = ServiceManager.getService(ICameraService.class);
   CameraConfigDTO cameraConfigDTO = cameraService.getCameraConfigByCameraId(id);
   if (cameraConfigDTO == null) {
     cameraConfigDTO = new CameraConfigDTO();
     cameraConfigDTO.setCamera_id(id);
   }
   model.addAttribute("cameraConfigDTO", cameraConfigDTO);
   return "/camera/cameraRecordContent";
 }
Exemplo n.º 11
0
 @Override
 public void recycleInvitationCode(Integer pageSize) {
   IConfigService configService = ServiceManager.getService(IConfigService.class);
   if (pageSize == null) {
     pageSize = PAGE_SIZE;
   }
   long id = 0;
   List<InvitationCode> codeList;
   List<InvitationCodeRecycle> recycles = new ArrayList<InvitationCodeRecycle>();
   List<InvitationCode> codes = new ArrayList<InvitationCode>();
   InvitationCodeRecycle recycle;
   while (true) {
     NotificationWriter writer = notificationDaoManager.getWriter();
     codeList = writer.getInvitationCode(pageSize, id); // 得到将要reindex的orderId
     if (CollectionUtils.isEmpty(codeList)) break;
     Object status = writer.begin();
     try {
       for (InvitationCode code : codeList) {
         // 过期 无效
         if (InvitationCodeStatus.isRecycle(
             code.getExpirationTime(),
             configService.getConfig("INVITATION_CODE_OVERDUE_DATE", ShopConstant.BC_SHOP_ID),
             code.getStatus())) {
           recycle = new InvitationCodeRecycle();
           if (code.getExpirationTime() < System.currentTimeMillis()) {
             recycle = recycle.fromInvitationCode(code);
           }
           recycle.setStatus(InvitationCodeStatus.INVALID_OVERDUE);
           recycles.add(recycle);
           codes.add(code);
         } else if (InvitationCodeStatus.isOverdue(
             code.getExpirationTime(),
             configService.getConfig("INVITATION_CODE_EFFECTIVE_DATE", ShopConstant.BC_SHOP_ID))) {
           // 过期
           code.setStatus(InvitationCodeStatus.OVERDUE);
           writer.update(code);
         }
       }
       id = codeList.get(codeList.size() - 1).getId();
       if (CollectionUtils.isNotEmpty(recycles)) {
         for (int i = 0, max = recycles.size(); i < max; i++) {
           writer.save(recycles.get(i));
           writer.delete(InvitationCode.class, codes.get(i).getId());
         }
       }
       writer.commit(status);
     } finally {
       writer.rollback(status);
       recycles.clear();
       codes.clear();
     }
   }
 }
Exemplo n.º 12
0
  @Override
  public Node getBusinessScopeByShopId(Long shopId) {
    List<ProductCategoryDTO> productCategoryDTOList =
        ServiceManager.getService(IProductCategoryService.class)
            .getProductCategoryDTOByShopId(ShopConstant.BC_ADMIN_SHOP_ID);

    // 经营范围
    Set<Long> shopIdSet = new HashSet<Long>();
    shopIdSet.add(shopId);
    List<ShopBusinessScopeDTO> shopBusinessScopeDTOList =
        ServiceManager.getService(IConfigService.class).getShopBusinessScopeByShopId(shopIdSet);
    Map<Long, Object> map = new HashMap<Long, Object>();

    for (ShopBusinessScopeDTO dto : shopBusinessScopeDTOList) {
      map.put(dto.getProductCategoryId(), dto);
    }

    CheckNode root = (CheckNode) buildCheckProductCategoryTree(productCategoryDTOList, map);
    root.reBuildTreeForChecked();
    return root;
  }
Exemplo n.º 13
0
 @ResponseBody
 @RequestMapping(params = "method=getCategoryItemSearch")
 public Object getCategoryItemSearch(
     ModelMap model,
     HttpServletRequest request,
     CategoryServiceSearchDTO categoryServiceSearchDTO) {
   RFITxnService txnService = ServiceManager.getService(RFITxnService.class);
   Long shopId = WebUtil.getShopId(request);
   Long startPageNo = 1l;
   if (StringUtils.isNotBlank(request.getParameter("startPageNo"))
       && NumberUtil.isNumber(request.getParameter("startPageNo"))) {
     startPageNo = NumberUtil.longValue(request.getParameter("startPageNo"));
   }
   Map<String, Object> returnMap = new HashMap<String, Object>();
   try {
     if (categoryServiceSearchDTO == null) {
       categoryServiceSearchDTO = new CategoryServiceSearchDTO();
     }
     Pager pager = null;
     // 全部
     if (categoryServiceSearchDTO.getCategoryServiceType() == null) {
       categoryServiceSearchDTO.setServiceDTOs(
           txnService.getServicesByCategory(
               shopId,
               categoryServiceSearchDTO.getServiceName(),
               categoryServiceSearchDTO.getCategoryName(),
               CategoryType.BUSINESS_CLASSIFICATION,
               startPageNo,
               PAGE_SIZE));
       pager =
           new Pager(
               txnService.countServiceByCategory(
                   shopId,
                   categoryServiceSearchDTO.getServiceName(),
                   categoryServiceSearchDTO.getCategoryName(),
                   CategoryType.BUSINESS_CLASSIFICATION),
               startPageNo.intValue(),
               (int) PAGE_SIZE);
     }
     categoryServiceSearchDTO.setCategoryDTOs(txnService.getCategoryByShopId(shopId));
     returnMap.put("pager", pager);
     returnMap.put("categoryServiceSearchDTO", categoryServiceSearchDTO);
     returnMap.put("result", new Result(true));
     return returnMap;
   } catch (Exception e) {
     LOG.debug("/category.do");
     LOG.debug("method=getCategoryItemSearch");
     LOG.error(e.getMessage(), e);
     returnMap.put("result", new Result(false));
     return returnMap;
   }
 }
Exemplo n.º 14
0
 @RequestMapping(params = "method=getResources")
 @ResponseBody
 public Object getResources(HttpServletRequest request) {
   IPrivilegeService privilegeService = ServiceManager.getService(IPrivilegeService.class);
   List<ResourceDTO> resourceDTOList;
   try {
     resourceDTOList = privilegeService.getResourceDTOList(null, WebUtil.getUserGroupId(request));
   } catch (Exception e) {
     LOG.debug("/admin/resource.do");
     LOG.debug("method=getResources");
     LOG.error(e.getMessage(), e);
     resourceDTOList = new ArrayList<ResourceDTO>();
   }
   return resourceDTOList;
 }
Exemplo n.º 15
0
 @RequestMapping(params = "method=getResourcesByRoleId")
 @ResponseBody
 public Object getResourcesByRoleId(HttpServletRequest request, Long roleId) {
   Map<String, List<ResourceDTO>> map = new HashMap<String, List<ResourceDTO>>();
   try {
     Long shopId = WebUtil.getShopId(request);
     if (shopId == null || roleId == null) throw new Exception("shopId or roleId is null!");
     List<ResourceDTO> resourceDTOList =
         ServiceManager.getService(IResourceService.class).getResourceByRoleId(roleId);
     map.put("results", resourceDTOList);
   } catch (Exception e) {
     LOG.debug("/admin/resource.do");
     LOG.debug("method=getResourcesByRole");
     LOG.error(e.getMessage(), e);
   }
   return map;
 }
Exemplo n.º 16
0
 /*
   初始化摄像头配置
 */
 @ResponseBody
 @RequestMapping(params = "method=initCameraConfigList")
 public Object initCameraConfigList(HttpServletRequest request, Integer page, Integer rows) {
   Long shopId = null;
   shopId = WebUtil.getShopId(request);
   ICameraService cameraService = ServiceManager.getService(ICameraService.class);
   Map<String, Object> result = new HashMap<String, Object>();
   try {
     int total = cameraService.getCountCameraConfigByShopId(StringUtil.valueOf(shopId));
     Pager pager = new Pager(total, page, rows);
     result.put("total", total);
     if (total > 0) {
       List<CameraConfigDTO> rowsList = new ArrayList<CameraConfigDTO>();
       rowsList = cameraService.getCameraConfigByShopId(shopId.toString());
       result.put("rows", rowsList);
     }
   } catch (Exception e) {
     LOG.error(e.getMessage(), e);
   }
   return result;
 }
Exemplo n.º 17
0
 /*
   初始化到店车辆记录
 */
 @ResponseBody
 @RequestMapping(params = "method=initCameraRecordList")
 public Object initCameraRecordList(HttpServletRequest request, CameraSearchCondition condition) {
   Long shopId = null;
   shopId = WebUtil.getShopId(request);
   condition.setShopId(shopId.toString());
   ICameraService cameraService = ServiceManager.getService(ICameraService.class);
   Map<String, Object> result = new HashMap<String, Object>();
   try {
     int total = cameraService.getCameraRecordDTOListAccountByShopId(condition);
     Pager pager = new Pager(total, condition.getPage(), condition.getRows());
     result.put("total", total);
     List<CameraRecordDTO> rowsList = new ArrayList<CameraRecordDTO>();
     if (total > 0) {
       rowsList = cameraService.getCameraRecordListByShopId(pager, condition);
     }
     result.put("rows", rowsList);
   } catch (Exception e) {
     LOG.error(e.getMessage(), e);
   }
   return result;
 }
Exemplo n.º 18
0
  /**
   * 导入前: 1.读取excel文件表头 2.保存导入记录(文件)到数据库
   *
   * @param request
   * @return
   */
  @RequestMapping(params = "method=uploadExcel")
  public void getExcelHeader(HttpServletRequest request, HttpServletResponse response) {
    IImportService importService = ServiceManager.getService(IImportService.class);
    IPrivilegeService privilegeService = ServiceManager.getService(IPrivilegeService.class);
    Map result = new HashMap();
    try {
      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
      MultipartFile multipartFile = multipartRequest.getFile("selectfile");
      String fileName = multipartFile.getOriginalFilename();
      if (!validateOrderType(fileName)) { // todo 不起作用
        response.setHeader("Charset", "UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter writer = response.getWriter();
        result.put("orderImportMsg", "上传文件名无法识别,请使用标准模板名!");
        String resultStr = JsonUtil.mapToJson(result);
        writer.write(resultStr);
        writer.flush();
        writer.close();
        return;
      }
      InputStream inputStream = multipartFile.getInputStream();
      if (inputStream.available() > ImportConstants.UPLOAD_FILE_MAX_SIZE) {
        PrintWriter writer = response.getWriter();
        writer.write(
            "上传文件大小不能超过" + NumberUtil.byteToMillion(ImportConstants.UPLOAD_FILE_MAX_SIZE) + "M!");
        writer.flush();
        writer.close();
        return;
      }
      byte[] fileContent = IOUtil.readFromStream(inputStream);
      // 先读取表头
      ImportContext importContext = new ImportContext();
      importContext.setFileContent(fileContent);
      importContext.setFileName(fileName);
      List<String> headList = importService.parseHead(importContext);
      if (headList == null || headList.isEmpty()) {
        result.put("message", "解析导入文件头部失败!");
      } else {
        result.put("headList", headList);
      }

      // 再存入数据库
      ImportRecordDTO importRecordDTO = new ImportRecordDTO();
      importRecordDTO.setShopId(WebUtil.getShopId(request));
      importRecordDTO.setStatus(ImportConstants.Status.STATUS_WAITING);
      importRecordDTO.setType(ImportConstants.Type.TYPE_ORDER);
      importRecordDTO.setFileName(fileName);
      importRecordDTO.setFileContent(fileContent);
      importRecordDTO = importService.createImportRecord(importRecordDTO);
      if (importRecordDTO == null || importRecordDTO.getId() == null) {
        result.put("message", "保存导入记录出错!");
      } else {
        result.put("importRecordId", String.valueOf(importRecordDTO.getId()));
      }
      result.put(
          "systemFieldList",
          getOrderFieldList(
              PrivilegeRequestProxy.verifierShopVersionResourceProxy(
                  request, LogicResource.WEB_VERSION_WHOLESALERS)));
      String resultStr = JsonUtil.mapToJson(result);
      response.setHeader("Charset", "UTF-8");
      response.setContentType("text/html;charset=UTF-8");
      PrintWriter writer = response.getWriter();
      writer.write(resultStr);
      writer.flush();
      writer.close();
    } catch (Exception e) {
      LOG.error("上传文件出现异常!");
      LOG.error(e.getMessage(), e);
    }
  }
Exemplo n.º 19
0
 @Override
 protected boolean condition() throws JspTagException {
   return expectResult.equals(
       ServiceManager.getService(IConfigService.class)
           .getConfig(configValue, ShopConstant.BC_SHOP_ID));
 }
Exemplo n.º 20
0
 @Override
 public String buildMenu(long shopVersionId, long shopId, long userId, long userGroupId)
     throws Exception {
   Set<Long> resourceIds = new HashSet<Long>();
   List<Resource> resourceList =
       ServiceManager.getService(IResourceService.class)
           .getAllResourcesByUserGroupId(shopVersionId, userGroupId);
   for (Resource r : resourceList) {
     if (ResourceType.menu == r.getType()) {
       resourceIds.add(r.getId());
     }
   }
   Map<String, MenuRootResponse> menuRootResponseMap = new HashMap<String, MenuRootResponse>();
   List<MenuDTO> parents = new ArrayList<MenuDTO>();
   if (CollectionUtil.isNotEmpty(resourceIds)) {
     List<MenuDTO> menuDTOList =
         ServiceManager.getService(IResourceService.class).getMenuByResourceIds(resourceIds);
     //      List<UserSwitch> userSwitches =
     // ServiceManager.getService(IUserService.class).getUserSwitch(shopId);
     boolean isRepairPickingSwitchOn =
         ServiceManager.getService(IUserService.class).isRepairPickingSwitchOn(shopId);
     Iterator iterator = menuDTOList.iterator();
     MenuDTO menuDTO;
     while (iterator.hasNext()) {
       menuDTO = (MenuDTO) iterator.next();
       // 特殊过滤
       if (MenuType.TXN_INVENTORY_MANAGE_REPAIR_PICKING.name().equals(menuDTO.getMenuName())
           && !isRepairPickingSwitchOn) {
         iterator.remove();
       }
       // 页面配置开关
       if (MenuType.WEB_SYSTEM_SETTINGS_CUSTOM_CONFIG_PAGE_CONFIG
               .name()
               .equals(menuDTO.getMenuName())
           && !ConfigUtils.isCustomizerConfigOpen()) {
         iterator.remove();
       }
       if (menuDTO.getParentId() == null) {
         parents.add(menuDTO);
         iterator.remove();
       }
     }
     List<MenuItemResponse> menuItemResponseList;
     MenuItemResponse response;
     MenuRootResponse rootResponse;
     for (MenuDTO root : parents) {
       root.buildTree(root, menuDTOList);
       // 根据logic 做具体处理
       //        sort(shopVersionId, root);
       root.reBuildTreeForSort();
       menuItemResponseList = new ArrayList<MenuItemResponse>();
       for (MenuDTO menu : root.getChildren()) {
         //          if (menu.getChildren().size() > 1) {
         //            String href = "";
         //            //特殊root menu 需要连接
         //            if
         // (MenuType.AUTO_ACCESSORY_ONLINE_ORDER_CENTER.name().equals(menu.getMenuName())
         //                || MenuType.VEHICLE_CONSTRUCTION.name().equals(menu.getMenuName())) {
         //              href = root.getHref();
         //            }
         response = new MenuItemResponse(menu.getLabel(), menu.getHref(), menu.getMenuName());
         for (MenuDTO m : menu.getChildren()) {
           response
               .getItem()
               .add(new MenuItemResponse(m.getLabel(), m.getHref(), m.getMenuName()));
         }
         //          } else {
         //            response = new MenuItemResponse(menu.getLabel(), menu.getHref(),
         // menu.getMenuName());
         //          }
         menuItemResponseList.add(response);
       }
       rootResponse = new MenuRootResponse(root.getLabel(), root.getHref(), root.getMenuName());
       rootResponse.setItem(menuItemResponseList);
       menuRootResponseMap.put(root.getMenuName(), rootResponse);
     }
   }
   return JsonUtil.mapToJson(menuRootResponseMap);
 }
Exemplo n.º 21
0
 @ResponseBody
 @RequestMapping(params = "method=getQueryVehicleNo")
 public Object getQueryVehicleNo(HttpServletRequest request, CameraSearchCondition condition) {
   ICameraService cameraService = ServiceManager.getService(ICameraService.class);
   return cameraService.getVehicle_nos(condition);
 }
Exemplo n.º 22
0
  /**
   * 根据前台查询条件 获得标准商品店铺采购统计
   *
   * @param request
   * @param response
   * @param productSearchCondition
   * @return
   */
  @RequestMapping(params = "method=getNormalProductStatByCondition")
  @ResponseBody
  public Object getNormalProductStatByCondition(
      HttpServletRequest request,
      HttpServletResponse response,
      ProductSearchCondition productSearchCondition) {

    try {
      Long shopId = WebUtil.getShopId(request);
      if (shopId == null) throw new Exception("shopId is null!");
      if (productSearchCondition == null
          || productSearchCondition.getNormalProductStatType() == null) {
        return null;
      }

      List<Long> shopIdList = null;
      if (StringUtil.isNotEmpty(productSearchCondition.getShopVersion())
          || productSearchCondition.getProvinceId() != null
          || productSearchCondition.getCityId() != null
          || productSearchCondition.getRegionId() != null) {
        IConfigService configService = ServiceManager.getService(IConfigService.class);

        List<Long> shopVersionIds = new ArrayList<Long>();

        if ("REPAIR_VERSION".equals(productSearchCondition.getShopVersion())) {
          shopVersionIds.add(10000010017531654L);
          shopVersionIds.add(10000010017531655L);
          shopVersionIds.add(10000010039823882L);
        } else if ("WHOLESALER_VERSION".equals(productSearchCondition.getShopVersion())) {
          shopVersionIds.add(10000010017531657L);
          shopVersionIds.add(10000010037193619L);
          shopVersionIds.add(10000010037193620L);
          shopVersionIds.add(10000010017531653L);
        }

        shopIdList =
            configService.getShopByShopVersionAndArea(
                shopVersionIds.toArray(new Long[shopVersionIds.size()]),
                productSearchCondition.getProvinceId(),
                productSearchCondition.getCityId(),
                productSearchCondition.getRegionId());
        if (CollectionUtils.isEmpty(shopIdList)) {
          return null;
        }
      } else {
        shopIdList = new ArrayList<Long>();
        shopIdList.add(StatConstant.EMPTY_SHOP_ID);
      }

      productSearchCondition.setShopId(shopId);
      IProductService productService = ServiceManager.getService(IProductService.class);
      INormalProductStatService normalProductStatService =
          ServiceManager.getService(INormalProductStatService.class);

      Map<Long, NormalProductDTO> normalProductDTOMap =
          productService.getSimpleNormalProductDTO(productSearchCondition);

      if (MapUtils.isEmpty(normalProductDTOMap)) {
        return null;
      }
      Long[] normalProductIds =
          normalProductDTOMap.keySet().toArray(new Long[normalProductDTOMap.keySet().size()]);

      Pager pager = new Pager();
      pager.setRowStart(productSearchCondition.getStart());
      pager.setPageSize(productSearchCondition.getLimit());

      NormalProductStatSearchResult normalProductStatSearchResult =
          normalProductStatService.getStatDateByCondition(
              shopIdList.toArray(new Long[shopIdList.size()]),
              normalProductIds,
              productSearchCondition.getNormalProductStatType(),
              pager,
              normalProductDTOMap);

      return normalProductStatSearchResult;
    } catch (Exception e) {
      LOG.error("normalProductStat.do method=getNormalProductStatByCondition");
      LOG.error(productSearchCondition.toString());
      LOG.error(e.getMessage(), e);
    }
    return null;
  }
Exemplo n.º 23
0
 public IResourceService getResourceService() {
   if (resourceService == null) {
     resourceService = ServiceManager.getService(IResourceService.class);
   }
   return resourceService;
 }
Exemplo n.º 24
0
 @Override
 public List<InvitationCodeDTO> createInvitationCodes(
     InvitationCodeType invitationCodeType,
     OperatorType inviterType,
     Long inviterId,
     OperatorType inviteeType,
     List<Long> inviteeIds,
     Long expirationTime,
     boolean checkingDuplicated)
     throws Exception {
   List<InvitationCodeDTO> invitationCodeDTOList = new ArrayList<InvitationCodeDTO>();
   if (inviterType == null
       || inviterId == null
       || inviteeType == null
       || CollectionUtil.isEmpty(inviteeIds)) {
     LOG.warn(
         "parameters can't be null:[inviterType:"
             + inviterType
             + ",inviterId:"
             + inviterId
             + ",inviteeType:"
             + inviteeType
             + ",inviteeIds:"
             + inviteeIds);
     return invitationCodeDTOList;
   }
   InvitationCodeDTO dto;
   String code;
   List<String> codeList = RandomUtils.randomAlphabeticList(inviteeIds.size());
   IConfigService configService = ServiceManager.getService(IConfigService.class);
   String effectiveDate;
   if (checkingDuplicated) {
     long beginning = System.currentTimeMillis();
     while (duplicatedInvitationCodeDuplicate(codeList)) {
       codeList = RandomUtils.randomAlphabeticList(inviteeIds.size());
       if (System.currentTimeMillis() - beginning > CREATE_INVITATION_CODE_TIMEOUT) {
         throw new Exception("create invitationCode timeout exception!");
       }
     }
   }
   for (int i = 0; i < codeList.size(); i++) {
     dto = new InvitationCodeDTO();
     dto.setInviterId(inviterId);
     dto.setInviterType(inviterType);
     dto.setInviteeId(inviteeIds.get(i));
     dto.setInviteeType(inviteeType);
     dto.setStatus(InvitationCodeStatus.EFFECTIVE);
     dto.setInviteTime(System.currentTimeMillis());
     dto.setType(invitationCodeType);
     if (expirationTime == null) {
       effectiveDate =
           configService.getConfig("INVITATION_CODE_EFFECTIVE_DATE", ShopConstant.BC_SHOP_ID);
       if (StringUtil.isEmpty(effectiveDate)) {
         dto.setExpirationTime(System.currentTimeMillis() + DEFAULT_EXPIRATION_TIME);
       } else {
         dto.setExpirationTime(
             System.currentTimeMillis()
                 + Long.valueOf(
                     configService.getConfig(
                         "INVITATION_CODE_EFFECTIVE_DATE", ShopConstant.BC_SHOP_ID)));
       }
     } else {
       dto.setExpirationTime(expirationTime);
     }
     code = codeList.get(i);
     dto.setCode(code);
     invitationCodeDTOList.add(dto);
   }
   saveInvitationCodes(invitationCodeDTOList);
   return invitationCodeDTOList;
 }