| | |
| | | // 是否异常 |
| | | wrapper.eq("is_exception",2); |
| | | List<TAppUser> tAppUsers = tAppUserService.selectList(wrapper); |
| | | List<TAppUserResp> tAppUserRespList = new ArrayList<>(tAppUsers.size()); |
| | | for (TAppUser tAppUser : tAppUsers) { |
| | | TAppUserResp tAppUserResp = new TAppUserResp(); |
| | | BeanUtils.copyProperties(tAppUser,tAppUserResp); |
| | | |
| | | // 查询当前用户优惠券数量 |
| | | List<TUserToCoupon> tUserToCoupons = tUserToCouponService.selectList(new EntityWrapper<TUserToCoupon>().eq("userId", tAppUser.getId())); |
| | | |
| | | int couponTotal = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); |
| | | int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum(); |
| | | |
| | | // List<TCoupon> tCoupons = tCouponService.selectList(new EntityWrapper<TCoupon>().eq("user_id", tAppUser.getId())); |
| | | // List<TCoupon> notUsedList = tCoupons.stream().filter(coupon -> coupon.getCouponStatus().equals(CouponStatusEnum.NOT_USED.getCode())).collect(Collectors.toList()); |
| | | tAppUserResp.setCouponSum(couponTotal); |
| | | tAppUserResp.setNotUsedCount(validCount); |
| | | List<TOrder> orders = tOrderService.selectList(new EntityWrapper<TOrder>().eq("userId", tAppUser.getId()).orderBy(true,"createTime",false)); |
| | | if(!CollectionUtils.isEmpty(orders)){ |
| | | List<TOrder> collect1 = orders.stream().filter(order->Objects.nonNull(order.getState())) |
| | | .filter(order -> OrderStateEnum.WAIT_EVALUATED.getCode() == order.getState() || |
| | | OrderStateEnum.FINISH.getCode() == order.getState()).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect1)) { |
| | | tAppUserResp.setConsumeSum(collect1.size()); |
| | | // 总消费金额 |
| | | collect1.stream().map(TOrder::getPayMoney).reduce(BigDecimal::add) |
| | | .ifPresent(tAppUserResp::setConsumePrice); |
| | | } |
| | | } |
| | | tAppUserRespList.add(tAppUserResp); |
| | | } |
| | | return tAppUserRespList; |
| | | return tAppUserService.getTAppUserResp(tAppUsers); |
| | | } |
| | | |
| | | |
| | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | TAppUser d = list.get(i); |
| | | values[i] = new String[title.length]; |
| | | values[i][0] = d.getId().toString(); |
| | | values[i][0] = String.valueOf(d.getId()); |
| | | values[i][1] = d.getNickname(); |
| | | values[i][2] = d.getPhone(); |
| | | Integer sex = d.getSex(); |
| | | if(1 == sex){ |
| | | values[i][3] = "男"; |
| | | }else if(2 == sex){ |
| | | values[i][3] = "女"; |
| | | if(Objects.nonNull(sex)){ |
| | | if(1 == sex){ |
| | | values[i][3] = "男"; |
| | | }else if(2 == sex){ |
| | | values[i][3] = "女"; |
| | | } |
| | | }else { |
| | | values[i][3] = "未知"; |
| | | } |
| | |
| | | values[i][6] = d.getUnionid(); |
| | | values[i][7] = d.getEmergencyContact(); |
| | | values[i][8] = d.getEmergencyPhone(); |
| | | values[i][9] = d.getAccountBalance().toString(); |
| | | values[i][10] = d.getUserTagId().toString(); |
| | | values[i][9] = String.valueOf(d.getAccountBalance()); |
| | | values[i][10] = String.valueOf(d.getUserTagId()); |
| | | Integer status1 = d.getStatus(); |
| | | if(1 == status1){ |
| | | values[i][11] = "正常"; |
| | |
| | | wrapper.eq("is_exception",2); |
| | | List<TAppUser> list = tAppUserService.selectList(wrapper); |
| | | |
| | | List<TAppUserExceptionExport> exportList = new ArrayList<>(list.size()); |
| | | /*List<TAppUserExceptionExport> exportList = new ArrayList<>(list.size()); |
| | | for (TAppUser tAppUser : list) { |
| | | TAppUserExceptionExport export = new TAppUserExceptionExport(); |
| | | BeanUtils.copyProperties(tAppUser,export); |
| | |
| | | tCoupons = tCoupons.stream().filter(coupon->coupon.getCouponStatus().equals(CouponStatusEnum.NOT_USED.getCode())).collect(Collectors.toList()); |
| | | // 剩余优惠券 |
| | | export.setRemainingCoupons(tCoupons.size()); |
| | | // TODO 查询消费记录 |
| | | // 查询消费记录 |
| | | exportList.add(export); |
| | | }*/ |
| | | List<TAppUserResp> tAppUserRespList = tAppUserService.getTAppUserResp(list); |
| | | List<TAppUserExceptionExport> exportList = new ArrayList<>(list.size()); |
| | | for (TAppUserResp tAppUserResp : tAppUserRespList) { |
| | | TAppUserExceptionExport export = new TAppUserExceptionExport(); |
| | | BeanUtils.copyProperties(tAppUserResp,export); |
| | | // 优惠券总数 |
| | | export.setCouponsSum(tAppUserResp.getCouponSum()); |
| | | // 剩余优惠券 |
| | | export.setRemainingCoupons(tAppUserResp.getNotUsedCount()); |
| | | export.setConsumptionTimes(tAppUserResp.getConsumeSum()); |
| | | export.setHistoricalConsumption(tAppUserResp.getConsumePrice()); |
| | | export.setLastConsumptionTime(tAppUserResp.getLastConsumptionTime()); |
| | | exportList.add(export); |
| | | } |
| | | String[][] values = new String[list.size()][]; |
| | |
| | | values[i][1] = d.getId().toString(); |
| | | values[i][2] = d.getNickname(); |
| | | values[i][3] = d.getPhone(); |
| | | values[i][4] = d.getRemainingCoupons().toString(); |
| | | values[i][5] = d.getCouponsSum().toString(); |
| | | values[i][6] = d.getConsumptionTimes().toString(); |
| | | values[i][7] = d.getHistoricalConsumption().toString(); |
| | | values[i][4] = String.valueOf(d.getRemainingCoupons()); |
| | | values[i][5] = String.valueOf(d.getCouponsSum()); |
| | | values[i][6] = String.valueOf(Objects.nonNull(d.getConsumptionTimes())?d.getConsumptionTimes():0); |
| | | values[i][7] = String.valueOf(Objects.nonNull(d.getHistoricalConsumption())?d.getHistoricalConsumption():0); |
| | | if(Objects.nonNull(d.getLastConsumptionTime())){ |
| | | values[i][8] = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(d.getLastConsumptionTime()); |
| | | }else { |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TCashWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.ITCashWithdrawalService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2023-03-23 10:14:44 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tCashWithdrawal") |
| | | public class TCashWithdrawalController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tCashWithdrawal/"; |
| | | |
| | | @Autowired |
| | | private ITCashWithdrawalService tCashWithdrawalService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tCashWithdrawal.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/tCashWithdrawal_add") |
| | | public String tCashWithdrawalAdd() { |
| | | return PREFIX + "tCashWithdrawal_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tCashWithdrawal_update/{tCashWithdrawalId}") |
| | | public String tCashWithdrawalUpdate(@PathVariable Integer tCashWithdrawalId, Model model) { |
| | | TCashWithdrawal tCashWithdrawal = tCashWithdrawalService.selectById(tCashWithdrawalId); |
| | | model.addAttribute("item",tCashWithdrawal); |
| | | LogObjectHolder.me().set(tCashWithdrawal); |
| | | return PREFIX + "tCashWithdrawal_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return tCashWithdrawalService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TCashWithdrawal tCashWithdrawal) { |
| | | tCashWithdrawalService.insert(tCashWithdrawal); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCashWithdrawalId) { |
| | | tCashWithdrawalService.deleteById(tCashWithdrawalId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TCashWithdrawal tCashWithdrawal) { |
| | | tCashWithdrawalService.updateById(tCashWithdrawal); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tCashWithdrawalId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tCashWithdrawalId") Integer tCashWithdrawalId) { |
| | | return tCashWithdrawalService.selectById(tCashWithdrawalId); |
| | | } |
| | | } |
| | |
| | | TAppUserDetailOrderResp tAppUserDetailOrderResp = new TAppUserDetailOrderResp(); |
| | | BeanUtils.copyProperties(tOrder,tAppUserDetailOrderResp); |
| | | |
| | | // TODO 计算总里程 |
| | | |
| | | // 计算总里程 |
| | | if(Objects.nonNull(tOrder.getActualMileage())){ |
| | | tAppUserDetailOrderResp.setMileageSum(tOrder.getActualMileage()/1000); |
| | | } |
| | | |
| | | // 计算总时长 |
| | | long travelTimeSum = DateUtil.between(tAppUserDetailOrderResp.getBoardingTime(), tAppUserDetailOrderResp.getGetoffTime(), DateUnit.MINUTE); |
| | | long travelTimeSum = 0; |
| | | if(Objects.nonNull(tAppUserDetailOrderResp.getBoardingTime()) && Objects.nonNull(tAppUserDetailOrderResp.getGetoffTime())){ |
| | | travelTimeSum = DateUtil.between(tAppUserDetailOrderResp.getBoardingTime(), tAppUserDetailOrderResp.getGetoffTime(), DateUnit.MINUTE); |
| | | } |
| | | tAppUserDetailOrderResp.setTravelTimeSum(Integer.valueOf(Long.toString(travelTimeSum))); |
| | | |
| | | list.add(tAppUserDetailOrderResp); |
| | |
| | | }else if(2 == source1){ |
| | | values[i][2] = "司机创建"; |
| | | } |
| | | values[i][3] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d.getStartTime()); |
| | | if(Objects.nonNull(d.getStartTime())){ |
| | | values[i][3] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d.getStartTime()); |
| | | }else { |
| | | values[i][3] = ""; |
| | | } |
| | | values[i][4] = d.getUserName(); |
| | | values[i][5] = d.getUserPhone(); |
| | | values[i][6] = d.getStartAddress(); |
| | |
| | | }else if(2 == source1){ |
| | | values[i][2] = "司机创建"; |
| | | } |
| | | values[i][3] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d.getStartTime()); |
| | | if(Objects.nonNull(d.getStartTime())){ |
| | | values[i][3] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d.getStartTime()); |
| | | }else { |
| | | values[i][3] = ""; |
| | | } |
| | | values[i][4] = d.getUserName(); |
| | | values[i][5] = d.getUserPhone(); |
| | | values[i][6] = d.getStartAddress(); |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | public class TAppUserResp extends TAppUser { |
| | | |
| | |
| | | @ApiModelProperty(value = "历史消费") |
| | | private BigDecimal consumePrice; |
| | | |
| | | @ApiModelProperty(value = "最后一次消费时间") |
| | | private Date lastConsumptionTime; |
| | | |
| | | public Date getLastConsumptionTime() { |
| | | return lastConsumptionTime; |
| | | } |
| | | |
| | | public void setLastConsumptionTime(Date lastConsumptionTime) { |
| | | this.lastConsumptionTime = lastConsumptionTime; |
| | | } |
| | | |
| | | public Integer getCouponSum() { |
| | | return couponSum; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.TCashWithdrawal; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 提现记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-03-23 |
| | | */ |
| | | @Mapper |
| | | public interface TCashWithdrawalMapper extends BaseMapper<TCashWithdrawal> { |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.TCashWithdrawalMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCashWithdrawal"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="userDriverId" property="userDriverId" /> |
| | | <result column="code" property="code" /> |
| | | <result column="businessType" property="businessType" /> |
| | | <result column="amount" property="amount" /> |
| | | <result column="state" property="state" /> |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, type, userDriverId, code, businessType, amount, state, orderNumber, createTime |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | private Integer couponsSum; |
| | | |
| | | @ApiModelProperty(value = "消费次数") |
| | | private Integer ConsumptionTimes = 0; |
| | | private Integer consumptionTimes = 0; |
| | | |
| | | @ApiModelProperty(value = "历史消费") |
| | | private BigDecimal HistoricalConsumption = new BigDecimal("0.00"); |
| | | private BigDecimal historicalConsumption = new BigDecimal("0.00"); |
| | | |
| | | @ApiModelProperty(value = "最后一次消费时间") |
| | | private Date lastConsumptionTime; |
| | | |
| | | public Integer getConsumptionTimes() { |
| | | return consumptionTimes; |
| | | } |
| | | |
| | | public void setConsumptionTimes(Integer consumptionTimes) { |
| | | this.consumptionTimes = consumptionTimes; |
| | | } |
| | | |
| | | public BigDecimal getHistoricalConsumption() { |
| | | return historicalConsumption; |
| | | } |
| | | |
| | | public void setHistoricalConsumption(BigDecimal historicalConsumption) { |
| | | this.historicalConsumption = historicalConsumption; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | |
| | | public void setCouponsSum(Integer couponsSum) { |
| | | this.couponsSum = couponsSum; |
| | | } |
| | | |
| | | public Integer getConsumptionTimes() { |
| | | return ConsumptionTimes; |
| | | } |
| | | |
| | | public void setConsumptionTimes(Integer consumptionTimes) { |
| | | ConsumptionTimes = consumptionTimes; |
| | | } |
| | | |
| | | public BigDecimal getHistoricalConsumption() { |
| | | return HistoricalConsumption; |
| | | } |
| | | |
| | | public void setHistoricalConsumption(BigDecimal historicalConsumption) { |
| | | HistoricalConsumption = historicalConsumption; |
| | | } |
| | | |
| | | public Date getLastConsumptionTime() { |
| | |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 是否显示 1是 0否 |
| | | */ |
| | | private Boolean isShow; |
| | | |
| | | /** |
| | | * 上下架 1上架 2下架 |
| | | */ |
| | | private Integer upDown; |
| | | |
| | | public Boolean getIsShow() { |
| | | return isShow; |
| | | } |
| | | |
| | | public void setIsShow(Boolean isShow) { |
| | | this.isShow = isShow; |
| | | } |
| | | |
| | | public Integer getUpDown() { |
| | | return upDown; |
| | | } |
| | | |
| | | public void setUpDown(Integer upDown) { |
| | | this.upDown = upDown; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 提现记录 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-03-23 |
| | | */ |
| | | @TableName("t_cash_withdrawal") |
| | | public class TCashWithdrawal extends Model<TCashWithdrawal> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=用户,2=司机) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 用户或司机id |
| | | */ |
| | | private Integer userDriverId; |
| | | /** |
| | | * 提现编号 |
| | | */ |
| | | private String code; |
| | | /** |
| | | * 交易类型 11佣金提现 12余额提现 |
| | | */ |
| | | private Integer businessType; |
| | | /** |
| | | * 提现金额 |
| | | */ |
| | | private BigDecimal amount; |
| | | /** |
| | | * 提现状态 1未成功 2成功 |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 第三方流水号 |
| | | */ |
| | | private String orderNumber; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getUserDriverId() { |
| | | return userDriverId; |
| | | } |
| | | |
| | | public void setUserDriverId(Integer userDriverId) { |
| | | this.userDriverId = userDriverId; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public Integer getBusinessType() { |
| | | return businessType; |
| | | } |
| | | |
| | | public void setBusinessType(Integer businessType) { |
| | | this.businessType = businessType; |
| | | } |
| | | |
| | | public BigDecimal getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(BigDecimal amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getOrderNumber() { |
| | | return orderNumber; |
| | | } |
| | | |
| | | public void setOrderNumber(String orderNumber) { |
| | | this.orderNumber = orderNumber; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TCashWithdrawal{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", userDriverId=" + userDriverId + |
| | | ", code=" + code + |
| | | ", businessType=" + businessType + |
| | | ", amount=" + amount + |
| | | ", state=" + state + |
| | | ", orderNumber=" + orderNumber + |
| | | ", createTime=" + createTime + |
| | | "}"; |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "折扣优惠金额") |
| | | private BigDecimal discountAmount; |
| | | @ApiModelProperty(value = "实际里程(米)") |
| | | private Integer actualMileage; |
| | | |
| | | public Integer getActualMileage() { |
| | | return actualMileage; |
| | | } |
| | | |
| | | public void setActualMileage(Integer actualMileage) { |
| | | this.actualMileage = actualMileage; |
| | | } |
| | | |
| | | public String getRouteRecord() { |
| | | return routeRecord; |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAppUserResp; |
| | | import com.stylefeng.guns.modular.system.model.TAppUser; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import org.springframework.ui.Model; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | EntityWrapper<TAppUser> getUserListWrapper(String createTime, String nickname, String phone, Integer id, Integer status); |
| | | |
| | | /** |
| | | * 用户异常列表封装返回数据 |
| | | * @param tAppUsers |
| | | * @return |
| | | */ |
| | | List<TAppUserResp> getTAppUserResp(List<TAppUser> tAppUsers); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.TCashWithdrawal; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 提现记录 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-03-23 |
| | | */ |
| | | public interface ITCashWithdrawalService extends IService<TCashWithdrawal> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAppUserResp; |
| | | import com.stylefeng.guns.modular.system.dao.TCouponMapper; |
| | | import com.stylefeng.guns.modular.system.dao.TOrderMapper; |
| | | import com.stylefeng.guns.modular.system.dao.TUserToCouponMapper; |
| | |
| | | import com.stylefeng.guns.modular.system.model.TUserToCoupon; |
| | | import com.stylefeng.guns.modular.system.service.ITAppUserService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.ui.Model; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | wrapper.ne("status", StatusEnum.DELETE.getCode()); |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | public List<TAppUserResp> getTAppUserResp(List<TAppUser> tAppUsers) { |
| | | List<TAppUserResp> tAppUserRespList = new ArrayList<>(tAppUsers.size()); |
| | | for (TAppUser tAppUser : tAppUsers) { |
| | | TAppUserResp tAppUserResp = new TAppUserResp(); |
| | | BeanUtils.copyProperties(tAppUser,tAppUserResp); |
| | | |
| | | // 查询当前用户优惠券数量 |
| | | List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().eq("userId", tAppUser.getId())); |
| | | |
| | | int couponTotal = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); |
| | | int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum(); |
| | | |
| | | // List<TCoupon> tCoupons = tCouponService.selectList(new EntityWrapper<TCoupon>().eq("user_id", tAppUser.getId())); |
| | | // List<TCoupon> notUsedList = tCoupons.stream().filter(coupon -> coupon.getCouponStatus().equals(CouponStatusEnum.NOT_USED.getCode())).collect(Collectors.toList()); |
| | | tAppUserResp.setCouponSum(couponTotal); |
| | | tAppUserResp.setNotUsedCount(validCount); |
| | | List<TOrder> orders = tOrderMapper.selectList(new EntityWrapper<TOrder>().eq("userId", tAppUser.getId()).orderBy(true,"createTime",false)); |
| | | if(!CollectionUtils.isEmpty(orders)){ |
| | | // 最后一次消费时间 |
| | | tAppUserResp.setLastConsumptionTime(orders.get(0).getCreateTime()); |
| | | List<TOrder> collect1 = orders.stream().filter(order->Objects.nonNull(order.getState())) |
| | | .filter(order -> OrderStateEnum.WAIT_EVALUATED.getCode() == order.getState() || |
| | | OrderStateEnum.FINISH.getCode() == order.getState()).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect1)) { |
| | | tAppUserResp.setConsumeSum(collect1.size()); |
| | | // 总消费金额 |
| | | collect1.stream().map(TOrder::getPayMoney).reduce(BigDecimal::add) |
| | | .ifPresent(tAppUserResp::setConsumePrice); |
| | | } |
| | | } |
| | | tAppUserRespList.add(tAppUserResp); |
| | | } |
| | | return tAppUserRespList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.TCashWithdrawal; |
| | | import com.stylefeng.guns.modular.system.dao.TCashWithdrawalMapper; |
| | | import com.stylefeng.guns.modular.system.service.ITCashWithdrawalService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 提现记录 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-03-23 |
| | | */ |
| | | @Service |
| | | public class TCashWithdrawalServiceImpl extends ServiceImpl<TCashWithdrawalMapper, TCashWithdrawal> implements ITCashWithdrawalService { |
| | | |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.enums.PayStatusEnum; |
| | | import com.stylefeng.guns.modular.system.enums.StatusEnum; |
| | | import com.stylefeng.guns.modular.system.enums.UserTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import org.apache.poi.hdf.extractor.TC; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.ZoneId; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private ITRegionService itRegionService; |
| | | @Autowired |
| | | private HttpUtils httpUtils; |
| | | |
| | | @Autowired |
| | | private TRechargeRecordMapper tRechargeRecordMapper; |
| | | @Autowired |
| | | private TCashWithdrawalMapper tCashWithdrawalMapper; |
| | | |
| | | @Override |
| | | public EntityWrapper<TDriver> getPageList(String createTime, String phone, Integer status) { |
| | |
| | | |
| | | if(!CollectionUtils.isEmpty(tOrders)){ |
| | | //累计订单量 |
| | | List<TOrder> cumulativeOrderCount = tOrders.stream().filter(order -> order.getDriverId().equals(tDriver.getId()) |
| | | List<TOrder> cumulativeOrderCount = tOrders.stream().filter(order -> tDriver.getId().equals(order.getDriverId()) |
| | | && order.getState().equals(OrderStateEnum.WAIT_EVALUATED.getCode()) && order.getState().equals(OrderStateEnum.FINISH.getCode())).collect(Collectors.toList()); |
| | | model.addAttribute("cumulativeOrderCount",cumulativeOrderCount.size()); |
| | | //当月订单量 |
| | | List<TOrder> monthOrderCount = tOrders.stream().filter(order -> order.getDriverId().equals(tDriver.getId()) |
| | | List<TOrder> monthOrderCount = tOrders.stream().filter(order -> tDriver.getId().equals(order.getDriverId()) |
| | | && order.getState().equals(OrderStateEnum.WAIT_EVALUATED.getCode()) && order.getState().equals(OrderStateEnum.FINISH.getCode()) |
| | | && new SimpleDateFormat("yyyyMM").format(order.getCreateTime()).equals(monthDate)).collect(Collectors.toList()); |
| | | model.addAttribute("monthOrderCount",monthOrderCount.size()); |
| | | // 拒单次数 |
| | | List<TOrderRefusal> driverRefusalList = tOrderRefusalMapper.selectList(new EntityWrapper<TOrderRefusal>().eq("driver_id", tDriver.getId())); |
| | | model.addAttribute("refusalCount",driverRefusalList.size()); |
| | | // todo 累计收入 |
| | | model.addAttribute("cumulativeIncome",0); |
| | | // 累计收入 司机提现记录加上余额减去充值金额,为累计收入 |
| | | List<TCashWithdrawal> tCashWithdrawals = tCashWithdrawalMapper.selectList(new EntityWrapper<TCashWithdrawal>() |
| | | .eq("type", UserTypeEnum.DRIVER.getCode()) |
| | | .eq("userDriverId", tDriver.getId()) |
| | | .eq("state", 2)); |
| | | BigDecimal balance = tDriver.getBalance(); |
| | | if(!CollectionUtils.isEmpty(tCashWithdrawals)){ |
| | | Optional<BigDecimal> reduce = tCashWithdrawals.stream().map(TCashWithdrawal::getAmount).reduce(BigDecimal::add); |
| | | if(reduce.isPresent()){ |
| | | balance = balance.add(reduce.get()); |
| | | } |
| | | } |
| | | List<TRechargeRecord> tRechargeRecords = tRechargeRecordMapper.selectList(new EntityWrapper<TRechargeRecord>() |
| | | .eq("type", UserTypeEnum.DRIVER.getCode()) |
| | | .eq("userId", tDriver.getId()) |
| | | .eq("payType", 1) |
| | | .eq("payStatus", PayStatusEnum.FINISH.getCode())); |
| | | if(!CollectionUtils.isEmpty(tRechargeRecords)){ |
| | | Optional<BigDecimal> reduce = tRechargeRecords.stream().map(TRechargeRecord::getAmount).reduce(BigDecimal::add); |
| | | if(reduce.isPresent()){ |
| | | balance = balance.subtract(reduce.get()); |
| | | } |
| | | } |
| | | // 减去充值金额 |
| | | model.addAttribute("cumulativeIncome",balance); |
| | | }else { |
| | | model.addAttribute("cumulativeOrderCount",0); |
| | | model.addAttribute("monthOrderCount",0); |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>添加</h5> |
| | | </div> |
| | | <div class="ibox-content" id="broadcastInfoForm"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | |
| | | <div class="col-sm-12" style="cursor: pointer;text-align: right;"> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div style="background-color: gray;height: 35px;line-height: 35px"> |
| | | <label style="color: #0C0C0C">滚动消息</label> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >消息内容:</label> |
| | | <input id="content" name="content" type="text" maxlength="200" style="height: 30px" required="required"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >排序:</label> |
| | | <input id="sort" name="sort" type="number" style="height: 30px" maxlength="4" placeholder="请输入" required="required"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >是否显示:</label> |
| | | <select class="input-group col-sm-6" id="isShow" style="width: 180px;height: 30px" name="isShow"> |
| | | <option value="">选择是否显示</option> |
| | | <option value="1">是</option> |
| | | <option value="0">否</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TBranchOfficeInfoDlg.close()"/> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TBranchOfficeInfoDlg.addSubmit()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!--<div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | |
| | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div>--> |
| | | <script src="${ctxPath}/static/modular/system/tBroadcast/tBroadcast_info.js"></script> |
| | | @} |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="id" name="主键" value="${item.id}" underline="true"/> |
| | | <#input id="content" name="消息内容" value="${item.content}" underline="true"/> |
| | | <#input id="sort" name="排序" value="${item.sort}" /> |
| | | </div> |
| | | |
| | | <div class="col-sm-6"> |
| | | <#input id="status" name="状态(1=正常,2=冻结,3=删除)" value="${item.status}" underline="true"/> |
| | | <#input id="createTime" name="添加时间" value="${item.createTime}" /> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>编辑</h5> |
| | | </div> |
| | | <div class="ibox-content" id="broadcastInfoForm"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TBroadcastInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TBroadcastInfoDlg.close()"/> |
| | | <div class="col-sm-12" style="cursor: pointer;text-align: right;"> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div style="background-color: gray;height: 35px;line-height: 35px"> |
| | | <label style="color: #0C0C0C">滚动消息</label> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >消息内容:</label> |
| | | <input id="content" value="${content}" type="text" maxlength="200" style="height: 30px" required="required"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >排序:</label> |
| | | <input id="sort" value="${sort}" type="number" style="height: 30px" maxlength="4" placeholder="请输入" required="required"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >是否显示:</label> |
| | | <select class="input-group col-sm-6" id="isShow" style="width: 180px;height: 30px" name="isShow"> |
| | | <option value="">选择是否显示</option> |
| | | <option value="1">是</option> |
| | | <option value="0">否</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TBranchOfficeInfoDlg.close()"/> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TBranchOfficeInfoDlg.addSubmit()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tBroadcast/tBroadcast_info.js"></script> |
| | |
| | | {title: '优惠券总数', field: 'couponSum', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '消费次数', field: 'consumeSum', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '历史消费', field: 'consumePrice', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '最后一次消费时间', field: 'emergencyContact', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '最后一次消费时间', field: 'lastConsumptionTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.status === 1){ |
| | | return '<span>正常</span>' |
| | | }else if (row.status === 2){ |
| | | return '<span>冻结</span>' |
| | | }else if (row.status === 3){ |
| | | return '<span>已删除</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '操作', visible: true, align: 'center', valign: 'middle',width:150, |
| | | formatter: function (value, row) { |
| | | if (row.status === 1){ |
| | |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加', |
| | | area: ['800px', '420px'], //宽高 |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tBroadcast/tBroadcast_add' |
| | |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['800px', '420px'], //宽高 |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tBroadcast/tBroadcast_update/' + TBroadcast.seItem.id |
| | |
| | | return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +' ' + |
| | | '<a href="#" onclick="TDriver.stop('+row.id+','+row.status+')" style="color:red">冻结</a>' +' ' + |
| | | '<a href="#" onclick="TDriver.updateInfo('+row.id+')" style="color:green">编辑</a>' |
| | | }else if (row.status === 2){ |
| | | }else if (row.status === 2 || row.approvalStatus === 2){ |
| | | return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +' ' + |
| | | '<a href="#" onclick="TDriver.start('+row.id+','+row.status+')" style="color:green">解冻</a>' |
| | | } |