1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package com.chinacreator.videoalliance.query.action;
- import java.util.List;
- import javax.servlet.http.HttpServletRequest;
- import org.apache.commons.lang.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import com.chinacreator.common.exception.BusinessException;
- import com.chinacreator.common.pipe.DataOutPipe;
- import com.chinacreator.videoalliance.common.annotation.DataOut;
- import com.chinacreator.videoalliance.common.util.ConfigUtil;
- import com.chinacreator.videoalliance.query.bean.UserMsgInfo;
- import com.chinacreator.videoalliance.query.dao.UserMsgDao;
- @Controller
- public class UserMsgAction {
-
- @Autowired
- private UserMsgDao userMsgDao;
-
- @RequestMapping("/getUserMsg.do")
- @DataOut(callback = "getUserMsg")
- public DataOutPipe doOrder(HttpServletRequest request, UserMsgInfo userMsgInfo) throws Exception {
- DataOutPipe pipe = new DataOutPipe();
- if(userMsgInfo== null || StringUtils.isEmpty(userMsgInfo.getCpid()) || StringUtils.isEmpty(userMsgInfo.getSpid()) || StringUtils.isEmpty(userMsgInfo.getUserid()) || StringUtils.isEmpty(userMsgInfo.getActiveid()) ){
- throw new BusinessException("7002", "参数错误");
- }
- if(StringUtils.isEmpty(userMsgInfo.getType()) || userMsgInfo.getType().equals("0")){
- if(userMsgInfo!= null && StringUtils.isEmpty(userMsgInfo.getMsg1()) && StringUtils.isEmpty(userMsgInfo.getMsg2()) && StringUtils.isEmpty(userMsgInfo.getMsg3()) ){
- throw new BusinessException("7003", "缺少用户信息");
- }
- }
- try{
- userMsgInfo.setUserid(ConfigUtil.decrypt(userMsgInfo.getUserid(),userMsgInfo.getCpid()));
- if (userMsgInfo.getUserid().length() > 11) {
- userMsgInfo.setUserid(ConfigUtil.getUserid(userMsgInfo.getUserid(), userMsgInfo.getCpid()));
- }
- }catch(Exception e){
- throw new BusinessException("7002", "手机号码加密错误");
- }
- List<UserMsgInfo> list = userMsgDao.queryList(userMsgInfo.getUserid(), userMsgInfo.getCpid(), userMsgInfo.getSpid());
- if(list != null && list.size()>0){
- for (UserMsgInfo userMsgInfo2 : list) {
- if(userMsgInfo2.getActiveid().equals(userMsgInfo.getActiveid())){
- throw new BusinessException("9040", "用户已绑定信息");
- }else{
- throw new BusinessException("9041", "用户已参加过活动,不能重复参加");
- }
- }
- }
- if(StringUtils.isEmpty(userMsgInfo.getType()) || userMsgInfo.getType().equals("0")){
- userMsgDao.insert(userMsgInfo);
- }
- return pipe;
- }
-
- }
|