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

📄 groupinfo.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		Custinfo cust = new Custinfo();
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VOWN_ID", own_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		ArrayList list = groupExt.selByList("SEL_USER_BY_CLASS");
		ArrayList user_List = new RelationUUInfo().getContactList(own_id, "1");
		List<String> group_List = new ArrayList<String>();
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				HashMap groupMap = (HashMap) list.get(i);
				String cust_idx = groupMap.get("user_id").toString();
				group_List.add(cust_idx);
			}
		}
		
		if (group_List != null && group_List.size() > 0) {
			if (user_List != null && user_List.size() > 0) {
				for (int i = 0; i < user_List.size(); i++) {
					HashMap cust_map = (HashMap) user_List.get(i);
					String obj_cust_id = cust_map.get("user_id").toString();
					String obj_cust_name = cust.getCustNameById(cust_map.get("cust_id").toString());
					if (!group_List.contains(obj_cust_id)) {
						map.put(obj_cust_id, obj_cust_name);
					}
				}
			}
		}
		else {
			if (user_List != null && user_List.size() > 0) {
				for (int i = 0; i < user_List.size(); i++) {
					HashMap user_map = (HashMap) user_List.get(i);
					String obj_cust_id = user_map.get("user_id").toString();
					String obj_cust_name = cust.getCustNameById(user_map.get("cust_id").toString());
					map.put(obj_cust_id, obj_cust_name);
				}
			}
		}
		return map;
	}
	
	
	
	// 取出分类下的成员[客户分类|联系人分类]group_type 0客户 1联系人
	public String getJsonDataByType(String cust_id, String class_id, String group_type) throws SaasApplicationException {

		String jsonData = "";
		StringBuffer buf = new StringBuffer();
		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_JSON");
		log.LOG_INFO("===" + list);
		buf.append("{'data':[");
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				HashMap map = (HashMap) list.get(i);
				String obj_cust_id = "", cust_name = "", phone = "";
				if (map.get("cust_id") != null) {
					obj_cust_id = map.get("cust_id").toString();
				}
				if (map.get("cust_name") != null) {
					cust_name = map.get("cust_name").toString();
				}
				if (map.get("group_contact_phone") != null) {
					phone = map.get("group_contact_phone").toString();
				}
				buf.append("{" + "'id':'" + obj_cust_id + "','name':'" + cust_name + "','tel':'" + phone + "'},");
			}
		}
		buf.append("{}]}");
		jsonData = buf.toString();
		log.LOG_INFO(jsonData);
		return jsonData;
	}
	
	
	
	// 取出分类信息(已存在的客户)
	public ArrayList getGroupString(String cust_id, String class_id, String group_type) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_JOIN");
		return list;
	}
	
	
	
	// 取出分类信息(不存在的客户)
	public ArrayList getGroupForJoin(String cust_id, String class_id, String group_type) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_NO_JOIN");
		return list;
	}
	
	
	public ArrayList getGroupCusString(String index, String cust_id, String class_id, String group_type) throws SaasApplicationException {

		int iStart = Integer.parseInt(index);
		try {
			if (iStart == 0) {
				iStart = 0;
			}
			else {
				iStart = (iStart - 1) * 20;
			}
		}
		catch (Exception e) {
		}
		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_JOIN", iStart, 20);
		return list;
	}
	
	
	
	public int getGroupCusString(String cust_id, String class_id, String group_type) throws SaasApplicationException {
		int count = 0;
		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_JOIN");
		if(list != null && list.size()>0){
			count = list.size();
		}
		return count;
	}
	
	
	public ArrayList getPageByType(String cust_id, String class_id, String group_type, String index) throws SaasApplicationException {

		int iStart = Integer.parseInt(index);
		try {
			if (iStart == 0) {
				iStart = 0;
			}
			else {
				iStart = (iStart - 1) * 20;
			}
		}
		catch (Exception e) {
		}
		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_JOIN", iStart, 20);
		return list;
	}
	
	public int getPageGroupString(String cust_id, String class_id, String group_type) throws SaasApplicationException {

		int size = 0;
		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_JSON_TYPE");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			size = Integer.parseInt(map.get("ct").toString());
			return size;
		}
		else {
			return size;
		}
	}
	
	
	
	// 取出分类信息(已存在联系人)
	public ArrayList getGroupByContact(String cust_id, String user_id, String class_id, String group_type, String relation_code) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VUSER_ID", user_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VRELATION_TYPE_CODE", relation_code);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		list = groupExt.selByList("SEL_BY_CONTACT");
		return list;
	}
	
	
	
	// 取出分类信息(不存在的联系人)
	public ArrayList getContactForJoin(String cust_id, String user_id, String class_id, String group_type, String relation_code) throws SaasApplicationException {

		// 找出不存在的联系人的CustId
		ArrayList list = new ArrayList();
		GroupInfoExt groupExt = new GroupInfoExt();
		groupExt.setParam(":VCUST_ID", cust_id);
		groupExt.setParam(":VUSER_ID", user_id);
		groupExt.setParam(":VCLASS_ID", class_id);
		groupExt.setParam(":VRELATION_TYPE_CODE", relation_code);
		groupExt.setParam(":VGROUP_TYPE", group_type);
		ArrayList Custlist = groupExt.selByList("SEL_BY_JOIN_CNT");
		if (Custlist != null && Custlist.size() > 0) {
			for (int i = 0; i < Custlist.size(); i++) {
				HashMap map = (HashMap) Custlist.get(i);
				String custId = "";
				if (map.get("cust_id") != null) {
					custId = map.get("cust_id").toString();
					HashMap custMap = getCustomerInfo(custId);
					if (custMap != null && (!custMap.isEmpty())) {
						list.add(custMap);
					}
				}
			}
		}
		return list;
	}
	
	
	public HashMap getCustomerInfo(String cust_id) throws SaasApplicationException {

		HashMap map = new HashMap();
		CustomerExt custExt = new CustomerExt();
		custExt.setParam(":VCUST_ID", cust_id);
		ArrayList list = custExt.selByList("SEL_BY_GROUP_ID");
		if (list != null && list.size() > 0) {
			map = (HashMap) list.get(0);
		}
		return map;
	}
	
	
	
	// 删除组员
	public void deleteGroupByClass(Buffers inbuffer) {

		log.LOG_INFO("进入deleteGroupByClass方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		try {
			String cust_id = inbuffer.getString("SESSION_CUST_ID");
			String own_id = inbuffer.getString("SESSION_USER_ID");
			String group_type = inbuffer.getString("GROUP_TYPE");
			String class_id = inbuffer.getString("CLASS_ID");
			String user_id = inbuffer.getString("USER_ID");
			iResult = deleteGroupByClass(cust_id, own_id, group_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("退出deleteGroupByClass方法...");
	}
	
	
	public int deleteGroupByClass(String cust_id, String own_id, String group_type, String class_id, String user_ides) throws SaasApplicationException {

		StringTokenizer st = new StringTokenizer(user_ides, "|");
		while (st.hasMoreTokens()) {
			String user_id = st.nextToken();
			GroupInfoExt groupExt = new GroupInfoExt();
			groupExt.setParam(":VCLASS_ID", class_id);
			groupExt.setParam(":VCUST_ID", cust_id);
			groupExt.setParam(":VOWN_ID", own_id);
			groupExt.setParam(":VUSER_ID", user_id);
			groupExt.setParam(":VGROUP_TYPE", group_type);
			tradeQuery.executeBy(groupExt.insBy("DEL_BY_ALL"));
		}
		return 0;
	}
}

⌨️ 快捷键说明

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