单身团/代理团,bug修复
This commit is contained in:
parent
fa54ea9ddc
commit
2ca59e4baa
|
|
@ -1,15 +1,19 @@
|
|||
package com.ruoyi.web.controller.app;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.core.domain.Result;
|
||||
import com.ruoyi.system.domain.TbUser;
|
||||
import com.ruoyi.system.domain.TbUserImg;
|
||||
import com.ruoyi.system.domain.TbUserMatch;
|
||||
import com.ruoyi.system.domain.TbUserSingle;
|
||||
import com.ruoyi.system.service.ITbUserImgService;
|
||||
import com.ruoyi.system.service.ITbUserMatchService;
|
||||
import com.ruoyi.system.service.ITbUserService;
|
||||
import com.ruoyi.system.service.ITbUserSingleService;
|
||||
import com.ruoyi.web.request.MatchRegisterReq;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -17,7 +21,9 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>登陆相关接口</p>
|
||||
|
|
@ -28,15 +34,77 @@ import java.util.List;
|
|||
@RequestMapping(value = "/app/match")
|
||||
public class TbUserMatchAppController {
|
||||
|
||||
@Autowired
|
||||
private ITbUserService tbUserService;
|
||||
|
||||
@Autowired
|
||||
private ITbUserMatchService tbUserMatchService;
|
||||
|
||||
@Autowired
|
||||
private ITbUserImgService tbUserImgService;
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/registerSingleList")
|
||||
@ApiOperation(value = "我的单身团", httpMethod = "POST")
|
||||
@ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "当前页码", required = true, dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", required = true, dataType = "int") })
|
||||
public Result<PageInfo<TbUserSingle>> registerSingleList(@RequestBody MatchRegisterReq registerReq,
|
||||
@RequestParam("pageNum") int pageNum,
|
||||
@RequestParam("pageSize") int pageSize)
|
||||
{
|
||||
List<Long> ids = new ArrayList<>();
|
||||
List<TbUser> tbUsers = tbUserService.lambdaQuery().eq(TbUser::getRegisterUserId, registerReq.getMatchUserId()).list();
|
||||
if(CollectionUtil.isNotEmpty(tbUsers)){
|
||||
ids = tbUsers.stream().map(TbUser::getId).collect(Collectors.toList());
|
||||
}
|
||||
if(CollectionUtil.isEmpty(ids)){
|
||||
return Result.success(PageInfo.of(new ArrayList<>()));
|
||||
}
|
||||
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<TbUserSingle> list = tbUserSingleService.lambdaQuery()
|
||||
.eq(registerReq.getSex() != null, TbUserSingle::getSex, registerReq.getSex())
|
||||
.in(TbUserSingle::getUserId, ids)
|
||||
.list();
|
||||
list.forEach(model->{
|
||||
if(model.getBirthday() != null){
|
||||
model.setAge(DateUtil.ageOfNow(model.getBirthday()));
|
||||
}
|
||||
model.setTbUserImgList(tbUserImgService.lambdaQuery().eq(TbUserImg::getUserId, model.getUserId()).list());
|
||||
});
|
||||
return Result.success(PageInfo.of(list));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ITbUserSingleService tbUserSingleService;
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/registerMatchList")
|
||||
@ApiOperation(value = "我的代理团", httpMethod = "POST")
|
||||
@ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "当前页码", required = true, dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", required = true, dataType = "int") })
|
||||
public Result<PageInfo<TbUserMatch>> registerMatchList(@RequestBody MatchRegisterReq registerReq,
|
||||
@RequestParam("pageNum") int pageNum,
|
||||
@RequestParam("pageSize") int pageSize)
|
||||
{
|
||||
List<Long> ids = new ArrayList<>();
|
||||
List<TbUser> tbUsers = tbUserService.lambdaQuery().eq(TbUser::getRegisterUserId, registerReq.getMatchUserId()).list();
|
||||
if(CollectionUtil.isNotEmpty(tbUsers)){
|
||||
ids = tbUsers.stream().map(TbUser::getId).collect(Collectors.toList());
|
||||
}
|
||||
if(CollectionUtil.isEmpty(ids)){
|
||||
return Result.success(PageInfo.of(new ArrayList<>()));
|
||||
}
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<TbUserMatch> list = tbUserMatchService.lambdaQuery()
|
||||
.in(TbUserMatch::getUserId, ids)
|
||||
.list();
|
||||
list.forEach(model->{
|
||||
model.setTbUserImgList(tbUserImgService.lambdaQuery().eq(TbUserImg::getUserId, model.getUserId()).list());
|
||||
});
|
||||
return Result.success(PageInfo.of(list));
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "填写合伙人信息", httpMethod = "POST")
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class TbUserSingleAppController {
|
|||
}else {
|
||||
notExcludeSex = recommendReq.getSex();
|
||||
}
|
||||
int randomPageNum = 1 + (int) (20 * Math.random());
|
||||
int randomPageNum = 1 + (int) (6 * Math.random());
|
||||
PageHelper.startPage(randomPageNum, pageSize);
|
||||
List<TbUserSingle> list = tbUserSingleService.lambdaQuery()
|
||||
.ne(ObjectUtil.isNotEmpty(notExcludeSex), TbUserSingle::getSex, notExcludeSex)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.web.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>代理团/单身团</p>
|
||||
* @author clunt
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "媒婆代理和单身团请求对象")
|
||||
public class MatchRegisterReq {
|
||||
|
||||
@ApiModelProperty(value = "媒婆用户id")
|
||||
private Long matchUserId;
|
||||
|
||||
@ApiModelProperty(value = "性别,单身团使用")
|
||||
private Integer sex;
|
||||
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ public class AdapayServiceImpl implements AdapayService {
|
|||
paymentParams.put("app_id", adapayConfig.getAppId());
|
||||
paymentParams.put("order_no", orderNo);
|
||||
paymentParams.put("pay_channel", "alipay");
|
||||
paymentParams.put("pay_amt", "0.01");
|
||||
paymentParams.put("pay_amt", "1999");
|
||||
paymentParams.put("goods_title", "全民脱单合伙人开通");
|
||||
paymentParams.put("goods_desc", "全民脱单合伙人资格开通");
|
||||
paymentParams.put("div_members", "");
|
||||
|
|
@ -70,7 +70,7 @@ public class AdapayServiceImpl implements AdapayService {
|
|||
tbUserMatchOrder.setOrderNo(orderNo);
|
||||
tbUserMatchOrder.setPayStatus("Paying");
|
||||
// 测试订单,目前均为0.01元
|
||||
tbUserMatchOrder.setOrderMoney(BigDecimal.valueOf(0.01));
|
||||
tbUserMatchOrder.setOrderMoney(BigDecimal.valueOf(1999));
|
||||
tbUserMatchOrderService.insertTbUserMatchOrder(tbUserMatchOrder);
|
||||
return resp;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue