| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TDriverCommissionResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordAgentResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordUserResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.stylefeng.guns.modular.system.service.ITRechargeRecordService; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | model.addAttribute("item",tRechargeRecord); |
| | | LogObjectHolder.me().set(tRechargeRecord); |
| | | return PREFIX + "tRechargeRecord_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到用户充值列表 |
| | | */ |
| | | @RequestMapping("/userRecharge") |
| | | public String userRecharge() { |
| | | return PREFIX + "tRechargeRecordUser.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到代理商充值列表 |
| | | */ |
| | | @RequestMapping("/agentRecharge") |
| | | public String agentRecharge() { |
| | | return PREFIX + "tRechargeRecordAgent.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户充值列表 |
| | | */ |
| | | @RequestMapping(value = "/userRechargeList") |
| | | @ResponseBody |
| | | public Object userRechargeList(String userName,String userPhone,String code,String createTime) { |
| | | return tRechargeRecordService.userRecharge(userName,userPhone,code,createTime); |
| | | } |
| | | |
| | | /** |
| | | * 获取代理商充值列表 |
| | | */ |
| | | @RequestMapping(value = "/agentRechargeList") |
| | | @ResponseBody |
| | | public Object agentRechargeList(String driverName,String driverPhone,String createTime) { |
| | | return tRechargeRecordService.agentRechargeList(driverName,driverPhone,createTime); |
| | | } |
| | | |
| | | /** |
| | |
| | | public Object detail(@PathVariable("tRechargeRecordId") Integer tRechargeRecordId) { |
| | | return tRechargeRecordService.selectById(tRechargeRecordId); |
| | | } |
| | | |
| | | @ApiOperation(value = "导出用户充值列表",notes="导出用户充值列表") |
| | | @RequestMapping(value = "/exportUserRecharge") |
| | | @ResponseBody |
| | | public void exportUserRecharge(String userName,String userPhone,String code,String createTime, HttpServletResponse response) { |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time1 = format.format(date); |
| | | String fileName = "UserRechargeRecord"+time1+".xls"; |
| | | String[] title = new String[] {"充值时间","流水ID","用户姓名","用户手机号","充值金额", |
| | | "充值方式","状态"}; |
| | | List<TRechargeRecordUserResp> userRechargeList = tRechargeRecordService.userRecharge(userName,userPhone,code,createTime); |
| | | |
| | | String[][] values = new String[userRechargeList.size()][]; |
| | | for (int i = 0; i < userRechargeList.size(); i++) { |
| | | TRechargeRecordUserResp d = userRechargeList.get(i); |
| | | values[i] = new String[title.length]; |
| | | values[i][0] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d.getCreateTime()); |
| | | values[i][1] = d.getCode(); |
| | | values[i][2] = d.getUserName(); |
| | | values[i][3] = d.getUserPhone(); |
| | | values[i][4] = String.valueOf(Objects.nonNull(d.getAmount())?d.getAmount(): BigDecimal.ZERO); |
| | | Integer payType = d.getPayType(); |
| | | if(1 == payType){ |
| | | values[i][5] = "微信"; |
| | | }else if(2 == payType){ |
| | | values[i][5] = "系统充值"; |
| | | }else{ |
| | | values[i][5] = "其他"; |
| | | } |
| | | Integer status1 = d.getPayStatus(); |
| | | if(1 == status1){ |
| | | values[i][6] = "失败"; |
| | | }else if(2 == status1){ |
| | | values[i][6] = "成功"; |
| | | } |
| | | } |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null); |
| | | ExcelUtil.setResponseHeader(response, fileName); |
| | | OutputStream os = response.getOutputStream(); |
| | | wb.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "导出代理商充值列表",notes="导出代理商充值列表") |
| | | @RequestMapping(value = "/exportAgentRecharge") |
| | | @ResponseBody |
| | | public void exportAgentRecharge(String driverName,String driverPhone,String createTime, HttpServletResponse response) { |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time1 = format.format(date); |
| | | String fileName = "AgentRechargeRecord"+time1+".xls"; |
| | | String[] title = new String[] {"充值时间","代理商姓名","联系电话","代理区域","司机姓名","司机手机号","充值金额", |
| | | "充值方式","状态"}; |
| | | List<TRechargeRecordAgentResp> agentRechargeList = tRechargeRecordService.agentRechargeList(driverName,driverPhone,createTime); |
| | | |
| | | String[][] values = new String[agentRechargeList.size()][]; |
| | | for (int i = 0; i < agentRechargeList.size(); i++) { |
| | | TRechargeRecordAgentResp d = agentRechargeList.get(i); |
| | | values[i] = new String[title.length]; |
| | | values[i][0] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d.getCreateTime()); |
| | | values[i][1] = d.getPrincipal(); |
| | | values[i][2] = d.getPrincipalPhone(); |
| | | values[i][3] = d.getProvinceName()+d.getCityName(); |
| | | values[i][4] = d.getDriverName(); |
| | | values[i][5] = d.getDriverPhone(); |
| | | values[i][6] = String.valueOf(Objects.nonNull(d.getAmount())?d.getAmount(): BigDecimal.ZERO); |
| | | Integer payType = d.getPayType(); |
| | | if(1 == payType){ |
| | | values[i][7] = "微信"; |
| | | }else if(2 == payType){ |
| | | values[i][7] = "系统充值"; |
| | | }else{ |
| | | values[i][7] = "其他"; |
| | | } |
| | | Integer status1 = d.getPayStatus(); |
| | | if(1 == status1){ |
| | | values[i][8] = "失败"; |
| | | }else if(2 == status1){ |
| | | values[i][8] = "成功"; |
| | | } |
| | | } |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null); |
| | | ExcelUtil.setResponseHeader(response, fileName); |
| | | OutputStream os = response.getOutputStream(); |
| | | wb.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.resp; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | public class TRechargeRecordAgentResp extends TRechargeRecord { |
| | | |
| | | @ApiModelProperty(value = "司机姓名") |
| | | private String driverName; |
| | | |
| | | @ApiModelProperty(value = "司机手机号") |
| | | private String driverPhone; |
| | | |
| | | @ApiModelProperty(value = "代理商姓名") |
| | | private String principal; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String principalPhone; |
| | | @ApiModelProperty(value = "省份") |
| | | private String provinceName; |
| | | |
| | | @ApiModelProperty(value = "市区") |
| | | private String cityName; |
| | | |
| | | @ApiModelProperty(value = "代理区域") |
| | | private String area; |
| | | |
| | | public String getCityName() { |
| | | return cityName; |
| | | } |
| | | |
| | | public void setCityName(String cityName) { |
| | | this.cityName = cityName; |
| | | } |
| | | |
| | | public String getProvinceName() { |
| | | return provinceName; |
| | | } |
| | | |
| | | public void setProvinceName(String provinceName) { |
| | | this.provinceName = provinceName; |
| | | } |
| | | |
| | | public String getDriverName() { |
| | | return driverName; |
| | | } |
| | | |
| | | public void setDriverName(String driverName) { |
| | | this.driverName = driverName; |
| | | } |
| | | |
| | | public String getDriverPhone() { |
| | | return driverPhone; |
| | | } |
| | | |
| | | public void setDriverPhone(String driverPhone) { |
| | | this.driverPhone = driverPhone; |
| | | } |
| | | |
| | | public String getPrincipal() { |
| | | return principal; |
| | | } |
| | | |
| | | public void setPrincipal(String principal) { |
| | | this.principal = principal; |
| | | } |
| | | |
| | | public String getPrincipalPhone() { |
| | | return principalPhone; |
| | | } |
| | | |
| | | public void setPrincipalPhone(String principalPhone) { |
| | | this.principalPhone = principalPhone; |
| | | } |
| | | |
| | | public String getArea() { |
| | | return area; |
| | | } |
| | | |
| | | public void setArea(String area) { |
| | | this.area = area; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.resp; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | public class TRechargeRecordUserResp extends TRechargeRecord { |
| | | |
| | | @ApiModelProperty(value = "用户姓名") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String userPhone; |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getUserPhone() { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) { |
| | | this.userPhone = userPhone; |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordAgentResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordUserResp; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-02-20 |
| | | * @since 2023-03-10 |
| | | */ |
| | | @Mapper |
| | | public interface TRechargeRecordMapper extends BaseMapper<TRechargeRecord> { |
| | | |
| | | /** |
| | | * 用户充值记录查询 |
| | | * @param userName 用户名 |
| | | * @param userPhone 用户手机号 |
| | | * @param code 流水号 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return List<TRechargeRecordUserResp> |
| | | */ |
| | | List<TRechargeRecordUserResp> userRecharge(@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("userName")String userName, |
| | | @Param("userPhone")String userPhone, @Param("code")String code); |
| | | |
| | | List<TRechargeRecordAgentResp> agentRechargeList(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("driverName")String driverName, |
| | | @Param("driverPhone")String driverPhone, @Param("roleType")Integer roleType, @Param("objectId")Integer objectId); |
| | | } |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, type, userId, code, amount, payType, payTime, payStatus, orderNumber, createTime |
| | | id, `type`, userId, code, amount, payType, payTime, payStatus, orderNumber, createTime |
| | | </sql> |
| | | <select id="userRecharge" resultType="com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordUserResp"> |
| | | select rr.id, rr.`type`, rr.userId, rr.code, rr.amount, rr.payType, rr.payTime, rr.payStatus, rr.orderNumber, rr.createTime,au.nickname AS userName,au.phone AS userPhone |
| | | from t_recharge_record rr |
| | | left join t_app_user au on rr.userId = au.id |
| | | <where> |
| | | <if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
| | | AND rr.createTime between #{startTime} and #{endTime} |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | AND au.nickname LIKE concat('%',#{userName},'%') |
| | | </if> |
| | | <if test="userPhone != null and userPhone != ''"> |
| | | AND au.phone LIKE concat('%',#{userPhone},'%') |
| | | </if> |
| | | <if test="code != null and code != ''"> |
| | | AND rr.code LIKE concat('%',#{code},'%') |
| | | </if> |
| | | AND rr.`type` = 1 |
| | | </where> |
| | | ORDER BY rr.createTime DESC |
| | | </select> |
| | | <select id="agentRechargeList" resultType="com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordAgentResp"> |
| | | select rr.id, rr.`type`, rr.userId, rr.code, rr.amount, rr.payType, rr.payTime, rr.payStatus, rr.orderNumber, rr.createTime, |
| | | d.name AS driverName,d.phone AS driverPhone,a.principal,a.principalPhone,a.provinceName,a.cityName |
| | | from t_recharge_record rr |
| | | left join t_driver d on rr.userId = d.id |
| | | left join t_agent a on d.agentId = a.id |
| | | <where> |
| | | <if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
| | | AND rr.createTime between #{startTime} and #{endTime} |
| | | </if> |
| | | <if test="driverName != null and driverName != ''"> |
| | | AND d.name LIKE concat('%',#{driverName},'%') |
| | | </if> |
| | | <if test="driverPhone != null and driverPhone != ''"> |
| | | AND d.phone LIKE concat('%',#{driverPhone},'%') |
| | | </if> |
| | | <if test="roleType != null and roleType == 3"> |
| | | AND a.id = #{objectId} |
| | | </if> |
| | | AND rr.`type` = 3 |
| | | </where> |
| | | ORDER BY rr.createTime DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-02-20 |
| | | * @since 2023-03-10 |
| | | */ |
| | | @TableName("t_recharge_record") |
| | | public class TRechargeRecord extends Model<TRechargeRecord> { |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=用户,2=司机) |
| | | * 数据类型(1=用户,2=司机,3 = 代理商) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | |
| | | */ |
| | | private BigDecimal amount; |
| | | /** |
| | | * 支付方式(1=微信) |
| | | * 支付方式(1=微信 2 = 系统充值) |
| | | */ |
| | | private Integer payType; |
| | | /** |
| | |
| | | * 添加时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | private Integer agentId; |
| | | |
| | | public Integer getAgentId() { |
| | | return agentId; |
| | | } |
| | | |
| | | public void setAgentId(Integer agentId) { |
| | | this.agentId = agentId; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordAgentResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordUserResp; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-02-20 |
| | | * @since 2023-03-10 |
| | | */ |
| | | public interface ITRechargeRecordService extends IService<TRechargeRecord> { |
| | | |
| | | /** |
| | | * 用户充值记录查询 |
| | | * @param userName 用户名 |
| | | * @param userPhone 用户手机号 |
| | | * @param code 流水号 |
| | | * @param createTime 充值时间 |
| | | * @return List<TRechargeRecordUserResp> |
| | | */ |
| | | List<TRechargeRecordUserResp> userRecharge(String userName, String userPhone, String code, String createTime); |
| | | |
| | | /** |
| | | * |
| | | * @param driverName 司机姓名 |
| | | * @param driverPhone 司机手机号 |
| | | * @param createTime 充值时间 |
| | | * @return List<TRechargeRecordAgentResp> |
| | | */ |
| | | List<TRechargeRecordAgentResp> agentRechargeList(String driverName, String driverPhone, String createTime); |
| | | } |
| | |
| | | |
| | | if(!CollectionUtils.isEmpty(tOrders)){ |
| | | // 订单总量 |
| | | List<TOrder> orderList = tOrders.stream().filter(order -> order.getAgentId().equals(tAgent.getId())).collect(Collectors.toList()); |
| | | List<TOrder> orderList = tOrders.stream().filter(order -> tAgent.getId().equals(order.getAgentId())).collect(Collectors.toList()); |
| | | tAgentResp.setOrderSum(orderList.size()); |
| | | // 过滤已完成和待评价订单,且支付金额在14元以上 |
| | | List<TOrder> orders = tOrders.stream().filter(order -> (order.getState().equals(OrderStateEnum.FINISH.getCode()) || order.getState().equals(OrderStateEnum.WAIT_EVALUATED.getCode())) |
| | | && 0 < order.getPayMoney().compareTo(new BigDecimal("14")) && order.getAgentId().equals(tAgent.getId())).collect(Collectors.toList()); |
| | | && 0 < order.getPayMoney().compareTo(new BigDecimal("14")) && tAgent.getId().equals(order.getAgentId())).collect(Collectors.toList()); |
| | | tAgentResp.setValidOrder(orders.size()); |
| | | // 过滤已使用优惠券 |
| | | List<TOrder> usedCoupon = tOrders.stream().filter(order -> (order.getState().equals(OrderStateEnum.FINISH.getCode()) || order.getState().equals(OrderStateEnum.WAIT_EVALUATED.getCode())) |
| | | && Objects.nonNull(order.getCouponId()) && order.getAgentId().equals(tAgent.getId())).collect(Collectors.toList()); |
| | | && Objects.nonNull(order.getCouponId()) && tAgent.getId().equals(order.getAgentId())).collect(Collectors.toList()); |
| | | tAgentResp.setUsedCoupon(usedCoupon.size()); |
| | | // 已使用优惠券金额求和,已使用优惠券id |
| | | List<Integer> usedCouponId = usedCoupon.stream().map(TOrder::getCouponId).collect(Collectors.toList()); |
| | |
| | | |
| | | if(!CollectionUtils.isEmpty(tCoupons)){ |
| | | // 过滤代理商发放的优惠券 |
| | | List<TCoupon> coupons = tCoupons.stream().filter(coupon -> coupon.getAgentId().equals(tAgent.getId())).collect(Collectors.toList()); |
| | | List<TCoupon> coupons = tCoupons.stream().filter(coupon -> tAgent.getId().equals(coupon.getAgentId())).collect(Collectors.toList()); |
| | | tAgentResp.setIssuedCoupon(coupons.size()); |
| | | } |
| | | |
| | |
| | | |
| | | for (TBranchOfficeResp tBranchOfficeResp : tBranchOfficeRespList) { |
| | | |
| | | List<TOrder> orderList = orders.stream().filter(t -> t.getBranchOfficeId().equals(tBranchOfficeResp.getId())).collect(Collectors.toList()); |
| | | List<TOrder> orderList = orders.stream().filter(t -> tBranchOfficeResp.getId().equals(t.getBranchOfficeId())).collect(Collectors.toList()); |
| | | |
| | | if(!CollectionUtils.isEmpty(orderList)){ |
| | | |
| | | // 订单数据 |
| | | tBranchOfficeResp.setOrderCount(orderList.size());// 订单数量 |
| | | List<TOrder> effectiveOrder = orderList.stream().filter(order -> order.getPayMoney().compareTo(new BigDecimal("15")) > 0).collect(Collectors.toList()); |
| | | List<TOrder> effectiveOrder = orderList.stream().filter(order -> Objects.nonNull(order.getPayMoney()) && order.getPayMoney().compareTo(new BigDecimal("15")) > 0).collect(Collectors.toList()); |
| | | tBranchOfficeResp.setEffectiveOrderCount(effectiveOrder.size());// 有效订单 |
| | | |
| | | // 优惠券数据,,,通过订单找到该区域的下单人,找出优惠券信息 |
| | |
| | | tDriverResp.setBranchName(tBranchOffice.getPrincipal()); |
| | | } |
| | | //累计订单量 |
| | | 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()); |
| | | tDriverResp.setCumulativeOrderCount(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()); |
| | | tDriverResp.setMonthOrderCount(monthOrderCount.size()); |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordAgentResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordUserResp; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.stylefeng.guns.modular.system.dao.TRechargeRecordMapper; |
| | | import com.stylefeng.guns.modular.system.service.ITRechargeRecordService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2023-02-20 |
| | | * @since 2023-03-10 |
| | | */ |
| | | @Service |
| | | public class TRechargeRecordServiceImpl extends ServiceImpl<TRechargeRecordMapper, TRechargeRecord> implements ITRechargeRecordService { |
| | | |
| | | @Autowired |
| | | private TRechargeRecordMapper tRechargeRecordMapper; |
| | | |
| | | @Override |
| | | public List<TRechargeRecordUserResp> userRecharge(String userName, String userPhone, String code, String createTime) { |
| | | String startTime = null; |
| | | String endTime = null; |
| | | // 开始,结束时间 |
| | | if(StringUtils.hasLength(createTime)){ |
| | | String[] split = createTime.split(" - "); |
| | | startTime = split[0]; |
| | | endTime = split[1]; |
| | | } |
| | | return tRechargeRecordMapper.userRecharge(startTime,endTime,userName,userPhone,code); |
| | | } |
| | | |
| | | @Override |
| | | public List<TRechargeRecordAgentResp> agentRechargeList(String driverName, String driverPhone, String createTime) { |
| | | String startTime = null; |
| | | String endTime = null; |
| | | // 开始,结束时间 |
| | | if(StringUtils.hasLength(createTime)){ |
| | | String[] split = createTime.split(" - "); |
| | | startTime = split[0]; |
| | | endTime = split[1]; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | List<TRechargeRecordAgentResp> tRechargeRecordAgentRespList = tRechargeRecordMapper.agentRechargeList(startTime, endTime, driverName, driverPhone, roleType, objectId); |
| | | for (TRechargeRecordAgentResp tRechargeRecordAgentResp : tRechargeRecordAgentRespList) { |
| | | tRechargeRecordAgentResp.setArea(tRechargeRecordAgentResp.getProvinceName()+tRechargeRecordAgentResp.getCityName()); |
| | | } |
| | | return tRechargeRecordAgentRespList; |
| | | } |
| | | } |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <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"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-2"> |
| | | <#NameCon id="driverName" name="司机姓名" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#NameCon id="driverPhone" name="司机手机号" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#TimeCon id="createTime" name="充值时间" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TRechargeRecordAgent.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="TRechargeRecordAgent.resetSearch()" space="true"/> |
| | | </div> |
| | | <div class="col-sm-12"> |
| | | <button type="button" class="btn btn-primary " onclick="TRechargeRecordAgent.export()" id="export"> |
| | | <i class="fa "></i> 导出 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | <!--<div class="hidden-xs" id="TRechargeRecordTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/tRechargeRecord/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="TRechargeRecord.openAddTRechargeRecord()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tRechargeRecord/update")){ |
| | | <#button name="修改" icon="fa-edit" clickFun="TRechargeRecord.openTRechargeRecordDetail()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tRechargeRecord/delete")){ |
| | | <#button name="删除" icon="fa-remove" clickFun="TRechargeRecord.delete()" space="true"/> |
| | | @} |
| | | </div>--> |
| | | <#table id="TRechargeRecordAgentTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tRechargeRecord/tRechargeRecordAgent.js"></script> |
| | | <script type="text/javascript"> |
| | | laydate.render({ |
| | | elem: '#createTime', |
| | | type: 'date', |
| | | range: true |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <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"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-2"> |
| | | <#NameCon id="userName" name="用户姓名" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#NameCon id="userPhone" name="用户手机号" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#NameCon id="code" name="流水ID" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#TimeCon id="createTime" name="充值时间" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TRechargeRecordUser.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="TRechargeRecordUser.resetSearch()" space="true"/> |
| | | </div> |
| | | <div class="col-sm-12"> |
| | | <button type="button" class="btn btn-primary " onclick="TRechargeRecordUser.export()" id="export"> |
| | | <i class="fa "></i> 导出 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TRechargeRecordTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/tRechargeRecord/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="TRechargeRecord.openAddTRechargeRecord()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tRechargeRecord/update")){ |
| | | <#button name="修改" icon="fa-edit" clickFun="TRechargeRecord.openTRechargeRecordDetail()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tRechargeRecord/delete")){ |
| | | <#button name="删除" icon="fa-remove" clickFun="TRechargeRecord.delete()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="TRechargeRecordUserTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tRechargeRecord/tRechargeRecordUser.js"></script> |
| | | <script type="text/javascript"> |
| | | laydate.render({ |
| | | elem: '#createTime', |
| | | type: 'date', |
| | | range: true |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var TRechargeRecordAgent = { |
| | | id: "TRechargeRecordAgentTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TRechargeRecordAgent.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '完成支付时间', field: 'payTime', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '充值时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '代理商姓名', field: 'principal', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '联系电话', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '代理区域', field: 'area', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '三方流水号', field: 'orderNumber', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '数据类型(1=用户,2=司机)', field: 'type', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '司机id', field: 'userId', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '司机姓名', field: 'driverName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '司机手机号', field: 'driverPhone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '充值金额', field: 'amount', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '充值方式', field: 'payType', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.payType === 1){ |
| | | return '<span>微信</span>' |
| | | }else if (row.payType === 2){ |
| | | return '<span>系统充值</span>' |
| | | }else{ |
| | | return '<span>其他</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '状态', field: 'payStatus', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.payStatus === 1){ |
| | | return '<span>失败</span>' |
| | | }else if (row.payStatus === 2){ |
| | | return '<span>成功</span>' |
| | | } |
| | | } |
| | | } |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TRechargeRecordAgent.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TRechargeRecordAgent.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 点击添加 |
| | | */ |
| | | TRechargeRecordAgent.openAddTRechargeRecord = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加', |
| | | area: ['800px', '420px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tRechargeRecord/tRechargeRecord_add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看详情 |
| | | */ |
| | | TRechargeRecordAgent.openTRechargeRecordDetail = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['800px', '420px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tRechargeRecord/tRechargeRecord_update/' + TRechargeRecordAgent.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | TRechargeRecordAgent.delete = function () { |
| | | if (this.check()) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tRechargeRecord/delete", function (data) { |
| | | Feng.success("删除成功!"); |
| | | TRechargeRecordAgent.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("tRechargeRecordId",this.seItem.id); |
| | | ajax.start(); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 司机信息导出 |
| | | */ |
| | | TRechargeRecordAgent.export=function(){ |
| | | var createTime=$("#createTime").val() |
| | | var driverName=$("#driverName").val() |
| | | var driverPhone=$("#driverPhone").val() |
| | | window.location.href=Feng.ctxPath + "/tRechargeRecord/exportAgentRecharge?createTime="+createTime |
| | | +"&driverName"+driverName |
| | | +"&driverPhone="+driverPhone |
| | | ; |
| | | } |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TRechargeRecordAgent.search = function () { |
| | | var queryData = {}; |
| | | queryData['driverName'] = $("#driverName").val(); |
| | | queryData['driverPhone'] = $("#driverPhone").val(); |
| | | queryData['createTime'] = $("#createTime").val(); |
| | | TRechargeRecordAgent.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | /** |
| | | * 重置 |
| | | */ |
| | | TRechargeRecordAgent.resetSearch = function (){ |
| | | $("#createTime").val(''); |
| | | $("#driverName").val(''); |
| | | $("#driverPhone").val(''); |
| | | TRechargeRecordAgent.search(); |
| | | } |
| | | |
| | | $(function () { |
| | | var defaultColunms = TRechargeRecordAgent.initColumn(); |
| | | var table = new BSTable(TRechargeRecordAgent.id, "/tRechargeRecord/agentRechargeList", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TRechargeRecordAgent.table = table.init(); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var TRechargeRecordUser = { |
| | | id: "TRechargeRecordUserTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TRechargeRecordUser.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '完成支付时间', field: 'payTime', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '充值时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '流水ID', field: 'code', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '三方流水号', field: 'orderNumber', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '数据类型(1=用户,2=司机)', field: 'type', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '用户id', field: 'userId', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '用户姓名', field: 'userName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '用户手机号', field: 'userPhone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '充值金额', field: 'amount', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '充值方式', field: 'payType', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.payType === 1){ |
| | | return '<span>微信</span>' |
| | | }else if (row.payType === 2){ |
| | | return '<span>系统充值</span>' |
| | | }else{ |
| | | return '<span>其他</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '状态', field: 'payStatus', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.payStatus === 1){ |
| | | return '<span>失败</span>' |
| | | }else if (row.payStatus === 2){ |
| | | return '<span>成功</span>' |
| | | } |
| | | } |
| | | } |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TRechargeRecordUser.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TRechargeRecordUser.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 点击添加 |
| | | */ |
| | | TRechargeRecordUser.openAddTRechargeRecord = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加', |
| | | area: ['800px', '420px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tRechargeRecord/tRechargeRecord_add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看详情 |
| | | */ |
| | | TRechargeRecordUser.openTRechargeRecordDetail = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['800px', '420px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tRechargeRecord/tRechargeRecord_update/' + TRechargeRecordUser.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | TRechargeRecordUser.delete = function () { |
| | | if (this.check()) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tRechargeRecord/delete", function (data) { |
| | | Feng.success("删除成功!"); |
| | | TRechargeRecordUser.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("tRechargeRecordId",this.seItem.id); |
| | | ajax.start(); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 司机信息导出 |
| | | */ |
| | | TRechargeRecordUser.export=function(){ |
| | | var createTime=$("#createTime").val() |
| | | var userName=$("#userName").val() |
| | | var userPhone=$("#userPhone").val() |
| | | var code=$("#code").val() |
| | | window.location.href=Feng.ctxPath + "/tRechargeRecord/exportUserRecharge?createTime="+createTime |
| | | +"&userName="+userName |
| | | +"&userPhone="+userPhone |
| | | +"&code="+code |
| | | ; |
| | | } |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TRechargeRecordUser.search = function () { |
| | | var queryData = {}; |
| | | queryData['userName'] = $("#userName").val(); |
| | | queryData['userPhone'] = $("#userPhone").val(); |
| | | queryData['code'] = $("#code").val(); |
| | | queryData['createTime'] = $("#createTime").val(); |
| | | TRechargeRecordUser.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | /** |
| | | * 重置 |
| | | */ |
| | | TRechargeRecordUser.resetSearch = function (){ |
| | | $("#createTime").val(''); |
| | | $("#userName").val(''); |
| | | $("#userPhone").val(''); |
| | | $("#code").val(''); |
| | | TRechargeRecordUser.search(); |
| | | } |
| | | |
| | | $(function () { |
| | | var defaultColunms = TRechargeRecordUser.initColumn(); |
| | | var table = new BSTable(TRechargeRecordUser.id, "/tRechargeRecord/userRechargeList", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TRechargeRecordUser.table = table.init(); |
| | | }); |