浏览代码

短信处抛异常

anderx 7 年之前
父节点
当前提交
55a3891354

+ 1 - 0
src/main/java/com/goafanti/common/utils/MobileMessageUtils.java

@@ -44,6 +44,7 @@ public class MobileMessageUtils {
 		} catch (ClientException e) {
 			LoggerUtils.fmtError(MobileMessageUtils.class, e, CLIENT_EXCEPTION, e.getMessage());
 			e.printStackTrace();
+			return "短信异常!";
 		}
 		return null;
 	}

+ 5 - 1
src/main/java/com/goafanti/message/controller/AdminMessageController.java

@@ -342,7 +342,11 @@ public class AdminMessageController extends CertifyApiController{
 		Result res = checkMessageCode(messageCode);
 		if (res.getError().isEmpty()) {
 			//发送消息
-			res.setData(jtMessageProducerService.saveMobileMessage(messageCode));
+			int i=jtMessageProducerService.saveMobileMessage(messageCode);
+			if (i<0) {
+				res.getError().add(buildError(ErrorConstants.M_CODE_ERROR));
+			}
+			res.setData(i);
 		}
 		return res;
 	}

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

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.JtMessageConsumerMapper;
 import com.goafanti.common.dao.JtMessageProducerMapper;
@@ -148,7 +149,10 @@ public class JtMessageProducerServiceImpl  extends BaseMybatisDao<JtMessageProdu
 			}
 		}
 		if(mobile.length()>1)mobile=mobile.substring(0, mobile.length()-1);
-		MobileMessageUtils.sendMessage(messageCode, null, mobile, accessKey, accessSecret);
+		String ret=MobileMessageUtils.sendMessage(messageCode, null, mobile, accessKey, accessSecret);
+		if (StringUtils.isNotBlank(ret)) {
+			return -1;
+		}
 		JtMessageProducer producer=new JtMessageProducer();
 		producer.setId(UUID.randomUUID().toString());
 		producer.setCreater(AFTConstants.DEFAULT_INITIATOR);

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

@@ -27,6 +27,7 @@ import com.goafanti.common.bo.ReletivelyIndustry;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.bo.fieldGlossoryBo;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.DistrictGlossoryMapper;
 import com.goafanti.common.dao.IndustryCategoryMapper;
 import com.goafanti.common.dao.JtCollectSearchMapper;