|
@@ -7,16 +7,21 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.dto.OladingCommonRequest;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.SysUserSub;
|
|
|
+import com.qunzhixinxi.hnqz.admin.entity.WmScorePackage;
|
|
|
+import com.qunzhixinxi.hnqz.admin.entity.WmScorePackageSettleNote;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.dto.UserSignCertDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.GigCallBackStatus;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.GigTypeEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.OladingCertStatus;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.SysUserSubService;
|
|
|
+import com.qunzhixinxi.hnqz.admin.service.WmScorePackageService;
|
|
|
+import com.qunzhixinxi.hnqz.admin.service.WmScorePackageSettleNoteService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.gig.GigThirdApiService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.gig.SysUserSignCertService;
|
|
|
import com.qunzhixinxi.hnqz.common.core.exception.ValidateCodeException;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -24,8 +29,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author lixuesong
|
|
@@ -36,15 +43,16 @@ import java.util.concurrent.TimeUnit;
|
|
|
@AllArgsConstructor
|
|
|
public class GigThirdApiServiceImpl implements GigThirdApiService {
|
|
|
|
|
|
+ private final RedisTemplate redisTemplate;
|
|
|
private final SysUserSubService sysUserSubService;
|
|
|
-
|
|
|
private final SysUserSignCertService sysUserSignCertService;
|
|
|
-
|
|
|
- private final RedisTemplate redisTemplate;
|
|
|
+ private final WmScorePackageSettleNoteService scorePackageSettleNoteService;
|
|
|
+ private final WmScorePackageService scorePackageService;
|
|
|
|
|
|
/**
|
|
|
* 自由职家回调业务处理
|
|
|
- * @param interfaceName
|
|
|
+ *
|
|
|
+ * @param interfaceName
|
|
|
* @param requestId
|
|
|
* @param data
|
|
|
*/
|
|
@@ -53,7 +61,7 @@ public class GigThirdApiServiceImpl implements GigThirdApiService {
|
|
|
// 接口名称
|
|
|
OladingCommonRequest.InterfaceName interfaceNameEnum = Enum.valueOf(OladingCommonRequest.InterfaceName.class, interfaceName);
|
|
|
// 状态
|
|
|
- String status = (String) data.get("status");
|
|
|
+ String status = "CREATE_ORDER_DETAIL".equals(interfaceName) ? (String) data.get("remit_status") : (String) data.get("status");
|
|
|
// 截取前缀部分,从而获取到系统内部的requestId
|
|
|
String requestIdPrefix = StrUtil.split(requestId, StrUtil.UNDERLINE).get(0);
|
|
|
|
|
@@ -81,11 +89,139 @@ public class GigThirdApiServiceImpl implements GigThirdApiService {
|
|
|
Enum.valueOf(OladingCommonRequest.UploadTaxpayerAgreementStatus.class, status);
|
|
|
this.oladingUploadTaxpayerAgreement(requestIdPrefix, agreementStatus);
|
|
|
break;
|
|
|
+ case CREATE_ORDER_V2:
|
|
|
+ // 创建代付订单结果
|
|
|
+ this.oladingCreateOrderV2(requestId, Enum.valueOf(OladingCommonRequest.CreateOrderV2Status.class, status), data);
|
|
|
+ break;
|
|
|
+ case CREATE_ORDER_DETAIL:
|
|
|
+ this.oladingCreateOrderDetail(requestId, Enum.valueOf(OladingCommonRequest.RemitStatusStatus.class, status));
|
|
|
+ // 打款订单
|
|
|
+ break;
|
|
|
default:
|
|
|
+ throw new ValidateCodeException("回调方法处理不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 创建代付订单回调处理
|
|
|
+ *
|
|
|
+ * @param requestId 流水号
|
|
|
+ * @param status 受理状态
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void oladingCreateOrderDetail(String requestId, OladingCommonRequest.RemitStatusStatus status) {
|
|
|
+
|
|
|
+ int yaoyiStatus;
|
|
|
+ switch (status){
|
|
|
+ case REMIT:
|
|
|
+ yaoyiStatus = 1;
|
|
|
+ break;
|
|
|
+ case FAIL:
|
|
|
+ yaoyiStatus = 2;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ log.error("订单状态错误:{}", status);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<WmScorePackageSettleNote> noteList = scorePackageSettleNoteService.list(Wrappers.<WmScorePackageSettleNote>lambdaQuery().eq(WmScorePackageSettleNote::getStreamId, requestId));
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(noteList)) {
|
|
|
+
|
|
|
+ log.warn("阿拉钉内部打款:{}", requestId);
|
|
|
+
|
|
|
+ List<WmScorePackageSettleNote> updateList = noteList.stream().map(note -> {
|
|
|
+ WmScorePackageSettleNote updateEntity = new WmScorePackageSettleNote();
|
|
|
+ updateEntity.setId(note.getId());
|
|
|
+ updateEntity.setSettleNoteStatus(yaoyiStatus);
|
|
|
+ updateEntity.setNotifyTime(LocalDateTime.now());
|
|
|
+ return updateEntity;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ scorePackageSettleNoteService.updateBatchById(updateList);
|
|
|
+
|
|
|
+ WmScorePackageSettleNote tmp = noteList.get(0);
|
|
|
+ WmScorePackage scorePackage = scorePackageService.getById(tmp.getPackageId());
|
|
|
+
|
|
|
+ // 遥领不修改
|
|
|
+ if (!"1611890566".equals(scorePackage.getSendPackageDeptId())) {
|
|
|
+ // 更新积分包状态
|
|
|
+ log.info("更新积分包状态:{}", tmp);
|
|
|
+ WmScorePackage wmScorePackage = new WmScorePackage();
|
|
|
+ wmScorePackage.setId(tmp.getPackageId());
|
|
|
+ wmScorePackage.setSettleStatus(yaoyiStatus);
|
|
|
+ wmScorePackage.setUpdateTime(LocalDateTime.now());
|
|
|
+ scorePackageService.updateById(wmScorePackage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建代付订单回调处理
|
|
|
+ *
|
|
|
+ * @param requestId 流水号
|
|
|
+ * @param status 受理状态
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void oladingCreateOrderV2(String requestId, OladingCommonRequest.CreateOrderV2Status status, Map<String, Object> data) {
|
|
|
+
|
|
|
+ boolean accept = OladingCommonRequest.CreateOrderV2Status.ACCEPT.equals(status);
|
|
|
+
|
|
|
+ int yaoyiStatus;
|
|
|
+ if (!accept) {
|
|
|
+ yaoyiStatus = 2;
|
|
|
+ } else {
|
|
|
+ List<Map<String, Object>> orderList = (List<Map<String, Object>>) data.get("remit_order_list");
|
|
|
+ Map<String, Object> o = orderList.get(0);
|
|
|
+ String remitStatue = (String) o.get("remit_status");
|
|
|
+ OladingCommonRequest.RemitStatusStatus remitStatusStatus = Enum.valueOf(OladingCommonRequest.RemitStatusStatus.class, remitStatue);
|
|
|
+ switch (remitStatusStatus){
|
|
|
+ case REMIT:
|
|
|
+ yaoyiStatus = 1;
|
|
|
+ break;
|
|
|
+ case FAIL:
|
|
|
+ yaoyiStatus = 2;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<WmScorePackageSettleNote> noteList = scorePackageSettleNoteService.list(Wrappers.<WmScorePackageSettleNote>lambdaQuery().eq(WmScorePackageSettleNote::getStreamId, requestId));
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(noteList)) {
|
|
|
+
|
|
|
+ log.warn("阿拉丁创建代付订单:{}", requestId);
|
|
|
+
|
|
|
+ List<WmScorePackageSettleNote> updateList = noteList.stream().map(note -> {
|
|
|
+ WmScorePackageSettleNote updateEntity = new WmScorePackageSettleNote();
|
|
|
+ updateEntity.setId(note.getId());
|
|
|
+ updateEntity.setSettleNoteStatus(yaoyiStatus);
|
|
|
+ updateEntity.setNotifyTime(LocalDateTime.now());
|
|
|
+ return updateEntity;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ scorePackageSettleNoteService.updateBatchById(updateList);
|
|
|
+
|
|
|
+ WmScorePackageSettleNote tmp = noteList.get(0);
|
|
|
+ WmScorePackage scorePackage = scorePackageService.getById(tmp.getPackageId());
|
|
|
+
|
|
|
+ // 遥领不修改
|
|
|
+ if (!"1611890566".equals(scorePackage.getSendPackageDeptId())) {
|
|
|
+ // 更新积分包状态
|
|
|
+ log.info("更新积分包状态:{}", tmp);
|
|
|
+ WmScorePackage wmScorePackage = new WmScorePackage();
|
|
|
+ wmScorePackage.setId(tmp.getPackageId());
|
|
|
+ wmScorePackage.setSettleStatus(yaoyiStatus);
|
|
|
+ wmScorePackage.setUpdateTime(LocalDateTime.now());
|
|
|
+ scorePackageService.updateById(wmScorePackage);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 自由职家签约结果回调
|
|
|
*
|