Commit 5b52dd30 by chongli

会服亲密度推荐功能

parent 2fdd3926
Showing with 991 additions and 29 deletions
package com.ctrip.fun.golf.api.market;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ctrip.fun.common.vo.market.EventGameBean;
import com.ctrip.fun.common.vo.market.EventGameQuery;
import com.ctrip.fun.golf.api.GenericController;
import com.ctrip.fun.golf.service.market.EventGameService;
/**
* @author thshi
* @version 2016年1月6日
*/
@Controller
@RequestMapping(value = "/eventGame")
public class EventGameController extends GenericController<EventGameService, EventGameBean, Integer, EventGameQuery> {
@Autowired
private EventGameService eventGameService = null;
@Override
public EventGameService getEntityService() {
return eventGameService;
}
public EventGameService getEventGameService() {
return eventGameService;
}
public void setEventGameService(EventGameService eventGameService) {
this.eventGameService = eventGameService;
}
}
package com.ctrip.fun.golf.api.market;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ctrip.fun.common.vo.market.EventGameGroupBean;
import com.ctrip.fun.common.vo.market.EventGameGroupQuery;
import com.ctrip.fun.golf.api.GenericController;
import com.ctrip.fun.golf.service.market.EventGameGroupService;
/**
* @author thshi
* @version 2016年1月6日
*/
@Controller
@RequestMapping(value = "/eventGameGroup")
public class EventGameGroupController extends GenericController<EventGameGroupService, EventGameGroupBean, Integer, EventGameGroupQuery> {
@Autowired
private EventGameGroupService eventGameGroupService = null;
@Override
public EventGameGroupService getEntityService() {
return eventGameGroupService;
}
public EventGameGroupService getEventGameGroupService() {
return eventGameGroupService;
}
public void setEventGameGroupService(EventGameGroupService eventGameGroupService) {
this.eventGameGroupService = eventGameGroupService;
}
}
package com.ctrip.fun.golf.api.market;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ctrip.fun.common.vo.PagedResponseBean;
import com.ctrip.fun.common.vo.Request;
import com.ctrip.fun.common.vo.Response;
import com.ctrip.fun.common.vo.ResponseStatusEnum;
import com.ctrip.fun.common.vo.market.EventGamePlayerBean;
import com.ctrip.fun.common.vo.market.EventGamePlayerQuery;
import com.ctrip.fun.golf.api.GenericController;
import com.ctrip.fun.golf.service.market.EventGamePlayerService;
/**
* @author thshi
* @version 2016年1月6日
*/
@Controller
@RequestMapping(value = "/eventGamePlayer")
public class EventGamePlayerController extends GenericController<EventGamePlayerService, EventGamePlayerBean, Integer, EventGamePlayerQuery> {
@Autowired
private EventGamePlayerService eventGamePlayerService = null;
@Override
public EventGamePlayerService getEntityService() {
return eventGamePlayerService;
}
public EventGamePlayerService getEventGamePlayerService() {
return eventGamePlayerService;
}
public void setEventGamePlayerService(
EventGamePlayerService eventGamePlayerService) {
this.eventGamePlayerService = eventGamePlayerService;
}
@ResponseBody
@RequestMapping(value = "/playerInfoList", method = RequestMethod.POST)
public Response<PagedResponseBean<EventGamePlayerBean>> playerInfoList(@RequestBody Request<EventGamePlayerQuery> request) {
PagedResponseBean<EventGamePlayerBean> temp= eventGamePlayerService.playerInfoList(request);
Response<PagedResponseBean<EventGamePlayerBean>> response = new Response<PagedResponseBean<EventGamePlayerBean>>();
response.setStatus(ResponseStatusEnum.SUCCESS.getValue());
response.setMessage(ResponseStatusEnum.SUCCESS.getMsg());
response.setBody(temp);
return response;
}
@ResponseBody
@RequestMapping(value = "/recommendPlayer", method = RequestMethod.POST)
public Response<PagedResponseBean<EventGamePlayerBean>> recommendPlayer(@RequestBody Request<String> request) {
PagedResponseBean<EventGamePlayerBean> temp= eventGamePlayerService.recommendPlayer(request);
Response<PagedResponseBean<EventGamePlayerBean>> response = new Response<PagedResponseBean<EventGamePlayerBean>>();
response.setStatus(ResponseStatusEnum.SUCCESS.getValue());
response.setMessage(ResponseStatusEnum.SUCCESS.getMsg());
response.setBody(temp);
return response;
}
}
......@@ -159,6 +159,29 @@ public class EventCustomerInfoController extends
response.setBody(result);
return response;
}
@ResponseBody
@RequestMapping(value = "/getEventCustomerInfoByName", method = RequestMethod.POST)
public Response<List<EventCustomerInfoBean>> getEventCustomerInfoByName(
@RequestBody Request<EventCustomerInfoQuery> request) {
EventCustomerInfoQuery eventCustomerInfoQuery = request.getBody();
Response<List<EventCustomerInfoBean>> response = new Response<List<EventCustomerInfoBean>>();
List<EventCustomerInfoBean> result = new ArrayList<EventCustomerInfoBean>();
try {
result = eventCustomerInfoService
.getEventCustomerInfoByName(eventCustomerInfoQuery);
} catch (EventActivityException e) {
response.setStatus(e.getCode());
response.setMessage(e.getMessage());
response.setBody(result);
return response;
}
response.setStatus(ResponseStatusEnum.SUCCESS.getValue());
response.setMessage(ResponseStatusEnum.SUCCESS.getMsg());
response.setBody(result);
return response;
}
@ResponseBody
@RequestMapping(value = "/eventOrderHistoryList", method = RequestMethod.POST)
......
......@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ctrip.fun.common.vo.PagedResponseBean;
import com.ctrip.fun.common.vo.Request;
import com.ctrip.fun.common.vo.Response;
import com.ctrip.fun.common.vo.ResponseStatusEnum;
......@@ -121,5 +122,14 @@ public class UserExtController extends GenericController<UserExtService, UserExt
}
@ResponseBody
@RequestMapping(value = "/getUserExtByName", method = RequestMethod.POST)
public Response<PagedResponseBean<UserExtBean>> getUserExtByName(@RequestBody Request<UserExtQuery> request) {
Response<PagedResponseBean<UserExtBean>> response = new Response<PagedResponseBean<UserExtBean>>();
response.setStatus(ResponseStatusEnum.SUCCESS.getValue());
response.setMessage(ResponseStatusEnum.SUCCESS.getMsg());
PagedResponseBean<UserExtBean> pagedResponseBean = this.userExtService.getUserExtByName(request.getBody());
response.setBody(pagedResponseBean);
return response;
}
}
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package com.ctrip.fun.golf.dao.market;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import com.ctrip.fun.common.vo.SortDirectionEnum;
import com.ctrip.fun.common.vo.market.EventGameQuery;
import com.ctrip.fun.golf.dao.GenericHibernateDao;
import com.ctrip.fun.golf.domain.market.EventGame;
import com.ctrip.fun.golf.vo.PagedEntityBean;
/**
* @author zgsong
* @version 1.0.0
*/
public class EventGameDao extends GenericHibernateDao<EventGame, Integer> {
@SuppressWarnings("unchecked")
public PagedEntityBean<EventGame> queryList(Object query) {
EventGameQuery queryBean = (EventGameQuery) query;
Criteria criteria = this.getCriteria();
if (null != queryBean.getGameName() && !"".equals(queryBean.getGameName())) {
criteria.add(Restrictions.like("gameName", queryBean.getGameName(), MatchMode.ANYWHERE));
}
if (queryBean.getId()!=null && 0!= queryBean.getId()) {
criteria.add(Restrictions.eq("id", queryBean.getId()));
}
if (queryBean.getCourseId()!=null && 0!= queryBean.getCourseId()) {
criteria.add(Restrictions.eq("courseId", queryBean.getCourseId()));
}
if (null != queryBean.getPlayDateStart()) {
criteria.add(Restrictions.ge("playDate", queryBean.getPlayDateStart()));
}
if (null != queryBean.getPlayDateEnd()) {
criteria.add(Restrictions.le("playDate", queryBean.getPlayDateEnd()));
}
criteria.setFirstResult(queryBean.getPagerOffset());
criteria.setMaxResults(queryBean.getPagerPerPage());
if (queryBean.getSortDirection().equals(SortDirectionEnum.ASC)) {
criteria.addOrder(Order.asc(queryBean.getSortField()));
} else {
criteria.addOrder(Order.desc(queryBean.getSortField()));
}
List<EventGame> result = criteria.list();
criteria.setFirstResult(0);
Long count = (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
PagedEntityBean<EventGame> pagedEntityBean = new PagedEntityBean<EventGame>();
pagedEntityBean.setCount(count==null?0:count);
pagedEntityBean.setResult(result);
return pagedEntityBean;
}
}
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package com.ctrip.fun.golf.dao.market;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import com.ctrip.fun.common.vo.SortDirectionEnum;
import com.ctrip.fun.common.vo.market.EventGameGroupQuery;
import com.ctrip.fun.golf.dao.GenericHibernateDao;
import com.ctrip.fun.golf.domain.market.EventGameGroup;
import com.ctrip.fun.golf.vo.PagedEntityBean;
/**
* @author zgsong
* @version 1.0.0
*/
public class EventGameGroupDao extends GenericHibernateDao<EventGameGroup, Integer> {
@SuppressWarnings("unchecked")
public PagedEntityBean<EventGameGroup> queryList(Object query) {
EventGameGroupQuery queryBean = (EventGameGroupQuery) query;
Criteria criteria = this.getCriteria();
if (0 != queryBean.getId()) {
criteria.add(Restrictions.eq("id", queryBean.getId()));
}
if (0 != queryBean.getGameId()) {
criteria.add(Restrictions.eq("gameId", queryBean.getGameId()));
}
if (0 != queryBean.getGroupNum()) {
criteria.add(Restrictions.eq("groupNum", queryBean.getGroupNum()));
}
if (queryBean.getSortDirection().equals(SortDirectionEnum.ASC)) {
criteria.addOrder(Order.asc(queryBean.getSortField()));
} else {
criteria.addOrder(Order.desc(queryBean.getSortField()));
}
List<EventGameGroup> result = criteria.list();
criteria.setFirstResult(0);
Long count = (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
PagedEntityBean<EventGameGroup> pagedEntityBean = new PagedEntityBean<EventGameGroup>();
pagedEntityBean.setCount(count==null?0:count);
pagedEntityBean.setResult(result);
return pagedEntityBean;
}
}
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package com.ctrip.fun.golf.dao.market;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import com.ctrip.fun.common.core.util.BeanConverter;
import com.ctrip.fun.common.vo.PagedResponseBean;
import com.ctrip.fun.common.vo.SortDirectionEnum;
import com.ctrip.fun.common.vo.market.EventGamePlayerBean;
import com.ctrip.fun.common.vo.market.EventGamePlayerQuery;
import com.ctrip.fun.golf.dao.GenericHibernateDao;
import com.ctrip.fun.golf.domain.market.EventGamePlayer;
import com.ctrip.fun.golf.vo.PagedEntityBean;
/**
* @author zgsong
* @version 1.0.0
*/
public class EventGamePlayerDao extends GenericHibernateDao<EventGamePlayer, Integer> {
@SuppressWarnings("unchecked")
public PagedEntityBean<EventGamePlayer> queryList(Object query) {
EventGamePlayerQuery queryBean = (EventGamePlayerQuery) query;
Criteria criteria = this.getCriteria();
if (0 != queryBean.getId()) {
criteria.add(Restrictions.eq("id", queryBean.getId()));
}
if (0 != queryBean.getGroupId()) {
criteria.add(Restrictions.eq("groupId", queryBean.getGroupId()));
}
if (0 != queryBean.getGameId()) {
criteria.add(Restrictions.eq("gameId", queryBean.getGameId()));
}
if (0 != queryBean.getGroupNum()) {
criteria.add(Restrictions.eq("groupNum", queryBean.getGroupNum()));
}
if (null != queryBean.getPlayerName()&&!"".equals(queryBean.getPlayerName())) {
criteria.add(Restrictions.eq("playerName", queryBean.getPlayerName()));
}
criteria.setFirstResult(queryBean.getPagerOffset());
criteria.setMaxResults(queryBean.getPagerPerPage());
if (queryBean.getSortDirection().equals(SortDirectionEnum.ASC)) {
criteria.addOrder(Order.asc(queryBean.getSortField()));
} else {
criteria.addOrder(Order.desc(queryBean.getSortField()));
}
List<EventGamePlayer> result = criteria.list();
criteria.setFirstResult(0);
Long count = (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
PagedEntityBean<EventGamePlayer> pagedEntityBean = new PagedEntityBean<EventGamePlayer>();
pagedEntityBean.setCount(count==null?0:count);
pagedEntityBean.setResult(result);
return pagedEntityBean;
}
public PagedEntityBean<EventGamePlayer> playerInfoList(EventGamePlayerQuery query) {
StringBuffer sql = new StringBuffer("");
sql.append("SELECT friendName as playerName,friendPhone as mobilePhone,uid as uid from app_golffriend where friendName=:palyerName ");
sql.append("union all ");
sql.append("SELECT cName as playerName,mobileNo as mobilePhone,'' as uid from ord_customerinfo where CName =:palyerName ");
sql.append("union all ");
sql.append("SELECT NAME as playerName,phone as mobilePhone,uid as uid from app_golfplayer where NAME=:palyerName ");
Query qy = this.getSession().createSQLQuery(sql.toString());
qy.setParameter("palyerName", query.getPlayerName());
qy.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP);
List<Map<String, Object>> list = qy.list();
List<EventGamePlayer> result = new ArrayList<EventGamePlayer>();
if (list != null) {
for (Map<String, Object> map : list) {
EventGamePlayer eventGamePlayer = new EventGamePlayer();
BeanConverter.populate(eventGamePlayer, map);
result.add(eventGamePlayer);
}
}
PagedEntityBean<EventGamePlayer> pagedEntityBean = new PagedEntityBean<EventGamePlayer>();
pagedEntityBean.setResult(result);
return pagedEntityBean;
}
public PagedResponseBean<EventGamePlayerBean> recommendPlayer(String playerPhone) {
StringBuffer sql = new StringBuffer("SELECT playerName,mobilePhone,max(playDate) latestTime,count(*) times FROM event_game_player a LEFT JOIN event_game b ON a.gameId=b.id ");
sql.append("WHERE groupId IN (SELECT groupId FROM event_game_player WHERE mobilePhone = :palyerPhone) ");
sql.append("and mobilePhone <> :palyerPhone GROUP BY a.playerName,a.mobilePhone");
Query qy = this.getSession().createSQLQuery(sql.toString());
qy.setParameter("palyerPhone", playerPhone);
qy.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP);
List<Map<String, Object>> list = qy.list();
List<EventGamePlayerBean> result = new ArrayList<EventGamePlayerBean>();
if (list != null) {
for (Map<String, Object> map : list) {
EventGamePlayerBean eventGamePlayerBean = new EventGamePlayerBean();
eventGamePlayerBean.setPlayerName(map.get("playerName").toString());
eventGamePlayerBean.setMobilePhone(map.get("mobilePhone").toString());
eventGamePlayerBean.setTimes(Integer.parseInt(map.get("times").toString()) );
eventGamePlayerBean.setLatestTime((Date)map.get("latestTime"));
result.add(eventGamePlayerBean);
}
}
PagedResponseBean<EventGamePlayerBean> pagedResponseBean = new PagedResponseBean<EventGamePlayerBean>();
pagedResponseBean.setResult(result);
return pagedResponseBean;
}
}
......@@ -115,6 +115,24 @@ public class EventCustomerInfoDao extends GenericHibernateDao<EventCustomerInfo,
return eventCustomerInfos.get(0);
}
}
public List<EventCustomerInfoBean> getEventCustomerInfoByName(EventCustomerInfoQuery eventCustomerInfoQuery) {
List<EventCustomerInfoBean> list = new ArrayList<EventCustomerInfoBean>();
String hql = "from EventCustomerInfo where cName=:cName";
Query query = this.getSession().createQuery(hql);
query.setParameter("cName", eventCustomerInfoQuery.getcName());
List<EventCustomerInfo> eventCustomerInfos = query.list();
if(eventCustomerInfos!=null&&eventCustomerInfos.size()>0){
EventCustomerInfoBean bean = new EventCustomerInfoBean();
for(EventCustomerInfo eventCustomerInfo:eventCustomerInfos){
bean.setcName(eventCustomerInfo.getcName());
bean.setMobilePhone(eventCustomerInfo.getcName());
bean.setPriceDate(eventCustomerInfo.getPriceDate());
list.add(bean);
}
}
return list;
}
public EventCustomerInfo GetEventCustomerInfoResourceIdPriceDate(
EventCustomerInfoQuery eventCustomerInfoQuery) {
......
......@@ -35,6 +35,7 @@ import com.ctrip.fun.common.vo.basic.UserExtQuery;
import com.ctrip.fun.common.vo.basic.UserGradeAndVipGradeEnum;
import com.ctrip.fun.common.vo.basic.VipGradeEnum;
import com.ctrip.fun.common.vo.integral.IntegralReportBean;
import com.ctrip.fun.common.vo.order.EventCustomerInfoBean;
import com.ctrip.fun.common.vo.user.ImUserBean;
import com.ctrip.fun.common.vo.user.RecommendUserItemBean;
import com.ctrip.fun.common.vo.user.RecommendUserListQuery;
......@@ -1123,4 +1124,28 @@ public class UserExtDao extends GenericHibernateDao<UserExt, Integer> {
}
public PagedResponseBean<UserExtBean> getUserExtByName(UserExtQuery qu) {
Session session = this.getSession();
String queryByName = "SELECT username,umNickName,uid,mobilePhone,gender from bsc_userext where username=:playerName or umNickName=:playerName";
Query query = session.createSQLQuery(queryByName);
query.setParameter("playerName", qu.getName());
List<Map<String, Object>> list = query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list();
List<UserExtBean> result = new ArrayList<UserExtBean>();
if (list != null) {
for (Map<String, Object> map : list) {
UserExtBean userExtBean = new UserExtBean();
userExtBean.setUserName(map.get("username").toString());
userExtBean.setUmNickName(map.get("umNickName").toString());
userExtBean.setUid(map.get("uid").toString());
userExtBean.setMobilePhone(map.get("mobilePhone").toString());
userExtBean.setGender(map.get("gender").toString());
BeanConverter.populate(userExtBean, map);
result.add(userExtBean);
}
}
PagedResponseBean<UserExtBean> page = new PagedResponseBean<UserExtBean>();
page.setResult(result);
return page;
}
}
package com.ctrip.fun.golf.domain.market;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* 订场产品
* @author zgsong
*
*/
@Entity
@Table(name = "event_game")
public class EventGame implements java.io.Serializable{
/**
* serialVersionUID
*/
private static final long serialVersionUID = -8821033173307829967L;
private Integer id;// 赛事id
private Integer courseId;// 球场id
private String gameName;// 赛事名称
private Date playDate;//赛事日期
private String createUser;//创建人
private Date createTime;//创建日期
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "ID", unique = true)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "courseId")
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
@Column(name = "gameName", length = 128)
public String getGameName() {
return gameName;
}
public void setGameName(String gameName) {
this.gameName = gameName;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "playDate", length = 19)
public Date getPlayDate() {
return playDate;
}
public void setPlayDate(Date playDate) {
this.playDate = playDate;
}
@Column(name = "createUser", length = 128)
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "createTime", length = 29)
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ctrip.fun.golf.domain.market;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 订场产品
* @author zgsong
*
*/
@Entity
@Table(name = "event_game_group")
public class EventGameGroup implements java.io.Serializable{
/**
* serialVersionUID
*/
private static final long serialVersionUID = -8821033173307829967L;
private int id;// 赛事id
private int gameId;//所属赛事id
private int groupNum;//组序号
private int groupTime;//组时间
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "ID", unique = true)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name = "gameId")
public int getGameId() {
return gameId;
}
public void setGameId(int gameId) {
this.gameId = gameId;
}
@Column(name = "groupNum")
public int getGroupNum() {
return groupNum;
}
public void setGroupNum(int groupNum) {
this.groupNum = groupNum;
}
@Column(name = "groupTime")
public int getGroupTime() {
return groupTime;
}
public void setGroupTime(int groupTime) {
this.groupTime = groupTime;
}
}
package com.ctrip.fun.golf.domain.market;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 打球人信息
* @author zgsong
*
*/
@Entity
@Table(name = "event_game_player")
public class EventGamePlayer implements java.io.Serializable{
private static final long serialVersionUID = -8821033173307829967L;
private int id;// 打球人id
private int gameId;//所属赛事id
private Integer groupId;//所属组id
private Integer groupNum;//赛事中的组序号
private String playerName;//打球人姓名
private String mobilePhone;//手机号
private String sex;//性别
private Integer candicate;//差点
private String remark;//备注
private String uid;//用户uid
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "ID", unique = true)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name = "gameId")
public int getGameId() {
return gameId;
}
public void setGameId(int gameId) {
this.gameId = gameId;
}
@Column(name = "groupNum")
public Integer getGroupNum() {
return groupNum;
}
public void setGroupNum(Integer groupNum) {
this.groupNum = groupNum;
}
@Column(name = "groupId")
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
@Column(name = "playerName")
public String getPlayerName() {
return playerName;
}
public void setPlayerName(String playerName) {
this.playerName = playerName;
}
@Column(name = "mobilePhone")
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
@Column(name = "sex")
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
@Column(name = "candicate")
public Integer getCandicate() {
return candicate;
}
public void setCandicate(Integer candicate) {
this.candicate = candicate;
}
@Column(name = "remark")
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
}
......@@ -85,7 +85,7 @@ public abstract class GenericService<DAO extends GenericHibernateDao<T, ID>, T,
}
public <Q> PagedResponseBean<VO> queryList(Q queryBean) {
PagedResponseBean<VO> pagedResponseBean = new PagedResponseBean<VO>();
PagedResponseBean<VO> pagedResponseBean = new PagedResponseBean<VO>();
Collection<VO> result =new ArrayList<VO>();
PagedEntityBean<T> pagedEntityBean = this.getEntityDao().queryList(queryBean);
BeanConverter.copyProperties(pagedResponseBean, pagedEntityBean);
......
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package com.ctrip.fun.golf.service.market;
import com.ctrip.fun.common.vo.market.EventGameGroupBean;
import com.ctrip.fun.golf.dao.market.EventGameGroupDao;
import com.ctrip.fun.golf.domain.market.EventGameGroup;
import com.ctrip.fun.golf.service.GenericService;
/**
* @author zgsong
* @version 1.0.0
*/
public class EventGameGroupService extends GenericService<EventGameGroupDao, EventGameGroup, Integer, EventGameGroupBean>{
private EventGameGroupDao EventGameGroupDao = null;
/**
* @return
* @see com.ctrip.fun.golf.service.GenericService#getEntityDao()
*/
@Override
public EventGameGroupDao getEntityDao() {
return EventGameGroupDao;
}
public EventGameGroupDao getEventGameGroupDao() {
return EventGameGroupDao;
}
public void setEventGameGroupDao(EventGameGroupDao EventGameGroupDao) {
this.EventGameGroupDao = EventGameGroupDao;
}
}
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package com.ctrip.fun.golf.service.market;
import java.util.ArrayList;
import java.util.Collection;
import com.ctrip.fun.common.core.util.BeanConverter;
import com.ctrip.fun.common.vo.PagedResponseBean;
import com.ctrip.fun.common.vo.Request;
import com.ctrip.fun.common.vo.market.EventGamePlayerBean;
import com.ctrip.fun.common.vo.market.EventGamePlayerQuery;
import com.ctrip.fun.golf.dao.market.EventGamePlayerDao;
import com.ctrip.fun.golf.domain.market.EventGamePlayer;
import com.ctrip.fun.golf.exceptions.DaoException;
import com.ctrip.fun.golf.service.GenericService;
import com.ctrip.fun.golf.utils.GenericManager;
import com.ctrip.fun.golf.vo.PagedEntityBean;
/**
* @author zgsong
* @version 1.0.0
*/
public class EventGamePlayerService extends GenericService<EventGamePlayerDao, EventGamePlayer, Integer, EventGamePlayerBean> {
private EventGamePlayerDao eventGamePlayerDao = null;
/**
* @return
* @see com.ctrip.fun.golf.service.GenericService#getEntityDao()
*/
@Override
public EventGamePlayerDao getEntityDao() {
return eventGamePlayerDao;
}
public EventGamePlayerDao getEventGamePlayerDao() {
return eventGamePlayerDao;
}
public void setEventGamePlayerDao(EventGamePlayerDao eventGamePlayerDao) {
this.eventGamePlayerDao = eventGamePlayerDao;
}
public PagedResponseBean<EventGamePlayerBean> playerInfoList(Request<EventGamePlayerQuery> request) {
PagedResponseBean<EventGamePlayerBean> pagedResponseBean = new PagedResponseBean<EventGamePlayerBean>();
Collection<EventGamePlayerBean> result =new ArrayList<EventGamePlayerBean>();
PagedEntityBean<EventGamePlayer> pagedEntityBean = this.eventGamePlayerDao.playerInfoList(request.getBody());
if(pagedEntityBean!=null&&pagedEntityBean.getResult()!=null){
Collection<EventGamePlayer> collection = pagedEntityBean.getResult();
for (EventGamePlayer t : collection) {
try {
EventGamePlayerBean vo = new EventGamePlayerBean();
BeanConverter.copyProperties(vo, t);
result.add(vo);
} catch (Exception e) {
throw new DaoException("create instance fail", e);
}
}
}
pagedResponseBean.setResult(result);
return pagedResponseBean;
}
public PagedResponseBean<EventGamePlayerBean> recommendPlayer(Request<String> request) {
PagedResponseBean<EventGamePlayerBean> pagedResponseBean = this.eventGamePlayerDao.recommendPlayer(request.getBody());
return pagedResponseBean;
}
}
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package com.ctrip.fun.golf.service.market;
import com.ctrip.fun.common.vo.market.EventGameBean;
import com.ctrip.fun.golf.dao.market.EventGameDao;
import com.ctrip.fun.golf.domain.market.EventGame;
import com.ctrip.fun.golf.service.GenericService;
/**
* @author zgsong
* @version 1.0.0
*/
public class EventGameService extends GenericService<EventGameDao, EventGame, Integer, EventGameBean>{
private EventGameDao eventGameDao = null;
/**
* @return
* @see com.ctrip.fun.golf.service.GenericService#getEntityDao()
*/
@Override
public EventGameDao getEntityDao() {
return eventGameDao;
}
public EventGameDao getEventGameDao() {
return eventGameDao;
}
public void setEventGameDao(EventGameDao eventGameDao) {
this.eventGameDao = eventGameDao;
}
}
......@@ -7,6 +7,7 @@ import java.util.Date;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.hibernate.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -189,6 +190,15 @@ public class EventCustomerInfoService extends
List<EventCustomerInfoBean> eventCustomerInfos = getEventCustomerInfos(eventCustomerInfoQuery);
return eventCustomerInfos;
}
/**
* 查询指定姓名的人在赛事中电话号码和打球日期
* @param eventCustomerInfoQuery
* @return
*/
public List<EventCustomerInfoBean> getEventCustomerInfoByName(EventCustomerInfoQuery eventCustomerInfoQuery) {
return eventCustomerInfoDao.getEventCustomerInfoByName(eventCustomerInfoQuery);
}
/**
* 获取参赛人员信息
......
......@@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
import com.ctrip.fun.common.core.util.BeanConverter;
import com.ctrip.fun.common.core.util.DateUtil;
import com.ctrip.fun.common.vo.PagedResponseBean;
import com.ctrip.fun.common.vo.basic.UserExtQuery;
import com.ctrip.fun.common.vo.basic.VipGradeEnum;
import com.ctrip.fun.common.vo.user.UserExtBean;
import com.ctrip.fun.golf.dao.order.OrderDao;
......@@ -150,4 +152,9 @@ public class UserExtService extends GenericService<UserExtDao, UserExt, Integer,
public UserExtDao getEntityDao() {
return this.userExtDao;
}
public PagedResponseBean<UserExtBean> getUserExtByName(UserExtQuery body) {
PagedResponseBean<UserExtBean> pageList = this.userExtDao.getUserExtByName(body);
return pageList;
}
}
......@@ -187,6 +187,9 @@
<mapping class="com.ctrip.fun.golf.domain.market.PartnerUser" />
<mapping class="com.ctrip.fun.golf.domain.market.EventGame" />
<mapping class="com.ctrip.fun.golf.domain.market.EventGameGroup" />
<mapping class="com.ctrip.fun.golf.domain.market.EventGamePlayer" />
<mapping class="com.ctrip.fun.golf.domain.order.EventCustomerInfo" />
<mapping class="com.ctrip.fun.golf.domain.order.EventCustomerInfoOfflineLog" />
......
......@@ -10,7 +10,25 @@
<bean name="communeInviteActivityLogDao" class="com.ctrip.fun.golf.dao.market.CommuneInviteActivityLogDao">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean name="eventGameDao" class="com.ctrip.fun.golf.dao.market.EventGameDao">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean name="eventGameGroupDao" class="com.ctrip.fun.golf.dao.market.EventGameGroupDao">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean name="eventGamePlayerDao" class="com.ctrip.fun.golf.dao.market.EventGamePlayerDao">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean name="eventGameService" class="com.ctrip.fun.golf.service.market.EventGameService">
<property name="eventGameDao" ref="eventGameDao"></property>
</bean>
<bean name="eventGamePlayerService" class="com.ctrip.fun.golf.service.market.EventGamePlayerService">
<property name="eventGamePlayerDao" ref="eventGamePlayerDao"></property>
</bean>
<bean name="eventGameGroupService" class="com.ctrip.fun.golf.service.market.EventGameGroupService">
<property name="eventGameGroupDao" ref="eventGameGroupDao"></property>
</bean>
<bean name="communeInviteActivityService" class="com.ctrip.fun.golf.service.market.CommuneInviteActivityService">
<property name="communeInviteActivityDao" ref="communeInviteActivityDao"></property>
<property name="communeOrderItemDao" ref="communeOrderItemDao"></property>
......@@ -20,7 +38,7 @@
<property name="levelTwo" value="${communeInviteLevelTwo}"></property>
<property name="levelOneReward" value="${communeInviteLevelOneReward}"></property>
<property name="levelTwoReward" value="${communeInviteLevelTwoReward}"></property>
</bean>
</bean>
<bean name="communeInviteActivityLogService" class="com.ctrip.fun.golf.service.market.CommuneInviteActivityLogService">
<property name="communeInviteActivityLogDao" ref="communeInviteActivityLogDao"></property>
......
package com.ctrip.fun.golf.dao.statistics.user;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.List;
import com.ctrip.fun.common.vo.basic.VoucherQueryDto;
import com.ctrip.fun.golf.dao.order.OrderDao;
import com.ctrip.fun.golf.dao.user.UserOrderBehaviourStatisticsDao;
import com.ctrip.fun.golf.service.basic.VoucherService;
import com.ctrip.fun.golf.service.order.CommuneOrderService;
import com.ctrip.fun.common.core.util.DateUtil;
import com.ctrip.fun.common.vo.market.EventGameBean;
import com.ctrip.fun.common.vo.market.EventGameGroupBean;
import com.ctrip.fun.common.vo.market.EventGamePlayerBean;
import com.ctrip.fun.common.vo.order.EventCustomerInfoBean;
import com.ctrip.fun.common.vo.order.EventCustomerInfoQuery;
import com.ctrip.fun.golf.dao.market.EventGameDao;
import com.ctrip.fun.golf.dao.market.EventGameGroupDao;
import com.ctrip.fun.golf.dao.market.EventGamePlayerDao;
import com.ctrip.fun.golf.domain.market.EventGameGroup;
import com.ctrip.fun.golf.service.market.EventGameGroupService;
import com.ctrip.fun.golf.service.market.EventGamePlayerService;
import com.ctrip.fun.golf.service.market.EventGameService;
import com.ctrip.fun.golf.service.order.EventCustomerInfoService;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -13,24 +29,67 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:*.spring.xml"})
public class UserOrderBehaviourStatisticsDaoTest{
@Autowired
private VoucherService voucherService;
@Test
public void testListNonOrderUser() throws Exception {
VoucherQueryDto query = new VoucherQueryDto();
query.setUid("13198765437");
query.setType(1);
query.setResourceId(2972);
voucherService.queryListForCourseOrder(query);
}
@Test
public void testListOrderUser() throws Exception {
}
@ContextConfiguration(locations = { "classpath*:*.spring.xml" })
public class UserOrderBehaviourStatisticsDaoTest {
@Autowired
private EventGameService eventGameService;
@Autowired
private EventGameGroupService eventGameGroupService;
@Autowired
private EventGamePlayerService eventGamePlayerService;
@Test
public void testListOrderUser() throws Exception {
String[] filenames = {"美兰湖分组表_1170_2018-04-04","协和分组_1902_2018-04-01","协和分组_1902_2018-04-03","协和分组_1902_2018-04-08"};
for(String filename:filenames){
String fullFileName="D:/lichong/fenzu/"+filename+".txt";
File file = new File(fullFileName);
InputStreamReader fileIn = new InputStreamReader(new FileInputStream(file), "gbk");
BufferedReader reader = null;
String temp = null;
int eventGameId = 0;
int groupNum = 0;
int groupId = 0;
//创建一场赛事
EventGameBean eventGameBean = new EventGameBean();
String[] gameStrs = filename.split("_");
eventGameBean.setGameName(gameStrs[0]);
eventGameBean.setCourseId(Integer.parseInt(gameStrs[1]));
eventGameBean.setPlayDate(DateUtil.parseDate(gameStrs[2]));
eventGameBean.setCreateUser("caosy");
eventGameBean.setCreateTime(new Date());
eventGameId = eventGameService.save(eventGameBean);
try {
reader = new BufferedReader(fileIn);
while ((temp = reader.readLine()) != null) {
if(temp.contains(":")){
groupNum++;
EventGameGroupBean eventGameGroup = new EventGameGroupBean();
eventGameGroup.setGameId(eventGameId);
eventGameGroup.setGroupNum(groupNum);
eventGameGroup.setFormatTeeTime(temp);
groupId = eventGameGroupService.save(eventGameGroup);
}else{
EventGamePlayerBean eventGamePlayerBean = new EventGamePlayerBean();
eventGamePlayerBean.setGroupId(groupId);
eventGamePlayerBean.setGameId(eventGameId);
eventGamePlayerBean.setGroupNum(groupNum);
eventGamePlayerBean.setPlayerName(temp.trim());
eventGamePlayerService.save(eventGamePlayerBean);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment