Browse Source

极光推送修改

anderx 7 years ago
parent
commit
6bcf6cd85d

+ 7 - 0
src/main/java/com/goafanti/app/bo/ExpertsListBo.java

@@ -25,6 +25,7 @@ public class ExpertsListBo {
 	private String typicalCase;
 	private String honer;
 	private String goodAtIndustry;
+	private String mobile;
 	public String getUid() {
 		return uid;
 	}
@@ -157,5 +158,11 @@ public class ExpertsListBo {
 	public void setGoodAtIndustry(String goodAtIndustry) {
 		this.goodAtIndustry = goodAtIndustry;
 	}
+	public String getMobile() {
+		return mobile;
+	}
+	public void setMobile(String mobile) {
+		this.mobile = mobile;
+	}
 	
 }

+ 1 - 1
src/main/java/com/goafanti/common/mapper/UserIdentityMapper.xml

@@ -1538,7 +1538,7 @@ select a.create_time as createTime,
 
 
 <select id="selectByIdentityId" resultType="com.goafanti.app.bo.ExpertsListBo">
-	select a.id,a.uid as uid,b.nickname as username,b.society_tag as keyword,a.expert,b.introduction,a.consultant_type as consultantType from user_identity a 
+	select a.id,a.uid as uid,b.mobile,b.nickname as username,b.society_tag as keyword,a.expert,b.introduction,a.consultant_type as consultantType from user_identity a 
     left join user b on a.uid=b.id
     where a.id=#{id,jdbcType=VARCHAR}
 </select>

+ 0 - 1
src/main/java/com/goafanti/message/JGMessageHelper.java

@@ -124,7 +124,6 @@ public class JGMessageHelper implements InitializingBean, DisposableBean{
 					.setPlatform(Platform.android_ios())
 					.setAudience(Audience.all())
 					.setNotification(Notification.newBuilder()
-			        		.setAlert(mp.getTitle())
 			        		.addPlatformNotification(AndroidNotification.newBuilder()
 			        				.addExtra(MESSAGE_ID, mp.getId())
 			        				.addExtra(MESSAGE_BODY, mp.getBody())

+ 35 - 0
src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java

@@ -6,6 +6,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -43,6 +45,7 @@ import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.common.utils.MobileMessageUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -76,6 +79,16 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 	JtCollectSearchMapper	jtCollectSearchMapper;
 	@Value(value="${collect_flag}")
 	private Boolean collectFlag ;
+	@Value(value = "${examineAdopt}")
+	private String					examineAdopt	= null;
+	@Value(value = "${examineNoAdopt}")
+	private String					examineNoAdopt	= null;
+
+	@Value(value = "${accessKey}")
+	private String					accessKey			= null;
+
+	@Value(value = "${accessSecret}")
+	private String					accessSecret		= null;
 	
 
 	private static final Logger	logger	= LoggerFactory.getLogger(UserIdentityServiceImpl.class);
@@ -592,6 +605,7 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 		identity.setAuditStatus(auditStatus);*/
 		if(collectFlag){
 		ExpertsListBo u=userIdentityMapper.selectByIdentityId(identity.getId());
+		String str="";
 		if (identity.getAuditStatus()==2) {
 				JtCollectSearch r=new JtCollectSearch();
 				if(u.getExpert()==1){
@@ -600,9 +614,15 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 				if(u.getExpert()==2){
 					if(u.getConsultantType() == 4){
 						r.setFromTable(collectType.LEGAL_ADVISER.getDesc());
+						str="法律顾问认证";
 					}else{
 						r.setFromTable(collectType.ADVISER.getDesc());
+						str="顾问认证";
 					}
+					//通过后短信通知
+					String code="";
+					examineSendMessage(u, str, examineAdopt);
+					
 				}
 				r.setKeyword(SocietyTagStatus.getStatus(u.getKeyword()).getDesc());
 				r.setTitle(u.getUsername());
@@ -617,10 +637,25 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 		
 		if (identity.getAuditStatus()==4||identity.getAuditStatus()==3) {
 			if(collectFlag)jtCollectSearchMapper.deleteByrowId(u.getUid());
+			//不通过短信通知
+			examineSendMessage(u, str, examineNoAdopt);
 			}
 		}
 		return userIdentityMapper.updateAuditing(identity);
 	}
+
+	private void examineSendMessage(ExpertsListBo u, String str, String code) {
+		//String paramString = "{\"code\":\"" + mobileVerifyCode + "\",\"product\":\"技淘网\"}";
+		String paramString = "{\"audit\":\"" + str  + "}";
+		String regex = "^(1[1-9][0-9])\\d{8}$";
+		Pattern p = Pattern.compile(regex);
+		if (null!=u.getMobile()) {
+				Matcher m = p.matcher(u.getMobile());
+			if ( m.matches()) {
+				MobileMessageUtils.sendMessage(code, paramString, u.getMobile(), accessKey, accessSecret);
+				}
+		}
+	}
 	
 
 	@Override