|
@@ -14,11 +14,7 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
|
import com.qunzhixinxi.hnqz.admin.config.TaxNotifyConfig;
|
|
|
import com.qunzhixinxi.hnqz.admin.config.UpmsConfig;
|
|
|
-import com.qunzhixinxi.hnqz.admin.entity.HuiqiyunInputRecord;
|
|
|
-import com.qunzhixinxi.hnqz.admin.entity.SysDeptSub;
|
|
|
-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.*;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.dto.UserSignCertDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.DelEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.GigCallBackStatus;
|
|
@@ -27,6 +23,7 @@ import com.qunzhixinxi.hnqz.admin.enums.SubjectLocation;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.SubjectTypeEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.ZhongYiYunCertStatus;
|
|
|
import com.qunzhixinxi.hnqz.admin.event.OladingFinishTaskEvent;
|
|
|
+import com.qunzhixinxi.hnqz.admin.mapper.QifuInputRecordMapper;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.HuiqiyunInputRecordService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.SysDeptSubService;
|
|
@@ -87,6 +84,107 @@ public class GigThirdApiServiceImpl implements GigThirdApiService {
|
|
|
|
|
|
private final HuiqiyunInputRecordService huiqiyunInputRecordService;
|
|
|
|
|
|
+ private final QifuInputRecordMapper qifuInputRecordMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 福建企赋回调业务处理
|
|
|
+ *
|
|
|
+ * @param reqMsgId 报文流水号
|
|
|
+ * @param reqBody 请求总的body
|
|
|
+ * @param inputId 记录id
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean qifuNotify(String reqMsgId, JSONObject reqBody, Integer inputId) {
|
|
|
+
|
|
|
+ // 查询privateKey
|
|
|
+ List<SysDeptSub> deptSubList = sysDeptSubService.list(Wrappers.<SysDeptSub>lambdaQuery()
|
|
|
+ .eq(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode())
|
|
|
+ .eq(SysDeptSub::getSubjectLocation, SubjectLocation.QI_FU)
|
|
|
+ .isNotNull(SysDeptSub::getAppSecret));
|
|
|
+ if (CollUtil.isEmpty(deptSubList)) {
|
|
|
+ log.warn("汇企云privateKey不存在");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解密body
|
|
|
+ Map<String, Object> decryptData = this.decryptData(reqBody, deptSubList.get(0).getAppSecret());
|
|
|
+ log.info("汇企云解密后body={}", decryptData);
|
|
|
+
|
|
|
+ // 保存解密后的body
|
|
|
+ QifuInputRecord inputRecord = new QifuInputRecord();
|
|
|
+ inputRecord.setId(inputId);
|
|
|
+ inputRecord.setDecryptBody(JSONUtil.toJsonStr(decryptData));
|
|
|
+ qifuInputRecordMapper.updateById(inputRecord);
|
|
|
+
|
|
|
+ // 内层body
|
|
|
+ String bodyStr = (String) decryptData.get("body");
|
|
|
+ JSONObject bodyJson = JSONUtil.parseObj(bodyStr);
|
|
|
+
|
|
|
+ // 批次出款流水号
|
|
|
+ String batchNo = bodyJson.getStr("batchNo");
|
|
|
+ // 批次成功总笔数
|
|
|
+ Integer totalSuccessNum = bodyJson.getInt("totalSuccessNum");
|
|
|
+ // 批次成功总金额
|
|
|
+ String totalSuccessAmt = bodyJson.getStr("totalSuccessAmt");
|
|
|
+ // 批次失败总笔数
|
|
|
+ Integer totalFailNum = bodyJson.getInt("totalFailNum");
|
|
|
+ // 批次失败总金额
|
|
|
+ String totalFailAmt = bodyJson.getStr("totalFailAmt");
|
|
|
+ // 批次请求总笔数
|
|
|
+ Integer totalNum = bodyJson.getInt("totalNum");
|
|
|
+ // 批次请求总金额
|
|
|
+ String totalAmt = bodyJson.getStr("totalAmt");
|
|
|
+
|
|
|
+ int yaoyiStatus;
|
|
|
+ if (totalSuccessNum.equals(totalNum)) {
|
|
|
+ // 批次成功笔数=批次总笔数,则认为是成功
|
|
|
+ yaoyiStatus = 1;
|
|
|
+ } else {
|
|
|
+ yaoyiStatus = 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据orderNo查询结算单
|
|
|
+ List<WmScorePackageSettleNote> settleNoteList = scorePackageSettleNoteService.list(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
|
|
|
+ .eq(WmScorePackageSettleNote::getStreamId, batchNo));
|
|
|
+ if (CollUtil.isEmpty(settleNoteList)) {
|
|
|
+ log.warn("订单batchNo={}对应结算单不存在", batchNo);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 修改结算状态
|
|
|
+ List<WmScorePackageSettleNote> updateList = settleNoteList.stream().map(note -> {
|
|
|
+ WmScorePackageSettleNote updateEntity = new WmScorePackageSettleNote();
|
|
|
+ updateEntity.setId(note.getId());
|
|
|
+ updateEntity.setSettleNoteStatus(yaoyiStatus);
|
|
|
+ if (yaoyiStatus == 1){
|
|
|
+ updateEntity.setNotifyTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ updateEntity.setUpdateTime(LocalDateTime.now());
|
|
|
+ return updateEntity;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ scorePackageSettleNoteService.updateBatchById(updateList);
|
|
|
+
|
|
|
+ WmScorePackageSettleNote tmp = settleNoteList.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);
|
|
|
+ }
|
|
|
+
|
|
|
+ redisTemplate.delete(CacheConstants.SETTLE_PACKAGE_KEY + tmp.getId());
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 中智结算回调业务处理
|
|
|
*
|