|
|
|
@@ -22,10 +22,14 @@ import com.simple.domain.dto.WxCuerBasicInfoDto; |
|
|
|
import com.simple.domain.po.WxCUser; |
|
|
|
import com.simple.domain.po.WxCUserBasicInfo; |
|
|
|
import com.simple.domain.po.WxCUserTags; |
|
|
|
import com.simple.domain.po.WxCoupon; |
|
|
|
import com.simple.domain.po.WxCouponOrder; |
|
|
|
import com.simple.domain.po.WxTags; |
|
|
|
import com.simple.service.WxCUserBasicInfoService; |
|
|
|
import com.simple.service.WxCUserService; |
|
|
|
import com.simple.service.WxCUserTagsService; |
|
|
|
import com.simple.service.WxCouponOrderService; |
|
|
|
import com.simple.service.WxCouponService; |
|
|
|
import com.simple.service.WxTagsService; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@@ -49,6 +53,12 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCUserService wxCUserService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCouponOrderService wxCouponOrderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCouponService wxCouponService; |
|
|
|
|
|
|
|
private Logger logger = Logger.getLogger(WxCUserBasicInfoController.class); |
|
|
|
|
|
|
|
@@ -100,17 +110,18 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
@ApiOperation("根据id更新接口") |
|
|
|
@PostMapping("update") |
|
|
|
public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { |
|
|
|
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); |
|
|
|
wxCUserBasicInfo.setTenantId(getTenantId()); |
|
|
|
if(StringUtils.isNotBlank(wxCUserBasicInfo.getTags())) { |
|
|
|
if(StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { |
|
|
|
WxCUserTags record =new WxCUserTags(); |
|
|
|
record.setUserId(wxCUserBasicInfo.getCUserId()); |
|
|
|
record.setUserId(info.getCUserId()); |
|
|
|
record.setTenantId(getTenantId()); |
|
|
|
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(); |
|
|
|
String tags = wxCUserBasicInfo.getTagIds(); |
|
|
|
List<Long> tagIdList = new ArrayList<>(); |
|
|
|
for(String t:tags.split(",")) { |
|
|
|
tagIdList.add(Long.valueOf(t)); |
|
|
|
@@ -143,13 +154,44 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
WxTags wxTags =new WxTags(); |
|
|
|
wxTags.setIds(ids); |
|
|
|
PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); |
|
|
|
if(page.getSize()>0) { |
|
|
|
info.setTagList(page.getList()); |
|
|
|
String tagNames=""; |
|
|
|
String tagIds=""; |
|
|
|
List<Long> tagIdList = new ArrayList<>(); |
|
|
|
for(WxTags wt:page.getList()) { |
|
|
|
tagNames+=wt.getName()+"/"; |
|
|
|
tagIds+=wt.getId()+","; |
|
|
|
tagIdList.add(wt.getId()); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(tagNames)) { |
|
|
|
info.setTagNames(tagNames.substring(0,tagNames.length()-1)); |
|
|
|
} |
|
|
|
if(StringUtils.isNoneBlank(tagIds)) { |
|
|
|
info.setTagIds(tagIds.substring(0,tagIds.length()-1)); |
|
|
|
} |
|
|
|
long count = wxCUserTagsService.findCountByTag(tagIdList); |
|
|
|
info.setCount(count); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS,"查询成功",info); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id查询接口") |
|
|
|
@GetMapping("/findOrderCouponByUserId") |
|
|
|
@ApiImplicitParam(name="userId",value="userId",dataType="Long", paramType = "query",required=true) |
|
|
|
public ResultData findOrderCouponByUserId(Long userId,Integer pageNum, Integer pageSize) { |
|
|
|
WxCouponOrder corder = new WxCouponOrder(); |
|
|
|
corder.setCUserId(userId); |
|
|
|
corder.setTenantId(getTenantId()); |
|
|
|
PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(corder, pageNum, pageSize); |
|
|
|
if(page.getSize()>0) { |
|
|
|
List<WxCouponOrder> list = page.getList(); |
|
|
|
for(WxCouponOrder c:list) { |
|
|
|
WxCoupon coupon = wxCouponService.getById(c.getCouponId()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(Result.SUCCESS,"查询成功"); |
|
|
|
} |
|
|
|
|
|
|
|
} |