添加拉卡拉设备绑定解绑功能
This commit is contained in:
Binary file not shown.
@@ -14,6 +14,7 @@ import cn.pluss.platform.dto.DeviceStockDTO;
|
|||||||
import cn.pluss.platform.entity.*;
|
import cn.pluss.platform.entity.*;
|
||||||
import cn.pluss.platform.enums.DeviceOperateType;
|
import cn.pluss.platform.enums.DeviceOperateType;
|
||||||
import cn.pluss.platform.exception.MsgException;
|
import cn.pluss.platform.exception.MsgException;
|
||||||
|
import cn.pluss.platform.klk.service.LklPayService;
|
||||||
import cn.pluss.platform.mapper.DeviceStockMapper;
|
import cn.pluss.platform.mapper.DeviceStockMapper;
|
||||||
import cn.pluss.platform.mapper.DeviceTypeMapper;
|
import cn.pluss.platform.mapper.DeviceTypeMapper;
|
||||||
import cn.pluss.platform.merchant.MerchantCashPayCodeService;
|
import cn.pluss.platform.merchant.MerchantCashPayCodeService;
|
||||||
@@ -159,6 +160,10 @@ public class DeviceStockServiceImpl extends ServiceImpl<DeviceStockMapper, Devic
|
|||||||
merchantDeviceService.save(merchantDevice);
|
merchantDeviceService.save(merchantDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
LklPayService lklPayService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void unbind(Long id) {
|
public void unbind(Long id) {
|
||||||
@@ -175,6 +180,16 @@ public class DeviceStockServiceImpl extends ServiceImpl<DeviceStockMapper, Devic
|
|||||||
|
|
||||||
DeviceStock device = getById(id);
|
DeviceStock device = getById(id);
|
||||||
|
|
||||||
|
if(device.getSnNo().startsWith("QR")){
|
||||||
|
MerchantBaseInfo merchantBaseInfo=merchantBaseInfoService.getMerchantBaseInfoByUserId(device.getBuyMercId());
|
||||||
|
|
||||||
|
|
||||||
|
boolean flag=lklPayService.deactivate(merchantBaseInfo,device.getSnNo());
|
||||||
|
if(!flag){
|
||||||
|
MsgException.checkNull(null,"解绑设备异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 删除设备收银点关联的信息
|
// 删除设备收银点关联的信息
|
||||||
MerchantCashPayCode cashPayCode = cashPayCodeService.getByPayCode(device.getSnNo());
|
MerchantCashPayCode cashPayCode = cashPayCodeService.getByPayCode(device.getSnNo());
|
||||||
if (cashPayCode != null) {
|
if (cashPayCode != null) {
|
||||||
@@ -335,6 +350,7 @@ public class DeviceStockServiceImpl extends ServiceImpl<DeviceStockMapper, Devic
|
|||||||
return pageMercDevice(page, userApp.getUserId(), cashPlaceId);
|
return pageMercDevice(page, userApp.getUserId(), cashPlaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定设备V2
|
* 绑定设备V2
|
||||||
*
|
*
|
||||||
@@ -385,6 +401,14 @@ public class DeviceStockServiceImpl extends ServiceImpl<DeviceStockMapper, Devic
|
|||||||
}
|
}
|
||||||
|
|
||||||
MsgException.checkNull(merchant, "当前商户还未认证成商户,暂时无法进行绑定操作");
|
MsgException.checkNull(merchant, "当前商户还未认证成商户,暂时无法进行绑定操作");
|
||||||
|
if(snNo.startsWith("QR")){
|
||||||
|
Boolean flag= lklPayService.activityCloudDevice(merchant,snNo);
|
||||||
|
if(!flag){
|
||||||
|
MsgException.checkNull(null,"绑定设备异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
stock.setActMercName(merchant.getAlias());
|
stock.setActMercName(merchant.getAlias());
|
||||||
stock.setActMercId(String.valueOf(merchant.getId()));
|
stock.setActMercId(String.valueOf(merchant.getId()));
|
||||||
stock.setStatus("3");
|
stock.setStatus("3");
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class LklPayService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public JSONObject activityCloudDevice(MerchantBaseInfo merchantBaseInfo,String sno){
|
public boolean activityCloudDevice(MerchantBaseInfo merchantBaseInfo,String sno){
|
||||||
QueryWrapper<MerchantBackLkl> queryWrapper=new QueryWrapper<>();
|
QueryWrapper<MerchantBackLkl> queryWrapper=new QueryWrapper<>();
|
||||||
queryWrapper.eq("merchant_code",merchantBaseInfo.getMerchantCode());
|
queryWrapper.eq("merchant_code",merchantBaseInfo.getMerchantCode());
|
||||||
queryWrapper.eq("channel","5");
|
queryWrapper.eq("channel","5");
|
||||||
@@ -107,18 +107,51 @@ public class LklPayService {
|
|||||||
if (ObjectUtil.isNotEmpty(response)) {
|
if (ObjectUtil.isNotEmpty(response)) {
|
||||||
JSONObject object = JSONObject.parseObject(response);
|
JSONObject object = JSONObject.parseObject(response);
|
||||||
if (object.containsKey("retCode") && "000000".equals(object.getString("retCode"))) {
|
if (object.containsKey("retCode") && "000000".equals(object.getString("retCode"))) {
|
||||||
result.put("code", "0");
|
|
||||||
return result;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
result.put("code", ResultCode.FAIL.code());
|
|
||||||
result.put("msg", object.getString("retMsg"));
|
return false;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.error("==============>【拉卡拉】交易订单查询失败<==================");
|
return false;
|
||||||
result.put("code", ResultCode.FAIL.code());
|
|
||||||
result.put("msg", "订单查询异常");
|
}
|
||||||
return result;
|
|
||||||
|
public boolean deactivate(MerchantBaseInfo merchantBaseInfo,String sNo){
|
||||||
|
QueryWrapper<MerchantBackLkl> queryWrapper=new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("merchant_code",merchantBaseInfo.getMerchantCode());
|
||||||
|
queryWrapper.eq("channel","5");
|
||||||
|
MerchantBackLkl backLkl= merchantBackLklMapper.selectOne(queryWrapper);
|
||||||
|
MsgException.checkNull(backLkl,"缺失的进件信息"+merchantBaseInfo.getMerchantCode());
|
||||||
|
String req_time= DateUtils.getSdfTimes();
|
||||||
|
|
||||||
|
String body="{\n" +
|
||||||
|
" \"ver\":\"1.0.0\",\n" +
|
||||||
|
" \"timestamp\":\""+req_time+"\",\n" +
|
||||||
|
" \"reqId\":\""+req_time+"\",\n" +
|
||||||
|
" \"reqData\":{\n" +
|
||||||
|
" \"merId\":\""+backLkl.getExternalCustomerNo()+"\",\n" +
|
||||||
|
" \"termId\":\""+backLkl.getTermNos()+"\",\n" +
|
||||||
|
" \"sn\":\""+sNo+"\",\n" +
|
||||||
|
" \"source\":\"KSAAS\"\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
String response = req(body, "api/v2/iot/cloud/device/deactivate");
|
||||||
|
if (ObjectUtil.isNotEmpty(response)) {
|
||||||
|
JSONObject object = JSONObject.parseObject(response);
|
||||||
|
if (object.containsKey("retCode") && "000000".equals(object.getString("retCode"))) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,22 +701,36 @@ public class LklPayService {
|
|||||||
// mothod="api/v2/saas/query/wx_openid_query";
|
// mothod="api/v2/saas/query/wx_openid_query";
|
||||||
|
|
||||||
|
|
||||||
|
// String body="{\n" +
|
||||||
|
// " \"ver\":\"1.0.0\",\n" +
|
||||||
|
// " \"timestamp\":\""+req_time+"\",\n" +
|
||||||
|
// " \"reqId\":\""+req_time+"\",\n" +
|
||||||
|
// " \"reqData\":{\n" +
|
||||||
|
// " \"merId\":\"8227910593200K2\",\n" +
|
||||||
|
// " \"termId\":\"C7958968\",\n" +
|
||||||
|
// " \"sn\":\"QR939000089076\",\n" +
|
||||||
|
// " \"businessType\":\"1\",\n" +
|
||||||
|
// " \"shopName\":\"天地鉴宝\",\n" +
|
||||||
|
// " \"source\":\"LOAP\",\n" +
|
||||||
|
// " \"merOrgNo\":\"966805\"\n" +
|
||||||
|
// " }\n" +
|
||||||
|
// "}";
|
||||||
|
//
|
||||||
|
// mothod="api/v2/iot/cloud/device/activate";
|
||||||
|
|
||||||
|
|
||||||
String body="{\n" +
|
String body="{\n" +
|
||||||
" \"ver\":\"1.0.0\",\n" +
|
" \"ver\":\"1.0.0\",\n" +
|
||||||
" \"timestamp\":\""+req_time+"\",\n" +
|
" \"timestamp\":\""+req_time+"\",\n" +
|
||||||
" \"reqId\":\""+req_time+"\",\n" +
|
" \"reqId\":\""+req_time+"\",\n" +
|
||||||
" \"reqData\":{\n" +
|
" \"reqData\":{\n" +
|
||||||
" \"merId\":\"8227910593200K2\",\n" +
|
" \"merId\":\"8227910593200K2\",\n" +
|
||||||
" \"termId\":\"C7958968\",\n" +
|
" \"termId\":\"C7958968\",\n" +
|
||||||
" \"sn\":\"QR939000089076\",\n" +
|
" \"sn\":\"QR939000089076\",\n" +
|
||||||
" \"businessType\":\"1\",\n" +
|
" \"source\":\"KSAAS\"\n" +
|
||||||
" \"shopName\":\"天地鉴宝\",\n" +
|
|
||||||
" \"source\":\"LOAP\",\n" +
|
|
||||||
" \"merOrgNo\":\"966805\"\n" +
|
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
|
mothod="api/v2/iot/cloud/device/deactivate";
|
||||||
mothod="api/v2/iot/cloud/device/activate";
|
|
||||||
|
|
||||||
|
|
||||||
String authorization = getAuthorization(body, appId, mchSerialNo, privateKeyPath);
|
String authorization = getAuthorization(body, appId, mchSerialNo, privateKeyPath);
|
||||||
|
|||||||
@@ -482,10 +482,10 @@ public class MerchantChannelStatusServiceImpl extends ServiceImpl<MerchantChanne
|
|||||||
accountChannelVO.setOtherChannel("0");
|
accountChannelVO.setOtherChannel("0");
|
||||||
}else if (one.getValid() == -1){
|
}else if (one.getValid() == -1){
|
||||||
accountChannelVO.setOtherChannel("2");
|
accountChannelVO.setOtherChannel("2");
|
||||||
}else if (one.getChannel() == null){
|
|
||||||
accountChannelVO.setOtherChannel("3");
|
|
||||||
}else if (Objects.equals(one.getStatus(), "3")){
|
}else if (Objects.equals(one.getStatus(), "3")){
|
||||||
accountChannelVO.setOtherChannel("4");
|
accountChannelVO.setOtherChannel("4");
|
||||||
|
}else if (one.getChannel() == null){
|
||||||
|
accountChannelVO.setOtherChannel("3");
|
||||||
}else if(Objects.equals(one.getStatus(), "2")) {
|
}else if(Objects.equals(one.getStatus(), "2")) {
|
||||||
accountChannelVO.setOtherChannel("0");
|
accountChannelVO.setOtherChannel("0");
|
||||||
}else {
|
}else {
|
||||||
|
|||||||
Reference in New Issue
Block a user