|
|
|
@ -191,100 +191,99 @@ public class Merchant { |
|
|
|
|
List<BsMerContractRecord> list = merContractRecordService.getContractRecordList(param); |
|
|
|
|
for (BsMerContractRecord contractRecord : list) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
BsMer mer = merService.getMer(contractRecord.getMerId()); |
|
|
|
|
if (mer != null && mer.getMerStatus().equals(MerStatusEnum.status3.getNumber())) { |
|
|
|
|
|
|
|
|
|
BsMerPlatformNo platform = merPlatformNoService.getPlatformNo(mer.getId(), PlatformTypeEnum.type1); |
|
|
|
|
if (platform != null) { |
|
|
|
|
JSONObject merchantInfo = saasMerService.merchantInfo(platform.getPlatformNo()); |
|
|
|
|
// 查询申请记录
|
|
|
|
|
BsMerContractRecordMsg msg = new BsMerContractRecordMsg(); |
|
|
|
|
msg.setOrderNo(contractRecord.getOrderNo()); |
|
|
|
|
msg.setType(1); |
|
|
|
|
msg.setResponseContent(merchantInfo.toJSONString()); |
|
|
|
|
merContractRecordMsgService.insertRecordMsg(msg); |
|
|
|
|
|
|
|
|
|
JSONObject customer = merchantInfo.getJSONObject("customer"); |
|
|
|
|
// 商户状态 OPEN:开通,CLOSE:关闭,LOSS:流失, REJECT:拒绝。可用值:OPEN,ACTIVITY,WAIT_COMMIT,WAIT_AUDI,REJECT, CLOSE,INIT
|
|
|
|
|
if (customer.getString("customerStatus").equals("OPEN")) { |
|
|
|
|
contractRecord.setStatus(2); |
|
|
|
|
merContractRecordService.updateRecord(contractRecord); |
|
|
|
|
|
|
|
|
|
mer.setMerStatus(MerStatusEnum.status1.getNumber()); |
|
|
|
|
merService.editMer(mer); |
|
|
|
|
|
|
|
|
|
List<BsStore> storeList = storeService.getStoreByMerId(mer.getId(), StoreCreateTypeEnum.type1); |
|
|
|
|
if (storeList.size() > 0) { |
|
|
|
|
BsStore store = storeList.get(0); |
|
|
|
|
store.setStatus(StoreStatusEnum.status2.getNumber()); |
|
|
|
|
storeService.editStore(store); |
|
|
|
|
} |
|
|
|
|
platform.setCupNo(customer.getString("externalCustomerNo")); |
|
|
|
|
merPlatformNoService.editMerPlatformNo(platform); |
|
|
|
|
|
|
|
|
|
// 终端信息
|
|
|
|
|
BsMerPlatformTerm term = new BsMerPlatformTerm(); |
|
|
|
|
term.setMerPlatformNoId(platform.getId()); |
|
|
|
|
term.setMerId(platform.getMerId()); |
|
|
|
|
term.setActiveNo(customer.getString("activeNo")); |
|
|
|
|
term.setBusiTypeCode(customer.getString("bzPos")); |
|
|
|
|
term.setBusiTypeName("码牌"); |
|
|
|
|
term.setProductCode(customer.getString("bzPos")); |
|
|
|
|
term.setProductName("码牌"); |
|
|
|
|
term.setTermNo(customer.getString("termNo")); |
|
|
|
|
merPlatformTermService.editMerPlatformTerm(term); |
|
|
|
|
|
|
|
|
|
JSONArray terminalList = merchantInfo.getJSONArray("terminalInfo"); |
|
|
|
|
for (Object terminalObj : terminalList) { |
|
|
|
|
JSONObject terminal = (JSONObject) terminalObj; |
|
|
|
|
// 终端编号
|
|
|
|
|
JSONArray termNoList = terminal.getJSONArray("termNoList"); |
|
|
|
|
for (Object termNo : termNoList) { |
|
|
|
|
term = new BsMerPlatformTerm(); |
|
|
|
|
term.setMerPlatformNoId(platform.getId()); |
|
|
|
|
term.setMerId(platform.getMerId()); |
|
|
|
|
term.setActiveNo(customer.getString("activeNo")); |
|
|
|
|
term.setBusiTypeCode(terminal.getString("termTypeCode")); |
|
|
|
|
term.setBusiTypeName(terminal.getString("termTypeName")); |
|
|
|
|
term.setProductCode(terminal.getString("termTypeCode")); |
|
|
|
|
term.setProductName(terminal.getString("termTypeName")); |
|
|
|
|
term.setTermId(terminal.getString("coreTermId")); |
|
|
|
|
term.setTermNo(termNo.toString()); |
|
|
|
|
merPlatformTermService.editMerPlatformTerm(term); |
|
|
|
|
if (contractRecord.getPlatformType().equals(PlatformTypeEnum.type1.getNumber())) { |
|
|
|
|
BsMerPlatformNo platform = merPlatformNoService.getPlatformNo(mer.getId(), PlatformTypeEnum.type1); |
|
|
|
|
if (platform != null) { |
|
|
|
|
JSONObject merchantInfo = saasMerService.merchantInfo(platform.getPlatformNo()); |
|
|
|
|
// 查询申请记录
|
|
|
|
|
BsMerContractRecordMsg msg = new BsMerContractRecordMsg(); |
|
|
|
|
msg.setOrderNo(contractRecord.getOrderNo()); |
|
|
|
|
msg.setType(1); |
|
|
|
|
msg.setResponseContent(merchantInfo.toJSONString()); |
|
|
|
|
merContractRecordMsgService.insertRecordMsg(msg); |
|
|
|
|
|
|
|
|
|
JSONObject customer = merchantInfo.getJSONObject("customer"); |
|
|
|
|
// 商户状态 OPEN:开通,CLOSE:关闭,LOSS:流失, REJECT:拒绝。可用值:OPEN,ACTIVITY,WAIT_COMMIT,WAIT_AUDI,REJECT, CLOSE,INIT
|
|
|
|
|
if (customer.getString("customerStatus").equals("OPEN")) { |
|
|
|
|
contractRecord.setStatus(2); |
|
|
|
|
merContractRecordService.updateRecord(contractRecord); |
|
|
|
|
|
|
|
|
|
mer.setMerStatus(MerStatusEnum.status1.getNumber()); |
|
|
|
|
merService.editMer(mer); |
|
|
|
|
|
|
|
|
|
List<BsStore> storeList = storeService.getStoreByMerId(mer.getId(), StoreCreateTypeEnum.type1); |
|
|
|
|
if (storeList.size() > 0) { |
|
|
|
|
BsStore store = storeList.get(0); |
|
|
|
|
store.setStatus(StoreStatusEnum.status2.getNumber()); |
|
|
|
|
storeService.editStore(store); |
|
|
|
|
} |
|
|
|
|
platform.setCupNo(customer.getString("externalCustomerNo")); |
|
|
|
|
merPlatformNoService.editMerPlatformNo(platform); |
|
|
|
|
|
|
|
|
|
// 终端信息
|
|
|
|
|
BsMerPlatformTerm term = new BsMerPlatformTerm(); |
|
|
|
|
term.setMerPlatformNoId(platform.getId()); |
|
|
|
|
term.setMerId(platform.getMerId()); |
|
|
|
|
term.setActiveNo(customer.getString("activeNo")); |
|
|
|
|
term.setBusiTypeCode(customer.getString("bzPos")); |
|
|
|
|
term.setBusiTypeName("码牌"); |
|
|
|
|
term.setProductCode(customer.getString("bzPos")); |
|
|
|
|
term.setProductName("码牌"); |
|
|
|
|
term.setTermNo(customer.getString("termNo")); |
|
|
|
|
merPlatformTermService.editMerPlatformTerm(term); |
|
|
|
|
|
|
|
|
|
JSONArray terminalList = merchantInfo.getJSONArray("terminalInfo"); |
|
|
|
|
for (Object terminalObj : terminalList) { |
|
|
|
|
JSONObject terminal = (JSONObject) terminalObj; |
|
|
|
|
// 终端编号
|
|
|
|
|
JSONArray termNoList = terminal.getJSONArray("termNoList"); |
|
|
|
|
for (Object termNo : termNoList) { |
|
|
|
|
term = new BsMerPlatformTerm(); |
|
|
|
|
term.setMerPlatformNoId(platform.getId()); |
|
|
|
|
term.setMerId(platform.getMerId()); |
|
|
|
|
term.setActiveNo(customer.getString("activeNo")); |
|
|
|
|
term.setBusiTypeCode(terminal.getString("termTypeCode")); |
|
|
|
|
term.setBusiTypeName(terminal.getString("termTypeName")); |
|
|
|
|
term.setProductCode(terminal.getString("termTypeCode")); |
|
|
|
|
term.setProductName(terminal.getString("termTypeName")); |
|
|
|
|
term.setTermId(terminal.getString("coreTermId")); |
|
|
|
|
term.setTermNo(termNo.toString()); |
|
|
|
|
merPlatformTermService.editMerPlatformTerm(term); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BsMerPlatformNo merPlatform = merPlatformNoService.getPlatformNo(mer.getId(), PlatformTypeEnum.type1); |
|
|
|
|
|
|
|
|
|
BsMerLedger merLedger = merLedgerService.getMerLedger(mer.getId(), PlatformTypeEnum.type1); |
|
|
|
|
if (merLedger == null) { |
|
|
|
|
merLedger = new BsMerLedger(); |
|
|
|
|
merLedger.setMerId(mer.getId()); |
|
|
|
|
merLedger.setMerName(mer.getMerName()); |
|
|
|
|
merLedger.setPlatformType(merPlatform.getPlatformType()); |
|
|
|
|
merLedger.setPlatformNo(merPlatform.getPlatformNo()); |
|
|
|
|
merLedger.setCupNo(merPlatform.getCupNo()); |
|
|
|
|
merLedger.setStatus(MerLedgerStatusEnum.status4.getNumber()); |
|
|
|
|
merLedger.setReceiverStatus(false); |
|
|
|
|
merLedgerService.editMerLedger(merLedger); |
|
|
|
|
|
|
|
|
|
laKaLaLedgerService.applyLedgerReceiver(merLedger.getMerId()); |
|
|
|
|
BsMerPlatformNo merPlatform = merPlatformNoService.getPlatformNo(mer.getId(), PlatformTypeEnum.type1); |
|
|
|
|
|
|
|
|
|
BsMerLedger merLedger = merLedgerService.getMerLedger(mer.getId(), PlatformTypeEnum.type1); |
|
|
|
|
if (merLedger == null) { |
|
|
|
|
merLedger = new BsMerLedger(); |
|
|
|
|
merLedger.setMerId(mer.getId()); |
|
|
|
|
merLedger.setMerName(mer.getMerName()); |
|
|
|
|
merLedger.setPlatformType(merPlatform.getPlatformType()); |
|
|
|
|
merLedger.setPlatformNo(merPlatform.getPlatformNo()); |
|
|
|
|
merLedger.setCupNo(merPlatform.getCupNo()); |
|
|
|
|
merLedger.setStatus(MerLedgerStatusEnum.status4.getNumber()); |
|
|
|
|
merLedger.setReceiverStatus(false); |
|
|
|
|
merLedgerService.editMerLedger(merLedger); |
|
|
|
|
|
|
|
|
|
laKaLaLedgerService.applyLedgerReceiver(merLedger.getMerId()); |
|
|
|
|
} |
|
|
|
|
} else if (customer.getString("customerStatus").equals("REJECT")) { |
|
|
|
|
contractRecord.setStatus(3); |
|
|
|
|
merContractRecordService.updateRecord(contractRecord); |
|
|
|
|
|
|
|
|
|
mer.setMerStatus(MerStatusEnum.status4.getNumber()); |
|
|
|
|
merService.editMer(mer); |
|
|
|
|
|
|
|
|
|
BsMerContractRecordMsg merContractRecordMsg = new BsMerContractRecordMsg(); |
|
|
|
|
merContractRecordMsg.setOrderNo(contractRecord.getOrderNo()); |
|
|
|
|
merContractRecordMsg.setType(1); |
|
|
|
|
merContractRecordMsg.setResponseCode(customer.getString("customerStatus")); |
|
|
|
|
merContractRecordMsg.setResponseMsg(customer.getString("auditRemark")); |
|
|
|
|
merContractRecordMsgService.insertRecordMsg(merContractRecordMsg); |
|
|
|
|
} |
|
|
|
|
} else if (customer.getString("customerStatus").equals("REJECT")) { |
|
|
|
|
contractRecord.setStatus(3); |
|
|
|
|
merContractRecordService.updateRecord(contractRecord); |
|
|
|
|
|
|
|
|
|
mer.setMerStatus(MerStatusEnum.status4.getNumber()); |
|
|
|
|
merService.editMer(mer); |
|
|
|
|
|
|
|
|
|
BsMerContractRecordMsg merContractRecordMsg = new BsMerContractRecordMsg(); |
|
|
|
|
merContractRecordMsg.setOrderNo(contractRecord.getOrderNo()); |
|
|
|
|
merContractRecordMsg.setType(1); |
|
|
|
|
merContractRecordMsg.setResponseCode(customer.getString("customerStatus")); |
|
|
|
|
merContractRecordMsg.setResponseMsg(customer.getString("auditRemark")); |
|
|
|
|
merContractRecordMsg.setResponseMsg(customer.getString("auditRemark")); |
|
|
|
|
merContractRecordMsgService.insertRecordMsg(merContractRecordMsg); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|