package com.mzl.flower.web.init;
|
|
import com.mzl.flower.base.BaseController;
|
import com.mzl.flower.base.R;
|
import com.mzl.flower.base.ReturnDataDTO;
|
import com.mzl.flower.constant.Constants;
|
import com.mzl.flower.dto.request.payment.UserPaymentDTO;
|
import com.mzl.flower.service.payment.UserPaymentV3Service;
|
import com.mzl.flower.service.system.CodeService;
|
import com.mzl.flower.utils.UUIDGenerator;
|
import io.swagger.annotations.Api;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.ResponseEntity;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
@RestController
|
@RequestMapping("/api/pub/init")
|
@Api(tags = "忽略-初始化接口管理")
|
@Validated
|
@Slf4j
|
public class InitResource extends BaseController {
|
|
@Autowired
|
private CodeService codeService;
|
|
@Autowired
|
private UserPaymentV3Service userPaymentV3Service;
|
|
@GetMapping("/cache/{type}")
|
public ResponseEntity<ReturnDataDTO> init(@PathVariable String type) {
|
if("dict".equalsIgnoreCase(type)) {
|
codeService.refreshCache();
|
}
|
return returnData(R.SUCCESS.getCode(), null);
|
}
|
|
@GetMapping("/callback")
|
public ResponseEntity<ReturnDataDTO> callback(String orderId) {
|
String originalXml = "";
|
UserPaymentDTO dto = new UserPaymentDTO();
|
dto.setOrderId(orderId);
|
dto.setTransactionId(UUIDGenerator.getUUID());
|
dto.setOutTradeNo(orderId);
|
dto.setOriginalXml(originalXml);
|
dto.setPaymentAmountCallback("1");
|
dto.setStatus(Constants.PAYMENT_STATUS.SUCCESS.name());
|
|
userPaymentV3Service.saveCallbackInfo(dto, Constants.ORDER_STATUS_BACKEND.PAYMENT.name());
|
|
return returnData(R.SUCCESS.getCode(), null);
|
}
|
}
|