Michael před 8 roky
rodič
revize
1722240663

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

@@ -86,7 +86,8 @@ public class AdminMessageController extends CertifyApiController{
 		}
 		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.PERSON_CUSTOMER_RETAIL.getTypeCode()) targetMap.put(targetType, userIds);
+		if(targetType == ConsumerType.ORGANIZATION_CUSTOMER_RETAIL.getTypeCode()) targetMap.put(targetType, userIds);
 		if(targetType == ConsumerType.USER_RETAIL.getTypeCode()) targetMap.put(targetType, adminIds);
 		if(targetType == ConsumerType.SOCIETY_TAG.getTypeCode()) targetMap.put(targetType, societyTags);
 		if(targetType == ConsumerType.LOCATION.getTypeCode()){
@@ -158,7 +159,8 @@ public class AdminMessageController extends CertifyApiController{
 			return res;
 		}
 		Map<Integer,String> targetMap = new HashMap<Integer, String>();
-		if(targetType == ConsumerType.CUSTOMER_RETAIL.getTypeCode()) targetMap.put(targetType, userIds);
+		if(targetType == ConsumerType.PERSON_CUSTOMER_RETAIL.getTypeCode()) targetMap.put(targetType, userIds);
+		if(targetType == ConsumerType.ORGANIZATION_CUSTOMER_RETAIL.getTypeCode()) targetMap.put(targetType, userIds);
 		if(targetType == ConsumerType.SOCIETY_TAG.getTypeCode()) targetMap.put(targetType, societyTags);
 		if(targetType == ConsumerType.LOCATION.getTypeCode()){
 			 targetMap.put(targetType, ConsumerType.LOCATION.getTypeName());

+ 8 - 4
src/main/java/com/goafanti/message/enums/ConsumerType.java

@@ -4,8 +4,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 public enum ConsumerType {
-	/** 客户散户 **/
-	CUSTOMER_RETAIL(0,"CUSTOMER_RETAIL"),
+	/** 行业 **/
+	INDUSTRY(0,"INDUSTRY"),
 	/** 社会标签 **/
 	SOCIETY_TAG(1,"SOCIETY_TAG"),
 	/** 省市区 **/
@@ -19,8 +19,12 @@ public enum ConsumerType {
 	ROLE(4,"ROLE"),
 	/** 用户散户 **/
 	USER_RETAIL(5,"USER_RETAIL"),
-	/** 行业 **/
-	INDUSTRY(6,"INDUSTRY"),
+	/** 客户散户 **/
+	CUSTOMER_RETAIL(6,"CUSTOMER_RETAIL"),
+	/** 个人客户 **/
+	PERSON_CUSTOMER_RETAIL(61,"PERSON_CUSTOMER_RETAIL"),
+	/** 单位客户 **/
+	ORGANIZATION_CUSTOMER_RETAIL(61,"ORGANIZATION_CUSTOMER_RETAIL"),
 	/** 没有定义 **/
 	NO_DEFINITION(null,"NO_DEFINITION");
 	private ConsumerType(Integer typeCode, String typeName) {

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

@@ -83,6 +83,15 @@ public interface MessageService {
 	public int updateJpushEasemobAccount(String uuid,String registrationId,String easemobName, String easemobPass);
 	
 	/**
+	 * 新增第三方账号
+	 * @param uuid
+	 * @param easemobName 环信id
+	 * @param easemobPass 环信密码
+	 * @return
+	 */
+	public int addJpushEasemobAccount(String uuid,String easemobName,String easemobPass);
+	
+	/**
 	 * 更新
 	 * @param messageId
 	 * @param uid

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

@@ -44,7 +44,8 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 	private JpushEasemobAccountMapper jpushEasemobAccountMapper;
 	@Override
 	public String selectSendUser(Map<Integer, String> selectMap,Integer type) {
-		if(selectMap.containsKey(ConsumerType.CUSTOMER_RETAIL.getTypeCode())){ //客户散户
+		if(selectMap.containsKey(ConsumerType.PERSON_CUSTOMER_RETAIL.getTypeCode())
+				|| selectMap.containsKey(ConsumerType.ORGANIZATION_CUSTOMER_RETAIL.getTypeCode())){ //客户散户
 			return selectMap.get(ConsumerType.CUSTOMER_RETAIL.getTypeCode());
 		}else if(selectMap.containsKey(ConsumerType.USER_RETAIL.getTypeCode())){
 			return selectMap.get(ConsumerType.USER_RETAIL.getTypeCode()); //用户散户
@@ -140,7 +141,7 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 		mfs.setBody(body);
 		mfs.setCreateTime(createTime);
 		mfs.setSubject(subject);
-		mfs.setConsumerType(targetType);
+		mfs.setConsumerType(getTargetType(targetType));
 		mfs.setIsDraft(isDraft);
 		mfs.setDeleteSign(Boolean.FALSE);
 		if(SecurityUtils.getSubject().getPrincipal() instanceof Admin){
@@ -152,8 +153,9 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 		List<MessageProducer> target = new ArrayList<MessageProducer>();
 		String[] cids;
 		if(subject == SubjectType.KE_HU.getTypeCode()){
-			if(selectSendUser(targetMap,targetType).split(",")!=null){
-				cids = selectSendUser(targetMap,targetType).split(",");
+			String tmp = selectSendUser(targetMap,targetType);
+			if(tmp !=null){
+				cids = tmp.split(",");
 				MessageProducer mp;
 				for(String cid : cids){
 					mp = new MessageProducer();
@@ -165,8 +167,9 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 			}
 				if(target.size()>0) insertBatchProducer(target);					
 		}else if(subject == SubjectType.YUN_YING.getTypeCode()){
-			if(selectSendUser(targetMap,targetType).split(",")!=null){
-				cids = selectSendAdmin(targetMap,targetType).split(",");
+			String tmp = selectSendUser(targetMap,targetType);
+			if(tmp !=null){
+				cids = tmp.split(",");
 				MessageProducer mp;
 				for(String cid : cids){
 					mp = new MessageProducer();
@@ -196,8 +199,8 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 				Date createTime = new Date();
 				message.setCreateTime(createTime);	
 				message.setSubject(subject);
-				message.setConsumerType(targetType);
-				message.setResourceType(getSourceType(sourceType)); //需要适配
+				message.setConsumerType(getTargetType(targetType)); //适配客户类型
+				message.setResourceType(getSourceType(sourceType)); //适配成果需求
 				message.setIsDraft(isDraft);
 				message.setDeleteSign(Boolean.FALSE);
 				if(SecurityUtils.getSubject().getPrincipal() instanceof Admin){
@@ -337,6 +340,18 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 		return sourceType;
 	}
 
+	/**
+	 * 为个人和组织客户做转换
+	 * @param targetType
+	 * @return
+	 */
+	private Integer getTargetType(Integer targetType){
+		if(ConsumerType.PERSON_CUSTOMER_RETAIL.getTypeCode() == targetType
+				|| ConsumerType.ORGANIZATION_CUSTOMER_RETAIL.getTypeCode() == targetType){
+			targetType = ConsumerType.CUSTOMER_RETAIL.getTypeCode();
+		}
+		return targetType;
+	}
 	@Override
 	public JpushEasemobAccount selectSynAccByUid(String uid) {
 		return jpushEasemobAccountMapper.selectSynAccByUid(uid);
@@ -350,4 +365,14 @@ public class MessageServiceImpl  extends BaseMybatisDao<MessageFromSystemMapper>
 		}
 		return result;
 	}
+
+	@Override
+	public int addJpushEasemobAccount(String uuid,String easemobName,String easemobPass) {
+		JpushEasemobAccount jea = new  JpushEasemobAccount();
+		jea.setUid(TokenManager.getUserId());
+		jea.setUuid(uuid);
+		jea.setEasemobName(easemobName);
+		jea.setEasemobPass(easemobPass);
+		return jpushEasemobAccountMapper.insert(jea);
+	}
 }

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

@@ -64,6 +64,10 @@ public class UserRegisterController extends BaseController {
 					UserFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 		}
+		if(StringUtils.isBlank(uuid)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"", "手机串码不能为空"));
+			return res;
+		}
 		// 验证码15分钟有效
 		if (TimeUtils.checkOverTime("register")) {
 			res.getError().add(buildError(ErrorConstants.MCODE_OVERTIME_ERROR, "手机验证码超时失效"));
@@ -132,7 +136,8 @@ public class UserRegisterController extends BaseController {
 			easemobUtils.sendLater(
 					new EasemobInfo().uri("/users/").data(resultObj.toJSONString()).method(HttpMethod.POST));
 			//绑定账号
-			messageService.updateJpushEasemobAccount(uuid, null, easemobName,easemobPass);
+			messageService.addJpushEasemobAccount(uuid,easemobName,easemobPass);
+			
 		}
 	}
 }