Compare commits

...

7 Commits
master ... dev

Author SHA1 Message Date
deng aae4ef8b48 扫码王业务代码 2023-05-29 11:57:03 +08:00
hankaikai 790920f13e "拉卡拉进件支付代码" 2023-05-23 12:55:26 +08:00
hankaikai 52650b7ae0 "设备规格修改" 2023-05-23 12:50:46 +08:00
hankaikai c56357adc0 "设备规格修改" 2023-05-23 12:48:55 +08:00
hankaikai 085297700a "拉卡拉修改" 2023-05-23 12:47:17 +08:00
hankaikai 7d2f7b2d80 "设备规格修改" 2023-05-23 12:45:52 +08:00
hankaikai a344d0a9df "audit" 2023-05-23 12:42:41 +08:00
82 changed files with 5826 additions and 166 deletions

View File

@ -46,6 +46,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.*;
@ -388,7 +389,7 @@ public class MerchantOrderController {
@ApiOperation(value = "会员充值", notes = "APP扫码-会员充值", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "MemberRechargeDTO", value = "MemberRechargeDTO", paramType = "MemberRechargeDTO", dataType = "MemberRechargeDTO", required = true)})
public Result<Map<String, Object>> memberRecharge(@RequestBody MemberRechargeDTO memberRechargeDTO) {
public Result<Map<String, Object>> memberRecharge(@RequestBody MemberRechargeDTO memberRechargeDTO, HttpServletRequest request) {
try {
UserApp userApp = userAppService.queryUserAppByToken();
@ -398,7 +399,7 @@ public class MerchantOrderController {
memberRechargeDTO.setMerchantCode(userApp.getMerchantCode());
memberRechargeDTO.setUserId(String.valueOf(userApp.getUserId()));
memberRechargeDTO.setUserName(userApp.getUserName());
return merchantOrderService.toMemberRecharge(memberRechargeDTO);
return merchantOrderService.toMemberRecharge(memberRechargeDTO, request);
}catch (Exception e){
e.printStackTrace();
MsgException.throwException(e.getMessage());
@ -417,7 +418,7 @@ public class MerchantOrderController {
@ApiOperation(tags = {"页面-收款"}, value = "扫码支付", notes = "扫码支付", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "MerchantOrderVo", value = "扫码支付需要传递的参数实例", paramType = "body", dataType = "MerchantOrderVo", required = true)})
public Result<Object> scanPay(@RequestBody MerChantOrderDTO merchantOrderDTO) {
public Result<Object> scanPay(@RequestBody MerChantOrderDTO merchantOrderDTO, HttpServletRequest req) {
UserApp tokenUa = userAppService.queryUserAppByToken();
merchantOrderDTO.setMerchantCode(tokenUa.getMerchantCode());
//校验金额
@ -425,7 +426,7 @@ public class MerchantOrderController {
MsgException.throwException("金额异常");
}
try {
return merchantOrderService.toActivePay(merchantOrderDTO);
return merchantOrderService.toActivePay(merchantOrderDTO, req);
} catch (Exception e){
e.printStackTrace();
return ResultGenerator.genFailResult(e.getMessage());
@ -437,7 +438,7 @@ public class MerchantOrderController {
* @return
*/
@PostMapping("/posScanPay")
public Result<Object> posScanPay(@RequestBody MerChantOrderDTO merchantOrderDTO) {
public Result<Object> posScanPay(@RequestBody MerChantOrderDTO merchantOrderDTO, HttpServletRequest request) {
//首先验签
verify(merchantOrderDTO.getTimestamp(), merchantOrderDTO.getRequestId(), merchantOrderDTO.getAppId(), merchantOrderDTO.getToken());
//通过后查询商户信息
@ -451,7 +452,7 @@ public class MerchantOrderController {
}
//进行支付操作
try {
Result<Object> activePay = merchantOrderService.toActivePay(merchantOrderDTO);
Result<Object> activePay = merchantOrderService.toActivePay(merchantOrderDTO, request);
String result = activePay.toString();
JSONObject jsonData = JSONObject.parseObject(result);
Object orderNumber = jsonData.getJSONObject("data").get("orderNumber");

View File

@ -0,0 +1,208 @@
package cn.pluss.platform.controller.access;
import cn.pluss.platform.access.AccessService;
import cn.pluss.platform.access.domain.CodeEnum;
import cn.pluss.platform.access.domain.ReqEntity;
import cn.pluss.platform.access.domain.RespEntity;
import cn.pluss.platform.access.exception.AccessException;
import cn.pluss.platform.access.service.AccessBizService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
@RequestMapping("/access")
@RestController
public class AccessController {
@Autowired
private AccessService accessService;
@Autowired
private AccessBizService accessBizService;
@PostMapping("/storeInfoByDeviceNo")
public RespEntity machineStoreInfo(@RequestBody ReqEntity reqEntity) {
String requestId = reqEntity.getRequestId();
JSONObject reqData = reqEntity.initJSONData();
RespEntity result;
String deviceNo = reqData.getString("deviceNo");
if (deviceNo == null) {
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.PARAM_ERROR, null, requestId);
accessService.addSign(result);
return result;
}
Object bizResult = accessBizService.machineStoreInfo(deviceNo);
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.SUCCESS, bizResult, requestId);
accessService.addSign(result);
return result;
}
@PostMapping("/scanPay")
public RespEntity scanPay(@RequestBody ReqEntity reqEntity) {
String requestId = reqEntity.getRequestId();
JSONObject reqData = reqEntity.initJSONData();
RespEntity result;
String deviceNo = reqData.getString("deviceNo");
if (deviceNo == null) {
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.PARAM_ERROR, null, requestId);
accessService.addSign(result);
return result;
}
try {
Object bizResult = accessBizService.scanPay(reqData);
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.SUCCESS, bizResult, requestId);
accessService.addSign(result);
return result;
} catch (AccessException e) {
result = new RespEntity(reqEntity.getOrgId(), e.getCode(), null, requestId, e.getMessage());
accessService.addSign(result);
return result;
}
}
@PostMapping("/orderStatus")
public RespEntity orderStatus(@RequestBody ReqEntity reqEntity) {
String requestId = reqEntity.getRequestId();
JSONObject reqData = reqEntity.initJSONData();
RespEntity result;
String deviceNo = reqData.getString("deviceNo");
if (deviceNo == null) {
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.PARAM_ERROR, null, requestId);
accessService.addSign(result);
return result;
}
String orderNumber = reqData.getString("orderNumber");
String mercOrderNo = reqData.getString("mercOrderNo");
try {
Object bizResult = accessBizService.orderStatus(orderNumber, mercOrderNo);
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.SUCCESS, bizResult, requestId);
accessService.addSign(result);
return result;
} catch (AccessException e) {
result = new RespEntity(reqEntity.getOrgId(), e.getCode(), null, requestId, e.getMessage());
accessService.addSign(result);
return result;
}
}
@PostMapping("/orderRefund")
public RespEntity orderRefund(@RequestBody ReqEntity reqEntity) {
String requestId = reqEntity.getRequestId();
JSONObject reqData = reqEntity.initJSONData();
RespEntity result;
String deviceNo = reqData.getString("deviceNo");
if (deviceNo == null) {
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.PARAM_ERROR, null, requestId);
accessService.addSign(result);
return result;
}
try {
Object bizResult = accessBizService.refund(reqData);
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.SUCCESS, bizResult, requestId);
accessService.addSign(result);
return result;
} catch (AccessException e) {
result = new RespEntity(reqEntity.getOrgId(), e.getCode(), null, requestId, e.getMessage());
accessService.addSign(result);
return result;
}
}
@PostMapping("/orderRefundList")
public RespEntity orderRefundList(@RequestBody ReqEntity reqEntity) {
String requestId = reqEntity.getRequestId();
JSONObject reqData = reqEntity.initJSONData();
RespEntity result;
String deviceNo = reqData.getString("deviceNo");
if (deviceNo == null) {
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.PARAM_ERROR, null, requestId);
accessService.addSign(result);
return result;
}
try {
Object bizResult = accessBizService.refundList(reqData);
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.SUCCESS, bizResult, requestId);
accessService.addSign(result);
return result;
} catch (AccessException e) {
result = new RespEntity(reqEntity.getOrgId(), e.getCode(), null, requestId, e.getMessage());
accessService.addSign(result);
return result;
}
}
@PostMapping("/orderList")
public RespEntity orderList(@RequestBody ReqEntity reqEntity) {
String requestId = reqEntity.getRequestId();
JSONObject reqData = reqEntity.initJSONData();
RespEntity result;
String deviceNo = reqData.getString("deviceNo");
if (deviceNo == null) {
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.PARAM_ERROR, null, requestId);
accessService.addSign(result);
return result;
}
try {
Object bizResult = accessBizService.orderList(reqData);
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.SUCCESS, bizResult, requestId);
accessService.addSign(result);
return result;
} catch (AccessException e) {
result = new RespEntity(reqEntity.getOrgId(), e.getCode(), null, requestId, e.getMessage());
accessService.addSign(result);
return result;
}
}
@PostMapping("/dataAnalysis")
public RespEntity dataAnalysis(@RequestBody ReqEntity reqEntity) {
String requestId = reqEntity.getRequestId();
JSONObject reqData = reqEntity.initJSONData();
RespEntity result;
String deviceNo = reqData.getString("deviceNo");
if (deviceNo == null) {
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.PARAM_ERROR, null, requestId);
accessService.addSign(result);
return result;
}
try {
Object bizResult = accessBizService.dataAnalysis(reqData);
result = new RespEntity(reqEntity.getOrgId(), CodeEnum.SUCCESS, bizResult, requestId);
accessService.addSign(result);
return result;
} catch (AccessException e) {
result = new RespEntity(reqEntity.getOrgId(), e.getCode(), null, requestId, e.getMessage());
accessService.addSign(result);
return result;
}
}
}

View File

@ -4,6 +4,7 @@ import cn.hutool.crypto.symmetric.DES;
import cn.pluss.platform.channel.MerchantAuditService;
import cn.pluss.platform.channel.ys.YSAuditServiceV3;
import cn.pluss.platform.entity.RyxAccessModel;
import cn.pluss.platform.klk.service.impl.LaKalaInterfaceImpl;
import cn.pluss.platform.ryx.RyxService;
import cn.pluss.platform.ys.impl.v20210929.YsConfigV2;
import com.alibaba.fastjson.JSON;
@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.ExecutorService;
@ -139,5 +141,11 @@ public class AuditCallbackController {
return ryxMerchantAuditService.editMerchantCallback(result);
}
@Resource
LaKalaInterfaceImpl laKalaInterface;
@PostMapping("lklCallBack")
public String lklCallBack(@RequestBody Map<String, Object> map) throws Exception {
String str ="data -> hplFXwPU1gbHYwraQM/fKEcoIkBfHD07VSH99OnKTZk9HJRFAvZyOm9nsdeSi8t/UdGPn+LXldrjZ7wiY+F5MzGlIdEma7agKZyHJ+UO6CrDJfYFMwlPUOgO+Pq5ljg6QOdZBxBLEHkRMkQnC/CTv9vQnPDqeCv4MvAbHJspADGRRPvmjxtzf0J4OQgP3hj9+ZqH+btsuX+W+YZRXRMYL+uOQkSJhMUv31hc9MAC/1Sp0C9cBcHKxr+idS+0CCjvD8WzLbXv2QuOSQccIKQw+Je8RMeuKs8f64MibCkf+RkilTCVCEd5apL1MkhYJZoUVzqPXmDBLjaJgr987X1wBAzQMS8+F34Vl/BonKPuJ4RRwdE/M3WJ+ZfM2WiLawpU7ZqUQdVY2bwJO801TcmFCswLoz2qxHHsBsjXtQPqMOj3pw3Kvz3WH3oWmcFRZjHKIbDSy9Jh2STEFRbvVWarjksBVjXkcbletDtOtY0T8XCdiiNoQNlVNj5kH5QkAWmt";
return laKalaInterface.tuoKeCallBack(map);
}
}

View File

