|
@@ -78,8 +78,6 @@ public class StoreOrderController extends AppBaseController {
|
|
|
|
|
|
Logger logger= LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
- @Autowired
|
|
|
- private WxPayService wxPayService;
|
|
|
@Autowired
|
|
|
private IFsStoreOrderService orderService;
|
|
|
@Autowired
|
|
@@ -95,12 +93,6 @@ public class StoreOrderController extends AppBaseController {
|
|
|
@Autowired
|
|
|
private IFsPrescribeService prescribeService;
|
|
|
@Autowired
|
|
|
- private IPayService payService;
|
|
|
- @Autowired
|
|
|
- private FSSysConfig sysConfig;
|
|
|
- @Autowired
|
|
|
- private IErpOrderService erpOrderService;
|
|
|
- @Autowired
|
|
|
private ISysConfigService configService;
|
|
|
@Autowired
|
|
|
private IFsStoreAfterSalesService afterSalesService;
|
|
@@ -110,8 +102,6 @@ public class StoreOrderController extends AppBaseController {
|
|
|
PayService ybPayService;
|
|
|
@Autowired
|
|
|
TzBankService tzBankService;
|
|
|
- @Autowired
|
|
|
- private WxMaProperties properties;
|
|
|
|
|
|
|
|
|
@Login
|
|
@@ -215,106 +205,23 @@ public class StoreOrderController extends AppBaseController {
|
|
|
@ApiOperation("获取订单-轮询获取信息")
|
|
|
@GetMapping("/getStoreOrderByOrderIdTz")
|
|
|
public R getStoreOrderByIdRemote(@RequestParam(value = "orderId",required = false) Long orderId,
|
|
|
- @RequestParam(value = "payCode",required = false) String payCode, HttpServletRequest request){
|
|
|
- // 根据订单查询payment
|
|
|
- if(ObjectUtil.isNull(orderId)&&ObjectUtil.isNull(payCode)){
|
|
|
- return R.error("参数错误");
|
|
|
- }
|
|
|
-
|
|
|
- List<FsStorePayment> fsStorePayments;
|
|
|
- if(ObjectUtil.isNotNull(orderId)){
|
|
|
- fsStorePayments = fsStorePaymentMapper.selectFsStorePaymentByOrder(orderId);
|
|
|
- } else{
|
|
|
- fsStorePayments = fsStorePaymentMapper.selectFsStorePaymentByPayCode(payCode);
|
|
|
- }
|
|
|
- // 如果已经有支付成功的记录
|
|
|
- if(CollectionUtils.isNotEmpty(fsStorePayments)){
|
|
|
- for (FsStorePayment fsStorePayment : fsStorePayments) {
|
|
|
- // 如果状态为已支付或者已经退款
|
|
|
- if(ObjectUtil.equal(fsStorePayment.getStatus(),1) || ObjectUtil.equal(fsStorePayment.getStatus(), -1)){
|
|
|
- return R.ok().put("orderId", orderId)
|
|
|
- .put("payCode", payCode)
|
|
|
- .put("status", fsStorePayment.getStatus());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 如果没找到,查看付款信息是否有未支付的 且 类型为tzbank 且 trade_no 不为空的数据
|
|
|
- // 调用台州银行接口查询订单信息
|
|
|
- List<FsStorePayment> fsStorePayments1;
|
|
|
- if(ObjectUtil.isNotNull(orderId)){
|
|
|
- fsStorePayments1 = fsStorePaymentMapper.selectFsStorePaymentTzUnpayByOrder(orderId);
|
|
|
- } else {
|
|
|
- fsStorePayments1 = fsStorePaymentMapper.selectFsStorePaymentTzUnpayByPayCode(payCode);
|
|
|
- }
|
|
|
-
|
|
|
- if(CollectionUtils.isNotEmpty(fsStorePayments1)){
|
|
|
- FsStorePayment fsStorePayment = fsStorePayments1.get(0);
|
|
|
-
|
|
|
- RequestDTO<QueryOrderRestDTO> requestDTO = new RequestDTO<>();
|
|
|
-
|
|
|
- QueryOrderRestDTO queryOrderRestDTO = new QueryOrderRestDTO();
|
|
|
-
|
|
|
- queryOrderRestDTO.setOrderFlowNo(fsStorePayment.getTradeNo());
|
|
|
- TzConfigInfoDTO tzConfigInfoDTO = TzConfigUtils.getConfig();
|
|
|
-
|
|
|
- queryOrderRestDTO.setPlatMerCstNo(tzConfigInfoDTO.getPlatMerCstNo());
|
|
|
-
|
|
|
- requestDTO.setReqBody(queryOrderRestDTO);
|
|
|
- requestDTO.setReqHeader(TzReqHeaderDTO.getInstance(fsStorePayment.getPayCode()));
|
|
|
-
|
|
|
- TzReqResultDTO<QueryOrderInfoDTO> resultDTO = null;
|
|
|
- try {
|
|
|
- resultDTO = tzBankService.payQueryOrder(requestDTO);
|
|
|
- String retCode = resultDTO.getRetCode();
|
|
|
- // 如果查询支付成功
|
|
|
- if(retCode.equals("00000000")){
|
|
|
- QueryOrderInfoDTO body = resultDTO.getBody();
|
|
|
- String status = body.getStatus();
|
|
|
- if("90".equals(status)){
|
|
|
- // 如果查询支付成功 更新订单状态
|
|
|
- orderService.payConfirm(1,orderId,fsStorePayment.getPayCode(),
|
|
|
- fsStorePayment.getTradeNo(),body.getChlTrxId(),fsStorePayment.getTradeNo());
|
|
|
- return R.ok().put("orderId", orderId)
|
|
|
- .put("payCode", payCode)
|
|
|
- .put("status", 1);
|
|
|
- } else if("70".equals(status)) {
|
|
|
- return R.ok().put("orderId", orderId)
|
|
|
- .put("payCode", payCode)
|
|
|
- .put("status", -1);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("台州银行支付回调查询失败:",e);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- FsStoreOrder order=orderService.selectFsStoreOrderById(orderId);
|
|
|
-
|
|
|
- if(ObjectUtil.isNotNull(order)){
|
|
|
- return R.ok().put("orderId",orderId)
|
|
|
- .put("payCode", payCode)
|
|
|
- .put("status", order.getStatus());
|
|
|
- } else {
|
|
|
- // 如果没有订单信息可能是从微信收款而来
|
|
|
- return R.ok().put("orderId", orderId)
|
|
|
- .put("payCode", payCode)
|
|
|
- .put("status", 0);
|
|
|
- }
|
|
|
+ @RequestParam(value = "payCode",required = false) String payCode){
|
|
|
|
|
|
+ logger.info("获取订单-轮询获取信息, 订单ID: {}, payCode: {}", orderId,payCode);
|
|
|
+ return orderService.getStoreOrderByOrderIdTz(orderId,payCode);
|
|
|
}
|
|
|
|
|
|
|
|
|
@Login
|
|
|
@ApiOperation("确认订单")
|
|
|
@PostMapping("/confirm")
|
|
|
- public R confirm(@Validated @RequestBody FsStoreConfirmOrderParam param, HttpServletRequest request){
|
|
|
+ public R confirm(@Validated @RequestBody FsStoreConfirmOrderParam param){
|
|
|
return orderService.confirmOrder(Long.parseLong(getUserId()),param);
|
|
|
}
|
|
|
@Login
|
|
|
@ApiOperation("计算订单金额")
|
|
|
@PostMapping("/computed")
|
|
|
- public R computed(@Validated @RequestBody FsStoreOrderComputedParam param, HttpServletRequest request){
|
|
|
+ public R computed(@Validated @RequestBody FsStoreOrderComputedParam param){
|
|
|
FsStoreOrderComputeDTO dto=orderService.computedOrder(Long.parseLong(getUserId()),param);
|
|
|
return R.ok().put("data",dto);
|
|
|
}
|
|
@@ -322,7 +229,7 @@ public class StoreOrderController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("创建订单")
|
|
|
@PostMapping("/create")
|
|
|
- public R create(@Validated @RequestBody FsStoreOrderCreateParam param, HttpServletRequest request){
|
|
|
+ public R create(@Validated @RequestBody FsStoreOrderCreateParam param){
|
|
|
return orderService.createOrder(Long.parseLong(getUserId()),param);
|
|
|
}
|
|
|
|
|
@@ -330,8 +237,7 @@ public class StoreOrderController extends AppBaseController {
|
|
|
@ApiOperation("支付")
|
|
|
@PostMapping("/pay")
|
|
|
@RepeatSubmit
|
|
|
- //@Synchronized
|
|
|
- public R pay(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param)
|
|
|
+ public R pay(@Validated @RequestBody FsStoreOrderPayParam param)
|
|
|
{
|
|
|
logger.info("开始处理支付请求, 订单号: {}, 支付类型: {}", param.getOrderId(), param.getPayType());
|
|
|
R result = null;
|
|
@@ -355,7 +261,7 @@ public class StoreOrderController extends AppBaseController {
|
|
|
@ApiOperation("修改支付类型")
|
|
|
@PostMapping("/editPayType")
|
|
|
@Transactional
|
|
|
- public R editPayType(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param) {
|
|
|
+ public R editPayType(@Validated @RequestBody FsStoreOrderPayParam param) {
|
|
|
FsStoreOrder order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
if(order==null){
|
|
|
return R.error("订单不存在");
|
|
@@ -363,14 +269,6 @@ public class StoreOrderController extends AppBaseController {
|
|
|
if(order.getStatus()!= OrderInfoEnum.STATUS_0.getValue()){
|
|
|
return R.error("订单状态不正确");
|
|
|
}
|
|
|
-// String userAddress = order.getUserAddress();
|
|
|
-// String noAdd="南通市,镇江市,淮安市,江阴市,金华市,驻马店市,民权县";
|
|
|
-// String[] split = noAdd.split(",");
|
|
|
-// for (String s : split) {
|
|
|
-// if (userAddress.contains(s)){
|
|
|
-// return R.error("此地区暂不支持配送");
|
|
|
-// }
|
|
|
-// }
|
|
|
|
|
|
String orderId=redisCache.getCacheObject("isPaying:"+order.getId());
|
|
|
if(StringUtils.isNotEmpty(orderId)&&orderId.equals(order.getId().toString())){
|
|
@@ -460,7 +358,7 @@ public class StoreOrderController extends AppBaseController {
|
|
|
@ApiOperation("支付尾款")
|
|
|
@PostMapping("/payRemain")
|
|
|
@Transactional
|
|
|
- public R payRemain(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param) {
|
|
|
+ public R payRemain(@Validated @RequestBody FsStoreOrderPayParam param) {
|
|
|
FsStoreOrder order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
if(order==null){
|
|
|
return R.error("订单不存在");
|
|
@@ -661,7 +559,7 @@ public class StoreOrderController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("获取订单总数")
|
|
|
@GetMapping("/getOrderCount")
|
|
|
- public R getOrderCount( HttpServletRequest request){
|
|
|
+ public R getOrderCount(){
|
|
|
Integer count0=orderService.selectFsStoreOrderCount(Long.parseLong(getUserId()),0);
|
|
|
Integer count1=orderService.selectFsStoreOrderCount(Long.parseLong(getUserId()),1);
|
|
|
Integer count2=orderService.selectFsStoreOrderCount(Long.parseLong(getUserId()),2);
|