"拉卡拉进件支付代码"

This commit is contained in:
hankaikai 2023-06-09 15:24:35 +08:00
parent 3c7b7ad5a7
commit 2527ffb4af
9 changed files with 195 additions and 2 deletions

View File

@ -71,6 +71,7 @@ public class TokenRegistryInterceptor extends HandlerInterceptorAdapter {
limitUri.add("/api/lkl/lklCallBack");
limitUri.add("/api/lkl/queryMerchantChannelStatus");
limitUri.add("/api/auditCallback/tradeCallBack");
limitUri.add("/api/merchantOrder/posTradeQuery");
boolean passFlag = limitUri.stream().anyMatch(s -> s.equals(requestUri) || requestUri.startsWith(s));
if (passFlag) {
return true;

View File

@ -84,13 +84,16 @@ public class TokenUtil {
finalMap.put("TOKEN", RSASignature.sign(encode, RSAUtil.CERT));
return finalMap;
}
public static void main(String[] args) throws Exception{
String s = String.valueOf(System.currentTimeMillis());
System.out.println(s);
String s1 = UUID.randomUUID().toString();
System.out.println(s1);
String param = "{\"ordNo\":\"2017031601582703488262843972\",\"mno\":\"399190513665034\"}";
Map<String, String> token = getToken(s, s1, APP_ID);
String param = "{\"date\":null,\"sn\":\"ZF544CG02S00001\",\"type\":null,\"page\":1,\"size\":10}";
Map<String, String> token = getToken(s, s1, APP_ID,param);
System.out.println(token);

View File

@ -0,0 +1,28 @@
package cn.pluss.platform.pos;
import lombok.Data;
import java.io.Serializable;
@Data
public class BasePosReq implements Serializable {
/**
* 请求标识用于唯一标识当前请求(pos,uuid)
*/
private String requestId;
/**
* 唯一识别码(pos机)
*/
private String appId;
/**
* 签名pos
*/
private String token;
/**
* timestamp时间戳pos机
*/
private String timestamp;
}

View File

@ -0,0 +1,41 @@
package cn.pluss.platform.pos;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
@Data
public class PosTradeQueryReq extends BasePosReq{
/**
* 订单号
*/
private String date;
/**
* 设备编号
*/
private String sn;
/**
* 搜索类型
* 1按日期检索
* 2按照月份检索
*/
private String type;
/**
* 页码
*/
private Integer page;
/**
* 单页搜索条数
*/
private Integer size;
public static void main(String[] args) throws JsonProcessingException {
System.out.println(new ObjectMapper().writeValueAsString(new PosTradeQueryReq()));
}
}

View File

@ -425,5 +425,8 @@ public interface MerchantOrderService extends IService<MerchantOrder> {
Integer getValidNumByMerchantCode(String merchantCode);
// void sendPayCallBackArrival(String userId,String orderNumber,Double consumeFee);
Result<Object> posTradeQuery(String merchantCode,String date,String type,Integer page,Integer size);
}

View File

@ -1,5 +1,6 @@
package cn.pluss.platform.merchantOrder.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.SecureUtil;
import cn.pluss.platform.IdCardService;
import cn.pluss.platform.PushService;
@ -58,6 +59,7 @@ import cn.pluss.platform.vo.*;
import cn.pluss.platform.ys.YsBusinessCodeEnum;
import cn.pluss.platform.ys.YsOldConstants;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -71,6 +73,7 @@ import com.opencsv.CSVReaderBuilder;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.collections4.map.LinkedMap;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
@ -2494,4 +2497,70 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
public Integer getValidNumByMerchantCode(String merchantCode) {
return baseMapper.getValidNumByMerchantCode(merchantCode);
}
@Override
public Result<Object> posTradeQuery(String merchantCode, String date, String type, Integer pageIndex, Integer pageSize) {
QueryWrapper<MerchantOrder> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("merchantCode",merchantCode);
List<String> status=new ArrayList<>();
status.add("1");
status.add("2");
queryWrapper.in("status",status);
if(ObjectUtil.isNotEmpty(date)&&ObjectUtil.isNotEmpty(type)){
switch (type){
case "1":
queryWrapper.apply("DATE_FORMAT(createDt,'%Y-%m-%d')='"+date+"'");
break;
case "2":
queryWrapper.apply("DATE_FORMAT(createDt,'%Y-%m')='"+date+"'");
break;
default:
MsgException.check(false,"不存在的时间格式");
}
}
if(ObjectUtil.isNotEmpty(pageIndex)){
pageIndex=1;
}
if(ObjectUtil.isNotEmpty(pageSize)){
pageSize=10;
}
Page page = new Page<>(pageIndex, pageSize);
IPage<MerchantOrder> orderIPage= merchantOrderMapper.selectMapsPage(page,queryWrapper);
if(ObjectUtil.isNotEmpty(orderIPage)){
List<MerchantOrder> list= orderIPage.getRecords();
if(ObjectUtil.isNotEmpty(list)){
JSONObject object=new JSONObject();
object.put("current",orderIPage.getCurrent());
object.put("pages",orderIPage.getPages());
object.put("size",orderIPage.getSize());
object.put("total",orderIPage.getTotal());
JSONArray array=new JSONArray();
for (MerchantOrder merchantOrder : list) {
JSONObject object1=new JSONObject();
object1.put("orderNumber",merchantOrder.getOrderNumber());
object1.put("status",merchantOrder.getStatus().equals("1")?"1":"2");
object1.put("alias",merchantOrder.getMerchantName());
object1.put("transTime",merchantOrder.getTransDt());
object1.put("consumeFee",merchantOrder.getConsumeFee());
if(merchantOrder.getStatus().equals("2")){
object1.put("refundAmt",merchantOrder.getRefundAmt());
object1.put("refundTime",merchantOrder.getUpdateTime());
}
object1.put("payType",merchantOrder.getPayTypeCode().equals("wechatPay")?"wechatPay":merchantOrder.getPayTypeCode().equals("aliPay")?"aliPay":"bank");
array.add(object1);
}
object.put("records",array);
return ResultGenerator.genSuccessResult(object);
}
}
return ResultGenerator.genSuccessResult();
}
}

View File

@ -365,6 +365,10 @@ public class ApiPayServiceImpl implements ApiPayService {
if (StringUtil.isNotEmpty(isMember) && "1".equals(isMember)) {
return vipTradePay(jsonObject, store);
} else {
if (!StringUtil.isMoney(jsonObject.getString("payAmt"))){
MsgException.throwException("金额异常");
}
try {
JSONObject result = new JSONObject(10);
//构建订单

View File

@ -11,11 +11,16 @@ import cn.pluss.platform.klk.service.impl.LaKalaInterfaceImpl;
import cn.pluss.platform.mapper.*;
import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.merchant.MerchantCashPlaceService;
import cn.pluss.platform.notice.NoticeService;
import cn.pluss.platform.user.impl.GeneralPushUtil;
import cn.pluss.platform.userApp.UserAppService;
import cn.pluss.platform.util.IpUtils;
import cn.pluss.platform.util.LogExceptionUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@ -29,6 +34,7 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -80,6 +86,19 @@ public class LklMerAuditHandler{
private LakalaConfig lakalaConfig;
@Autowired
private GeneralPushUtil generalPushUtil;
@Setter(onMethod_ = {@Autowired})
private NoticeService noticeService;
@Autowired
private UserAppService uaService;
public void auditHandler(Map<String,Object> map) {
execute(map);
}
@ -206,6 +225,17 @@ public class LklMerAuditHandler{
mcsMapper.updateById(merchantChannelStatus);
}
QueryWrapper<MerchantBaseInfo> queryWrapper1=new QueryWrapper<>();
queryWrapper1.eq("merchantCode",merchantChannelStatus.getMerchantCode());
MerchantBaseInfo baseInfo=merchantBaseInfoService.getOne(queryWrapper1);
if(ObjectUtil.isNotEmpty(baseInfo)){
LambdaQueryWrapper<UserApp> qWrapper2 = Wrappers.lambdaQuery();
qWrapper2.eq(UserApp::getUserId, baseInfo.getUserId());
UserApp userApp = uaService.getOne(qWrapper2);
sendNotice(userApp, "收银呗审核通知","拉卡拉进件成功",merchantChannelStatus.getApplicationId());
}
return merchantChannelStatus;
}
@ -259,4 +289,15 @@ public class LklMerAuditHandler{
}
public void sendNotice(UserApp userApp, String title, String msg, String uniqueKey) {
Notice notice = new Notice(1, 1, userApp);
notice.setNoticeCode(uniqueKey);
notice.setConrtent(msg);
noticeService.saveMerAuthNotice(notice);
generalPushUtil.sendAllPlatByAlias(Collections.singletonList(userApp.getUserId() + ""), title, msg, "1");
}
}

View File

@ -924,6 +924,9 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
ysAuditServiceV2.editMerchantAudit(userId);
sendEditApplyNotice(userApp.getUserId() + "", mbi.getAlias(), "实时到账");
break;
case "5":
//更新拉卡拉进件信息
break;
default:
throw new MsgException("未知的进件通道");
}