|
@@ -14,6 +14,7 @@ import java.util.Map;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import org.beetl.sql.core.engine.PageQuery;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -29,8 +30,12 @@ import com.comtika.ctkcloud.common.result.RespWrapper;
|
|
|
import com.comtika.ctkcloud.common.util.IDUtil;
|
|
|
import com.comtika.ctkcloud.common.util.StringUtil;
|
|
|
import com.comtika.ctkcloud.server.base.UnifyPayModel;
|
|
|
+import com.comtika.ctkcloud.server.config.ComtikaWechatClientProperties;
|
|
|
+import com.comtika.ctkcloud.server.config.ComtikaWechatProperties;
|
|
|
import com.comtika.ctkcloud.server.core.ComtikaHttpsUtil;
|
|
|
+import com.comtika.ctkcloud.server.dao.comtika.SysComtikaBillDao;
|
|
|
import com.comtika.ctkcloud.server.dao.comtika.SysComtikaMerchantDao;
|
|
|
+import com.comtika.ctkcloud.server.dao.comtika.SysComtikaSubUserDao;
|
|
|
import com.comtika.ctkcloud.server.dao.customer.CtkCustomerDao;
|
|
|
import com.comtika.ctkcloud.server.dao.pay.PrePayDao;
|
|
|
import com.comtika.ctkcloud.server.dao.refund.RefundDao;
|
|
@@ -38,6 +43,9 @@ import com.comtika.ctkcloud.server.dao.sepAccount.ReceiveDao;
|
|
|
import com.comtika.ctkcloud.server.entity.DaFeng;
|
|
|
import com.comtika.ctkcloud.server.entity.MybankPay;
|
|
|
import com.comtika.ctkcloud.server.entity.NotifyOrder;
|
|
|
+import com.comtika.ctkcloud.server.entity.comtikapay.SubLedgerBill;
|
|
|
+import com.comtika.ctkcloud.server.entity.comtikapay.SysComtikaBill;
|
|
|
+import com.comtika.ctkcloud.server.entity.comtikapay.SysComtikaSubUser;
|
|
|
import com.comtika.ctkcloud.server.entity.comtikawechat.ComtikaRegisterMerchant;
|
|
|
import com.comtika.ctkcloud.server.entity.comtikawechat.SysComtikaMerchant;
|
|
|
import com.comtika.ctkcloud.server.entity.customer.CtkCustomer;
|
|
@@ -78,6 +86,14 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
|
|
|
@Autowired
|
|
|
private CtkCustomerDao ctkCustomerDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysComtikaBillDao sysComtikaBillDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysComtikaSubUserDao sysComtikaSubUserDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ComtikaWechatProperties comtikaWechatProperties;
|
|
|
|
|
|
//public static String host = "http://127.0.0.1:8888";
|
|
|
public static String host = "https://www.comtikaiot.cn/wechatpay";
|
|
@@ -98,6 +114,7 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
|
|
|
|
|
|
public static String CTK_SEP_HANDLE_URL = "/sepAccount/sepAccountHandle";//发起分账接口
|
|
|
|
|
|
+ public static String comtikaSubLedgerBill = "/wxpay/jsapi/querySubLedgerBill";
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
@@ -380,9 +397,9 @@ System.out.println("查询订单信息返回结果:"+data.isSuccess()+"data:"+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RespWrapper<Object> comtikaPrePay(MybankPay mybankPay, Long userId,
|
|
|
- String ip) {
|
|
|
+ public RespWrapper<Object> comtikaPrePay(MybankPay mybankPay, Long userId,String ip,String uCode) {
|
|
|
try {
|
|
|
+System.out.println("uCode的值:" + uCode);
|
|
|
if (mybankPay == null)return RespWrapper.makeFailResp("入参不能为空");
|
|
|
if (mybankPay.getTotalFee() < 0)return RespWrapper.makeFailResp("支付金额不能小于最小值");
|
|
|
System.out.println("入参:" + mybankPay.toString());
|
|
@@ -390,6 +407,16 @@ System.out.println("查询订单信息返回结果:"+data.isSuccess()+"data:"+
|
|
|
// 查询康体佳的商户号
|
|
|
SysComtikaMerchant comtika = new SysComtikaMerchant();
|
|
|
comtika.setMerchantId(1L);
|
|
|
+ if(!StringUtil.isEmpty(uCode)){
|
|
|
+ ComtikaWechatClientProperties[] comtikaProperties = comtikaWechatProperties.getClients();
|
|
|
+ for (ComtikaWechatClientProperties comtikaWechatClientProperties : comtikaProperties) {
|
|
|
+ System.out.println("商户id值为:" + comtikaWechatClientProperties.getPayMchid());
|
|
|
+ if(uCode.equals(comtikaWechatClientProperties.getAppCode())){
|
|
|
+ Long comtikaMerchantId = Long.parseLong(comtikaWechatClientProperties.getPayMchid());
|
|
|
+ comtika.setMerchantId(comtikaMerchantId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
comtika.setRegisterStatus(2);
|
|
|
comtika = sysComtikaMerchantDao.templateOne(comtika);
|
|
|
if (comtika == null) {
|
|
@@ -400,7 +427,7 @@ System.out.println("查询订单信息返回结果:"+data.isSuccess()+"data:"+
|
|
|
UnifyPayModel payModel = UnifyPayModel.valueOf(mybankPay.getPayModel());
|
|
|
CtkRechargeOrder order = new CtkRechargeOrder();
|
|
|
// 如果不是在线充电,订单关联到康体佳
|
|
|
- order.setMerchantId(1L);
|
|
|
+ order.setMerchantId(comtika.getMerchantId());
|
|
|
order.setCustomerId(userId);
|
|
|
order.setCreateTime(startTime);
|
|
|
// 30分中支付时间 过期时间
|
|
@@ -579,20 +606,6 @@ System.out.println("分账结果返回:" + str);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- map.put("id", "14020");
|
|
|
- map.put("outRefundNo", "comtika_tui_1591074564673");
|
|
|
- map.put("refundFee", "1");
|
|
|
- map.put("rechargeOrderId", "51783");
|
|
|
- map.put("merchantId", "408");
|
|
|
- map.put("status", "0");
|
|
|
- map.put("createTime", "1591074564673");
|
|
|
- map.put("refundOrderNo", "50300604602020060200815797491");
|
|
|
- map.put("channelType", "3");
|
|
|
- ComtikaMerchantServiceImpl a = new ComtikaMerchantServiceImpl();
|
|
|
- a.queryComtikaRefund(map);
|
|
|
- }
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
@@ -746,6 +759,73 @@ System.out.println("发起微信分账,分账结果:" + str1);
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
+ public RespWrapper<Object> comtikaSubLedgerBill(SysComtikaMerchant sysComtikaMerchant, String billDate) {
|
|
|
+ try {
|
|
|
+ // 请求服务商平台
|
|
|
+ String httpData = ComtikaHttpsUtil.doGet(host + comtikaSubLedgerBill + "?billDate=" + billDate + "&subMchid="+sysComtikaMerchant.getSubMchid());
|
|
|
+ RespWrapper<Object> data = JSONObject.parseObject(httpData,RespWrapper.class);
|
|
|
+ if(data != null && data.isSuccess()){
|
|
|
+ SubLedgerBill slb = JSONObject.parseObject(data.getData().toString(),SubLedgerBill.class);
|
|
|
+ SysComtikaBill sysComtikaBill = new SysComtikaBill();
|
|
|
+ sysComtikaBill.setMerchantName(sysComtikaMerchant.getMerchantName());
|
|
|
+ sysComtikaBill.setMerchantId(sysComtikaMerchant.getMerchantId());
|
|
|
+ slb.assignmentSysComtikaBill(sysComtikaBill);
|
|
|
+ sysComtikaBillDao.insertTemplate(sysComtikaBill, true);
|
|
|
+ List<SysComtikaSubUser> list = slb.getList();
|
|
|
+ if(null != list && !list.isEmpty()){
|
|
|
+ for (SysComtikaSubUser sysComtikaSubUser : list) {
|
|
|
+ sysComtikaSubUser.setSysComtikaBillId(sysComtikaBill.getId());
|
|
|
+ }
|
|
|
+ sysComtikaSubUserDao.insertBatch(list);
|
|
|
+ }
|
|
|
+ System.out.println(slb);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return RespWrapper.makeErrorResp("服务器错误!");
|
|
|
+ }
|
|
|
+ return RespWrapper.makeSuccessResp("查询分账账单成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
+ String httpData = ComtikaHttpsUtil.doGet(host + comtikaSubLedgerBill + "?billDate=2020-06-03&subMchid=1596395521");
|
|
|
+ System.out.println(httpData);
|
|
|
+ RespWrapper<Object> data = JSONObject.parseObject(httpData,RespWrapper.class);
|
|
|
+ if(data != null && data.isSuccess()){
|
|
|
+ SubLedgerBill a = JSONObject.parseObject(data.getData().toString(),SubLedgerBill.class);
|
|
|
+ System.out.println(a);
|
|
|
+ }
|
|
|
+ System.out.println(data.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RespWrapper<Object> queryComtikaBill(PageQuery<Map<String, Object>> pageQery) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ pageQery = sysComtikaBillDao.queryComtikaBill(pageQery);
|
|
|
+ return RespWrapper.makeSuccessResp(pageQery);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return RespWrapper.makeErrorResp("服务器错误!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RespWrapper<Object> queryComtikaBillUser(PageQuery<Map<String, Object>> pageQery) {
|
|
|
+ try {
|
|
|
+ pageQery = sysComtikaSubUserDao.queryComtikaBillUser(pageQery);
|
|
|
+ return RespWrapper.makeSuccessResp(pageQery);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return RespWrapper.makeErrorResp("服务器错误!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|