Commit 8a564182 authored by 张永's avatar 张永

V1.1.7.8.5

parent 90bae4ae
......@@ -209,7 +209,7 @@
</executions>
<configuration>
<repository>dockerhub.linkfern.com/b2c/shopapi</repository>
<tag>V1.1.7.8.4</tag>
<tag>V1.1.7.8.5</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
......
......@@ -152,7 +152,7 @@ public class OrderController {
String salesOrderID = request.getParameter("salesOrderID");
String goodsList = request.getParameter("goodsList");
String trace_id = request.getAttribute("trace_id")+"";
if(!StringUtil.isNotEmpty(shopNO,salesOrderID)) {
return Rjx.json().setCode(-1).setMessage(I18NUtils.getMessage(langID, "Msg_Parameter_empty")).toJson();
......@@ -163,6 +163,7 @@ public class OrderController {
map.put("salesOrderID", salesOrderID);
map.put("goodsList", goodsList);
map.put("ipaddress", ServletUtil.remoteIp(request));
map.put("trace_id", trace_id);
return orderService.paySubmitV2(map);
}
......
......@@ -3,20 +3,16 @@ package com.egolm.shop.api.service.impl;
import java.io.File;
import java.math.BigDecimal;
import java.sql.Types;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.stream.Collectors;
import java.util.stream.Collectors;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -37,17 +33,13 @@ import com.egolm.common.DateUtil;
import com.egolm.common.FileUtil;
import com.egolm.common.GsonUtil;
import com.egolm.common.HttpUtil;
import com.egolm.common.HttpsUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.common.jdbc.JdbcTemplate.OutParameter;
import com.egolm.common.jdbc.dialect.Dialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.common.jdbc.dialect.bean.Sql;
import com.egolm.common.web.ServletUtil;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.shop.api.service.CrmService;
import com.egolm.shop.api.service.OrderService;
import com.egolm.shop.bean.RespObject;
......@@ -55,8 +47,8 @@ import com.egolm.shop.bean.TSalesOrder;
import com.egolm.shop.bean.TSalesOrderDtl;
import com.egolm.shop.bean.WxPayResponse;
import com.egolm.shop.common.XException;
import com.egolm.shop.common.config.PayClient;
import com.egolm.shop.common.utils.I18NUtils;
import com.qcloud.cos.utils.DateUtils;
@Service
public class OrderServiceImpl implements OrderService {
......@@ -66,6 +58,9 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private CrmService crmService;
@Autowired
private PayClient payClient;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
......@@ -481,6 +476,23 @@ public class OrderServiceImpl implements OrderService {
jdbcTemplate.update(sql, ErrorMsg,salesOrderID);
logger.info("支付对应的订单号:{},支付单号:{} ,已回写错误 信息:{} ",salesOrderID,sOutTradeNO,ErrorMsg);
}else {
/*if(IsPush.equals("1") && Status.equals("0")) {
}*/
this.doPushOrderToSdongPo(salesOrderID,IsPush,Status);
this.delPayFile(sOutTradeNO, PayTypeID, callBackFilePath);
}
}else {
logger.info("支付单号{},返回的过程处理结果为空 {}-------",sOutTradeNO, GsonUtil.toJson(returnMap));
}
} catch (Exception e) {
logger.info("支付单号{}, 推送到蔬东坡的订单 异常 ",sOutTradeNO,e);
}
}
// 最终推送蔬东坡
public void doPushOrderToSdongPo(String salesOrderID,String IsPush,String Status) {
if(IsPush.equals("1") && Status.equals("0")) {
String ssql = "select * FROM tSystemCtrl WHERE sCode = 'OrderToSudongPoUrl' ";
Map<String,Object> setMap = jdbcTemplate.queryForMap(ssql);
......@@ -493,14 +505,6 @@ public class OrderServiceImpl implements OrderService {
}
}
this.delPayFile(sOutTradeNO, PayTypeID, callBackFilePath);
}
}else {
logger.info("支付单号{},返回的过程处理结果为空 {}-------",sOutTradeNO, GsonUtil.toJson(returnMap));
}
} catch (Exception e) {
logger.info("支付单号{}, 推送到蔬东坡的订单 异常 ",sOutTradeNO,e);
}
}
......@@ -1682,6 +1686,8 @@ public class OrderServiceImpl implements OrderService {
//查询订单状态
boolean isHave170 = false; //是否有扫呗分账支付
String sqlOrderQuery = "select\r\n" +
" OrderStatus = nOrderStatus, OrderStatusName = sOrderStatusName,\r\n" +
" TotalRealSaleAmount = nTotalRealSaleAmount,\r\n" +
......@@ -1819,13 +1825,85 @@ public class OrderServiceImpl implements OrderService {
return Rjx.jsonOk().setData(payObj).toJson();
}
} else if(PayTypeID != null && Tag != null && Tag.intValue() == 0 && (PayTypeID.equals("120") ||PayTypeID.equals("121") || PayTypeID.equals("170") || PayTypeID.equals("122") || PayTypeID.equals("130") || PayTypeID.equals("900") || PayTypeID.equals("901") || PayTypeID.equals("902") || PayTypeID.equals("903"))) {
if(PayTypeID.equals("170")) { //扫呗分账 获取分账列表
String account_out = payObj.get("CBKAccountOut")+""; //出账方
String account_in = payObj.get("CBKAccountIn")+""; //入账方
String come_from = "shop";
String appId = payObj.get("AppID")+"";
String agentID = payObj.get("AgentID")+"";
isHave170 = true;
BigDecimal pay_bd = new BigDecimal("100"); //表里为正数
int total_fee = PayAmount.multiply(pay_bd).intValue(); //支付金额分
Map<String,Object> params = new HashMap<String,Object>();
params.put("trade_no", OutTradeNO);
params.put("total_fee",total_fee);
params.put("appId",appId);
params.put("order_body","支付分账");
params.put("account_in",account_in);
params.put("account_out",account_out);
params.put("come_from",come_from);
params.put("agentID",agentID);
params.put("onlinePayTypeId", PayTypeID);
for(int ii = 1;ii<=100;ii++) {
logger.info("第:{} 次进行扫呗分账支付 ,请求:{} ",ii,payObj.toString());
String cbkResult = payClient.post("/lcsw/fz_cbk_dotrans_f", params,map.get("trace_id")+"");
JSONObject cbkJsonResult = JSONObject.parseObject(cbkResult);
if(cbkJsonResult.getBooleanValue("isValid")) {
String cbk_out_trade_no = cbkJsonResult.getString("out_trade_no"); //CBK的支付结果单号
String finish_time = cbkJsonResult.getString("finish_time"); //完成时间
String sql = "exec up_B2BSalesOrderPayCallBack '" + OutTradeNO + "' ,'" + cbk_out_trade_no + "' , '" + PayAmount
+ "' , '" + finish_time + "' , '" + PayTypeID + "' ,0,'' ";
List<Map<String, Object>> returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
String returnStr = GsonUtil.toJson(returnMap);
logger.info("第:{} 次进行扫呗分账支付成功 ,回写结果:{} ",ii,returnStr);
break;
}else {
String statusName = cbkJsonResult.containsKey("err_code_des")?cbkJsonResult.getString("err_code_des"):cbkJsonResult.getString("message");
if(StringUtil.isBlank(statusName)) {
statusName = "分账支付失败.";
}
//支付失败
String sql = "exec up_B2BSalesOrderPayCallBack '" + OutTradeNO + "' ,'' , '' , '' , '" + PayTypeID + "' ,1,'"+statusName+"' ";
List<Map<String, Object>> returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
String returnStr = GsonUtil.toJson(returnMap);
logger.info("第:{} 次进行扫呗分账支付失败 ,回写结果:{} ",ii,returnStr);
}
}
}else {
payObj.putAll(jdbcTemplate.queryForMap(sqlOrderQuery, salesOrderID));
return Rjx.jsonOk().setData(payObj).toJson();
}
}
}
if(isHave170) { //存在分账支付
//检查是否要推疏东波
String sql111 = "exec up_B2BSalesOrderPayCallBack '" + salesOrderID + "'";
List<Map<String, Object>> returnMap = jdbcTemplate.executeMutil(sql111).getDatas().get(0);
Map<String,Object> orderMap = returnMap.get(0);
logger.info("订单单号 :"+salesOrderID+" 检查是否要推送蔬东坡-------"+GsonUtil.toJson(returnMap));
String IsPush = orderMap.get("IsPush")+"";
if(IsPush.equals("1")) {
this.doPushOrderToSdongPo(salesOrderID,IsPush,"0");
}
return Rjx.jsonOk().setData(jdbcTemplate.queryForMap(sqlOrderQuery, salesOrderID)).toJson();
}else {
return Rjx.jsonOk().setData(orderStatusMap).toJson();
}
}
}
return Rjx.jsonErr().setMessage("订单错误").set("errorMsg", "订单错误").toJson();
......
package com.egolm.shop.common.config;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.egolm.common.HttpUtil;
import com.egolm.common.MD5Util;
import com.egolm.common.StringUtil;
@Component
public class PayClient {
@Value("${pay.baseUrl}")
private String baseUrl;
@Value("${pay.secret}")
private String secret;
private static final Log log = LogFactory.getLog(PayClient.class);
public String post(String url, Map<String, Object> parameters,String trace_id) {
for(String key : parameters.keySet()) {
Object val = parameters.get(key);
if(val == null) {
parameters.put(key, "");
}
}
String requestUrl = this.baseUrl + "/" + url;
log.debug("RequestUrl: " + requestUrl);
String timestamp = String.valueOf(System.currentTimeMillis()/1000L);
parameters.put("timestamp", timestamp);
String sign = createSign(parameters, secret);
parameters.put("sign", sign);
Map<String,String> header = new HashMap<String,String>();
header.put("trace_id", trace_id);
String result = HttpUtil.post(requestUrl, parameters,header);
return result;
}
public static String createSign(Map<String,Object> params,String md5Key) {
SortedMap<Object,Object> parameters = new TreeMap<Object,Object>();
for(String key : params.keySet()) {
parameters.put(key, params.get(key));
}
parameters.put("md5Key", md5Key);
return MD5Util.createSign("UTF-8", parameters);
}
public static void main(String[] args) {
}
}
......@@ -51,6 +51,7 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
traceId = StringUtil.getId(32,"S");
}
LogBackUtil.setTraceId(traceId);
req.setAttribute("trace_id", traceId);
resp.setHeader(LogBackUtil.TRACE_ID, traceId);
......
......@@ -106,6 +106,9 @@ crm.appid=d30cde80e5ac42479c5551a5c00f3717
crm.secret=d0ca67eebe6c4c53996b9b310999fccd
pay.baseUrl=https://dev.linkfern.com/egoPay_b2b
pay.secret=90f49d4bb0216c10816c7dec6bf28c89
opt.express.url=https://service-5ptj62bx-1257101137.ap-shanghai.apigateway.myqcloud.com/release/express/query
opt.express.secretId=AKID3dJ0MqWwN23oZ8xt4GFB0s8My1rEfUW2diLU
opt.express.secretKey=4mp4j4Vu4ZE8lCI9R9jqlo0okFz3bRh24II19d9y
......
......@@ -24,6 +24,8 @@
</head>
<body>
<div id="app">
<el-divider content-position="left">V1.1.7.8.5 2024-9-23</el-divider>
<p class="title">1.扫员分账支付通过shop/paySubmitV2调用</p>
<el-divider content-position="left">V1.1.7.8.4 2024-9-19</el-divider>
<p class="title">1.需求 #17402 ,增加crm参数</p>
<p class="title">2.需求 #17311</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment