| @@ -761,7 +761,13 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| @Override | @Override | ||||
| public void updateTagByUserId(Long cUserId, List<Long> tags) { | public void updateTagByUserId(Long cUserId, List<Long> tags) { | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId); | WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId); | ||||
| WxCUserTags userTags = getById(wxCUserBasicInfo.getTagId()); | |||||
| WxCUserTags userTags = null; | |||||
| if (wxCUserBasicInfo.getTagId() != null) { | |||||
| userTags = getById(wxCUserBasicInfo.getTagId()); | |||||
| } else { | |||||
| userTags = new WxCUserTags(); | |||||
| userTags.setTags("[]"); | |||||
| } | |||||
| List<Long> tagList = JSONArray.parseArray(userTags.getTags(), Long.class); | List<Long> tagList = JSONArray.parseArray(userTags.getTags(), Long.class); | ||||
| //先从现有标签中查看用户是否有 服饰尺码 和 鞋码 类别 有 删除 | //先从现有标签中查看用户是否有 服饰尺码 和 鞋码 类别 有 删除 | ||||
| Long tagId = 0L; | Long tagId = 0L; | ||||
| @@ -781,7 +787,13 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| String tagStr = JSONArray.toJSONString(tagList); | String tagStr = JSONArray.toJSONString(tagList); | ||||
| userTags.setTags(tagStr); | userTags.setTags(tagStr); | ||||
| userTags.setUpdateDate(new Date()); | userTags.setUpdateDate(new Date()); | ||||
| wxCUserTagsMapper.updateById(userTags); | |||||
| if (userTags.getId() != null) { | |||||
| wxCUserTagsMapper.updateById(userTags); | |||||
| } else { | |||||
| userTags.setCreateDate(new Date()); | |||||
| userTags.setUpdateDate(new Date()); | |||||
| wxCUserTagsMapper.insert(userTags); | |||||
| } | |||||
| } | } | ||||
| public Long getTagId(List<Long> tagList, Long id, WxTags wxTags) { | public Long getTagId(List<Long> tagList, Long id, WxTags wxTags) { | ||||