|
|
@ -16,6 +16,7 @@ import com.hfkj.model.MerBasisModel; |
|
|
|
import com.hfkj.service.*; |
|
|
|
import com.hfkj.service.*; |
|
|
|
import com.hfkj.sysenum.*; |
|
|
|
import com.hfkj.sysenum.*; |
|
|
|
import com.hfkj.sysenum.lakala.UploadFileTypeEnum; |
|
|
|
import com.hfkj.sysenum.lakala.UploadFileTypeEnum; |
|
|
|
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
@ -38,6 +39,8 @@ public class LaKaLaLedgerService { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private BsMerLedgerReceiverService merLedgerReceiverService; |
|
|
|
private BsMerLedgerReceiverService merLedgerReceiverService; |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsMerLedgerReceiverApplyService merLedgerReceiverApplyService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private BsMerService merService; |
|
|
|
private BsMerService merService; |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private BsMerAttachService merAttachService; |
|
|
|
private BsMerAttachService merAttachService; |
|
|
@ -50,11 +53,11 @@ public class LaKaLaLedgerService { |
|
|
|
public JSONObject applyLedger(Long merLedgerId) { |
|
|
|
public JSONObject applyLedger(Long merLedgerId) { |
|
|
|
//
|
|
|
|
//
|
|
|
|
BsMerLedger merLedger = merLedgerService.getMerLedgerById(merLedgerId); |
|
|
|
BsMerLedger merLedger = merLedgerService.getMerLedgerById(merLedgerId); |
|
|
|
if (merLedger == null || merLedger.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) { |
|
|
|
if (merLedger == null || !merLedger.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
// 商户
|
|
|
|
// 商户
|
|
|
|
MerBasisModel merDetail = merService.getMerDetail(merLedger.getId()); |
|
|
|
MerBasisModel merDetail = merService.getMerDetail(merLedger.getMerId()); |
|
|
|
if (merDetail == null) { |
|
|
|
if (merDetail == null) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); |
|
|
|
} |
|
|
|
} |
|
|
@ -74,11 +77,11 @@ public class LaKaLaLedgerService { |
|
|
|
map.put("splitLowestRatio", merLedger.getSplitLowestRatio()); |
|
|
|
map.put("splitLowestRatio", merLedger.getSplitLowestRatio()); |
|
|
|
map.put("splitEntrustFileName", merLedger.getSplitEntrustFileName()); |
|
|
|
map.put("splitEntrustFileName", merLedger.getSplitEntrustFileName()); |
|
|
|
// 转换成bas64
|
|
|
|
// 转换成bas64
|
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url() + "/"+ merLedger.getSplitEntrustFilePath()); |
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url()+merLedger.getSplitEntrustFilePath()); |
|
|
|
String fileType = merLedger.getSplitEntrustFilePath().substring(merLedger.getSplitEntrustFilePath().lastIndexOf(".") + 1); |
|
|
|
String fileType = merLedger.getSplitEntrustFilePath().substring(merLedger.getSplitEntrustFilePath().lastIndexOf(".") + 1); |
|
|
|
map.put("splitEntrustFilePath", LaKaLaConfig.uploadFile("COOPERATION_QUALIFICATION_PROOF", fileType, base64ImgUrl).getString("attFileId")); |
|
|
|
map.put("splitEntrustFilePath", LaKaLaConfig.uploadFile("COOPERATION_QUALIFICATION_PROOF", fileType, base64ImgUrl).getString("attFileId")); |
|
|
|
map.put("splitRange", "MARK"); |
|
|
|
map.put("splitRange", "MARK"); |
|
|
|
map.put("retUrl", CommonSysConst.getSysConfig() + "/crest/laKaLaNotify/applyLedgerMer"); |
|
|
|
map.put("retUrl", CommonSysConst.getSysConfig().getDomainName() + "/crest/laKaLaNotify/applyLedgerMer"); |
|
|
|
commonParam.put("reqData", map); |
|
|
|
commonParam.put("reqData", map); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(commonParam))); |
|
|
|
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(commonParam))); |
|
|
@ -96,19 +99,16 @@ public class LaKaLaLedgerService { |
|
|
|
merLedgerApply.setMerId(merLedger.getId()); |
|
|
|
merLedgerApply.setMerId(merLedger.getId()); |
|
|
|
merLedgerApply.setOrderNo(orderNo); |
|
|
|
merLedgerApply.setOrderNo(orderNo); |
|
|
|
merLedgerApply.setRequestBody(JSONObject.toJSONString(requestMap)); |
|
|
|
merLedgerApply.setRequestBody(JSONObject.toJSONString(requestMap)); |
|
|
|
merLedgerApplyService.editMerLedgerApply(merLedgerApply); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/mms/openApi/ledger/applyLedgerMer", commonParam, heard); |
|
|
|
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/mms/openApi/ledger/applyLedgerMer", commonParam, heard); |
|
|
|
|
|
|
|
if (!responseBody.getString("retCode").equals("000000")) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); |
|
|
|
|
|
|
|
} |
|
|
|
System.out.println("body:" + JSONObject.toJSONString(commonParam)); |
|
|
|
System.out.println("body:" + JSONObject.toJSONString(commonParam)); |
|
|
|
System.out.println("response:" + responseBody.toJSONString()); |
|
|
|
System.out.println("response:" + responseBody.toJSONString()); |
|
|
|
merLedgerApply.setApplyId(responseBody.getJSONObject("respData").getString("applyId")); |
|
|
|
merLedgerApply.setApplyId(responseBody.getJSONObject("respData").getString("applyId")); |
|
|
|
merLedgerApply.setResponseBody(responseBody.toJSONString()); |
|
|
|
merLedgerApply.setResponseBody(responseBody.toJSONString()); |
|
|
|
merLedgerApplyService.editMerLedgerApply(merLedgerApply); |
|
|
|
merLedgerApplyService.editMerLedgerApply(merLedgerApply); |
|
|
|
|
|
|
|
|
|
|
|
if (!responseBody.getString("retCode").equals("000000")) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return responseBody; |
|
|
|
return responseBody; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -262,7 +262,7 @@ public class LaKaLaLedgerService { |
|
|
|
attachMap = new HashMap<>(); |
|
|
|
attachMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
// 转换成bas64
|
|
|
|
// 转换成bas64
|
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url() + "/"+ attach.getFileUrl()); |
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url()+"/"+attach.getFileUrl()); |
|
|
|
String fileType = attach.getFileUrl().substring(attach.getFileUrl().lastIndexOf(".") + 1); |
|
|
|
String fileType = attach.getFileUrl().substring(attach.getFileUrl().lastIndexOf(".") + 1); |
|
|
|
attachMap.put("attachType", attachType.getLklCode()); |
|
|
|
attachMap.put("attachType", attachType.getLklCode()); |
|
|
|
attachMap.put("attachName", attachType.getName()); |
|
|
|
attachMap.put("attachName", attachType.getName()); |
|
|
@ -297,9 +297,8 @@ public class LaKaLaLedgerService { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 绑定分账关系 |
|
|
|
* 绑定分账关系 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void applyBind(Long merId,String receiverNo) { |
|
|
|
public void applyBind(BsMerLedgerReceiver merLedgerReceiver) { |
|
|
|
// 查询
|
|
|
|
// 查询
|
|
|
|
BsMerLedgerReceiver merLedgerReceiver = merLedgerReceiverService.getMerLedgerReceiver(merId, receiverNo); |
|
|
|
|
|
|
|
if (merLedgerReceiver == null) { |
|
|
|
if (merLedgerReceiver == null) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到分账关系"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到分账关系"); |
|
|
|
} |
|
|
|
} |
|
|
@ -315,11 +314,11 @@ public class LaKaLaLedgerService { |
|
|
|
map.put("merCupNo", merLedgerReceiver.getCupNo()); |
|
|
|
map.put("merCupNo", merLedgerReceiver.getCupNo()); |
|
|
|
map.put("receiverNo", merLedgerReceiver.getReceiverNo()); |
|
|
|
map.put("receiverNo", merLedgerReceiver.getReceiverNo()); |
|
|
|
|
|
|
|
|
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url() + "/"+ merLedgerReceiver.getEntrustFilePath()); |
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url()+merLedgerReceiver.getEntrustFilePath()); |
|
|
|
String fileType = merLedgerReceiver.getEntrustFilePath().substring(merLedgerReceiver.getEntrustFilePath().lastIndexOf(".") + 1); |
|
|
|
String fileType = merLedgerReceiver.getEntrustFilePath().substring(merLedgerReceiver.getEntrustFilePath().lastIndexOf(".") + 1); |
|
|
|
map.put("entrustFileName", merLedgerReceiver.getEntrustFileName()); |
|
|
|
map.put("entrustFileName", merLedgerReceiver.getEntrustFileName()); |
|
|
|
map.put("entrustFilePath", LaKaLaConfig.uploadFile("COOPERATION_QUALIFICATION_PROOF", fileType, base64ImgUrl).getString("attFileId")); |
|
|
|
map.put("entrustFilePath", LaKaLaConfig.uploadFile("COOPERATION_QUALIFICATION_PROOF", fileType, base64ImgUrl).getString("attFileId")); |
|
|
|
map.put("retUrl", CommonSysConst.getSysConfig().getDomainName()+"/crest/laKaLaNotify/applyLedgerMer"); |
|
|
|
map.put("retUrl", CommonSysConst.getSysConfig().getDomainName()+"/crest/laKaLaNotify/applyBindReceiver"); |
|
|
|
commonParam.put("reqData", map); |
|
|
|
commonParam.put("reqData", map); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(commonParam))); |
|
|
|
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(commonParam))); |
|
|
@ -333,8 +332,21 @@ public class LaKaLaLedgerService { |
|
|
|
if (!responseBody.getString("retCode").equals("000000")) { |
|
|
|
if (!responseBody.getString("retCode").equals("000000")) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); |
|
|
|
} |
|
|
|
} |
|
|
|
merLedgerReceiver.setStatus(MerLedgerStatusEnum.status1.getNumber()); |
|
|
|
merLedgerReceiver.setStatus(MerLedgerReceiverStatusEnum.status2.getNumber()); |
|
|
|
|
|
|
|
merLedgerReceiver.setAuditStatus(MerLedgerReceiverAuditStatusEnum.status1.getNumber()); |
|
|
|
|
|
|
|
merLedgerReceiverService.editMerLedgerReceiver(merLedgerReceiver); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BsMerLedgerReceiverApply ledgerReceiverApply = new BsMerLedgerReceiverApply(); |
|
|
|
|
|
|
|
ledgerReceiverApply.setMerId(merLedgerReceiver.getMerId()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setMerLedgerId(merLedgerReceiver.getMerLedgerId()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setMerLedgerReceiverId(merLedgerReceiver.getId()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setReceiverNo(merLedgerReceiver.getReceiverNo()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setOrderNo(MapUtils.getString(map,"orderNo")); |
|
|
|
|
|
|
|
ledgerReceiverApply.setApplyId(responseBody.getJSONObject("respData").getString("applyId")); |
|
|
|
|
|
|
|
ledgerReceiverApply.setRequestBody(JSONObject.toJSONString(commonParam)); |
|
|
|
|
|
|
|
ledgerReceiverApply.setResponseBody(responseBody.toJSONString()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setStatus(MerLedgerReceiverApplyStatusEnum.status1.getNumber()); |
|
|
|
|
|
|
|
merLedgerReceiverApplyService.editReceiverApply(ledgerReceiverApply); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -355,15 +367,13 @@ public class LaKaLaLedgerService { |
|
|
|
map.put("version", "1.0"); |
|
|
|
map.put("version", "1.0"); |
|
|
|
map.put("orderNo", System.currentTimeMillis()+""); |
|
|
|
map.put("orderNo", System.currentTimeMillis()+""); |
|
|
|
map.put("orgCode", "1"); |
|
|
|
map.put("orgCode", "1"); |
|
|
|
map.put("merCupNo", "8226900581208NT"); |
|
|
|
map.put("merCupNo", merLedgerReceiver.getCupNo()); |
|
|
|
map.put("receiverNo", ""); |
|
|
|
map.put("receiverNo", merLedgerReceiver.getReceiverNo()); |
|
|
|
map.put("entrustFileName", "123"); |
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url() + merLedgerReceiver.getRelieveEntrustFilePath()); |
|
|
|
|
|
|
|
String fileType = merLedgerReceiver.getRelieveEntrustFilePath().substring(merLedgerReceiver.getRelieveEntrustFilePath().lastIndexOf(".") + 1); |
|
|
|
String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url() + "/"+ merLedgerReceiver.getEntrustFilePath()); |
|
|
|
map.put("entrustFileName", merLedgerReceiver.getRelieveEntrustFileName()); |
|
|
|
String fileType = merLedgerReceiver.getEntrustFilePath().substring(merLedgerReceiver.getEntrustFilePath().lastIndexOf(".") + 1); |
|
|
|
|
|
|
|
map.put("entrustFileName", merLedgerReceiver.getEntrustFileName()); |
|
|
|
|
|
|
|
map.put("entrustFilePath", LaKaLaConfig.uploadFile("COOPERATION_QUALIFICATION_PROOF", fileType, base64ImgUrl).getString("attFileId")); |
|
|
|
map.put("entrustFilePath", LaKaLaConfig.uploadFile("COOPERATION_QUALIFICATION_PROOF", fileType, base64ImgUrl).getString("attFileId")); |
|
|
|
map.put("retUrl", "123"); |
|
|
|
map.put("retUrl", CommonSysConst.getSysConfig().getDomainName()+"/crest/laKaLaNotify/applyBindUnReceiver"); |
|
|
|
commonParam.put("reqData", map); |
|
|
|
commonParam.put("reqData", map); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(commonParam))); |
|
|
|
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(commonParam))); |
|
|
@ -377,6 +387,20 @@ public class LaKaLaLedgerService { |
|
|
|
if (!responseBody.getString("retCode").equals("000000")) { |
|
|
|
if (!responseBody.getString("retCode").equals("000000")) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
merLedgerReceiver.setAuditStatus(MerLedgerReceiverAuditStatusEnum.status4.getNumber()); |
|
|
|
|
|
|
|
merLedgerReceiverService.editMerLedgerReceiver(merLedgerReceiver); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BsMerLedgerReceiverApply ledgerReceiverApply = new BsMerLedgerReceiverApply(); |
|
|
|
|
|
|
|
ledgerReceiverApply.setMerId(merLedgerReceiver.getMerId()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setMerLedgerId(merLedgerReceiver.getMerLedgerId()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setMerLedgerReceiverId(merLedgerReceiver.getId()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setReceiverNo(merLedgerReceiver.getReceiverNo()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setOrderNo(MapUtils.getString(map,"orderNo")); |
|
|
|
|
|
|
|
ledgerReceiverApply.setApplyId(responseBody.getJSONObject("respData").getString("applyId")); |
|
|
|
|
|
|
|
ledgerReceiverApply.setRequestBody(JSONObject.toJSONString(commonParam)); |
|
|
|
|
|
|
|
ledgerReceiverApply.setResponseBody(responseBody.toJSONString()); |
|
|
|
|
|
|
|
ledgerReceiverApply.setStatus(MerLedgerReceiverApplyStatusEnum.status1.getNumber()); |
|
|
|
|
|
|
|
merLedgerReceiverApplyService.editReceiverApply(ledgerReceiverApply); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|