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

📄 warnparainfo.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			iStart = iStart  * 20;
		
		ArrayList list = new ArrayList();
		WarnparamExt warnExt = new WarnparamExt();
		warnExt.setParam(":VUSER_ID", user_id);
		warnExt.setParam(":VWARN_TYPE", warn_type);
		log.LOG_INFO("=="+warnExt.insBy("SEL_BY_WARN_TYPE"));
		list = warnExt.selByList("SEL_BY_WARN_TYPE", iStart, 20);
		return list;
	}
	
	
	
	/**
	 * @param user_id
	 * @param warn_type
	 * @return 用户告警参数统计
	 * @throws SaasApplicationException
	 */
	public int getParamCountByType(String user_id, String warn_type) throws SaasApplicationException {

		int size = 0;
		ArrayList list = new ArrayList();
		WarnparamExt warnExt = new WarnparamExt();
		warnExt.setParam(":VUSER_ID", user_id);
		warnExt.setParam(":VWARN_TYPE", warn_type);
		log.LOG_INFO("count=="+warnExt.insBy("SEL_COUNT_WARN_TYPE"));
		list = warnExt.selByList("SEL_COUNT_WARN_TYPE");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			size = Integer.parseInt(map.get("ct").toString());
		}
		return size;
	}
	
	
	
	/**
	 * @param cust_id
	 * @param user_id
	 * @return是否存在预警信息
	 * @throws SaasApplicationException
	 */
	public boolean checkUserWarninfo(String cust_id, String user_id) throws SaasApplicationException {

		boolean result = false;
		WarnparamExt warnExt = new WarnparamExt();
		warnExt.setParam(":VCUST_ID", cust_id);
		warnExt.setParam(":VUSER_ID", user_id);
		ArrayList list = warnExt.selByList("SEL_BY_CHECK_WARN");
		if (list != null && list.size() > 0) {
			result = true;
		}
		return result;
	}
	
	
	
	/**
	 * @param cust_id
	 * @param user_id
	 * @param warn_type:0:email、1:底部通知、2:手工查询
	 * @return
	 * @throws SaasApplicationException
	 */
	public ArrayList getUserWarnList(String cust_id, String user_id, String warn_type) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		WarnparamExt warnExt = new WarnparamExt();
		warnExt.setParam(":VCUST_ID", cust_id);
		warnExt.setParam(":VUSER_ID", user_id);
		warnExt.setParam(":VWARN_TYPE", warn_type);
		list = warnExt.selByList("SEL_WARN_BY_TYPE");
		return list;
	}
	
	
	
	/**
	 * @param cust_id
	 * @param user_id
	 * @return用户告警信息处理
	 * @throws SaasApplicationException
	 */
	public ArrayList excUserWarninfo(String cust_id, String user_id) throws SaasApplicationException {

		wareHouseInfo house = new wareHouseInfo();
		WareHousePosInfo position = new WareHousePosInfo();
		GoodsInfo goods = new GoodsInfo();
		SendMailInfo mail = new SendMailInfo();
		ParamethodMgr param = new ParamethodMgr();
		WarnparamExt warnExt = new WarnparamExt();
		warnExt.setParam(":VCUST_ID", cust_id);
		warnExt.setParam(":VUSER_ID", user_id);
		ArrayList list = warnExt.selByList("SEL_BY_CHECK_WARN");
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				HashMap map = (HashMap) list.get(i);
				String exec_date = "", start_date = "", param_name = "", end_date = "", mod_type = "", warn_type = "", rsrv_str1 = "", quo_id = "", param_value = "", post = "", sum_type = "", warn_circle = "", param_type = "";
				// 告警时间
				if (map.get("exec_date") != null) {
					exec_date = map.get("exec_date").toString();
				}
				if (map.get("start_date") != null) {
					start_date = map.get("start_date").toString();
					start_date = start_date.substring(0, 10);
				}
				if (map.get("end_date") != null) {
					end_date = map.get("end_date").toString();
					end_date = end_date.substring(0, 10);
				}
				if (map.get("param_name") != null) {
					param_name = map.get("param_name").toString();
				}
				// 0:销售库存量告警、1:采购库存量告警等
				if (map.get("mod_type") != null) {
					mod_type = map.get("mod_type").toString();
				}
				// 0:email、1:底部通知、2:手工查询
				if (map.get("warn_type") != null) {
					warn_type = map.get("warn_type").toString();
				}
				// sum_type:0:或、1:与
				if (map.get("sum_type") != null) {
					sum_type = map.get("sum_type").toString();
				}
				// param_type:
				if (map.get("param_type") != null) {
					param_type = map.get("param_type").toString();
				}
				// warn_circle:周期
				if (map.get("warn_circle") != null) {
					warn_circle = map.get("warn_circle").toString();
				}
				// param_value参数值
				if (map.get("param_value") != null) {
					param_value = map.get("param_value").toString();
				}
				// param_door告警线rsrv_str1
				int param_door = 0;
				if (map.get("param_door") != null) {
					param_door = Integer.parseInt(map.get("param_door").toString());
				}
				if (map.get("rsrv_str1") != null) {
					rsrv_str1 = map.get("rsrv_str1").toString();
				}
				if (param_type == "0" || param_type.equals("0")) {
					
				}
				else if (param_type == "1" || param_type.equals("1")) {
					
				}
				else if (param_type == "2" || param_type.equals("2")) {
					quo_id = param_value.substring(0, param_value.length() - 2);
					post = param_value.substring(param_value.length() - 1, param_value.length());
					if (post.equals("p") || post == "p") {
						// 仓位信息
						HashMap pos_Map = position.getAreaById(cust_id, quo_id);
						// 仓位名称
						String pos_name = "";
						if (pos_Map.get("pos_Map") != null) {
							pos_name = pos_Map.get("pos_Map").toString();
						}
						// 剩余库存量
						double capacity = 0, max_capacity = 0;
						try {
							if (pos_Map.get("capacity") != null) {
								capacity = Double.parseDouble(pos_Map.get("capacity").toString());
							}
							if (pos_Map.get("max_capacity") != null) {
								max_capacity = Double.parseDouble(pos_Map.get("max_capacity").toString());
							}
							double currentSize = max_capacity - capacity;
							int size = (int) currentSize;
							// 进行或运算
							if (sum_type == "0" || sum_type.equals("0")) {
								if (rsrv_str1 == "0" || rsrv_str1.equals("0")) {// 不大于
									if (size <= param_door) {
										String subject = param.getParamNameByValue("87", mod_type);
										String messageInfo = "尊敬的用户您好:\t\n请注意你的" + pos_name + "的容量!\n\t  XSaaS平台预警中心。";
										String toAddr = mail.getUserEmailById(cust_id, user_id);
										String fromAddr = "sales@xsaas.com";
										mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
									}
								}
								else if (rsrv_str1 == "1" || rsrv_str1.equals("1")) {// 不小于
									if (size >= param_door) {
										
										String subject = param.getParamNameByValue("87", mod_type);
										String messageInfo = "尊敬的用户您好,请注意你的" + pos_name + "的容量!\n\t  XSaaS平台预警中心。";
										String toAddr = mail.getUserEmailById(cust_id, user_id);
										String fromAddr = "sales@xsaas.com";
										mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
										
									}
								}
							}
						}
						catch (Exception e) {
							log.LOG_INFO("当前仓位库存量有误!");
						}
					}
					else {
						// 仓库信息
						ArrayList houseList = house.getOneWareHouse(cust_id, quo_id);
						if (houseList != null && houseList.size() > 0) {
							HashMap houseMap = (HashMap) houseList.get(0);
							// 剩余库存量
							double capacity = 0, max_capacity = 0;
							String house_name = "";
							try {
								if (houseMap.get("capacity") != null) {
									capacity = Double.parseDouble(houseMap.get("capacity").toString());
								}
								
								if (houseMap.get("max_capacity") != null) {
									max_capacity = Double.parseDouble(houseMap.get("max_capacity").toString());
								}
								double currentSize = max_capacity - capacity;
								int size = (int) currentSize;
								
								if (houseMap.get("house_name") != null) {
									house_name = houseMap.get("house_name").toString();
								}
								// 进行或运算
								if (sum_type == "0" || sum_type.equals("0")) {
									if (rsrv_str1 == "0" || rsrv_str1.equals("0")) {// 不大于
										if (size <= param_door) {
											String subject = param.getParamNameByValue("87", mod_type);
											String messageInfo = "尊敬的用户您好:\t\n请注意你的" + house_name + "的容量!\n\t  XSaaS平台预警中心。";
											String toAddr = mail.getUserEmailById(cust_id, user_id);
											String fromAddr = "sales@xsaas.com";
											mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
										}
									}
									else if (rsrv_str1 == "1" || rsrv_str1.equals("1")) {// 不小于
										if (size >= param_door) {
											String subject = param.getParamNameByValue("87", mod_type);
											String messageInfo = "尊敬的用户您好,请注意你的" + house_name + "的容量!\n\t  XSaaS平台预警中心。";
											String toAddr = mail.getUserEmailById(cust_id, user_id);
											String fromAddr = "sales@xsaas.com";
											mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
										}
									}
								}
							}
							catch (Exception e) {
								log.LOG_INFO("当前仓库库存量有误!");
							}
						}
					}
				}
				else if (param_type == "3" || param_type.equals("3")) {
					quo_id = param_value.substring(0, param_value.length() - 2);
					HashMap goodsMap = goods.getOneGoods(cust_id, quo_id);
					// 当前库存量
					int now_num = 0;
					String goods_name = "";
					if (goodsMap.get("goods_name") != null) {
						goods_name = goodsMap.get("goods_name").toString();
					}
					if (goodsMap.get("goodsMap") != null) {
						now_num = Integer.parseInt(goodsMap.get("goodsMap").toString());
					}
					// 或运算
					if (sum_type == "0" || sum_type.equals("0")) {
						if (rsrv_str1 == "0" || rsrv_str1.equals("0")) {// 不大于
							String subject = param.getParamNameByValue("87", mod_type);
							String messageInfo = "尊敬的用户您好,请注意你的" + goods_name + "的存储数量!\n\t  XSaaS平台预警中心。";
							String toAddr = mail.getUserEmailById(cust_id, user_id);
							String fromAddr = "sales@xsaas.com";
							mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
						}
						else {
							String subject = param.getParamNameByValue("87", mod_type);
							String messageInfo = "尊敬的用户您好,请注意你的" + goods_name + "的存储数量!\n\t  XSaaS平台预警中心。";
							String toAddr = mail.getUserEmailById(cust_id, user_id);
							String fromAddr = "sales@xsaas.com";
							mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
						}
					}
					else {// 与运算
						if (rsrv_str1 == "0" || rsrv_str1.equals("0")) {// 不大于
							if (now_num <= param_door) {
								String subject = param.getParamNameByValue("87", mod_type);
								String messageInfo = "尊敬的用户您好,请注意你的" + goods_name + "的容量!\n\t  XSaaS平台预警中心。";
								String toAddr = mail.getUserEmailById(cust_id, user_id);
								String fromAddr = "sales@xsaas.com";
								mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
							}
						}
						else {
							if (now_num >= param_door) {
								String subject = param.getParamNameByValue("87", mod_type);
								String messageInfo = "尊敬的用户您好,请注意你的" + goods_name + "的容量!\n\t  XSaaS平台预警中心。";
								String toAddr = mail.getUserEmailById(cust_id, user_id);
								String fromAddr = "sales@xsaas.com";
								mail.sendEmail(fromAddr, toAddr, subject, messageInfo);
							}
						}
					}
				}
			}
		}
		return list;
	}
}

⌨️ 快捷键说明

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