| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.net.MalformedURLException; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | @Autowired |
| | | private TbAccountDetailService accountDetailService; |
| | | |
| | | |
| | | @Autowired |
| | | private TbUserService userService; |
| | | |
| | | |
| | | @ApiOperation(value = "获取我的订单",tags = {"订单模块"}) |
| | |
| | | } |
| | | TbCompany company = companyService.getById(tbOrder.getCompanyId()); |
| | | // 判断是否在支付前下架了 或者删除了 |
| | | if(company==null || company.getStatus()!=1 || company.getIsDelete()==1){ |
| | | if (company == null || company.getStatus() == 2 || company.getIsDelete() == 1) { |
| | | return R.fail("该公司已下架或者删除"); |
| | | } |
| | | long count = buyerCompanyInfoService.count(new LambdaQueryWrapper<TbBuyerCompanyInfo>().eq(TbBuyerCompanyInfo::getOrderId, dto.getOrderId())); |
| | |
| | | orderService.lastPayOrderData(tbOrder,dto,userId,company); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "立即支付",tags = {"订单模块"}) |
| | |
| | | if(!tbOrder.getUserId().equals(userId.toString())){ |
| | | return R.fail("非法操作"); |
| | | } |
| | | |
| | | TbUser user = userService.getById(userId); |
| | | if(StringUtils.isEmpty(user.getOpenId())){ |
| | | return R.fail(602,"需要授权微信小程序"); |
| | | } |
| | | |
| | | if(tbOrder.getStatus()!=3){ |
| | | return R.fail("订单状态错误"); |
| | | } |
| | | TbCompany company = companyService.getById(tbOrder.getCompanyId()); |
| | | // 判断是否在支付前下架了 或者删除了 |
| | | if(company==null || company.getStatus()!=1 || company.getIsDelete()==1){ |
| | | if (company == null || company.getStatus() == 2 || company.getIsDelete() == 1) { |
| | | return R.fail("该公司已下架或者删除"); |
| | | } |
| | | long count = buyerCompanyInfoService.count(new LambdaQueryWrapper<TbBuyerCompanyInfo>().eq(TbBuyerCompanyInfo::getOrderId,orderId)); |
| | |
| | | WxPayMpOrderResult result = orderService.payOrder(tbOrder,userId); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "下单预定",tags = {"订单模块"}) |
| | |
| | | Long userId = loginUser.getUserId(); |
| | | // 查看现在是否可以单 判断这个公司是否上架 是否已经产生的了订单 |
| | | TbCompany company = companyService.getById(companyId); |
| | | if(company.getStatus()!=1){ |
| | | if (company == null) { |
| | | return R.fail("公司不存在"); |
| | | } |
| | | if (company.getUserId().equals(userId.toString())) { |
| | | return R.fail("不能预定自己发布的公司"); |
| | | } |
| | | |
| | | if (company.getStatus() == 2) { |
| | | return R.fail("公司未上架"); |
| | | } |
| | | if (company.getStatus() == 3) { |
| | | return R.fail("公司已售卖"); |
| | | } |
| | | if (company.getStatus() == 4) { |
| | | return R.fail("公司已被预定"); |
| | | } |
| | | // long count = orderService.count(new LambdaQueryWrapper<TbOrder>().eq(TbOrder::getCompanyId, companyId).ne(TbOrder::getStatus, -1)); |
| | | if (company.getStatus()==4) { |
| | |
| | | |
| | | // 分佣 |
| | | orderService.commission(order,company.getUserId()); |
| | | |
| | | |
| | | // 卖家账户明细记录更新 |
| | | TbAccountDetail one = accountDetailService.getOne(new LambdaQueryWrapper<TbAccountDetail>().eq(TbAccountDetail::getOrderId, orderId).eq(TbAccountDetail::getCategory, 2)); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "编辑办理进度",tags = {"发布模块"}) |
| | | @PostMapping("/updateSchedule") |
| | | public R<?> updateSchedule(@RequestBody @Valid EditScheduleDto dto) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 微信小程序支付成功回调函数 |
| | | */ |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |