|
|
@@ -2,6 +2,7 @@ package org.dromara.server.consume.business;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -13,6 +14,8 @@ import org.dromara.common.core.config.AsyncConfig;
|
|
|
import org.dromara.common.core.constant.ApiErrorTypeConstants;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
import org.dromara.common.core.domain.model.ErrorInfo;
|
|
|
+import org.dromara.common.core.enums.ConsumeRecordTypeEnum;
|
|
|
+import org.dromara.common.core.enums.CreditTypeEnum;
|
|
|
import org.dromara.common.core.enums.ResultCodeEnum;
|
|
|
import org.dromara.common.core.enums.SystemUseTypeEnum;
|
|
|
import org.dromara.common.json.utils.JsonUtils;
|
|
|
@@ -54,7 +57,7 @@ public class ConsumeBusiness {
|
|
|
* @param xfPwd 消费密码
|
|
|
* @return 请求结果
|
|
|
*/
|
|
|
- public R<ErrorInfo> createOrder(ConsumptionBo bo, java.lang.String mac, java.lang.String xfPwd) {
|
|
|
+ public R<ErrorInfo> createOrder(ConsumptionBo bo, String mac, String xfPwd) {
|
|
|
//检查下客户的公钥与么钥
|
|
|
baseBusiness.getRegisterInfo();
|
|
|
|
|
|
@@ -117,7 +120,7 @@ public class ConsumeBusiness {
|
|
|
* @param xfPwd 消费密码
|
|
|
* @return 上传结果
|
|
|
*/
|
|
|
- public R<ErrorInfo> postOrder(ConsumptionBo bo, java.lang.String mac, java.lang.String xfPwd) {
|
|
|
+ public R<ErrorInfo> postOrder(ConsumptionBo bo, String mac, String xfPwd) {
|
|
|
log.info("[上传交易]-[开始参数验证]-[{}]", JSONUtil.toJsonStr(bo));
|
|
|
R<ErrorInfo> result = checkBusiness.checkParam(bo);
|
|
|
if (R.isError(result)) {
|
|
|
@@ -158,7 +161,17 @@ public class ConsumeBusiness {
|
|
|
* @param xfPwd 消费密码
|
|
|
* @return 处理结果
|
|
|
*/
|
|
|
- public R<ErrorInfo> fullOrder(ConsumptionBo bo, java.lang.String mac, java.lang.String xfPwd) {
|
|
|
+ public R<ErrorInfo> fullOrder(ConsumptionBo bo, String mac, String xfPwd) {
|
|
|
+ if (ObjectUtil.isEmpty(bo.getCreditType())) {
|
|
|
+ bo.setCreditType(CreditTypeEnum.TERM_CONSUME.code());
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isEmpty(bo.getUseType())) {
|
|
|
+ bo.setUseType(SystemUseTypeEnum.CONSUME.code());
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isEmpty(bo.getStatusFlag())) {
|
|
|
+ bo.setStatusFlag(Integer.valueOf(ConsumeRecordTypeEnum.XFJXF_4.code()));
|
|
|
+ }
|
|
|
+
|
|
|
R<ErrorInfo> result = this.createOrder(bo, mac, xfPwd);
|
|
|
if(!R.isSuccess(result)) {
|
|
|
log.error("[请求交易]-[请求交易处理失败]-[{}]", JSONUtil.toJsonStr(result.getData()));
|
|
|
@@ -182,7 +195,7 @@ public class ConsumeBusiness {
|
|
|
if (CollectionUtil.isEmpty(list)) {
|
|
|
return R.ok(new ErrorInfo(ResultCodeEnum.DATA_NOT_FOUND.code(), ApiErrorTypeConstants.NOT_FOUND, "没有待入账的原始消费记录"));
|
|
|
}
|
|
|
- List<java.lang.String> doMessage = new ArrayList<>();
|
|
|
+ List<String> doMessage = new ArrayList<>();
|
|
|
//循环写入原始消费记录
|
|
|
int total = list.size();
|
|
|
AtomicInteger success = new AtomicInteger();
|