|
@@ -29,6 +29,8 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
@@ -178,7 +180,7 @@ public class RefundServiceImpl implements RefundService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public R refundNotice(PrepayNoticeVo prepayNoticeVo, String dsKey) {
|
|
|
+ public ResponseEntity<String> refundNotice(PrepayNoticeVo prepayNoticeVo, String dsKey) {
|
|
|
log.info("微信退款申请成功回调函数: {},: {}", prepayNoticeVo, dsKey);
|
|
|
List<String> dsKeys;
|
|
|
if (StringUtils.isBlank(dsKey)) {
|
|
@@ -193,6 +195,7 @@ public class RefundServiceImpl implements RefundService {
|
|
|
List<SwEnterpriseConfigInfoDo> secretKeyList = commonBusinessDao.getSecretKey(dsKeys);
|
|
|
String analysisStr = null;
|
|
|
String deKey = null;
|
|
|
+ R error = R.error("失败");
|
|
|
for (SwEnterpriseConfigInfoDo swEnterpriseConfigInfoDo : secretKeyList) {
|
|
|
try {
|
|
|
byte[] apiV3Key = swEnterpriseConfigInfoDo.getMerchantsecretkey().getBytes("UTF8");
|
|
@@ -216,7 +219,7 @@ public class RefundServiceImpl implements RefundService {
|
|
|
}
|
|
|
if (StringUtils.isBlank(analysisStr)) {
|
|
|
log.error("回调函数解析异常");
|
|
|
- return R.error();
|
|
|
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error.toString());
|
|
|
}
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
WeChatRefundNoticeVo weChatRefundNoticeVo;
|
|
@@ -225,9 +228,9 @@ public class RefundServiceImpl implements RefundService {
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
log.error("JSON转换异常");
|
|
|
- return R.error();
|
|
|
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error.toString());
|
|
|
}
|
|
|
- log.debug("josn解析正常:{}",weChatRefundNoticeVo);
|
|
|
+ log.debug("json解析正常:{}",weChatRefundNoticeVo);
|
|
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
// 设置租户信息 自动切库
|
|
@@ -239,20 +242,19 @@ public class RefundServiceImpl implements RefundService {
|
|
|
.eq(BaseDo::getDeleted, "0").eq(SwRefundRequestRecordDO::getMerchantrefundnumber, outRefundNo));
|
|
|
if (swRefundRequestRecordDO == null) {
|
|
|
log.error("退款记录失败");
|
|
|
- throw new CustomException("退款失败");
|
|
|
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error.toString());
|
|
|
}
|
|
|
if (!"SUCCESS".equals(weChatRefundNoticeVo.getRefundStatus())) {
|
|
|
log.error("退款失败");
|
|
|
// 更新缴费记录相关信息
|
|
|
swRefundRequestRecordService.getBaseMapper().updateWeChatRefundInfo(deKey, outRefundNo,
|
|
|
refundId, analysisStr, weChatRefundNoticeVo.getSuccessTime(), "4");
|
|
|
- return R.ok();
|
|
|
+ return ResponseEntity.status(HttpStatus.OK).body("");
|
|
|
}
|
|
|
// 更新缴费记录相关信息
|
|
|
swRefundRequestRecordService.getBaseMapper().updateWeChatRefundInfo(deKey, outRefundNo,
|
|
|
refundId, analysisStr, weChatRefundNoticeVo.getSuccessTime(), "3");
|
|
|
-
|
|
|
swRefundRequestRecordService.refundApplication(swRefundRequestRecordDO.getId());
|
|
|
- return R.ok();
|
|
|
+ return ResponseEntity.status(HttpStatus.OK).body("");
|
|
|
}
|
|
|
}
|