コード例 #1
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 根据折扣detail获取折扣名称,(98*97*94_2010-07-12)
   *
   * @param someDetail
   * @return
   */
  public static String getDiscountName(String someDetail) {
    //// typeId1=3&percent1=99&remark1=&typeId2=4&percent2=97&remark2=&detailCount=2

    StringBuffer sb = new StringBuffer();

    String[] details = someDetail.split("&");

    for (String detail : details) {

      if (!CommonUtils.isStrEmpty(detail) && detail.startsWith("percent")) {

        String[] tmp = detail.split("=");
        try {
          sb.append(tmp[1]);
        } catch (Exception e) {
        }
        sb.append("*");
      }
    }

    String ret = sb.toString();
    ret = CommonUtils.removeLastChar(ret);

    return ret + "_" + CommonUtils.getNowForString();
  }
コード例 #2
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 获取project_discount(楼盘折扣)的table map String
   *
   * @param payWayDiscountList
   * @return
   */
  public static String projectDiscountListJson(List<ProjectDiscount> projectDiscountList) {

    if (CommonUtils.isCollectionEmpty(projectDiscountList)) {

      return "[]";
    }

    List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
    Map<String, String> map = null;

    for (ProjectDiscount detail : projectDiscountList) {

      map = new HashMap<String, String>();

      map.put("typeId", detail.getDiscountType());
      map.put("percent", detail.getDiscountPercent().toString());
      map.put("remark", detail.getRemark());

      listMap.add(map);
    }

    String out = CommonUtils.getListMapJsonAnd(listMap);

    return out;
  }
コード例 #3
0
ファイル: CheckFeeModAction.java プロジェクト: qw4wer/back
  public String myGetCheckFeeDateList() throws Exception {

    JSONArray jsonArray = new JSONArray();

    confirmCond = new ConfirmCond();
    confirmCond.setPropertyId(request.getParameter("propertyId"));

    List<Map<String, Object>> checkFeeDateList = confirmServices.checkFeeDateList(confirmCond);

    for (int i = 0; i < checkFeeDateList.size(); i++) {

      Map<String, Object> mapobject = checkFeeDateList.get(i);

      String checkfee_date =
          mapobject.get("checkfee_date") == null ? "" : mapobject.get("checkfee_date").toString();

      if (!CommonUtils.isStrEmpty(checkfee_date)) {

        Map<String, Object> json = new HashMap<String, Object>();
        json.put(
            "checkFeeDate",
            CommonUtils.getDateString(CommonUtils.getDateFromString(checkfee_date)));

        jsonArray.add(json);
      }
    }

    CustomerUtils.writeResponse(response, jsonArray.toString());

    return null;
  }
コード例 #4
0
ファイル: CustomerServices.java プロジェクト: qw4wer/back
  /**
   * 新增Customer
   *
   * @param customer
   */
  public void saveCustomer(Customer customer) throws RuntimeException {
    // CustomerPermission.doCheckSave();

    // TODO 根据当前项目的customerOneSale,是否为1,才进行判断
    // 客户来源为来访判断,该项目下电话号码是否重复
    if ("2".equals(customer.getCustomerSource())) {
      PhoneUniqueUtils.isPhoneRepeat(customer);
    }

    // 增加号码归属地(可以改成定时器去执行),CustomerPhoneFromQuartz.java
    // customer = PhoneUtils.postPhone(customer);

    // 根据project_code设置customer的price_num对应的项目的PRICE_AMOUNT值,area_num对应的项目的REQUEST_AREA值
    ProjectCodeFieldUtils.setRriceAndAreaNum(customer);

    // 如果来访日期为空,就增加默认为当天,2013.8.14
    if (CommonUtils.isStrEmpty(customer.getVisitDate())) {
      customer.setVisitDate(CommonUtils.getDateString(new Date()));
    }

    // 设定follow_time,(因为该字段为后来新增的,所以要在这里增加)
    customer.setFollowTime(CommonUtils.getDateFromString(customer.getVisitDate()));

    // 实际保存
    customerMapper.saveCustomer(customer);

    // CacheUtils.removeCache(cacheKeyOne,customer.getId());
  }
