| | |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "类型 1订单收入 4提现 5=佣金收入,7=优惠券收入", name = "type", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CommissionListWarpper>> queryCommissionList(String time, Integer pageNum, Integer pageSize){ |
| | | public ResponseWarpper<List<CommissionListWarpper>> queryCommissionList(String time, Integer pageNum, Integer pageSize,Integer type){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<CommissionListWarpper> list = revenueService.queryCommissionList(uid, time, pageNum, pageSize); |
| | | List<CommissionListWarpper> list = revenueService.queryCommissionList(uid, time, pageNum, pageSize,type); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<CommissionListWarpper> queryCommissionList(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception; |
| | | List<CommissionListWarpper> queryCommissionList(Integer driverId, String time, Integer pageNum, Integer pageSize,Integer type) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.supersavedriving.driver.modular.system.dao.RevenueMapper; |
| | | import com.supersavedriving.driver.modular.system.model.AppUser; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.model.Revenue; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.IAppUserService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Resource |
| | | private AccountChangeDetailMapper accountChangeDetailMapper; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CommissionListWarpper> queryCommissionList(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception { |
| | | public List<CommissionListWarpper> queryCommissionList(Integer driverId, String time, Integer pageNum, Integer pageSize,Integer type) throws Exception { |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | Wrapper<Revenue> wrapper = new EntityWrapper<Revenue>().eq("userType", 2) |
| | | .eq("userId", driverId); |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | objects.add(4); |
| | | objects.add(5); |
| | | objects.add(7); |
| | | Wrapper<AccountChangeDetail> wrapper = new EntityWrapper<AccountChangeDetail>().eq("userType", 2) |
| | | .eq("userId", driverId).eq("type",1).in("changeType",objects); |
| | | if(ToolUtil.isNotEmpty(type)){ |
| | | wrapper.eq("changeType",type); |
| | | } |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | | wrapper.eq("DATE_FORMAT(createTime, '%Y年%m月')", time); |
| | | } |
| | | List<Revenue> revenues = this.selectList(wrapper.last(" order by createTime desc limit " + pageNum + ", " + pageSize)); |
| | | List<AccountChangeDetail> revenues = accountChangeDetailMapper.selectList(wrapper.last(" order by createTime desc limit " + pageNum + ", " + pageSize)); |
| | | List<CommissionListWarpper> list = new ArrayList<>(); |
| | | for (Revenue revenue : revenues) { |
| | | for (AccountChangeDetail revenue : revenues) { |
| | | CommissionListWarpper commissionListWarpper = new CommissionListWarpper(); |
| | | commissionListWarpper.setCreateTime(revenue.getCreateTime().getTime()); |
| | | commissionListWarpper.setAmount(revenue.getAmount()); |
| | | commissionListWarpper.setUserType(revenue.getType()); |
| | | commissionListWarpper.setUserType(revenue.getChangeType()); |
| | | commissionListWarpper.setMoney(revenue.getOldData()); |
| | | if(revenue.getChangeType()==4){ |
| | | commissionListWarpper.setAmount(revenue.getNewData()-revenue.getOldData()); |
| | | }else { |
| | | commissionListWarpper.setAmount(revenue.getOldData()-revenue.getNewData()); |
| | | } |
| | | |
| | | list.add(commissionListWarpper); |
| | | } |
| | | return list; |
| | |
| | | public class CommissionListWarpper { |
| | | @ApiModelProperty("日期") |
| | | private Long createTime; |
| | | @ApiModelProperty("推广类型(1=线上收入,2=佣金,3=优惠券)") |
| | | @ApiModelProperty("推广类型(1=订单收入,4=提现,5=佣金收入,7优惠券收入)") |
| | | private Integer userType; |
| | | @ApiModelProperty("获取佣金") |
| | | private Double amount; |
| | | @ApiModelProperty("余额") |
| | | private Double money; |
| | | } |
| | |
| | | private String code; |
| | | @ApiModelProperty(value = "头像", required = false, dataType = "string") |
| | | private String avatar; |
| | | @ApiModelProperty(value = "姓名", required = false, dataType = "string") |
| | | private String name; |
| | | @ApiModelProperty(value = "手机号码", required = true, dataType = "string") |
| | | private String phone; |
| | | @ApiModelProperty(value = "紧急联系人", required = false, dataType = "string") |