|
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.chelvc.cloud.vehicle.client.constant.TradeConstant;
|
|
|
import com.chelvc.cloud.vehicle.client.util.SFTPUtils;
|
|
|
+import com.chelvc.cloud.vehicle.server.dao.MerchantAuthMapper;
|
|
|
import com.chelvc.cloud.vehicle.server.dao.MerchantRelationMapper;
|
|
|
+import com.chelvc.cloud.vehicle.server.dao.UserAuthMapper;
|
|
|
import com.chelvc.cloud.vehicle.server.entity.*;
|
|
|
import com.chelvc.cloud.vehicle.server.handle.TradeHandle;
|
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantApplyRecordService;
|
|
@@ -14,6 +16,7 @@ import com.chelvc.cloud.vehicle.server.service.MerchantRelationService;
|
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantService;
|
|
|
import com.chelvc.framework.common.exception.ResourceUnavailableException;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -23,11 +26,14 @@ import java.util.Date;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
@RequiredArgsConstructor(onConstructor = @__({@Autowired,@Lazy}))
|
|
|
public class MerchantRelationServiceImpl extends ServiceImpl<MerchantRelationMapper,
|
|
|
MerchantRelation> implements MerchantRelationService {
|
|
|
private final MerchantService merchantService;
|
|
|
private final MerchantApplyRecordService merchantApplyRecordService;
|
|
|
+ private final MerchantAuthMapper merchantAuthMapper;
|
|
|
+ private final UserAuthMapper userAuthMapper;
|
|
|
@Override
|
|
|
public MerchantRelation queryByUserIdAndType(Long userId, Integer type) {
|
|
|
LambdaQueryWrapper<MerchantRelation> wrapper = Wrappers.lambdaQuery();
|
|
@@ -120,20 +126,29 @@ public class MerchantRelationServiceImpl extends ServiceImpl<MerchantRelationMap
|
|
|
JSONObject json = TradeHandle.handle(String.valueOf(jsonObject), TradeConstant.DECLARE_URL,
|
|
|
TradeConstant.PARTNER_ID, null);
|
|
|
String status = json.getString("status");
|
|
|
+ int resultStatus = 0;
|
|
|
+ String examineStatus = "PROCESSING";
|
|
|
+ String errorMessage = "";
|
|
|
if(!"SUCCESS".equals(status)) {
|
|
|
- String errorMessage = json.getString("errorMessage");
|
|
|
- throw new ResourceUnavailableException("【认证失败】:" + errorMessage);
|
|
|
+ resultStatus = 4;
|
|
|
+ examineStatus = "NO_PASS";
|
|
|
+ errorMessage = json.getString("errorMessage");
|
|
|
+ log.info("店名:【{}】-【认证失败】:{}", merchantAuth.getStoreName(), errorMessage);
|
|
|
+ //更改状态
|
|
|
+ merchantAuthMapper.updateStatusById(merchantAuth.getId(), String.valueOf(resultStatus), errorMessage);
|
|
|
}
|
|
|
String subMerchantId = json.getString("subMerchantId");
|
|
|
MerchantApplyRecord record = new MerchantApplyRecord();
|
|
|
record.setUserId(merchantAuth.getApplicant());
|
|
|
record.setType(2);
|
|
|
record.setRequestId(requestId);
|
|
|
- record.setStatus(0);
|
|
|
+ record.setStatus(resultStatus);
|
|
|
record.setOperationType("CREATE");
|
|
|
- record.setExamineStatus("PROCESSING");
|
|
|
+ record.setExamineStatus(examineStatus);
|
|
|
record.setSubMerchantId(subMerchantId);
|
|
|
+ record.setMerchantReviewRemarks(errorMessage);
|
|
|
record.setCreateTime(new Date());
|
|
|
+ record.setUpdateTime(new Date());
|
|
|
merchantApplyRecordService.insert(record);
|
|
|
}
|
|
|
|
|
@@ -205,20 +220,29 @@ public class MerchantRelationServiceImpl extends ServiceImpl<MerchantRelationMap
|
|
|
JSONObject json = TradeHandle.handle(String.valueOf(jsonObject), TradeConstant.DECLARE_URL,
|
|
|
TradeConstant.PARTNER_ID, null);
|
|
|
String status = json.getString("status");
|
|
|
+ int resultStatus = 0;
|
|
|
+ String examineStatus = "PROCESSING";
|
|
|
+ String errorMessage = "";
|
|
|
if(!"SUCCESS".equals(status)){
|
|
|
- String errorMessage = json.getString("errorMessage");
|
|
|
- throw new ResourceUnavailableException("【认证失败】:"+errorMessage);
|
|
|
+ resultStatus = 4;
|
|
|
+ examineStatus = "NO_PASS";
|
|
|
+ errorMessage = json.getString("errorMessage");
|
|
|
+ log.info("用户:【{}】-【认证失败】:{}", userAuth.getUserName(), errorMessage);
|
|
|
+ //更改状态
|
|
|
+ userAuthMapper.updateStatusById(userAuth.getId(), resultStatus, errorMessage);
|
|
|
}
|
|
|
String subMerchantId = json.getString("subMerchantId");
|
|
|
MerchantApplyRecord record = new MerchantApplyRecord();
|
|
|
record.setUserId(userAuth.getUserId());
|
|
|
record.setType(1);
|
|
|
record.setRequestId(requestId);
|
|
|
- record.setStatus(0);
|
|
|
+ record.setStatus(resultStatus);
|
|
|
record.setOperationType("CREATE");
|
|
|
- record.setExamineStatus("PROCESSING");
|
|
|
+ record.setExamineStatus(examineStatus);
|
|
|
record.setSubMerchantId(subMerchantId);
|
|
|
+ record.setMerchantReviewRemarks(errorMessage);
|
|
|
record.setCreateTime(new Date());
|
|
|
+ record.setUpdateTime(new Date());
|
|
|
merchantApplyRecordService.insert(record);
|
|
|
}
|
|
|
|