| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<String> getCode(HttpServletRequest request){ |
| | | public ResultUtil<Map<String,String>> getCode(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | if (userInfo.getCode()==null){ |
| | | userInfo = driverService.generateCode(userInfo); |
| | | } |
| | | return ResultUtil.success(userInfo.getCode()); |
| | | Map<String, String> res = new HashMap<>(); |
| | | res.put("code",userInfo.getCode()); |
| | | int i = inviteService.selectCount(new EntityWrapper<Invite>() |
| | | .eq("inviteUserId", uid) |
| | | .eq("useType", 2)); |
| | | |
| | | res.put("inviteNumber",i+""); |
| | | return ResultUtil.success(res); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取用户邀请二维码 |
| | | * @param request |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil inviteList(String startTime,String endTime,Integer pageNum,Integer size,HttpServletRequest request){ |
| | | public ResultUtil<List<Invite>> inviteList(String startTime,String endTime,Integer pageNum,Integer size,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | endTime = endTime + " 23:59:59"; |
| | | } |
| | | List<Invite> invites = inviteService.inviteList(uid,startTime,endTime,pageNum,size); |
| | | for (Invite invite : invites) { |
| | | // 将手机号phone中间四位替换为* |
| | | String phone = invite.getPhone(); |
| | | if (phone != null && phone.length() > 4) { |
| | | phone = phone.substring(0, 3) + "****" + phone.substring(7); |
| | | invite.setPhone(phone); |
| | | } |
| | | } |
| | | return ResultUtil.success(invites); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | /** |
| | | * 司机手动确认收款 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/confirm") |
| | | @ApiOperation(value = "司机手动确认收款", tags = {"司机端-2.0新增"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil process(Integer orderId, Integer orderType, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | OrderTaxi orderTaxi = orderTaxiService.selectById(orderId); |
| | | paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderTaxi.getOrderMoney(), "", 1);//添加预支付数据 |
| | | orderTaxi.setState(8); |
| | | orderTaxi.setPayType(3); |
| | | orderTaxi.setPayMoney(orderTaxi.getOrderMoney()); |
| | | Integer placeOrderWay = null; |
| | | switch (orderTaxi.getOrderSource()){ |
| | | case 2: |
| | | placeOrderWay = 4; |
| | | break; |
| | | case 3: |
| | | placeOrderWay = 4; |
| | | break; |
| | | case 6: |
| | | placeOrderWay = 1; |
| | | break; |
| | | case 7: |
| | | placeOrderWay = 2; |
| | | break; |
| | | case 5: |
| | | placeOrderWay = 3; |
| | | break; |
| | | } |
| | | // 司机收入 |
| | | double moneyTwo; |
| | | // 平台收入 |
| | | double money; |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Company company = companyService.selectById(driver.getFranchiseeId()); |
| | | |
| | | if(orderTaxi.getOrderSource() == 2 || orderTaxi.getOrderSource() == 3){ |
| | | double v = company.getPercentageDeduction() / 100; |
| | | money = v * orderTaxi.getOrderMoney(); |
| | | moneyTwo = orderTaxi.getOrderMoney()-money; |
| | | }else { |
| | | money = company.getFixedDeduction(); |
| | | moneyTwo = orderTaxi.getOrderMoney()-money; |
| | | } |
| | | driver.setBalance(driver.getBalance() + moneyTwo); |
| | | // 新增扣除使用费记录 |
| | | transactionDetailsService.saveDataTaxi(driver.getId(), "软件使用费", money, 2, 1, 2, 6, orderTaxi.getId(),placeOrderWay,company.getId()); |
| | | // 司机订单收入 |
| | | transactionDetailsService.saveDataTaxi(driver.getId(), "完成订单", moneyTwo, 1, 1, 2, 2, orderTaxi.getId(),placeOrderWay,company.getId()); |
| | | |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | */ |
| | | @TableField("registerTime") |
| | | @ApiModelProperty("注册时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date registerTime; |
| | | /** |
| | | * 使用范围(1=用户,2=司机) |
| | |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryMoneyInfo(Integer orderId, Integer orderType) throws Exception; |
| | | |
| | | } |
| | |
| | | */ |
| | | void saveData(Integer userId, String remark, Double money, Integer state, |
| | | Integer type, Integer userType, Integer orderType, Integer orderId,Integer companyId) throws Exception; |
| | | void saveDataTaxi(Integer userId, String remark, Double money, Integer state, |
| | | Integer type, Integer userType, Integer orderType, Integer orderId, Integer placeOrderWay,Integer companyId) throws Exception; |
| | | } |
| | |
| | | @Service |
| | | public class OrderServiceImpl implements IOrderService { |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | |
| | | transactionDetails.setCompanyId(companyId); |
| | | this.insert(transactionDetails); |
| | | } |
| | | @Override |
| | | public void saveDataTaxi(Integer userId, String remark, Double money, Integer state, Integer type, Integer userType, Integer orderType, Integer orderId, Integer placeOrderWay,Integer companyId) throws Exception { |
| | | TransactionDetails transactionDetails = new TransactionDetails(); |
| | | transactionDetails.setInsertTime(new Date()); |
| | | transactionDetails.setMoney(money); |
| | | transactionDetails.setOrderId(orderId); |
| | | transactionDetails.setOrderType(orderType); |
| | | transactionDetails.setRemark(remark); |
| | | transactionDetails.setState(state); |
| | | transactionDetails.setType(type); |
| | | transactionDetails.setUserId(userId); |
| | | transactionDetails.setUserType(userType); |
| | | transactionDetails.setPlaceOrderWay(placeOrderWay); |
| | | transactionDetails.setCompanyId(companyId); |
| | | this.insert(transactionDetails); |
| | | } |
| | | } |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<String> getCode(HttpServletRequest request){ |
| | | public ResultUtil<Map<String,String>> getCode(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | if (userInfo.getCode()==null){ |
| | | userInfo = userInfoService.generateCode(userInfo); |
| | | } |
| | | return ResultUtil.success(userInfo.getCode()); |
| | | Map<String, String> res = new HashMap<>(); |
| | | res.put("code",userInfo.getCode()); |
| | | int i = inviteService.selectCount(new EntityWrapper<Invite>() |
| | | .eq("inviteUserId", uid) |
| | | .eq("useType", 1)); |
| | | |
| | | res.put("inviteNumber",i+""); |
| | | return ResultUtil.success(res); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil inviteList(String startTime,String endTime,Integer pageNum,Integer size,HttpServletRequest request){ |
| | | public ResultUtil<List<Invite>> inviteList(String startTime,String endTime,Integer pageNum,Integer size,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | endTime = endTime + " 23:59:59"; |
| | | } |
| | | List<Invite> invites = inviteService.inviteList(uid,startTime,endTime,pageNum,size); |
| | | for (Invite invite : invites) { |
| | | // 将手机号phone中间四位替换为* |
| | | String phone = invite.getPhone(); |
| | | if (phone != null && phone.length() > 4) { |
| | | phone = phone.substring(0, 3) + "****" + phone.substring(7); |
| | | invite.setPhone(phone); |
| | | } |
| | | } |
| | | return ResultUtil.success(invites); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | */ |
| | | @TableField("registerTime") |
| | | @ApiModelProperty("注册时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date registerTime; |
| | | /** |
| | | * 使用范围(1=用户,2=司机) |