|
@@ -2,14 +2,19 @@ package com.fs.store.controller;
|
|
|
|
|
|
import com.fs.FSAdminApplication;
|
|
import com.fs.FSAdminApplication;
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
|
+import com.fs.huifuPay.dto.*;
|
|
import com.fs.store.domain.FsCouponSchedule;
|
|
import com.fs.store.domain.FsCouponSchedule;
|
|
import com.fs.store.domain.FsMiniprogramSubNotifyTask;
|
|
import com.fs.store.domain.FsMiniprogramSubNotifyTask;
|
|
import com.fs.store.domain.FsStorePayment;
|
|
import com.fs.store.domain.FsStorePayment;
|
|
|
|
+import com.fs.store.domain.TzConfigInfoDTO;
|
|
import com.fs.store.enums.IcgProcessStatusEnum;
|
|
import com.fs.store.enums.IcgProcessStatusEnum;
|
|
import com.fs.store.mapper.FsMiniprogramSubNotifyTaskMapper;
|
|
import com.fs.store.mapper.FsMiniprogramSubNotifyTaskMapper;
|
|
import com.fs.store.service.IFsCouponScheduleService;
|
|
import com.fs.store.service.IFsCouponScheduleService;
|
|
import com.fs.store.service.IFsStorePaymentService;
|
|
import com.fs.store.service.IFsStorePaymentService;
|
|
import com.fs.task.MiniProgramSubTask;
|
|
import com.fs.task.MiniProgramSubTask;
|
|
|
|
+import com.fs.task.StoreTask;
|
|
|
|
+import com.fs.tzBank.TzBankService;
|
|
|
|
+import com.fs.tzBank.utils.TzConfigUtils;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
@@ -23,6 +28,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -98,6 +104,77 @@ public class FsStorePaymentControllerTest {
|
|
fsCouponScheduleService.insertFsCouponSchedule(fsCouponSchedule);
|
|
fsCouponScheduleService.insertFsCouponSchedule(fsCouponSchedule);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TzBankService tzBankService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 手动退款
|
|
|
|
+ */
|
|
|
|
+ @Test
|
|
|
|
+ public void refund(){
|
|
|
|
+ String[] data = new String[]{
|
|
|
|
+ "1909799684457627648"
|
|
|
|
+// "1909589366116712448",
|
|
|
|
+// "1909522277674778624",
|
|
|
|
+// "1909492344919425024",
|
|
|
|
+// "1909466851759357952",
|
|
|
|
+// "1909427177938485248",
|
|
|
|
+// "1909400759435264000",
|
|
|
|
+// "1909368705347747840",
|
|
|
|
+// "1909337288844771328",
|
|
|
|
+// "1909330401881489408"
|
|
|
|
+ };
|
|
|
|
+ TzConfigInfoDTO tzConfigInfoDTO = TzConfigUtils.getConfig();
|
|
|
|
+
|
|
|
|
+ for (String datum : data) {
|
|
|
|
+ FsStorePayment payment = fsStorePaymentService.selectFsStorePaymentByCode(datum);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ RequestDTO<TzPayRefundDTO> requestDTO = new RequestDTO<TzPayRefundDTO>();
|
|
|
|
+ TzPayRefundDTO tzPayRefundDTO = new TzPayRefundDTO();
|
|
|
|
+ tzPayRefundDTO.setOldPayOutOrderNo(payment.getPayCode());
|
|
|
|
+ tzPayRefundDTO.setRefundOrderNo(payment.getPayCode());
|
|
|
|
+ tzPayRefundDTO.setPlatMerCstNo(tzConfigInfoDTO.getPlatMerCstNo());
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
+ tzPayRefundDTO.setTrxSendTime(sdf.format(new Date()));
|
|
|
|
+ tzPayRefundDTO.setRefundOrdTransAmt(payment.getPayMoney());
|
|
|
|
+ tzPayRefundDTO.setNotifyURL(tzConfigInfoDTO.getRefundNotifyUrl());
|
|
|
|
+ requestDTO.setReqBody(tzPayRefundDTO);
|
|
|
|
+ requestDTO.setReqHeader(TzReqHeaderDTO.getInstance(payment.getPayCode()));
|
|
|
|
+
|
|
|
|
+ TzReqResultDTO<TzRefundNotifyDTO> resultDTO;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ resultDTO = tzBankService.payRefund(requestDTO);
|
|
|
|
+ TzRefundNotifyDTO body = resultDTO.getBody();
|
|
|
|
+ String refundOrdStatus = body.getRefundOrdStatus();
|
|
|
|
+ log.info("退款支付单号:{} 返回结果:{}",datum, resultDTO);
|
|
|
|
+ if("90".equals(refundOrdStatus) || "50".equals(refundOrdStatus)) {
|
|
|
|
+ payment.setRefundMoney(payment.getRefundMoney());
|
|
|
|
+ payment.setStatus(-1);
|
|
|
|
+ payment.setRefundTime(new Date());
|
|
|
|
+ fsStorePaymentService.updateFsStorePayment(payment);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ } finally {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 退款将定时发放优惠券的状态设置为已退款
|
|
|
|
+// fsCouponScheduleService.setScheduleCouponRefund(String.valueOf(payment.getOrderId()));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private StoreTask storeTask;
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void deliveryOp(){
|
|
|
|
+ storeTask.deliveryOp();
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void issueCoupon() throws Exception {
|
|
public void issueCoupon() throws Exception {
|
|
fsCouponScheduleService.issueCoupon();
|
|
fsCouponScheduleService.issueCoupon();
|