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

📄 relationccinfo.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		return relationList;
	}
	
	
	public int getAllOppByType(String cust_id, String rela_class) throws SaasApplicationException {

		int count = 0;
		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", rela_class);
		relationList = relaExt.selByList("SEL_ALLOPP_BY_TYPE");
		if (relationList != null && relationList.size() > 0) {
			count = relationList.size();
		}
		return count;
	}
	
	
	
	// 通过级别取出客户信息
	public ArrayList getCustomerByRelaClass(String cust_id, String rale_class) throws SaasApplicationException {

		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", rale_class);
		relationList = relaExt.selByList("SEL_BY_RELA_CLASS");
		return relationList;
	}
	
	//取出经销商
	public ArrayList getCoustomerById(String cust_id) throws SaasApplicationException {

		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relationList = relaExt.selByList("SEL_COU_BY_ID");
		return relationList;
	}
	
	//取出所有未加片区经销商
	public ArrayList getCoustomerByArea(String cust_id, String rsrv_str1) throws SaasApplicationException {

		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRSRV_STR1", rsrv_str1);
		relationList = relaExt.selByList("SEL_BY_AREA");
		return relationList;
	}
	
	// 点击片区取出该片区下的经销商
	public ArrayList getCoustomerInfoByArea(String cust_id, String rsrv_str1,String channels_id) throws SaasApplicationException {

		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRSRV_STR1", rsrv_str1);
		relaExt.setParam(":VCHANNELS_ID", channels_id);
		relationList = relaExt.selByList("SEL_BY_AREA_ID");
		return relationList;
	}
	
	
	
	// 修改已增加片区的经销商的rsrv_str1值 [0代表已加片区,NULL代表未加片区]
	public void updateCustomerRelationByArea(Buffers inbuffer) {

		log.LOG_INFO("进入updateCustomerRelation方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String obj_cust_id = inbuffer.getString("CHANNELS_ID_GRP");
		String rsrv_str1 = inbuffer.getString("RSRV_STR1");
		try {
			iResult = updateCustomerRelationByArea(cust_id, obj_cust_id, rsrv_str1);
		}
		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("退出updateCustomerRelation方法...");
	}
	
	
	public int updateCustomerRelationByArea(String cust_id, String obj_cust_id, String rsrv_str1) {

		StringTokenizer st = new StringTokenizer(obj_cust_id, "|");
		while (st.hasMoreTokens()) {
			String obj_cust = st.nextToken();
			RelationCcExt relaExt = new RelationCcExt();
			relaExt.setParam(":VCUST_ID", cust_id);
			relaExt.setParam(":VOBJ_CUST_ID", obj_cust);
			relaExt.setParam(":VRSRV_STR1", rsrv_str1);
			tradeQuery.executeBy(relaExt.insBy("UP_OR_DEL"));
		}
		return 0;
	}
	
	
	public ArrayList getCustomerByRelaUpClass(String cust_id, String rale_class) throws SaasApplicationException {

		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", rale_class);
		relationList = relaExt.selByList("SEL_BY_RELA_UP_CLASS");
		return relationList;
	}
	
	public ArrayList getCByRelaClass(String cust_id, String rale_class) throws SaasApplicationException {

		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", rale_class);
		relationList = relaExt.selByList("SEL_BY_UP_CLASS");
		return relationList;
	}
	
	
	public int getRelationByType(String cust_id, String rela_class) throws SaasApplicationException {

		int count = 0;
		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", rela_class);
		relationList = relaExt.selByList("SEL_BY_RELA_TYPE");
		if (relationList != null && relationList.size() > 0) {
			count = relationList.size();
		}
		return count;
	}
	
	
	
	// 查找客户类型分页统计
	public int getPageSizeByType(String rela_class, String cust_id) throws SaasApplicationException {

		int size = 0;
		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", rela_class);
		relationList = relaExt.selByList("SEL_BY_TYPE_CT");
		if (relationList != null && relationList.size() > 0) {
			HashMap map = (HashMap) relationList.get(0);
			size = Integer.parseInt(map.get("ct").toString());
		}
		return size;
	}
	
	
	public ArrayList getSelfdefinition(String cust_id) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		list = relaExt.selByList("SEL_BY_GROUP_TYPE");
		return list;
	}
	
	
	public ArrayList getRelationByCustNameLike(int iStart, String cust_id, String cust_name,String relation_type_code) throws SaasApplicationException {

		iStart = iStart  * 20;
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VCUST_NAME", "%" + cust_name.trim() + "%");
		relaExt.setParam(":VRELATION_TYPE_CODE", relation_type_code);
		ArrayList list = relaExt.selByList("SEL_BY_LIKE_CUST_NAME", iStart, 20);
		return list;
	}
	
	public int getRelationByCustNameLike(String cust_id, String cust_name,String relation_type_code) throws SaasApplicationException {
		int count = 0;
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VCUST_NAME", "%" + cust_name.trim() + "%");
		relaExt.setParam(":VRELATION_TYPE_CODE", relation_type_code);
		ArrayList list = relaExt.selByList("SEL_BY_LIKE_CUST_NAME");
		if(list!=null && list.size()>0){
			count = list.size();
		}
		return count;
	}
	
	public ArrayList getDealerByCustNameLike(int iStart, String cust_id, String cust_name) throws SaasApplicationException {

		if (iStart == 0) {
			iStart = 0;
		}
		else {
			iStart = (iStart - 1) * 20;
		}
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VCUST_NAME", "%" + cust_name + "%");
		ArrayList list = relaExt.selByList("SEL_LIKE_CUST_NAME", iStart, 20);
		return list;
	}
	
	public int getDealerByCustNameLike(String cust_id, String cust_name) throws SaasApplicationException {

		int count = 0;
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VCUST_NAME", "%" + cust_name + "%");
		ArrayList list = relaExt.selByList("SEL_LIKE_CUST_NAME");
		if (list != null && list.size() > 0) {
			count = list.size();
		}
		return count;
	}
	
	public ArrayList getRelaByNameLike(int iStart, String cust_id, String cust_name) throws SaasApplicationException {

		if (iStart == 0) {
			iStart = 0;
		}
		else {
			iStart = (iStart - 1) * 20;
		}
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VCUST_NAME", "%" + cust_name + "%");
		ArrayList list = relaExt.selByList("SEL_LIKE_CUST_NAME", iStart, 20);
		return list;
	}
	
	public int getRelaByNameLike(String cust_id, String cust_name) throws SaasApplicationException {

		int count = 0;
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VCUST_NAME", "%" + cust_name + "%");
		ArrayList list = relaExt.selByList("SEL_LIKE_CUST_NAME");
		if (list != null && list.size() > 0) {
			count = list.size();
		}
		return count;
	}
	
	
	// 对竞争对手进行级别调整--lill2
	public void updateEntClassRankOpp(Buffers inbuffer) {

		log.LOG_INFO("进入updateEntClassRankOpp方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String obj_cust_id = inbuffer.getString("USER_ID");
		String relation_type_code = "2";
		String rela_class = inbuffer.getString("RELA_CLASS");
		RelationCcDAO relationCcDao = new RelationCcDAO();
		try {
			relationCcDao.setRela_class(rela_class);
			relationCcDao.setCust_id(cust_id);
			relationCcDao.setRelation_type_code(relation_type_code);
			relationCcDao.setObj_cust_id(obj_cust_id);
			iResult = updateEntClassRankOpp(relationCcDao);
		}
		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(RelationCcDAO relationCcDao) throws SaasApplicationException {

		String idx = relationCcDao.getObj_cust_id();
		StringTokenizer st = new StringTokenizer(idx, "|");
		while (st.hasMoreTokens()) {
			String id = st.nextToken();
			RelationCcExt relaExt = new RelationCcExt();
			relaExt.setParam(":VCUST_ID", relationCcDao.getCust_id());
			relaExt.setParam(":VOBJ_CUST_ID", id);
			relaExt.setParam(":VRELATION_TYPE_CODE", relationCcDao.getRelation_type_code());
			relaExt.setParam(":VRELA_CLASS", relationCcDao.getRela_class());
			tradeQuery.executeBy(relaExt.insBy("UPDATE_BY_OPP_RANK"));
		}
		return 0;
	}
	
	
	
	// 取出关系客户数量
	public int getPateSizeByType(String cust_id, String type) throws SaasApplicationException {

		int size = 0;
		ArrayList relationList = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", type);
		relationList = relaExt.selByList("SEL_BY_TYPE_SIZE");
		if (relationList != null && relationList.size() > 0) {
			HashMap map = (HashMap) relationList.get(0);
			size = Integer.parseInt(map.get("ct").toString());
		}
		return size;
	}
	
	
	public String getConcatByJson(int iStart, String cust_id, String type) throws SaasApplicationException {

		String json = "";
		int size = getPateSizeByType(cust_id, type);
		JSONArray array = new JSONArray();
		ArrayList list = new ArrayList();
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID", cust_id);
		relaExt.setParam(":VRELA_CLASS", type);
		list = relaExt.selByList("SEL_ALLOPP_BY_TYPE", iStart, 10);
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				JSONObject obj = new JSONObject();
				HashMap map = (HashMap) list.get(i);
				String id = map.get("obj_cust_id").toString();
				String name = "";
				String email = "";
				String phone = "";
				String date = "";
				if (map.get("cust_name") != null) {
					name = map.get("cust_name").toString();
				}
				if (map.get("group_contact_phone") != null) {
					phone = map.get("group_contact_phone").toString();
				}
				if (map.get("email") != null) {
					email = map.get("email").toString();
				}
				if (map.get("start_date") != null) {
					date = map.get("start_date").toString();
					if (date.length() > 10) {
						date = date.substring(0, 10);
					}
				}
				obj.put("id", id);
				obj.put("name", name);
				obj.put("email", email);
				obj.put("phone", phone);
				obj.put("date", date);
				array.add(obj);
			}
		}
		JSONObject root = new JSONObject();
		root.put("root", array);
		root.put("totalCount", size);
		json = root.toString();
		return json;
	}
	
	public ArrayList getCustomerByRelaClassAgain(int iStart,String cust_id,String rela_class,String relation_type_code) throws SaasApplicationException {
		iStart = iStart* 20;
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID",cust_id);
		relaExt.setParam(":VRELA_CLASS",rela_class);
		relaExt.setParam(":VRELATION_TYPE_CODE",relation_type_code);
		ArrayList list = relaExt.selByList("SEL_CUST_RELA_CLASS", iStart, 20);
		return list;
	}
	
	public int getCustomerByRelaClassAgain(String cust_id,String rela_class,String relation_type_code) throws SaasApplicationException {
		int count = 0;
		RelationCcExt relaExt = new RelationCcExt();
		relaExt.setParam(":VCUST_ID",cust_id);
		relaExt.setParam(":VRELA_CLASS",rela_class);
		relaExt.setParam(":VRELATION_TYPE_CODE",relation_type_code);
		ArrayList list = relaExt.selByList("SEL_CUST_RELA_CLASS");
		if(list!=null && list.size()>0){
			count = list.size();
		}
		return count;
	}
	
}

⌨️ 快捷键说明

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