Browse Source

消息推送

wanghui 8 years ago
parent
commit
8ab577edd8

+ 1 - 1
GeneratorConfig.xml

@@ -8,6 +8,6 @@
     <javaModelGenerator targetPackage="com.goafanti.common.model" targetProject="AFT" />
     <sqlMapGenerator targetPackage="com.goafanti.common.mapper" targetProject="AFT" />
     <javaClientGenerator targetPackage="com.goafanti.common.dao" targetProject="AFT" type="XMLMAPPER" />
-    <table schema="aft" tableName="message_from_system"/>
+    <table schema="aft" tableName="jpush_easemob_account"/>
   </context>
 </generatorConfiguration>

+ 35 - 4
src/main/java/com/goafanti/admin/controller/AdminMessageController.java

@@ -4,6 +4,7 @@ import java.text.ParseException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,7 +16,10 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.MessageFromSystem;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.message.bo.MessageListBo;
 import com.goafanti.message.enums.ConsumerType;
 import com.goafanti.message.enums.RecommendType;
 import com.goafanti.message.enums.SubjectType;
@@ -79,6 +83,7 @@ public class AdminMessageController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"必须说明是否为草稿"));
 			return res;
 		}
+		checkParam(userIds,adminIds,companyIds,societyTags,provinceIds,cityIds,areaIds,roles,industryIds);
 		Map<Integer,String> targetMap = new HashMap<Integer, String>();
 		if(targetType == ConsumerType.CUSTOMER_RETAIL.getTypeCode()) targetMap.put(targetType, userIds);
 		if(targetType == ConsumerType.USER_RETAIL.getTypeCode()) targetMap.put(targetType, adminIds);
@@ -137,6 +142,8 @@ public class AdminMessageController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"必须说明是否为草稿"));
 			return res;
 		}
+		checkParam(projectIds,projectIds,personalAchievementIds,organizationAchievementIds,personalDemandIds,organizationDemandIds,
+				expertIds,newsIds,userIds,provinceIds,cityIds,areaIds,industryIds);
 		Map<Integer,String> sourceMap = new HashMap<Integer, String>();
 		if(sourceType == RecommendType.TECH_SERVICE.getTypeCode()) sourceMap.put(sourceType, projectIds);
 		if(sourceType == RecommendType.PERSON_ACHIEVEMENT.getTypeCode()) sourceMap.put(sourceType, personalAchievementIds);
@@ -181,10 +188,10 @@ public class AdminMessageController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "消息发送状态不能未空"));
 			return res;
 		}
-		if(null == subject){
+		/*if(null == subject){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "消息类型不能为空"));
 			return res;
-		}
+		}*/
 		res.setData(messageServiceImpl.listSystemMessage(isDraft, subject));
 		return res;
 	}
@@ -233,7 +240,7 @@ public class AdminMessageController extends CertifyApiController{
 	
 	/**
 	 * 读取消息详情
-	 * @param messageId
+	 * @param messageId 消息ID
 	 * @return
 	 */
 	@RequestMapping(value = "/getSystemMessageDetail", method = RequestMethod.GET)
@@ -243,7 +250,31 @@ public class AdminMessageController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "消息编号为空"));
 			return res;
 		}
-		res.setData(messageServiceImpl.selectSystemMessageDetail(messageId));
+		// 读取消息详情
+		MessageFromSystem mfs = messageServiceImpl.selectSystemMessageDetail(messageId);
+		MessageListBo bo = new MessageListBo();
+		bo.setCreateTime(bo.getCreateTime() == null ? ""
+				: DateUtils.formatDate(mfs.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS));
+		bo.setResourceType(String.valueOf(mfs.getResourceType()));
+		bo.setSubject(String.valueOf(mfs.getSubject()));
+		bo.setMessageId(mfs.getId());
+		bo.setTitle(mfs.getTitle());
+		bo.setBody(mfs.getBody());
+		bo.setResourceId(mfs.getResourceId());
+		res.setData(bo);
 		return res;
 	}
+	
+	/**
+	 * 校验
+	 * @param ids
+	 */
+	public void checkParam(String... ids){
+		String regex = "^[0-9a-z-,]*$";
+		for(String s:ids){
+			if(StringUtils.isNotBlank(s) && !Pattern.matches(regex, s)){
+				throw new BusinessException(buildError(ErrorConstants.PARAM_ERROR, "参数不合法", s));
+			}
+		}
+	} 
 }

+ 12 - 5
src/main/java/com/goafanti/app/bo/UserBasicInfo.java