コード例 #5
0
ファイル: UserAccountBatAction.java プロジェクト: qw4wer/back
  /**
   * 返回null表示修改成功
   *
   * @param cell
   * @return
   */
  @SuppressWarnings("unused")
  private BatchExceptionData modifyUserAccountProject(Cell[] cell) {

    String message = "";

    try {

      String projectName = cell[0].getContents().trim();
      int projectId = Integer.parseInt(cell[1].getContents().trim());

      String realName = cell[3].getContents().trim();
      String userName = cell[4].getContents().trim();

      CompanyProject project = companyProjectServices.findCompanyProjectById(projectId);
      if (project == null || !projectName.equals(project.getProjectName())) {

        message = "项目名称与id不一致";
        throw new Exception();
      }

      UserAccount user = userAccountServices.findUserAccountByUserNameIncludeDelete(userName);
      if (user == null || !realName.equals(user.getRealName())) {

        message = "用户的姓名与账号不一致";
        throw new Exception();
      }

      user.setProjectId(projectId);

      user.setModId(SessionUser.getUserId());
      user.setModTime(new Date());

      userAccountServices.updateUserAccount(user);

    } catch (Exception e) {

      if (CommonUtils.isStrEmpty(message)) {

        message = "数据格式不合法";
      }
    }

    if (CommonUtils.isStrEmpty(message)) {
      // 表示修改成功

      return null;
    }

    BatchExceptionData retPojo = new BatchExceptionData();

    retPojo.setProjectName(cell[0].getContents());
    retPojo.setProjectId(cell[1].getContents());
    retPojo.setJobNumber(cell[2].getContents());
    retPojo.setRealName(cell[3].getContents());
    retPojo.setUserName(cell[4].getContents());
    retPojo.setExceptionData(message);

    return retPojo;
  }
