コード例 #1
0
  private Map<String, Object> date4key(
      String key, Calendar calendar, Map<String, Object> variables) {
    if (variables == null) return null;
    if (key == null || key.length() == 0 || calendar == null) return variables;

    variables.put(key + "4yyyy", DateUtils.formatCalendar(calendar, "yyyy"));
    variables.put(key + "4MM", DateUtils.formatCalendar(calendar, "MM"));
    variables.put(key + "4dd", DateUtils.formatCalendar(calendar, "dd"));

    return variables;
  }
コード例 #2
0
  // 同步附件
  private void syscAttach(Case4InfractBusiness cib, String procInstId, String taskId) {
    if (cib == null || procInstId == null || procInstId.length() == 0) return;

    List<Attach> attachs =
        attachService.findByPtype(Case4InfractBusiness.ATTACH_TYPE, cib.getUid());
    if (attachs == null || attachs.size() == 0) return;

    for (Attach attach : attachs) {
      // 复制附件到流程附件位置中----开始---
      // 扩展名
      String extension = StringUtils.getFilenameExtension(attach.getPath());
      // 文件存储的相对路径(年月),避免超出目录内文件数的限制
      String subFolder = DateUtils.formatCalendar(Calendar.getInstance(), "yyyyMM");
      // 上传文件存储的绝对路径
      String appRealDir = Attach.DATA_REAL_PATH + File.separator + FlowAttach.DATA_SUB_PATH;
      // 所保存文件所在的目录的绝对路径名
      String realFileDir = appRealDir + File.separator + subFolder;
      // 不含路径的文件名
      String fileName =
          DateUtils.formatCalendar(Calendar.getInstance(), "yyyyMMddHHmmssSSSS") + "." + extension;
      // 所保存文件的绝对路径名
      String realFilePath = realFileDir + File.separator + fileName;
      // 构建文件要保存到的目录
      File _fileDir = new File(realFileDir);
      if (!_fileDir.exists()) {
        if (logger.isFatalEnabled()) logger.fatal("mkdir=" + realFileDir);
        _fileDir.mkdirs();
      }
      // 直接复制附件
      if (logger.isInfoEnabled()) logger.info("pure copy file");

      // 附件路径
      String path = Attach.DATA_REAL_PATH + File.separator + attach.getPath();

      // 从附件目录下的指定文件复制到attachment目录下
      try {
        FileCopyUtils.copy(new FileInputStream(new File(path)), new FileOutputStream(realFilePath));
      } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
      }

      // 复制附件到流程附件位置中----结束---

      // 插入流程附件记录信息
      FlowAttach flowAttach = new FlowAttach();
      flowAttach.setUid(idGeneratorService.next(FlowAttach.ATTACH_TYPE));
      flowAttach.setType(FlowAttach.TYPE_ATTACHMENT); // 类型:1-附件,2-意见
      flowAttach.setPid(procInstId); // 流程id
      flowAttach.setPath(subFolder + File.separator + fileName); // 附件路径,物理文件保存的相对路径
      flowAttach.setExt(extension); // 扩展名
      flowAttach.setSubject(attach.getSubject()); // 标题
      flowAttach.setSize(attach.getSize());
      flowAttach.setFormatted(false); // 附件是否需要格式化

      if (taskId == null) {
        flowAttach.setCommon(true); // 公共附件
      } else {
        flowAttach.setCommon(false); // 任务附件
        flowAttach.setTid(taskId);
      }

      // 创建人,最后修改人信息
      SystemContext context = SystemContextHolder.get();
      flowAttach.setAuthor(context.getUserHistory());
      flowAttach.setModifier(context.getUserHistory());
      flowAttach.setFileDate(Calendar.getInstance());
      flowAttach.setModifiedDate(Calendar.getInstance());
      this.flowAttachService.save(flowAttach);
    }
  }
コード例 #3
0
  private Map<String, Object> returnParam(Case4InfractBusiness cib, Map<String, Object> variables) {
    if (variables == null) return null;
    if (cib == null) return null;

    // 流转
    variables.put("goTo", true);
    variables.put("module_id", cib.getId());
    variables.put("module_type", Case4InfractBusiness.class.getSimpleName());

    // 违法行为
    variables.put("illegalSubject", cib.getSubject());
    // 违章地点
    variables.put("address", cib.getAddress());
    // 违章日期
    variables.put("happenDate", DateUtils.formatCalendar2Second(cib.getHappenDate()));
    // 违章类别
    variables.put("category", cib.getCategory());
    // 案号
    variables.put("caseNo", cib.getCaseNo());
    // 接案人
    variables.put("receiverName", cib.getReceiverName() == null ? "" : cib.getReceiverName());
    // 自编号
    variables.put("code", cib.getCode() == null ? "" : cib.getCode());
    // 扣件证号
    variables.put(
        "confiscateCertNo", cib.getConfiscateCertNo() == null ? "" : cib.getConfiscateCertNo());
    // 执法人
    variables.put("operator", cib.getOperator() == null ? "" : cib.getOperator());
    // 执法机关
    variables.put("operateUnit", cib.getOperateUnit() == null ? "" : cib.getOperateUnit());
    // 所属区县
    variables.put("area", cib.getArea() == null ? "" : cib.getArea());
    // 拖车单位
    variables.put("pullUnit", cib.getPullUnit() == null ? "" : cib.getPullUnit());

    // 来源
    variables.put("businessFrom", cib.getFrom() == null ? "" : cib.getFrom());

    // 车ID
    variables.put("carId", cib.getCarId());
    // 车号
    variables.put("carPlate", cib.getCarPlate());
    // 车队
    if (cib.getMotorcadeId() != null) {
      variables.put("motorcadeId", cib.getMotorcadeId());
      variables.put("motorcadeName", cib.getMotorcadeName());
      Motorcade m = this.motorcadeService.load(cib.getMotorcadeId());
      // 分公司
      variables.put("filialeId", m.getUnit().getId());
      variables.put("filiale", m.getUnit().getName());
    }

    // 主题
    String subject = cib.getCarPlate() + "驾驶员";

    if (cib.getCategory() == Case4InfractBusiness.CATEGORY_BUSINESS) {
      subject += "营运";
    } else if (cib.getCategory() == Case4InfractBusiness.CATEGORY_STATION) {
      subject += "站场";
    } else {
      subject += "服务";
    }
    subject += "违章处理";

    variables.put("subject", subject);

    return variables;
  }
コード例 #4
0
  public Attach doGetAttachFromTemplate(Long id, String templateCode) throws IOException {
    TempDriver tempDriver = this.load(id);

    // 获取模板
    Template template = this.templateService.loadByCode(templateCode);
    if (template == null) {
      logger.error("模板不存在,返回null:code=" + templateCode);
      throw new CoreException("模板不存在,code=" + templateCode);
    }

    String ptype = TempDriver.ATTACH_TYPE;
    String puid = tempDriver.getUid();

    // 不能格式化
    if (!template.isFormatted()) {
      Attach attach = template.format2Attach(null, ptype, puid);
      this.attachService.save(attach);
      return attach;
    }

    // 声明格式化参数
    Map<String, Object> params = new HashMap<String, Object>();
    params = this.returnParam(tempDriver, params);

    // 修改信誉档案的显示
    String credit = params.get("credit").toString();
    if (!"".equals(credit)) {
      credit =
          credit.replace(
              "bc/attach/", SystemContextHolder.get().getAttr("htmlPageNamespace") + "/bc/attach/");
      credit = credit.replaceAll("<font size=\"\\d\">", "");
      credit = credit.replace("</font>", "");
      credit = credit.replace("padding-right:8px;", "");
      params.put("credit", credit);
    }

    params.put("sex", tempDriver.getSex() == 1 ? "男" : "女");

    params.put("age", DateUtils.getAge(tempDriver.getBirthdate()));

    // 出生日期格式化
    date4key("birthdate", tempDriver.getBirthdate(), params);
    // 驾驶证初领日期
    date4key("certDrivingFirstDate", tempDriver.getCertDrivingFirstDate(), params);
    // 驾驶证起效日期
    date4key("certDrivingStartDate", tempDriver.getCertDrivingStartDate(), params);
    // 驾驶证无效日期
    date4key("certDrivingEndDate", tempDriver.getCertDrivingEndDate(), params);

    // 根据模板参数获取的替换值
    Map<String, Object> mapFormatSql = new HashMap<String, Object>();
    mapFormatSql.put("id", id);
    Map<String, Object> mapParams = templateService.getMapParams(template.getId(), mapFormatSql);
    if (mapParams != null) params.putAll(mapParams);

    // 加载系统上下文属性
    params.put(SystemContext.class.getSimpleName(), SystemContextHolder.get());

    Attach attach = template.format2Attach(params, ptype, puid);
    return attach;
  }