@@ -11,7 +11,8 @@ public class UserBasicInfo {
 	private String headPortraitUrl;
 	private String introduction;
 	private Integer isMember;
-	private String username;//环信名
+	private String easemobName;//环信名
+	private String easemobPass;//环信密码
 	private String registrationId;//极光id
 	public String getId() {
 		return id;
@@ -73,11 +74,17 @@ public class UserBasicInfo {
 	public void setIsMember(Integer isMember) {
 		this.isMember = isMember;
 	}
-	public String getUsername() {
-		return username;
+	public String getEasemobName() {
+		return easemobName;
 	}
-	public void setUsername(String username) {
-		this.username = username;
+	public void setEasemobName(String easemobName) {
+		this.easemobName = easemobName;
+	}
+	public String getEasemobPass() {
+		return easemobPass;
+	}
+	public void setEasemobPass(String easemobPass) {
+		this.easemobPass = easemobPass;
 	}
 	public String getRegistrationId() {
 		return registrationId;

+ 2 - 3
src/main/java/com/goafanti/app/controller/AppApiController.java

@@ -16,7 +16,6 @@ import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.MessageFromSystem;
 import com.goafanti.common.model.User;
-import com.goafanti.common.utils.BeanUtilsExt;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.message.bo.MessageListBo;
@@ -95,10 +94,10 @@ public class AppApiController extends BaseApiController {
 	 * @param userName
 	 */
 	@RequestMapping(value = "/synBindingAccount",method = RequestMethod.POST)
-	private Result synBindingAccount(String uuid,String registrationId,String userName){
+	private Result synBindingAccount(String uuid,String registrationId,String easemobName,String easemobPass){
 		Result res = new Result();
 		//更新 jpush_easemob_account
-		messageServiceImpl.updateJpushEasemobAccount(uuid, registrationId, userName);
+		messageServiceImpl.updateJpushEasemobAccount(uuid, registrationId, easemobName,easemobPass);
 		return res;
 	}
 	

+ 58 - 77
src/main/java/com/goafanti/common/dao/JpushEasemobAccountMapper.java

@@ -6,91 +6,72 @@ import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
 public interface JpushEasemobAccountMapper {
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    long countByExample(JpushEasemobAccountExample example);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int deleteByExample(JpushEasemobAccountExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	long countByExample(JpushEasemobAccountExample example);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int deleteByPrimaryKey(String uuid);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int deleteByExample(JpushEasemobAccountExample example);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int insert(JpushEasemobAccount record);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int deleteByPrimaryKey(String uuid);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int insertSelective(JpushEasemobAccount record);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int insert(JpushEasemobAccount record);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    List<JpushEasemobAccount> selectByExample(JpushEasemobAccountExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int insertSelective(JpushEasemobAccount record);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    JpushEasemobAccount selectByPrimaryKey(String uuid);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	List<JpushEasemobAccount> selectByExample(JpushEasemobAccountExample example);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int updateByExampleSelective(@Param("record") JpushEasemobAccount record, @Param("example") JpushEasemobAccountExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	JpushEasemobAccount selectByPrimaryKey(String uuid);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int updateByExample(@Param("record") JpushEasemobAccount record, @Param("example") JpushEasemobAccountExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int updateByExampleSelective(@Param("record") JpushEasemobAccount record,
+			@Param("example") JpushEasemobAccountExample example);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int updateByPrimaryKeySelective(JpushEasemobAccount record);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int updateByExample(@Param("record") JpushEasemobAccount record,
+			@Param("example") JpushEasemobAccountExample example);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table jpush_easemob_account
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    int updateByPrimaryKey(JpushEasemobAccount record);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int updateByPrimaryKeySelective(JpushEasemobAccount record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table jpush_easemob_account
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	int updateByPrimaryKey(JpushEasemobAccount record);
 }

+ 3 - 2
src/main/java/com/goafanti/common/dao/MessageFromSystemMapper.java

@@ -6,6 +6,7 @@ import com.goafanti.common.model.MessageFromSystem;
 import com.goafanti.common.model.MessageFromSystemExample;
 import com.goafanti.common.model.MessageProducer;
 import com.goafanti.message.bo.MessageBo;
+import com.goafanti.message.bo.MessageListBo;
 
 import java.util.Date;
 import java.util.List;
@@ -122,7 +123,7 @@ public interface MessageFromSystemMapper {
 	 * @return
 	 */
 	int updateJpushEasemobAccount(@Param("uuid")String uuid, @Param("registrationId")String registrationId, 
-			@Param("userName")String userName, @Param("uid")String uid,@Param("lastLoginTime")Date lastLoginTime);
+			@Param("easemobName")String easemobName, @Param("easemobPass")String easemobPass, @Param("uid")String uid,@Param("lastLoginTime")Date lastLoginTime);
 	
 	/**
 	 * 把消息置为已�?
@@ -146,7 +147,7 @@ public interface MessageFromSystemMapper {
 	 * @param subject 消息类型
 	 * @return
 	 */
-	List<MessageFromSystem> listSystemMessage(@Param("isDraft")Integer isDraft,@Param("subject")Integer subject);
+	List<MessageListBo> listSystemMessage(@Param("isDraft")Integer isDraft,@Param("subject")Integer subject);
 
 	/**
 	 * APP首页消息

+ 54 - 39
src/main/java/com/goafanti/common/mapper/JpushEasemobAccountMapper.xml

@@ -5,21 +5,22 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     <id column="uuid" jdbcType="VARCHAR" property="uuid" />
     <result column="registration_id" jdbcType="VARCHAR" property="registrationId" />
-    <result column="username" jdbcType="VARCHAR" property="username" />
     <result column="uid" jdbcType="VARCHAR" property="uid" />
     <result column="tag" jdbcType="VARCHAR" property="tag" />
     <result column="group_id" jdbcType="VARCHAR" property="groupId" />
     <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
+    <result column="easemob_name" jdbcType="VARCHAR" property="easemobName" />
+    <result column="easemob_pass" jdbcType="VARCHAR" property="easemobPass" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -53,7 +54,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -87,15 +88,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
-    uuid, registration_id, username, uid, tag, group_id, last_login_time
+    uuid, registration_id, uid, tag, group_id, last_login_time, easemob_name, easemob_pass
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.JpushEasemobAccountExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     select
     <if test="distinct">
@@ -114,7 +115,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     select 
     <include refid="Base_Column_List" />
@@ -125,7 +126,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     delete from jpush_easemob_account
     where uuid = #{uuid,jdbcType=VARCHAR}
@@ -134,7 +135,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     delete from jpush_easemob_account
     <if test="_parameter != null">
@@ -145,20 +146,20 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
-    insert into jpush_easemob_account (uuid, registration_id, username, 
-      uid, tag, group_id, 
-      last_login_time)
-    values (#{uuid,jdbcType=VARCHAR}, #{registrationId,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, 
-      #{uid,jdbcType=VARCHAR}, #{tag,jdbcType=VARCHAR}, #{groupId,jdbcType=VARCHAR}, 
-      #{lastLoginTime,jdbcType=TIMESTAMP})
+    insert into jpush_easemob_account (uuid, registration_id, uid, 
+      tag, group_id, last_login_time, 
+      easemob_name, easemob_pass)
+    values (#{uuid,jdbcType=VARCHAR}, #{registrationId,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, 
+      #{tag,jdbcType=VARCHAR}, #{groupId,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP}, 
+      #{easemobName,jdbcType=VARCHAR}, #{easemobPass,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.JpushEasemobAccount">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     insert into jpush_easemob_account
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -168,9 +169,6 @@
       <if test="registrationId != null">
         registration_id,
       </if>
-      <if test="username != null">
-        username,
-      </if>
       <if test="uid != null">
         uid,
       </if>
@@ -183,6 +181,12 @@
       <if test="lastLoginTime != null">
         last_login_time,
       </if>
+      <if test="easemobName != null">
+        easemob_name,
+      </if>
+      <if test="easemobPass != null">
+        easemob_pass,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="uuid != null">
@@ -191,9 +195,6 @@
       <if test="registrationId != null">
         #{registrationId,jdbcType=VARCHAR},
       </if>
-      <if test="username != null">
-        #{username,jdbcType=VARCHAR},
-      </if>
       <if test="uid != null">
         #{uid,jdbcType=VARCHAR},
       </if>
@@ -206,13 +207,19 @@
       <if test="lastLoginTime != null">
         #{lastLoginTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="easemobName != null">
+        #{easemobName,jdbcType=VARCHAR},
+      </if>
+      <if test="easemobPass != null">
+        #{easemobPass,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.goafanti.common.model.JpushEasemobAccountExample" resultType="java.lang.Long">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     select count(*) from jpush_easemob_account
     <if test="_parameter != null">
@@ -223,7 +230,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     update jpush_easemob_account
     <set>
@@ -233,9 +240,6 @@
       <if test="record.registrationId != null">
         registration_id = #{record.registrationId,jdbcType=VARCHAR},
       </if>
-      <if test="record.username != null">
-        username = #{record.username,jdbcType=VARCHAR},
-      </if>
       <if test="record.uid != null">
         uid = #{record.uid,jdbcType=VARCHAR},
       </if>
@@ -248,6 +252,12 @@
       <if test="record.lastLoginTime != null">
         last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="record.easemobName != null">
+        easemob_name = #{record.easemobName,jdbcType=VARCHAR},
+      </if>
+      <if test="record.easemobPass != null">
+        easemob_pass = #{record.easemobPass,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -257,16 +267,17 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     update jpush_easemob_account
     set uuid = #{record.uuid,jdbcType=VARCHAR},
       registration_id = #{record.registrationId,jdbcType=VARCHAR},
-      username = #{record.username,jdbcType=VARCHAR},
       uid = #{record.uid,jdbcType=VARCHAR},
       tag = #{record.tag,jdbcType=VARCHAR},
       group_id = #{record.groupId,jdbcType=VARCHAR},
-      last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP}
+      last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
+      easemob_name = #{record.easemobName,jdbcType=VARCHAR},
+      easemob_pass = #{record.easemobPass,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -275,16 +286,13 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     update jpush_easemob_account
     <set>
       <if test="registrationId != null">
         registration_id = #{registrationId,jdbcType=VARCHAR},
       </if>
-      <if test="username != null">
-        username = #{username,jdbcType=VARCHAR},
-      </if>
       <if test="uid != null">
         uid = #{uid,jdbcType=VARCHAR},
       </if>
@@ -297,6 +305,12 @@
       <if test="lastLoginTime != null">
         last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="easemobName != null">
+        easemob_name = #{easemobName,jdbcType=VARCHAR},
+      </if>
+      <if test="easemobPass != null">
+        easemob_pass = #{easemobPass,jdbcType=VARCHAR},
+      </if>
     </set>
     where uuid = #{uuid,jdbcType=VARCHAR}
   </update>
@@ -304,15 +318,16 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Dec 18 19:12:58 CST 2017.
+      This element was generated on Thu Dec 21 08:23:35 CST 2017.
     -->
     update jpush_easemob_account
     set registration_id = #{registrationId,jdbcType=VARCHAR},
-      username = #{username,jdbcType=VARCHAR},
       uid = #{uid,jdbcType=VARCHAR},
       tag = #{tag,jdbcType=VARCHAR},
       group_id = #{groupId,jdbcType=VARCHAR},
-      last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
+      last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
+      easemob_name = #{easemobName,jdbcType=VARCHAR},
+      easemob_pass = #{easemobPass,jdbcType=VARCHAR}
     where uuid = #{uuid,jdbcType=VARCHAR}
   </update>
 </mapper>

+ 24 - 15
src/main/java/com/goafanti/common/mapper/MessageFromSystemMapper.xml

@@ -434,6 +434,7 @@
 			a.message_id as messageId,
 			b.registration_id as registrationId,
 			c.resource_id as resourceId,
+			c.resource_type as resourceType,
 			c.title as messageTitle,
 			c.body as messageBody
 		from
@@ -458,8 +459,11 @@
    			<if test="registrationId != null and registrationId != ''">
    				registration_id = #{registrationId,jdbcType=VARCHAR}
    			</if>
-   			<if test="userName != null and userName != ''">
-   				username = #{userName,jdbcType=VARCHAR}
+   			<if test="easemobName != null and easemobName != ''">
+   				easemob_name = #{easemobName,jdbcType=VARCHAR}
+   			</if>
+   			<if test="easemobPass != null and easemobPass != ''">
+   				easemob_pass = #{easemobPass,jdbcType=VARCHAR}
    			</if>
    			<if test="lastLoginTime != null">
    				last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
@@ -483,20 +487,25 @@
    	 	#{sql,jdbcType=VARCHAR}
    </select>
    
-   <select id="listSystemMessage"  resultMap="BaseResultMap">
+   <select id="listSystemMessage"  resultMap="com.goafanti.message.bo.MessageListBo">
 		select
-			a.id,
-			a.create_time,
+			a.id as messageId,
+			date_format(a.create_time,'%Y-%m-%d %H:%I:%S') as createTime,
 			a.creater,
-			a.consumer_type,
-			a.resource_type,
+			a.consumer_type as consumerType,
+			a.resource_type as resourceType,
 			a.title,
-			a.body
+			a.body,
+			a.is_draft as isDraft
 		from
 			message_from_system a
-		where
-			a.subject = #{subject,jdbcType=INTEGER}
+		where 1= 1
+		<if test="subject != null">
+			and a.subject = #{subject,jdbcType=INTEGER}
+		</if>
+		<if test="isDraft != null">
 			and a.is_draft = #{isDraft,jdbcType=INTEGER}
+		</if>
 			and a.delete_sign = false 
    </select>
    
@@ -521,7 +530,7 @@
 					where
 						consumer_id = #{uid,jdbcType=VARCHAR}
 						and a.read_time is not null
-					<!-- and a.delete_sign = false -->
+						and a.delete_sign = false
 						and b.subject = 1
 					order by
 						a.create_time desc limit 1
@@ -535,7 +544,7 @@
 					where
 						consumer_id = #{uid,jdbcType=VARCHAR}
 						and a.read_time is not null
-					<!-- and a.delete_sign = false -->
+						and a.delete_sign = false
 						and b.subject = 1
 				) t2 on
 				t1.nouse = t2.nouse
@@ -557,7 +566,7 @@
 					where
 						consumer_id = #{uid,jdbcType=VARCHAR}
 						and a.read_time is not null
-					<!-- and a.delete_sign = false -->
+						and a.delete_sign = false
 						and b.subject = 2
 					order by
 						a.create_time desc limit 1
@@ -571,7 +580,7 @@
 					where
 						consumer_id = #{uid,jdbcType=VARCHAR}
 						and a.read_time is not null
-					<!-- and a.delete_sign = false -->
+						and a.delete_sign = false
 						and b.subject = 2
 				) t4 on
 				t3.nouse = t4.nouse
@@ -580,7 +589,7 @@
    
    <select id="listPersonalMessageByPage" resultType="com.goafanti.message.bo.MessageListBo">
 		select
-			b.title,date_format(b.create_time,'%Y-%m-%d %H:%I:%S') as createTime,b.subject, b.resource_type as resourceType
+			b.id as messageId,b.title,date_format(b.create_time,'%Y-%m-%d %H:%I:%S') as createTime,b.subject, b.resource_type as resourceType
 		from
 			message_consumer a left join message_from_system b on
 			a.message_id = b.id

+ 3 - 2
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -1423,8 +1423,9 @@
     		a.head_portrait_url as headPortraitUrl, 
     		a.introduction, 
    			a.is_member as isMember,
-   			b.registration_id registrationId,
-   			b.username
+   			b.registration_id as registrationId,
+   			b.easemob_name as easemobName,
+   			b.easemob_pass as easemobPass
    		from user a left join jpush_easemob_account b 
    			on a.id = b.uid 
    		where 

+ 185 - 230
src/main/java/com/goafanti/common/model/JpushEasemobAccount.java

@@ -3,234 +3,189 @@ package com.goafanti.common.model;
 import java.util.Date;
 
 public class JpushEasemobAccount {
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column jpush_easemob_account.uuid
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    private String uuid;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column jpush_easemob_account.registration_id
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    private String registrationId;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column jpush_easemob_account.username
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    private String username;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column jpush_easemob_account.uid
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    private String uid;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column jpush_easemob_account.tag
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    private String tag;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column jpush_easemob_account.group_id
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    private String groupId;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column jpush_easemob_account.last_login_time
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    private Date lastLoginTime;
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column jpush_easemob_account.uuid
-     *
-     * @return the value of jpush_easemob_account.uuid
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public String getUuid() {
-        return uuid;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column jpush_easemob_account.uuid
-     *
-     * @param uuid the value for jpush_easemob_account.uuid
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column jpush_easemob_account.registration_id
-     *
-     * @return the value of jpush_easemob_account.registration_id
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public String getRegistrationId() {
-        return registrationId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column jpush_easemob_account.registration_id
-     *
-     * @param registrationId the value for jpush_easemob_account.registration_id
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public void setRegistrationId(String registrationId) {
-        this.registrationId = registrationId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column jpush_easemob_account.username
-     *
-     * @return the value of jpush_easemob_account.username
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public String getUsername() {
-        return username;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column jpush_easemob_account.username
-     *
-     * @param username the value for jpush_easemob_account.username
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column jpush_easemob_account.uid
-     *
-     * @return the value of jpush_easemob_account.uid
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public String getUid() {
-        return uid;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column jpush_easemob_account.uid
-     *
-     * @param uid the value for jpush_easemob_account.uid
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public void setUid(String uid) {
-        this.uid = uid;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column jpush_easemob_account.tag
-     *
-     * @return the value of jpush_easemob_account.tag
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public String getTag() {
-        return tag;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column jpush_easemob_account.tag
-     *
-     * @param tag the value for jpush_easemob_account.tag
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public void setTag(String tag) {
-        this.tag = tag;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column jpush_easemob_account.group_id
-     *
-     * @return the value of jpush_easemob_account.group_id
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public String getGroupId() {
-        return groupId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column jpush_easemob_account.group_id
-     *
-     * @param groupId the value for jpush_easemob_account.group_id
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public void setGroupId(String groupId) {
-        this.groupId = groupId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column jpush_easemob_account.last_login_time
-     *
-     * @return the value of jpush_easemob_account.last_login_time
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public Date getLastLoginTime() {
-        return lastLoginTime;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column jpush_easemob_account.last_login_time
-     *
-     * @param lastLoginTime the value for jpush_easemob_account.last_login_time
-     *
-     * @mbg.generated Mon Dec 18 19:12:58 CST 2017
-     */
-    public void setLastLoginTime(Date lastLoginTime) {
-        this.lastLoginTime = lastLoginTime;
-    }
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.uuid
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private String uuid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.registration_id
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private String registrationId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.uid
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private String uid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.tag
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private String tag;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.group_id
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private String groupId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.last_login_time
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private Date lastLoginTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.easemob_name
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private String easemobName;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column jpush_easemob_account.easemob_pass
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	private String easemobPass;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.uuid
+	 * @return  the value of jpush_easemob_account.uuid
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public String getUuid() {
+		return uuid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.uuid
+	 * @param uuid  the value for jpush_easemob_account.uuid
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.registration_id
+	 * @return  the value of jpush_easemob_account.registration_id
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public String getRegistrationId() {
+		return registrationId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.registration_id
+	 * @param registrationId  the value for jpush_easemob_account.registration_id
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setRegistrationId(String registrationId) {
+		this.registrationId = registrationId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.uid
+	 * @return  the value of jpush_easemob_account.uid
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public String getUid() {
+		return uid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.uid
+	 * @param uid  the value for jpush_easemob_account.uid
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.tag
+	 * @return  the value of jpush_easemob_account.tag
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public String getTag() {
+		return tag;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.tag
+	 * @param tag  the value for jpush_easemob_account.tag
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setTag(String tag) {
+		this.tag = tag;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.group_id
+	 * @return  the value of jpush_easemob_account.group_id
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public String getGroupId() {
+		return groupId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.group_id
+	 * @param groupId  the value for jpush_easemob_account.group_id
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setGroupId(String groupId) {
+		this.groupId = groupId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.last_login_time
+	 * @return  the value of jpush_easemob_account.last_login_time
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public Date getLastLoginTime() {
+		return lastLoginTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.last_login_time
+	 * @param lastLoginTime  the value for jpush_easemob_account.last_login_time
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setLastLoginTime(Date lastLoginTime) {
+		this.lastLoginTime = lastLoginTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.easemob_name
+	 * @return  the value of jpush_easemob_account.easemob_name
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public String getEasemobName() {
+		return easemobName;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.easemob_name
+	 * @param easemobName  the value for jpush_easemob_account.easemob_name
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setEasemobName(String easemobName) {
+		this.easemobName = easemobName;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column jpush_easemob_account.easemob_pass
+	 * @return  the value of jpush_easemob_account.easemob_pass
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public String getEasemobPass() {
+		return easemobPass;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column jpush_easemob_account.easemob_pass
+	 * @param easemobPass  the value for jpush_easemob_account.easemob_pass
+	 * @mbg.generated  Thu Dec 21 08:23:35 CST 2017
+	 */
+	public void setEasemobPass(String easemobPass) {
+		this.easemobPass = easemobPass;
+	}
 }

File diff suppressed because it is too large
+ 792 - 763
src/main/java/com/goafanti/common/model/JpushEasemobAccountExample.java


+ 21 - 2
src/main/java/com/goafanti/message/JGMessageHelper.java

@@ -46,8 +46,9 @@ public class JGMessageHelper implements InitializingBean, DisposableBean{
 	private static final int EXCEED_THE_LIMIT = 429;//超过频率限制
 	private static final Logger logger = LoggerFactory.getLogger(JGMessageHelper.class);
 	private static final int MAX_TRYCOUNT = 3;
-	private static final String MESSAGE_ID = "MESSAGE_ID";//消息ID
-	private static final String RESOURCE_ID =  "RESOURCE_ID";//资源ID
+	private static final String MESSAGE_ID = "message_id";//消息ID
+	private static final String RESOURCE_ID =  "resource_id";//资源ID
+	private static final String RESOURCE_TYPE = "resource_type";//资源类型
 	public void send(MessageAdapter messageAdapter){
 		ClientConfig clientConfig = ClientConfig.getInstance();
 	    String host = (String) clientConfig.get(ClientConfig.PUSH_HOST_NAME);
@@ -94,6 +95,7 @@ public class JGMessageHelper implements InitializingBean, DisposableBean{
 					.setMsgContent(mb.getMessageBody())
 					.addExtra(MESSAGE_ID,mb.getMessageId())
 					.addExtra(RESOURCE_ID,mb.getResourceId())
+					.addExtra(RESOURCE_TYPE, mb.getResourceType())
 					.build())
 			.build());
 		send(ma);
@@ -121,4 +123,21 @@ public class JGMessageHelper implements InitializingBean, DisposableBean{
 		
 	}
 
+	public static void main(String[] args) {
+		PushPayload pp = PushPayload.newBuilder()
+		.setPlatform(Platform.android_ios())
+		.setAudience(Audience.newBuilder()
+				.addAudienceTarget(
+						AudienceTarget.registrationId("极光id"))
+				.build())
+		.setMessage(Message.newBuilder()
+				.setTitle("消息标题")
+				.setMsgContent("消息内容")
+				.addExtra(MESSAGE_ID,"消息id")
+				.addExtra(RESOURCE_ID,"资源id")
+				.addExtra(RESOURCE_TYPE, "资源类型")
+				.build())
+		.build();
+		System.out.println(pp.toString());
+	}
 }

+ 8 - 0
src/main/java/com/goafanti/message/bo/MessageBo.java

@@ -25,6 +25,8 @@ public class MessageBo{
 	private String messageBody; 
 	/** 资源ID **/
 	private String resourceId; 
+	/** 资源类型 **/
+	private String resourceType;
 
 	public String getId() {
 		return id;
@@ -92,4 +94,10 @@ public class MessageBo{
 	public void setResourceId(String resourceId) {
 		this.resourceId = resourceId;
 	}
+	public String getResourceType() {
+		return resourceType;
+	}
+	public void setResourceType(String resourceType) {
+		this.resourceType = resourceType;
+	}
 }

+ 28 - 0
src/main/java/com/goafanti/message/bo/MessageListBo.java

@@ -4,9 +4,13 @@ public class MessageListBo {
 	private String messageId;
 	private String title;
 	private String body;
+	private String creater;
 	private String createTime;
 	private String subject;
+	private String consumerType;
 	private String resourceType;
+	private String resourceId;
+	private String isDraft;
 	public String getMessageId() {
 		return messageId;
 	}
@@ -25,6 +29,12 @@ public class MessageListBo {
 	public void setBody(String body) {
 		this.body = body;
 	}
+	public String getCreater() {
+		return creater;
+	}
+	public void setCreater(String creater) {
+		this.creater = creater;
+	}
 	public String getCreateTime() {
 		return createTime;
 	}
@@ -37,10 +47,28 @@ public class MessageListBo {
 	public void setSubject(String subject) {
 		this.subject = subject;
 	}
+	public String getConsumerType() {
+		return consumerType;
+	}
+	public void setConsumerType(String consumerType) {
+		this.consumerType = consumerType;
+	}
 	public String getResourceType() {
 		return resourceType;
 	}
 	public void setResourceType(String resourceType) {
 		this.resourceType = resourceType;
 	}
+	public String getResourceId() {
+		return resourceId;
+	}
+	public void setResourceId(String resourceId) {
+		this.resourceId = resourceId;
+	}
+	public String getIsDraft() {
+		return isDraft;
+	}
+	public void setIsDraft(String isDraft) {
+		this.isDraft = isDraft;
+	}
 }

+ 2 - 2
src/main/java/com/goafanti/message/service/MessageService.java

@@ -79,7 +79,7 @@ public interface MessageService {
 	 * @param jea
 	 * @return
 	 */
-	public int updateJpushEasemobAccount(String uuid,String registrationId,String userName);
+	public int updateJpushEasemobAccount(String uuid,String registrationId,String easemobName, String easemobPass);
 	
 	/**
 	 * 更新
@@ -104,7 +104,7 @@ public interface MessageService {
 	 * @param isDraft
 	 * @return
 	 */
-	List<MessageFromSystem> listSystemMessage(Integer isDraft,Integer subject);
+	List<MessageListBo> listSystemMessage(Integer isDraft,Integer subject);
 	
 	/**
 	 * 更新消息

+ 5 - 5
src/main/java/com/goafanti/message/service/impl/MessageServiceImpl.java

@@ -154,7 +154,7 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 				mp.setMessageId(mfs.getId());
 				mp.setConsumerId(cid);
 			}
-			insertBatchProducer(target);
+			if(target.size()>0) insertBatchProducer(target);
 		}else if(subject == SubjectType.YUN_YING.getTypeCode()){
 			cids = selectSendAdmin(targetMap,targetType).split(",");
 			MessageProducer mp;
@@ -164,7 +164,7 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 				mp.setMessageId(mfs.getId());
 				mp.setConsumerId(cid);
 			}
-			insertBatchProducer(target);
+			if(target.size()>0) insertBatchProducer(target);
 		}
 		return 1;
 	}
@@ -243,8 +243,8 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 	}
 
 	@Override
-	public int updateJpushEasemobAccount(String uuid, String registrationId, String userName) {
-		return messageFromSystemMapper.updateJpushEasemobAccount(uuid, registrationId,userName,TokenManager.getUserId(),new Date());
+	public int updateJpushEasemobAccount(String uuid,String registrationId,String easemobName, String easemobPass) {
+		return messageFromSystemMapper.updateJpushEasemobAccount(uuid, registrationId,easemobName,easemobPass,TokenManager.getUserId(),new Date());
 	}
 
 	@Override
@@ -253,7 +253,7 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 	}
 
 	@Override
-	public List<MessageFromSystem> listSystemMessage(Integer isDraft,Integer subject) {
+	public List<MessageListBo> listSystemMessage(Integer isDraft,Integer subject) {
 		return messageFromSystemMapper.listSystemMessage(isDraft,subject);
 	}
 

+ 2 - 2
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -859,8 +859,8 @@ public class UserApiController extends BaseApiController {
 		if (u != null) {
 			JSONObject res = easemobUtils.send(new EasemobInfo().uri("/users/" + u.getNumber()).method(HttpMethod.GET));
 			JSONObject resultObj = new JSONObject();
-			resultObj.put("password", new SimpleHash("md5", u.getId(), null, 1).toHex());
-			resultObj.put("username", String.valueOf(u.getNumber()));
+			resultObj.put("easemobPass", new SimpleHash("md5", u.getId(), null, 1).toHex());
+			resultObj.put("easemobName", String.valueOf(u.getNumber()));
 			resultObj.put("nickname", StringUtils.isBlank(u.getNickname()) ? "技淘用户" + u.getNumber() : u.getNickname());
 			if (res == null || StringUtils.equals("service_resource_not_found", (CharSequence) res.get("error"))) {
 				easemobUtils.sendLater(

+ 1 - 1
src/main/java/com/goafanti/user/controller/UserLoginController.java

@@ -162,7 +162,7 @@ public class UserLoginController extends BaseController {
 				//新增 message_consumer
 				messageServiceImpl.insertBatchConsumer(consumers);
 			}
-			messageServiceImpl.updateJpushEasemobAccount(null, null, null);
+			messageServiceImpl.updateJpushEasemobAccount(null, null, null,null);
 		}
 	}
 }

+ 5 - 4
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -125,14 +125,15 @@ public class UserRegisterController extends BaseController {
 		User u = TokenManager.getUserToken();
 		if(u != null){
 			JSONObject resultObj = new JSONObject();
-			resultObj.put("password", new SimpleHash("md5", u.getId(), null, 1).toHex());
-			resultObj.put("username", String.valueOf(u.getNumber()));
+			String easemobName =  String.valueOf(u.getNumber());
+			String easemobPass = new SimpleHash("md5", u.getId(), null, 1).toHex();
+			resultObj.put("password", easemobPass);
+			resultObj.put("username", easemobName);
 			resultObj.put("nickname", StringUtils.isBlank(u.getNickname()) ? "技淘用户" + u.getNumber() : u.getNickname());
 			easemobUtils.sendLater(
 					new EasemobInfo().uri("/users/").data(resultObj.toJSONString()).method(HttpMethod.POST));
 			//绑定账号
-			messageServiceImpl.updateJpushEasemobAccount(uuid, null, u.getNumber()+"");
+			messageServiceImpl.updateJpushEasemobAccount(uuid, null, easemobName,easemobPass);
 		}
 	}
-
 }