addstorecmm.java

来自「电信的网厅的整站代码」· Java 代码 · 共 94 行

JAVA
94
字号
/**
 * 
 */
package com.doone.wskfmgr.business.netstore.cmm;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import com.doone.data.DacClient;
import com.doone.fj1w.common.entity.impl.TFNetStoreImpl;
import com.doone.fj1w.fj1w.account.SequencesFactory;
import com.doone.fj1w.fjmgr.order.CommonMethod;
import com.doone.wskfmgr.common.PageEnum;
import com.doone.wskfmgr.common.command.CommandDispatcher;
import com.doone.wskfmgr.common.command.CommandInterface;

/**
 * 添加商店。
 * @author Administrator
 *
 */
public class AddStoreCmm implements CommandInterface {

	/**
	 * 
	 */
	public AddStoreCmm() {
	}

	/* 
	 * 页面暂时不支持子父商店,业务将变得复杂,简单为妙,用户操作也舒服。
	 * String cityCode = WebAuth.getInstance(request).getCityCode();
	 * <%pageContext.setAttribute("UPSTORENAME", StoreDAO.getStoreParents(cityCode));%>
	 * 	<tr>
	 * 		<td class="InnerHead" style="text-align: right">&nbsp;&nbsp;所属商店:</td>
	 * 		<td class="InnerMain" >
	 * 			<custom:HtmlSelect name="UPSTORENAME" style="width: 100%" styleId="UPSTORENAME" 
	 * 			                      dataSource="UPSTORENAME" textFieldName="NAME" valueFieldName="STOREID" value="<%=String.valueOf(storeAttribute.getUpStoreId())%>">
	 * 			        <custom:HtmlOption value="0">无</custom:HtmlOption>
	 * 			</custom:HtmlSelect>
	 * 		</td>
	 * 	</tr>
	 * 
	 * (non-Javadoc)
	 * @see com.doone.wskfmgr.common.command.CommandInterface#execute(com.doone.wskfmgr.common.command.CommandDispatcher)
	 */
	public String execute(CommandDispatcher dispatcher) throws Exception {
		HttpServletRequest request = dispatcher.getRequest();
		try {
			String storeName = CommonMethod.formatResult(request.getParameter("STORENAME"));
			if(storeName.equals(""))throw new RuntimeException("商店名称不能为空");
			String description = CommonMethod.formatResult(request.getParameter("STOREDESC"));
			if(description.equals(""))throw new RuntimeException("商店描述不能为空");
			String cityCode = CommonMethod.formatResult(request.getParameter("CITYCODE"));
			if(cityCode.equals(""))throw new RuntimeException("地市编码不能为空");
			
			long upStoreName = 0L;
			long type = Long.valueOf(request.getParameter("STORETYPE")).longValue();
			long contentId   = Long.valueOf(request.getParameter("CONTENTID")).longValue();
			int  credit      = Integer.valueOf(request.getParameter("CREDIT")).intValue();

			SequencesFactory factory = SequencesFactory.getInstance();
			long storeId = factory.getOthersSeq("seq_storeid");
			
			TFNetStoreImpl impl = new TFNetStoreImpl(new DacClient());
			impl.setStoreId(storeId);
			impl.setUpStoreId(upStoreName);
			impl.setName(storeName);
			impl.setDescription(description);
			impl.setType(type);
			impl.setCredit(credit);
			impl.setCreateTime(new Date());
			impl.setState("E");
			impl.setCityCode(cityCode);
			impl.setContentId(contentId);
			impl.newObject();
			
			request.getSession().setAttribute(PageEnum.RESPONSE_PAGE_MSG, PageEnum.RESPONSE_SUCCESS_MSG);
		} catch (Exception e) {
			request.getSession().setAttribute(PageEnum.RESPONSE_PAGE_MSG, PageEnum.RESPONSE_FAILURE_MSG+e.getMessage());
		} 
		return PageEnum.ATTENTION_MSG_PATH;
	}

	/* (non-Javadoc)
	 * @see com.doone.wskfmgr.common.command.CommandInterface#getName()
	 */
	public String getName() {
		return "AddStore";
	}

}

⌨️ 快捷键说明

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