|
@@ -20,6 +20,7 @@ import org.dromara.common.core.enums.ResultCodeEnum;
|
|
|
import org.dromara.common.core.exception.ApiException;
|
|
import org.dromara.common.core.exception.ApiException;
|
|
|
import org.dromara.common.message.kafka.aop.annotation.SyncDataToLocal;
|
|
import org.dromara.common.message.kafka.aop.annotation.SyncDataToLocal;
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -49,31 +50,24 @@ public class CardApiController extends BaseController {
|
|
|
private final CardBusiness cardBusiness;
|
|
private final CardBusiness cardBusiness;
|
|
|
private final IPtCardService cardService;
|
|
private final IPtCardService cardService;
|
|
|
|
|
|
|
|
- @PostMapping("/api/v1/new")
|
|
|
|
|
|
|
+ @PostMapping({"/api/v1/new", "/api/v1/init"})
|
|
|
@SyncDataToLocal(eventType = CARD_OPERATION, sender = CARD_CENTER_SENDER)
|
|
@SyncDataToLocal(eventType = CARD_OPERATION, sender = CARD_CENTER_SENDER)
|
|
|
public ReturnResult initNewCard(@RequestBody Map<String, Object> initParam) {
|
|
public ReturnResult initNewCard(@RequestBody Map<String, Object> initParam) {
|
|
|
- PtCardBo bo = getInitInfo(initParam);
|
|
|
|
|
- InitCardVo initCardVo = new InitCardVo();
|
|
|
|
|
- R<ResultInfo> result = cardBusiness.initEntityCard(bo, initCardVo);
|
|
|
|
|
- if (R.isSuccess(result)) {
|
|
|
|
|
- return ReturnResult.success(YcVoConvert.initCardVoCovert(initCardVo));
|
|
|
|
|
- }
|
|
|
|
|
- throw new ApiException(result.getData().getDetail(), result.getData().getCode());
|
|
|
|
|
|
|
+ return getReturnResult(initParam);
|
|
|
}
|
|
}
|
|
|
@PostMapping("/api/v1/change")
|
|
@PostMapping("/api/v1/change")
|
|
|
@SyncDataToLocal(eventType = CARD_OPERATION, sender = CARD_CENTER_SENDER)
|
|
@SyncDataToLocal(eventType = CARD_OPERATION, sender = CARD_CENTER_SENDER)
|
|
|
public ReturnResult initChangeCard(@RequestBody Map<String, Object> initParam) {
|
|
public ReturnResult initChangeCard(@RequestBody Map<String, Object> initParam) {
|
|
|
- PtCardBo bo = getInitInfo(initParam);
|
|
|
|
|
- InitCardVo initCardVo = new InitCardVo();
|
|
|
|
|
- R<ResultInfo> result = cardBusiness.initEntityCard(bo, initCardVo);
|
|
|
|
|
- if (R.isSuccess(result)) {
|
|
|
|
|
- return ReturnResult.success(YcVoConvert.initCardVoCovert(initCardVo));
|
|
|
|
|
- }
|
|
|
|
|
- throw new ApiException(result.getData().getDetail(), result.getData().getCode());
|
|
|
|
|
|
|
+ return getReturnResult(initParam);
|
|
|
}
|
|
}
|
|
|
@PostMapping("/api/v1/reissue")
|
|
@PostMapping("/api/v1/reissue")
|
|
|
@SyncDataToLocal(eventType = CARD_OPERATION, sender = CARD_CENTER_SENDER)
|
|
@SyncDataToLocal(eventType = CARD_OPERATION, sender = CARD_CENTER_SENDER)
|
|
|
public ReturnResult initReissueCard(@RequestBody Map<String, Object> initParam) {
|
|
public ReturnResult initReissueCard(@RequestBody Map<String, Object> initParam) {
|
|
|
|
|
+ return getReturnResult(initParam);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @NotNull
|
|
|
|
|
+ private ReturnResult getReturnResult(@RequestBody Map<String, Object> initParam) {
|
|
|
PtCardBo bo = getInitInfo(initParam);
|
|
PtCardBo bo = getInitInfo(initParam);
|
|
|
InitCardVo initCardVo = new InitCardVo();
|
|
InitCardVo initCardVo = new InitCardVo();
|
|
|
R<ResultInfo> result = cardBusiness.initEntityCard(bo, initCardVo);
|
|
R<ResultInfo> result = cardBusiness.initEntityCard(bo, initCardVo);
|
|
@@ -82,6 +76,7 @@ public class CardApiController extends BaseController {
|
|
|
}
|
|
}
|
|
|
throw new ApiException(result.getData().getDetail(), result.getData().getCode());
|
|
throw new ApiException(result.getData().getDetail(), result.getData().getCode());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@PostMapping("/api/v1/write/success")
|
|
@PostMapping("/api/v1/write/success")
|
|
|
public ReturnResult writeNewCardOk(@RequestBody Map<String, Object> initParam) throws InterruptedException {
|
|
public ReturnResult writeNewCardOk(@RequestBody Map<String, Object> initParam) throws InterruptedException {
|
|
|
PtCardBo bo = getInitInfo(initParam);
|
|
PtCardBo bo = getInitInfo(initParam);
|
|
@@ -164,15 +159,15 @@ public class CardApiController extends BaseController {
|
|
|
return bo;
|
|
return bo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/api/v1/init")
|
|
|
|
|
- public ReturnResult initSefNewCard(@RequestBody Map<String, Object> initParam) {
|
|
|
|
|
- PtCardBo bo = getInitInfo(initParam);
|
|
|
|
|
- InitCardVo initCardVo = new InitCardVo();
|
|
|
|
|
- R<ResultInfo> result = cardBusiness.initEntityCard(bo, initCardVo);
|
|
|
|
|
- if (R.isSuccess(result)) {
|
|
|
|
|
- PtCardVo cardVo = initCardVo.getCard();
|
|
|
|
|
- return ReturnResult.success(YcVoConvert.cardVoConvert(cardVo));
|
|
|
|
|
- }
|
|
|
|
|
- throw new ApiException(result.getData().getDetail(), result.getData().getCode());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //@PostMapping("/api/v1/init")
|
|
|
|
|
+ //public ReturnResult initSefNewCard(@RequestBody Map<String, Object> initParam) {
|
|
|
|
|
+ // PtCardBo bo = getInitInfo(initParam);
|
|
|
|
|
+ // InitCardVo initCardVo = new InitCardVo();
|
|
|
|
|
+ // R<ResultInfo> result = cardBusiness.initEntityCard(bo, initCardVo);
|
|
|
|
|
+ // if (R.isSuccess(result)) {
|
|
|
|
|
+ // PtCardVo cardVo = initCardVo.getCard();
|
|
|
|
|
+ // return ReturnResult.success(YcVoConvert.cardVoConvert(cardVo));
|
|
|
|
|
+ // }
|
|
|
|
|
+ // throw new ApiException(result.getData().getDetail(), result.getData().getCode());
|
|
|
|
|
+ //}
|
|
|
}
|
|
}
|