コード例 #6
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 根据单元折扣id获取项目折扣的显示名称
   *
   * @param unitDiscountId
   * @return
   */
  public static String getProjectDiscountShowByUnitDiscountId(int unitDiscountId) {

    StringBuffer sb = new StringBuffer();

    UnitDiscount unitDiscount = unitDiscountServices.findUnitDiscountById(unitDiscountId);

    try {

      List<UnitDiscountDetail> detailList =
          unitDiscountDetailServices.findDetailByDiscountId(unitDiscountId);

      if (!CommonUtils.isCollectionEmpty(detailList)) {
        for (UnitDiscountDetail detail : detailList) {

          sb.append(detail.getDiscountPercent()).append("*");
        }
      }

      List<ProjectDiscount> proList =
          projectDiscountServices.findProjectDiscountByUnitDiscountId(unitDiscountId);

      if (!CommonUtils.isCollectionEmpty(proList)) {
        for (ProjectDiscount pro : proList) {

          sb.append(pro.getDiscountPercent()).append("*");
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
      sb.delete(0, sb.length());
      sb.append(unitDiscount.getDiscountName());
    }

    String ret = sb.toString();
    if (ret.endsWith("*")) {

      ret = ret.substring(0, ret.length() - 1);

      // 增加折扣对应的说明
      String computeWay = unitDiscount.getComputeWay();
      String wayValue = computeWayMap.get(computeWay);
      if (!CommonUtils.isStrEmpty(wayValue)) {

        ret += wayValue;
      }
    }

    if (CommonUtils.isStrEmpty(ret)) {
      ret = "查看折扣";
    }

    return ret;
  }
コード例 #7
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 设置房间总价及合同总价(合同总价=房间总价+装修总价) 房间总价的计算方式 (1) 先加附加再优惠减价再折 计算方式:(标准总价+附加价-优惠减价)×折扣 (2) 先折再附加价再优惠减价
   * 计算方式:标准总价×折扣+附加价-优惠减价 (3) 先优惠减价再折再附加价 计算方式:(标准总价-优惠减价)×折扣+附加价
   *
   * <p>并设置"建筑成交单价","套内成交单价"
   *
   * @param discountId
   * @param multiply, 具体的折扣
   * @param map
   * @return
   */
  private static Map<String, String> initSumMoneyAndContractMoney(
      HttpServletRequest request, int discountId, BigDecimal multiply, Map<String, String> map) {

    UnitDiscount unitDiscount = unitDiscountServices.findUnitDiscountById(discountId);

    String computeWay = unitDiscount.getComputeWay(); // 折扣方式

    BigDecimal addSumPrice =
        unitDiscount.getAddSumPrice() == null
            ? new BigDecimal(0)
            : unitDiscount.getAddSumPrice(); // 附加价
    BigDecimal reduceSumPrice =
        unitDiscount.getReduceSumPrice() == null
            ? new BigDecimal(0)
            : unitDiscount.getReduceSumPrice(); // 优惠减价

    // PropertyUnit unit = unitServices.findPropertyUnitById(unitDiscount.getUnitId()); //对应的单元
    // BigDecimal sumPrice = unit.getSumPrice() == null ? new BigDecimal(0) : unit.getSumPrice();
    // //标准总价
    // BigDecimal buildPrice = unit.getBuildPrice() == null ? new BigDecimal(0) :
    // unit.getBuildPrice(); //建筑单价
    // BigDecimal insidePrice = unit.getInsidePrice() == null ? new BigDecimal(0) :
    // unit.getInsidePrice(); //套内单价

    // 下面几个字段从页面传过来
    BigDecimal sumPrice = new BigDecimal(request.getParameter("sumPrice")); // 标准总价
    BigDecimal buildArea = new BigDecimal(request.getParameter("buildArea")); // 建筑面积
    BigDecimal insideArea = new BigDecimal(request.getParameter("insideArea")); // 套内面积

    BigDecimal sumMoney = new BigDecimal(0); // 成交总价

    if ("1".equals(computeWay)) {

      sumMoney = (sumPrice.add(addSumPrice).subtract(reduceSumPrice)).multiply(multiply);

    } else if ("2".equals(computeWay)) {

      sumMoney = sumPrice.multiply(multiply).add(addSumPrice).subtract(reduceSumPrice);

    } else if ("3".equals(computeWay)) {

      sumMoney = (sumPrice.subtract(reduceSumPrice)).multiply(multiply).add(addSumPrice);
    }

    sumMoney = sumMoney.divide(new BigDecimal(1), 0, BigDecimal.ROUND_HALF_EVEN); // 四舍五入

    map.put("sumMoney", sumMoney.toString()); // 成交总价
    map.put("buildPrice", CommonUtils.moneyDivide(sumMoney, buildArea, 0)); // 建筑成交单价=成交总价/建筑面积
    map.put("insidePrice", CommonUtils.moneyDivide(sumMoney, insideArea, 0)); // 套内成交单价=成交总价/套内面积

    return map;
  }
コード例 #8
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 获取单元折扣dialog关闭要设置的值
   *
   * @param request
   * @return
   */
  public static Map<String, String> getUnitDiscountManagerCloseShowAndMultiplyByDiscountId(
      HttpServletRequest request) {

    int discountId = Integer.parseInt(request.getParameter("unitDiscountId"));

    Map<String, String> retMap = new HashMap<String, String>();

    StringBuffer sb = new StringBuffer();
    BigDecimal multiply = new BigDecimal(1); // 具体的折扣

    UnitDiscount unitDiscount = unitDiscountServices.findUnitDiscountById(discountId);

    try {

      List<PayWayDiscount> discountList =
          payWayDiscountServices.findPayWayDiscountByUnitDiscountId(discountId);

      if (!CommonUtils.isCollectionEmpty(discountList)) {
        for (PayWayDiscount discount : discountList) {

          sb.append(discount.getDiscountPercent()).append("*");
          multiply = multiply.multiply(discount.getDiscountPercent().divide(new BigDecimal(100)));
        }
      } else {

        sb.append(unitDiscount.getDiscountName());
      }

      retMap = initSumMoneyAndContractMoney(request, discountId, multiply, retMap); // 设置其他的相关金额

    } catch (Exception e) {
      e.printStackTrace();
    }

    String detail = sb.toString();
    if (detail.endsWith("*")) {
      detail = detail.substring(0, detail.length() - 1);
    }

    // 增加折扣对应的说明
    String computeWay = unitDiscount.getComputeWay();
    String wayValue = computeWayMap.get(computeWay);
    if (!CommonUtils.isStrEmpty(wayValue)) {

      detail += wayValue;
    }

    retMap.put("detail", detail); // 折扣显示
    retMap.put("multiply", multiply.toString()); // 具体的折扣

    return retMap;
  }
コード例 #9
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 根据请求参数及单元折扣id,获取单元折扣详细列表
   *
   * @param someDetail
   * @param discountId
   * @return
   * @throws Exception
   */
  public static List<UnitDiscountDetail> initForAddDiscountDetail(String someDetail, int discountId)
      throws Exception {
    // typeId1=3&percent1=99&remark1=&typeId2=4&percent2=97&remark2=&detailCount=2

    Map<String, String> map = new HashMap<String, String>();

    String[] details = someDetail.split("&");
    for (String detail : details) {

      String[] tmp = detail.split("=");
      try {

        map.put(tmp[0], tmp[1]);
      } catch (Exception e) {

        map.put(tmp[0], "");
      }
    }

    List<UnitDiscountDetail> retList = new ArrayList<UnitDiscountDetail>();
    int beanCount = Integer.parseInt(map.get("detailCount"));

    for (int i = 1; i <= beanCount; i++) {

      UnitDiscountDetail tmpDetail = new UnitDiscountDetail();

      String typeId = map.get("typeId" + i);
      String percent = map.get("percent" + i);
      String remark = map.get("remark" + i);

      if (CommonUtils.isStrEmpty(typeId)
          && CommonUtils.isStrEmpty(percent)
          && CommonUtils.isStrEmpty(remark)) continue;

      tmpDetail.setDiscountId(discountId);
      tmpDetail.setDiscountType(typeId);
      tmpDetail.setDiscountPercent(CommonUtils.exceptionToZero(percent));
      tmpDetail.setRemark(remark);

      CommonPojoUtils.initPojoCommonFiled(tmpDetail);

      retList.add(tmpDetail);
    }

    return retList;
  }
コード例 #10
0
ファイル: UserAccountBatAction.java プロジェクト: qw4wer/back
  /**
   * 跳到批量修改项目的页面 dtc 2013.11.29
   *
   * @return
   * @throws Exception
   */
  public String toBatchModifyProject() throws Exception {

    Map<String, String> map = new LinkedHashMap<String, String>();

    List<Company> companyList = companyServices.findCompany(new CompanyCond());
    if (!CommonUtils.isCollectionEmpty(companyList)) {

      for (Company com : companyList) {

        map.put(com.getId() + "", com.getCompanyName());
      }
    }

    companyOption = CommonUtils.getSelectContent(map, SessionUser.getCompanyId() + "", true);

    return "toBatchModifyProject";
  }
コード例 #11
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 获取折扣记忆名称
   *
   * @param payWayDiscountIds
   * @return
   */
  public static String initUnitDiscountDiscountNameByPayWayDiscountIds(String[] payWayDiscountIds) {

    StringBuffer sb = new StringBuffer();

    if (payWayDiscountIds != null) {
      for (String payWayDiscountId : payWayDiscountIds) {

        PayWayDiscount discount =
            payWayDiscountServices.findPayWayDiscountById(Integer.parseInt(payWayDiscountId));
        sb.append(discount.getDiscountPercent());
      }
    }

    String ret = sb.toString();
    ret = CommonUtils.removeLastChar(ret);

    return ret + "_" + CommonUtils.getNowForString();
  }
コード例 #12
0
ファイル: XshlfxLcReportAction.java プロジェクト: qw4wer/back
  private void initSearchDate() {
    if (propertyUnitCond == null) {
      propertyUnitCond = new PropertyUnitCond();

      propertyUnitCond.addPermissionCompanyProjectIds(
          PermissionUtils.getUserProjectIdList(EnumPrivCode.REPORT_SALEUNIT_STAT));
      propertyUnitCond.setSearchCompanyProjectIds(propertyUnitCond.getPrivCompanyProjectIds());

      //			propertyUnitCond.setDate1(CommonUtils.getMonthFirstForString());
      propertyUnitCond.setDate2(CommonUtils.getMonthEndForString());
    } else if (propertyUnitCond.getPrivCompanyProjectIds() == null) {
      propertyUnitCond.addPermissionCompanyProjectIds(
          PermissionUtils.getUserProjectIdList(EnumPrivCode.REPORT_SALEUNIT_STAT));
    }
  }
コード例 #13
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 根据单元折扣id获取对应的项目折扣id
   *
   * @param unitDiscountId
   * @return
   */
  public static Integer[] getProjectDiscountIdsByUnitDiscountId(int unitDiscountId) {

    List<ProjectDiscount> changeList =
        projectDiscountServices.findProjectDiscountByUnitDiscountId(unitDiscountId);

    List<Integer> idList = new ArrayList<Integer>();

    if (!CommonUtils.isCollectionEmpty(changeList)) {

      for (ProjectDiscount change : changeList) {

        idList.add(change.getId());
      }
    }

    if (CommonUtils.isCollectionEmpty(idList)) return new Integer[0];

    Integer[] ret = new Integer[idList.size()];
    for (int i = 0; i < idList.size(); i++) {
      ret[i] = idList.get(i);
    }

    return ret;
  }
コード例 #14
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 根据请求参数及项目折扣id获取单元折扣名称
   *
   * @param someDetail
   * @return
   */
  public static String getDiscountNameAndProjectDiscountId(
      String someDetail, Integer[] projectDiscountId) {
    //// typeId1=3&percent1=99&remark1=&typeId2=4&percent2=97&remark2=&detailCount=2

    StringBuffer sb = new StringBuffer();

    String[] details = someDetail.split("&");

    for (String detail : details) {

      if (!CommonUtils.isStrEmpty(detail) && detail.startsWith("percent")) {

        String[] tmp = detail.split("=");
        try {
          sb.append(tmp[1]);
        } catch (Exception e) {
        }
        sb.append("*");
      }
    }

    if (projectDiscountId != null && projectDiscountId.length > 0) {

      for (int proDiscountId : projectDiscountId) {

        ProjectDiscount proDiscount =
            projectDiscountServices.findProjectDiscountById(proDiscountId);
        sb.append(proDiscount.getDiscountPercent().intValue()).append("*");
      }
    }

    String ret = sb.toString();
    ret = CommonUtils.removeLastChar(ret);

    return ret + "_" + CommonUtils.getNowForString();
  }
コード例 #15
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 根据payWayId获取具体的折扣(百分比)多选框
   *
   * @param payWayId
   * @return
   */
  public static Map<String, String> initSelProjectDiscountByPayWayId(int payWayId) {

    List<ProjectDiscount> list = projectDiscountServices.findProjectDiscountByPayWayId(payWayId);

    Map<String, String> map = new HashMap<String, String>();
    if (CommonUtils.isCollectionEmpty(list)) return map;

    for (ProjectDiscount discount : list) {

      String key = discount.getId() + "";
      String value = discount.getDescDiscountType() + "(" + discount.getDiscountPercent() + ")";

      map.put(key, value);
    }

    return map;
  }
コード例 #16
0
ファイル: UserAccountBatAction.java プロジェクト: qw4wer/back
  /**
   * 判断是否唯一包含公司项目,如果返回的list size不等于1就表示有问题
   *
   * @param proList
   * @param companyProjectName
   * @return
   */
  private List<CompanyProject> isIncludeOnlyCompanyProject(
      List<CompanyProject> proList, String companyProjectName) {

    List<CompanyProject> retList = new ArrayList<CompanyProject>();

    if (CommonUtils.isCollectionEmpty(proList)) {

      return retList;
    }

    for (CompanyProject pro : proList) {

      if (companyProjectName.equals(pro.getProjectName())) {

        retList.add(pro);
      }
    }

    return retList;
  }
コード例 #17
0
  /**
   * 根据文件名返回项目id,如果返回0表示该文件不合法 C:\\question\\兰乔圣菲_55.xl
   *
   * @param fileName
   * @return
   */
  private int getProjectIdByFileName(String fileName) {

    if (CommonUtils.isStrEmpty(fileName)) {

      return 0;
    }

    try {

      int start = fileName.lastIndexOf("\\");
      int end = fileName.lastIndexOf(".");

      fileName = fileName.substring(start + 1, end);

      String[] arr = fileName.split("_");

      String projectName = arr[0].trim(); // 项目名称
      int projectId = Integer.parseInt(arr[1].trim()); // 项目id

      CompanyProject project = companyProjectServices.findCompanyProjectById(projectId);

      if (project == null) {
        // 表示该文件不合法
        return 0;
      }

      if (!projectName.equals(project.getProjectName())) {

        return 0;
      }

      return projectId;

    } catch (Exception e) {

      return 0;
    }
  }
コード例 #18
0
ファイル: DiscountManagerUtils.java プロジェクト: qw4wer/back
  /**
   * 根据单元id获取折扣名称,(要重新修改)
   *
   * @param unitId
   * @return
   */
  @Deprecated
  public static String getDiscountName(int unitId) {

    StringBuffer sb = new StringBuffer();

    try {

      PropertyUnit unit = MyPropertyUtils.getPropertyUnitServices().findPropertyUnitById(unitId);
      PropertyBuild build =
          MyPropertyUtils.getPropertyBuildServices().findPropertyBuildById(unit.getBuildId());

      sb.append(build.getBuildName()).append("_").append(unit.getUnitNo()).append("_");

    } catch (Exception e) {

      sb = new StringBuffer();
      sb.append("_");
    }

    sb.append(CommonUtils.getNowForString());

    return sb.toString();
  }
コード例 #19
0
ファイル: CustomerListByFollow.java プロジェクト: qw4wer/back
  /**
   * 返回数据
   *
   * @return
   * @throws Exception
   */
  public String xsgjqkReportAjax() throws Exception {
    ActionTemplate.executeAjaxPage(
        this,
        cond,
        new ActionAjaxPageCallback() {

          @Override
          public int initTotal() throws Exception {
            return value;
          }

          @Override
          public List<Map<String, String>> initRows() throws Exception {
            List<Map<String, String>> retList = new ArrayList<Map<String, String>>();
            List<Map> list = null;
            if (!"".equals(cond.getFollowUserId()))
              list = customerFollowServices.findCustomerListByCustomerFollowUser(cond);
            else if (!"".equals(cond.getCompanyId()))
              list = customerFollowServices.findCustomerListByCustomer(cond);
            else if (!"".equals(cond.getProjectId()))
              list = customerFollowServices.findCustomerListByProject(cond);
            if (!CommonUtils.isCollectionEmpty(list)) {
              for (Map obj : list) {
                Map<String, String> map = new HashMap<String, String>();

                map.put("name", obj.get("customerName").toString());
                if (PermissionUtils.hasPermission(
                    EnumPrivCode.PRECUSTOMER_RETRIEVE_TEL, EnumDevFlag.GUANGZHOU)) {
                  map.put("phone1", obj.get("homePhone").toString());
                  map.put("phone2", obj.get("phone").toString());
                } else {
                  map.put("phone1", "********");
                  map.put("phone2", "********");
                }
                map.put("area", obj.get("areaNum").toString());
                map.put("price", obj.get("priceNum").toString());
                map.put("pro", obj.get("projectName").toString());
                map.put("followUserName", obj.get("userId").toString());
                map.put(
                    "createdTime",
                    obj.get("createdTime")
                        .toString()
                        .substring(0, obj.get("createdTime").toString().length() - 2));
                retList.add(map);
              }
            }
            return retList;
          }
        });
    cond.pageSize = 0;
    List<Map<String, String>> downList = new ArrayList<Map<String, String>>();
    List<Map> list = null;
    if (!"".equals(cond.getFollowUserId()))
      list = customerFollowServices.findCustomerListByCustomerFollowUser(cond);
    else if (!"".equals(cond.getCompanyId()))
      list = customerFollowServices.findCustomerListByCustomer(cond);
    else if (!"".equals(cond.getProjectId()))
      list = customerFollowServices.findCustomerListByProject(cond);
    if (!CommonUtils.isCollectionEmpty(list)) {
      for (Map obj : list) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("name", obj.get("customerName").toString());
        map.put("phone1", obj.get("phone").toString());
        map.put("phone2", obj.get("homePhone").toString());
        map.put("area", obj.get("areaNum").toString());
        map.put("price", obj.get("priceNum").toString());
        map.put("pro", obj.get("projectName").toString());
        map.put("followUserName", obj.get("userId").toString());
        map.put(
            "createdTime",
            obj.get("createdTime")
                .toString()
                .substring(0, obj.get("createdTime").toString().length() - 2));
        downList.add(map);
      }
    }
    setDownloadData(downList);

    return null;
  }
コード例 #20
0
ファイル: SearchWeekAction.java プロジェクト: qw4wer/back
  public String searchWeek() throws Exception {
    HttpSession session = request.getSession();

    if (saleWeekCond == null) {
      saleWeekCond = new SaleMonitorCond();
    }
    if (CustomerUtils.isStrEmpty(saleWeekCond.getDate1())) {
      saleWeekCond.setDate1(CommonUtils.getWeekFirstForString());
    }
    if (CustomerUtils.isStrEmpty(saleWeekCond.getDate2())) {
      saleWeekCond.setDate2(CommonUtils.getWeekEndForString());
    }

    List<Integer> projectIds = new ArrayList<Integer>();

    String from = request.getParameter("from");
    if ("left".equals(from)) {
      // 此时总是为该登陆用户的projectId

      projectIds = HengDaUtils.getUserProjects();
    } else {
      String getCompanyId = saleWeekCond.getCompanyId();
      int getProjectId = saleWeekCond.getProjectId();

      projectIds = HengDaUtils.getUserProjects();

      if (!CustomerUtils.isStrEmpty(getCompanyId)) {

        if (getProjectId != 0) {
          // 选了单个项目

          projectIds.clear();
          projectIds.add(getProjectId);
        } else {
          // 单个公司下的所有项目

          projectIds =
              HengDaUtils.getUserProjectsByCompanyId(Integer.parseInt(getCompanyId), projectIds);
        }
      }
    }

    initSelCompany();
    initSelProject(true);

    saleWeekCond.setProjectIds(projectIds);
    if (!projectIds.isEmpty()) {
      // 为空时表示该用户在该查询组合下没有符合的记录,不用再去查数据库
      saleTypeList = saleMonitorServices.findSaleMonitorList(saleWeekCond);
    }

    amount = initSaleMonitorWeekAmount(amount, saleTypeList);

    session.setAttribute("saleTypeList", saleTypeList); // 下载使用 ,没有分页不用利用saleWeekCond再查询一次
    session.setAttribute("companyId", saleWeekCond.getCompanyId());
    session.setAttribute("projectId", saleWeekCond.getProjectId());

    // 判断是否公司及项目都是一个,如果都是一个,那么就让公司项目处于选择状态
    LinkedHashMap<String, String> getSelPro = HengDaUtils.setSessionIfCompanyAndProjectOne(request);
    if (getSelPro != null) {
      selProject = getSelPro;
    }

    return "searchWeek";
  }
コード例 #21
0
ファイル: UserAccountBatAction.java プロジェクト: qw4wer/back
  /**
   * 返回null表示修改成功
   *
   * @param cell
   * @param proList
   * @param companyId
   * @return
   */
  private BatchExceptionData modifyUserAccountProject(
      Cell[] cell, List<CompanyProject> proList, int companyId) {

    String message = "";

    try {

      String projectName = cell[0].getContents().trim();
      int projectId = 0;
      try {
        projectId = Integer.parseInt(cell[1].getContents().trim());
      } catch (Exception e) {
      }

      String jobNumber = cell[2].getContents().trim();

      String realName = cell[3].getContents().trim();

      if (projectId > 0) {
        // 表示填了项目id

        CompanyProject project = companyProjectServices.findCompanyProjectById(projectId);
        if (project == null || !projectName.equals(project.getProjectName())) {

          message = "项目名称与id不一致";
          throw new Exception();
        }
      } else {
        // 没有填项目id

        List<CompanyProject> inclueProList = isIncludeOnlyCompanyProject(proList, projectName);
        if (CommonUtils.isCollectionEmpty(inclueProList) || inclueProList.size() != 1) {

          message = "选择的公司该项目不合法";
          throw new Exception();
        }

        projectId = inclueProList.get(0).getId();
      }

      UserAccount userAccount = new UserAccount(); // 参数
      userAccount.setCompanyId(companyId);
      userAccount.setRealName(realName);
      if (!CommonUtils.isStrEmpty(jobNumber)) {
        userAccount.setJobNumber(jobNumber);
      }

      List<UserAccount> userList =
          userAccountServices.findUserAccountByCompanyIdAndRealNameOrJobNumberIncludeDelete(
              userAccount);
      if (CommonUtils.isCollectionEmpty(userList) || userList.size() != 1) {

        message = "用户姓名不能唯一确定一个用户";
        throw new Exception();
      }

      UserAccount user = userList.get(0);

      user.setProjectId(projectId);

      user.setModId(SessionUser.getUserId());
      user.setModTime(new Date());

      userAccountServices.updateUserAccount(user);

    } catch (Exception e) {

      if (CommonUtils.isStrEmpty(message)) {

        message = "数据格式不合法\n" + e.getMessage();
      }
    }

    if (CommonUtils.isStrEmpty(message)) {
      // 表示修改成功

      return null;
    }

    BatchExceptionData retPojo = new BatchExceptionData();

    retPojo.setProjectName(cell[0].getContents());
    retPojo.setProjectId(cell[1].getContents());
    retPojo.setJobNumber(cell[2].getContents());
    retPojo.setRealName(cell[3].getContents());
    retPojo.setExceptionData(message);

    return retPojo;
  }