Commit 8e99a874 by Lee Munkyeong

ネームカード修正

parent 9daff9e1
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class UserUpdateJSON extends AcmsCommonJSON {
public ShopMemberDto shopMemberDto;
public UserUpdateJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject UserInfoJson = json.getJSONObject(ABookCommConstants.KEY.BODY);
if (UserInfoJson == null) { return; }
shopMemberDto = new ShopMemberDto();
ArrayList<Integer> groupIdList = new ArrayList<Integer>();
JSONArray groupIdJsonArray = (JSONArray) UserInfoJson.get(ABookCommConstants.KEY.GROUP_IDS);
for (int i = 0; i < groupIdJsonArray.length(); i++) {
groupIdList.add(groupIdJsonArray.getInt(i));
}
shopMemberDto.groupIdList = groupIdList;
}
}
...@@ -27,6 +27,7 @@ public interface ABookCommConstants { ...@@ -27,6 +27,7 @@ public interface ABookCommConstants {
String GROUP_ID = "groupId"; String GROUP_ID = "groupId";
String GROUP_IDS = "groupIds"; String GROUP_IDS = "groupIds";
String GROUP_PATH_LIST = "groupPathList"; String GROUP_PATH_LIST = "groupPathList";
String IS_FAVORITE = "isFavorite";
String CHILD_GROUP_LIST = "childGroupList"; String CHILD_GROUP_LIST = "childGroupList";
String GROUP_USER_LIST = "groupUserList"; String GROUP_USER_LIST = "groupUserList";
String BODY = "body"; String BODY = "body";
......
...@@ -18,6 +18,7 @@ import jp.agentec.abook.abv.bl.dto.ChatMessageDto; ...@@ -18,6 +18,7 @@ import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto; import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.GroupDto; import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto; import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.StringUtil;
/** /**
* @author Lee-mk * @author Lee-mk
...@@ -71,6 +72,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -71,6 +72,7 @@ public class CommunicationLogic extends AbstractLogic {
Map<String, Object> chatMessageMap = new HashMap<String, Object>(); Map<String, Object> chatMessageMap = new HashMap<String, Object>();
chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId); chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName); chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, chatMessageDto.shopMemberId);
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message);
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType);
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate); chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
...@@ -83,6 +85,22 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -83,6 +85,22 @@ public class CommunicationLogic extends AbstractLogic {
return messageListStr; return messageListStr;
} }
public String getNameCardInfo(Integer shopMemberId) {
JSONObject resultJson = new JSONObject();
ShopMemberDto shopMemberDto = shopMemberDao.getShopMember(shopMemberId);
List<String> groupPathList = groupDao.getUserGroupPathList(shopMemberId);
resultJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMemberDto.shopMemberId);
resultJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMemberDto.shopMemberName);
resultJson.put(ABookCommConstants.KEY.PROFILE_URL, shopMemberDto.profileUrl);
resultJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
if(StringUtil.isNullOrEmpty(shopMemberDto.favoriteRegisterDate)) {
resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else {
resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, true);
}
return resultJson.toString();
}
public String getMyInfo() { public String getMyInfo() {
ShopMemberDto myInfo = shopMemberDao.getMyInfo(); ShopMemberDto myInfo = shopMemberDao.getMyInfo();
...@@ -214,12 +232,14 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -214,12 +232,14 @@ public class CommunicationLogic extends AbstractLogic {
groupSearchData.put(ABookCommConstants.KEY.CHILD_GROUP_LIST,childGroupJSONArray); groupSearchData.put(ABookCommConstants.KEY.CHILD_GROUP_LIST,childGroupJSONArray);
List<ShopMemberDto> shopMemberList = shopMemberDao.getUserListByGroupId(targetGroupId); List<ShopMemberDto> shopMemberList = shopMemberDao.getUserListByGroupId(targetGroupId);
JSONArray shopMemberJSONArray = new JSONArray(); JSONArray shopMemberJSONArray = new JSONArray();
for (ShopMemberDto shopMember : shopMemberList) { for (ShopMemberDto shopMember : shopMemberList) {
Map<String, Object> shopMemberMap = new HashMap<String, Object>(); Map<String, Object> shopMemberMap = new HashMap<String, Object>();
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId); shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName); shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl); shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl);
shopMemberMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupDao.getUserGroupPathList(shopMember.shopMemberId));
JSONObject jsonObject = new JSONObject(shopMemberMap); JSONObject jsonObject = new JSONObject(shopMemberMap);
shopMemberJSONArray.put(jsonObject); shopMemberJSONArray.put(jsonObject);
} }
......
...@@ -787,6 +787,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -787,6 +787,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
String groupInfoStr = communicationLogic.getGroupSearchData(Integer.parseInt(groupId)); String groupInfoStr = communicationLogic.getGroupSearchData(Integer.parseInt(groupId));
return groupInfoStr; return groupInfoStr;
} }
@JavascriptInterface
public String getNameCardData(String shopMemberId) {
String nameCardStr = communicationLogic.getNameCardInfo(Integer.parseInt(shopMemberId));
return nameCardStr;
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment