⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 entclassinfo.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		log.LOG_INFO("进入updateEntClassRankOpp方法...");
		System.out.println("----------------------------------------------------");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String entity_id = inbuffer.getString("USER_ID");
		String entity_type = "2";
		String class_id = inbuffer.getString("RELA_CLASS");
		log.LOG_INFO("cust_id==================" + cust_id + "entity_id============" + entity_id + "class_id============" + class_id);
		EntClassDAO entDao = new EntClassDAO();
		try {
			entDao.setClass_id(class_id);
			entDao.setCust_id(cust_id);
			entDao.setEntity_type(entity_type);
			entDao.setEntity_id(entity_id);
			iResult = updateEntClassRankOpp(entDao);
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出updateEntClassRankOpp方法...");
	}
	
	
	public int updateEntClassRankOpp(EntClassDAO entDao) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		String idx = entDao.getEntity_id();
		StringTokenizer st = new StringTokenizer(idx, "|");
		while (st.hasMoreTokens()) {
			String id = st.nextToken();
			log.LOG_INFO("------------------------" + id);
			list = getClassGrp(id);
			HashMap map = (HashMap) list.get(0);
			String class_id = "", class_id_grp = "", class_name = "", class_name_grp = "";
			if (map.get("class_id") != null) {
				class_id = map.get("class_id").toString();
			}
			if (map.get("class_id_grp") != null) {
				class_id_grp = map.get("class_id_grp").toString();
			}
			if (map.get("class_name") != null) {
				class_name = map.get("class_name").toString();
			}
			if (map.get("class_name_grp") != null) {
				class_name_grp = map.get("class_name_grp").toString();
			}
			log.LOG_INFO("class_id============" + class_id + "=========class_id_grp===============" + class_id_grp + "=========class_name===============" + class_name + "=========class_name_grp==========" + class_name_grp);
			EntClassExt entExt = new EntClassExt();
			entExt.setParam(":VCLASS_NAME_GRP", class_name_grp);
			entExt.setParam(":VCLASS_NAME", class_name);
			entExt.setParam(":VCLASS_ID_GRP", class_id_grp);
			entExt.setParam(":VCLASS_ID", entDao.getClass_id());
			entExt.setParam(":VCUST_ID", entDao.getCust_id());
			entExt.setParam(":VENTITY_TYPE", entDao.getEntity_type());
			entExt.setParam(":VENTITY_ID", id);
			log.LOG_INFO("====" + entExt.insBy("UPDATE_BY_OPP_RANK"));
			tradeQuery.executeBy(entExt.insBy("UPDATE_BY_OPP_RANK"));
		}
		return 0;
	}
	
	
	
	// 删除实体
	public void delEntClassInfo(Buffers inbuffer) {

		log.LOG_INFO("进入delEntClassInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("CUST_ID");
		String entity_id = inbuffer.getString("ENTITY_ID");
		EntClassDAO entDao = new EntClassDAO();
		try {
			entDao.setCust_id(cust_id);
			entDao.setEntity_id(entity_id);
			iResult = delEntClassInfo(entDao);
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出delEntClassInfo方法...");
	}
	
	
	public int delEntClassInfo(EntClassDAO entDao) throws SaasApplicationException {

		EntClassExt entExt = new EntClassExt();
		entExt.setParam(":VCUST_ID", entDao.getCust_id());
		entExt.setParam(":VENTITY_ID", entDao.getEntity_id());
		tradeQuery.executeBy(entExt.insBy("DEL_BY_ID"));
		return 0;
	}
	
	
	public void delOppByRank(Buffers inbuffer) {

		log.LOG_INFO("进入delOppByRank方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String class_id = inbuffer.getString("CLASS_ID");
		String entity_id = inbuffer.getString("USER_ID");
		EntClassDAO entDao = new EntClassDAO();
		try {
			log.LOG_INFO("--------" + cust_id + "==============" + class_id + "````````````````[" + entity_id + "]");
			entDao.setCust_id(cust_id);
			entDao.setClass_id(class_id);
			entDao.setEntity_id(entity_id);
			iResult = delOppByRank(entDao);
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出delOppByRank方法...");
	}
	
	
	public int delOppByRank(EntClassDAO entDao) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		String idx = entDao.getEntity_id();
		StringTokenizer st = new StringTokenizer(idx, "|");
		while (st.hasMoreTokens()) {
			String id = st.nextToken();
			EntClassExt entExt = new EntClassExt();
			entExt.setParam(":VCUST_ID", entDao.getCust_id());
			entExt.setParam(":VCLASS_ID", entDao.getClass_id());
			entExt.setParam(":VENTITY_ID", id);
			log.LOG_INFO("sql..." + id);
			tradeQuery.executeBy(entExt.insBy("DEL_OPP_BY_RANK"));
		}
		return 0;
	}
	
	
	
	// 取出客户实体列表
	public List getEntClassInfoList(String cust_id) throws SaasApplicationException {

		List entList = new ArrayList();
		try {
			EntClassExt entExt = new EntClassExt();
			entExt.setParam(":VCUST_ID", cust_id);
			entList = entExt.selByList("SEL_BY_CUST");
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		return entList;
	}
	
	
	
	// 取出单个实体
	public Map getEntClassInfoById(String id) throws SaasApplicationException {

		Map map = new HashMap();
		try {
			EntClassExt entExt = new EntClassExt();
			entExt.setParam(":VENTITY_ID", id);
			List entList = entExt.selByList("SEL_BY_ID");
			if (entList != null && entList.size() > 0) {
				map = (HashMap) entList.get(0);
			}
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		return map;
	}
	
	
	public ArrayList getClassGrp(String entity_id) {

		ArrayList list = new ArrayList();
		EntClassExt entExt = new EntClassExt();
		entExt.setParam(":VENTITY_ID", entity_id);
		list = entExt.selByList("SEL_BY_CLASSGRP");
		return list;
	}
	
	
	
	// ////////////////////////////////////////////////////////////
	// 获取上级组id和name
	// ///////////////////////////////////////////////////////////
	public Map getGroupClassById(String cust_id, String class_id, String entity_type) throws SaasApplicationException {

		Map map = new HashMap();
		map = new EntityClassInfo().getUpClassIdAndName(class_id, cust_id, entity_type);
		return map;
	}
	
	
	
	// 删除分类信息
	public void deleteEntityClass(Buffers inbuffer) {

		log.LOG_INFO("进入deleteEntityClass方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		try {
			String cust_id = inbuffer.getString("SESSION_CUST_ID");
			String entity_type = inbuffer.getString("GROUP_TYPE");
			String class_id = inbuffer.getString("CLASS_ID");
			String user_id = inbuffer.getString("USER_ID");
			iResult = deleteEntityClass(cust_id, entity_type, class_id, user_id);
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出deleteEntityClass方法...");
	}
	
	
	public int deleteEntityClass(String cust_id, String entity_type, String class_id, String user_id) throws SaasApplicationException {

		StringTokenizer st = new StringTokenizer(user_id, "|");
		while (st.hasMoreTokens()) {
			String entity_id = st.nextToken();
			EntClassExt groupExt = new EntClassExt();
			Map map = getUpClassIdWithName(cust_id, entity_id, entity_type);
			if (map != null && map.size() > 0) {
				String class_idx = "", class_id_grp = "", class_name_grp = "", class_namex = "", classID = "";
				if (map.get("id") != null) {
					class_idx = map.get("id").toString();
				}
				if (map.get("class_id_grp") != null) {
					class_id_grp = map.get("class_id_grp").toString();
				}
				if (map.get("class_name_grp") != null) {
					class_name_grp = map.get("class_name_grp").toString();
				}
				if (map.get("class_name") != null) {
					class_namex = map.get("class_name").toString();
				}
				if (map.get("class_id") != null) {
					classID = map.get("class_id").toString();
				}
				if (class_id == class_idx || class_id.equals(class_idx)) {
					groupExt.setParam(":VCLASS_ID", classID);
					groupExt.setParam(":VCUST_ID", cust_id);
					groupExt.setParam(":VCLASS_ID_GRP", class_id_grp);
					groupExt.setParam(":VCLASS_NAME_GRP", class_name_grp);
					groupExt.setParam(":VCLASS_NAME", class_namex);
					groupExt.setParam(":VENTITY_ID", entity_id);
					groupExt.setParam(":VENTITY_TYPE", entity_type);
					tradeQuery.executeBy(groupExt.insBy("UPDATE_BY_CLASS"));
				}
			}
		}
		return 0;
	}
	
	
	
	// 删除分类特殊处理
	public Map getUpClassIdWithName(String cust_id, String entity_id, String entity_type) throws SaasApplicationException {

		log.LOG_INFO("==删除分类特殊处理开始..........");
		Map map = new HashMap();
		Map obj_Map = getEntClassInfoById(entity_id);
		String class_id = "";
		if (obj_Map.get("class_id") != null) {
			class_id = obj_Map.get("class_id").toString();
		}
		Map classMap = new EntityClassInfo().getUpClassIdAndName(class_id, cust_id, entity_type);
		if (classMap != null && classMap.size() > 0) {
			Entry ent = (Entry) classMap.entrySet().iterator().next();
			String class_id_grp = String.valueOf(ent.getKey());
			String class_name_grp = String.valueOf(ent.getValue());
			String class_idx = "";
			String class_namex = "";
			int sub_idx = class_id_grp.lastIndexOf("|");
			if (sub_idx > -1) {
				class_id_grp = class_id_grp.substring(0, sub_idx);
			}
			sub_idx = class_id_grp.lastIndexOf("|");
			if (sub_idx > -1) {
				class_idx = class_id_grp.substring(sub_idx + 1, class_id_grp.length());
			}
			else {
				class_idx = class_id_grp;
			}
			sub_idx = class_name_grp.lastIndexOf("|");
			if (sub_idx > -1) {
				class_name_grp = class_name_grp.substring(0, sub_idx);
			}
			sub_idx = class_name_grp.lastIndexOf("|");
			if (sub_idx > -1) {
				class_namex = class_name_grp.substring(class_name_grp.lastIndexOf("|") + 1, class_name_grp.length());
			}
			else {
				class_namex = class_name_grp;
			}
			map.put("class_id_grp", class_id_grp);
			map.put("class_name_grp", class_name_grp);
			map.put("class_id", class_idx);
			map.put("id", class_id);
			map.put("class_name", class_namex);
		}
		log.LOG_INFO("==删除分类特殊处理完成...........");
		return map;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -