|
@@ -15,8 +15,6 @@ import com.rongwei.rwcommon.base.BaseDo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
-import com.rongwei.rwcommonentity.commonservers.domain.TenantDo;
|
|
|
-import com.rongwei.wechat.system.config.ContextHolder;
|
|
|
import com.rongwei.wechat.system.config.WeChatAboutApiPara;
|
|
|
import com.rongwei.wechat.system.dao.CommonBusinessDao;
|
|
|
import com.rongwei.wechat.system.service.impl.SwBillManagementUnpaidServiceImpl;
|
|
@@ -44,7 +42,6 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.rongwei.wechat.system.utils.SaveConstans.PayType.*;
|
|
|
|
|
@@ -203,13 +200,13 @@ public class PayMentServiceImpl implements PayMentService {
|
|
|
// }
|
|
|
R error = R.error("失败");
|
|
|
// dsKeys.remove("incontrol");
|
|
|
- httpServletRequest.setAttribute("schema",dskey);
|
|
|
+ httpServletRequest.setAttribute("schema", dskey);
|
|
|
// 获取所有商户的密钥
|
|
|
List<SwEnterpriseConfigInfoDo> secretKeyList = commonBusinessDao.getSecretKey(Collections.singletonList(dskey));
|
|
|
String analysisStr = null;
|
|
|
// String deKey = null;
|
|
|
- if(secretKeyList.isEmpty()) {
|
|
|
- log.error("无法根据:{}找到到对应的商户信息",dskey);
|
|
|
+ if (secretKeyList.isEmpty()) {
|
|
|
+ log.error("无法根据:{}找到到对应的商户信息", dskey);
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error.toString());
|
|
|
}
|
|
|
for (SwEnterpriseConfigInfoDo swEnterpriseConfigInfoDo : secretKeyList) {
|
|
@@ -252,6 +249,7 @@ public class PayMentServiceImpl implements PayMentService {
|
|
|
SwPaymentInitRecordDo paymentInitRecordDo = swPaymentInitRecordService.getOne(new LambdaQueryWrapper<SwPaymentInitRecordDo>()
|
|
|
.eq(BaseDo::getDeleted, "0")
|
|
|
.eq(SwPaymentInitRecordDo::getOrderno, outTradeNo), false);
|
|
|
+ String state = SUCCESS;
|
|
|
try {
|
|
|
// 微信订单号
|
|
|
String transactionId = transaction.getTransactionId();
|
|
@@ -265,18 +263,11 @@ public class PayMentServiceImpl implements PayMentService {
|
|
|
createPaymentRecordVo.setOrderNo(outTradeNo);
|
|
|
createPaymentRecordVo.setPaymentAmount(amount);
|
|
|
|
|
|
- log.info("根据商户订单号:{}获取到的下单信息为:{}",outTradeNo,paymentInitRecordDo);
|
|
|
- String zdIds = null;
|
|
|
+ log.info("根据商户订单号:{}获取到的下单信息为:{}", outTradeNo, paymentInitRecordDo);
|
|
|
+ String zdIds="";
|
|
|
if (paymentInitRecordDo != null) {
|
|
|
zdIds = StringUtils.isBlank(paymentInitRecordDo.getBillid()) ? null : paymentInitRecordDo.getBillid();
|
|
|
- swPaymentInitRecordService.update(new LambdaUpdateWrapper<SwPaymentInitRecordDo>()
|
|
|
- .eq(SwPaymentInitRecordDo::getId, paymentInitRecordDo.getId())
|
|
|
- .set(SwPaymentInitRecordDo::getState, SUCCESS)
|
|
|
- .set(SwPaymentInitRecordDo::getCallbackcontent, transaction.toString())
|
|
|
- .set(BaseDo::getModifydate, new Date())
|
|
|
- );
|
|
|
}
|
|
|
-
|
|
|
createPaymentRecordVo.setZdId(zdIds);
|
|
|
createPaymentRecordVo.setUserNumber(userNum);
|
|
|
createPaymentRecordVo.setOpenId(transaction.getPayer().getOpenid());
|
|
@@ -285,18 +276,20 @@ public class PayMentServiceImpl implements PayMentService {
|
|
|
createPaymentRecordVo.setSuccessTime(successTime);
|
|
|
log.error("开始创建缴费记录:{}", createPaymentRecordVo);
|
|
|
paymentRecordService.createRecord(createPaymentRecordVo);
|
|
|
+ state = SUCCESS;
|
|
|
} catch (Exception e) {
|
|
|
+ state = FAIL;
|
|
|
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error.toString());
|
|
|
+ } finally {
|
|
|
if (paymentInitRecordDo != null) {
|
|
|
swPaymentInitRecordService.update(new LambdaUpdateWrapper<SwPaymentInitRecordDo>()
|
|
|
.eq(SwPaymentInitRecordDo::getId, paymentInitRecordDo.getId())
|
|
|
- .set(SwPaymentInitRecordDo::getState, FAIL)
|
|
|
+ .set(SwPaymentInitRecordDo::getState, state)
|
|
|
.set(SwPaymentInitRecordDo::getCallbackcontent, transaction.toString())
|
|
|
.set(BaseDo::getModifydate, new Date())
|
|
|
);
|
|
|
}
|
|
|
- return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error.toString());
|
|
|
- } finally {
|
|
|
- ContextHolder.clear();
|
|
|
+ // ContextHolder.clear();
|
|
|
}
|
|
|
return ResponseEntity.status(HttpStatus.OK).body("");
|
|
|
}
|