Authored by LiQZ

Merge branch 'channel' of http://git.yoho.cn/yoho30/yohobuy-union into channel

... ... @@ -51,12 +51,16 @@ public class ChannelGroupRest {
@RequestMapping("/sendMessage")
@ResponseBody
public ApiResponse sendMessage(ChannelMessageRequestBO channelGroupRequestBO){
logger.info("enter sendMessage. param channelGroupRequestBO={}", channelGroupRequestBO);
public ApiResponse sendMessage(ChannelMessageRequestBO channelGroupRequestBO,HttpSession session){
logger.info("enter sendMessage. param channelGroupRequestBO={},session={}", channelGroupRequestBO,session);
if(StringUtils.isEmpty(channelGroupRequestBO.getContent()) || channelGroupRequestBO.getGroupId()==0){
return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build();
}
int result = channelGroupService.sendMessage(channelGroupRequestBO);
UserInfoBO userInfoBO= (UserInfoBO) session.getAttribute("userSession");
logger.info("ChannelGroupRest.sendMessage:useinfo is {}", userInfoBO);
// int result = channelGroupService.sendMessage(channelGroupRequestBO,userInfoBO.getPid());
int result = channelGroupService.sendMessage(channelGroupRequestBO,14);
if(result==1){
return new ApiResponse.ApiResponseBuilder().code(200).message("成功").build();
}else{
... ...
... ... @@ -18,7 +18,7 @@ public interface ChannelGroupService {
PageChannelGroupRspBO queryChannelGroupList(ChannelGroupRequestBO channelGroupRequestBO);
int sendMessage(ChannelMessageRequestBO channelGroupRequestBO);
int sendMessage(ChannelMessageRequestBO channelGroupRequestBO,int senderId);
Map<Integer,String> getCondition(String ids);
... ...
... ... @@ -15,6 +15,7 @@ import com.yoho.service.model.union.response.ChannelGroupRspBO;
import com.yoho.service.model.union.response.PageChannelGroupRspBO;
import com.yoho.unions.channel.service.ChannelGroupService;
import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.common.utils.ErpApiServiceHelper;
import com.yoho.unions.dal.*;
import com.yoho.unions.dal.model.*;
import com.yoho.unions.utils.DateUtils;
... ... @@ -57,10 +58,10 @@ public class ChannelGroupServiceImpl implements ChannelGroupService {
private IChannelGroupBatchDAO channelGroupBatchDAO;
@Autowired
private IProfileDAO profileDAO;
private IChannelSmsBlackDAO channelSmsBlackDAO;
@Autowired
private IChannelSmsBlackDAO channelSmsBlackDAO;
private ErpApiServiceHelper erpApiServiceHelper;
public static final int BATCH_MESSAGE_NUMBER = 1000;
... ... @@ -127,13 +128,11 @@ public class ChannelGroupServiceImpl implements ChannelGroupService {
}
@Override
public int sendMessage(ChannelMessageRequestBO channelGroupRequestBO) {
public int sendMessage(ChannelMessageRequestBO channelGroupRequestBO,int sendUserId) {
logger.info("enter sendMessage. param channelGroupRequestBO{}", channelGroupRequestBO);
int groupId = channelGroupRequestBO.getGroupId();
String content = channelGroupRequestBO.getContent();
//发送人id,待改成从session读取
int sendUserId = 14;
//1.根据groupId查询条件
List<ChannelGroupCondition> conditions = channelGroupConditionDAO.selectByGroupId(groupId);
logger.info("sendMessage:conditions is {}",conditions);
... ... @@ -215,12 +214,16 @@ public class ChannelGroupServiceImpl implements ChannelGroupService {
channelGroup.setId(groupId);
channelGroup.setSendTime(sendTime);
channelGroup.setUpdateTime(sendTime);
channelGroup.setGroupNumber(total);
channelGroup.setGroupNumber(mobileSet.size());
channelGroup.setContent(content);
channelGroup.setSendUser(sendUserId);
Profile profile = profileDAO.selectByPrimaryKey(sendUserId);
channelGroup.setSendUserName(profile!=null?profile.getAccount():"");
channelGroup.setSmsNumber(groupBatchId);
// Profile profile = profileDAO.selectByPrimaryKey(sendUserId);
// channelGroup.setSendUserName(profile!=null?profile.getAccount():"");
UserInfoBO userInfoBO = erpApiServiceHelper.getUserByPid(String.valueOf(sendUserId));
channelGroup.setSendUserName(userInfoBO!=null?userInfoBO.getAccount():"");
channelGroupDAO.updateByPrimaryKeySelective(channelGroup);
logger.info("sendMessage:update channelGroup,channelGroup is {}",channelGroup);
return 1;
}
... ...
package com.yoho.unions.dal;
import com.yoho.unions.dal.model.Profile;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IProfileDAO {
int deleteByPrimaryKey(Integer pid);
int insert(Profile record);
int insertSelective(Profile record);
Profile selectByPrimaryKey(Integer pid);
int updateByPrimaryKeySelective(Profile record);
int updateByPrimaryKey(Profile record);
/**
* 根据用户id列表批量获取用户信息
*/
List<Profile> batchSelectByPrimaryKey(@Param("list") List<Integer> pids);
}
\ No newline at end of file
package com.yoho.unions.dal.model;
/**
* Created by yoho on 2017/2/16.
*/
public class Profile{
private static final long serialVersionUID = 6342804270613557444L;
/**
* 帐号记录ID
*/
private Integer pid;
/**
* 登录帐号
*/
private String account;
/**
* 真实姓名
*/
private String truename;
/**
* 员工号
*/
private String staffCode;
/**
* 邮件地址
*/
private String email;
/**
* 密码
*/
private String password;
/**
* 手机号
*/
private String phone;
/**
* 创建时间
*/
private Integer createTime;
/**
* 过期时间
*/
private Integer expires;
/**
* 登录时间
*/
private Integer loginTime;
/**
* 状态
*/
private Byte status;
/**
* 身份
* 1 => '品牌公司'
* 2 => '品牌经销商'
* 3 => '品牌代运营商'
* 4 => '有货品牌经理'
* 5 => '有货店铺运营'
* 6 => '有货商品运营'
* 7 => '有货平台运营'
*/
private Byte identity;
/**
* 认证站点
* 1 => '运营平台',
* 2 => '商家平台'
*
*/
private String authSite;
/**
* 角色ID
*/
private Integer roleId;
/**
* 部门ID
*/
private Integer deptId;
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account == null ? null : account.trim();
}
public String getTruename() {
return truename;
}
public void setTruename(String truename) {
this.truename = truename == null ? null : truename.trim();
}
public String getStaffCode() {
return staffCode;
}
public void setStaffCode(String staffCode) {
this.staffCode = staffCode == null ? null : staffCode.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getExpires() {
return expires;
}
public void setExpires(Integer expires) {
this.expires = expires;
}
public Integer getLoginTime() {
return loginTime;
}
public void setLoginTime(Integer loginTime) {
this.loginTime = loginTime;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public Byte getIdentity() {
return identity;
}
public void setIdentity(Byte identity) {
this.identity = identity;
}
public String getAuthSite() {
return authSite;
}
public void setAuthSite(String authSite) {
this.authSite = authSite == null ? null : authSite.trim();
}
public Integer getDeptId() {
return deptId;
}
public void setDeptId(Integer deptId) {
this.deptId = deptId;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.unions.dal.IProfileDAO">
<resultMap id="BaseResultMap"
type="com.yoho.unions.dal.model.Profile">
<id column="pid" property="pid" jdbcType="INTEGER" />
<result column="account" property="account" jdbcType="VARCHAR" />
<result column="truename" property="truename" jdbcType="VARCHAR" />
<result column="staff_code" property="staffCode" jdbcType="VARCHAR" />
<result column="email" property="email" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="expires" property="expires" jdbcType="INTEGER" />
<result column="login_time" property="loginTime" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="identity" property="identity" jdbcType="TINYINT" />
<result column="auth_site" property="authSite" jdbcType="VARCHAR" />
<result column="role_id" property="roleId" jdbcType="INTEGER" />
<result column="dept_id" property="deptId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
pid, account, truename, staff_code, email, password, phone, create_time,
expires,
login_time, status, identity, auth_site, role_id, dept_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from profile
where pid = #{pid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from profile
where pid = #{pid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.Profile">
insert into profile (pid, account, truename,
staff_code, email, password,
phone, create_time, expires,
login_time, status, identity,
auth_site)
values (#{pid,jdbcType=INTEGER}, #{account,jdbcType=VARCHAR},
#{truename,jdbcType=VARCHAR},
#{staffCode,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER},
#{expires,jdbcType=INTEGER},
#{loginTime,jdbcType=INTEGER}, #{status,jdbcType=TINYINT}, #{identity,jdbcType=TINYINT},
#{authSite,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.Profile">
insert into profile
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pid != null">
pid,
</if>
<if test="account != null">
account,
</if>
<if test="truename != null">
truename,
</if>
<if test="staffCode != null">
staff_code,
</if>
<if test="email != null">
email,
</if>
<if test="password != null">
password,
</if>
<if test="phone != null">
phone,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="expires != null">
expires,
</if>
<if test="loginTime != null">
login_time,
</if>
<if test="status != null">
status,
</if>
<if test="identity != null">
identity,
</if>
<if test="authSite != null">
auth_site,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pid != null">
#{pid,jdbcType=INTEGER},
</if>
<if test="account != null">
#{account,jdbcType=VARCHAR},
</if>
<if test="truename != null">
#{truename,jdbcType=VARCHAR},
</if>
<if test="staffCode != null">
#{staffCode,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
<if test="expires != null">
#{expires,jdbcType=INTEGER},
</if>
<if test="loginTime != null">
#{loginTime,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="identity != null">
#{identity,jdbcType=TINYINT},
</if>
<if test="authSite != null">
#{authSite,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.Profile">
update profile
<set>
<if test="account != null">
account = #{account,jdbcType=VARCHAR},
</if>
<if test="truename != null">
truename = #{truename,jdbcType=VARCHAR},
</if>
<if test="staffCode != null">
staff_code = #{staffCode,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="expires != null">
expires = #{expires,jdbcType=INTEGER},
</if>
<if test="loginTime != null">
login_time = #{loginTime,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="identity != null">
identity = #{identity,jdbcType=TINYINT},
</if>
<if test="authSite != null">
auth_site = #{authSite,jdbcType=VARCHAR},
</if>
</set>
where pid = #{pid,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.Profile">
update profile
set account = #{account,jdbcType=VARCHAR},
truename = #{truename,jdbcType=VARCHAR},
staff_code = #{staffCode,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=INTEGER},
expires = #{expires,jdbcType=INTEGER},
login_time = #{loginTime,jdbcType=INTEGER},
status = #{status,jdbcType=TINYINT},
identity = #{identity,jdbcType=TINYINT},
auth_site = #{authSite,jdbcType=VARCHAR}
where pid = #{pid,jdbcType=INTEGER}
</update>
<select id="batchSelectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.util.List" >
select
<include refid="Base_Column_List" />
from profile
where pid in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ... @@ -474,7 +474,9 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
}else if(StringUtils.isNotEmpty(request.getImei())){
muid = request.getImei();
}
DeviceActiveEvent activeEvent = new DeviceActiveEvent("deviceActive",source,source_id,muid);
String interfaceType = click.getInterfaceType();
DeviceActiveEvent activeEvent = new DeviceActiveEvent("deviceActive",interfaceType,source,source_id,muid);
//上报激活事件
try{
... ...
... ... @@ -49,13 +49,4 @@ datasources:
- com.yoho.unions.dal.IChannelGroupBatchDAO
- com.yoho.unions.dal.IChannelSmsBlackDAO
erp_account:
servers:
- 192.168.102.219:3306
- 192.168.102.219:3306
username: yh_test
password: 9nm0icOwt6bMHjMusIfMLw==
daos:
- com.yoho.unions.dal.IProfileDAO
readOnlyInSlave: true
\ No newline at end of file
... ...
... ... @@ -50,13 +50,4 @@ datasources:
- com.yoho.unions.dal.IChannelGroupBatchDAO
- com.yoho.unions.dal.IChannelSmsBlackDAO
erp_account:
servers:
- 192.168.102.219:3306
- 192.168.102.219:3306
username: yh_test
password: 9nm0icOwt6bMHjMusIfMLw==
daos:
- com.yoho.unions.dal.IProfileDAO
readOnlyInSlave: true
\ No newline at end of file
... ...
... ... @@ -8,7 +8,15 @@
</head>
<body class="easyui-layout" fit="true">
<div id="search" region="north" style="height: 170px;" class="xsdvideogl">
<div style="margin-left: 30px;margin-top: 20px;">
<script>
document.write(addHead('市场管理', '分组营销管理'));
</script>
<style>
.div_search input { margin-top: 20px; }
.div_search .textbox { margin-top: 20px; }
.div_search .easyui-linkbutton { margin-top: 20px; }
</style>
<div style="margin-left: 30px;" class="div_search">
<input type="text" id="name"/>
<input id="createTimeBegin" type="text" class="easyui-datetimebox" editable="false" >
<label>~</label>
... ... @@ -148,11 +156,11 @@
width: 170,
align: "center",
formatter: function (value, rowData, rowIndex) {
if(rowData.content !=''){
return "-"
}else{
if(rowData.content == null || rowData.content ==''){
var str = "<a role='send' dataId='" + rowData.id + "' style='margin-left:10px'>发送短信</a>";
return str;
}else{
return "-"
}
}
}
... ... @@ -298,12 +306,11 @@
for ( var i = 0; i < data1.rows.length; i++) {
ids.push(data1.rows[i].id);
}
$.post(contextPath + "/channel/getCondition", {ids:"2,3"},function (data) {
var groupIds = ids.join(",");
$.post(contextPath + "/channel/getCondition", {ids:groupIds},function (data) {
var content = data.data;
for ( var i = 0; i < data1.rows.length; i++) {
var id = data1.rows[i].id;
console.info(content[id]);
addTooltip(content[id],'condition-' + i);
}
});
... ...