public boolean remove(Object myaction) throws Exception {
   ButtonEnumRuleAction action = (ButtonEnumRuleAction) myaction;
   String ids = action.getWid();
   boolean deleteSuccess2 = getBaseDao().deleteAll("TSysButtonEnumRule", "buttonRuleId", "=", ids);
   boolean deleteSuccess1 = getBaseDao().deleteAll("TSysButtonRule", "wid", "=", ids);
   if (deleteSuccess1 && deleteSuccess2) {
     BusinessLogUtil.log(
         action.getLoginUser().getUserLoginId(),
         SysConstants.CZDX_T_SYS_BUTTON_RULE,
         SysConstants.LOG_ACTION_DEL);
   }
   return deleteSuccess1 && deleteSuccess2;
 }
Example #2
0
 /*
  * (non-Javadoc)
  *
  * @see com.imchooser.framework.service.BaseService#remove(java.lang.Object)
  */
 public boolean remove(Object myaction) throws Exception {
   DepartAction action = (DepartAction) myaction;
   String mess = null;
   mess =
       DBUtil.execOracleProcQueryString(
           "prc_sys_deletedepartid(?,?,?)",
           action.getTsysDepart().getDepartid(),
           action.getDepartID());
   boolean deleteSuccess = "1".equals(mess);
   if (deleteSuccess) {
     BusinessLogUtil.log(
         action.getLoginUser().getUserLoginId(),
         SysConstants.CZDX_T_SYS_DEPART,
         SysConstants.LOG_ACTION_DEL);
   } else {
     throw new Exception(mess);
   }
   return deleteSuccess;
 }
Example #3
0
  public void saveOrUpdate(Object myaction) throws Exception {
    DepartAction action = (DepartAction) myaction;
    TSysDepart object = action.getTsysDepart();
    object.setUpdepartid(action.getUpdepartid());
    if (object.getDepartname() != null && object.getDepartnamePy() == null) {
      object.setDepartnamePy(Char2spell.getPYString(object.getDepartname()));
    }
    TDepartDetail tDepartDetail = action.getDepartDetail();

    String proceduceName = SQLConfigUtil.getProcName("procd.changeDepart");
    if (object.getDepartid() == null || "".equals(object.getDepartid())) {
      String deptid = getNewDepartid(action.getUpdepartid());
      /**
       * String deptid=""; String sql="select max(departid) from t_sys_depart where
       * updepartid='"+object.getUpdepartid()+"'"; String id=(String)DBUtil.queryField(sql);
       * if(id==null) { deptid=object.getUpdepartid()+"001"; } else { Long nl=Long.parseLong(id)+1L;
       * deptid=String.valueOf(nl); }
       */
      object.setDepartid(deptid);
      if ("0".equals(object.getUpdepartid())) {
        object.setCc("1");
        object.setDeparttype("1");
      } else {
        // 查询上级部门
        TSysDepart updepart =
            (TSysDepart) getBaseDao().findById(TSysDepart.class, action.getUpdepartid());
        if (updepart == null) return;
        object.setCc(String.valueOf(Integer.parseInt(updepart.getCc()) + 1));
        object.setDeparttype(getDeparttype(updepart.getDeparttype()));
      }
      getBaseDao().save(object);
      tDepartDetail.setDepartid(deptid);
      getBaseDao().save(tDepartDetail);
      BusinessLogUtil.log(
          action.getLoginUser().getUserLoginId(),
          SysConstants.CZDX_T_SYS_DEPART,
          SysConstants.LOG_ACTION_SAVE);
      action.setSuccessFlag("1");

      DBUtil.execUniProcNoneQuery(proceduceName, deptid, "1"); // 调用存储过程更新相关业务数据
    } else {
      // 动态更新
      TSysDepart olddepart =
          (TSysDepart) getBaseDao().findById(TSysDepart.class, object.getDepartid());
      // 如果不为空则更新部门名称
      if (StringUtils.isNotBlank(object.getDepartname())) {
        olddepart.setDepartname(object.getDepartname());
      }
      // 如果不为空则更新上级部门ID
      if (StringUtils.isNotBlank(action.getUpdepartid())) {
        olddepart.setUpdepartid(action.getUpdepartid());
      }
      // 如果不为空则更新部门ID
      // if(StringUtils.isNotBlank(action.getTsysDepart().getDepartid())){
      // olddepart.setDepartid(action.getTsysDepart().getDepartid());
      // }
      olddepart.setSfsn(object.getSfsn());
      olddepart.setState(object.getState());
      getBaseDao().update(olddepart);
      BusinessLogUtil.log(
          action.getLoginUser().getUserLoginId(),
          SysConstants.CZDX_T_SYS_DEPART,
          SysConstants.LOG_ACTION_UPDATE);
      // 动态更新
      TDepartDetail olddetail =
          (TDepartDetail) getBaseDao().findById(TDepartDetail.class, object.getDepartid());
      // 如果不为空则更新部门ID
      // if(StringUtils.isNotBlank(action.getTsysDepart().getDepartid())){
      // tDepartDetail.setDepartid(action.getTsysDepart().getDepartid());
      // }
      if (olddetail == null) {
        olddetail = new TDepartDetail();
        olddetail.setDepartid(object.getDepartid());
        // throw new Exception("数据不完整,缺少此部门的扩展信息数据。请联系技术人员解决此问题!");
      }
      olddetail.setAccount1(tDepartDetail.getAccount1());
      olddetail.setAccount2(tDepartDetail.getAccount2());
      olddetail.setHh(tDepartDetail.getHh());
      olddetail.setHh2(tDepartDetail.getHh2());
      olddetail.setZhmc(tDepartDetail.getZhmc());
      olddetail.setZhmc2(tDepartDetail.getZhmc2());
      olddetail.setAddress(tDepartDetail.getAddress());
      olddetail.setBank1(tDepartDetail.getBank1());
      olddetail.setBank2(tDepartDetail.getBank2());
      olddetail.setEmail(tDepartDetail.getEmail());
      olddetail.setFax(tDepartDetail.getFax());
      olddetail.setLinkman(tDepartDetail.getLinkman());
      olddetail.setLinktel(tDepartDetail.getLinktel());
      olddetail.setPostcode(tDepartDetail.getPostcode());
      //
      getBaseDao().saveOrUpdate(olddetail);
      //
      action.setSuccessFlag("1");
      DBUtil.execUniProcNoneQuery(proceduceName, object.getDepartid(), "2"); // 调用存储过程更新相关业务数据
    }

    DBUtil.execOracleProcQueryString("prc_sys_init(?,?,?)", CommonQuery.getThisSchoolYear(), '0');
  }