|
|
@@ -16,10 +16,14 @@
|
|
|
*/
|
|
|
package org.springblade.salesPart.payMethod;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springblade.client.feign.IWechatClient;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.pay.tonglianPayment.dto.PaymentDTO;
|
|
|
import org.springblade.pay.tonglianPayment.entity.Parameters;
|
|
|
@@ -33,6 +37,9 @@ import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
@@ -54,13 +61,15 @@ public class PayServiceImpl implements PayService {
|
|
|
|
|
|
private final ISysClient sysClient;
|
|
|
|
|
|
+ private final IWechatClient wechatClient;
|
|
|
+
|
|
|
/**
|
|
|
* 获取用户信息
|
|
|
*/
|
|
|
private IUserClient userClient;
|
|
|
|
|
|
@Override
|
|
|
- public R<Map<Object, Object>> payPrepay(String id, BigDecimal amount, String serialNumber, int status, String goodsNames) {
|
|
|
+ public R<Map<Object, Object>> payPrepay(String corpName,String tel,String id, BigDecimal amount, String serialNumber, int status, String goodsNames) {
|
|
|
if (ObjectUtils.isNull(id)) {
|
|
|
throw new RuntimeException("未找到订单信息,订单已取消");
|
|
|
}
|
|
|
@@ -130,18 +139,27 @@ public class PayServiceImpl implements PayService {
|
|
|
//通联平台sm2公钥
|
|
|
paymentDTO.setSybSmtlpubkey(parameters.getSybSmtlpubkey());
|
|
|
//支付
|
|
|
- /*for (String orderId : id.split(",")) {
|
|
|
- PjOrder order = new PjOrder();
|
|
|
- // 付款
|
|
|
- order.setId(Long.parseLong(orderId));
|
|
|
- order.setActualPaymentStatus(1);
|
|
|
- //更新订单表
|
|
|
- orderMapper.updateById(order);
|
|
|
- }
|
|
|
- return R.success("");*/
|
|
|
R<Map<Object, Object>> res = paymentClient.payPrepay(paymentDTO);
|
|
|
if ("1".equals(count)) {
|
|
|
if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
|
|
|
+ if ("504978".equals(AuthUtil.getTenantId())) {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ String date1 = format.format(new Date());
|
|
|
+ R<String> clientDeptIds = sysClient.getRoleIds(SecureUtil.getTenantId(), "客服");
|
|
|
+ if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
|
|
|
+ R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()), null, null);
|
|
|
+ if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
|
|
|
+ StringBuilder openIds = new StringBuilder();
|
|
|
+ for (User datum : userList.getData()) {
|
|
|
+ if (ObjectUtils.isNotNull(datum.getOaOpenId())) {
|
|
|
+ openIds.append(datum.getOaOpenId()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wechatClient.sendMessage(openIds.substring(0, openIds.length() - 1), "订单通知", "订单通知", date1, corpName, serialNumber,
|
|
|
+ tel, null, null, amount, "2");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.data(res.getData());
|
|
|
} else {
|
|
|
throw new RuntimeException("下单失败");
|