|
@@ -0,0 +1,68 @@
|
|
|
+package com.fs.his.task;
|
|
|
+
|
|
|
+import com.fs.FSApplication;
|
|
|
+import com.fs.common.exception.CustomException;
|
|
|
+import com.fs.common.utils.DateUtils;
|
|
|
+import com.fs.his.domain.FsStorePayment;
|
|
|
+import com.fs.his.mapper.FsStorePaymentMapper;
|
|
|
+import com.fs.huifuPay.domain.HuiFuRefundResult;
|
|
|
+import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
|
|
|
+import com.fs.huifuPay.service.HuiFuService;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@SpringBootTest(classes = FSApplication.class)
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Slf4j
|
|
|
+public class TaskTest {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private Task task;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void addPrescribeImg() {
|
|
|
+ try {
|
|
|
+ task.addPrescribeImg();
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private HuiFuService huiFuService;
|
|
|
+ @Autowired
|
|
|
+ private FsStorePaymentMapper fsStorePaymentMapper;
|
|
|
+ @Test
|
|
|
+ public void refundMoney(){
|
|
|
+ V2TradePaymentScanpayRefundRequest request = new V2TradePaymentScanpayRefundRequest();
|
|
|
+ request.setOrdAmt("1.00");
|
|
|
+ request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(new Date()));
|
|
|
+ request.setReqSeqId("refund-1950556773014306817");
|
|
|
+ Map<String, Object> extendInfoMap = new HashMap<>();
|
|
|
+ extendInfoMap.put("org_req_seq_id", "store" + "-" + "1950556773014306816");
|
|
|
+ request.setExtendInfo(extendInfoMap);
|
|
|
+ HuiFuRefundResult refund = huiFuService.refund(request);
|
|
|
+ if ((refund.getResp_code().equals("00000000") || refund.getResp_code().equals("00000100")) && (refund.getTrans_stat().equals("S") || refund.getTrans_stat().equals("P"))) {
|
|
|
+ FsStorePayment paymentMap = new FsStorePayment();
|
|
|
+ paymentMap.setPaymentId(134L);
|
|
|
+ paymentMap.setStatus(-1);
|
|
|
+ paymentMap.setRefundTime(DateUtils.getNowDate());
|
|
|
+ paymentMap.setRefundMoney(BigDecimal.ONE);
|
|
|
+ fsStorePaymentMapper.updateFsStorePayment(paymentMap);
|
|
|
+ } else {
|
|
|
+ throw new CustomException("退款请求失败" + refund.getResp_desc());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|