|
@@ -20,6 +20,7 @@ import com.tianhu.common.log.enums.BusinessType;
|
|
|
import com.tianhu.common.security.annotation.PreAuthorize;
|
|
|
import com.tianhu.common.security.service.TokenService;
|
|
|
import com.tianhu.system.api.RemoteConfigService;
|
|
|
+import com.tianhu.system.api.RemoteZxBankService;
|
|
|
import com.tianhu.system.api.domain.SysUser;
|
|
|
import com.tianhu.system.api.model.LoginUser;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -101,6 +102,8 @@ public class FinanceRecordController extends BaseController {
|
|
|
//待办服务类
|
|
|
@Autowired
|
|
|
private ISysNoticeService sysNoticeService;
|
|
|
+ @Autowired
|
|
|
+ private RemoteZxBankService remoteZxBankService;
|
|
|
|
|
|
/**
|
|
|
* 查询融资管理列表
|
|
@@ -246,6 +249,12 @@ public class FinanceRecordController extends BaseController {
|
|
|
}
|
|
|
//获取接收方
|
|
|
String zfiSupplierId = financeInf.getZfiSupplierId();
|
|
|
+ //授信id
|
|
|
+ String zfiCoreQuotaId = financeInf.getZfiCoreQuotaId();
|
|
|
+ //查询授信信息
|
|
|
+ ZcFinanceProComRel zcFinanceProComRel = iZcFinanceProComRelService.getById(zfiCoreQuotaId);
|
|
|
+ //是否收取手续费(0:不收取, 1收取)
|
|
|
+ String zfpcrCharge = zcFinanceProComRel.getZfpcrCharge();
|
|
|
//放入map中
|
|
|
map.put("zfiSupplierId",zfiSupplierId);
|
|
|
//融资金额
|
|
@@ -336,7 +345,8 @@ public class FinanceRecordController extends BaseController {
|
|
|
// LambdaQueryWrapper<ZcChargeInf> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
// queryWrapper.eq(ZcChargeInf::getZciFinanceId,zfrFinanceId);
|
|
|
// int count = iZcChargeInfService.count(queryWrapper);
|
|
|
-// if (count == 0) {
|
|
|
+ //平台收取手续费则添加费用信息
|
|
|
+ if ("1".equals(zfpcrCharge)) {
|
|
|
ZcChargeInf zcChargeInf = new ZcChargeInf();
|
|
|
//主键
|
|
|
zcChargeInf.setZciId(IdUtils.fastSimpleUUID());
|
|
@@ -355,7 +365,7 @@ public class FinanceRecordController extends BaseController {
|
|
|
//创建时间
|
|
|
zcChargeInf.setCreateTime(DateUtils.getNowDate());
|
|
|
iZcChargeInfService.createZcChargeInf(zcChargeInf);
|
|
|
-// }
|
|
|
+ }
|
|
|
/*----------修改融信表状态---------------*/
|
|
|
ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
|
|
|
//融信id
|
|
@@ -411,6 +421,7 @@ public class FinanceRecordController extends BaseController {
|
|
|
LoginUser userInfo = tokenService.getLoginUser();
|
|
|
SysUser user = userInfo.getSysUser();
|
|
|
String userId = user.getUserId() + "";
|
|
|
+ String companyId = user.getCompanyId();
|
|
|
//放款金额
|
|
|
String zfrLoanAmount = CommonUtil.objToString(map.get("zfrLoanAmount"));
|
|
|
//融资金额
|
|
@@ -438,6 +449,77 @@ public class FinanceRecordController extends BaseController {
|
|
|
zcFinanceInf.setUpdateBy(userId);
|
|
|
//修改时间
|
|
|
zcFinanceInf.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ /*========查询本公司虚拟账户和平台公共计息账户*/
|
|
|
+ //--------------------查询本公司电子账户
|
|
|
+ LambdaQueryWrapper<PayAccInf> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ //企业id
|
|
|
+ queryWrapper.eq(PayAccInf::getPaiCstno,companyId);
|
|
|
+ //账户类型(00基本账户01贷款账户02信用账户03手续费账户04待结算账户05提现账户06虚拟账户)
|
|
|
+ queryWrapper.eq(PayAccInf::getPaiAcctype,"06");
|
|
|
+ //开户行号(1000:中信银行)
|
|
|
+ queryWrapper.eq(PayAccInf::getPaiQlbankno,"302");
|
|
|
+ //账户状态(0:未开通,1:冻结,2已开通3:待激活)
|
|
|
+ queryWrapper.eq(PayAccInf::getPaiStatus,"2");
|
|
|
+ List<PayAccInf> accInfList = iPayAccInfService.findPayAccInfs(queryWrapper);
|
|
|
+ //账号
|
|
|
+ String paiAccNo = "";
|
|
|
+ //账户名称
|
|
|
+ String paiAccnoName = "";
|
|
|
+ if (accInfList.size() > 0){
|
|
|
+ paiAccNo = accInfList.get(0).getPaiAccno();
|
|
|
+ paiAccnoName = accInfList.get(0).getPaiAccnoName();
|
|
|
+ }
|
|
|
+ //--------------------查询平台电子账户
|
|
|
+ LambdaQueryWrapper<PayAccInf> query = new LambdaQueryWrapper<>();
|
|
|
+ //企业id
|
|
|
+ query.eq(PayAccInf::getPaiCstno,"000000");
|
|
|
+ //账户类型(00基本账户01贷款账户02信用账户03手续费账户04待结算账户05提现账户06虚拟账户)
|
|
|
+ query.eq(PayAccInf::getPaiAcctype,"06");
|
|
|
+ //开户行号(1000:中信银行)
|
|
|
+ query.eq(PayAccInf::getPaiQlbankno,"302");
|
|
|
+ //账户状态(0:未开通,1:冻结,2已开通3:待激活)
|
|
|
+ query.eq(PayAccInf::getPaiStatus,"2");
|
|
|
+ List<PayAccInf> accList = iPayAccInfService.findPayAccInfs(query);
|
|
|
+ //账号
|
|
|
+ String accNo = "";
|
|
|
+ if (accInfList.size() > 0){
|
|
|
+ accNo = accList.get(0).getPaiAccno();
|
|
|
+ }
|
|
|
+ //--------------------查询平台公共计息账户
|
|
|
+ LambdaQueryWrapper<PayAccInf> infWrapper = new LambdaQueryWrapper<>();
|
|
|
+ //企业id
|
|
|
+ infWrapper.eq(PayAccInf::getPaiCstno,"000000");
|
|
|
+ //账户类型(00基本账户01贷款账户02信用账户03手续费账户04待结算账户05提现账户06虚拟账户)
|
|
|
+ infWrapper.eq(PayAccInf::getPaiAcctype,"07");
|
|
|
+ //开户行号(1000:中信银行)
|
|
|
+ infWrapper.eq(PayAccInf::getPaiQlbankno,"302");
|
|
|
+ //账户状态(0:未开通,1:冻结,2已开通3:待激活)
|
|
|
+ infWrapper.eq(PayAccInf::getPaiStatus,"2");
|
|
|
+ List<PayAccInf> infList = iPayAccInfService.findPayAccInfs(infWrapper);
|
|
|
+ //账号
|
|
|
+ String accountNo = "";
|
|
|
+ //开户行名
|
|
|
+ String accnoName = "";
|
|
|
+ if (accInfList.size() > 0){
|
|
|
+ accountNo = infList.get(0).getPaiAccno();
|
|
|
+ accnoName = infList.get(0).getPaiAccnoName();
|
|
|
+ }
|
|
|
+ /*查询费用列表*/
|
|
|
+ LambdaQueryWrapper<ZcChargeInf> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ //融资id
|
|
|
+ wrapper.eq(ZcChargeInf::getZciFinanceId,zfrId);
|
|
|
+ List<ZcChargeInf> chargeList = iZcChargeInfService.findZcChargeInfs(wrapper);
|
|
|
+ //主键
|
|
|
+ String zciId = "";
|
|
|
+ //费用状态(00:待缴费;01:缴费中;02:已缴费;03:已退款 04:退款中05:缴费失败 06 退款失败)
|
|
|
+ String zciStatus = "";
|
|
|
+ //融资手续费
|
|
|
+ String zciAmount = "";
|
|
|
+ if (chargeList.size() > 0){
|
|
|
+ zciId = chargeList.get(0).getZciId();
|
|
|
+ zciStatus = chargeList.get(0).getZciStatus();
|
|
|
+ zciAmount = chargeList.get(0).getZciAmount();
|
|
|
+ }
|
|
|
/*========放款登记========*/
|
|
|
if ("00".equals(TYPE)) {
|
|
|
//授信额度
|
|
@@ -476,6 +558,11 @@ public class FinanceRecordController extends BaseController {
|
|
|
//----------执行修改融信表状态
|
|
|
//融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
|
|
|
zcFinanceInf.setZfiStatus("05");
|
|
|
+ //-----------------放款=>平台电子账户转账到平台公共计息账户
|
|
|
+ //费用状态(00:待缴费;01:缴费中;02:已缴费;03:已退款 04:退款中05:缴费失败 06 退款失败)
|
|
|
+ if ("02".equals(zciStatus)) {
|
|
|
+ remoteZxBankService.transfer(accNo, accountNo, accnoName, zciAmount, zciId, "000000", "94");
|
|
|
+ }
|
|
|
}
|
|
|
/*========拒绝放款登记========*/
|
|
|
else if ("01".equals(TYPE)){
|
|
@@ -494,6 +581,30 @@ public class FinanceRecordController extends BaseController {
|
|
|
//----------执行修改融信表状态
|
|
|
//融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
|
|
|
zcFinanceInf.setZfiStatus("02");
|
|
|
+ //----------------拒绝放款=>退款
|
|
|
+ //费用状态(00:待缴费;01:缴费中;02:已缴费;03:已退款 04:退款中05:缴费失败 06 退款失败)
|
|
|
+ if ("02".equals(zciStatus)){
|
|
|
+ R r= remoteZxBankService.transfer(accNo,paiAccNo,paiAccnoName,zciAmount,zciId,companyId,"30");
|
|
|
+ Map maps = (Map) r.getData();
|
|
|
+ if(maps.containsKey("status")) {
|
|
|
+ //状态 0 交易中 1 成功 2 失败
|
|
|
+ String status = maps.get("status").toString();
|
|
|
+ //退款成功费用列表改为退款成功
|
|
|
+ if ("1".equals(status)){
|
|
|
+ ZcChargeInf chargeInf = new ZcChargeInf();
|
|
|
+ //主键
|
|
|
+ chargeInf.setZciId(zciId);
|
|
|
+ //费用状态(00:待缴费;01:缴费中;02:已缴费;03:已退款 04:退款中05:缴费失败 06 退款失败)
|
|
|
+ chargeInf.setZciStatus("03");
|
|
|
+ //修改人
|
|
|
+ chargeInf.setUpdateBy(userId);
|
|
|
+ //修改时间
|
|
|
+ chargeInf.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ iZcChargeInfService.updateById(chargeInf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
iZcFinanceInfService.updateZcFinanceInf(zcFinanceInf);
|
|
|
iZcFinanceRecordService.updateZcFinanceRecord(zcFinanceRecord);
|