@ -1,5 +1,9 @@
package cn.pluss.platform.interceptor;
import cn.pluss.platform.access.AccessService;
import cn.pluss.platform.access.domain.CodeEnum;
import cn.pluss.platform.access.domain.ReqEntity;
import cn.pluss.platform.access.domain.RespEntity;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultCode;
import cn.pluss.platform.constants.CommonError;
@ -10,14 +14,20 @@ import cn.pluss.platform.merchant.MerchantStaffConnService;
import cn.pluss.platform.userApp.UserAppService;
import cn.pluss.platform.userInfo.UserInfoService;
import cn.pluss.platform.util.ComUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@ -35,6 +45,9 @@ public class TokenRegistryInterceptor extends HandlerInterceptorAdapter {
@Resource
private MerchantStaffConnService staffConnService;
@Autowired
private AccessService accessService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String requestUri = request.getRequestURI();
@ -75,6 +88,46 @@ public class TokenRegistryInterceptor extends HandlerInterceptorAdapter {
String contentType = request.getContentType();
if (contentType != null
&& contentType.contains("application/json")
&& requestUri.startsWith("/api/access")) {
StringBuilder responseStrBuilder = new StringBuilder();
InputStream is = request.getInputStream();
BufferedReader streamReader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
String inputStr;
while ((inputStr = streamReader.readLine()) != null) {
responseStrBuilder.append(inputStr);
}
ReqEntity reqEntity;
try {
reqEntity = JSON.toJavaObject(JSON.parseObject(responseStrBuilder.toString()), ReqEntity.class);
} catch (Exception e) {
RespEntity entity = new RespEntity(null, CodeEnum.PARAM_ERROR, null, null);
ComUtil.responseResult(response, entity);
return false;
}
if (reqEntity == null || reqEntity.getOrgId() == null) {
RespEntity entity = new RespEntity(null, CodeEnum.ORG_ID_NOT_FOUND, null, null);
ComUtil.responseResult(response, entity);
return false;
}
boolean signCheck = accessService.checkSign(reqEntity);
// 操作
if (signCheck) {
return true;
} else {
RespEntity entity = new RespEntity(reqEntity.getOrgId(), CodeEnum.SIGN_ERROR, null, reqEntity.getRequestId());
accessService.addSign(entity);
ComUtil.responseResult(response, entity);
return false;
}
}
synchronized (this) {
String requestToken = request.getHeader("token");
// 登录账号

View File

@ -1,14 +1,11 @@
spring:
# datasource:
# url: jdbc:mysql://rm-bp19ib8x213kh9t45.rwlb.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
# username: root
# password: prodCZGmysqlroot@123
# driver-class-name: com.mysql.jdbc.Driver
datasource:
# url: jdbc:mysql://rm-bp19ib8x213kh9t45.rwlb.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
url: jdbc:mysql://rm-bp19ib8x213kh9t450o.rwlb.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: prodCZGmysqlroot@123
driver-class-name: com.mysql.jdbc.Driver
parameter:
### 这个根据自己的情况配置
domain: https://ky.sxczgkj.cn

View File

@ -139,7 +139,7 @@ public class ComUtil {
public static boolean equalsIgnoreCase(String str1, String str2) {
return str1 != null ? str1.equalsIgnoreCase(str2) : str2 == null;
}
public static String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
@ -165,7 +165,7 @@ public class ComUtil {
return ip;
}
public static void responseResult(HttpServletResponse response, Result result) {
public static void responseResult(HttpServletResponse response, Object result) {
response.setCharacterEncoding("UTF-8");
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/json;charset=UTF-8");
response.setStatus(200);

View File

@ -1,2 +1,11 @@
lkl:
private_key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDvDBZyHUDndAGxrIcsCV2njhNO3vCEZotTaWYSYwtDvkcAb1EjsBFabXZaKigpqFXk5XXNI3NIHP9M8XKzIgGvc65NpLAfRjVql8JiTvLyYd1gIUcOXMInabu+oX7dQSI1mS8XzqaoVRhDZQWhXcJW9bxMulgnzvk0Ggw07AjGF7si+hP/Va8SJmN7EJwfQq6TpSxR+WdIHpbWdhZ+NHwitnQwAJTLBFvfk28INM39G7XOsXdVLfsooFdglVTOHpNuRiQAj9gShCCNrpGsNQxDiJIxE43qRsNsRwigyo6DPJk/klgDJa417E2wgP8VrwiXparO4FMzOGK15quuoD7DAgMBAAECggEBANhmWOt1EAx3OBFf3f4/fEjylQgRSiqRqg8Ymw6KGuh4mE4Md6eW/B6geUOmZjVP7nIIR1wte28M0REWgn8nid8LGf+v1sB5DmIwgAf+8G/7qCwd8/VMg3aqgQtRp0ckb5OV2Mv0h2pbnltkWHR8LDIMwymyh5uCApbn/aTrCAZKNXcPOyAn9tM8Bu3FHk3Pf24Er3SN+bnGxgpzDrFjsDSHjDFT9UMIc2WdA3tuMv9X3DDn0bRCsHnsIw3WrwY6HQ8mumdbURk+2Ey3eRFfMYxyS96kOgBC2hqZOlDwVPAKTPtS4hoq+cQ0sRaJQ4T0UALJrBVHa+EESgRaTvrXqAECgYEA+WKmy9hcvp6IWZlk9Q1JZ+dgIVxrO65zylK2FnD1/vcTx2JMn73WKtQb6vdvTuk+Ruv9hY9PEsf7S8gHSTTmzHOUgo5x0F8yCxXFnfji2juoUnDdpkjtQK5KySDcpQb5kcCJWEVi9v+zObM0Zr1Nu5/NreE8EqUl3+7MtHOu1TMCgYEA9WM9P6m4frHPW7h4gs/GISA9LuOdtjLvAtgCK4cW2mhtGNAMttD8zOBQrRuafcbFAyU9de6nhGwetOhkW9YSV+xRNa7HWTeIRgXJuJBrluq5e1QGTIwZU/GujpNaR4Qiu0B8TodM/FME7htsyxjmCwEfT6SDYlkeMzTbMa9Q0DECgYBqsR/2+dvD2YMwAgZFKKgNAdoIq8dcwyfamUQ5mZ5EtGQL2yw48zibHh/LiIxgUD1Kjk/qQgNsX45NP4iOc0mCkrgomtRqdy+rumbPTNmQ0BEVJCBPscd+8pIgNiTvnWpMRvj7gMP0NDTzLI3wnnCRIq8WAtR2jZ0Ejt+ZHBziLQKBgQDibEe/zqNmhDuJrpXEXmO7fTv3YB/OVwEj5p1Z/LSho2nHU3Hn3r7lbLYEhUvwctCnLl2fzC7Wic1rsGOqOcWDS5NDrZpUQGGF+yE/JEOiZcPwgH+vcjaMtp0TAfRzuQEzNzV8YGwxB4mtC7E/ViIuVULHAk4ZGZI8PbFkDxjKgQKBgG8jEuLTI1tsP3kyaF3jAylnw7SkBc4gfe9knsYlw44YlrDSKr8AOp/zSgwvMYvqT+fygaJ3yf9uIBdrIilqCHKXccZ9uA/bT5JfIi6jbg3EoE9YhB0+1aGAS1O2dBvUiD8tJ+BjAT4OB0UDpmM6QsFLQgFyXgvDnzr/o+hQJelW
appid: OP00000462 #接入方唯一编号
mchSerialNo: 00dfba8194c41b84cf #证书序列号
merchantNo: 8221210594300JY #商户号
vposId: 491612871013605376 #vpos_id
termNo: A0073841 #终端号
apiUrl: https://test.wsmsd.cn/
privateKeyPath: "classpath:lakalaConf/OP00000003_private_key.pem"
certificatePath: "classpath:lakalaConf/OP00000003_cert"

View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDYTCCAkmgAwIBAgIJAN+6gZTEG4TPMA0GCSqGSIb3DQEBCwUAMEkxCzAJBgNV
BAYTAlVTMREwDwYDVQQIEwhzaGFuZ2hhaTERMA8GA1UEBxMIc2hhbmdoYWkxFDAS
BgNVBAMUC2xha2FsYV8yMDIxMB4XDTIxMDYxODA3MjEzNFoXDTMxMDYxOTA3MjEz
NFowSTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCHNoYW5naGFpMREwDwYDVQQHEwhz
aGFuZ2hhaTEUMBIGA1UEAxQLbGFrYWxhXzIwMjEwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQDvDBZyHUDndAGxrIcsCV2njhNO3vCEZotTaWYSYwtDvkcA
b1EjsBFabXZaKigpqFXk5XXNI3NIHP9M8XKzIgGvc65NpLAfRjVql8JiTvLyYd1g
IUcOXMInabu+oX7dQSI1mS8XzqaoVRhDZQWhXcJW9bxMulgnzvk0Ggw07AjGF7si
+hP/Va8SJmN7EJwfQq6TpSxR+WdIHpbWdhZ+NHwitnQwAJTLBFvfk28INM39G7XO
sXdVLfsooFdglVTOHpNuRiQAj9gShCCNrpGsNQxDiJIxE43qRsNsRwigyo6DPJk/
klgDJa417E2wgP8VrwiXparO4FMzOGK15quuoD7DAgMBAAGjTDBKMAkGA1UdEwQC
MAAwEQYJYIZIAYb4QgEBBAQDAgTwMAsGA1UdDwQEAwIFoDAdBgNVHSUEFjAUBggr
BgEFBQcDAgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggEBAI21YYAlH+Pc1ISv
nbQrGqL8suGL0Hh/8hGaFfrJEJEKr9OeC8jElUhck2MTmfu/Y1lB7r8RBrhGPXi4
kTXmB6ADs/9+ezNW3WXyFj7fhs3JcZ3mo33T9wyQySDKd//JrEtrTsc/s2PZ602y
qNmPomXSzjrlugaMyC7LI9sR44mc7sQnchjHoxrQFD5/usTFW72UQfYCORsQWYMt
0KKEyAcpRL51RE3xbX1WDtduFYGP62PbwLAn2nCL/j1wlF5hltWj7sditWqKgso5
F8BTffn2Bb0RdsNxqwMy1cTPrWLeXVOqMDu3ge7hvoav8lZKTjk5Kmqhs7wNAQXK
mg9qSwo=
-----END CERTIFICATE-----

View File

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDvDBZyHUDndAGx
rIcsCV2njhNO3vCEZotTaWYSYwtDvkcAb1EjsBFabXZaKigpqFXk5XXNI3NIHP9M
8XKzIgGvc65NpLAfRjVql8JiTvLyYd1gIUcOXMInabu+oX7dQSI1mS8XzqaoVRhD
ZQWhXcJW9bxMulgnzvk0Ggw07AjGF7si+hP/Va8SJmN7EJwfQq6TpSxR+WdIHpbW
dhZ+NHwitnQwAJTLBFvfk28INM39G7XOsXdVLfsooFdglVTOHpNuRiQAj9gShCCN
rpGsNQxDiJIxE43qRsNsRwigyo6DPJk/klgDJa417E2wgP8VrwiXparO4FMzOGK1
5quuoD7DAgMBAAECggEBANhmWOt1EAx3OBFf3f4/fEjylQgRSiqRqg8Ymw6KGuh4
mE4Md6eW/B6geUOmZjVP7nIIR1wte28M0REWgn8nid8LGf+v1sB5DmIwgAf+8G/7
qCwd8/VMg3aqgQtRp0ckb5OV2Mv0h2pbnltkWHR8LDIMwymyh5uCApbn/aTrCAZK
NXcPOyAn9tM8Bu3FHk3Pf24Er3SN+bnGxgpzDrFjsDSHjDFT9UMIc2WdA3tuMv9X
3DDn0bRCsHnsIw3WrwY6HQ8mumdbURk+2Ey3eRFfMYxyS96kOgBC2hqZOlDwVPAK
TPtS4hoq+cQ0sRaJQ4T0UALJrBVHa+EESgRaTvrXqAECgYEA+WKmy9hcvp6IWZlk
9Q1JZ+dgIVxrO65zylK2FnD1/vcTx2JMn73WKtQb6vdvTuk+Ruv9hY9PEsf7S8gH
STTmzHOUgo5x0F8yCxXFnfji2juoUnDdpkjtQK5KySDcpQb5kcCJWEVi9v+zObM0
Zr1Nu5/NreE8EqUl3+7MtHOu1TMCgYEA9WM9P6m4frHPW7h4gs/GISA9LuOdtjLv
AtgCK4cW2mhtGNAMttD8zOBQrRuafcbFAyU9de6nhGwetOhkW9YSV+xRNa7HWTeI
RgXJuJBrluq5e1QGTIwZU/GujpNaR4Qiu0B8TodM/FME7htsyxjmCwEfT6SDYlke
MzTbMa9Q0DECgYBqsR/2+dvD2YMwAgZFKKgNAdoIq8dcwyfamUQ5mZ5EtGQL2yw4
8zibHh/LiIxgUD1Kjk/qQgNsX45NP4iOc0mCkrgomtRqdy+rumbPTNmQ0BEVJCBP
scd+8pIgNiTvnWpMRvj7gMP0NDTzLI3wnnCRIq8WAtR2jZ0Ejt+ZHBziLQKBgQDi
bEe/zqNmhDuJrpXEXmO7fTv3YB/OVwEj5p1Z/LSho2nHU3Hn3r7lbLYEhUvwctCn
Ll2fzC7Wic1rsGOqOcWDS5NDrZpUQGGF+yE/JEOiZcPwgH+vcjaMtp0TAfRzuQEz
NzV8YGwxB4mtC7E/ViIuVULHAk4ZGZI8PbFkDxjKgQKBgG8jEuLTI1tsP3kyaF3j
Aylnw7SkBc4gfe9knsYlw44YlrDSKr8AOp/zSgwvMYvqT+fygaJ3yf9uIBdrIilq
CHKXccZ9uA/bT5JfIi6jbg3EoE9YhB0+1aGAS1O2dBvUiD8tJ+BjAT4OB0UDpmM6
QsFLQgFyXgvDnzr/o+hQJelW
-----END PRIVATE KEY-----

View File

@ -0,0 +1,16 @@
package cn.pluss.platform.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.pluss.platform.entity.AccessChannelCipherCode;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
public interface AccessChannelCipherCodeMapper extends BaseMapper<AccessChannelCipherCode> {
default AccessChannelCipherCode selectAllByOrgId(String orgId) {
LambdaQueryWrapper<AccessChannelCipherCode> qWrapper = Wrappers.lambdaQuery();
qWrapper.eq(AccessChannelCipherCode::getOrgId, orgId);
return selectOne(qWrapper);
}
}

View File

@ -5,6 +5,7 @@ import cn.pluss.platform.entity.UserProfit;
import cn.pluss.platform.vo.*;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
@ -22,6 +23,14 @@ import java.util.Map;
@Mapper
public interface MerchantOrderMapper extends BaseMapper<MerchantOrder> {
@Select("SELECT SUM(mro.refundAmt) refundFee FROM tb_pluss_merchant_order mo LEFT JOIN \n" +
"tb_pluss_merchant_refund_order mro ON (mo.orderNumber = mro.orderNumber OR mo.orderNumber = mro.refundNo)\n" +
"WHERE mo.snNo = #{snNo} AND mo.`status` = '1' AND mro.`status` = '1' " +
"AND mo.merchantCode = #{merchantCode} AND mro.refundTime LIKE CONCAT(#{date}, '%')")
BigDecimal selectRefundAmt(@Param("merchantCode") String merchantCode, @Param("snNo") String snNo, @Param("date") String date);
Page<MerchantOrder> page(IPage<MerchantOrder> page, @Param("map") Map<String, Object> map, @Param("statusList") List<String> statusList);
/**
* 统计一些数值的合计值
* @return .
@ -37,43 +46,43 @@ public interface MerchantOrderMapper extends BaseMapper<MerchantOrder> {
Integer queryMerchantOrderPageCount(Map map);
void saveMerchantOrderBatch(List<MerchantOrder> merchantOrderList);
/**
* 可提现总金额提现规则 超过一个月的时间推广
* @param
* @param
* @return
*/
Double sumMerchantAllowCashMoney(@Param(value = "memberCode") String memberCode);
/**
* 不可提现总金额提现规则 不超过一个月推广
* @param
* @param
* @return
*/
Double sumMerchantNotAllowCashMoney(@Param(value = "memberCode") String memberCode);
/**
* 今日分润 推广
* @param merchantCode
* @return
*/
Double sumNowDayShareMoney(@Param(value = "memberCode") String merchantCode);
/**
* 累计总分润 推广
* @return
*/
Double sumAllShareMoney(@Param(value = "memberCode") String memberCode);
/**
* 商户推广- 交易明细 接口使用
* 商户推广- 交易明细 接口使用
* @param map
* @return
*/
List<MerchantOrder> queryMerchantOrderPageApp(Map map);
/**
* 商户推广- 交易明细 接口使用
* @param map
@ -82,23 +91,23 @@ public interface MerchantOrderMapper extends BaseMapper<MerchantOrder> {
Integer queryMerchantOrderPageCountApp(Map map);
Integer queryMerchantOrderPageCountByTime(Map map);
Double queryMerchantOrdeFeeByTime(Map map);
List<MerchantOrder> queryMerchantOrderPageByTime(Map map);
/**
* 汇总流水manage
*/
SummaryOfWaterVO querySummaryOfWater(Map map);
/**
* 订单退款信息
* @param map
* @return
*/
List<MerchantOrder> queryMerchantOrderRefundPage(Map map);
/**
* 订单退款统计
* @param map
@ -107,111 +116,111 @@ public interface MerchantOrderMapper extends BaseMapper<MerchantOrder> {
Integer queryMerchantOrderRefundPageCount(Map map);
Double queryMerchantOrderShareMoney(Map map);
/**
*
* queryOrderTask:(给wap端的定时任务使用的 暂定查3天内状态为5待支付的订单). <br/>
*
* @author Administrator
*
* queryOrderTask:(给wap端的定时任务使用的 暂定查3天内状态为5待支付的订单). <br/>
*
* @author Administrator
* @param merchantOrder
* @return
* @return
* @since JDK 1.8
*/
List<MerchantOrder> queryOrderTask(MerchantOrder merchantOrder);
/**
* 7日交易数统计
* @param s
* @param s
*/
List<OrderStatisticsVO> queryOrderStatistics(MerchantOrder s);
/**
* 支付通道统计
* @param s
* @param s
*/
List<PayTypeStatisticsVO> queryPayTypeStatistics(MerchantOrder s);
Double queryMerchantOrderEnterFeeByTime(Map map);
Double queryMerchantOrderShareMoneyByTime(Map map);
/**
*
* queryMerchantOrderPageShuju:(最新统计订单方法). <br/>
*
* @author Administrator
*
* queryMerchantOrderPageShuju:(最新统计订单方法). <br/>
*
* @author Administrator
* @param map
* @return
* @return
* @since JDK 1.8
*/
List<MerchantMangeOrderVO> queryMerchantOrderPageShuju(Map<String, Object> map);
// List<MerchantMangeOrderVO> queryMerchantOrderNoPageShuju(Map<String, Object> map);
/**
*
* queryMerchantOrderPageCountShuju:(最新统计订单方法). <br/>
*
* @author Administrator
*
* queryMerchantOrderPageCountShuju:(最新统计订单方法). <br/>
*
* @author Administrator
* @param map
* @return
* @return
* @since JDK 1.8
*/
Integer queryMerchantOrderPageCountShuju(Map<String, Object> map);
// Integer queryMerchantOrderNoPageCountShuju(Map<String, Object> map);
/**
*
* querySumEarnings:(统计总的收益 根据时间). <br/>
*
* @author Administrator
*
* querySumEarnings:(统计总的收益 根据时间). <br/>
*
* @author Administrator
* @param map
* @return
* @return
* @since JDK 1.8
*/
List<MerchantMangeOrderVO> querySumEarnings(Map<String, Object> map);
/**
*
* promoterSumCash:(推广员退关分润余额信息统计). <br/>
*
* @author Administrator
*
* promoterSumCash:(推广员退关分润余额信息统计). <br/>
*
* @author Administrator
* @param userId
* @return
* @return
* @since JDK 1.8
*/
PromoterSumVO promoterSumCash(@Param(value = "userId") Long userId);
/**
*
* PlatformSum:(统计平台大屏的门店数量 商户数量 交易总额 交易笔数 会员数量 推广员数量 推广分润总额 粉丝奖励总额 收益总计). <br/>
*
* @author Administrator
* @return
*
* PlatformSum:(统计平台大屏的门店数量 商户数量 交易总额 交易笔数 会员数量 推广员数量 推广分润总额 粉丝奖励总额 收益总计). <br/>
*
* @author Administrator
* @return
* @since JDK 1.8
*/
PlatformSumVO PlatformSum(@Param(value = "timeStatus") String timeStatus);
/**
*
* sumConsumeFeebystoreId:(查询门店的今日流水 跟总流水). <br/>
*
* @author Administrator
*
* sumConsumeFeebystoreId:(查询门店的今日流水 跟总流水). <br/>
*
* @author Administrator
* @param storeId
* @return
* @return
* @since JDK 1.8
*/
StoreVO sumConsumeFeebystoreId(String storeId);
/**
*
* sumConsumeFeebystoreId:(查询商户的今日流水 跟总流水). <br/>
*
*
* sumConsumeFeebystoreId:(查询商户的今日流水 跟总流水). <br/>
*
* @author Administrator
* @return
* @return
* @since JDK 1.8
*/
StoreVO sumConsumeFeebymerchantCode(String merchantCode);
@ -222,7 +231,7 @@ public interface MerchantOrderMapper extends BaseMapper<MerchantOrder> {
* @return
*/
Double getOrderFeeSum1(Map<String, Object> orderMap);
Double getToDayTransSum1(Map<String, Object> orderMap);
@Select("SELECT SUM(consumeFee) fee, status FROM tb_pluss_merchant_order ${ew.customSqlSegment}")

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.PlussMerchantLklEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PlussMerchantLklDao extends BaseMapper<PlussMerchantLklEntity> {
}

View File

@ -0,0 +1,8 @@
package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.TbLklRegionBankInfoEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TbLklRegionBankInfoDao extends BaseMapper<TbLklRegionBankInfoEntity> {
}

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.TbPlussBankBranchLklEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TbPlussBankBranchLklMapper extends BaseMapper<TbPlussBankBranchLklEntity> {
}

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.TbPlussBankRegionLklEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TbPlussBankRegionLklMapper extends BaseMapper<TbPlussBankRegionLklEntity> {
}

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.TbPlussBusinessSmallLklEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TbPlussBusinessSmallLklDao extends BaseMapper<TbPlussBusinessSmallLklEntity> {
}

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.TbPlussRegionLklEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TbPlussRegionLklMapper extends BaseMapper<TbPlussRegionLklEntity> {
}

View File

@ -15,6 +15,51 @@
</foreach>
</insert>
<select id="page" resultType="cn.pluss.platform.entity.MerchantOrder">
SELECT
IFNULL(mro.orderNumber, mo.orderNumber) orderNumber, mo.merchantCode, mo.merchantName, mo.payTypeCode,
mo.thirdTransNo, mo.consumeFee, mo.createDt, mo.transDt, mo.staffCode, mo.staffName, mo.`status`,
mo.enterFee, mo.remark, mo.updateTime, mo.rate, mo.mercOrderNo, mo.isRecharge, mo.snNo, mo.cashPlaceId,
mo.settlementType, mo.drType, mro.refundAmt, mro.refundTime
FROM
tb_pluss_merchant_order mo
LEFT JOIN tb_pluss_merchant_refund_order mro ON mo.merchantCode = mro.merchantCode
AND (mo.orderNumber = mro.orderNumber OR mo.orderNumber = mro.refundNo) AND mo.`status` = '2'
<where>
<if test="map.merchantCode != null and map.merchantCode != ''">
AND mo.merchantCode = #{map.merchantCode}
</if>
<if test="map.snNo != null and map.snNo != ''">
AND mo.snNo = #{map.snNo}
</if>
<if test="map.createDate != null">
AND (
(mo.createDate LIKE CONCAT(#{map.createDate}, '%') AND mo.status = '1')
OR (mro.refundTime LIKE CONCAT(#{map.createDate}, '%') AND mo.status IN ('2', '6'))
)
</if>
<if test="map.startTime != null">
AND (
(mo.transTime &gt; #{map.startTime} AND mo.status = '1')
OR (mro.refundTime &gt; #{map.startTime} AND mo.status IN ('2', '6'))
)
</if>
<if test="map.endTime != null">
AND (
(mo.transTime &lt; #{map.endTime} AND mo.status = '1')
OR (mro.refundTime &lt; #{map.endTime} AND mo.status IN ('2', '6'))
)
</if>
<if test="statusList != null and statusList.size > 0">
AND mo.`status` IN
<foreach collection="statusList" item="item" close=")" separator="," open="(">
#{item}
</foreach>
</if>
</where>
ORDER BY mo.updateTime
</select>
<select id="queryMerchantOrder"
parameterType="cn.pluss.platform.entity.MerchantOrder"
resultType="cn.pluss.platform.entity.MerchantOrder">

View File

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@ -187,6 +188,7 @@ public class ActivityActivateController extends BaseNoModelController {
@RequestMapping(value = "/saveActivityActivate", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> saveActivityActivate(ActivityActivate activityActivate) {
Map<String, Object> result = new HashMap<String, Object>(16);
// 通过merchantCode查商户信息
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();

View File

@ -6,9 +6,11 @@ import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.base.BaseModelController;
import cn.pluss.platform.device.DeviceGoodTagService;
import cn.pluss.platform.device.DeviceSpecService;
import cn.pluss.platform.device.DeviceTypeService;
import cn.pluss.platform.entity.DeviceGoodTag;
import cn.pluss.platform.entity.DeviceGoods;
import cn.pluss.platform.entity.DeviceSpec;
import cn.pluss.platform.entity.DeviceType;
import cn.pluss.platform.util.OssOperatUtil;
import com.alibaba.fastjson.JSONObject;
@ -20,6 +22,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@ -70,7 +73,8 @@ public class DeviceGoodsController extends BaseModelController<DeviceGoodsServic
return data;
}
@Resource
DeviceSpecService deviceSpecService;
/**
* 数据回显
*/
@ -82,6 +86,9 @@ public class DeviceGoodsController extends BaseModelController<DeviceGoodsServic
List<DeviceGoodTag> list = deviceGoodTagService.list();
model.addAttribute("deviceGoodTagList", list);
List<DeviceSpec> list1 = deviceSpecService.list();
model.addAttribute("list1", list1);
Map<String, String> uploadParam = OssOperatUtil.getUploadParam();
model.addAttribute("uploadParam",uploadParam);
if (id != null) {

View File

@ -3,7 +3,10 @@ package cn.pluss.platform.controller.home;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.controller.BaseNoModelController;
import cn.pluss.platform.device.DeviceSpecService;
import cn.pluss.platform.entitiy.ShiroUser;
import cn.pluss.platform.entity.DeviceSpec;
import cn.pluss.platform.entity.DeviceType;
import cn.pluss.platform.entity.MerchantChannelStatus;
import cn.pluss.platform.entity.PlatformData;
import cn.pluss.platform.home.HomeService;
@ -17,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -166,7 +170,6 @@ public class HomeController extends BaseNoModelController {
result.put("loginName", loginName);
return result;
}
@PostMapping(value = "/getAuditData")
@ResponseBody
public Result<Object> getAuditData() {

View File

@ -77,7 +77,28 @@
</div>
</div>
<%-- <div class="layui-form-item">--%>
<%-- <div class="layui-inline">--%>
<%-- <label class="layui-form-label">规格选择:</label>--%>
<%-- <div class="layui-input-inline">--%>
<%-- <select lay-filter="typeSelect1" id="typeSelect1" class="layui-select" autocomplete="off">--%>
<%-- <option value="">请选择</option>--%>
<%-- <c:forEach items="${list1}" var="item">--%>
<%--&lt;%&ndash; <option value="${dict.code}" ${dict.code == entity.code ? 'selected' : ''}>${dict.name}</option>&ndash;%&gt;--%>
<%-- <option value="${item.id}" ${item.id == entity.id ? 'selected' : ''}>${item.specName}</option>--%>
<%-- </c:forEach>--%>
<%-- </select>--%>
<%-- </div>--%>
<%-- <div class="layui-form-mid layui-word-aux">--%>
<%-- <span style="color: red">* 若需添加规格的商品,可以在编码和名称中自定义</span>--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- </div>--%>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">分类标签:</label>
<div class="layui-input-inline">
@ -328,6 +349,17 @@
} else {
$("input[name = 'codeName']").val("");
}
});
form.on("select(typeSelect1)", function(data) {
console.log("aaaaa");
console.log(data.othis);
console.log(data.value);
$("input[name = 'code']").val(data.value);
if (data.value != "") {
$("input[name = 'codeName']").val(data.elem[data.elem.selectedIndex].text);
} else {
$("input[name = 'codeName']").val("");
}
})
});

View File

@ -0,0 +1,54 @@
package cn.pluss.platform.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* CREATE TABLE `tb_pluss_access_channel_cipher_code` (
* `id` int(11) NOT NULL AUTO_INCREMENT,
* `orgId` varchar(50) DEFAULT NULL COMMENT '机构号id',
* `priKey` longtext COMMENT '私钥用于返回回调数据签名以及渠道数据解密',
* `pubKey` longtext COMMENT '公钥加密给到渠道接口数据加密',
* `orgPubKey` longtext COMMENT '机构公钥',
* `orgPriKey` longtext COMMENT '机构私钥测试使用字段',
* `createTime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
* PRIMARY KEY (`id`) USING BTREE,
* KEY `uniq` (`orgId`) USING BTREE
* ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='接入渠道秘钥表';
*/
@Setter
@Getter
public class AccessChannelCipherCode {
@TableId
private Long id;
private String orgId;
/**
* 平台私钥
*/
private String priKey;
/**
* 平台公钥
*/
private String pubKey;
/**
* 机构公钥
*/
private String orgPubKey;
/**
* 机构私钥
*/
private String orgPriKey;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,15 @@
package cn.pluss.platform.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@TableName("tb_pluss_merchant_lkl")
@Data
public class PlussMerchantLklEntity {
@TableField("merchantId")
private String merchantId;
@TableField("merchantlkl")
private String merchantlkl;
@TableField("type")
private String type;
}

View File

@ -0,0 +1,28 @@
package cn.pluss.platform.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@TableName("tb_lkl_region_bank_info")
@Data
public class TbLklRegionBankInfoEntity {
@TableField("s_code")
private String sCode;
@TableField("s_name")
private String sName;
@TableField("r_code")
private String rCode;
@TableField("r_name")
private String rName;
@TableField("clear_no")
private String clearNo;
@TableField("area_code")
private String areaCode;
@TableField("branch_bank_no")
private String branchBankNo;
@TableField("branch_bank_name")
private String branchBankName;
@TableField("bank_no")
private String bankNo;
}

View File

@ -0,0 +1,28 @@
package cn.pluss.platform.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("tb_pluss_bank_branch_lkl")
public class TbPlussBankBranchLklEntity {
@TableField("id")
private String id;
@TableField("create_time")
private String createTime;
@TableField("optimistic")
private String optimistic;
@TableField("update_time")
private String updateTime;
@TableField("area_code")
private String areaCode;
@TableField("bank_no")
private String bankNo;
@TableField("branch_bank_name")
private String branchBankName;
@TableField("branch_bank_no")
private String branchBankNo;
@TableField("clear_no")
private String clearNo;
}

View File

@ -0,0 +1,24 @@
package cn.pluss.platform.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("tb_pluss_bank_region_lkl")
public class TbPlussBankRegionLklEntity {
@TableField("id")
private String id;
@TableField("create_time")
private String createTime;
@TableField("optimistic")
private String optimistic;
@TableField("update_time")
private String updateTime;
@TableField("code")
private String code;
@TableField("name")
private String name;
@TableField("parent_code")
private String parentCode;
}

View File

@ -0,0 +1,23 @@
package cn.pluss.platform.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@TableName("tb_pluss_business_small_lkl")
@Data
public class TbPlussBusinessSmallLklEntity {
@TableField("id")
private String id;
@TableField("create_time")
private String createTime;
@TableField("optimistic")
private String optimistic;
@TableField("update_time")
private String updateTime;
@TableField("code")
private String code;
@TableField("name")
private String name;
@TableField("parent_code")
private String parentCode;
}

View File

@ -0,0 +1,24 @@
package cn.pluss.platform.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("tb_pluss_region_lkl")
public class TbPlussRegionLklEntity {
@TableField("id")
private String id;
@TableField("create_time")
private String createTime;
@TableField("optimistic")
private String optimistic;
@TableField("update_time")
private String updateTime;
@TableField("code")
private String code;
@TableField("name")
private String name;
@TableField("parent_code")
private String parentCode;
}

View File

@ -0,0 +1,37 @@
package cn.pluss.platform.converter;
import cn.pluss.platform.dto.BankInfoDTO;
import cn.pluss.platform.entity.BankCard;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-05-04T16:00:25+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_191 (Oracle Corporation)"
)
public class BankCardConverterImpl implements BankCardConverter {
@Override
public BankCard dto2Domain(BankInfoDTO bankInfoDTO) {
if ( bankInfoDTO == null ) {
return null;
}
BankCard bankCard = new BankCard();
bankCard.setUserId( bankInfoDTO.getUserId() );
bankCard.setBankCardNo( bankInfoDTO.getBankCardNo() );
bankCard.setBankName( bankInfoDTO.getBankName() );
bankCard.setBranchName( bankInfoDTO.getBranchName() );
bankCard.setAccountType( bankInfoDTO.getAccountType() );
bankCard.setContactLine( bankInfoDTO.getContactLine() );
bankCard.setBranchProvince( bankInfoDTO.getBranchProvince() );
bankCard.setBranchCity( bankInfoDTO.getBranchCity() );
bankCard.setBranchArea( bankInfoDTO.getBranchArea() );
bankCard.setBankAddressNo( bankInfoDTO.getBankAddressNo() );
bankCard.setPhone( bankInfoDTO.getPhone() );
bankCard.setImgUrl( bankInfoDTO.getImgUrl() );
return bankCard;
}
}

View File

@ -0,0 +1,43 @@
package cn.pluss.platform.converter;
import cn.pluss.platform.entity.MerchantImage;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-05-04T16:00:25+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_191 (Oracle Corporation)"
)
public class ImgConverterImpl implements ImgConverter {
@Override
public MerchantImage imgCopy(MerchantImage merchantImage) {
if ( merchantImage == null ) {
return null;
}
MerchantImage merchantImage1 = new MerchantImage();
merchantImage1.setId( merchantImage.getId() );
merchantImage1.setMerchantCode( merchantImage.getMerchantCode() );
merchantImage1.setPhotoType( merchantImage.getPhotoType() );
merchantImage1.setPhotoUrl( merchantImage.getPhotoUrl() );
merchantImage1.setPicUrl( merchantImage.getPicUrl() );
merchantImage1.setPicUrl1( merchantImage.getPicUrl1() );
merchantImage1.setPicUrl2( merchantImage.getPicUrl2() );
merchantImage1.setPicUrl3( merchantImage.getPicUrl3() );
merchantImage1.setPicUrl6( merchantImage.getPicUrl6() );
merchantImage1.setPicUrl7( merchantImage.getPicUrl7() );
merchantImage1.setPicUrl8( merchantImage.getPicUrl8() );
merchantImage1.setPicUrl9( merchantImage.getPicUrl9() );
merchantImage1.setPicUrl999( merchantImage.getPicUrl999() );
merchantImage1.setPicUrl101( merchantImage.getPicUrl101() );
merchantImage1.setPicUrl102( merchantImage.getPicUrl102() );
merchantImage1.setPicUrl11( merchantImage.getPicUrl11() );
merchantImage1.setCreateDt( merchantImage.getCreateDt() );
merchantImage1.setUpdateDt( merchantImage.getUpdateDt() );
merchantImage1.setAisleSwitch( merchantImage.getAisleSwitch() );
return merchantImage1;
}
}

View File

@ -0,0 +1,314 @@
package cn.pluss.platform.converter;
import cn.pluss.platform.dto.MerchantBaseInfoDTO;
import cn.pluss.platform.entity.MerchantBaseInfo;
import cn.pluss.platform.entity.MerchantStore;
import cn.pluss.platform.entity.UserApp;
import cn.pluss.platform.vo.MerchantBaseInfoVO;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-05-04T16:00:26+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_191 (Oracle Corporation)"
)
public class MerchantBaseInfoConverterImpl implements MerchantBaseInfoConverter {
@Override
public MerchantBaseInfoDTO domain2dto(MerchantBaseInfo entity) {
if ( entity == null ) {
return null;
}
MerchantBaseInfoDTO merchantBaseInfoDTO = new MerchantBaseInfoDTO();
merchantBaseInfoDTO.setId( entity.getId() );
merchantBaseInfoDTO.setUserId( entity.getUserId() );
merchantBaseInfoDTO.setMerchantName( entity.getMerchantName() );
merchantBaseInfoDTO.setMerchantType( entity.getMerchantType() );
merchantBaseInfoDTO.setAlias( entity.getAlias() );
merchantBaseInfoDTO.setMcc( entity.getMcc() );
merchantBaseInfoDTO.setMccName( entity.getMccName() );
merchantBaseInfoDTO.setAliAccount( entity.getAliAccount() );
merchantBaseInfoDTO.setProductDesc( entity.getProductDesc() );
merchantBaseInfoDTO.setAddressNo( entity.getAddressNo() );
merchantBaseInfoDTO.setMerchantAddress( entity.getMerchantAddress() );
merchantBaseInfoDTO.setAddress( entity.getAddress() );
merchantBaseInfoDTO.setContactMobile( entity.getContactMobile() );
merchantBaseInfoDTO.setContactName( entity.getContactName() );
merchantBaseInfoDTO.setEmail( entity.getEmail() );
merchantBaseInfoDTO.setStoreHeadPic( entity.getStoreHeadPic() );
merchantBaseInfoDTO.setStoreInsidePic( entity.getStoreInsidePic() );
merchantBaseInfoDTO.setCashPic( entity.getCashPic() );
merchantBaseInfoDTO.setUserPhone( entity.getUserPhone() );
return merchantBaseInfoDTO;
}
@Override
public MerchantBaseInfoVO domain2VO(MerchantBaseInfo entity) {
if ( entity == null ) {
return null;
}
MerchantBaseInfoVO merchantBaseInfoVO = new MerchantBaseInfoVO();
merchantBaseInfoVO.setId( entity.getId() );
merchantBaseInfoVO.setBindingCode( entity.getBindingCode() );
merchantBaseInfoVO.setUserId( entity.getUserId() );
merchantBaseInfoVO.setAliAccount( entity.getAliAccount() );
merchantBaseInfoVO.setMerchantCode( entity.getMerchantCode() );
merchantBaseInfoVO.setMerchantName( entity.getMerchantName() );
merchantBaseInfoVO.setMerchantType( entity.getMerchantType() );
merchantBaseInfoVO.setProductDesc( entity.getProductDesc() );
merchantBaseInfoVO.setAliMcc( entity.getAliMcc() );
merchantBaseInfoVO.setMcc( entity.getMcc() );
merchantBaseInfoVO.setMccName( entity.getMccName() );
merchantBaseInfoVO.setAlias( entity.getAlias() );
merchantBaseInfoVO.setContactMobile( entity.getContactMobile() );
merchantBaseInfoVO.setContactName( entity.getContactName() );
merchantBaseInfoVO.setAddressNo( entity.getAddressNo() );
merchantBaseInfoVO.setProvince( entity.getProvince() );
merchantBaseInfoVO.setCity( entity.getCity() );
merchantBaseInfoVO.setDistrict( entity.getDistrict() );
merchantBaseInfoVO.setAddress( entity.getAddress() );
merchantBaseInfoVO.setEmail( entity.getEmail() );
merchantBaseInfoVO.setPrincipalMobile( entity.getPrincipalMobile() );
merchantBaseInfoVO.setPrincipalCertType( entity.getPrincipalCertType() );
merchantBaseInfoVO.setPrincipalCertNo( entity.getPrincipalCertNo() );
merchantBaseInfoVO.setPrincipalPerson( entity.getPrincipalPerson() );
merchantBaseInfoVO.setBussAuthName( entity.getBussAuthName() );
merchantBaseInfoVO.setBussAuthNum( entity.getBussAuthNum() );
merchantBaseInfoVO.setBussAuthAddress( entity.getBussAuthAddress() );
merchantBaseInfoVO.setBussAuthStartTime( entity.getBussAuthStartTime() );
merchantBaseInfoVO.setBussAuthEndTime( entity.getBussAuthEndTime() );
merchantBaseInfoVO.setAllowBankLarge( entity.getAllowBankLarge() );
merchantBaseInfoVO.setWxCertStatus( entity.getWxCertStatus() );
merchantBaseInfoVO.setCreateDt( entity.getCreateDt() );
merchantBaseInfoVO.setUpdateDt( entity.getUpdateDt() );
merchantBaseInfoVO.setBuslicType( entity.getBuslicType() );
merchantBaseInfoVO.setIsVoice( entity.getIsVoice() );
merchantBaseInfoVO.setIsPushWxMessage( entity.getIsPushWxMessage() );
merchantBaseInfoVO.setIsUnionPay( entity.getIsUnionPay() );
merchantBaseInfoVO.setMd5Key( entity.getMd5Key() );
merchantBaseInfoVO.setLimitPay( entity.getLimitPay() );
merchantBaseInfoVO.setSubAppId( entity.getSubAppId() );
merchantBaseInfoVO.setAppid( entity.getAppid() );
merchantBaseInfoVO.setStatus( entity.getStatus() );
merchantBaseInfoVO.setMerchantAddress( entity.getMerchantAddress() );
merchantBaseInfoVO.setStoreHeadPic( entity.getStoreHeadPic() );
merchantBaseInfoVO.setStoreInsidePic( entity.getStoreInsidePic() );
merchantBaseInfoVO.setCashPic( entity.getCashPic() );
merchantBaseInfoVO.setLiteralPic( entity.getLiteralPic() );
merchantBaseInfoVO.setWarrantyPic( entity.getWarrantyPic() );
merchantBaseInfoVO.setDealPic( entity.getDealPic() );
merchantBaseInfoVO.setAffilatePic( entity.getAffilatePic() );
merchantBaseInfoVO.setHandPic( entity.getHandPic() );
merchantBaseInfoVO.setMerchantAuditStatus( entity.getMerchantAuditStatus() );
merchantBaseInfoVO.setStartTime( entity.getStartTime() );
merchantBaseInfoVO.setEndTime( entity.getEndTime() );
merchantBaseInfoVO.setImgUrl( entity.getImgUrl() );
merchantBaseInfoVO.setLoginName( entity.getLoginName() );
merchantBaseInfoVO.setPassword( entity.getPassword() );
merchantBaseInfoVO.setLogo( entity.getLogo() );
merchantBaseInfoVO.setUserPhone( entity.getUserPhone() );
merchantBaseInfoVO.setUserName( entity.getUserName() );
merchantBaseInfoVO.setBusinessLicensePic( entity.getBusinessLicensePic() );
merchantBaseInfoVO.setLocation( entity.getLocation() );
merchantBaseInfoVO.setFirstTradeTime( entity.getFirstTradeTime() );
merchantBaseInfoVO.setLastTradeTime( entity.getLastTradeTime() );
merchantBaseInfoVO.setSplitFlag( entity.getSplitFlag() );
merchantBaseInfoVO.setValidFlag( entity.getValidFlag() );
return merchantBaseInfoVO;
}
@Override
public MerchantBaseInfo vo2domain(MerchantBaseInfoVO entity) {
if ( entity == null ) {
return null;
}
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
merchantBaseInfo.setId( entity.getId() );
merchantBaseInfo.setBindingCode( entity.getBindingCode() );
merchantBaseInfo.setUserId( entity.getUserId() );
merchantBaseInfo.setAliAccount( entity.getAliAccount() );
merchantBaseInfo.setMerchantCode( entity.getMerchantCode() );
merchantBaseInfo.setMerchantName( entity.getMerchantName() );
merchantBaseInfo.setMerchantType( entity.getMerchantType() );
merchantBaseInfo.setProductDesc( entity.getProductDesc() );
merchantBaseInfo.setAliMcc( entity.getAliMcc() );
merchantBaseInfo.setMcc( entity.getMcc() );
merchantBaseInfo.setMccName( entity.getMccName() );
merchantBaseInfo.setAlias( entity.getAlias() );
merchantBaseInfo.setContactMobile( entity.getContactMobile() );
merchantBaseInfo.setContactName( entity.getContactName() );
merchantBaseInfo.setAddressNo( entity.getAddressNo() );
merchantBaseInfo.setProvince( entity.getProvince() );
merchantBaseInfo.setCity( entity.getCity() );
merchantBaseInfo.setDistrict( entity.getDistrict() );
merchantBaseInfo.setAddress( entity.getAddress() );
merchantBaseInfo.setEmail( entity.getEmail() );
merchantBaseInfo.setPrincipalMobile( entity.getPrincipalMobile() );
merchantBaseInfo.setPrincipalCertType( entity.getPrincipalCertType() );
merchantBaseInfo.setPrincipalCertNo( entity.getPrincipalCertNo() );
merchantBaseInfo.setPrincipalPerson( entity.getPrincipalPerson() );
merchantBaseInfo.setBussAuthName( entity.getBussAuthName() );
merchantBaseInfo.setBussAuthNum( entity.getBussAuthNum() );
merchantBaseInfo.setBussAuthAddress( entity.getBussAuthAddress() );
merchantBaseInfo.setBussAuthStartTime( entity.getBussAuthStartTime() );
merchantBaseInfo.setBussAuthEndTime( entity.getBussAuthEndTime() );
merchantBaseInfo.setAllowBankLarge( entity.getAllowBankLarge() );
merchantBaseInfo.setWxCertStatus( entity.getWxCertStatus() );
merchantBaseInfo.setCreateDt( entity.getCreateDt() );
merchantBaseInfo.setUpdateDt( entity.getUpdateDt() );
merchantBaseInfo.setBuslicType( entity.getBuslicType() );
merchantBaseInfo.setIsVoice( entity.getIsVoice() );
merchantBaseInfo.setIsPushWxMessage( entity.getIsPushWxMessage() );
merchantBaseInfo.setIsUnionPay( entity.getIsUnionPay() );
merchantBaseInfo.setMd5Key( entity.getMd5Key() );
merchantBaseInfo.setLimitPay( entity.getLimitPay() );
merchantBaseInfo.setSubAppId( entity.getSubAppId() );
merchantBaseInfo.setAppid( entity.getAppid() );
merchantBaseInfo.setStatus( entity.getStatus() );
merchantBaseInfo.setMerchantAddress( entity.getMerchantAddress() );
merchantBaseInfo.setStoreHeadPic( entity.getStoreHeadPic() );
merchantBaseInfo.setStoreInsidePic( entity.getStoreInsidePic() );
merchantBaseInfo.setCashPic( entity.getCashPic() );
merchantBaseInfo.setLiteralPic( entity.getLiteralPic() );
merchantBaseInfo.setWarrantyPic( entity.getWarrantyPic() );
merchantBaseInfo.setDealPic( entity.getDealPic() );
merchantBaseInfo.setAffilatePic( entity.getAffilatePic() );
merchantBaseInfo.setHandPic( entity.getHandPic() );
merchantBaseInfo.setMerchantAuditStatus( entity.getMerchantAuditStatus() );
merchantBaseInfo.setStartTime( entity.getStartTime() );
merchantBaseInfo.setEndTime( entity.getEndTime() );
merchantBaseInfo.setImgUrl( entity.getImgUrl() );
merchantBaseInfo.setLoginName( entity.getLoginName() );
merchantBaseInfo.setPassword( entity.getPassword() );
merchantBaseInfo.setLogo( entity.getLogo() );
merchantBaseInfo.setUserPhone( entity.getUserPhone() );
merchantBaseInfo.setUserName( entity.getUserName() );
merchantBaseInfo.setBusinessLicensePic( entity.getBusinessLicensePic() );
merchantBaseInfo.setLocation( entity.getLocation() );
merchantBaseInfo.setFirstTradeTime( entity.getFirstTradeTime() );
merchantBaseInfo.setLastTradeTime( entity.getLastTradeTime() );
merchantBaseInfo.setSplitFlag( entity.getSplitFlag() );
merchantBaseInfo.setValidFlag( entity.getValidFlag() );
return merchantBaseInfo;
}
@Override
public MerchantBaseInfo dto2Domain(MerchantBaseInfoDTO dto) {
if ( dto == null ) {
return null;
}
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
merchantBaseInfo.setId( dto.getId() );
merchantBaseInfo.setUserId( dto.getUserId() );
merchantBaseInfo.setAliAccount( dto.getAliAccount() );
merchantBaseInfo.setMerchantName( dto.getMerchantName() );
merchantBaseInfo.setMerchantType( dto.getMerchantType() );
merchantBaseInfo.setProductDesc( dto.getProductDesc() );
merchantBaseInfo.setMcc( dto.getMcc() );
merchantBaseInfo.setMccName( dto.getMccName() );
merchantBaseInfo.setAlias( dto.getAlias() );
merchantBaseInfo.setContactMobile( dto.getContactMobile() );
merchantBaseInfo.setContactName( dto.getContactName() );
merchantBaseInfo.setAddressNo( dto.getAddressNo() );
merchantBaseInfo.setAddress( dto.getAddress() );
merchantBaseInfo.setEmail( dto.getEmail() );
merchantBaseInfo.setMerchantAddress( dto.getMerchantAddress() );
merchantBaseInfo.setStoreHeadPic( dto.getStoreHeadPic() );
merchantBaseInfo.setStoreInsidePic( dto.getStoreInsidePic() );
merchantBaseInfo.setCashPic( dto.getCashPic() );
merchantBaseInfo.setUserPhone( dto.getUserPhone() );
return merchantBaseInfo;
}
@Override
public MerchantStore baseInfo2StoreInfo(MerchantBaseInfo entity) {
if ( entity == null ) {
return null;
}
MerchantStore merchantStore = new MerchantStore();
merchantStore.setStoreName( entity.getAlias() );
merchantStore.setMerchantName( entity.getAlias() );
if ( entity.getId() != null ) {
merchantStore.setId( entity.getId().intValue() );
}
merchantStore.setMerchantCode( entity.getMerchantCode() );
merchantStore.setCreateDt( entity.getCreateDt() );
merchantStore.setStatus( entity.getStatus() );
merchantStore.setEmail( entity.getEmail() );
merchantStore.setStoreHeadPic( entity.getStoreHeadPic() );
merchantStore.setStoreInsidePic( entity.getStoreInsidePic() );
merchantStore.setCashPic( entity.getCashPic() );
merchantStore.setProductDesc( entity.getProductDesc() );
merchantStore.setMerchantType( entity.getMerchantType() );
merchantStore.setStartTime( entity.getStartTime() );
merchantStore.setEndTime( entity.getEndTime() );
merchantStore.setAlias( entity.getAlias() );
return merchantStore;
}
@Override
public UserApp baseInfo2UserApp(MerchantBaseInfo entity) {
if ( entity == null ) {
return null;
}
UserApp userApp = new UserApp();
userApp.setId( entity.getId() );
userApp.setLoginName( entity.getLoginName() );
if ( entity.getUserId() != null ) {
userApp.setUserId( Long.parseLong( entity.getUserId() ) );
}
userApp.setUserName( entity.getUserName() );
userApp.setLogo( entity.getLogo() );
userApp.setCreateDt( entity.getCreateDt() );
userApp.setUpdateDt( entity.getUpdateDt() );
if ( entity.getStatus() != null ) {
userApp.setStatus( Integer.parseInt( entity.getStatus() ) );
}
userApp.setMerchantCode( entity.getMerchantCode() );
userApp.setMerchantName( entity.getMerchantName() );
userApp.setContactName( entity.getContactName() );
userApp.setProductDesc( entity.getProductDesc() );
userApp.setBussAuthNum( entity.getBussAuthNum() );
userApp.setIsVoice( entity.getIsVoice() );
userApp.setIsUnionPay( entity.getIsUnionPay() );
userApp.setPassword( entity.getPassword() );
userApp.setMerchantType( entity.getMerchantType() );
userApp.setAlias( entity.getAlias() );
userApp.setMerchantAuditStatus( entity.getMerchantAuditStatus() );
return userApp;
}
@Override
public List<MerchantBaseInfoDTO> domain2dto(List<MerchantBaseInfo> entityList) {
if ( entityList == null ) {
return null;
}
List<MerchantBaseInfoDTO> list = new ArrayList<MerchantBaseInfoDTO>( entityList.size() );
for ( MerchantBaseInfo merchantBaseInfo : entityList ) {
list.add( domain2dto( merchantBaseInfo ) );
}
return list;
}
}

View File

@ -0,0 +1,33 @@
package cn.pluss.platform.converter;
import cn.pluss.platform.entity.MerchantCashPlace;
import cn.pluss.platform.vo.MerchantCashPlaceVO;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-05-04T16:00:25+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_191 (Oracle Corporation)"
)
public class MerchantCashPlaceConverterImpl implements MerchantCashPlaceConverter {
@Override
public MerchantCashPlaceVO entity2VO(MerchantCashPlace merchantCashPlace) {
if ( merchantCashPlace == null ) {
return null;
}
MerchantCashPlaceVO merchantCashPlaceVO = new MerchantCashPlaceVO();
merchantCashPlaceVO.setId( merchantCashPlace.getId() );
merchantCashPlaceVO.setUserId( merchantCashPlace.getUserId() );
merchantCashPlaceVO.setName( merchantCashPlace.getName() );
merchantCashPlaceVO.setCode( merchantCashPlace.getCode() );
merchantCashPlaceVO.setAddress( merchantCashPlace.getAddress() );
merchantCashPlaceVO.setRemark( merchantCashPlace.getRemark() );
merchantCashPlaceVO.setCreateTime( merchantCashPlace.getCreateTime() );
merchantCashPlaceVO.setUpdateTime( merchantCashPlace.getUpdateTime() );
return merchantCashPlaceVO;
}
}

View File

@ -0,0 +1,30 @@
package cn.pluss.platform.converter;
import cn.pluss.platform.dto.MerchantStaffDTO;
import cn.pluss.platform.entity.UserInfo;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-05-04T16:00:25+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_191 (Oracle Corporation)"
)
public class MerchantStaffConverterImpl implements MerchantStaffConverter {
@Override
public UserInfo toUserInfo(MerchantStaffDTO merchantStaffDTO) {
if ( merchantStaffDTO == null ) {
return null;
}
UserInfo userInfo = new UserInfo();
userInfo.setId( merchantStaffDTO.getUserId() );
userInfo.setLoginName( merchantStaffDTO.getLoginName() );
userInfo.setPhone( merchantStaffDTO.getPhone() );
userInfo.setPassword( merchantStaffDTO.getPassword() );
userInfo.setMerchantCode( merchantStaffDTO.getMerchantCode() );
return userInfo;
}
}

View File

@ -0,0 +1,151 @@
package cn.pluss.platform.converter;
import cn.pluss.platform.entity.MerchantBaseInfo;
import cn.pluss.platform.entity.MerchantStore;
import cn.pluss.platform.entity.UserApp;
import cn.pluss.platform.entity.UserInfo;
import java.text.SimpleDateFormat;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-05-04T16:00:25+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_191 (Oracle Corporation)"
)
public class UserAppConverterImpl implements UserAppConverter {
@Override
public void copyProperties(MerchantStore merchantStore, UserApp userApp) {
if ( merchantStore == null ) {
return;
}
if ( merchantStore.getId() != null ) {
userApp.setStoreId2( String.valueOf( merchantStore.getId() ) );
}
if ( merchantStore.getCreateDt() != null ) {
userApp.setCreateDt( merchantStore.getCreateDt() );
}
if ( merchantStore.getMerchantCode() != null ) {
userApp.setMerchantCode( merchantStore.getMerchantCode() );
}
if ( merchantStore.getMerchantName() != null ) {
userApp.setMerchantName( merchantStore.getMerchantName() );
}
if ( merchantStore.getStoreName() != null ) {
userApp.setStoreName( merchantStore.getStoreName() );
}
if ( merchantStore.getStoreId() != null ) {
userApp.setStoreId( merchantStore.getStoreId() );
}
if ( merchantStore.getProductDesc() != null ) {
userApp.setProductDesc( merchantStore.getProductDesc() );
}
if ( merchantStore.getPayEcdemicSwitch() != null ) {
userApp.setPayEcdemicSwitch( merchantStore.getPayEcdemicSwitch() );
}
if ( merchantStore.getIsMarket() != null ) {
userApp.setIsMarket( merchantStore.getIsMarket() );
}
if ( merchantStore.getMerchantType() != null ) {
userApp.setMerchantType( merchantStore.getMerchantType() );
}
if ( merchantStore.getAlias() != null ) {
userApp.setAlias( merchantStore.getAlias() );
}
if ( merchantStore.getMcsStatus() != null ) {
userApp.setMcsStatus( merchantStore.getMcsStatus() );
}
}
@Override
public void copyProperties(MerchantBaseInfo merchantBaseInfo, UserApp userApp) {
if ( merchantBaseInfo == null ) {
return;
}
if ( merchantBaseInfo.getAlias() != null ) {
userApp.setMerchantName( merchantBaseInfo.getAlias() );
}
if ( merchantBaseInfo.getId() != null ) {
userApp.setMercId( merchantBaseInfo.getId() );
}
if ( merchantBaseInfo.getLoginName() != null ) {
userApp.setLoginName( merchantBaseInfo.getLoginName() );
}
if ( merchantBaseInfo.getUserId() != null ) {
userApp.setUserId( Long.parseLong( merchantBaseInfo.getUserId() ) );
}
if ( merchantBaseInfo.getUserName() != null ) {
userApp.setUserName( merchantBaseInfo.getUserName() );
}
if ( merchantBaseInfo.getLogo() != null ) {
userApp.setLogo( merchantBaseInfo.getLogo() );
}
if ( merchantBaseInfo.getCreateDt() != null ) {
userApp.setCreateDt( merchantBaseInfo.getCreateDt() );
}
if ( merchantBaseInfo.getUpdateDt() != null ) {
userApp.setUpdateDt( merchantBaseInfo.getUpdateDt() );
}
if ( merchantBaseInfo.getMerchantCode() != null ) {
userApp.setMerchantCode( merchantBaseInfo.getMerchantCode() );
}
if ( merchantBaseInfo.getContactName() != null ) {
userApp.setContactName( merchantBaseInfo.getContactName() );
}
if ( merchantBaseInfo.getProductDesc() != null ) {
userApp.setProductDesc( merchantBaseInfo.getProductDesc() );
}
if ( merchantBaseInfo.getBussAuthNum() != null ) {
userApp.setBussAuthNum( merchantBaseInfo.getBussAuthNum() );
}
if ( merchantBaseInfo.getIsVoice() != null ) {
userApp.setIsVoice( merchantBaseInfo.getIsVoice() );
}
if ( merchantBaseInfo.getIsUnionPay() != null ) {
userApp.setIsUnionPay( merchantBaseInfo.getIsUnionPay() );
}
if ( merchantBaseInfo.getPassword() != null ) {
userApp.setPassword( merchantBaseInfo.getPassword() );
}
if ( merchantBaseInfo.getMerchantType() != null ) {
userApp.setMerchantType( merchantBaseInfo.getMerchantType() );
}
if ( merchantBaseInfo.getAlias() != null ) {
userApp.setAlias( merchantBaseInfo.getAlias() );
}
if ( merchantBaseInfo.getMerchantAuditStatus() != null ) {
userApp.setMerchantAuditStatus( merchantBaseInfo.getMerchantAuditStatus() );
}
}
@Override
public UserApp toUserApp(UserInfo userInfo) {
if ( userInfo == null ) {
return null;
}
UserApp userApp = new UserApp();
userApp.setCreateDt( userInfo.getCreateTime() );
userApp.setUserId( userInfo.getId() );
userApp.setLoginName( userInfo.getLoginName() );
userApp.setStatus( userInfo.getStatus() );
if ( userInfo.getParentId() != null ) {
userApp.setParentId( userInfo.getParentId().longValue() );
}
userApp.setPhone( userInfo.getPhone() );
userApp.setMerchantCode( userInfo.getMerchantCode() );
userApp.setStoreId( userInfo.getStoreId() );
userApp.setPassword( userInfo.getPassword() );
if ( userInfo.getUpdateTime() != null ) {
userApp.setUpdateTime( new SimpleDateFormat().format( userInfo.getUpdateTime() ) );
}
userApp.setPayPassword( userInfo.getPayPassword() );
userApp.setFaceCert( userInfo.getFaceCert() );
userApp.setFaceCompare( userInfo.getFaceCompare() );
return userApp;
}
}

View File

@ -0,0 +1,12 @@
package cn.pluss.platform.access;
import cn.pluss.platform.access.domain.ReqEntity;
import cn.pluss.platform.access.domain.RespEntity;
public interface AccessService {
boolean checkSign(ReqEntity reqEntity);
void addSign(RespEntity respEntity);
}

View File

@ -0,0 +1,33 @@
package cn.pluss.platform.access.domain;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum CodeEnum {
SUCCESS("0000", "操作成功"),
PARAM_ERROR("0001", "参数不正确"),
SIGN_ERROR("0002", "签名校验异常"),
ORG_ID_NOT_FOUND("0003", "缺少机构ID"),
STORE_NOT_FOUND("1001", "未找到机具"),
ORDER_NOT_FOUND("2001", "未找到订单"),
ORDER_REFUND_ERROR("2002", "订单退款异常"),
REFUND_ORDER_NOT_FOUND("2003", "未找到退款订单"),
PASSWORD_NOT_INIT("2011", "安全密码未初始化请前往收银呗APP进行初始化"),
PASSWORD_ERROR("2021", "安全密码错误若忘记密码可前往收银呗APP进行重置"),
;
private final String val;
private final String desc;
}

View File

@ -0,0 +1,44 @@
package cn.pluss.platform.access.domain;
import cn.pluss.platform.access.exception.AccessException;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ReqEntity {
private String orgId;
private String requestId;
private String version;
private String timestamp;
private String reqData;
public JSONObject initJSONData() {
if (reqData == null) {
throw new AccessException(CodeEnum.PARAM_ERROR);
}
return JSON.parseObject(reqData);
}
private String signType;
private String sign;
public static String getSignContent(ReqEntity entity) {
return "orgId=" + entity.getOrgId() + "&" +
"reqData=" + entity.getReqData() + "&" +
"requestId=" + entity.getRequestId() + "&" +
"signType=" + entity.getSignType() + "&" +
"timestamp=" + entity.getTimestamp() + "&" +
"version=" + entity.getVersion();
}
}

View File

@ -0,0 +1,94 @@
package cn.pluss.platform.access.domain;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.ValueFilter;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
@Getter
@Setter
public class RespEntity {
private String code;
private String msg;
private String respData;
private String sign;
private String signType;
private String orgId;
private String requestId;
public RespEntity(String orgId, CodeEnum codeEnum, Object respData, String requestId) {
this(orgId, codeEnum, respData, requestId, null);
}
public RespEntity(String orgId, String code, Object respData, String requestId) {
this(orgId, code, respData, requestId, null);
}
public RespEntity(String orgId, CodeEnum codeEnum, Object respData, String requestId, String msg) {
this.code = codeEnum.getVal();
this.requestId = requestId;
if (!ObjectUtils.isEmpty(msg)) {
this.msg = msg;
} else {
this.msg = codeEnum.getDesc();
}
this.signType = "RSA";
this.respData = JSON.toJSONString(respData, (ValueFilter) (object, name, value) -> {
if (value instanceof BigDecimal) {
return ((BigDecimal) value).toPlainString();
}
if (value instanceof Double || value instanceof Float) {
return String.valueOf(value);
}
return value;
});
this.orgId = orgId;
}
public RespEntity(String orgId, String code, Object respData, String requestId, String msg) {
this.code = code;
this.requestId = requestId;
this.msg = msg;
this.signType = "RSA";
this.respData = JSON.toJSONString(respData, (ValueFilter) (object, name, value) -> {
if (value instanceof BigDecimal) {
return ((BigDecimal) value).toPlainString();
}
if (value instanceof Double || value instanceof Float) {
return String.valueOf(value);
}
return value;
});
this.orgId = orgId;
}
public static String getSignContent(RespEntity entity) {
String signContent = "code=" + entity.getCode() + "&"
+ "msg=" + entity.getMsg() + "&"
+ "orgId=" + entity.getOrgId() + "&"
+ "requestId=" + entity.getRequestId() + "&";
if (entity.getRespData() != null) {
signContent += "respData=" + entity.getRespData() + "&";
}
signContent += "signType=" + entity.getSignType();
return signContent;
}
}

View File

@ -0,0 +1,24 @@
package cn.pluss.platform.access.exception;
import cn.pluss.platform.access.domain.CodeEnum;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.ObjectUtils;
@NoArgsConstructor
@Getter
@Setter
public class AccessException extends RuntimeException {
private String code;
public AccessException(CodeEnum codeEnum, String msg) {
super(ObjectUtils.isEmpty(msg)? codeEnum.getDesc(): msg);
this.code = codeEnum.getVal();
}
public AccessException(CodeEnum codeEnum) {
this(codeEnum, null);
}
}

View File

@ -0,0 +1,23 @@
package cn.pluss.platform.access.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
public interface AccessBizService {
Object machineStoreInfo(String snNo);
Object scanPay(JSONObject param);
Object orderStatus(String orderNum, String mercOrderNo);
Object refund(JSONObject param);
<T> List<T> refundList(JSONObject param);
Page<Object> orderList(JSONObject param);
Object dataAnalysis(JSONObject param);
}

View File

@ -0,0 +1,504 @@
package cn.pluss.platform.access.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.pluss.platform.access.domain.CodeEnum;
import cn.pluss.platform.access.exception.AccessException;
import cn.pluss.platform.access.service.AccessBizService;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.deviceStock.DeviceStockService;
import cn.pluss.platform.dto.MerChantOrderDTO;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.mapper.MerchantChannelStatusMapper;
import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.merchantOrder.MerchantOrderService;
import cn.pluss.platform.merchantStore.MerchantStoreService;
import cn.pluss.platform.pay.ApiPayService;
import cn.pluss.platform.pay.PayService;
import cn.pluss.platform.refundOrder.MerchantRefundOrderService;
import cn.pluss.platform.ryx.pay.RyxPayService;
import cn.pluss.platform.sxf.pay.SxfPayService;
import cn.pluss.platform.userInfo.UserInfoService;
import cn.pluss.platform.util.StringUtil;
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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AccessBizServiceImpl implements AccessBizService {
@Autowired
private DeviceStockService deviceStockService;
@Autowired
private MerchantBaseInfoService mbiService;
@Autowired
private MerchantOrderService orderService;
@Autowired
private MerchantStoreService merchantStoreService;
@Resource
private MerchantChannelStatusMapper mcsMapper;
@Autowired
private SxfPayService sxfPayService;
@Autowired
private RyxPayService ryxPayService;
@Autowired
@Qualifier("ysPayOldService")
private PayService ysPayOldService;
@Autowired
private ApiPayService apiPayService;
@Autowired
private UserInfoService userInfoService;
@Autowired
private MerchantRefundOrderService refundOrderService;
@Autowired
private HttpServletRequest request;
private MerchantBaseInfo getByDeviceNo(String deviceNo) {
DeviceStock deviceStock = deviceStockService.getDevicebyNo(deviceNo);
if (deviceStock == null) {
deviceStock = deviceStockService.getDeviceBySnNo(deviceNo);
}
if (deviceStock == null || !"3".equals(deviceStock.getStatus())) {
throw new AccessException(CodeEnum.STORE_NOT_FOUND);
}
MerchantBaseInfo mbi = mbiService.getById(deviceStock.getActMercId());
if (mbi == null) {
throw new AccessException(CodeEnum.STORE_NOT_FOUND);
}
return mbi;
}
@Override
public Object machineStoreInfo(String deviceNo) {
JSONObject result = new JSONObject();
DeviceStock deviceStock = deviceStockService.getDevicebyNo(deviceNo);
if (deviceStock == null) {
deviceStock = deviceStockService.getDeviceBySnNo(deviceNo);
}
// 未入库
result.put("status", "-3");
result.put("remark", "机具未入库");
if (deviceStock == null) {
return result;
}
// 未绑定商户
result.put("status", "-2");
result.put("remark", "未绑定商户");
if (!"3".equals(deviceStock.getStatus())) {
return result;
} else {
result.put("status", "-1");
result.put("remark", "未获取到商户信息");
}
String actMercId = deviceStock.getActMercId();
if (ObjectUtils.isEmpty(actMercId)) {
return result;
}
MerchantBaseInfo mbi = mbiService.getById(actMercId);
if (mbi == null) {
return result;
}
// 已绑定商户
result.put("status", "1");
result.put("remark", "商户信息获取成功");
result.put("merchantName", mbi.getMerchantName());
result.put("alias", mbi.getAlias());
return result;
}
@Override
public Object scanPay(JSONObject param) {
String authCode = param.getString("authCode");
BigDecimal consumeFee = param.getBigDecimal("consumeFee");
String type = param.getString("type");
String deviceNo = param.getString("deviceNo");
String remark = param.getString("remark");
String mercOrderNo = param.getString("mercOrderNo");
// 必传参数
if (ObjectUtils.isEmpty(authCode)
|| ObjectUtils.isEmpty(consumeFee)
|| ObjectUtils.isEmpty(type)
|| ObjectUtils.isEmpty(deviceNo)) {
throw new AccessException(CodeEnum.PARAM_ERROR);
}
MerchantBaseInfo mbi = getByDeviceNo(deviceNo);
MerchantStore merchantStore = merchantStoreService.getStoreByMerchantCode(mbi.getMerchantCode());
MerChantOrderDTO dto = new MerChantOrderDTO();
dto.setType(type);
dto.setConsumeFee(consumeFee.doubleValue());
dto.setAuthCode(authCode);
dto.setUserId(mbi.getUserId());
dto.setDeviceNo(deviceNo);
dto.setStoreId(merchantStore.getStoreId());
dto.setMerchantCode(mbi.getMerchantCode());
dto.setRemark(remark);
dto.setMercOrderNo(mercOrderNo);
return orderService.toActivePayV2(dto, request);
}
@Override
public Object orderStatus(String orderNum, String mercOrderNo) {
// 校验参数是否完整
if (ObjectUtils.isEmpty(orderNum) && ObjectUtils.isEmpty(mercOrderNo)) {
return ResultGenerator.genFailResult("订单号不能为空");
}
QueryWrapper<MerchantOrder> queryWrapper = new QueryWrapper<MerchantOrder>()
.eq(!ObjectUtils.isEmpty(orderNum), "orderNumber", orderNum)
.eq(!ObjectUtils.isEmpty(mercOrderNo), "mercOrderNo", mercOrderNo);
MerchantOrder order = orderService.getOne(queryWrapper);
if (order == null) {
throw new AccessException(CodeEnum.ORDER_NOT_FOUND);
}
//支付成功
if ("1".equals(order.getStatus())) {
JSONObject result = new JSONObject();
result.put("status", "1");
result.put("orderNumber", order.getOrderNumber());
result.put("mercOrderNo", order.getMercOrderNo());
result.put("transTime", DateUtil.format(order.getCreateDt(), DatePattern.NORM_DATETIME_FORMAT));
result.put("consumeFee", order.getConsumeFee());
result.put("payType", order.getPayTypeCode());
return result;
}
String aisleSwitch = order.getAisleSwitch();
MerchantChannelStatus channel = null;
switch (aisleSwitch) {
case "2":
channel = mcsMapper.getByMerchantCode(order.getMerchantCode(), 1);
break;
default:
channel = mcsMapper.getByMerchantCode(order.getMerchantCode(), Integer.valueOf(aisleSwitch));
break;
}
if (channel != null) {
JSONObject result = null;
switch (channel.getChannel()) {
case 1:
result = sxfPayService.tradeQuery(order, channel.getMerchantId());
break;
case 3:
result = ryxPayService.tradeQuery(order, channel.getMerchantId());
break;
case 4:
result = ysPayOldService.tradeQuery(order, channel.getMerchantId());
break;
}
if (result != null) {
orderService.updateOrderStatus(result, order);
String status = result.getString("payStatus");
if ("1".equals(status)) {
order.setStatus("1");
}
}
}
JSONObject result = new JSONObject();
result.put("status", order.getStatus());
result.put("orderNumber", order.getOrderNumber());
result.put("mercOrderNo", order.getMercOrderNo());
result.put("transTime", DateUtil.format(order.getCreateDt(), DatePattern.NORM_DATETIME_FORMAT));
result.put("consumeFee", order.getConsumeFee());
result.put("payType", order.getPayTypeCode());
return result;
}
@Override
public Object refund(JSONObject param) {
String deviceNo = param.getString("deviceNo");
String orderNumber = param.getString("orderNumber");
param.put("thirdSendNo", param.getString("channelTransNo"));
BigDecimal refundAmt = param.getBigDecimal("refundAmt");
String refundFlag = param.getString("refundFlag");
// String pwd = param.getString("pwd");
MerchantBaseInfo mbi = getByDeviceNo(deviceNo);
// UserInfo userInfo = userInfoService.getById(mbi.getUserId());
// if (ObjectUtils.isEmpty(pwd)) {
// throw new AccessException(CodeEnum.PARAM_ERROR, "安全密码不能为空");
// }
// String payPassword = userInfo.getPayPassword();
// if (payPassword == null) {
// throw new AccessException(CodeEnum.PASSWORD_NOT_INIT);
// }
//
// if (!payPassword.equalsIgnoreCase(MD5Util.MD5Encode(pwd, "utf-8"))) {
// throw new AccessException(CodeEnum.PASSWORD_ERROR);
// }
param.put("merchant", mbi);
if (!"1".equals(refundFlag)) {
if (ObjectUtils.isEmpty(refundAmt)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "未选择全额退款时,退款金额不能为空");
}
if (!StringUtil.isNumber(param.getString("refundAmt"))) {
throw new AccessException(CodeEnum.PARAM_ERROR, "退款金额格式有误,小数点保留后两位");
}
}
try {
JSONObject jsonObject = apiPayService.apiRefundPay(param);
jsonObject.remove("sign");
return jsonObject;
} catch (Exception e) {
e.printStackTrace();
throw new AccessException(CodeEnum.ORDER_REFUND_ERROR, e.getMessage());
}
}
@Override
public List<JSONObject> refundList(JSONObject param) {
String deviceNo = param.getString("deviceNo");
String orderNumber = param.getString("orderNumber");
String mercOrderNo = param.getString("mercOrderNo");
String thirdTransNo = param.getString("thirdTransNo");
String channelTransNo = param.getString("channelTransNo");
String refundNo = param.getString("refundNo");
String mercRefundNo = param.getString("mercRefundNo");
if (ObjectUtils.isEmpty(deviceNo)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "缺少设备编号");
}
if (ObjectUtils.isEmpty(orderNumber)
&& ObjectUtils.isEmpty(mercOrderNo)
&& ObjectUtils.isEmpty(thirdTransNo)
&& ObjectUtils.isEmpty(channelTransNo)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "缺少原交易订单号");
}
MerchantBaseInfo mbi = getByDeviceNo(deviceNo);
LambdaQueryWrapper<MerchantRefundOrder> qWrapper = Wrappers.lambdaQuery();
qWrapper.eq(!ObjectUtils.isEmpty(orderNumber), MerchantRefundOrder::getOrderNumber, orderNumber);
qWrapper.eq(!ObjectUtils.isEmpty(refundNo), MerchantRefundOrder::getRefundNo, refundNo);
qWrapper.eq(MerchantRefundOrder::getMerchantCode, mbi.getMerchantCode());
qWrapper.eq(!ObjectUtils.isEmpty(mercRefundNo), MerchantRefundOrder::getMercRefundNo, mercRefundNo);
qWrapper.orderByDesc(MerchantRefundOrder::getRefundTime);
List<MerchantRefundOrder> refundOrderList = refundOrderService.list(qWrapper);
if (CollectionUtil.isEmpty(refundOrderList)) {
throw new AccessException(CodeEnum.REFUND_ORDER_NOT_FOUND);
}
List<JSONObject> result = new ArrayList<>();
for (MerchantRefundOrder item : refundOrderList) {
JSONObject jsonItem = new JSONObject();
jsonItem.put("orderNumber", item.getOrderNumber());
jsonItem.put("refundNo", item.getRefundNo());
jsonItem.put("mercRefundNo", item.getMercRefundNo());
jsonItem.put("refundTime", DateUtil.format(item.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
jsonItem.put("status", item.getStatus());
jsonItem.put("oPayAmt", item.getPayAmt());
jsonItem.put("refundAmt", item.getRefundAmt());
jsonItem.put("payType", item.getPayTypeCode());
result.add(jsonItem);
}
return result;
}
@Override
public Page<Object> orderList(JSONObject param) {
String deviceNo = param.getString("deviceNo");
Integer page = param.getInteger("page");
Integer size = param.getInteger("size");
String date = param.getString("date");
// 1: ; 2:
String type = param.getString("type");
Map<String, Object> condition = new HashMap<>();
condition.put("createDate", date);
condition.put("snNo", deviceNo);
List<String> statusList = CollectionUtil.list(false, "1", "2", "6");
IPage<MerchantOrder> pageInfo = new Page<>(page, size);
if (ObjectUtils.isEmpty(type)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "类型不能为空");
}
if (!ArrayUtil.contains(new String[]{"1", "2"}, type)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "类型只能为1(日)或者2(月)");
}
if (ObjectUtils.isEmpty(date)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "日期不能为空");
}
if (ObjectUtils.isEmpty(page)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "页码不能为空");
}
if (ObjectUtils.isEmpty(size)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "页长不能为空");
}
if (size > 1000) {
throw new AccessException(CodeEnum.PARAM_ERROR, "查询单次不能超过1000条");
}
MerchantBaseInfo mbi = getByDeviceNo(deviceNo);
condition.put("merchantCode", mbi.getMerchantCode());
orderService.pageData(pageInfo, condition, statusList);
Page<Object> resultPage = new Page<>(page, size);
resultPage.setTotal(pageInfo.getTotal());
List<Object> result = new ArrayList<>();
for (MerchantOrder item : pageInfo.getRecords()) {
JSONObject orderItem = new JSONObject();
orderItem.put("orderNumber", item.getOrderNumber());
orderItem.put("consumeFee", item.getConsumeFee());
orderItem.put("status", item.getStatus());
orderItem.put("alias", item.getMerchantName());
orderItem.put("channelTransNo", item.getThirdSendNo());
orderItem.put("thirdTransNo", item.getThirdTransNo());
orderItem.put("transTime", DateUtil.format(item.getTransDt(), DatePattern.NORM_DATETIME_FORMAT));
if (item.getStatus().equals("2")) {
orderItem.put("refundAmt", item.getRefundAmt());
orderItem.put("refundTime", DateUtil.format(item.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT));
}
orderItem.put("payType", item.getPayTypeCode());
result.add(orderItem);
}
resultPage.setPages(pageInfo.getPages());
resultPage.setRecords(result);
return resultPage;
}
@Override
public Object dataAnalysis(JSONObject param) {
String deviceNo = param.getString("deviceNo");
MerchantBaseInfo mbi = getByDeviceNo(deviceNo);
String type = param.getString("type");
String date = param.getString("date");
JSONObject result = new JSONObject();
if (ObjectUtils.isEmpty(type)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "类型不能为空");
}
if (!ArrayUtil.contains(new String[]{"1", "2"}, type)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "类型只能为1(日)或者2(月)");
}
if (ObjectUtils.isEmpty(date)) {
throw new AccessException(CodeEnum.PARAM_ERROR, "日期不能为空");
}
LambdaQueryWrapper<MerchantOrder> qWrapper = Wrappers.lambdaQuery();
qWrapper.likeRight(MerchantOrder::getCreateDate, date)
.eq(MerchantOrder::getMerchantCode, mbi.getMerchantCode())
.eq(MerchantOrder::getSnNo, deviceNo)
.eq(MerchantOrder::getStatus, "1");
int transCount = orderService.count(qWrapper);
result.put("transCount", transCount);
qWrapper.clear();
qWrapper.likeRight(MerchantOrder::getCreateDate, date)
.eq(MerchantOrder::getMerchantCode, mbi.getMerchantCode())
.eq(MerchantOrder::getSnNo, deviceNo)
.eq(MerchantOrder::getStatus, "2");
int refundCount = orderService.count(qWrapper);
result.put("refundCount", refundCount);
QueryWrapper<MerchantOrder> qWrapper2 = Wrappers.query();
qWrapper2.likeRight("createDate", date)
.eq("merchantCode", mbi.getMerchantCode())
.eq("snNo", deviceNo)
.eq("status", "1")
.select("SUM(consumeFee) transFee");
BigDecimal transFee = orderService.getObj(qWrapper2, (SFunction<Object, BigDecimal>) o -> {
if (o == null) {
return BigDecimal.ZERO;
}
if (o instanceof BigDecimal) {
return (BigDecimal) o;
}
return new BigDecimal(o.toString());
});
if (transFee == null) {
transFee = BigDecimal.ZERO;
}
result.put("transFee", transFee);
BigDecimal refundFee = orderService.getRefundAmt(mbi.getMerchantCode(), deviceNo, date);
if (refundFee == null) {
refundFee = BigDecimal.ZERO;
}
result.put("refundFee", refundFee);
return result;
}
}

View File

@ -0,0 +1,43 @@
package cn.pluss.platform.access.service.impl;
import cn.hutool.core.codec.Base64;
import cn.hutool.crypto.SignUtil;
import cn.hutool.crypto.asymmetric.Sign;
import cn.hutool.crypto.asymmetric.SignAlgorithm;
import cn.pluss.platform.access.AccessService;
import cn.pluss.platform.access.domain.ReqEntity;
import cn.pluss.platform.access.domain.RespEntity;
import cn.pluss.platform.entity.AccessChannelCipherCode;
import cn.pluss.platform.mapper.AccessChannelCipherCodeMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
@Service
public class AccessServiceImpl implements AccessService {
@Resource
private AccessChannelCipherCodeMapper acccMapper;
@Override
public boolean checkSign(ReqEntity reqEntity) {
AccessChannelCipherCode accc = acccMapper.selectAllByOrgId(reqEntity.getOrgId());
String orgPubKey = accc.getOrgPubKey();
Sign sign = SignUtil.sign(SignAlgorithm.SHA256withRSA, null, orgPubKey);
String signContent = ReqEntity.getSignContent(reqEntity);
return sign.verify(signContent.getBytes(StandardCharsets.UTF_8), Base64.decode(reqEntity.getSign()));
}
@Override
public void addSign(RespEntity respEntity) {
String signContent = RespEntity.getSignContent(respEntity);
AccessChannelCipherCode accc = acccMapper.selectAllByOrgId(respEntity.getOrgId());
Sign sign = SignUtil.sign(SignAlgorithm.SHA256withRSA, accc.getPriKey(), null);
byte[] signBytes = sign.sign(signContent);
respEntity.setSign(Base64.encode(signBytes));
}
}

View File

@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@ -65,6 +66,9 @@ public class AliScanCodeDeviceServiceImpl implements AliDeviceService {
@Resource
private MerchantChannelStatusService channelService;
@Resource
private HttpServletRequest request;
@Override
public RespDeviceEntity getDeviceStatusV1(String deviceNo) {
if(StringUtil.isEmpty(deviceNo)){
@ -139,7 +143,7 @@ public class AliScanCodeDeviceServiceImpl implements AliDeviceService {
dto.setDeviceNo(entity.getCode());
dto.setRemark(entity.getRemark());
try {
Result<Object> mapResult = merchantOrderService.toActivePay(dto);
Result<Object> mapResult = merchantOrderService.toActivePay(dto, request);
Object data = mapResult.getData();
if (ResultCode.TRANSUNKNOW.code() == mapResult.getCode()) {
return RespDeviceEntity.await(mapResult.getMessage(),((Map)data).get("orderNumber"));

View File

@ -11,6 +11,7 @@ import cn.pluss.platform.dto.AccountDTO;
import cn.pluss.platform.dto.BankCardDTO;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.klk.vo.CallBackVo;
import cn.pluss.platform.mapper.AccountMapper;
import cn.pluss.platform.mapper.UserAppMapper;
import cn.pluss.platform.mcc.MccReflectService;
@ -549,6 +550,59 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
}
}
/**
* 入网申请流水 lkl
* 备注 note
* 客户号id custId
* 入网状态 status
*/
public void lklResultHandle(CallBackVo cust) {
String status = cust.getStatus();
String sysFlowId = cust.getSysFlowId();
MerchantChannelStatus mcs = new MerchantChannelStatus();
mcs.setApplicationId(sysFlowId);
mcs.setChannel(5);
mcs = mcsService.getOne(new QueryWrapper<>(mcs));
mcs.setThirdStatus(status);
mcs.getExtra().putAll((JSONObject) JSON.toJSON(cust));
switch (status) {
case YsConfigV3.STATUS_SUCCESS:
mcs.setAuditSuccessTime(new Date());
mcsService.updateById(mcs);
sign(mcs);
break;
case YsConfigV3.STATUS_REFUSE:
List<String> excludeStatus = Arrays.asList(MerchantChannelStatus.AUDIT_STATUS_REJECT, MerchantChannelStatus.AUDIT_STATUS_SUCCESS);
MerchantChannelStatus finalMcs = mcs;
boolean returnFlag = excludeStatus.stream().anyMatch(s -> s.equals(finalMcs.getStatus()));
if (returnFlag) {
return;
}
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode());
String note = cust.getNote();
mcs.setRemark(note);
mcs.setStatus(MerchantChannelStatus.AUDIT_STATUS_REJECT);
mcsService.updateById(mcs);
mercAuditListener.onFail(mbi.getUserId(), mcs, note);
break;
// case YsConfigV3.STATUS_TO_MANUAL:
// List<String> excludeStatus2 = Arrays.asList(MerchantChannelStatus.AUDIT_STATUS_SUCCESS, MerchantChannelStatus.AUDIT_STATUS_ARTIFICIAL_EXAMINING);
// MerchantChannelStatus finalMcs2 = mcs;
// boolean returnFlag2 = excludeStatus2.stream().anyMatch(s -> s.equals(finalMcs2.getStatus()));
// if (returnFlag2) {
// return;
// }
// mcs.setStatus(MerchantChannelStatus.AUDIT_STATUS_ARTIFICIAL_EXAMINING);
// mcsService.updateById(mcs);
// break;
}
}
public void step2(String userId) {
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId);
List<MerchantImage> miList = miService.getListOfMerch(userId, Account.CHANNEL_TYPE_D0);

View File

@ -0,0 +1,56 @@
package cn.pluss.platform.klk;
import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;
import java.security.KeyFactory;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
public class LaKaLaUtility {
// static String pubKey ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCp5aV3ZiXG2R8Yd8Nxocv+cF7VAUHBc0TF4MNne7mI8wM2yEP2QgI+rK1qDf6G7\n" +
// "ZFPhutpIHKQchpolbSuC0vgaHpSjO9OUs1fpnK/JjZq9o8DatUsA0n4Fccec9NBbV5dy5yrwro7xmDpsevp1\n" +
// "/IeiIssi1+iD+nBWqqVFx7GVQIDAQAB";
//测试公钥
private static String pubKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvO9EN9W6OG7y72VUWZili4m8DlD+TMofgIl96OPX9fRBS7Icg3oIqxmU20xFbiswJ2cCU6I1gbE7GDM14CihLQd26xW5T/8TmHCaVFFy1b9AWHNK7sW3aNd2KK1PI3h4gS38ND8jqvdr/8YZSCNF2KOoOe3F17FqVecBdq+1VZQIDAQAB";
public static void main(String[] args) throws Exception {
String data="TOykml1JtGtrNL8rS+Aj/FOaq87eERTCUt9uZJk/ObFvuX5TRstQSl9fP3J2UTjSPO0b/p3Sh8Sxi1w9a6YuDQL9rrZ9orpWpEU+vg8H99fVZnvFjozB4HJf7NE5S9z7Mah93zW7TY1TFS55pIDv4go/fOtGTUcReUY0uFpZQote41m9KHvcjv5HiyCKaT/4cOoSMzHrsRiThwsU+rCDTzI4C32obwrXDOiaMd45wU4GL9/YMfHSpPOqgcsRZIWSBi2Pgt4nJX/s4uxVLzzKG00A8Jxa+yo0JZEgWRuHkOgcrV2Mxg8WmnXug8KeZBSeqYyvPXG9hy32q2phEwd1c6AYEOAKRu3QVhXEyDWjXkn86nvPimn8aohxYaAjky4E66LTnNIPNKOkwC5KVG27H9Fv27ZgqpDzRpYvaRExBT3RjJxXssLBRQ/eejOf7uuq0RgDUqFfwqOICqIUb8qbos6qu+QIsY2tvkbsMB1ZmD3s1SviHmvxWisD0VE/ZTDVQwDLUiORTwaMExirkc0s5bcB51FHHs2TFDa1raa/kSQwL/ADS0yAWNctiQGQtymErEmiD9iFdGXMvgjbqJ7KsDTAotKuYh9VzIA/RuAy+lpajvCIG6NOy428VHHin+RcXe/Ztx1UUHVk3xrHWNYG2aI4yyTLcz0EbG7rcOgWFwI=";
// String data ="hplFXwPU1gbHYwraQM/fKEcoIkBfHD07VSH99OnKTZk9HJRFAvZyOm9nsdeSi8t/UdGPn+LXldrjZ7wiY+F5MzGlIdEma7agKZyHJ+UO6CrDJfYFMwlPUOgO+Pq5ljg6QOdZBxBLEHkRMkQnC/CTv9vQnPDqeCv4MvAbHJspADGRRPvmjxtzf0J4OQgP3hj9+ZqH+btsuX+W+YZRXRMYL+uOQkSJhMUv31hc9MAC/1Sp0C9cBcHKxr+idS+0CCjvD8WzLbXv2QuOSQccIKQw+Je8RMeuKs8f64MibCkf+RkilTCVCEd5apL1MkhYJZoUVzqPXmDBLjaJgr987X1wBAzQMS8+F34Vl/BonKPuJ4RRwdE/M3WJ+ZfM2WiLawpU7ZqUQdVY2bwJO801TcmFCswLoz2qxHHsBsjXtQPqMOj3pw3Kvz3WH3oWmcFRZjHKIbDSy9Jh2STEFRbvVWarjksBVjXkcbletDtOtY0T8XCdiiNoQNlVNj5kH5QkAWmt";
String decrypt = LaKaLaUtility.decrypt(data);
System.out.println("解密结果:" + decrypt);
}
/**
* 公钥解密
* @param
* @param data Base64 数据
* @return 解密字符串
* @throws Exception 解密异常
*/
public static String decrypt(String data){
try {
Base64.Decoder decoder = Base64.getDecoder();
byte[] keyBytes = decoder.decode(pubKey.getBytes());
byte[] dataBytes = decoder.decode(data.getBytes());
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE,
KeyFactory.getInstance("RSA").generatePublic(new
X509EncodedKeySpec(keyBytes)));
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] cache;
for (int i = 0, offset = 0, length = dataBytes.length; length -
offset > 0; i++, offset = i * 128) {
if (length - offset > 128) {
cache = cipher.doFinal(dataBytes, offset, 128);
} else {
cache = cipher.doFinal(dataBytes, offset, length - offset);
}
out.write(cache, 0, cache.length);
}
return out.toString();
}catch (Exception e){
e.printStackTrace();
}
return null;
}
}

View File

@ -1,14 +0,0 @@
package cn.pluss.platform.klk;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "lkl")
public class LklConfig {
@Value("private_key")
private String privateKey;
}

View File

@ -0,0 +1,196 @@
package cn.pluss.platform.klk.cache;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.*;
/**
* 暂时用jdk的缓存
* */
public class MemoryCache {
//键值对集合
private final static Map<String, Entity> map = new HashMap<>();
//定时器线程池用于清除过期缓存
private final static ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
/**
* 添加缓存
* 可用 synchronized 加锁
* @param key
* @param data
*/
public static void put(String key, Object data) {
MemoryCache.put(key, data, 0);
}
/**
* 添加缓存
* 可用 synchronized 加锁
* @param key
* @param data
* @param expire 过期时间单位毫秒 0表示无限长
*/
public static void put(String key, Object data, long expire) {
//清除原键值对
MemoryCache.remove(key);
//设置过期时间
if (expire > 0) {
Future future = executor.schedule(new Runnable() {
@Override
public void run() {
//过期后清除该键值对
synchronized (MemoryCache.class) {
map.remove(key);
}
}
}, expire, TimeUnit.MILLISECONDS);
map.put(key, new Entity(data, future));
} else {
//不设置过期时间
map.put(key, new Entity(data, null));
}
}
/**
* 读取缓存
* 可用 synchronized 加锁
* @param key
* @return
*/
public static Object get(String key) {
Entity entity = map.get(key);
return entity == null ? null : entity.getValue();
}
/**
* 读取缓存
* 可用 synchronized 加锁
* @param key
* @param clazz 值类型
* @return
*/
public static <T> T get(String key, Class<T> clazz) {
return clazz.cast(MemoryCache.get(key));
}
/**
* 清除缓存
* 可用 synchronized 加锁
* @param key
* @return
*/
public static Object remove(String key) {
//清除原缓存数据
Entity entity = map.remove(key);
if (entity == null) {
return null;
}
//清除原键值对定时器
Future future = entity.getFuture();
if (future != null) {
future.cancel(true);
}
return entity.getValue();
}
/**
* 查询当前缓存的键值对数量
* 可用 synchronized 加锁
* @return
*/
public static int size() {
return map.size();
}
/**
* 缓存实体类
*/
private static class Entity {
//键值对的value
private Object value;
//定时器Future
private Future future;
public Entity(Object value, Future future) {
this.value = value;
this.future = future;
}
/**
* 获取值
*
* @return
*/
public Object getValue() {
return value;
}
/**
* 获取Future对象
*
* @return
*/
public Future getFuture() {
return future;
}
}
public static void main(String[] args) throws ExecutionException, InterruptedException {
String key = "id";
//不设置过期时间
System.out.println("***********不设置过期时间**********");
MemoryCache.put(key, 123);
System.out.println("key:" + key + ", value:" + MemoryCache.get(key));
System.out.println("key:" + key + ", value:" + MemoryCache.remove(key));
System.out.println("key:" + key + ", value:" + MemoryCache.get(key));
//设置过期时间
System.out.println("\n***********设置过期时间**********");
MemoryCache.put(key, "123456", 1000);
System.out.println("key:" + key + ", value:" + MemoryCache.get(key));
TimeUnit.MILLISECONDS.sleep(1500);
System.out.println("key:" + key + ", value:" + MemoryCache.get(key));
/******************并发性能测试************/
System.out.println("\n***********并发性能测试************");
//创建有10个线程的线程池将1000000次操作分10次添加到线程池
ExecutorService executorService = Executors.newFixedThreadPool(10);
Future[] futures = new Future[10];
/********添加********/
{
long start = System.currentTimeMillis();
for (int j = 0; j < 10; j++) {
futures[j] = executorService.submit(() -> {
for (int i = 0; i < 100000; i++) {
MemoryCache.put(Thread.currentThread().getId() + key + i, i, 300000);
}
});
}
//等待全部线程执行完成打印执行时间
for (Future future : futures) {
future.get();
}
System.out.printf("添加耗时:%dms\n", System.currentTimeMillis() - start);
}
/********查询********/
{
long start = System.currentTimeMillis();
for (int j = 0; j < 10; j++) {
futures[j] = executorService.submit(() -> {
for (int i = 0; i < 100000; i++) {
Object obj = MemoryCache.get(Thread.currentThread().getId() + key + i);
System.out.println("cacheObj:" + obj);
}
});
}
//等待全部线程执行完成打印执行时间
for (Future future : futures) {
future.get();
}
System.out.printf("查询耗时:%dms\n", System.currentTimeMillis() - start);
}
System.out.println("当前缓存容量:" + MemoryCache.size());
}
}

View File

@ -0,0 +1,19 @@
package cn.pluss.platform.klk.controller;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.ResponseErrorHandler;
import java.io.IOException;
public class FacePlusThrowErrorHandler implements ResponseErrorHandler {
@Override
public boolean hasError(ClientHttpResponse response) throws IOException {
return false;
}
@Override
public void handleError(ClientHttpResponse response) throws IOException {
}
}

View File

@ -0,0 +1,49 @@
package cn.pluss.platform.klk.controller;
import cn.pluss.platform.klk.service.impl.LaKalaInterfaceImpl;
import cn.pluss.platform.klk.vo.TuoKeVo;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.util.Map;
@RestController
@RequestMapping("/lkl")
public class LaKaLaController {
@Resource
LaKalaInterfaceImpl laKalaInterface;
@PostMapping("/lkl")
public void aa(@RequestBody TuoKeVo tuoKeVo){
laKalaInterface.tuoKeAddMer(tuoKeVo);
}
@PostMapping("/jjkl")
public void jjkl(MultipartFile file){
// try {
// laKalaInterface.laKaLaFileUpload();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
}
@PostMapping("/jjkls")
public void jjkls(){
laKalaInterface.ff();
}
@PostMapping("/tuoke")
public void jjklss(){
laKalaInterface.createTuoKeInfo("244");
}
@PostMapping("/callBackToke")
public void callBackToke(@RequestBody Map<String,Object> map){
laKalaInterface.tuoKeCallBack(map);
}
}

View File

@ -1,51 +0,0 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.klk.LklConfig;
import cn.pluss.platform.klk.entity.ReqKlkEntity;
import cn.pluss.platform.klk.entity.RespKlkEntity;
import cn.pluss.platform.util.RSAUtils;
import cn.pluss.platform.util.SM4Util;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
/**
* @author lyf
*/
@Slf4j
@Service("KlkService")
public class KlkService {
@Autowired
private LklConfig lklConfig;
public void reqKlk()throws Exception{
String data = "req_data\": {\n" +
" \"member_id\": \"AAA200154561278\",\n" +
" \"mer_order_id\": \"202112030923011\"\n" +
" }\n";
String key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDvDBZyHUDndAGxrIcsCV2njhNO3vCEZotTaWYSYwtDvkcAb1EjsBFabXZaKigpqFXk5XXNI3NIHP9M8XKzIgGvc65NpLAfRjVql8JiTvLyYd1gIUcOXMInabu+oX7dQSI1mS8XzqaoVRhDZQWhXcJW9bxMulgnzvk0Ggw07AjGF7si+hP/Va8SJmN7EJwfQq6TpSxR+WdIHpbWdhZ+NHwitnQwAJTLBFvfk28INM39G7XOsXdVLfsooFdglVTOHpNuRiQAj9gShCCNrpGsNQxDiJIxE43qRsNsRwigyo6DPJk/klgDJa417E2wgP8VrwiXparO4FMzOGK15quuoD7DAgMBAAECggEBANhmWOt1EAx3OBFf3f4/fEjylQgRSiqRqg8Ymw6KGuh4mE4Md6eW/B6geUOmZjVP7nIIR1wte28M0REWgn8nid8LGf+v1sB5DmIwgAf+8G/7qCwd8/VMg3aqgQtRp0ckb5OV2Mv0h2pbnltkWHR8LDIMwymyh5uCApbn/aTrCAZKNXcPOyAn9tM8Bu3FHk3Pf24Er3SN+bnGxgpzDrFjsDSHjDFT9UMIc2WdA3tuMv9X3DDn0bRCsHnsIw3WrwY6HQ8mumdbURk+2Ey3eRFfMYxyS96kOgBC2hqZOlDwVPAKTPtS4hoq+cQ0sRaJQ4T0UALJrBVHa+EESgRaTvrXqAECgYEA+WKmy9hcvp6IWZlk9Q1JZ+dgIVxrO65zylK2FnD1/vcTx2JMn73WKtQb6vdvTuk+Ruv9hY9PEsf7S8gHSTTmzHOUgo5x0F8yCxXFnfji2juoUnDdpkjtQK5KySDcpQb5kcCJWEVi9v+zObM0Zr1Nu5/NreE8EqUl3+7MtHOu1TMCgYEA9WM9P6m4frHPW7h4gs/GISA9LuOdtjLvAtgCK4cW2mhtGNAMttD8zOBQrRuafcbFAyU9de6nhGwetOhkW9YSV+xRNa7HWTeIRgXJuJBrluq5e1QGTIwZU/GujpNaR4Qiu0B8TodM/FME7htsyxjmCwEfT6SDYlkeMzTbMa9Q0DECgYBqsR/2+dvD2YMwAgZFKKgNAdoIq8dcwyfamUQ5mZ5EtGQL2yw48zibHh/LiIxgUD1Kjk/qQgNsX45NP4iOc0mCkrgomtRqdy+rumbPTNmQ0BEVJCBPscd+8pIgNiTvnWpMRvj7gMP0NDTzLI3wnnCRIq8WAtR2jZ0Ejt+ZHBziLQKBgQDibEe/zqNmhDuJrpXEXmO7fTv3YB/OVwEj5p1Z/LSho2nHU3Hn3r7lbLYEhUvwctCnLl2fzC7Wic1rsGOqOcWDS5NDrZpUQGGF+yE/JEOiZcPwgH+vcjaMtp0TAfRzuQEzNzV8YGwxB4mtC7E/ViIuVULHAk4ZGZI8PbFkDxjKgQKBgG8jEuLTI1tsP3kyaF3jAylnw7SkBc4gfe9knsYlw44YlrDSKr8AOp/zSgwvMYvqT+fygaJ3yf9uIBdrIilqCHKXccZ9uA/bT5JfIi6jbg3EoE9YhB0+1aGAS1O2dBvUiD8tJ+BjAT4OB0UDpmM6QsFLQgFyXgvDnzr/o+hQJelW";
ReqKlkEntity reqKlkEntity = ReqKlkEntity.get(data);
System.out.println("signFormat++++++++++++++"+reqKlkEntity.getSign());
String sign = RSAUtils.signSHA256(key, reqKlkEntity.getSign());
System.out.println("sign++++++++++++++++++"+sign);
//设置Authorization
HttpHeaders headers = new HttpHeaders();
headers.setContentType(APPLICATION_JSON);
headers.set("Authorization", "LKLAPI-SHA256withRSA");
String finalSign = "Content-Type: application/json"+"\n"+"Authorization:LKLAPI-SHA256withRSA"+" "+"appid="+reqKlkEntity.getAppid()+","+"serial_no="+reqKlkEntity.getSerialNo()+","+
reqKlkEntity.getTimestamp()+","+"nonce_str="+reqKlkEntity.getNonceStr()+","+
"signature="+sign;
System.out.println(finalSign);
}
// public String signEncrypt(String sign){
// SM4Util
// }
}

View File

@ -0,0 +1,67 @@
package cn.pluss.platform.klk.service;
import lombok.Data;
import java.util.Set;
@Data
public class LaKaLaVO {
private String version;
private String orderNo;
private String posType;
private String orgCode;
private String merRegName;
private String merBizName;
private String merRegDistCode;
private String merRegAddr;
private String mccCode;
private String merBlisName;
private String merBlis;
private String merBlisStDt;
private String merBlisExpDt;
private String merBusiContent;
private String larName;
private String larIdType;
private String larIdcard;
private String larIdcardStDt;
private String larIdcardExpDt;
private String merContactMobile;
private String merContactName;
private String shopName;
private String shopDistCode;
private String shopAddr;
private String shopContactName;
private String shopContactMobile;
private String openningBankCode;
private String openningBankName;
private String clearingBankCode;
private String acctNo;
private String acctName;
private String acctTypeCode;
private String settlePeriod;
private String clearDt;
private String acctIdType;
private String acctIdcard;
private String acctIdDt;
private String devSerialNo;
private String devTypeName;
private String termVer;
private String salesStaff;
private String termNum;
private String retUrl;
private Set feeData;
private String fileData;
private String contractNo;
private String feeAssumeType;
private String amountOfMonth;
private String serviceFee;
}
@Data
class FeeData{
private String feeRateTypeCode;
private String feeRatePct;
private String feeRateTypeName;
}

View File

@ -0,0 +1,23 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.klk.vo.OrganVo;
import cn.pluss.platform.klk.vo.TuoKeVo;
import java.util.List;
public interface LaKalaInterface {
/**
* 拉卡拉进件
* */
void laKaLaAddMer(LaKaLaVO laVO,String ip);
/**
* 拓客进件
* */
void tuoKeAddMer(TuoKeVo tuoKeVo);
/**
* 获取省市区县
* */
List<OrganVo> getOrganCode(String code);
}

View File

@ -0,0 +1,87 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.dto.MemberScanPayDTO;
import cn.pluss.platform.dto.MerChantOrderDTO;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.pay.PayService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Service("lkLPayService")
@Slf4j
public class LkLPayServiceImpl implements PayService {
@Resource
LklPayService lklPayService;
@Override
public JSONObject tradePay(MerchantOrder order, MerchantChannelStatus channel, MerchantBaseInfo merchant) {
return null;
}
@Override
public JSONObject tradePay(MerChantOrderDTO merchantOrderDTO, MerchantOrder order) {
return null;
}
@Override
public Map<String, Object> refundPay(MerchantOrder order, String mchNo) {
return null;
}
@Override
public JSONObject tradeQuery(MerchantOrder order, String mchId) {
return null;
}
@Override
public JSONObject refundQuery(MerchantRefundOrder refundOrder) {
return null;
}
@Override
public Map<String, Object> closeOrder(String orderNumber, String channelNo) {
return null;
}
@Override
public Map<String, Object> getWxOpenId(MemberScanPayDTO memberScanPayDTO, MerchantChannelStatus channel) throws Exception {
return null;
}
@Override
public Map<String, Object> getUnionInfo(String userAuthCode, String paymentApp, String merchantId) throws Exception {
Map<String, Object> result = new HashMap<>();
JSONObject reqData = new JSONObject(2);
Map<String, Object> stringObjectMap=lklPayService.authUserId(userAuthCode, paymentApp);
reqData.put("data",stringObjectMap.get("userId"));
reqData.put("userAuthCode",userAuthCode);
reqData.put("appUpIdentifier",paymentApp);
result.put("data",reqData);
result.put("code","1");
result.put("msg","获取成功");
return result;
}
@Override
public Object payNotifyCallBack(Map<String, String> params) {
return null;
}
@Override
public String tradePayWap(MerchantOrder order, MerchantChannelStatus channel) {
return null;
}
@Override
public JSONObject getUnionAccountUrl(JSONObject reqData) {
return null;
}
@Override
public JSONObject jftPay(JftReceiptOrder order, JftMercBaseInfo jftMerc, JftMercPaymentChannel jftChannel) {
return null;
}
}

View File

@ -0,0 +1,483 @@
package cn.pluss.platform.klk.service;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.io.IOUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.junit.Test;
import org.springframework.stereotype.Service;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.cert.*;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@Service
@Slf4j
public class LklPayService {
private static Integer index = 0;
/**
* 字符集固定 utf-8
*/
/**
* API schema ,固定 LKLAPI-SHA256withRSA
*/
public final static String SCHEMA = "LKLAPI-SHA256withRSA";
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static final SecureRandom RANDOM = new SecureRandom();
private String appId = "OP00000354";
// private String appId="OP00000657";
private String mchSerialNo = "00dfba8194c41b84cf";
private String merchantNo = "8221210594300JY";
private String termNo = "A0073841";
// private String privateKeyPath="classpath:lakalaConf/OP00000003_private_key.pem";
private String privateKeyPath = "C:\\Users\\Administrator\\Desktop\\dr\\OP00000003_private_key.pem";
// private String cerPath="C:\\Users\\Administrator\\Desktop\\dr\\lkl-apigw-v1.cer";
private String cerPath = "C:\\Users\\Administrator\\Desktop\\dr\\OP00000003_cert.cer";
private String apiUrl = "https://test.wsmsd.cn/sit";
String apiPath = "/api/v2/saas/query/wx_openid_query";
// private String apiUrl="https://s2.lakala.com";
@Test
public void test1() {
LaKaLaVO laVO = new LaKaLaVO();
createOrder(laVO, "127.0.0.1");
}
public String createOrder(LaKaLaVO laVO, String ip) {
//public String createOrder(String body,String apiPath,String ip) {
// String apiPath = "/api/v2/mms/openApi/addMer";
// String apiPath = "/api/v3/labs/trans/preorder";
// String apiPath = "/api/v3/labs/relation/revoked";
// String apiPath = "/api/v2/mms/openApi/addMer";
//ordCode存在异议
// String body ="{ \n" +
// " \"reqData\":{ \n" +
// " \"version\":\"1.0\", \n" +
// " \"orderNo\":\"2021031215011012345678\", \n" +
// " \"posType\":\"SUPER_POS\", \n" +
// " \"orgCode\":\"1\", \n" +
// " \"merRegName\":\"开放平台商户进件注册名称\", \n" +
// " \"merBizName\":\"开放平台商户进件经营名称\", \n" +
// " \"merRegDistCode\":\"290012\", \n" +
// " \"merRegAddr\":\"五星路102号\", \n" +
// " \"mccCode\":\"7011\", \n" +
// " \"merBusiContent\":\"640\", \n" +
// " \"larName\":\"张三丰\", \n" +
// " \"larIdType\":\"01\", \n" +
// " \"larIdcard\":\"33088119690117459X\", \n" +
// " \"larIdcardExpDt\":\"2051-01-10\", \n" +
// " \"merContactMobile\":\"15878559969\", \n" +
// " \"merContactName\":\"张三丰\", \n" +
// " \"settlePeriod\":\"T+1\", \n" +
// " \"openningBankCode\":\"102100000030\", \n" +
// " \"openningBankName\":\"中国工商银行股份有限公司北京市分行营业部\", \n" +
// " \"clearingBankCode\":\"102100099996\", \n" +
// " \"acctNo\":\"6212260200102400000\", \n" +
// " \"acctName\":\"仲涛飘\", \n" +
// " \"acctTypeCode\":\"58\", \n" +
// " \"acctIdcard\":\"33088119690117459X\", \n" +
// " \"devSerialNo\":\"yp13293921932131\", \n" +
// " \"devTypeName\":\"V8\", \n" +
// " \"termVer\":\"1.0\", \n" +
// " \"salesStaff\":\"销售3356\", \n" +
// " \"retUrl\":\"http://10.177.93.135:8082/notify\", \n" +
// " \"feeData\":[\n" +
// " { \n" +
// " \"feeRateTypeCode\":\"300\", \n" +
// " \"feeRatePct\":\"0.38\", \n" +
// " \"feeUpperAmtPcnt\":\"20\", \n" +
// " \"feeLowerAmtPcnt\":\"10\"\n" +
// " },\n" +
// " { \n" +
// " \"feeRateTypeCode\":\"301\", \n" +
// " \"feeRatePct\":\"0.58\"\n" +
// " },\n" +
// " { \n" +
// " \"feeRateTypeCode\":\"302\", \n" +
// " \"feeRatePct\":\"0.48\"\n" +
// " },\n" +
// " { \n" +
// " \"feeRateTypeCode\":\"303\", \n" +
// " \"feeRatePct\":\"0.48\"\n" +
// " }\n" +
// " ], \n" +
// " \"fileData\":[\n" +
// " { \n" +
// " \"attType\":\"ID_CARD_FRONT\", \n" +
// " \"attFileId\":\"G1/M00/00/61/CrFdEl3IyceAVVd8AAA0ADuZsA0911.jpg\"\n" +
// " }\n" +
// " ]\n" +
// " }, \n" +
// " \"ver\":\"1.0.0\", \n" +
// " \"timestamp\":\"1541589957000\", \n" +
// " \"reqId\":\"baff59de4694438ca9089862253517a5\"\n" +
// "}";
Integer type = null;
String subAppid = "";
String subOpenid = "";
String body = "";
String orderNumber = "";
String consumeFee = "";
HttpServletRequest request = null;
body = "{ \n" +
" \"ver\": \"1.0.0\",\n" +
" \"timestamp\": \"1541589957000\",\n" +
" \"reqId\": \"ca9089862253517a5\",\n" +
" \"reqData\": {\n" +
" \"mercId\": \"" + merchantNo + "\",\n" +
" \"termNo\": \"" + termNo + "\",\n" +
" \"authCode\": \"136519690623734145\",\n" +
" \"tradeCode\":\"030304\"\n" +
" }\n" +
"}";
// if (type==51||type==71){
//
// body="{\n" +
// " \"out_org_code\":\""+appId+"\",\n" +
// " \"req_data\":{\n" +
// " \"acc_busi_fields\":{\n" +
// " \"detail\":\"{\\\"goods_detail\\\":[{\\\\\\\"goods_id\\\\\\\":\\\\\\\"100734033\\\\\\\",\\\\\\\"price\\\\\\\":\\\\\\\"50\\\\\\\",\\\\\\\"quantity\\\\\\\":\\\\\\\"1\\\\\\\"}]}\",\n" +
// " \"goods_tag\":\"ceshi\",\n" +
// " \"sub_appid\":\""+subAppid+"\",\n" +
// " \"user_id\":\""+subOpenid+"\"\n" +
// " },\n" +
// " \"account_type\":\"WECHAT\",\n" +
// " \"location_info\":{\n" +
// " \"request_ip\":\""+IpUtils.getIpAddr(request)+"\"\n" +
// " },\n" +
// " \"merchant_no\":\""+merchantNo+"\",\n" +
// " \"notify_url\":\"https://testca/notify\",\n" +
// " \"out_trade_no\":\""+orderNumber+"\",\n" +
// " \"term_no\":\""+ laVO.getTermNum()+"\",\n" +
// " \"total_amount\":\""+consumeFee+"\",\n" +
// " \"trans_type\":\""+type+"\"\n" +
// " },\n" +
// " \"req_time\":\""+getNowDate()+"\",\n" +
// " \"version\":\"3.0\"\n" +
// "}";
// }else if (type==41){
// body="{\n" +
// " \"out_org_code\":\""+appId+"\",\n" +
// " \"req_data\":{\n" +
// " \"acc_busi_fields\":{\n" +
// " \"detail\":\"{\\\"goods_detail\\\":[{\\\\\\\"goods_id\\\\\\\":\\\\\\\"100734033\\\\\\\",\\\\\\\"price\\\\\\\":\\\\\\\"50\\\\\\\",\\\\\\\"quantity\\\\\\\":\\\\\\\"1\\\\\\\"}]}\",\n" +
// " \"goods_tag\":\"ceshi\",\n" +
// " \"sub_appid\":\""+subAppid+"\",\n" +
// " \"user_id\":\""+subOpenid+"\"\n" +
// " },\n" +
// " \"account_type\":\"WECHAT\",\n" +
// " \"location_info\":{\n" +
// " \"request_ip\":\""+IpUtils.getIpAddr(request)+"\"\n" +
// " },\n" +
// " \"merchant_no\":\""+merchantNo+"\",\n" +
// " \"notify_url\":\"https://testca/notify\",\n" +
// " \"out_trade_no\":\""+orderNumber+"\",\n" +
// " \"term_no\":\""+ laVO.getTermNum()+"\",\n" +
// " \"total_amount\":\""+consumeFee+"\",\n" +
// " \"trans_type\":\""+type+"\"\n" +
// " },\n" +
// " \"req_time\":\""+getNowDate()+"\",\n" +
// " \"version\":\"3.0\"\n" +
// "}";
// }
return "";
}
public Map<String, Object> authUserId(String authCode, String appUpIdentifier) {
String body = "{ \n" +
" \"ver\": \"1.0.0\",\n" +
" \"timestamp\": \"1541589957000\",\n" +
" \"reqId\": \"ca9089862253517a5\",\n" +
" \"reqData\": {\n" +
" \"mercId\": \"" + merchantNo + "\",\n" +
" \"termNo\": \"" + termNo + "\",\n" +
" \"authCode\": \"" + authCode + "\",\n" +
" \"tradeCode\":\"030304\",\n" +
" \"appUpIdentifier\":\"" + appUpIdentifier + "\"\n" +
" }\n" +
"}";
Map map = (Map) JSONArray.parse(req(body));
return (Map<String, Object>) JSONArray.parse(map.get("reqData").toString());
}
public String req(String body) {
String encode = encode("client_id:client_secret".getBytes());
System.out.println("base64:" + encode);
try {
String authorization = getAuthorization(body, appId, mchSerialNo, privateKeyPath);
HttpResponse lakalaResponse = post(apiUrl + apiPath, body, authorization, "utf-8");
if (lakalaResponse.getStatusLine().getStatusCode() != 200) {
log.error("请求失败,statusCode:{},message:{}", lakalaResponse.getStatusLine(), IOUtils.toString(lakalaResponse.getEntity().getContent(), "utf-8"));
}
String appid = getHeadValue(lakalaResponse, "Lklapi-Appid");
String lklapiSerial = getHeadValue(lakalaResponse, "Lklapi-Serial");
String timestamp = getHeadValue(lakalaResponse, "Lklapi-Timestamp");
String nonce = getHeadValue(lakalaResponse, "Lklapi-Nonce");
String signature = getHeadValue(lakalaResponse, "Lklapi-Signature");
String responseStr = IOUtils.toString(lakalaResponse.getEntity().getContent(), "utf-8");
log.info("返回的信息为 responseStr:{}", responseStr);
String source = appid + "\n" + lklapiSerial + "\n" + timestamp + "\n" + nonce + "\n" + responseStr + "\n";
log.info("请求的数据为:{}", source);
// X509Certificate lklCertificate = loadCertificate(new FileInputStream(new File(privateKeyPath)));
X509Certificate lklCertificate = loadCertificate(new FileInputStream(new File(cerPath)));
boolean verify = verify(lklCertificate, source.getBytes("utf-8"), signature);
if (verify) {
log.info("验签通过");
return responseStr;
} else {
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String encode(byte[] content) {
return new sun.misc.BASE64Encoder().encode(content);
}
public static boolean isNumeric(String str) {
//?:0或1个, *:0或多个, +:1或多个
Boolean strResult = str.matches("-?[0-9]+.?[0-9]*");
if (strResult == true) {
return true;
} else {
return false;
}
}
private boolean isNumber(String str) {
for (int i = str.length(); --i >= 0; ) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
public HttpResponse post(String url, String message, String authorization, String ENCODING) throws Exception {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] xcs, String str) {
}
@Override
public void checkServerTrusted(X509Certificate[] xcs, String str) {
}
};
HttpClient http = new DefaultHttpClient();
ClientConnectionManager ccm = http.getConnectionManager();
ctx.init(null, new TrustManager[]{tm}, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
SchemeRegistry registry = ccm.getSchemeRegistry();
registry.register(new Scheme("https", ssf, 443));
HttpPost post = new HttpPost(url);
StringEntity myEntity = new StringEntity(message, ENCODING);
post.setEntity(myEntity);
post.setHeader("Authorization", SCHEMA + " " + authorization);
post.setHeader("Accept", "application/json");
post.setHeader("Content-Type", "application/json");
return http.execute(post);
}
private String getNowDate() {
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
return simpleDateFormat.format(date);
}
private String getRandom() {
String rand = "";
for (int i = 0; i < 8; i++) {
rand = rand + (int) (Math.random() * 10);
}
return rand;
}
public String createOrderCode() {
String OrderCode = getNowDate() + getRandom();
return OrderCode;
}
protected long generateTimestamp() {
return System.currentTimeMillis() / 1000;
}
protected String generateNonceStr() {
char[] nonceChars = new char[32];
for (int index = 0; index < nonceChars.length; ++index) {
nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
}
return new String(nonceChars);
}
public final String getAuthorization(String body, String appid, String mchSerialNo, String merchantPrivateKeyPath) throws IOException {
String nonceStr = generateNonceStr();
long timestamp = generateTimestamp();
String message = appid + "\n" + mchSerialNo + "\n" + timestamp + "\n" + nonceStr + "\n" + body + "\n";
System.out.println("getToken message : " + message);
PrivateKey merchantPrivateKey = loadPrivateKey(new FileInputStream(new File(merchantPrivateKeyPath)));
String signature = this.sign(message.getBytes("utf-8"), merchantPrivateKey);
String authorization = "appid=\"" + appid + "\"," + "serial_no=\"" + mchSerialNo + "\"," + "timestamp=\""
+ timestamp + "\"," + "nonce_str=\"" + nonceStr + "\"," + "signature=\"" + signature + "\"";
System.out.println("authorization message :" + authorization);
return authorization;
}
public String sign(byte[] message, PrivateKey privateKey) {
try {
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initSign(privateKey);
sign.update(message);
return new String(Base64.encodeBase64(sign.sign()));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("当前Java环境不支持SHA256withRSA", e);
} catch (SignatureException e) {
throw new RuntimeException("签名计算失败", e);
} catch (InvalidKeyException e) {
throw new RuntimeException("无效的私钥", e);
}
}
private static String getHeadValue(HttpResponse response, String key) {
return (response.containsHeader(key)) ? response.getFirstHeader(key).getValue() : "";
}
private static boolean verify(X509Certificate certificate, byte[] message, String signature) {
try {
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initVerify(certificate);
sign.update(message);
byte[] signatureB = Base64.decodeBase64(signature);
return sign.verify(signatureB);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("当前Java环境不支持SHA256withRSA", e);
} catch (SignatureException e) {
throw new RuntimeException("签名验证过程发生了错误", e);
} catch (InvalidKeyException e) {
throw new RuntimeException("无效的证书", e);
}
}
public static PrivateKey loadPrivateKey(InputStream inputStream) {
try {
ByteArrayOutputStream array = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
array.write(buffer, 0, length);
}
String privateKey = array.toString("utf-8").replace("-----BEGIN PRIVATE KEY-----", "")
.replace("-----END PRIVATE KEY-----", "").replaceAll("\\s+", "");
KeyFactory kf = KeyFactory.getInstance("RSA");
return kf.generatePrivate(new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey)));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("当前Java环境不支持RSA", e);
} catch (InvalidKeySpecException e) {
throw new RuntimeException("无效的密钥格式");
} catch (IOException e) {
throw new RuntimeException("无效的密钥");
}
}
public static X509Certificate loadCertificate(InputStream inputStream) {
try {
CertificateFactory cf = CertificateFactory.getInstance("X509");
X509Certificate cert = (X509Certificate) cf.generateCertificate(inputStream);
cert.checkValidity();
return cert;
} catch (CertificateExpiredException e) {
throw new RuntimeException("证书已过期", e);
} catch (CertificateNotYetValidException e) {
throw new RuntimeException("证书尚未生效", e);
} catch (CertificateException e) {
throw new RuntimeException("无效的证书", e);
}
}
protected final String getBody(HttpServletRequest request) throws Exception {
InputStreamReader in = null;
try {
in = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuffer bf = new StringBuffer();
int len;
char[] chs = new char[1024];
while ((len = in.read(chs)) != -1) {
bf.append(new String(chs, 0, len));
}
return bf.toString();
} catch (Exception e) {
log.error("请求头部取数据异常:{}", e);
throw new RuntimeException("999999", e.getCause());
} finally {
if (null != in) {
try {
in.close();
} catch (Exception e) {
log.error("流关闭异常:{}", e);
}
}
}
}
}

View File

@ -0,0 +1,7 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.PlussMerchantLklEntity;
import com.baomidou.mybatisplus.extension.service.IService;
public interface PlussMerchantLklService extends IService<PlussMerchantLklEntity> {
}

View File

@ -0,0 +1,7 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.TbLklRegionBankInfoEntity;
import com.baomidou.mybatisplus.extension.service.IService;
public interface TbLklRegionBankInfoService extends IService<TbLklRegionBankInfoEntity> {
}

View File

@ -0,0 +1,7 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.TbPlussBankBranchLklEntity;
import com.baomidou.mybatisplus.extension.service.IService;
public interface TbPlussBankBranchLklService extends IService<TbPlussBankBranchLklEntity> {
}

View File

@ -0,0 +1,7 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.TbPlussBankRegionLklEntity;
import com.baomidou.mybatisplus.extension.service.IService;
public interface TbPlussBankRegionLklService extends IService<TbPlussBankRegionLklEntity> {
}

View File

@ -0,0 +1,7 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.TbPlussBusinessSmallLklEntity;
import com.baomidou.mybatisplus.extension.service.IService;
public interface TbPlussBusinessSmallLklService extends IService<TbPlussBusinessSmallLklEntity> {
}

View File

@ -0,0 +1,7 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.TbPlussRegionLklEntity;
import com.baomidou.mybatisplus.extension.service.IService;
public interface TbPlussRegionLklService extends IService<TbPlussRegionLklEntity> {
}

View File

@ -0,0 +1,53 @@
package cn.pluss.platform.klk.service.impl;
import org.springframework.core.io.InputStreamResource;
import java.io.InputStream;
public class CommonInputStreamResource extends InputStreamResource {
/***
* 文件長度
*/
private int length;
/***
* 文件名稱
*/
private String fileName;
public CommonInputStreamResource(InputStream inputStream) {
super(inputStream);
}
public CommonInputStreamResource(InputStream inputStream, int length,String fileName) {
super(inputStream);
this.length = length;
this.fileName = fileName;
}
/**
* 覆写父类方法
* 如果不重写这个方法并且文件有一定大小那么服务端会出现异常
* {@code The multi-part request contained parameter data (excluding uploaded files) that exceeded}
*
* @return
*/
@Override
public String getFilename() {
return this.fileName;
}
/**
* 覆写父类 contentLength 方法
* 因为 {@link org.springframework.core.io.AbstractResource#contentLength()}方法会重新读取一遍文件
* 而上传文件时restTemplate 会通过这个方法获取大小然后当真正需要读取内容的时候发现已经读完会报如下错误
* <code>
* java.lang.IllegalStateException: InputStream has already been read - do not use InputStreamResource if a stream needs to be read multiple times
* at org.springframework.core.io.InputStreamResource.getInputStream(InputStreamResource.java:96)
* </code>
* <p>
* ref:com.amazonaws.services.s3.model.S3ObjectInputStream#available()
*
* @return
*/
@Override
public long contentLength() {
int estimate = length;
return estimate == 0 ? 1 : estimate;
}
}

View File

@ -0,0 +1,789 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.BankCardService;
import cn.pluss.platform.IdCardService;
import cn.pluss.platform.channel.ys.impl.YSAuditServiceV3;
import cn.pluss.platform.dto.AccountDTO;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.klk.LaKaLaUtility;
import cn.pluss.platform.klk.service.*;
import cn.pluss.platform.klk.vo.*;
import cn.pluss.platform.mcc.MccReflectService;
import cn.pluss.platform.merchant.AccountService;
import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
import cn.pluss.platform.userApp.UserAppService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.*;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
@Service
public class LaKalaInterfaceImpl implements LaKalaInterface {
@Resource
LklPayService lklPayService;
@Resource
TbLklRegionBankInfoServiceImpl tbLklRegionBankInfoServiceImpl;
@Resource
TbPlussBankBranchLklService tbPlussBankBranchLklService;
@Resource
UserAppService uaService;
@Resource
private MerchantBaseInfoService mbiService;
@Resource
BankCardService bankCardService;
@Resource
private TbPlussRegionLklService tbPlussRegionLklService;
@Resource
private IdCardService idCardService;
@Resource
private TbPlussBankRegionLklService regionLklService;
@Resource
AccountService accountService;
@Lazy
@Resource
private MerchantChannelStatusService mcsService;
@Resource
MerchantBaseInfoService baseInfoService;
@Resource
TbPlussBusinessSmallLklService businessSmallLklService;
@Resource
MccReflectService service;
@Resource
PlussMerchantLklService merchantLklService;
// private static final String client_id = "chaozhanggui";
// private static final String client_secret = "Y54Gqy6aLpxld3dp";
// private static final String grant_type = "client_credentials";
// private static final String userNo = "22241007";
// /**
// * 商户进件
// */
// private static final String tuoKeMerchat = "https://htkactvi.lakala.com/registration/merchant";
// /**
// * 获取地区信息
// */
// private static final String organparentCode = "https://htkactvi.lakala.com/registration/organization/";
// /**
// * 获取银行地区信息
// */
// private static final String organizationBank = "https://htkactvi.lakala.com/registration/organization/bank/";
// /**
// * 文件上传
// */
// private static final String fileUpload = "https://htkactvi.lakala.com/registration/file/upload";
// private static final String tuoKeToken = "https://tkapi.lakala.com/auth/oauth/token";
/************************************************测试信息***************************************************/
private static final String client_id = "testsit";
private static final String client_secret = "EguwEckByf2I6u6z";
private static final String grant_type = "client_credentials";
private static final String userNo = "20000101";
/**
* 商户进件
*/
private static final String tuoKeMerchat = "https://test.wsmsd.cn/sit/htkregistration/merchant";
/**
* 获取地区信息
*/
private static final String organparentCode = "https://test.wsmsd.cn/sit/htkregistration/organization/";
/**
* 获取银行地区信息
*/
private static final String organizationBank = "https://test.wsmsd.cn/sit/htkregistration/organization/bank/";
/**
* 文件上传
*/
private static final String fileUpload = "https://test.wsmsd.cn/sit//htkregistration/file/upload";
private static final String tuoKeToken = "https://test.wsmsd.cn/sit/htkauth/oauth/token";
/**
* 拉卡拉模式进件
*/
@Override
public void laKaLaAddMer(LaKaLaVO laVO, String ip) {
String apiPath = "/api/v2/mms/openApi/addMer";
JSONObject object1 = new JSONObject();
JSONObject object2 = new JSONObject();
object1.put("reqData", object2);
object2.put("version", "1.0"); //接口版本号
object2.put("orderNo", laVO.getOrderNo()); //订单编号便于后续跟踪排查问题及核对报文
object2.put("posType", laVO.getPosType()); //进件POS类型 按接入系统做控制参见 POS类型字典表
object2.put("orgCode", "1"); //机构代码 合作方在拉卡拉的标识请联系业务员
object2.put("merRegName", laVO.getMerRegName()); //商户注册名称
object2.put("merRegDistCode", laVO.getMerRegDistCode()); //地区代码参看地区文档]
object2.put("merRegAddr", laVO.getMerRegAddr()); //商户详细地址
object2.put("mccCode", laVO.getMccCode()); //商户MCC编号
if (null != laVO.getMerBlisName() || null != laVO.getMerBlis()) { //小微商户可不传其它必传,为空则小微商户
object2.put("merBlisName", laVO.getMerBlisName()); //营业执照名称
object2.put("merBlis", laVO.getMerBlis()); //营业执照号
object2.put("merBlisStDt", laVO.getMerBlisStDt()); //营业执照开始日期
object2.put("merBlisExpDt", "1.0"); //营业执照有效期
}
object2.put("merBusiContent", laVO.getMerBusiContent()); //参看经营内容字典表文档
object2.put("larName", laVO.getLarName()); //商户法人姓名
object2.put("larIdType", laVO.getLarIdType()); //支持其他证件类型见参证件类型字典表
object2.put("larIdcard", laVO.getLarIdcard()); //法人身份证号码
object2.put("larIdcardStDt", laVO.getLarIdcardStDt()); //法人身份证开始日期 yyyy-MM-dd
object2.put("larIdcardExpDt", laVO.getLarIdcardExpDt()); //法人身份证有效期 yyyy-MM-dd
object2.put("merContactMobile", laVO.getMerContactMobile()); //商户联系人手机号码
object2.put("merContactName", laVO.getMerContactName()); //商户联系人
object2.put("openningBankCode", laVO.getOpenningBankCode()); //可根据结算卡信息进行查询仅支持对私结算卡查询参见卡BIN信息查询
object2.put("openningBankName", laVO.getOpenningBankName()); //可根据结算卡信息进行查询仅支持对私结算卡查询参见卡BIN信息查询
object2.put("clearingBankCode", laVO.getClearingBankCode()); //可根据结算卡信息进行查询仅支持对私结算卡查询参见卡BIN信息查询
object2.put("acctNo", laVO.getAcctNo()); //结算账户账号
object2.put("acctName", laVO.getAcctName()); //结算账户名称
object2.put("acctTypeCode", laVO.getAcctTypeCode()); //结算账户性质 57对公 58 对私
object2.put("settlePeriod", laVO.getSettlePeriod()); //结算周期 参见结算周期表
object2.put("retUrl", "1.0"); //回调地址url
object2.put("feeData", laVO.getFeeData()); //费率信息集合 参看下方费率信息
// orderService.createOrder(object1.toString(),apiPath,"");
}
/**
* 拉卡拉拓客进件
* */
public TuoKeVo createTuoKeInfo(String userId) {
MerchantBaseInfo merchantBaseInfo = mbiService.getMerchantBaseInfoByUserId(userId);
TuoKeVo tuoKeVo = new TuoKeVo();
tuoKeVo.setBusiCode(""); //业务类型
tuoKeVo.setEmail("chaozhanggui2023@163.com");
tuoKeVo.setMerchantCode(merchantBaseInfo.getMerchantCode());
tuoKeVo.setMerRegName(merchantBaseInfo.getMerchantName());//商户注册名称
if (merchantBaseInfo.getMerchantType().equals("1") || merchantBaseInfo.getMerchantType().equals("2")) { //商户类型/营业执照类型 可选值1:小微2:个体3:企业
tuoKeVo.setMerType("TP_PERSONAL");//商户注册类型 TP_MERCHANT:企业 TP_PERSONAL:微个
} else {
tuoKeVo.setMerType("TP_MERCHANT");//商户注册类型
}
tuoKeVo.setMerName(merchantBaseInfo.getMerchantName()); //商户名称(经营名称
tuoKeVo.setMerAddr(merchantBaseInfo.getAddress()); //市区后的详细地址
List<OrganVo> proOrganCode = getOrganCode("1");
System.out.println("proOrganCode :" + proOrganCode);
String cityCode = null;
for (OrganVo organVo : proOrganCode) { //省code
if (organVo.getName().equals(merchantBaseInfo.getProvince())) {
QueryWrapper<TbPlussRegionLklEntity> wrapper = new QueryWrapper<>();
wrapper.eq("name", merchantBaseInfo.getProvince()).last("limit 1");
TbPlussRegionLklEntity one = tbPlussRegionLklService.getOne(wrapper);
tuoKeVo.setProvinceCode(one.getCode());
cityCode = one.getCode();
break;
}
}
List<OrganVo> cityOrganCode = getOrganCode(cityCode); //市code
for (OrganVo organVo : cityOrganCode) {
if (organVo.getName().equals(merchantBaseInfo.getCity())) {
QueryWrapper<TbPlussRegionLklEntity> wrapper = new QueryWrapper<>();
wrapper.eq("name", merchantBaseInfo.getCity()).last("limit 1");
TbPlussRegionLklEntity one = tbPlussRegionLklService.getOne(wrapper);
tuoKeVo.setCityCode(one.getCode());
cityCode = one.getCode();
break;
}
}
List<OrganVo> countyOrganCode = getOrganCode(cityCode); //区code
for (OrganVo organVo : countyOrganCode) {
if (organVo.getName().equals(merchantBaseInfo.getDistrict())) {
QueryWrapper<TbPlussRegionLklEntity> wrapper = new QueryWrapper<>();
wrapper.eq("name", merchantBaseInfo.getDistrict()).last("limit 1");
TbPlussRegionLklEntity one = tbPlussRegionLklService.getOne(wrapper);
tuoKeVo.setCountyCode(one.getCode());
cityCode = one.getCode();
break;
}
}
if (!merchantBaseInfo.getMerchantType().equals("1")) {// 非小微商户类型
tuoKeVo.setLicenseName(merchantBaseInfo.getBussAuthName()); //营业执照名称
tuoKeVo.setLicenseNo(merchantBaseInfo.getBussAuthNum());//营业执照号码 微商户可不传 其他必传
tuoKeVo.setLicenseDtStart(merchantBaseInfo.getBussAuthStartTime());//营业执照开始时间微商户可不传 其他必传格式yyyy-MM-dd
tuoKeVo.setLicenseDtEnd(merchantBaseInfo.getBussAuthEndTime());//微商户可不传 其他必传格式yyyy-MM-dd
}
tuoKeVo.setLatitude("");//经度 进件所在地址经度
tuoKeVo.setLongtude("");//纬度 进件所在地址纬度
tuoKeVo.setSource("APP"); //进件来源 APP: app H5: h5
tuoKeVo.setBusinessContent(merchantBaseInfo.getMccName()); //商户经营内容
IdCard one = idCardService.getLegalIdCard(userId); //获取法人身份证信息
tuoKeVo.setLarName(one.getCertName());
tuoKeVo.setLarIdType("01");
tuoKeVo.setLarIdCard(one.getCertNo());
tuoKeVo.setLarIdCardStart(birthdayDate(one.getCertStartTime()));
tuoKeVo.setLarIdCardEnd(birthdayDate(one.getCertEndTime()));
tuoKeVo.setContactMobile(merchantBaseInfo.getContactMobile());
tuoKeVo.setContactName(merchantBaseInfo.getContactName());
QueryWrapper<Account> accountQueryWrapper1 = new QueryWrapper<>();
accountQueryWrapper1.eq("userId", userId);
accountQueryWrapper1.eq("channelType", "D1");
Account accountServiceOne1 = accountService.getOne(accountQueryWrapper1);
QueryWrapper<BankCard> bankCardWrapper = new QueryWrapper<>();
bankCardWrapper.eq("id", accountServiceOne1.getBankCardId());
BankCard userBrakCard = bankCardService.getOne(bankCardWrapper);
QueryWrapper<TbPlussBankBranchLklEntity> lklEntityQueryWrapper = new QueryWrapper<>();
lklEntityQueryWrapper.eq("branch_bank_no", userBrakCard.getContactLine());
TbPlussBankBranchLklEntity lakalaBranchInfo = tbPlussBankBranchLklService.getOne(lklEntityQueryWrapper);
tuoKeVo.setOpenningBankCode(lakalaBranchInfo.getBranchBankNo());
tuoKeVo.setOpenningBankName(lakalaBranchInfo.getBranchBankName());
tuoKeVo.setClearingBankCode(lakalaBranchInfo.getClearNo());
QueryWrapper<TbPlussBankRegionLklEntity> regionLklEntityQueryWrapper = new QueryWrapper<>();
regionLklEntityQueryWrapper.eq("code", lakalaBranchInfo.getAreaCode());
TbPlussBankRegionLklEntity bankParentCode = regionLklService.getOne(regionLklEntityQueryWrapper); //市code name
regionLklEntityQueryWrapper.clear();
regionLklEntityQueryWrapper.eq("code", bankParentCode.getParentCode());
TbPlussBankRegionLklEntity parentCode = regionLklService.getOne(regionLklEntityQueryWrapper); //省code 名称
tuoKeVo.setSettleProvinceCode(parentCode.getCode());
tuoKeVo.setSettleProvinceName(parentCode.getName());
tuoKeVo.setSettleCityCode(bankParentCode.getCode());
tuoKeVo.setSettleCityName(bankParentCode.getName());
Account account = new Account().setUserId("userId").setChannelType("D1");
AccountDTO accountV4 = getAccountV4(userId, "D1"); //结算人
/**获取结算人**/
BankCard bankCard = accountV4.getBankCard();
tuoKeVo.setAccountNo(bankCard.getBankCardNo());
tuoKeVo.setAccountName(bankCard.getBranchName());
if (bankCard.getAccountType().equals("01")) {
tuoKeVo.setAccountType("58"); //结算账户类型 57 对公 58 对私
} else {
tuoKeVo.setAccountType("57");
}
IdCard idcard = accountV4.getIdcard();
tuoKeVo.setAccountIdCard(idcard.getCertNo());//结算人证件号码
tuoKeVo.setTermNum("1");
tuoKeVo.setFeeCode("SCAN_PAY_SECOND"); //费率类型 参考 附录 费率类型表
tuoKeVo.setFeeValue("0.038"); //费率值 百分比费率
MerchantBaseInfo merchantBaseInfoByUserId = baseInfoService.getMerchantBaseInfoByUserId(userId);
QueryWrapper<MccReflect> userAppQueryWrapper = new QueryWrapper();
userAppQueryWrapper.eq("standard_mcc_code", merchantBaseInfoByUserId.getMcc()).eq("channel_id", "5").last("limit 1");
MccReflect mccReflect = service.getOne(userAppQueryWrapper);
if (null != mccReflect) {
tuoKeVo.setMcc("11010"); //商户MCC编号 通过 商户类别查询查询小类接口获取 对应 code字段
// tuoKeVo.setMcc(mccReflect.getMccCode()); //商户MCC编号 通过 商户类别查询查询小类接口获取 对应 code字段
} else {
tuoKeVo.setMcc("18001");
}
tuoKeVo.setActivityId("12"); //归属活动信息 由拓客SAAS分配
Set<Object> attchmentsVoSet = new HashSet<>();
AttchmentsVo frontLegalPerson = new AttchmentsVo(); //图片set
frontLegalPerson.setId(laKaLaFileUpload(idcard.getImgPositive()));//法人身份证图片地址
frontLegalPerson.setType("ID_CARD_FRONT");//身份证正
AttchmentsVo reverseLegalPerson = new AttchmentsVo();
reverseLegalPerson.setId(idcard.getImgNegative()); //法人身份证图片地址
reverseLegalPerson.setType("ID_CARD_BEHIND");//身份证反
attchmentsVoSet.add(reverseLegalPerson);
tuoKeVo.setSet(attchmentsVoSet);
tuoKeVo.setSettleType("D1"); //结算类型 D0秒到 D1次日结算
tuoKeAddMer(tuoKeVo);
return tuoKeVo;
}
/**
* 参数组装
* */
@Override
public void tuoKeAddMer(TuoKeVo tuoKeVo) {
JSONObject object1 = new JSONObject();
JSONObject object2 = new JSONObject();
object1.put("userNo", userNo); //合作机构信息 由拓客SAAS提供
object1.put("email", tuoKeVo.getEmail()); //商户邮箱
// object1.put("busiCode", "PAPER_CODE");//业务类型 BPOS:传统POS, ZPOS:电签,ZPOS4G4G电签,SUPER_POS:智能pos,B_WIZARD:蓝精灵,PAPER_CODE:码牌,WECHAT_PAY:专业化扫码,KLYX:云音箱,QRCODE:收款王,MONEY_BOX:收钱宝盒根据业务开放取值
object1.put("busiCode", "PAPER_CODE");//业务类型 BPOS:传统POS, ZPOS:电签,ZPOS4G4G电签,SUPER_POS:智能pos,B_WIZARD:蓝精灵,PAPER_CODE:码牌,WECHAT_PAY:专业化扫码,KLYX:云音箱,QRCODE:收款王,MONEY_BOX:收钱宝盒根据业务开放取值
object1.put("merRegName", tuoKeVo.getMerRegName()); //商户注册名称 不能少于七个中文
object1.put("merType", tuoKeVo.getMerType()); //商户注册类型 TP_MERCHANT:企业 TP_PERSONAL:微个
object1.put("merName", tuoKeVo.getMerName()); //商户名称(经营名称) 不能少于七个中文
object1.put("merAddr", tuoKeVo.getMerAddr()); //去掉省市区后的详细地址
object1.put("provinceCode", tuoKeVo.getProvinceCode()); //省代码 通过地区信息获取地区查询接口获取 对应 code字段
object1.put("cityCode", tuoKeVo.getCityCode()); // 市代码 通过地区信息获取地区查询接口获取 对应 code字段
object1.put("countyCode", tuoKeVo.getCountyCode()); // 区县代码 通过地区信息获取地区查询接口获取 对应 code字段
object1.put("licenseName", tuoKeVo.getLicenseName()); //营业执照名称
object1.put("licenseNo", tuoKeVo.getLicenseNo()); //营业执照号码 微商户可不传 其他必传
object1.put("licenseDtStart", tuoKeVo.getLicenseDtStart()); //营业执照开始时间微商户可不传 其他必传格式yyyy-MM-dd
object1.put("licenseDtEnd", tuoKeVo.getLicenseDtEnd()); //微商户可不传 其他必传格式yyyy-MM-dd
object1.put("latitude", "108.94647"); //经度 进件所在地址经度error
object1.put("longtude", "34.34727"); //纬度 进件所在地址纬度 error
object1.put("source", tuoKeVo.getSource()); //进件来源 APP: app H5: h5
object1.put("businessContent", tuoKeVo.getBusinessContent()); //商户经营内容
object1.put("larName", tuoKeVo.getLarName()); //姓名
object1.put("larIdType", tuoKeVo.getLarIdType()); //证件类型 01 身份证 暂时只支持身份证
object1.put("larIdCard", tuoKeVo.getLarIdCard()); //证件号码
object1.put("larIdCardStart", tuoKeVo.getLarIdCardStart()); //证件开始 格式yyyy-MM-dd
object1.put("larIdCardEnd", tuoKeVo.getLarIdCardEnd()); //证件过期时间 格式yyyy-MM-dd
object1.put("contactMobile", tuoKeVo.getContactMobile()); //商户联系⼿机号码
object1.put("contactName", tuoKeVo.getContactName()); //商户联系姓名
object1.put("openningBankCode", tuoKeVo.getOpenningBankCode()); //结算账户开户 通过银行列表查询接口获取 对应 branchBankNo字段
object1.put("openningBankName", tuoKeVo.getOpenningBankName()); //结算账户开户名称 通过银行列表查询接口获取 对应 branchBankName字段
object1.put("clearingBankCode", tuoKeVo.getClearingBankCode()); //结算账户清算 通过银行列表查询接口获取 对应 clearNo字段
object1.put("settleProvinceCode", tuoKeVo.getSettleProvinceCode()); //结算信息省份名称 通过地区信息获取银行地区查询接口获取 对应 code字段
object1.put("settleProvinceName", tuoKeVo.getSettleProvinceName()); //结算信息省份代码 通过地区信息获取银行地区查询接口获取 对应 name字段
object1.put("settleCityCode", tuoKeVo.getSettleCityCode()); //结算信息城市名称 通过地区信息获取银行地区查询接口获取 对应 code字段
object1.put("settleCityName", tuoKeVo.getSettleCityName()); //结算信息城市代码 通过地区信息获取银行地区查询接口获取 对应 name字段
object1.put("accountNo", tuoKeVo.getAccountNo()); //结算人银行卡号
object1.put("accountName", tuoKeVo.getAccountName()); //结算人账户名称
object1.put("accountType", tuoKeVo.getAccountType()); //结算账户类型 57 对公 58 对私
// object1.put("accountIdType",tuoKeVo.getUserNo()); //结算证件类型 为空同法
object1.put("accountIdCard", tuoKeVo.getAccountIdCard()); //结算证件号码
Set<FeesSetVo> feesSet = new HashSet<>();
FeesSetVo f = new FeesSetVo();
f.setFeeCode(tuoKeVo.getFeeCode());
f.setFeeValue(tuoKeVo.getFeeValue());
feesSet.add(f);
object2.put("termNum", tuoKeVo.getTermNum()); //终端数量 1-5 5个终端
object2.put("fees", feesSet); //费率集合
object2.put("mcc", tuoKeVo.getMcc()); //商户MCC编号 通过 商户类别查询查询小类接口获取 对应 code字段
// object2.put("activityId", tuoKeVo.getActivityId()); //归属活动信息 由拓客SAAS分配
object2.put("activityId","37"); //归属活动信息 由拓客SAAS分配
object1.put("bizContent", object2); //业务扩展信息 业务扩展信息
//
// Set<AttchmentsVo> attchmentsVoSet = new HashSet<>();
// AttchmentsVo attchmentsVo = new AttchmentsVo();
// attchmentsVo.setId(tuoKeVo.getId());
// attchmentsVo.setType(tuoKeVo.getType());
// attchmentsVoSet.add(attchmentsVo);
// object1.put("attchments", attchmentsVoSet); //附件信息集合 附件信息
object1.put("attchments", tuoKeVo.getSet()); //附件信息集合 附件信息
object1.put("settleType", tuoKeVo.getSettleType()); //结算类型 D0秒到 D1次日结算
System.out.println("请求报文: " + object1);
/**获取拓客accessToken**/
Map map = getToken();
String result="";
try{
result = cn.hutool.http.HttpRequest.post(tuoKeMerchat)
.header("Authorization", "bearer " + map.get("access_token")).header("content-type", "application/json")
.body(object1.toString()).execute().body();
Map arry = (Map) JSONArray.parse(result);
if (String.valueOf(arry.get("status")).equals("WAIT_AUDI")){
PlussMerchantLklEntity plussMerchantLklEntity =new PlussMerchantLklEntity();
plussMerchantLklEntity.setMerchantId(tuoKeVo.getMerchantCode());
plussMerchantLklEntity.setMerchantlkl(String.valueOf(arry.get("merchantNo")));
plussMerchantLklEntity.setType("0");
merchantLklService.save(plussMerchantLklEntity);
}else {
}
}catch (Exception e){
Map arry = (Map) JSONArray.parse(result);
new MsgException(String.valueOf(arry.get("message")));
}
}
@Resource
YSAuditServiceV3 auditServiceV3;
/**
* 进件回调
* */
public String tuoKeCallBack(Map<String,Object> map){
String data = LaKaLaUtility.decrypt(map.get("data").toString());
Map arryMap = (Map) JSONArray.parse(data);
System.out.println(arryMap);
if (String.valueOf(arryMap.get("status")).equals("SUCCESS")){
CallBackVo callBackVo =new CallBackVo();
callBackVo.setStatus("00");
callBackVo.setNote(String.valueOf(arryMap.get("remark")));
callBackVo.setSysFlowId(String.valueOf(arryMap.get("customerNo")));
callBackVo.setJsoon(data);
auditServiceV3.lklResultHandle(callBackVo);
} else if (String.valueOf(arryMap.get("status")).equals("FAILURE")) {
CallBackVo callBackVo =new CallBackVo();
callBackVo.setStatus("90");
callBackVo.setNote(String.valueOf(arryMap.get("remark")));
callBackVo.setSysFlowId(String.valueOf(arryMap.get("customerNo")));
callBackVo.setJsoon(data);
auditServiceV3.lklResultHandle(callBackVo);
}
return "200";
}
/**
* 获取拓客accessToken
*/
public static Map getToken() {
RestTemplate client = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
// 表单提交
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("Authorization", "Basic " + getBase64());
// 封装参数
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
params.add("grant_type", grant_type);
params.add("client_id", client_id);
params.add("client_secret", client_secret);
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
// 执行HTTP请求
ResponseEntity<String> response = client.exchange(tuoKeToken, HttpMethod.POST, requestEntity, String.class);
Map map = (Map) JSONArray.parse(response.getBody());
return map;
}
// 加密
public static String getBase64() {
String encodeBase64String = org.apache.commons.codec.binary.Base64.encodeBase64String((client_id + ":" + client_secret).getBytes());
return encodeBase64String;
}
// 解密
public static String getFromBase64(String s) {
byte[] decodeBase64 = org.apache.commons.codec.binary.Base64.decodeBase64(s);
s = new String(decodeBase64);
return s;
}
/**
* 拼接身份证过期时间
*/
public String birthdayDate(String date) {
String str = new String(date);
String s1 = "";
s1 = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, str.length());
return s1;
}
@Autowired
private UserAppService userAppService;
/**
* 获取结算人信息
*/
public AccountDTO getAccountV4(String userId, String type) {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.set("token", "admin");
headers.set("myLoginName", "admin");
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);
ResponseEntity<String> exchange = restTemplate.exchange("http://127.0.0.1:7004/api/account/v4?userId=" + userId + "&channelType=" + type, HttpMethod.GET, formEntity, String.class);
JSONObject jsonArray = JSONArray.parseObject(exchange.getBody());
AccountDTO accountDTO = JSONArray.parseObject(jsonArray.get("data").toString(), AccountDTO.class);
System.out.println(accountDTO);
return accountDTO;
}
/**
* 获取地区信息
*/
@Override
public List<OrganVo> getOrganCode(String code) {
/**获取拓客accessToken**/
RestTemplate client = new RestTemplate();
Map parse = getToken();
HttpHeaders header = new HttpHeaders();
header.set("Authorization", "bearer " + parse.get("access_token"));
// 封装参数
MultiValueMap<String, String> par = new LinkedMultiValueMap<String, String>();
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(par, header);
// 执行HTTP请求
ResponseEntity<String> re = client.exchange(organparentCode + code, HttpMethod.GET, request, String.class);
List<OrganVo> jsonArrayList = null;
try {
String seqResult = new String(re.getBody().getBytes("ISO8859-1"), "utf-8");
jsonArrayList = JSONArray.parseArray(seqResult, OrganVo.class);
// jsonArrayList = (List<OrganVo>) JSONArray.parse(seqResult);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
return jsonArrayList;
}
/**
* 获取银行地区信息
*/
public String bankOrgen(String code) {
RestTemplate client = new RestTemplate();
Map parse = getToken();
HttpHeaders header = new HttpHeaders();
header.set("Authorization", "bearer " + parse.get("access_token"));
MultiValueMap<String, String> par = new LinkedMultiValueMap<String, String>();
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(par, header);
// 执行HTTP请求
ResponseEntity<String> re = client.exchange(organizationBank + code, HttpMethod.GET, request, String.class);
try {
String seqResult = new String(re.getBody().getBytes("ISO8859-1"), "utf-8");
return seqResult;
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
/**
* 银行列表查询
*/
public String banList(String areaCode) {
Map parse = getToken();
//请求头
HttpHeaders header = new HttpHeaders();
header.add("Authorization", "bearer " + parse.get("access_token"));
MultiValueMap<String, Object> param = new LinkedMultiValueMap<String, Object>();
//封装请求头
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(param, header);
RestTemplate restTemplate = new RestTemplate();
try {
//访问地址
ResponseEntity<String> result4 = restTemplate.exchange("https://htkactvi.lakala.com/registration/bank?areaCode=" + areaCode, HttpMethod.GET, formEntity, String.class);
String seqResult = new String(result4.getBody().getBytes("ISO8859-1"), "utf-8");
return seqResult;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 商户类别查询
* 一般商户传1 小微系统商户传2 拓客现在只传2
*/
public String htkRegistration() {
/**获取拓客accessToken**/
RestTemplate client = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
// 表单提交
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// 封装参数
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
params.add("grant_type", "client_credentials");
params.add("client_id", "testsit");
params.add("client_secret", "EguwEckByf2I6u6z");
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
// 执行HTTP请求
ResponseEntity<String> response = client.exchange("https://test.wsmsd.cn/sit/htkauth/oauth/token", HttpMethod.POST, requestEntity, String.class);
System.out.println(response.getBody().toString());
Map parse = (Map) JSONArray.parse(response.getBody().toString());
HttpHeaders header = new HttpHeaders();
header.set("Authorization", "bearer " + parse.get("access_token"));
// 封装参数
MultiValueMap<String, String> par = new LinkedMultiValueMap<String, String>();
par.add("businessScene", "2");
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(par, header);
// 执行HTTP请求
ResponseEntity<String> re = client.exchange("https://test.wsmsd.cn/sit/htkregistration/customer/category", HttpMethod.GET, request, String.class);
try {
String seqResult = new String(re.getBody().getBytes("ISO8859-1"), "utf-8");
return seqResult;
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
/**
* 获取大类和小类
*/
public String getRegistrationChid() {
/**获取拓客accessToken**/
RestTemplate client = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
// 表单提交
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// 封装参数
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
params.add("grant_type", "client_credentials");
params.add("client_id", "testsit");
params.add("client_secret", "EguwEckByf2I6u6z");
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
// 执行HTTP请求
ResponseEntity<String> response = client.exchange("https://test.wsmsd.cn/sit/htkauth/oauth/token", HttpMethod.POST, requestEntity, String.class);
System.out.println(response.getBody().toString());
Map parse = (Map) JSONArray.parse(response.getBody().toString());
HttpHeaders header = new HttpHeaders();
header.set("Authorization", "bearer " + parse.get("access_token"));
// 封装参数
MultiValueMap<String, String> par = new LinkedMultiValueMap<String, String>();
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(par, header);
// 执行HTTP请求
ResponseEntity<String> re = client.exchange("https://test.wsmsd.cn/sit/htkregistration/customer/category", HttpMethod.GET, request, String.class);
try {
String seqResult = new String(re.getBody().getBytes("ISO8859-1"), "utf-8");
return seqResult;
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
/**
* 拓客文件上传接口
*/
@SneakyThrows
public String laKaLaFileUpload(String url1) {
RestTemplate restTemplate = new RestTemplate();
String url = fileUpload;
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
// String url1 = "https://czg-oss.oss-cn-hangzhou.aliyuncs.com/images/9b42a8f68e2b4682bdb72490abe131fe.png?Expires=1994642722&OSSAccessKeyId=LTAI5tPdEfYSZcqHbjCrtPRD&Signature=cTcS0ey%2F6NYWQnyvVCMQsO6rZMU%3D";
URI uri = null;
try {
uri = new URI(url1);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
RestTemplate restTemplate1 = new RestTemplate();
ResponseEntity<byte[]> exchange = restTemplate1.exchange(uri, HttpMethod.GET, null, byte[].class);
MultipartFile file1 = new MockMultipartFile("file", exchange.getBody());
ByteArrayResource fileAsResource = new ByteArrayResource(file1.getBytes()) {
@Override
public String getFilename() {
return file1.getOriginalFilename();
// return null;
}
@Override
public long contentLength() {
// return 0L;
return file1.getSize();
}
};
params.add("file", fileAsResource);
params.add("imgType", "ID_CARD_FRONT");
params.add("sourcechnl", "1");
params.add("isOcr", "false");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
Map token = getToken();
headers.set("Authorization", "bearer " + token.get("access_token"));
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers);
String result = restTemplate.postForObject(url, requestEntity, String.class);
Map parse = (Map) JSONArray.parse(result);
return parse.get("url").toString();
}
/**
* 银行地区对象
*/
@Data
static class BankInfo {
private String clearNo;
private String branchBankNo;
private String branchBankName;
private String bankNo;
private String areaCode;
}
/**
* 银行对象
*/
@Data
static class Region {
private String code;
private String name;
}
public void ff() {
LaKalaInterfaceImpl laKalaInterface = new LaKalaInterfaceImpl();
String s = laKalaInterface.bankOrgen("1");
List<Region> lists = JSONArray.parseArray(s, Region.class);
for (Region list : lists) {
String s1 = laKalaInterface.bankOrgen(list.getCode());
List<Region> lists1 = JSONArray.parseArray(s1, Region.class);
for (Region bank : lists1) {
String s2 = laKalaInterface.banList(bank.getCode());
List<BankInfo> bankInfos = JSONArray.parseArray(s2, BankInfo.class);
for (BankInfo bankInfo : bankInfos) {
TbLklRegionBankInfoEntity entity = new TbLklRegionBankInfoEntity();
entity.setSCode(list.getCode());
entity.setSName(list.getName());
entity.setRCode(bank.getCode());
entity.setRName(bank.getName());
entity.setAreaCode(bankInfo.getAreaCode());
entity.setBankNo(bankInfo.getBankNo());
entity.setBranchBankName(bankInfo.getBranchBankName());
entity.setBranchBankNo(bankInfo.getBranchBankNo());
entity.setClearNo(bankInfo.getClearNo());
tbLklRegionBankInfoServiceImpl.aa(entity);
}
}
}
}
public static void main(String[] args) {
// getToken();
LaKalaInterfaceImpl laKalaInterface = new LaKalaInterfaceImpl();
laKalaInterface.getOrganCode("1");
// try {
// laKalaInterface.laKaLaFileUpload1();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// System.out.println(getBase64("testsit:EguwEckByf2I6u6z"));
// String str = new String("20180301");
// String s1 = "";
//
// s1 = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, str.length());
//
// System.out.println(s1);
}
}

View File

@ -0,0 +1,11 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.entity.PlussMerchantLklEntity;
import cn.pluss.platform.klk.service.PlussMerchantLklService;
import cn.pluss.platform.mapper.PlussMerchantLklDao;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class PlussMerchantLklServiceImpl extends ServiceImpl<PlussMerchantLklDao, PlussMerchantLklEntity> implements PlussMerchantLklService {
}

View File

@ -0,0 +1,20 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.entity.TbLklRegionBankInfoEntity;
import cn.pluss.platform.klk.service.TbLklRegionBankInfoService;
import cn.pluss.platform.mapper.TbLklRegionBankInfoDao;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service("tbLklRegionBankInfoServiceImpl")
public class TbLklRegionBankInfoServiceImpl extends ServiceImpl<TbLklRegionBankInfoDao, TbLklRegionBankInfoEntity> implements TbLklRegionBankInfoService {
@Resource
TbLklRegionBankInfoDao regionBankInfoDao;
public void aa(TbLklRegionBankInfoEntity entity){
// QueryWrapper<TbLklRegionBankInfoEntity> wrapper =new QueryWrapper<>();
regionBankInfoDao.insert(entity);
}
}

View File

@ -0,0 +1,12 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.entity.TbPlussBankBranchLklEntity;
import cn.pluss.platform.klk.service.TbPlussBankBranchLklService;
import cn.pluss.platform.mapper.TbPlussBankBranchLklMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class TbPlussBankBranchLklServiceImpl extends ServiceImpl<TbPlussBankBranchLklMapper, TbPlussBankBranchLklEntity> implements TbPlussBankBranchLklService {
}

View File

@ -0,0 +1,11 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.entity.TbPlussBankRegionLklEntity;
import cn.pluss.platform.klk.service.TbPlussBankRegionLklService;
import cn.pluss.platform.mapper.TbPlussBankRegionLklMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class TbPlussBankRegionLklServiceImpl extends ServiceImpl<TbPlussBankRegionLklMapper, TbPlussBankRegionLklEntity> implements TbPlussBankRegionLklService {
}

View File

@ -0,0 +1,11 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.entity.TbPlussBusinessSmallLklEntity;
import cn.pluss.platform.klk.service.TbPlussBusinessSmallLklService;
import cn.pluss.platform.mapper.TbPlussBusinessSmallLklDao;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class TbPlussBusinessSmallLklServiceImpl extends ServiceImpl<TbPlussBusinessSmallLklDao, TbPlussBusinessSmallLklEntity> implements TbPlussBusinessSmallLklService {
}

View File

@ -0,0 +1,11 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.entity.TbPlussRegionLklEntity;
import cn.pluss.platform.klk.service.TbPlussRegionLklService;
import cn.pluss.platform.mapper.TbPlussRegionLklMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class TbPlussRegionLklServiceImpl extends ServiceImpl<TbPlussRegionLklMapper, TbPlussRegionLklEntity> implements TbPlussRegionLklService {
}

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.klk.vo;
import lombok.Data;
@Data
public class AttchmentsVo {
private String id;
private String type;
}

View File

@ -0,0 +1,11 @@
package cn.pluss.platform.klk.vo;
import lombok.Data;
@Data
public class CallBackVo {
private String status;
private String sysFlowId;
private String note;
private String jsoon;
}

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.klk.vo;
import lombok.Data;
@Data
public class FeesSetVo {
private String feeCode;
private String feeValue;
}

View File

@ -0,0 +1,14 @@
package cn.pluss.platform.klk.vo;
import lombok.Data;
@Data
public class OrganVo {
private String id;
private String createTime;
private String optimistic;
private String updateTime;
private String code;
private String name;
private String parentCode;
}

View File

@ -0,0 +1,68 @@
package cn.pluss.platform.klk.vo;
import lombok.Data;
import java.util.Set;
@Data
public class TuoKeVo {
private String userNo;
private String email;
private String busiCode;
private String merchantCode;
private String merRegName;
private String merType;
private String merName;
private String merAddr;
private String provinceCode;
private String cityCode;
private String countyCode;
private String licenseName;
private String licenseNo;
private String licenseDtStart;
private String licenseDtEnd;
private String latitude;
private String longtude;
private String source;
private String businessContent;
private String larName;
private String larIdType;
private String larIdCard;
private String larIdCardStart;
private String larIdCardEnd;
private String contactMobile;
private String contactName;
private String openningBankCode;
private String openningBankName;
private String clearingBankCode;
private String settleProvinceCode;
private String settleProvinceName;
private String settleCityCode;
private String settleCityName;
private String accountNo;
private String accountName;
private String accountType;
private String accountIdCard;
private String ccountIdDtStart;
private String accountIdDtEnd;
private String accountIdType;
private String bizContent;
private String settleType;
private String shopId;
private String settlementType;
private String regularSettlementTime;
private String merchantNo;
private String id;
private String type;
private String termNum;
private String termVer;
private String fees;
private String mcc;
private String feeCode;
private String feeValue;
private String topFee;
private String activityId;
private Set<Object> set;
}

View File

@ -9,9 +9,11 @@ import cn.pluss.platform.mapper.MerchantOrderMapper;
import cn.pluss.platform.vo.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ -21,6 +23,14 @@ import java.util.Map;
*/
public interface MerchantOrderService extends IService<MerchantOrder> {
default Page<MerchantOrder> pageData(IPage<MerchantOrder> page, Map<String, Object> map, List<String> statusList) {
return ((MerchantOrderMapper) getBaseMapper()).page(page, map, statusList);
}
default BigDecimal getRefundAmt(String merchantCode, String snNo, String date) {
return ((MerchantOrderMapper) getBaseMapper()).selectRefundAmt(merchantCode, snNo, date);
}
default MerchantOrder queryMerchantOrder(MerchantOrder merchantOrder) {
return getBaseMapper().selectOne(new QueryWrapper<>(merchantOrder));
}
@ -261,7 +271,15 @@ public interface MerchantOrderService extends IService<MerchantOrder> {
* @param merchantOrderDTO ignored
* @return ignored
*/
Result<Object> toActivePay(MerChantOrderDTO merchantOrderDTO);
Result<Object> toActivePay(MerChantOrderDTO merchantOrderDTO, HttpServletRequest request);
/**
* 扫用户二维码支付
*
* @param merchantOrderDTO ignored
* @return ignored
*/
JSONObject toActivePayV2(MerChantOrderDTO merchantOrderDTO, HttpServletRequest request);
/**
* 主扫会员卡支付
@ -275,7 +293,7 @@ public interface MerchantOrderService extends IService<MerchantOrder> {
* @param memberRechargeDTO ignored
* @return ignored
*/
Result<Map<String, Object>> toMemberRecharge(MemberRechargeDTO memberRechargeDTO);
Result<Map<String, Object>> toMemberRecharge(MemberRechargeDTO memberRechargeDTO, HttpServletRequest request);
/**
* 退款

View File

@ -18,6 +18,7 @@ import cn.pluss.platform.entitiy.SettleTypeEnum;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.enums.UserRoleEnum;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.ipLocation.IpLocationService;
import cn.pluss.platform.mapper.*;
import cn.pluss.platform.memberOrder.MemberOrderService;
import cn.pluss.platform.merchant.MerchantCashPlaceService;
@ -81,6 +82,7 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
@ -98,6 +100,10 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
@Autowired
private GeneralPushUtil generalPushUtil;
@Lazy
@Resource
private IpLocationService ipLocationService;
@Setter(onMethod_ = {@Autowired})
private MerchantOrderVOMapper merchantOrderVOMapper;
@ -439,7 +445,7 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
BigDecimal todayConsumeFee = BigDecimal.ZERO;
int orderCount = 0;// 今日订单数量
Integer fanCount = 0;// 今日粉丝数量
LambdaQueryWrapper<MerchantOrder> queryWrapperTotal = Wrappers.lambdaQuery();
Date dayBegin = DateUtils.getDayBegin();
@ -684,7 +690,7 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
*
* @param
* @return
*
*
* @author Administrator
* @since JDK 1.8
*/
@ -771,7 +777,7 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
@Override
public Result<Object> toActivePay(MerChantOrderDTO dto) {
public Result<Object> toActivePay(MerChantOrderDTO dto, HttpServletRequest request) {
//校验参数
checkActivePayParamsMap(dto);
//组装订单参数
@ -786,11 +792,42 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
result.put("message", "交易成功");
return ResultGenerator.genSuccessResult("支付成功", result);
}else{
MerchantOrder order = getMerchantOrder(dto, dto.getConsumeFee(), "1","1");
MerchantOrder order = getMerchantOrder(dto, dto.getConsumeFee(), "1","1", request);
return activePay(order, dto);
}
}
@Override
public JSONObject toActivePayV2(MerChantOrderDTO dto, HttpServletRequest request) {
//校验参数
checkActivePayParamsMap(dto);
//组装订单参数
if (StringUtils.isNotEmpty(dto.getType()) && "3".equals(dto.getType())) {
MerchantMemberCode menberCode = dto.getMercMenberCode();
MerchantMenber menber = merchantMenberMapper.getByCardNo(menberCode.getCardNo());
MemberScanPayDTO memberScanPayDTO = new MemberScanPayDTO(dto, menber);
MemberScanVO vo = getMemberPayOrder(memberScanPayDTO, menber);
JSONObject result = new JSONObject();
result.put("orderNumber", vo.getOrderNumber());
result.put("consumeFee", vo.getConsumeFee());
result.put("status", "1");
return result;
} else {
MerchantOrder order = getMerchantOrder(dto, dto.getConsumeFee(), "1", "1", request);
Result<Object> objectResult = activePay(order, dto);
JSONObject result = new JSONObject();
result.put("orderNumber", order.getOrderNumber());
result.put("consumeFee", order.getConsumeFee());
result.put("status", order.getStatus());
result.put("remark", objectResult.getMessage());
return result;
}
}
/**
* 主扫会员卡支付
*
@ -814,11 +851,11 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
*/
@Override
@Transactional(rollbackFor = Exception.class,propagation = Propagation.NOT_SUPPORTED)
public Result<Map<String, Object>> toMemberRecharge(MemberRechargeDTO dto) {
public Result<Map<String, Object>> toMemberRecharge(MemberRechargeDTO dto, HttpServletRequest req) {
// 校验参数
checkActivePayParamsMap(dto);
MerchantOrder order = getMerchantOrder(dto, Double.parseDouble(dto.getRechargeMoney()), "1","5");
MerchantOrder order = getMerchantOrder(dto, Double.parseDouble(dto.getRechargeMoney()), "1","5", req);
QueryWrapper<MerchantMenber> menberWrapper = new QueryWrapper<MerchantMenber>()
.eq("phone", dto.getPhone()).eq("merchantCode", dto.getMerchantCode()).eq("storeId", dto.getStoreId());
@ -1218,7 +1255,7 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
/**
* merchantIncome:(添加收益记录). <br/>
*
*
*
* @author Administrator
* @since JDK 1.8
*/
@ -1244,7 +1281,7 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
* @param orderType 订单类型 5 APP扫码充值
* @return
*/
private MerchantOrder getMerchantOrder(MerChantOrderDTO dto, Double amt, String type,String orderType) {
private MerchantOrder getMerchantOrder(MerChantOrderDTO dto, Double amt, String type,String orderType, HttpServletRequest request) {
MerchantOrder merchantOrder = new MerchantOrder();
MerchantCashPlaceStaff cashPlaceStaff = new MerchantCashPlaceStaff();
@ -1305,6 +1342,12 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
}else{
merchantOrder.setSettlementType(SettleTypeEnum.D1.getValue());
}
//主扫记录商户交易ip 不一定准确
String ip = IpUtils.getIpAddr(request);
merchantOrder.setIp(ip);
String ipAddress = IpUtils.getIpLoactionAddress(ipLocationService.getLocation(ip));
merchantOrder.setIpAddress(ipAddress);
return merchantOrder;
}

View File

@ -29,6 +29,8 @@ public interface ApiPayService {
*/
Result<Object> refundQuery(JSONObject params);
JSONObject apiRefundPay(JSONObject params);
/**
* @description:api退款
* @date: 2021/11/22 10:48

View File

@ -801,11 +801,11 @@ public class ApiPayServiceImpl implements ApiPayService {
}
return ResultGenerator.genFailResult("订单号有误,退款订单不存在!");
}
/**
* @description:api退款功能
* @date: 2021/11/22 10:49
* @param params:
* @param params:
* @return cn.pluss.platform.api.Result<com.alibaba.fastjson.JSONObject>
*/
@Override
@ -844,7 +844,7 @@ public class ApiPayServiceImpl implements ApiPayService {
}
//退款操作
private JSONObject apiRefundPay(JSONObject params) {
public JSONObject apiRefundPay(JSONObject params) {
MerchantBaseInfo merchant = params.getObject("merchant", MerchantBaseInfo.class);
String refundReason = StringUtil.isEmpty(params.getString("refundReason")) ? "订单退款" : params.getString("refundReason");
String mercOrderNo = params.getString("mercOrderNo");

View File

@ -20,6 +20,7 @@ import cn.pluss.platform.entity.*;
import cn.pluss.platform.enums.UserRoleEnum;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.jfShop.JfShopHandler;
import cn.pluss.platform.klk.service.impl.LaKalaInterfaceImpl;
import cn.pluss.platform.leshua.BizConstants;
import cn.pluss.platform.leshua.ExpandDto;
import cn.pluss.platform.mapper.*;
@ -65,6 +66,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
@ -735,7 +737,8 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
return result;
}
@Resource
LaKalaInterfaceImpl laKalaInterface;
@Override
@Transactional(rollbackFor = Exception.class)
public void merchantAudit(JSONObject jsonObject, String channelId) {
@ -801,6 +804,8 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
//ysAuditServiceV2.merchantAudit(userId, false);
ysAuditServiceV3.merchantAuditV3(userId, false);
break;
case "5":
laKalaInterface.createTuoKeInfo(userId);
default:
MsgException.throwException("未知的进件通道");
}

View File

@ -88,6 +88,7 @@
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
</dependencies>
<!-- <dependencyManagement>-->

View File

@ -66,6 +66,9 @@ import cn.pluss.platform.wechat.*;
import cn.pluss.platform.wx.WxAccessTokenRequest;
import cn.pluss.platform.wx.WxCommonService;
import cn.pluss.platform.wx.WxOauth2AccessTokenResponse;
import cn.pluss.platform.ys.YSConstants;
import cn.pluss.platform.ys.YsEnum;
import cn.pluss.platform.ys.YsService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
@ -168,6 +171,9 @@ public class MerchantController {
@Setter(onMethod_ = {@Autowired, @Qualifier("ysPayOldService")})
private PayService ysPayOldService;
@Setter(onMethod_ = {@Autowired, @Qualifier("lkLPayService")})
private PayService lkLPayService;
@Setter(onMethod_ = {@Autowired})
private RyxPayService ryxPayService;
@ -565,6 +571,8 @@ public class MerchantController {
unionInfo = ryxPayService.getUnionInfo(userAuthCode, payMentApp, channel.getMerchantId());
} else if (channel.getChannel() == 4) {
unionInfo = ysPayOldService.getUnionInfo(userAuthCode, payMentApp, null);
} else if (channel.getChannel() == 5) {
unionInfo = lkLPayService.getUnionInfo(userAuthCode, payMentApp, null);
} else {
view.addObject("error", "未知通道类型");
return view;
@ -1698,6 +1706,8 @@ public class MerchantController {
unionInfo = ryxPayService.getUnionInfo(userAuthCode, payMentApp, channel.getMerchantId());
} else if (channel.getChannel() == 4) {
unionInfo = ysPayOldService.getUnionInfo(userAuthCode, payMentApp, null);
} else if (channel.getChannel() == 5) {
unionInfo = lkLPayService.getUnionInfo(userAuthCode, payMentApp, null);
} else {
view.addObject("error", "未知通道类型");
return view;
@ -1929,6 +1939,8 @@ public class MerchantController {
return modelAndView;
} else if (channel.getChannel() == 4) {
unionInfo = ysPayOldService.getUnionInfo(userAuthCode, payMentApp, null);
} else if (channel.getChannel() == 5) {
unionInfo = lkLPayService.getUnionInfo(userAuthCode, payMentApp, null);
} else {
modelAndView.addObject("error", "未知通道类型");
modelAndView.setViewName("/merchant/errorInfo2");