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

📄 ordenaction.java

📁 简易的客服管理系统,采用easyJweb框架,实现简单的功能
💻 JAVA
字号:
package com.easycrm.asp.action;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

import com.easycrm.asp.business.ActiveUser;
import com.easycrm.asp.business.Customers;
import com.easycrm.asp.business.OrderInfo;
import com.easycrm.asp.business.Product;
import com.easyjf.util.CommUtil;
import com.easyjf.web.Module;
import com.easyjf.web.Page;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.DbPageList;
import com.easyjf.web.tools.IPageList;

public class OrdenAction extends BaseAction {

	public IPageList doQuery(WebForm form, int currentPage, int pageSize) {
		ActiveUser u = (ActiveUser) this.getCurrentUser(form);
		String scope = "belongDept=?";
		Collection paras = new ArrayList();
		paras.add(u.getDept());

		
		String orderType=CommUtil.null2String(form.get("orderType"));
		String orderField=CommUtil.null2String(form.get("orderField"));	
		
		
		String customersTitle=CommUtil.null2String(form.get("queryCustomersTitle"));
		String salePrice=CommUtil.null2String(form.get("querySalePrice"));
		String vdate1=CommUtil.null2String(form.get("queryVdate1"));
		String vdate2=CommUtil.null2String(form.get("queryVdate2"));
				
		if(!customersTitle.equals(""))
		{
			scope+=" and customersTitle=?";
			paras.add(customersTitle);
		}	
		
		if(!salePrice.equals("")){
			scope+=" and salePrice=?";
			paras.add(salePrice);
		}
		
		if(vdate2.equals("")&& !vdate1.equals(""))
		{
			scope+=" and vdate=?";
			paras.add(vdate1);
		}
		else if(!vdate1.equals(""))
		{
			scope+=" and vdate>=?";
			paras.add(vdate1);
		}
		if(!vdate2.equals(""))
		{
			scope+=" and vdate<?";
			paras.add(vdate2);
		}
		if(orderField.equals(""))
			{
			orderField="vdate";
			orderType="desc";				
			}		
		scope +=" order by "+orderField;
		if(!orderType.equals(""))scope+=" "+orderType;				
		
		DbPageList pList = new DbPageList(OrderInfo.class, scope, paras);
		pList.doList(currentPage, pageSize);
		return pList;
	}
	
	public Page doManage(WebForm form, Module module) {
		String cid=CommUtil.null2String(form.get("cid"));
		String sn=CommUtil.null2String(form.get("orderSn"));		
		OrderInfo order=null;
		if(!cid.equals(""))order=OrderInfo.read(cid);
		else if(!sn.equals(""))order=OrderInfo.readBySn(sn);		
		if(order!=null)
		{
			form.addResult("cid",order.getCid());
			form.addResult("totalAmount",order.getTotalAmount());
			
			form.addResult("payment",order.getPayment());
			form.addResult("delivery",order.getDelivery());
			if(order.getDeliveryDept()!=null && (!order.getDeliveryDept().equals("")))					
			form.addResult("deliveryDept",order.getDeliveryDept());
			form.addResult("vdate",order.getVdate());
			form.addResult("bdate",order.getBdate());
			form.addResult("sdate",order.getSdate());
			form.addResult("customers",Customers.readBySn(order.getCustomersSn()));	
			form.addResult("product",Product.readBySn(order.getProductSn()));
			form.addResult("orderSn",order.getSn());
			form.addResult("isFix",order.getIsFix());
			form.addResult("des",order.getDes());
			form.addResult("fit",order.getFit());			
			form.addResult("trit",order.getTrit());
			form.addResult("times",order.getTimes());
			
		}
		return module.findPage("manage");
	}
	
	

	public Object form2Obj(WebForm form) {
		String cid = CommUtil.null2String(form.get("cid"));
		OrderInfo obj = null;
		if (cid.equals("")) {
			obj = (OrderInfo) form.toPo(OrderInfo.class);
			obj.setInputTime(new Date());
			obj.setDelivery(new Integer(0));
			obj.setPayment(new Integer(0));
			obj.setTimes(new Integer(0));
			obj.setInputUser(this.getCurrentUser(form).getUserName());
			obj.setHandPerson(this.getCurrentUser(form).getUserName());
			obj.setSn(OrdenAction.madeSn());
			
		} else {
			obj = OrderInfo.read(cid);
			form.toPo(obj);
		}
		if (obj != null)
			obj.setBelongDept(((ActiveUser) this.getCurrentUser(form))
					.getDept());
			
		return obj;
	}
	private static String madeSn(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		String s=sdf.format(new Date());
		System.out.println(s);
		String a=s.substring(0,4);
		String b=s.substring(5,7);
		String c=s.substring(8,10);
		String e=s.substring(11,13);
		String f=s.substring(14,16);
		String g=s.substring(17,19);
		String sn = a+b+c+e+f+g;
		System.out.println(sn);
		return sn;
	}

}

⌨️ 快捷键说明

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