|
@@ -96,16 +96,11 @@ public class FinanceRecordController extends BaseController {
|
|
|
@Autowired
|
|
|
private IZcFinanceFileRelService iZcFinanceFileRelService;
|
|
|
@Autowired
|
|
|
- private FlowableService flowableService;
|
|
|
- @Autowired
|
|
|
private IZcFinanceProComRelService iZcFinanceProComRelService;
|
|
|
@Autowired
|
|
|
private ApprovalService approvalService;
|
|
|
@Autowired
|
|
|
private IZcFinanceRecordFileRelService financeRecordFileRelService;
|
|
|
- // 开始流程
|
|
|
- public final static String STRART_FLOW = "flow/strartFlow";
|
|
|
-
|
|
|
//正整数正则
|
|
|
private static final String REGEX = "^[0-9]*[1-9][0-9]*$";
|
|
|
|
|
@@ -224,14 +219,9 @@ public class FinanceRecordController extends BaseController {
|
|
|
LambdaQueryWrapper<SysUserCompanyRel> companyRelWrapper = new LambdaQueryWrapper<>();
|
|
|
companyRelWrapper.eq(SysUserCompanyRel::getSucrUserId,userId);
|
|
|
companyRelWrapper.eq(SysUserCompanyRel::getSucrCompanyId,companyId);
|
|
|
+ companyRelWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
|
|
|
List<SysUserCompanyRel> list = iSysUserCompanyRelService.findSysUserCompanyRels(companyRelWrapper);
|
|
|
- if (list.size() > 0){
|
|
|
- //是否经办人 0:不是, 1:是
|
|
|
- String handler = list.get(0).getSucrHandler();
|
|
|
- if (!"1".equals(handler)){
|
|
|
- return AjaxResult.error("此操作需经办人权限,请确认您是否是经办人");
|
|
|
- }
|
|
|
- }else {
|
|
|
+ if (list.size() == 0) {
|
|
|
return AjaxResult.error("此操作需经办人权限,请确认您是否是经办人");
|
|
|
}
|
|
|
//融信id
|
|
@@ -272,8 +262,6 @@ public class FinanceRecordController extends BaseController {
|
|
|
String zfrNumber = "MB";
|
|
|
//查询融资产品编号
|
|
|
ZcFinanceProduct zcFinanceProduct = iZcFinanceProductService.getById(zfiProductId);
|
|
|
- //资方id
|
|
|
- String zfpManagementId = zcFinanceProduct.getZfpManagementId();
|
|
|
//融资产品编号
|
|
|
String zfpNumber = zcFinanceProduct.getZfpNumber();
|
|
|
zfpNumber = StringUtils.substring(zfpNumber,0,2);
|
|
@@ -289,22 +277,8 @@ public class FinanceRecordController extends BaseController {
|
|
|
return AjaxResult.error("请输入正确的融资收款账号");
|
|
|
}
|
|
|
}
|
|
|
- }else if ("0".equals(zfpcrLoanType)){
|
|
|
- //通过资方id查询电子账户表
|
|
|
- LambdaQueryWrapper<PayAccInf> accInfWrapper = new LambdaQueryWrapper<>();
|
|
|
- //账户状态(0:未开通,1:冻结,2已开通3:待激活)
|
|
|
- accInfWrapper.eq(PayAccInf::getPaiStatus,"2");
|
|
|
- //TODO 账户类型(00基本账户01贷款账户02信用账户03手续费账户04待结算账户05提现账户06邢台银行虚拟账户)
|
|
|
- accInfWrapper.eq(PayAccInf::getPaiAcctype,"00");
|
|
|
- //资方id
|
|
|
- accInfWrapper.eq(PayAccInf::getPaiCstno,zfpManagementId);
|
|
|
- List<PayAccInf> accInfList = iPayAccInfService.findPayAccInfs(accInfWrapper);
|
|
|
- if (accInfList.size() == 0){
|
|
|
- return AjaxResult.error("暂无电子账户");
|
|
|
- }else {
|
|
|
- zfrCollectionAccount = accInfList.get(0).getPaiAccno();
|
|
|
- }
|
|
|
- }else if ("2".equals(zfpcrLoanType)){
|
|
|
+ }
|
|
|
+ else if ("2".equals(zfpcrLoanType)){
|
|
|
if(CommonUtil.isNotEmpty(zfrCollectionAccount)) {
|
|
|
if(!pattern.matcher(zfrCollectionAccount).matches()) {
|
|
|
return AjaxResult.error("请输入正确的融资收款账号");
|
|
@@ -377,7 +351,10 @@ public class FinanceRecordController extends BaseController {
|
|
|
iZcFinanceInfService.updateZcFinanceInf(zcFinanceInf);
|
|
|
iZcFinanceRecordService.createZcFinanceRecord(zcFinanceRecord);
|
|
|
//调用融资审批
|
|
|
+ //融信id
|
|
|
map.put("zfrId",zfrId);
|
|
|
+ //企业id
|
|
|
+ map.put("companyId",companyId);
|
|
|
approvalService.addFinancingApproval(map);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
@@ -466,97 +443,85 @@ public class FinanceRecordController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("listBillInf/{zfiId}")
|
|
|
public AjaxResult listBillInf(@PathVariable("zfiId") String zfiId) throws Exception {
|
|
|
- //最终结果
|
|
|
- Map result = new HashMap();
|
|
|
//查询当前操作员
|
|
|
LoginUser userInfo = tokenService.getLoginUser();
|
|
|
SysUser user = userInfo.getSysUser();
|
|
|
- //获取企业
|
|
|
- String companyId = user.getCompanyId();
|
|
|
LambdaQueryWrapper<ZcFinanceBillRel> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.in(ZcFinanceBillRel::getZfbrFinanceId,zfiId);
|
|
|
List<ZcFinanceBillRel> relList = iZcFinanceBillRelService.findZcFinanceBillRels(queryWrapper);
|
|
|
//查询往来账款
|
|
|
Map map = new HashMap();
|
|
|
+ List<Map> list = new ArrayList<>();
|
|
|
if (relList.size() > 0){
|
|
|
//提取所有的
|
|
|
List<String> billIdList = CommonUtil.getIdFromList(relList,"zfbrBillId");
|
|
|
map.put("billIdList",CommonUtil.listToStr4InSql(billIdList));
|
|
|
+ list = financeRecordService.selectBillInfList(map);
|
|
|
}
|
|
|
- List<Map> list = financeRecordService.selectBillInfList(map);
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 提交审批
|
|
|
- * @param map
|
|
|
+ * 查询资方电子账户
|
|
|
+ * @param zfiProductId 融资产品id
|
|
|
* @return
|
|
|
*/
|
|
|
- @PreAuthorize(hasPermi = "finance:record:approve")
|
|
|
- @Log(title = "提交审批", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping("/examineApprove")
|
|
|
- public AjaxResult examineApprove(@RequestBody Map<String,Object> map) throws Exception {
|
|
|
- //融信id
|
|
|
- String zfrId = CommonUtil.objToString(map.get("zfrId"));
|
|
|
- //查询当前操作员
|
|
|
- LoginUser userInfo = tokenService.getLoginUser();
|
|
|
- SysUser user = userInfo.getSysUser();
|
|
|
- String companyId =user.getCompanyId();
|
|
|
- Long userId = user.getUserId();
|
|
|
- String userName =user.getUserName();
|
|
|
- //查询融信id
|
|
|
- ZcFinanceRecord zcFinanceRecord = iZcFinanceRecordService.getById(zfrId);
|
|
|
- String financeId = zcFinanceRecord.getZfrFinanceId();
|
|
|
- Map<String, Object> flowParam = new HashMap<String, Object>();
|
|
|
- //查询当前操作员
|
|
|
- flowParam.put("menuId", "1000000006");
|
|
|
- flowParam.put("companyId", companyId);
|
|
|
- //双主键
|
|
|
- flowParam.put("businessKey", zfrId);
|
|
|
- //员工id
|
|
|
- flowParam.put("sessionUserId", userId);
|
|
|
- //融资编号
|
|
|
- String zfrNumber =zcFinanceRecord.getZfrNumber();
|
|
|
- if(CommonUtil.isNotEmpty(zfrNumber)) {
|
|
|
- flowParam.put("name",userName + DateUtils.getTime() + "发起审批,融信编号为:" + zfrNumber+"的融资审批");
|
|
|
- }else {
|
|
|
- flowParam.put("name",userName + DateUtils.getTime() + "发起融资审批");
|
|
|
- }
|
|
|
- JSONObject jsonObj=new JSONObject(map);
|
|
|
- flowParam.put("paras", jsonObj.toString());
|
|
|
- Map<String, Object> resMap = flowableService.apiPost(STRART_FLOW, flowParam);
|
|
|
- if ("200".equals(resMap.get("code"))){
|
|
|
- ZcFinanceInf zfi = new ZcFinanceInf();
|
|
|
- zfi.setZfiId(financeId);
|
|
|
- //状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
|
|
|
- zfi.setZfiStatus("04");
|
|
|
- iZcFinanceInfService.updateById(zfi);
|
|
|
- //融资状态(00:融资中 01:已放款 02:融资失败 03:已结算)
|
|
|
- zcFinanceRecord.setZfrStatus("00");
|
|
|
- //审批状态(00:审核中 01:审批通过, 2:审批拒绝)
|
|
|
- zcFinanceRecord.setZfrApproveStt("00");
|
|
|
- iZcFinanceRecordService.updateById(zcFinanceRecord);
|
|
|
- }
|
|
|
- //未开启流程实例
|
|
|
- if("300".equals(resMap.get("code")) || "350".equals(resMap.get("code"))){
|
|
|
- ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
|
|
|
- //融信id
|
|
|
- zcFinanceInf.setZfiId(financeId);
|
|
|
- //融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
|
|
|
- zcFinanceInf.setZfiStatus("04");
|
|
|
- iZcFinanceInfService.updateById(zcFinanceInf);
|
|
|
- //融资状态(00:融资中 01:已放款 02:融资失败 03:已结算)
|
|
|
- zcFinanceRecord.setZfrStatus("00");
|
|
|
- //审批状态(00:审核中 01:审批通过, 2:审批拒绝)
|
|
|
- zcFinanceRecord.setZfrApproveStt("01");
|
|
|
- iZcFinanceRecordService.updateById(zcFinanceRecord);
|
|
|
- }else if (!"200".equals(resMap.get("code"))) {
|
|
|
- throw new Exception(resMap.get("message").toString());
|
|
|
+ @GetMapping("listAccInf/{zfiProductId}")
|
|
|
+ public AjaxResult listAccInf(@PathVariable("zfiProductId") String zfiProductId){
|
|
|
+ //查询融资产品编号
|
|
|
+ ZcFinanceProduct zcFinanceProduct = iZcFinanceProductService.getById(zfiProductId);
|
|
|
+ //资方id
|
|
|
+ String zfpManagementId = zcFinanceProduct.getZfpManagementId();
|
|
|
+ //通过资方id查询电子账户表
|
|
|
+ LambdaQueryWrapper<PayAccInf> accInfWrapper = new LambdaQueryWrapper<>();
|
|
|
+ //账户状态(0:未开通,1:冻结,2已开通3:待激活)
|
|
|
+ accInfWrapper.eq(PayAccInf::getPaiStatus,"2");
|
|
|
+ //TODO 账户类型(00基本账户01贷款账户02信用账户03手续费账户04待结算账户05提现账户06邢台银行虚拟账户)
|
|
|
+ accInfWrapper.eq(PayAccInf::getPaiAcctype,"00");
|
|
|
+ //资方id
|
|
|
+ accInfWrapper.eq(PayAccInf::getPaiCstno,zfpManagementId);
|
|
|
+ List<PayAccInf> accInfList = iPayAccInfService.findPayAccInfs(accInfWrapper);
|
|
|
+ String zfrCollectionAccount = "";
|
|
|
+ if (accInfList.size() > 0){
|
|
|
+ zfrCollectionAccount = accInfList.get(0).getPaiAccno();
|
|
|
}
|
|
|
- return AjaxResult.success();
|
|
|
+ return AjaxResult.success(zfrCollectionAccount);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取融信盖章文件
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @PutMapping("/getRecordSealFile")
|
|
|
+ public AjaxResult getRecordSealFile(@RequestBody Map<String,Object> map)throws Exception
|
|
|
+ {
|
|
|
+ //获取融信编号
|
|
|
+ String zfiId = CommonUtil.objToString(map.get("zfrFinanceId"));
|
|
|
+ //查询融信和文件的关系表
|
|
|
+ LambdaQueryWrapper<ZcFinanceRecordFileRel> relLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ relLambdaQueryWrapper.eq(ZcFinanceRecordFileRel::getZfrfrFinanceId,zfiId);
|
|
|
+ List<ZcFinanceRecordFileRel> recordFileRelList = financeRecordFileRelService.findZcFinanceRecordFileRels(relLambdaQueryWrapper);
|
|
|
+ //文件信息
|
|
|
+ List<PubFileInf> list = new ArrayList<>();
|
|
|
+ for(int i = 0 ; i < recordFileRelList.size();i ++){
|
|
|
+ ZcFinanceRecordFileRel rel = recordFileRelList.get(i);
|
|
|
+ //获取文件编号
|
|
|
+ String fileId = rel.getZfrfrFileId();
|
|
|
+ //获取文件信息
|
|
|
+ PubFileInf fileInf = fileInfService.getById(fileId);
|
|
|
+ if(fileInf == null){
|
|
|
+ throw new Exception("获取文件信息失败");
|
|
|
+ }
|
|
|
+ list.add(fileInf);
|
|
|
+ }
|
|
|
+ //返回
|
|
|
+ Map<String,Object> p = new HashMap<>();
|
|
|
+ p.put("list",list);
|
|
|
+ return AjaxResult.success(p);
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 导出附件
|
|
|
* @return
|
|
|
*/
|
|
@@ -667,7 +632,6 @@ public class FinanceRecordController extends BaseController {
|
|
|
fileInfLambdaQueryWrapper.eq(PubFileInf::getPfiIsDel,"00");
|
|
|
recordFileList = fileInfService.findPubFileInfs(fileInfLambdaQueryWrapper);
|
|
|
}
|
|
|
-
|
|
|
for (int i = 0; i < otherFileList.size(); i++) {
|
|
|
Map map = new HashMap();
|
|
|
//文件路径
|
|
@@ -697,7 +661,6 @@ public class FinanceRecordController extends BaseController {
|
|
|
map.put("pfiFileUrl",pfiFileUrl);
|
|
|
map.put("pfiFileName",pfiFileName);
|
|
|
list.add(map);
|
|
|
-
|
|
|
}
|
|
|
for (int x = 0; x < financeFileList.size(); x++) {
|
|
|
Map map = new HashMap();
|
|
@@ -720,11 +683,6 @@ public class FinanceRecordController extends BaseController {
|
|
|
list.add(map);
|
|
|
}
|
|
|
String directory = configService.selectConfigByKey("zc_record_file").getMsg();
|
|
|
- for (int l = 0; l < list.size(); l++) {
|
|
|
- String files = list.get(l).get("pfiFileUrl");
|
|
|
- String names = list.get(l).get("pfiFileName");
|
|
|
-// downloadFile(files, directory+ names,directory);
|
|
|
- }
|
|
|
//存放--服务器上zip文件的目录
|
|
|
File directoryFile=new File(directory);
|
|
|
if(!directoryFile.isDirectory() && !directoryFile.exists()){
|
|
@@ -741,11 +699,8 @@ public class FinanceRecordController extends BaseController {
|
|
|
//构造最终压缩包的输出流
|
|
|
zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
|
|
|
//TODO:未对文件不存在时进行操作,后期优化。
|
|
|
-
|
|
|
for (Map crete : list) {
|
|
|
-// File file = new File();
|
|
|
if(new UrlResource(CommonUtil.objToString(crete.get("pfiFileUrl"))).exists()) {
|
|
|
-// FileInputStream zipSource = new FileInputStream(crete.get("pfiFileUrl")+"");//将需要压缩的文件格式化为输入流
|
|
|
InputStream zipSource = getFileInputStream(crete.get("pfiFileUrl")+"");
|
|
|
/**
|
|
|
* 压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样这里的name就是文件名,
|
|
@@ -786,10 +741,6 @@ public class FinanceRecordController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
/** 压缩方法 */
|
|
|
-// generateFile(directory,"zip");
|
|
|
-// FileOutputStream fos1= new FileOutputStream(new File(directory + "rzgl"+DateUtils.dateTimeNow()+ ".zip"));
|
|
|
-// toZip(directory,fos1 ,true);
|
|
|
-// File zipFile = new File(directory + "rzgl"+DateUtils.dateTimeNow()+ ".zip");
|
|
|
if(zipFile.exists()) {
|
|
|
down(response, zipFileName, directory);
|
|
|
zipFile.delete();
|
|
@@ -846,8 +797,12 @@ public class FinanceRecordController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 文件流转换
|
|
|
+ * @param path 路径
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
public static InputStream getFileInputStream(String path) throws Exception {
|
|
|
URL url = null;
|
|
|
url = new URL(path);
|