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

📄 sw4102form.java

📁 一个完整的物流系统
💻 JAVA
字号:

package jp.com.cost.sw.web.form;

import javax.servlet.http.HttpServletRequest;

import jp.com.cost.common.DataCheckor;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;


/*******************************************************************************
 * 
 * SW4102Form.java
 * 	
 * [ 录属于: 商务稽核页面 SW4102 ] - 对准备保存的值进行了最大限度的检测
 * @version v1.0
 * @author Angie.K
 * @struts.form name="SW4201Form"
 * @extends org.apache.struts.action.ActionForm
 * @PS: 由于涉及到对2个表(BOOK&LOG)的操作。
 *          为了清晰的作业 添加了较多的注释。
 *          [显] 用来表示页面显示的数据来自什么表
 *          [存] 就代表了这个数据而后会存到什么表
 *
 ***************************************************************************** */

public class SW4102Form extends ActionForm {
	
	/** 序列化ID serialVersionUID = -2072995911847442391L  */
	private static final long serialVersionUID = -2072995911847442391L;
	
	/** Book表业务id */
	private Integer id;       			//Book表业务id			[显] 对应数据表BOOK.id						[存] 对应数据库表 LOG.wtId
	
	/** 发货人 */
	private String sendPeron; 			// 发货人					[显] 对应数据表BOOK.sendPeron				[存] 对应数据库表 LOG.conSigner
	
	/** 船代公司 */
	private String shipCName;			// 船代公司				[显] 对应数据表BOOK.shipCName  			[存] 对应数据库表 LOG.shipCo
	
	/** 货运量 */
	private Double weight;				// 货运量					[显] 对应数据表BOOK.weight  				[存] 对应数据库表 LOG.quantity
	
	/** 应收费用 */
	private Double dealCost;			// 应收费用				[显] 对应数据表BOOK.dealCost  				[存] 对应数据库表 LOG.accountMoney
	
	/** 应付费用 */
	private Double payRate;				// 应付费用				[显] 对应数据表BOOK.payRate  				[存] 对应数据库表 LOG.dealMoney
	
	/** 利润 */
	private Double gain;				// 利润					[显] BOOK.dealCost - BOOK.payRate		[存] 对应数据库表 LOG.gain
	
	/** 稽核结果 */
	private String state;				// 稽核结果				[显] N/A  								[存] 对应数据库表 LOG.state
	
	/** 备注 */
	private String remark;				// 备注					[显] N/A  								[存] 对应数据库表 LOG.remark
	
	/** 操作人 */
	private String operater;			// 操作人					[显] 来自Session  						[存] 对应数据库表 LOG.operAter
	
	/** 操作时间 */
	private String updateTime;			// 操作时间				[显] 来自系统 							[存] 对应数据库表 LOG.updateTime
	
	
	/**
	 * Method validate
	 *
	 * @param mapping 
	 * @param request 
	 * @return ActionErrors 牵涉变量: Id, State, Remark 
	 */
	
	//TODO 这上面的注释写什么 mapping 和 request?
	public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		// 稽核状态 选择情况检测 为避免因OS语言环境带来的问题下面进行了转换
		// [ \u8bf7\u9009\u62e9...] 为汉字 [请选择...] 
		// [ \u7a3d\u6838\u5df2\u901a\u8fc7 ] 为汉字 [ 稽核已通过 ] 
		// [ \u7a3d\u6838\u672a\u901a\u8fc7 ] 为汉字 [ 稽核未通过 ] 
		//又如果 准备保存的业务状态 既不是 [ 稽核已通过 ]也不是 [ 稽核未通过 ]
		if(!("\u7a3d\u6838\u5df2\u901a\u8fc7".equals(this.state))){		
			if(!("\u7a3d\u6838\u672a\u901a\u8fc7".equals(this.state))){
				errors.add("remarkIsNull",new ActionMessage("errors.SW4102Form.Warning"));
				System.out.println("[警告]:SW4102FormError - Type1 目标终端+getUserInfo()+尝试提错误的业务状态 业务终止!  位于: "+ this.toString());
				// TODO 这里补上记入系统日志的代码
			}
		}	
		// 备注 
		if (DataCheckor.isNull(this.remark)) {
			errors.add("remarkIsNull",new ActionMessage("errors.SW4102Form.Warning"));
			
			// TODO 这里补上记入系统日志的代码
		}
		String temp = "\u8bf7\u5728\u8fd9\u91cc\u586b\u5199\u5173\u4e8e\u8be5\u4e1a\u52a1\u7a3d\u6838\u4e0e\u5426\u7684\u7406\u7531...";
		// 在 [ 稽核状态 ] 值为 [ 稽核未通过 ] 的时候检查 [备注] 非空
		if("\u7a3d\u6838\u672a\u901a\u8fc7".equals(this.state)) {
			if(this.remark.trim().length()!=0 & temp.equals(this.state)) {
			System.out.println("[消息]:SW4102FormMsg - Type1 目标终端+getUserInfo()+尝试提交空的备注 已拒绝提交。 位于: "+ this.toString());
			errors.add("remarkIsNull",new ActionMessage("errors.SW4102Form.Warning"));
			}
		}
		
		if(this.state.length()>10 || this.state.length()< 500){
			System.out.println("[消息]: SW4102FormMsg - Type2 目标终端+getUserInfo()+尝试提长度不符合的备注 已拒绝提交。 位于: "+ this.toString());
		}
		return errors;
	}

	/**
	 * Method reset
	 * 
	 * @param mapping
	 * @param request
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {

	}
	
	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}
	/**
	 * @return the sendPeron
	 */
	public String getSendPeron() {
		return sendPeron;
	}
	/**
	 * @param sendPeron the sendPeron to set
	 */
	public void setSendPeron(String sendPeron) {
		this.sendPeron = sendPeron;
	}
	/**
	 * @return the shipCName
	 */
	public String getShipCName() {
		return shipCName;
	}
	/**
	 * @param shipCName the shipCName to set
	 */
	public void setShipCName(String shipCName) {
		this.shipCName = shipCName;
	}
	/**
	 * @return the weight
	 */
	public Double getWeight() {
		return weight;
	}
	/**
	 * @param weight the weight to set
	 */
	public void setWeight(Double weight) {
		this.weight = weight;
	}
	/**
	 * @return the dealCost
	 */
	public Double getDealCost() {
		return dealCost;
	}
	/**
	 * @param dealCost the dealCost to set
	 */
	public void setDealCost(Double dealCost) {
		this.dealCost = dealCost;
	}
	/**
	 * @return the payRate
	 */
	public Double getPayRate() {
		return payRate;
	}
	/**
	 * @param payRate the payRate to set
	 */
	public void setPayRate(Double payRate) {
		this.payRate = payRate;
	}
	/**
	 * @return the gain
	 */
	public Double getGain() {
		return gain;
	}
	/**
	 * @param gain the gain to set
	 */
	public void setGain(Double gain) {
		this.gain = gain;
	}
	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}
	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}
	/**
	 * @return the remark
	 */
	public String getRemark() {
		return remark;
	}
	/**
	 * @param remark the remark to set
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}
	/**
	 * @return the operAter
	 */
	public String getOperater() {
		return operater;
	}
	/**
	 * @param operater the operAter to set
	 */
	public void setOperater(String operater) {
		this.operater = operater;
	}
	/**
	 * @return the updateTime
	 */
	public String getUpdateTime() {
		return updateTime;
	}
	/**
	 * @param updateTime the updateTime to set
	 */
	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}
}

⌨️ 快捷键说明

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