コード例 #5
0
  // 返回的全局参数
  private Map<String, Object> returnParam(TempDriver tempDriver, Map<String, Object> variables) {
    variables.put("tempDriver_id", tempDriver.getId());
    variables.put("tempDriver_status", tempDriver.getStatus());
    variables.put("tempDriver_uid", tempDriver.getUid());
    variables.put("tempDriver_desc", tempDriver.getDesc() != null ? tempDriver.getDesc() : "");
    if (tempDriver.getModifier() != null) {
      variables.put("tempDriver_modifierId", tempDriver.getModifier().getId());
      variables.put("tempDriver_modifier", tempDriver.getModifier().getName());
      variables.put("tempDriver_modifierCode", tempDriver.getModifier().getCode());
      variables.put(
          "tempDriver_modifiedDate", DateUtils.formatCalendar2Day(tempDriver.getModifiedDate()));
    }

    variables.put("address", tempDriver.getAddress() != null ? tempDriver.getAddress() : "");
    variables.put("birthdate", DateUtils.formatCalendar2Day(tempDriver.getBirthdate()));
    variables.put(
        "certDrivingFirstDate",
        tempDriver.getCertDrivingFirstDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getCertDrivingFirstDate())
            : "");
    variables.put(
        "cyStartYear",
        tempDriver.getCyStartYear() != null ? tempDriver.getCyStartYear().toString() : "");
    variables.put("certCYZG", tempDriver.getCertCYZG() != null ? tempDriver.getCertCYZG() : "");
    variables.put("certFWZG", tempDriver.getCertFWZG() != null ? tempDriver.getCertFWZG() : "");
    variables.put("certIdentity", tempDriver.getCertIdentity());
    variables.put("education", tempDriver.getEducation() != null ? tempDriver.getEducation() : "");
    variables.put(
        "list_family", tempDriver.getListFamily() != null ? tempDriver.getListFamily() : "");
    variables.put(
        "list_workExperience",
        tempDriver.getListWorkExperience() != null ? tempDriver.getListWorkExperience() : "");
    variables.put("marry", tempDriver.getMarry() != null ? tempDriver.getMarry() : "");
    variables.put("name", tempDriver.getName());
    variables.put("nation", tempDriver.getNation() != null ? tempDriver.getNation() : "");
    variables.put(
        "newAddress", tempDriver.getNewAddress() != null ? tempDriver.getNewAddress() : "");
    variables.put("origin", tempDriver.getOrigin() != null ? tempDriver.getOrigin() : "");
    variables.put("phone", tempDriver.getPhone() != null ? tempDriver.getPhone() : "");
    variables.put("region", tempDriver.getRegion());
    variables.put("sex", tempDriver.getSex());
    variables.put("credit", tempDriver.getCredit() != null ? tempDriver.getCredit() : "");
    variables.put(
        "validStartDate",
        tempDriver.getValidStartDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getValidStartDate())
            : "");
    variables.put(
        "validEndDate",
        tempDriver.getValidEndDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getValidEndDate())
            : "");
    variables.put(
        "creditDate",
        tempDriver.getCreditDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getCreditDate())
            : "");
    variables.put(
        "interviewDate",
        tempDriver.getInterviewDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getInterviewDate())
            : "");
    variables.put(
        "registerDate",
        tempDriver.getRegisterDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getRegisterDate())
            : "");
    variables.put(
        "creditDesc", tempDriver.getCreditDesc() != null ? tempDriver.getCreditDesc() : "");
    variables.put(
        "crimeRecode", tempDriver.getCrimeRecode() != null ? tempDriver.getCrimeRecode() : "");
    variables.put(
        "backGround", tempDriver.getBackGround() != null ? tempDriver.getBackGround() : "");
    variables.put("entryCar", tempDriver.getEntryCar() != null ? tempDriver.getEntryCar() : "");
    // variables.put("applyAttr", tempDriver.getApplyAttr()!=null?tempDriver.getApplyAttr():"");
    variables.put(
        "formerUnit", tempDriver.getFormerUnit() != null ? tempDriver.getFormerUnit() : "");
    variables.put("issue", tempDriver.getIssue() != null ? tempDriver.getIssue() : "");
    variables.put(
        "isCrimeRecode",
        tempDriver.getIsCrimeRecode() != null ? tempDriver.getIsCrimeRecode() + "" : "");
    variables.put("model", tempDriver.getModel() != null ? tempDriver.getModel() + "" : "");
    variables.put(
        "certDriving", tempDriver.getCertDriving() != null ? tempDriver.getCertDriving() + "" : "");
    variables.put(
        "certDrivingStartDate",
        tempDriver.getCertDrivingStartDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getCertDrivingStartDate())
            : "");
    variables.put(
        "certDrivingEndDate",
        tempDriver.getCertDrivingEndDate() != null
            ? DateUtils.formatCalendar2Day(tempDriver.getCertDrivingEndDate())
            : "");
    variables.put(
        "certDrivingArchive",
        tempDriver.getCertDrivingArchive() != null ? tempDriver.getCertDrivingArchive() : "");
    return variables;
  }