registruseraction.java

来自「移动彩信管理平台」· Java 代码 · 共 133 行

JAVA
133
字号
/**
 * 
 */
package com.my7g.zj.mobile.mms.web.action;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.my7g.zj.mobile.mms.bean.User;
import com.my7g.zj.mobile.mms.business.IUserService;
import com.my7g.zj.mobile.mms.mapping.TbMmsCpUser;
import com.opensymphony.xwork2.ActionSupport;
import org.acegisecurity.providers.encoding.Md5PasswordEncoder;

/**
 * 注册CP管理平台统一用户 内容提供商/运营商管理员/平台管理员/客服管理员 
 * @author liuhb
 */
public class RegistrUserAction extends ActionSupport {
	private Integer type = 0;
	private IUserService userService;
	private TbMmsCpUser tbMmsCpUser = new TbMmsCpUser();
	private Md5PasswordEncoder md5 = new Md5PasswordEncoder();
	private Map map = new HashMap();
	private int num=0;
	private int numCompany=0;
	// 管理平台统一用户登录名
	private String userPassport;
	// 登录密码
	private String userPassword;
	// 单位名称
	private String userCompany;
	// 用户类型
	private String userType;
	// 用户姓名
	private String username;
	// 运营商管理员 地区
	private String address="";
	//内容提供商所属栏目
	private String typeIndex="";
	private Short auditState;
	public String execute() {
		try {
			//createId
			tbMmsCpUser.setCreateId(Integer.valueOf(User.getUserInfo().getUserid()));
			tbMmsCpUser.setUserPassport(userPassport);
			tbMmsCpUser.setUserPassword(md5.encodePassword(userPassword, null));
			tbMmsCpUser.setUserGroup(Integer.valueOf(userType));
			tbMmsCpUser.setUserCompany(userCompany);
			tbMmsCpUser.setCreateTime(new Date());
			tbMmsCpUser.setIsUse(Short.valueOf("1"));
			tbMmsCpUser.setAuditState(Short.valueOf("1"));
			map.put("userType", userType);
			map.put("username", username);
			map.put("address",address);
			map.put("typeIndex", typeIndex);
			num = userService.checkName(userPassport);
			numCompany = userService.checkUserCompany(userCompany);
			if(num==0&&numCompany==0){
				userService.saveUser(tbMmsCpUser, map);
			}else {				
				return ERROR;
			}			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}

	public String getUserCompany() {
		return userCompany;
	}

	public void setUserCompany(String userCompany) {
		this.userCompany = userCompany;
	}

	public IUserService getUserService() {
		return userService;
	}

	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	public void setUserPassport(String userPassport) {		
		this.userPassport = userPassport;
	}

	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}

	public String getUserPassport() {
		return userPassport;
	}

	public String getUsername() {		
		return username;
	}

	public void setUsername(String username) {		
		this.username = username;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getTypeIndex() {
		return typeIndex;
	}

	public void setTypeIndex(String typeIndex) {
		this.typeIndex = typeIndex;
	}

	public String getAddress() {
		return address;
	}

	public Integer getType() {		
		return type;
	}

	
}

⌨️ 快捷键说明

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