|
|
@@ -1,281 +1,225 @@
|
|
|
package com.fs.app.controller;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.fs.app.annotation.Login;
|
|
|
-
|
|
|
-import com.fs.common.utils.CloudHostUtils;
|
|
|
-import com.fs.his.dto.ExpressInfoDTO;
|
|
|
-import com.fs.his.param.BillListParam;
|
|
|
-import com.fs.app.param.FsStoreOrderExpressParam;
|
|
|
-import com.fs.app.param.FsStoreOrderFinishParam;
|
|
|
-import com.fs.his.vo.FsStoreOrderBillLogVo;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
-
|
|
|
+import com.fs.common.exception.ServiceException;
|
|
|
import com.fs.common.utils.ParseUtils;
|
|
|
-import com.fs.his.domain.*;
|
|
|
-import com.fs.his.param.*;
|
|
|
-import com.fs.his.service.*;
|
|
|
-import com.fs.his.vo.FsStoreOrderItemListUVO;
|
|
|
-import com.fs.his.vo.FsStoreOrderListUVO;
|
|
|
-import com.fs.ybPay.service.IPayService;
|
|
|
+import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductPackageScrm;
|
|
|
+import com.fs.hisStore.dto.FsStoreOrderComputeDTO;
|
|
|
+import com.fs.hisStore.param.FsMyStoreOrderQueryParam;
|
|
|
+import com.fs.hisStore.param.FsStoreConfirmOrderParam;
|
|
|
+import com.fs.hisStore.param.FsStoreOrderCancelParam;
|
|
|
+import com.fs.hisStore.param.FsStoreOrderComputedParam;
|
|
|
+import com.fs.hisStore.param.FsStoreOrderCreateParam;
|
|
|
+import com.fs.hisStore.param.FsStoreOrderPayParam;
|
|
|
+import com.fs.hisStore.service.IFsStoreOrderScrmService;
|
|
|
+import com.fs.hisStore.service.IFsStoreProductPackageScrmService;
|
|
|
+import com.fs.hisStore.vo.FsMyStoreOrderListQueryVO;
|
|
|
+import com.fs.store.config.StoreConfig;
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiResponse;
|
|
|
+import org.redisson.api.RLock;
|
|
|
+import org.redisson.api.RedissonClient;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.List;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
+import static com.fs.hisStore.constants.UserAppsLockConstant.LOCK_KEY_CANCEL;
|
|
|
+import static com.fs.hisStore.constants.UserAppsLockConstant.LOCK_KEY_EDIT_PAY_TYPE;
|
|
|
+import static com.fs.hisStore.constants.UserAppsLockConstant.LOCK_KEY_PAY;
|
|
|
|
|
|
@Api("商城接口")
|
|
|
@RestController
|
|
|
-@RequestMapping(value="/app/storeOrder")
|
|
|
-public class StoreOrderController extends AppBaseController {
|
|
|
+@RequestMapping(value = "/app/storeOrder")
|
|
|
+public class StoreOrderController extends AppBaseController {
|
|
|
|
|
|
- @Autowired
|
|
|
- private IFsExpressService expressService;
|
|
|
- @Autowired
|
|
|
- IPayService payService;
|
|
|
- @Autowired
|
|
|
- private IFsStoreOrderService orderService;
|
|
|
+ Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
@Autowired
|
|
|
- private IFsStoreOrderItemService orderItemService;
|
|
|
+ private RedissonClient redissonClient;
|
|
|
|
|
|
@Autowired
|
|
|
- private IFsStorePaymentService storePaymentService;
|
|
|
- @Autowired
|
|
|
- private IFsUserService userService;
|
|
|
- @Autowired
|
|
|
- private IFsUserAddressService userAddressService;
|
|
|
- @Autowired
|
|
|
- private IFsUserCouponService userCouponService;
|
|
|
+ private IFsStoreOrderScrmService orderService;
|
|
|
+
|
|
|
@Autowired
|
|
|
- private IFsCouponService couponService;
|
|
|
+ private IFsStoreProductPackageScrmService productPackageService;
|
|
|
+
|
|
|
@Autowired
|
|
|
- private IFsStoreOrderBillLogService orderBillLogService;
|
|
|
+ private ISysConfigService configService;
|
|
|
+
|
|
|
@Login
|
|
|
- @ApiOperation("获取我的订单列表")
|
|
|
- @GetMapping("/getMyStoreOrderList")
|
|
|
- public R getMyStoreOrderList(FsStoreOrderListUParam param, HttpServletRequest request){
|
|
|
- PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
- param.setUserId(Long.parseLong(getUserId()));
|
|
|
- List<FsStoreOrderListUVO> list=orderService.selectFsStoreOrderListUVO(param);
|
|
|
- PageInfo<FsStoreOrderListUVO> listPageInfo=new PageInfo<>(list);
|
|
|
- return R.ok().put("data",listPageInfo);
|
|
|
+ @ApiOperation("确认订单")
|
|
|
+ @PostMapping("/confirm")
|
|
|
+ public R confirm(@Validated @RequestBody FsStoreConfirmOrderParam param, HttpServletRequest request) {
|
|
|
+ return orderService.confirmOrder(Long.parseLong(getUserId()), param);
|
|
|
}
|
|
|
|
|
|
@Login
|
|
|
- @ApiOperation("获取我的订单详情")
|
|
|
- @GetMapping("/getMyStoreOrderById")
|
|
|
- public R getMyStoreOrderById(@RequestParam("orderId") Long orderId, HttpServletRequest request){
|
|
|
- FsStoreOrder order=orderService.selectFsStoreOrderByOrderId(orderId);
|
|
|
- order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
|
|
|
- order.setUserAddress(ParseUtils.parseIdCard(order.getUserAddress()));
|
|
|
- List<FsStoreOrderItemListUVO> list=orderItemService.selectFsStoreOrderItemListUVOByOrderId(orderId);
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(order.getCreateTime());
|
|
|
-// String json=configService.selectConfigByKey("his.store");
|
|
|
-// StoreConfig config=JSONUtil.toBean(json,StoreConfig.class);
|
|
|
-// calendar.add(Calendar.MINUTE,config.getUnPayTime());
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- String payLimitTime = format.format(calendar.getTime() );
|
|
|
- //处理是否可以申请售后
|
|
|
- Integer isAfterSales=0;
|
|
|
-// if(order.getStatus().equals(FsStoreOrderStatusEnum.STATUS_4.getValue())) {
|
|
|
-// //已完成订单
|
|
|
-// isAfterSales=1;
|
|
|
-// if (order.getFinishTime() != null) {
|
|
|
-//// if (config.getStoreAfterSalesDay() != null && config.getStoreAfterSalesDay() > 0) {
|
|
|
-//// //判断完成时间是否超过指定时间
|
|
|
-//// Calendar calendarAfterSales = new GregorianCalendar();
|
|
|
-//// calendarAfterSales.setTime(order.getFinishTime());
|
|
|
-//// calendarAfterSales.add(calendarAfterSales.DATE, config.getStoreAfterSalesDay()); //把日期往后增加一天,整数 往后推,负数往前移动
|
|
|
-//// if (calendarAfterSales.getTime().getTime() < new Date().getTime()) {
|
|
|
-//// isAfterSales = 0;
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// else if(order.getStatus()==2||order.getStatus()==3){
|
|
|
-// isAfterSales=1;
|
|
|
-// }
|
|
|
- return R.ok().put("order",order).put("items",list).put("payLimitTime",payLimitTime);
|
|
|
+ @ApiOperation("计算订单金额")
|
|
|
+ @PostMapping("/computed")
|
|
|
+ public R computed(@Validated @RequestBody FsStoreOrderComputedParam param, HttpServletRequest request) {
|
|
|
+ try {
|
|
|
+ FsStoreOrderComputeDTO dto = orderService.computedOrder(Long.parseLong(getUserId()), param);
|
|
|
+ return R.ok().put("data", dto);
|
|
|
+ } catch (ServiceException e) {
|
|
|
+ if ("偏远地区暂不可购买".equals(e.getMessage())) {
|
|
|
+ return R.error("偏远地区暂不可购买");
|
|
|
+ }
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Login
|
|
|
- @ApiOperation("获取订单")
|
|
|
+ @ApiOperation("创建订单")
|
|
|
+ @PostMapping("/create")
|
|
|
+ public R create(@Validated @RequestBody FsStoreOrderCreateParam param, HttpServletRequest request) {
|
|
|
+ return orderService.createOrder(Long.parseLong(getUserId()), param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @ApiOperation("获取订单详情")
|
|
|
@GetMapping("/getStoreOrderById")
|
|
|
- public R getStoreOrderById(@RequestParam("orderId") Long orderId, HttpServletRequest request){
|
|
|
- FsStoreOrder order=orderService.selectFsStoreOrderByOrderId(orderId);
|
|
|
-// if(!order.getUserId().equals(Long.parseLong(getUserId()))){
|
|
|
-// return R.error("非法操作");
|
|
|
-// }
|
|
|
+ public R getStoreOrderById(@RequestParam("orderId") Long orderId, HttpServletRequest request) {
|
|
|
+ FsStoreOrderScrm order = orderService.selectFsStoreOrderById(orderId);
|
|
|
order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
|
|
|
order.setUserAddress(ParseUtils.parseIdCard(order.getUserAddress()));
|
|
|
- List<FsStoreOrderItemListUVO> list=orderItemService.selectFsStoreOrderItemListUVOByOrderId(orderId);
|
|
|
-
|
|
|
-// String json=configService.selectConfigByKey("his.store");
|
|
|
-// StoreConfig config=JSONUtil.toBean(json,StoreConfig.class);
|
|
|
+ String json = configService.selectConfigByKey("his.store");
|
|
|
+ StoreConfig config = JSONUtil.toBean(json, StoreConfig.class);
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(order.getCreateTime());
|
|
|
-// calendar.add(Calendar.MINUTE,config.getUnPayTime());
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- String payLimitTime = format.format(calendar.getTime() );
|
|
|
- return R.ok().put("order",order).put("payLimitTime",payLimitTime).put("items",list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Login
|
|
|
- @ApiOperation("计算订单")
|
|
|
- @PostMapping("/compute")
|
|
|
- public R compute(@Validated @RequestBody FsStoreOrderComputeParam param, HttpServletRequest request){
|
|
|
- return orderService.computeOrder(param);
|
|
|
-
|
|
|
+ calendar.add(Calendar.MINUTE, config.getUnPayTime());
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String payLimitTime = format.format(calendar.getTime());
|
|
|
+ FsStoreProductPackageScrm productPackage = null;
|
|
|
+ if (order.getIsPackage() != null && order.getIsPackage() == 1) {
|
|
|
+ productPackage = productPackageService.selectFsStoreProductPackageById(order.getPackageId());
|
|
|
+ }
|
|
|
+ return R.ok().put("order", order).put("productPackage", productPackage).put("payLimitTime", payLimitTime);
|
|
|
}
|
|
|
|
|
|
@Login
|
|
|
- @ApiOperation("支付")
|
|
|
- @PostMapping("/pay")
|
|
|
- public R pay(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param)
|
|
|
- {
|
|
|
+ @ApiOperation("获取我的订单列表")
|
|
|
+ @GetMapping("/getMyStoreOrderList")
|
|
|
+ public R getMyStoreOrderList(FsMyStoreOrderQueryParam param, HttpServletRequest request) {
|
|
|
+ PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
|
- return orderService.payOrder(param);
|
|
|
+ List<FsMyStoreOrderListQueryVO> list = orderService.selectFsMyStoreOrderListVO(param);
|
|
|
+ PageInfo<FsMyStoreOrderListQueryVO> listPageInfo = new PageInfo<>(list);
|
|
|
+ return R.ok().put("data", listPageInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @ApiOperation("修改支付类型")
|
|
|
+ @PostMapping("/editPayType")
|
|
|
+ public R editPayType(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param) {
|
|
|
+ Long orderId = param.getOrderId();
|
|
|
+ logger.info("开始处理修改支付类型请求, 订单号: {}, 新支付类型: {}", orderId, param.getPayType());
|
|
|
+ RLock lock = redissonClient.getLock(String.format(LOCK_KEY_EDIT_PAY_TYPE, orderId));
|
|
|
+ R result = null;
|
|
|
+ try {
|
|
|
+ boolean locked = lock.tryLock(100, 10000, TimeUnit.MILLISECONDS);
|
|
|
+ if (!locked) {
|
|
|
+ logger.warn("订单支付类型正在修改中,获取锁失败, 订单号: {}", orderId);
|
|
|
+ return R.error("订单正在处理中,请勿重复提交");
|
|
|
+ }
|
|
|
+ result = orderService.editPayType(param);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ logger.error("获取修改支付类型锁的过程被中断, 订单号: {}", orderId, e);
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ return R.error("修改支付类型处理被中断,请稍后重试");
|
|
|
+ } catch (Throwable e) {
|
|
|
+ logger.error("修改支付类型过程中发生异常, 订单号: {}", orderId, e);
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ if (lock != null && lock.isHeldByCurrentThread()) {
|
|
|
+ lock.unlock();
|
|
|
+ logger.debug("修改支付类型锁已释放, 订单号: {}", orderId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Login
|
|
|
@ApiOperation("支付")
|
|
|
- @PostMapping("/payment")
|
|
|
- public R payment(HttpServletRequest request, @Validated @RequestBody FsStoreOrderDoPayParam param)
|
|
|
- {
|
|
|
- param.setUserId(Long.parseLong(getUserId()));
|
|
|
- return orderService.payment(param);
|
|
|
- }
|
|
|
- @Login
|
|
|
- @ApiOperation("支付宝支付")
|
|
|
- @PostMapping("/zfbPayment")
|
|
|
- public R zfbPayment(HttpServletRequest request, @Validated @RequestBody FsStoreOrderDoPayParam param)
|
|
|
- {
|
|
|
- param.setUserId(Long.parseLong(getUserId()));
|
|
|
- return orderService.zfbPayment(param);
|
|
|
+ @PostMapping("/pay")
|
|
|
+ public R pay(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param) {
|
|
|
+ Long orderId = param.getOrderId();
|
|
|
+ logger.info("开始处理支付请求, 订单号: {}, 支付类型: {}", orderId, param.getPayType());
|
|
|
+ RLock lock = redissonClient.getLock(String.format(LOCK_KEY_PAY, orderId));
|
|
|
+ R result = null;
|
|
|
+ try {
|
|
|
+ boolean locked = lock.tryLock(100, 30000, TimeUnit.MILLISECONDS);
|
|
|
+ if (!locked) {
|
|
|
+ logger.warn("订单正在处理中,获取锁失败, 订单号: {}", orderId);
|
|
|
+ return R.error("订单正在处理中,请勿重复提交");
|
|
|
+ }
|
|
|
+ result = orderService.pay(param, request);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ logger.error("获取支付锁的过程被中断, 订单号: {}", orderId, e);
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ return R.error("支付处理被中断,请稍后重试");
|
|
|
+ } catch (Throwable e) {
|
|
|
+ logger.error("支付过程中发生异常, 订单号: {}", orderId, e);
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ if (lock.isHeldByCurrentThread()) {
|
|
|
+ lock.unlock();
|
|
|
+ logger.debug("支付锁已释放, 订单号: {}", orderId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Login
|
|
|
@ApiOperation("取消订单")
|
|
|
@PostMapping("/cancelOrder")
|
|
|
- public R cancelOrder(@Validated @RequestBody FsStoreOrderCancelParam param, HttpServletRequest request){
|
|
|
- FsStoreOrder order=orderService.selectFsStoreOrderByOrderId(param.getOrderId());
|
|
|
- if (ObjectUtil.isNull(order)) {
|
|
|
- throw new CustomException("订单不存在");
|
|
|
- }
|
|
|
- return orderService.cancelOrder(param.getOrderId());
|
|
|
-
|
|
|
- }
|
|
|
- @Login
|
|
|
- @ApiOperation("快递信息")
|
|
|
- @PostMapping("/getExpress")
|
|
|
- public R getExpress(@Validated @RequestBody FsStoreOrderExpressParam param, HttpServletRequest request){
|
|
|
- FsStoreOrder order=orderService.selectFsStoreOrderByOrderId(param.getOrderId());
|
|
|
- if (ObjectUtil.isNull(order)) {
|
|
|
- throw new CustomException("订单不存在");
|
|
|
+ public R cancelOrder(@Validated @RequestBody FsStoreOrderCancelParam param, HttpServletRequest request) {
|
|
|
+ Long orderId = param.getOrderId();
|
|
|
+ logger.info("开始处理取消订单请求, 订单号: {}", orderId);
|
|
|
+ RLock lock = redissonClient.getLock(String.format(LOCK_KEY_CANCEL, orderId));
|
|
|
+ R result = null;
|
|
|
+ try {
|
|
|
+ boolean locked = lock.tryLock(100, 30000, TimeUnit.MILLISECONDS);
|
|
|
+ if (!locked) {
|
|
|
+ throw new CustomException("订单正在处理中,请勿重复提交");
|
|
|
+ }
|
|
|
+ FsStoreOrderScrm order = orderService.selectFsStoreOrderById(orderId);
|
|
|
+ if (ObjectUtil.isNull(order)) {
|
|
|
+ throw new CustomException("订单不存在");
|
|
|
+ }
|
|
|
+ if (order.getStatus() != 0) {
|
|
|
+ throw new CustomException("非法操作");
|
|
|
+ }
|
|
|
+ orderService.cancelOrder(orderId);
|
|
|
+ result = R.ok("操作成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("取消订单失败, 订单号: {}", orderId, e);
|
|
|
+ throw new CustomException("取消订单过程中发生错误");
|
|
|
+ } finally {
|
|
|
+ if (lock.isHeldByCurrentThread()) {
|
|
|
+ lock.unlock();
|
|
|
+ }
|
|
|
}
|
|
|
- if (order.getStatus() <3) {
|
|
|
- throw new CustomException("未发货订单不能查询");
|
|
|
- }
|
|
|
- if (CloudHostUtils.hasCloudHostName("金牛明医")){
|
|
|
- ExpressInfoDTO dto = orderService.getDfExpressInfoDTO(order);
|
|
|
- dto.setShipperName(order.getDeliveryName());
|
|
|
- return R.ok().put("data", dto).put("express",expressService.selectFsExpressByName(order.getDeliveryName())).put("deliverySn", order.getDeliverySn());
|
|
|
- } else {
|
|
|
- return orderService.getExpress(order);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Login
|
|
|
- @ApiOperation("完成订单")
|
|
|
- @PostMapping("/finishOrder")
|
|
|
- public R finishOrder(@Validated @RequestBody FsStoreOrderFinishParam param, HttpServletRequest request){
|
|
|
- return orderService.finishOrder(param.getOrderId());
|
|
|
+ return result;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- @Login
|
|
|
- @ApiOperation("获取销售订单列表")
|
|
|
- @GetMapping("/getCompanyUserStoreOrderList")
|
|
|
- public R getCompanyUserStoreOrderList(FsStoreOrderListUParam param, HttpServletRequest request){
|
|
|
- PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
- param.setCompanyUserId(getCompanyUserId());
|
|
|
- List<FsStoreOrderListUVO> list=orderService.selectFsStoreOrderListUVO(param);
|
|
|
- PageInfo<FsStoreOrderListUVO> listPageInfo=new PageInfo<>(list);
|
|
|
- return R.ok().put("data",listPageInfo);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Login
|
|
|
- @ApiOperation("获取订单")
|
|
|
- @GetMapping("/getCompanyUserStoreOrderById")
|
|
|
- public R getCompanyUserStoreOrderById(@RequestParam("orderId") Long orderId, HttpServletRequest request){
|
|
|
- FsStoreOrder order=orderService.selectFsStoreOrderByOrderId(orderId);
|
|
|
-// if(!order.getCompanyUserId().equals(getCompanyUserId())){
|
|
|
-// return R.error("非法操作");
|
|
|
-// }
|
|
|
- order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
|
|
|
- order.setUserAddress(ParseUtils.parseIdCard(order.getUserAddress()));
|
|
|
- List<FsStoreOrderItemListUVO> list=orderItemService.selectFsStoreOrderItemListUVOByOrderId(orderId);
|
|
|
-
|
|
|
-// String json=configService.selectConfigByKey("his.store");
|
|
|
-// StoreConfig config=JSONUtil.toBean(json,StoreConfig.class);
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(order.getCreateTime());
|
|
|
-// calendar.add(Calendar.MINUTE,config.getUnPayTime());
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- String payLimitTime = format.format(calendar.getTime() );
|
|
|
- return R.ok().put("order",order).put("payLimitTime",payLimitTime).put("items",list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @Login
|
|
|
- @ApiOperation("开票")
|
|
|
- @PostMapping("/bill")
|
|
|
- public R bill(@RequestBody OrderBillParam param){
|
|
|
- param.setUserId(Long.parseLong(getUserId()));
|
|
|
- return orderBillLogService.bill(param);
|
|
|
- }
|
|
|
- @Login
|
|
|
- @ApiOperation("开票历史")
|
|
|
- @GetMapping("/billList")
|
|
|
- @ApiResponse(code = 200, message = "", responseContainer = "List", response = FsStoreOrderBillLogVo.class)
|
|
|
- public R billList(BillListParam param){
|
|
|
- PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
- param.setUserId(Long.parseLong(getUserId()));
|
|
|
- PageInfo<FsStoreOrderBillLogVo> listPageInfo= orderBillLogService.billList(param);
|
|
|
- return R.ok().put("data",listPageInfo);
|
|
|
- }
|
|
|
- @Login
|
|
|
- @ApiOperation("开票详情")
|
|
|
- @GetMapping("/billInfo")
|
|
|
- @ApiResponse(code = 200, message = "", response = FsStoreOrderBillLog.class)
|
|
|
- public R billList(Long id){
|
|
|
- return R.ok().put("data", orderBillLogService.getById(id));
|
|
|
- }
|
|
|
-
|
|
|
- @Login
|
|
|
- @ApiOperation("开票冲红")
|
|
|
- @GetMapping("/billBack")
|
|
|
- public R billBack(Long id){
|
|
|
- return orderBillLogService.billBack(id);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|