|
|
|
@@ -1,5 +1,8 @@ |
|
|
|
package com.simple.controller; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.log4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -11,13 +14,16 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.simple.common.Result; |
|
|
|
import com.simple.common.ResultData; |
|
|
|
import com.simple.domain.po.WxCUserBasicInfo; |
|
|
|
import com.simple.domain.po.WxCUserTags; |
|
|
|
import com.simple.domain.po.WxTags; |
|
|
|
import com.simple.service.WxCUserBasicInfoService; |
|
|
|
import com.simple.service.WxCUserTagsService; |
|
|
|
import com.simple.service.WxTagsService; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
@@ -34,6 +40,9 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCUserTagsService wxCUserTagsService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxTagsService wxTagsService; |
|
|
|
|
|
|
|
private Logger logger = Logger.getLogger(WxCUserBasicInfoController.class); |
|
|
|
|
|
|
|
@@ -66,7 +75,17 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
WxCUserTags record =new WxCUserTags(); |
|
|
|
record.setUserId(wxCUserBasicInfo.getcUserId()); |
|
|
|
record.setTenantId(getTenantId()); |
|
|
|
record.setTags(JSON.toJSONString(wxCUserBasicInfo.getTags())); |
|
|
|
PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1); |
|
|
|
if(page.getSize()>0) { |
|
|
|
WxCUserTags t = page.getList().get(0); |
|
|
|
record.setId(t.getId()); |
|
|
|
} |
|
|
|
String tags = wxCUserBasicInfo.getTags(); |
|
|
|
List<Long> tagIdList = new ArrayList<>(); |
|
|
|
for(String t:tags.split(",")) { |
|
|
|
tagIdList.add(Long.valueOf(t)); |
|
|
|
} |
|
|
|
record.setTags(JSON.toJSONString(tagIdList)); |
|
|
|
wxCUserTagsService.saveOrUpdate(record); |
|
|
|
wxCUserBasicInfo.setTagId(record.getId()); |
|
|
|
} |
|
|
|
@@ -87,10 +106,20 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
@ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) |
|
|
|
public ResultData findById(Long id) { |
|
|
|
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); |
|
|
|
info.getTagId(); |
|
|
|
return new ResultData(Result.SUCCESS,"查询成功",wxCUserBasicInfoService.getById(id)); |
|
|
|
if(info.getTagId()!=null) { |
|
|
|
WxCUserTags uTag = wxCUserTagsService.getById(id); |
|
|
|
if(StringUtils.isNotBlank(uTag.getTags())) { |
|
|
|
List<Long> ids = JSONObject.parseArray(uTag.getTags(),Long.class); |
|
|
|
WxTags wxTags =new WxTags(); |
|
|
|
wxTags.setIds(ids); |
|
|
|
PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); |
|
|
|
if(page.getSize()>0) { |
|
|
|
info.setTagList(page.getList()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS,"查询成功",info); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |