Commit 72a11d83 authored by mengbali153's avatar mengbali153

在线点单一版

parent 5105aab0
......@@ -129,7 +129,12 @@ public class UserControler extends UserController {
if (merchantInfo.getCode() == 200) {
Merchant data = merchantInfo.getData();
if (data.getManageStatus() == 1) {
return R.failed("当前商户已关闭");
// return R.failed("当前商户已关闭");
data.setManageStatus((byte)0);
BaseResponse updatemerchant = merchantService.updatemerchant(data);
return R.ok(updatemerchant);
}else{
return R.ok("当前商户已开启");
}
}
if ("ADMIN".equals(user.getSysUser().getLevel())) {
......@@ -162,6 +167,16 @@ public class UserControler extends UserController {
}
}
@ApiOperation("收银端退出")
@ApiImplicitParam(name = "deviceCode", value = "当前设备号", dataType = "String", paramType = "query")
@PostMapping("/close")
public R closeCashier(@RequestParam("deviceCode") String deviceCode) {
Merchant merchByDevice = iMerchantService.getMerchByDevice(deviceCode);
merchByDevice.setManageStatus((byte)1);
BaseResponse updatemerchant = iMerchantService.updatemerchant(merchByDevice);
return R.ok(updatemerchant);
}
@PostMapping("/check/pwd")
@ApiOperation("验证敏感操作密码")
......
......@@ -26,4 +26,7 @@ public interface IDeviceService {
@DeleteMapping("page")
public BaseResponse devicePage(@RequestParam("merchId") Long merchId, @RequestParam("typeId") Integer typeId,
@SpringQueryMap PageQuery pageQuery);
@GetMapping("/getDeviceBySeller")
public Device getDeviceBySeller(Long merchId);
}
......@@ -40,6 +40,9 @@ public interface IMerchantService {
@PostMapping("getMerchNames")
BaseResponse getMerchNameByIds(@RequestBody List<Long> merchIds);
@PostMapping("getMerchByDevice")
Merchant getMerchByDevice(@RequestParam("deviceCode") String deviceCode);
@GetMapping("getMerchNameByIds")
BaseResponse getMerchantByIds(@RequestParam("ids") List<Long> ids);
......
......@@ -33,4 +33,9 @@ public class DeviceServiceImpl implements IDeviceService {
public BaseResponse devicePage(Long merchId, Integer typeId, PageQuery pageQuery) {
return null;
}
@Override
public Device getDeviceBySeller(Long merchId) {
return null;
}
}
......@@ -32,6 +32,12 @@ public class MerchantImpl implements IMerchantService {
return null;
}
@Override
public Merchant getMerchByDevice(String device) {
error();
return null;
}
@Override
public BaseResponse getDeviceUser(String deviceCode, String username) {
error();
......
......@@ -68,6 +68,13 @@ public class DeviceController {
return BaseResponse.ok(result);
}
public List<Device> getMerchDevicesV2(@PathVariable("merchId") Long merchId) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("merch_id", merchId);
List<Device> result = deviceService.list(wrapper);
return result;
}
@DeleteMapping("delete/{id}")
public BaseResponse deleteDevice(@PathVariable("id") Long id) {
if (id == null) {
......@@ -96,4 +103,15 @@ public class DeviceController {
page = (Page<Device>) deviceService.page(page, wrapper);
return BaseResponse.ok(page);
}
@GetMapping("/getDeviceBySeller")
public Device getDeviceBySeller(Long merchId) {
// QueryWrapper wrapper = new QueryWrapper();
// wrapper.eq("merch_id", merchId);
// Device one = deviceService.getOne(wrapper);
List<Device> merchDevicesV2 = getMerchDevicesV2(merchId);
Device device = merchDevicesV2.get(1);
return device;
}
}
package cn.wise.sc.pay.business.merchant.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.wise.sc.pay.business.merchant.service.IDeviceService;
import cn.wise.sc.pay.business.merchant.service.IDeviceUserService;
import cn.wise.sc.pay.business.merchant.service.IMerchantService;
import cn.wise.sc.pay.common.core.model.BaseController;
......@@ -8,6 +9,7 @@ import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.common.core.query.PageQuery;
import cn.wise.sc.pay.common.core.query.PageWrapperQuery;
import cn.wise.sc.pay.common.core.query.TimeBucket;
import cn.wise.sc.pay.domain.merchant.bean.Device;
import cn.wise.sc.pay.domain.merchant.bean.DeviceUser;
import cn.wise.sc.pay.domain.merchant.bean.Merchant;
import cn.wise.sc.pay.domain.merchant.excelvo.MerchantExcelVO;
......@@ -67,6 +69,9 @@ public class MerchantController extends BaseController<IMerchantService, Merchan
@Autowired
IDeviceUserService deviceUserService;
@Autowired
IDeviceService deviceService;
@Autowired
UserRoleService userRoleService;
......@@ -85,6 +90,14 @@ public class MerchantController extends BaseController<IMerchantService, Merchan
return BaseResponse.ok(merchantService.list(wrapper));
}
@PostMapping("getMerchByDevice")
public Merchant getMerchByDevice(String deviceCode) {
Long byDevice = merchantService.getMerchByDevice(deviceCode);
Merchant merchant = merchantService.getById(byDevice);
return merchant;
}
@GetMapping("like")
public BaseResponse getMerchList(@RequestParam(value = "merchName", required = false) String merchName) {
QueryWrapper wrapper = new QueryWrapper();
......
......@@ -47,6 +47,14 @@ public interface IMerchantService extends IService<Merchant> {
*/
BaseResponse updateMerchant(Merchant merchant);
/**
* 获取设备所属的商户id
*
* @param deviceCode
* @return
*/
Long getMerchByDevice(String deviceCode);
/**
* 根据条件获取商户列表
*
......
......@@ -165,6 +165,15 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant>
return result ? BaseResponse.ok("成功删除商户") : BaseResponse.error("删除商户失败", Merchant.class);
}
@Override
public Long getMerchByDevice(String deviceCode) {
QueryWrapper qw = new QueryWrapper();
qw.eq("device_code",deviceCode);
Device device = deviceService.getOne(qw);
Long merchId = device.getMerchId();
return merchId;
}
@Override
public BaseResponse updateMerchant(Merchant merchant) {
merchant.setUpdateTime(System.currentTimeMillis());
......
......@@ -6,6 +6,7 @@ import cn.wise.sc.pay.common.core.query.PageWrapperQuery;
import cn.wise.sc.pay.domain.order.excel.OrderExcel;
import cn.wise.sc.pay.domain.order.model.OrderResponse;
import cn.wise.sc.pay.domain.order.model.OrderStatus;
import cn.wise.sc.pay.domain.order.model.Orders;
import cn.wise.sc.pay.domain.order.model.StatisticsGoods;
import cn.wise.sc.pay.domain.order.query.OrderDetailQuery;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
......@@ -281,4 +282,13 @@ public interface IOrdersService {
BaseResponse<List<StatisticsGoods>> statisticsGoodsMarketMoneyGroupSellerGood(PageWrapperQuery pageWrapperQuery);
/**
* 根据订单号查询订单
*
* @param orderNo 订单号
* @return
*/
@GetMapping("/getOrderByOrderNo")
Orders getOrderByOrderNo(@PathVariable("orderNo") String orderNo);
}
......@@ -7,6 +7,7 @@ import cn.wise.sc.pay.common.core.query.PageWrapperQuery;
import cn.wise.sc.pay.domain.order.excel.OrderExcel;
import cn.wise.sc.pay.domain.order.model.OrderResponse;
import cn.wise.sc.pay.domain.order.model.OrderStatus;
import cn.wise.sc.pay.domain.order.model.Orders;
import cn.wise.sc.pay.domain.order.query.OrderDetailQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -165,6 +166,11 @@ public class IOrderImpl implements IOrdersService {
}
@Override
public Orders getOrderByOrderNo(String orderNo) {
return null;
}
Logger logger = LoggerFactory.getLogger(this.getClass());
/**
......
......@@ -355,6 +355,19 @@ public class OrderController {
return ordersService.statisticsGoodsMarketMoneyGroupSellerGood(pageWrapperQuery);
}
/**
* 根据订单号查询订单
*
* @param orderNo 订单号
* @return
*/
@GetMapping("/getOrderByOrderNo")
public Orders getOrderByOrderNo(@PathVariable("orderNo") String orderNo){
QueryWrapper qw =new QueryWrapper();
qw.eq("order_no",orderNo);
return ordersService.getOne(qw);
}
/**
* JSON转MAP
*
......
......@@ -5,7 +5,9 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.pay.api.merchant.service.IDeviceService;
import cn.wise.sc.pay.api.merchant.service.IMerchantProfitService;
import cn.wise.sc.pay.api.merchant.service.IMerchantService;
import cn.wise.sc.pay.business.goods.service.ISpcDetailService;
import cn.wise.sc.pay.business.order.configure.WX_Util;
import cn.wise.sc.pay.business.order.model.BizContent;
......@@ -23,6 +25,7 @@ import cn.wise.sc.pay.business.order.utils.UgcContentUtil;
import cn.wise.sc.pay.business.order.weichat.model.OAuthAccessToken;
import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.common.mq.client.dto.TransactionMessage;
import cn.wise.sc.pay.domain.merchant.bean.Device;
import cn.wise.sc.pay.domain.order.model.OrderResponse;
import cn.wise.sc.pay.domain.order.model.OrderStatus;
import cn.wise.sc.pay.domain.order.model.Orders;
......@@ -37,6 +40,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -85,6 +89,12 @@ public class WXController {
ISafeguardService iSafeguardService;
final
Producer producer;
@Autowired
IMerchantService iMerchantService;
// @Autowired
// IDeviceService iDeviceService;
final
IDeviceService iDeviceService;
@Value("${wechat.suqiancredit.appId}")
String WECHAT_APPID;
@Value("${wechat.suqiancredit.secret}")
......@@ -97,13 +107,15 @@ public class WXController {
ISpcDetailService iSpcDetailService,
IMerchantProfitService merchantProfitService,
Producer producer,
ISafeguardService iSafeguardService) {
ISafeguardService iSafeguardService,
IDeviceService iDeviceService) {
this.wxPayService = wxPayService;
this.iOrdersService = iOrdersService;
this.iSpcDetailService = iSpcDetailService;
this.merchantProfitService = merchantProfitService;
this.producer = producer;
this.iSafeguardService = iSafeguardService;
this.iDeviceService = iDeviceService;
}
/**
......@@ -260,6 +272,7 @@ public class WXController {
//将订单号存到保留域
String mchReserved = body + "|" + orderId;
//微信下单时 支付方式
Function<PayParamQuery, BaseResponse> zfbUnifiedFuc = arg ->
wxPayService.servicePay(arg.getUnifiedOrderNo(), arg.getTxnAmt(),
......@@ -276,6 +289,56 @@ public class WXController {
log.info("=====================requestIp==========================");
log.info(requestIp);
//
// if (body == "oxo-pay"){
// //微信支付时的参数
// PayParamQuery payParamQuery = PayParamQuery.builder()
// .requestIp(requestIp)
// .openId(openId)
// .unifiedOrderNo(orderId)
// .payMethod(0)
// .build();
//
//// QueryWrapper qw =new QueryWrapper();
//// qw.eq("order_no",orderId);
////
//// Orders one = iOrdersService.getOne(qw);
// log.info("=====================mchReserved!!!!!!!!!!!!!!!!!!!!!!!==========================");
//// Long sellerId = one.getSellerId();
//// Device deviceBySeller = iDeviceService.getDeviceBySeller(sellerId);
//// String deviceCode = deviceBySeller.getDeviceCode();
// String deviceCode = "T208D94L40388";
// String mchReserved = deviceCode + "|" + orderId;
// log.info(mchReserved);
//
// //微信下单时 支付方式
// Function<PayParamQuery, BaseResponse> wxUnifiedFuc = arg ->
// wxPayService.wxPay(arg.getRequestIp(), arg.getUnifiedOrderNo(),
// arg.getTxnAmt(), arg.getOpenId(), mchReserved, arg.getSellerId() + "");
//
//
// return unifiedOrder(orderId, wxUnifiedFuc, payParamQuery);
// }else {
// //微信支付时的参数
// PayParamQuery payParamQuery = PayParamQuery.builder()
// .requestIp(requestIp)
// .openId(openId)
// .unifiedOrderNo(orderId)
// .payMethod(0)
// .build();
//
// //将订单号存到保留域
// String mchReserved = body + "|" + orderId;
//
// //微信下单时 支付方式
// Function<PayParamQuery, BaseResponse> wxUnifiedFuc = arg ->
// wxPayService.wxPay(arg.getRequestIp(), arg.getUnifiedOrderNo(),
// arg.getTxnAmt(), arg.getOpenId(), mchReserved, arg.getSellerId() + "");
//
//
// return unifiedOrder(orderId, wxUnifiedFuc, payParamQuery);
// }
//微信支付时的参数
PayParamQuery payParamQuery = PayParamQuery.builder()
......@@ -284,6 +347,7 @@ public class WXController {
.unifiedOrderNo(orderId)
.payMethod(0)
.build();
//将订单号存到保留域
String mchReserved = body + "|" + orderId;
......@@ -292,6 +356,7 @@ public class WXController {
wxPayService.wxPay(arg.getRequestIp(), arg.getUnifiedOrderNo(),
arg.getTxnAmt(), arg.getOpenId(), mchReserved, arg.getSellerId() + "");
return unifiedOrder(orderId, wxUnifiedFuc, payParamQuery);
}
......@@ -836,23 +901,57 @@ public class WXController {
if (StrUtil.isBlank(msgInfo)) {
log.error("打印小票的消息失败!预保留域为空!");
}
log.info("--------------------------");
log.info("orders="+orders);
log.info("masInfo="+msgInfo);
log.info("--------------------------");
//收银系统 打印小票
if ("cashier".equals(orders.getPaas())) {
String[] strs = msgInfo.split("\\|");
if (strs.length >= 2) {
String msg = strs[strs.length - 3];
// String msg = strs[strs.length - 3];
String msg = strs[strs.length - 2];
String sn = strs[strs.length - 2];
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(msg + "|" + orders.getOrderNo());
transactionMessage.setQueue(sn);
transactionMessage.setRouteKey(sn);
try {
log.info("打印小票 msg :{}", JSON.toJSONString(transactionMessage));
mqpost(transactionMessage);
} catch (IOException e) {
log.error("收银端打印小票,mq消息推送失败!");
e.printStackTrace();
log.info(msg+"-------------------"+sn);
if (msg == "oxo-pay"){
String deviceNo = "T208D94L40388";
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(deviceNo + "|" + orders.getOrderNo());
transactionMessage.setQueue(deviceNo);
transactionMessage.setRouteKey(deviceNo);
transactionMessage.setStatus(999);
log.info(transactionMessage.toString());
try {
log.info("打印小票 msg :{}", JSON.toJSONString(transactionMessage));
mqpost(transactionMessage);
} catch (IOException e) {
log.error("收银端打印小票,mq消息推送失败!");
e.printStackTrace();
}
}else {
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(msg + "|" + orders.getOrderNo());
transactionMessage.setQueue(sn);
transactionMessage.setRouteKey(sn);
try {
log.info("打印小票 msg :{}", JSON.toJSONString(transactionMessage));
mqpost(transactionMessage);
} catch (IOException e) {
log.error("收银端打印小票,mq消息推送失败!");
e.printStackTrace();
}
}
// TransactionMessage transactionMessage = new TransactionMessage();
// transactionMessage.setMessage(msg + "|" + orders.getOrderNo());
// transactionMessage.setQueue(sn);
// transactionMessage.setRouteKey(sn);
// try {
// log.info("打印小票 msg :{}", JSON.toJSONString(transactionMessage));
// mqpost(transactionMessage);
// } catch (IOException e) {
// log.error("收银端打印小票,mq消息推送失败!");
// e.printStackTrace();
// }
}
}
......@@ -861,7 +960,8 @@ public class WXController {
if ("APP".equals(orders.getPaas())) {
String[] strs = msgInfo.split("\\|");
if (strs.length >= 2) {
String msg = strs[strs.length - 3];
// String msg = strs[strs.length - 3];
String msg = strs[strs.length - 2];
String sn = strs[strs.length - 2];
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(msg + "|" + orders.getOrderNo());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment