Commit 4146f156 by Lee Munkyeong

Merge branch 'features/#487_ネームカードのグループパースが3件まで表示される。' into 'features/abcomm_sp6'

グループパース取得方法修正。

See merge request !100
parents 6ac18d62 30a9c9da
......@@ -49,6 +49,17 @@ public class ChatGroupDao extends AbstractDao {
return rawQueryGetDtoList(sql.toString(), null, ChatGroupDto.class);
}
public List<ChatGroupDto> getUserGroups(Integer shopMemberId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT cg.group_id ");
sql.append(" ,cg.parent_group_id ");
sql.append(" ,cg.group_name ");
sql.append(" ,cg.favorite_register_date ");
sql.append(" FROM m_chat_group cg INNER JOIN r_shop_member_group rsmg ON cg.group_id = rsmg.group_id");
sql.append(" WHERE rsmg.shop_member_id = ?");
return rawQueryGetDtoList(sql.toString(), new String[] {"" + shopMemberId}, ChatGroupDto.class);
}
public List<String> getMyGroupPathList() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
......
......@@ -39,4 +39,8 @@ public class ChatGroupDto extends AbstractDto {
public String[] getKeyValues() {
return new String[]{"" + groupId};
}
public String getGroupName() {
return groupName;
}
}
......@@ -8,6 +8,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
......@@ -147,19 +148,24 @@ public class CommunicationLogic extends AbstractLogic {
public String getNameCardInfo(Integer shopMemberId) {
JSONObject resultJson = new JSONObject();
ShopMemberDto shopMemberDto = shopMemberDao.getShopMember(shopMemberId);
List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(shopMemberId);
JSONArray groupPathArray = new JSONArray();
for (ChatGroupDto chatGroupDto : groupPathList){
List<ChatGroupDto> userGroupList = chatGroupDao.getUserGroups(shopMemberId);
JSONArray groupPathJsonArray = new JSONArray();
for (ChatGroupDto userGroup : userGroupList) {
List<ChatGroupDto> gorupPathList = chatGroupDao.getGroupTree(userGroup.groupId);
List<String> groupPathString = new ArrayList<String>();
for (ChatGroupDto group : gorupPathList) {
groupPathString.add(group.groupName);
}
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, userGroup.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, StringUtil.join(" / ", groupPathString));
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
groupPathJsonArray.put(jsonObject);
}
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, groupPathArray);
resultJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathJsonArray);
boolean hasRegisteredDate = StringUtil.isNullOrEmpty(shopMemberDto.favoriteRegisterDate) == false;
resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, hasRegisteredDate);
......
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