@@ -19,6 +19,8 @@ public class FssBlackList extends StringUUIDEntity { | |||
/*** 下黑协议号*/ | |||
private String agreementNum; | |||
/*** 下黑协议号*/ | |||
private String agencyId; | |||
/*** 下黑的路网订单号*/ | |||
private String orderId; | |||
/*** 下黑的路网交易单号*/ | |||
@@ -42,7 +44,8 @@ public class FssBlackList extends StringUUIDEntity { | |||
} | |||
public FssBlackList(String agreementNum, String orderId, String payId, BlacklistOpType opType, Integer statusCode, | |||
String errorMsg, String requestStr, String responseStr, String reason, LocalDateTime insertTime) { | |||
String errorMsg, String requestStr, String responseStr, String reason, LocalDateTime insertTime, | |||
String agencyId) { | |||
this.agreementNum = agreementNum; | |||
this.orderId = orderId; | |||
this.payId = payId; | |||
@@ -53,6 +56,7 @@ public class FssBlackList extends StringUUIDEntity { | |||
this.responseStr = responseStr; | |||
this.reason = reason; | |||
this.insertTime = insertTime; | |||
this.agencyId = agencyId; | |||
} | |||
@Column(name = "agreement_num") | |||
@@ -145,4 +149,13 @@ public class FssBlackList extends StringUUIDEntity { | |||
public void setInsertTime(LocalDateTime insertTime) { | |||
this.insertTime = insertTime; | |||
} | |||
@Column(name = "agency_id") | |||
public String getAgencyId() { | |||
return agencyId; | |||
} | |||
public void setAgencyId(String agencyId) { | |||
this.agencyId = agencyId; | |||
} | |||
} |
@@ -0,0 +1,271 @@ | |||
package com.qtzl.alterSales.dao.entity.second; | |||
import cn.com.taiji.common.entity.StringUUIDEntity; | |||
import javax.persistence.Column; | |||
import javax.persistence.Entity; | |||
import javax.persistence.Table; | |||
import java.time.LocalDateTime; | |||
/*** | |||
* <p> | |||
* 渠道信息实体 | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/11/22 9:20 | |||
**/ | |||
@Entity | |||
@Table(name = "QTK_AGENCY") | |||
public class QtlAgency extends StringUUIDEntity { | |||
private String agencyId; | |||
private String type; | |||
private String name; | |||
private String contact; | |||
private String tel; | |||
private String taxPayercode; | |||
private String creditCode; | |||
private String address; | |||
private String info; | |||
private LocalDateTime createTime; | |||
private String issuerId; | |||
private String startTime; | |||
private String endTime; | |||
private String hgUsername; | |||
private String hgPassword; | |||
private String serialNo; | |||
private String issueNo; | |||
private String packageNo; | |||
private String accountNo; | |||
private String fileDir; | |||
private String accountId; | |||
private String agencyTransSendType; | |||
private String agencyTransInfoType; | |||
private String agencyTransFileType; | |||
private String orgCodeBlack; | |||
@Column(name = "AGENCY_ID") | |||
public String getAgencyId() { | |||
return agencyId; | |||
} | |||
public void setAgencyId(String agencyId) { | |||
this.agencyId = agencyId; | |||
} | |||
@Column(name = "TYPE") | |||
public String getType() { | |||
return type; | |||
} | |||
public void setType(String type) { | |||
this.type = type; | |||
} | |||
@Column(name = "NAME") | |||
public String getName() { | |||
return name; | |||
} | |||
public void setName(String name) { | |||
this.name = name; | |||
} | |||
@Column(name = "CONTACT") | |||
public String getContact() { | |||
return contact; | |||
} | |||
public void setContact(String contact) { | |||
this.contact = contact; | |||
} | |||
@Column(name = "TEL") | |||
public String getTel() { | |||
return tel; | |||
} | |||
public void setTel(String tel) { | |||
this.tel = tel; | |||
} | |||
@Column(name = "TAX_PAYERCODE") | |||
public String getTaxPayercode() { | |||
return taxPayercode; | |||
} | |||
public void setTaxPayercode(String taxPayercode) { | |||
this.taxPayercode = taxPayercode; | |||
} | |||
@Column(name = "CREDIT_CODE") | |||
public String getCreditCode() { | |||
return creditCode; | |||
} | |||
public void setCreditCode(String creditCode) { | |||
this.creditCode = creditCode; | |||
} | |||
@Column(name = "ADDRESS") | |||
public String getAddress() { | |||
return address; | |||
} | |||
public void setAddress(String address) { | |||
this.address = address; | |||
} | |||
@Column(name = "INFO") | |||
public String getInfo() { | |||
return info; | |||
} | |||
public void setInfo(String info) { | |||
this.info = info; | |||
} | |||
@Column(name = "CREATE_TIME") | |||
public LocalDateTime getCreateTime() { | |||
return createTime; | |||
} | |||
public void setCreateTime(LocalDateTime createTime) { | |||
this.createTime = createTime; | |||
} | |||
@Column(name = "ISSUER_ID") | |||
public String getIssuerId() { | |||
return issuerId; | |||
} | |||
public void setIssuerId(String issuerId) { | |||
this.issuerId = issuerId; | |||
} | |||
@Column(name = "START_TIME") | |||
public String getStartTime() { | |||
return startTime; | |||
} | |||
public void setStartTime(String startTime) { | |||
this.startTime = startTime; | |||
} | |||
@Column(name = "END_TIME") | |||
public String getEndTime() { | |||
return endTime; | |||
} | |||
public void setEndTime(String endTime) { | |||
this.endTime = endTime; | |||
} | |||
@Column(name = "HG_USERNAME") | |||
public String getHgUsername() { | |||
return hgUsername; | |||
} | |||
public void setHgUsername(String hgUsername) { | |||
this.hgUsername = hgUsername; | |||
} | |||
@Column(name = "HG_PASSWORD") | |||
public String getHgPassword() { | |||
return hgPassword; | |||
} | |||
public void setHgPassword(String hgPassword) { | |||
this.hgPassword = hgPassword; | |||
} | |||
@Column(name = "SERIAL_NO") | |||
public String getSerialNo() { | |||
return serialNo; | |||
} | |||
public void setSerialNo(String serialNo) { | |||
this.serialNo = serialNo; | |||
} | |||
@Column(name = "ISSUE_NO") | |||
public String getIssueNo() { | |||
return issueNo; | |||
} | |||
public void setIssueNo(String issueNo) { | |||
this.issueNo = issueNo; | |||
} | |||
@Column(name = "PACKAGE_NO") | |||
public String getPackageNo() { | |||
return packageNo; | |||
} | |||
public void setPackageNo(String packageNo) { | |||
this.packageNo = packageNo; | |||
} | |||
@Column(name = "ACCOUNT_NO") | |||
public String getAccountNo() { | |||
return accountNo; | |||
} | |||
public void setAccountNo(String accountNo) { | |||
this.accountNo = accountNo; | |||
} | |||
@Column(name = "FILE_DIR") | |||
public String getFileDir() { | |||
return fileDir; | |||
} | |||
public void setFileDir(String fileDir) { | |||
this.fileDir = fileDir; | |||
} | |||
@Column(name = "ACCOUNT_ID") | |||
public String getAccountId() { | |||
return accountId; | |||
} | |||
public void setAccountId(String accountId) { | |||
this.accountId = accountId; | |||
} | |||
@Column(name = "AGENCY_TRANS_SEND_TYPE") | |||
public String getAgencyTransSendType() { | |||
return agencyTransSendType; | |||
} | |||
public void setAgencyTransSendType(String agencyTransSendType) { | |||
this.agencyTransSendType = agencyTransSendType; | |||
} | |||
@Column(name = "AGENCY_TRANS_INFO_TYPE") | |||
public String getAgencyTransInfoType() { | |||
return agencyTransInfoType; | |||
} | |||
public void setAgencyTransInfoType(String agencyTransInfoType) { | |||
this.agencyTransInfoType = agencyTransInfoType; | |||
} | |||
@Column(name = "AGENCY_TRANS_FILE_TYPE") | |||
public String getAgencyTransFileType() { | |||
return agencyTransFileType; | |||
} | |||
public void setAgencyTransFileType(String agencyTransFileType) { | |||
this.agencyTransFileType = agencyTransFileType; | |||
} | |||
@Column(name = "ORG_CODE_BLACK") | |||
public String getOrgCodeBlack() { | |||
return orgCodeBlack; | |||
} | |||
public void setOrgCodeBlack(String orgCodeBlack) { | |||
this.orgCodeBlack = orgCodeBlack; | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.qtzl.alterSales.dao.repo.jpa.second; | |||
import com.qtzl.alterSales.dao.entity.second.QtlAgency; | |||
import org.springframework.data.jpa.repository.JpaRepository; | |||
import java.util.List; | |||
/*** | |||
* <p> | |||
* 渠道 repo | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/11/22 9:24 | |||
**/ | |||
public interface QtlAgencyRepo extends JpaRepository<QtlAgency, String> { | |||
/*** | |||
* 根据渠道编号获取渠道信息 | |||
* @param agencyId 渠道编号 | |||
* @return 、 | |||
*/ | |||
List<QtlAgency> findByAgencyId(String agencyId); | |||
} |
@@ -1,7 +1,13 @@ | |||
package com.qtzl.alterSales.manager.enums; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
public enum BlackListReson { | |||
/*** | |||
* 描述 | |||
*/ | |||
JJK_QF("借记卡-欠款未及时还款",1){}, | |||
XYK_WQYK("信用卡-未启用卡(发生etc扣款但未及时激活)",2){}, | |||
XYK_CSXED("信用卡-超授信额度、etc扣款但余额不足未及时还款",3){}, | |||
@@ -12,12 +18,21 @@ public enum BlackListReson { | |||
TB("退保",8){}, | |||
ZXZD("增信中断",9){}; | |||
private String value; | |||
private int code; | |||
private BlackListReson(String value, int code) { | |||
private Integer code; | |||
private BlackListReson(String value, Integer code) { | |||
this.code=code; | |||
this.value=value; | |||
} | |||
public static BlackListReson findByCode(Integer code) throws ServiceHandleException { | |||
for (BlackListReson instance : BlackListReson.values()) { | |||
if (instance.getCode().equals(code)) { | |||
return instance; | |||
} | |||
} | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("非法的下黑原因!" + code); | |||
} | |||
public String getValue() { | |||
return value; | |||
} | |||
@@ -26,7 +41,7 @@ public enum BlackListReson { | |||
this.value = value; | |||
} | |||
public int getCode() { | |||
public Integer getCode() { | |||
return code; | |||
} | |||
@@ -1,14 +1,31 @@ | |||
package com.qtzl.alterSales.manager.enums; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
public enum BlacklistOpType { | |||
IN("加入状态名单/下黑",1){}, | |||
OUT("解除状态名单/反白",2){}; | |||
/*** | |||
* 描述 | |||
*/ | |||
IN("加入状态名单/下黑", 1) {}, | |||
OUT("解除状态名单/反白", 2) {}; | |||
private String value; | |||
private int code; | |||
private BlacklistOpType(String value, int code) { | |||
this.code=code; | |||
this.value=value; | |||
private Integer code; | |||
BlacklistOpType(String value, Integer code) { | |||
this.code = code; | |||
this.value = value; | |||
} | |||
public static BlacklistOpType findByCode(Integer code) throws ServiceHandleException { | |||
for (BlacklistOpType instance : BlacklistOpType.values()) { | |||
if (instance.getCode().equals(code)) { | |||
return instance; | |||
} | |||
} | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("非法的状态名单类型!" + code); | |||
} | |||
public String getValue() { | |||
@@ -19,7 +36,7 @@ public enum BlacklistOpType { | |||
this.value = value; | |||
} | |||
public int getCode() { | |||
public Integer getCode() { | |||
return code; | |||
} | |||
@@ -0,0 +1,45 @@ | |||
package com.qtzl.alterSales.manager.handler; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.abstracts.AbstractAfterSalesManager; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.BlackListManagerRequest; | |||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||
import com.qtzl.alterSales.manager.service.FssBlackListManager; | |||
import com.txffp.api.core.manager.comm.annotation.ApiHandler; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.Resource; | |||
/*** | |||
* <p> | |||
* 状态名单管理(下黑或返白) | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/11/22 9:30 | |||
**/ | |||
@Service | |||
@ApiHandler | |||
public class AflBlackListManagerHandler extends AbstractAfterSalesManager<BlackListManagerRequest> { | |||
@Resource | |||
private FssBlackListManager blackListManager; | |||
public AflBlackListManagerHandler(){ | |||
super(AfterSalesCmd.BLACKLISTMANAGER, BlackListManagerRequest.class); | |||
} | |||
@Override | |||
public String handleInternal(String filename, BlackListManagerRequest request) throws ServiceHandleException { | |||
try { | |||
logger.info("选装-发行-状态名单管理,请求参数:{}", request.toJson(true)); | |||
return blackListManager.agencyBlackListManager(request).toJson(); | |||
} catch (Exception e) { | |||
if (e instanceof ServiceHandleException) { | |||
throw e; | |||
} | |||
logger.error("选装-发行-状态名单管理操作失败:{}", e.getMessage()); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("加入或移出状态名单失败"); | |||
} | |||
} | |||
} |
@@ -35,14 +35,14 @@ public class SelectByVehicleNumberBillsHandler extends AbstractAfterSalesManager | |||
@Override | |||
public String handleInternal(String filename, SelectByVehicleNumberBillsRequest request) throws ServiceHandleException { | |||
try { | |||
logger.info("选装-发行-根据车牌号获取待补交账单,请求参数:{}", request.toJson(true)); | |||
logger.info("选装-售后-根据车牌号获取待补交账单,请求参数:{}", request.toJson(true)); | |||
final List<VehicleAgreementNumBillsVo> agreementBills = paccountPayService.getAgreementBills(request.getPlateNumber()); | |||
return JSON.toJSONString(agreementBills); | |||
} catch (Exception e) { | |||
if (e instanceof ServiceHandleException) { | |||
throw e; | |||
} | |||
logger.error("选装-发行-根据车牌号获取待补交账单失败:{}", e.getMessage()); | |||
logger.error("选装-售后-根据车牌号获取待补交账单失败:{}", e.getMessage()); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("获取待补交账单失败"); | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
package com.qtzl.alterSales.manager.model.protocol.sales; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||
import com.txffp.api.core.manager.comm.annotation.Api; | |||
/*** | |||
* <p> | |||
* | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/11/22 9:32 | |||
**/ | |||
@Api(cmdClazz = AfterSalesCmd.class, cmd = "BLACKLISTMANAGER") | |||
public class BlackListManagerRequest extends BaseModel { | |||
private String agentId; | |||
private String agreementNum; | |||
private Integer type; | |||
private String createTime; | |||
private Integer reason; | |||
public String getAgentId() { | |||
return agentId; | |||
} | |||
public void setAgentId(String agentId) { | |||
this.agentId = agentId; | |||
} | |||
public String getAgreementNum() { | |||
return agreementNum; | |||
} | |||
public void setAgreementNum(String agreementNum) { | |||
this.agreementNum = agreementNum; | |||
} | |||
public Integer getType() { | |||
return type; | |||
} | |||
public void setType(Integer type) { | |||
this.type = type; | |||
} | |||
public String getCreateTime() { | |||
return createTime; | |||
} | |||
public void setCreateTime(String createTime) { | |||
this.createTime = createTime; | |||
} | |||
public Integer getReason() { | |||
return reason; | |||
} | |||
public void setReason(Integer reason) { | |||
this.reason = reason; | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.qtzl.alterSales.manager.model.protocol.sales; | |||
import cn.com.taiji.common.model.BaseModel; | |||
/*** | |||
* <p> | |||
* | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/11/22 9:40 | |||
**/ | |||
public class BlackListManagerResponse extends BaseModel { | |||
private Integer status; | |||
private String msg; | |||
public BlackListManagerResponse() { | |||
} | |||
public BlackListManagerResponse(Integer status, String msg) { | |||
this.status = status; | |||
this.msg = msg; | |||
} | |||
public Integer getStatus() { | |||
return status; | |||
} | |||
public void setStatus(Integer status) { | |||
this.status = status; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -26,6 +26,7 @@ public enum AfterSalesCmd implements ApiCmd { | |||
USERMOBILELOGIN("用户根据手机号登录(免密)", UcServiceType.AFTERSALES), | |||
ETCUSERINFOBYPAPERSINFO("根据用户证件类型、证件号获取用户信息", UcServiceType.AFTERSALES), | |||
SUPPLEMENTARYNOTIFY("渠道补缴成功通知", UcServiceType.AFTERSALES), | |||
BLACKLISTMANAGER("状态名单管理(下黑或返白)", UcServiceType.AFTERSALES), | |||
; | |||
private String value; |
@@ -1,7 +1,10 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.enums.BlacklistOpType; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.BlackListManagerRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.BlackListManagerResponse; | |||
/*** | |||
* <p> | |||
@@ -22,4 +25,11 @@ public interface FssBlackListManager { | |||
*/ | |||
void implement(String orderId, String payId, String agreementNum, BlacklistOpType opType, String reason); | |||
/*** | |||
* 渠道方对用户进行下黑或返白 | |||
* @param request 入参工具类 | |||
* @return 、 | |||
* @throws ServiceHandleException 、 | |||
*/ | |||
BlackListManagerResponse agencyBlackListManager(BlackListManagerRequest request) throws ServiceHandleException; | |||
} |
@@ -1,21 +1,34 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.alibaba.fastjson2.JSONObject; | |||
import com.qtzl.alterSales.dao.entity.primary.FssBlackList; | |||
import com.qtzl.alterSales.dao.entity.primary.FssPaccountPay; | |||
import com.qtzl.alterSales.dao.entity.primary.SignInfo; | |||
import com.qtzl.alterSales.dao.entity.second.QtlAgency; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssBlackListRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssPaccountPayRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.SignInfoRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.QtlAgencyRepo; | |||
import com.qtzl.alterSales.manager.enums.BlackListReson; | |||
import com.qtzl.alterSales.manager.enums.BlacklistOpType; | |||
import com.qtzl.alterSales.manager.enums.PlatformServiceType; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.external.PlatFormBlacklistRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.BlackListManagerRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.BlackListManagerResponse; | |||
import com.qtzl.alterSales.manager.tools.PlatformHttpUtil; | |||
import com.qtzl.alterSales.manager.tools.PlatformJsonResponse; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.CollectionUtils; | |||
import javax.annotation.Resource; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.List; | |||
/*** | |||
* <p> | |||
@@ -33,6 +46,12 @@ public class FssBlackListManagerImpl implements FssBlackListManager { | |||
private FssBlackListRepo fssBlackListRepo; | |||
@Resource | |||
private PlatformHttpUtil platformHttpUtil; | |||
@Resource | |||
private QtlAgencyRepo agencyRepo; | |||
@Resource | |||
private SignInfoRepo signInfoRepo; | |||
@Resource | |||
private FssPaccountPayRepo accountPayRepo; | |||
@Override | |||
public void implement(String orderId, String payId, String agreementNum, BlacklistOpType opType, String reason) { | |||
@@ -56,12 +75,73 @@ public class FssBlackListManagerImpl implements FssBlackListManager { | |||
log.error("下黑或返白时,需指定操作原因..."); | |||
return; | |||
} | |||
// 请求部中心进行下黑或反白 | |||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); | |||
sendRequest(agreementNum, opType, orderId, payId, reason, BlackListReson.JJK_QF, | |||
dateTimeFormatter.format(LocalDateTime.now()), null); | |||
} | |||
@Override | |||
public BlackListManagerResponse agencyBlackListManager(BlackListManagerRequest request) throws ServiceHandleException { | |||
// | |||
agencyBlackListManagerVerify(request); | |||
// 查询协议号是否存在 | |||
final SignInfo signInfo = signInfoRepo.findByAgreementNum(request.getAgreementNum()); | |||
if (null == signInfo) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("不存在的签约协议号"); | |||
} | |||
if (BlacklistOpType.OUT.getCode().equals(request.getType())) { | |||
// 反白是需要校验该协议下是否存在未扣款流水 | |||
final List<FssPaccountPay> bills = accountPayRepo.findByAgreementNum(request.getAgreementNum()); | |||
if (!CollectionUtils.isEmpty(bills)) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该协议号下存在未扣款流水,不允许反白"); | |||
} | |||
} | |||
final BlackListReson blackListReson = null == request.getReason() ? null : BlackListReson.findByCode(request.getReason()); | |||
return sendRequest(request.getAgreementNum(), BlacklistOpType.findByCode(request.getType()), "0", "0", "由渠道进行下黑或反白", | |||
blackListReson, request.getCreateTime(), request.getAgentId()); | |||
} | |||
private void agencyBlackListManagerVerify(BlackListManagerRequest request) throws ServiceHandleException { | |||
if (StringUtils.isEmpty(request.getAgentId())) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请指定渠道标识"); | |||
} | |||
if (StringUtils.isEmpty(request.getAgreementNum())) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请指定签约协议号"); | |||
} | |||
if (null == request.getType()) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请指定状态名单类型"); | |||
} | |||
if (StringUtils.isEmpty(request.getCreateTime())) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请指定状态名单生成时间"); | |||
} | |||
final BlacklistOpType blacklistOpType = BlacklistOpType.findByCode(request.getType()); | |||
if (BlacklistOpType.IN.getCode().equals(blacklistOpType.getCode()) && null == request.getReason()) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请指定下黑原因"); | |||
} | |||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); | |||
try { | |||
LocalDateTime.parse(request.getCreateTime(), df); | |||
} catch (Exception e) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("状态名单生成时间格式错误"); | |||
} | |||
// 校验渠道编号是否存在 | |||
final List<QtlAgency> agencyList = agencyRepo.findByAgencyId(request.getAgentId()); | |||
if (CollectionUtils.isEmpty(agencyList)) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("渠道标识错误,未查询到该渠道信息"); | |||
} | |||
} | |||
private BlackListManagerResponse sendRequest(String agreementNum, BlacklistOpType opType, String orderId, String payId, String reason, | |||
BlackListReson blackListReson, String createTime, String agencyId) { | |||
final PlatFormBlacklistRequest request = new PlatFormBlacklistRequest(); | |||
request.setAgreementNum(agreementNum); | |||
request.setType(String.valueOf(opType.getCode())); | |||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); | |||
request.setCreateTime(dateTimeFormatter.format(LocalDateTime.now())); | |||
request.setReason(String.valueOf(BlackListReson.JJK_QF.getCode())); | |||
request.setCreateTime(createTime); | |||
if (null != blackListReson) { | |||
request.setReason(String.valueOf(blackListReson.getCode())); | |||
} | |||
PlatformJsonResponse httpJsonPost; | |||
try { | |||
log.info("请求部中心黑名单接口入参:" + request.toJson()); | |||
@@ -69,17 +149,19 @@ public class FssBlackListManagerImpl implements FssBlackListManager { | |||
log.info("请求部中心黑名单接口返回:" + httpJsonPost.toJson()); | |||
// 请求结果存入对应的日志记录表 | |||
final FssBlackList blackList = new FssBlackList(agreementNum, orderId, payId, opType, httpJsonPost.getStatusCode(), | |||
httpJsonPost.getErrorMsg(), request.toJson(), httpJsonPost.toJson(), reason, LocalDateTime.now()); | |||
httpJsonPost.getErrorMsg(), request.toJson(), httpJsonPost.toJson(), reason, LocalDateTime.now(), agencyId); | |||
fssBlackListRepo.save(blackList); | |||
if (null != httpJsonPost.getStatusCode() && httpJsonPost.getStatusCode().equals(200)) { | |||
if (null != httpJsonPost.getStatusCode() && httpJsonPost.getStatusCode().equals(0)) { | |||
// 下黑或返白成功 | |||
log.error("请求部中心黑名单接口成功,协议编号:{}", agreementNum); | |||
return; | |||
log.info("请求部中心黑名单接口成功,协议编号:{}", agreementNum); | |||
return JSONObject.parseObject(httpJsonPost.getBizContent(), BlackListManagerResponse.class); | |||
} | |||
log.error("请求部中心黑名单接口失败,对应的路网订单号:{},协议编号:{}", orderId, agreementNum); | |||
return new BlackListManagerResponse(2, "部中心接口响应为空,请重试"); | |||
} catch (Exception e) { | |||
log.error("请求部中心黑名单接口失败,对应的路网订单号:{},协议编号:{}", orderId, agreementNum); | |||
e.printStackTrace(); | |||
} | |||
return new BlackListManagerResponse(2, "部中心接口请求异常,请重试"); | |||
} | |||
} |