| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | @Autowired |
| | | private TbUserService userService; |
| | | |
| | | @Autowired |
| | | private TbAgreementService agreementService; |
| | | |
| | | @ApiOperation(value = "获取我的订单", tags = {"订单模块"}) |
| | | |
| | | @ApiOperation(value = "获取我的订单", tags = {"订单模块"},response =MyPushCompanyListVo.class ) |
| | | @GetMapping("/getMyOrderList") |
| | | public R<Page<MyPushCompanyListVo>> getMyOrderList(MyOrderListQuery query) { |
| | | public R<HashMap<String, Object>> getMyOrderList(MyOrderListQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | Page<MyPushCompanyListVo> page = orderService.getMyOrderList(query, userId); |
| | | return R.ok(page); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("data",page); |
| | | map = orderService.getMyOrderListNum(userId,map); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @ApiOperation(value = "立即支付前填写信息", tags = {"订单模块"}) |
| | | @PostMapping("/lastPayOrderData") |
| | | public R<?> lastPayOrderData(@RequestBody @Valid AddBuyerCompanyInfoDto dto) { |
| | | public synchronized R<WxPayMpOrderResult> lastPayOrderData(@RequestBody @Valid AddBuyerCompanyInfoDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder tbOrder = orderService.getById(dto.getOrderId()); |
| | |
| | | if (company == null || company.getStatus() == 2 || company.getIsDelete() == 1) { |
| | | return R.fail("该公司已下架或者删除"); |
| | | } |
| | | long count = buyerCompanyInfoService.count(new LambdaQueryWrapper<TbBuyerCompanyInfo>().eq(TbBuyerCompanyInfo::getOrderId, dto.getOrderId())); |
| | | if (count > 0) { |
| | | return R.fail("请勿重复填写"); |
| | | } |
| | | orderService.lastPayOrderData(tbOrder, dto, userId, company); |
| | | return R.ok(); |
| | | TbBuyerCompanyInfo one = buyerCompanyInfoService.getOne(new LambdaQueryWrapper<TbBuyerCompanyInfo>().eq(TbBuyerCompanyInfo::getOrderId, dto.getOrderId())); |
| | | orderService.lastPayOrderData(tbOrder, dto, userId, company,one); |
| | | R<WxPayMpOrderResult> wxPayMpOrderResultR = payOrder(dto.getOrderId()); |
| | | return wxPayMpOrderResultR; |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/placeOrder") |
| | | public synchronized R<?> placeOrder(String companyId) { |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | R.fail("id不能为空"); |
| | | return R.fail("id不能为空"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "下单预定-获取信息", tags = {"订单模块"}) |
| | | @GetMapping("/placeOrderInfo") |
| | | public R<?> placeOrderInfo(String companyId) { |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | R.fail("id不能为空"); |
| | | } |
| | | TbCompany company = companyService.getById(companyId); |
| | | String information = company.getInformation(); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("information", information); |
| | | TbAgreement one = agreementService.getOne(new LambdaQueryWrapper<TbAgreement>().eq(TbAgreement::getType, 3)); |
| | | map.put("agreement", one.getContent()); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "买家完成订单", tags = {"订单模块"}) |
| | | @PostMapping("/buyerSuccessOrder") |
| | |
| | | // 订单完成 商品已售卖 |
| | | order.setStatus(6); |
| | | order.updateById(); |
| | | order.setFinishTime( new Date()); |
| | | company.setStatus(3); |
| | | |
| | | // 分佣 |