Commit 18c1447e authored by chenzhao's avatar chenzhao

代扣优化项 问题处理

parent 78f73f40
......@@ -198,7 +198,7 @@ public class IcbcWithholdController extends BaseController {
@Transactional
public ResponseModel sftpUploadAndUnzip(String fileUrl,String batchNo) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
icbcWithholdServiceImpl.sftpUploadAndUnzip(fileUrl,batchNo,reginParams.getUserModel().getRealName());
icbcWithholdServiceImpl.sftpUploadAndUnzip(fileUrl,batchNo);
return CommonResponseNewUtil.success();
}
......
......@@ -692,7 +692,7 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
public void exportExcel(HttpServletResponse response, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO){
List<HygfIcbcRecordExportDTO> hygfIcbcRecordExportDTOS = hygfIcbcRecordMapper.paymentAmountExport(hygfIcbcRecordQueryDTO);
if (CollectionUtil.isNotEmpty(hygfIcbcRecordExportDTOS)){
ExcelUtil.createTemplate(response,"聚富通信息","聚富通信息",hygfIcbcRecordExportDTOS, HygfIcbcRecordExportDTO.class,null,false);
ExcelUtil.createTemplate(response,"账号信息","账号信息",hygfIcbcRecordExportDTOS, HygfIcbcRecordExportDTO.class,null,false);
}
}
}
\ No newline at end of file
......@@ -38,6 +38,7 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -197,7 +198,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
if (result != null) {
for (String url : result.getResult().keySet()) {
model.setUploadFile(url);
sftpUploadAndUnzip(url,batchNo,model.getConfirmator());
sftpUploadAndUnzip(url,batchNo);
}
}
} catch (IOException e) {
......@@ -206,12 +207,13 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
model.setIcbcRecordInfos(JSONObject.toJSONString(model.getRecordDTOS()));
model.setBatchNo(batchNo);
this.saveOrUpdate(model);
throw new BadRequest("上传工行失败");
} finally {
cleanup(dirPath);
}
model.setIcbcRecordInfos(JSONObject.toJSONString(model.getRecordDTOS()));
model.setBatchNo(batchNo);
model.setUploadFileName(fileName);
model.setUploader(model.getConfirmator());
model.setUploadTime(new Date());
......@@ -222,8 +224,60 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
}
this.saveOrUpdate(model);
}
// @Async
// void uploadFile (String batchNo,String firstLink,IcbcWithhold model) throws Exception {
// String fileName ="gxjr"+"-"+projectId+"-ENTRUST-"+batchNo;
// Path currentWorkingDir = Paths.get("");
// Path dirPath = currentWorkingDir.resolve(batchNo);
// System.out.println("Current working directory: " + System.getProperty("user.dir"));
// writeStringToFile(firstLink,dirPath.toString()+"/"+fileName+".bin");
//
//
// com.yeejoin.amos.boot.module.hygf.api.util.FileUtils.save2File(
// dirPath.toString()+"/"+fileName+".sign",
// RSASignUtils.signWithByte_New( com.yeejoin.amos.boot.module.hygf.api.util.FileUtils.toByteArray(dirPath.toString()+"/"+fileName+".bin"),
// RSASignUtils .loadPrivateKey(file+"secretKey/pkcs8.pem")));
//
// //String sign = RSASignUtils.sign(firstLink, RSASignUtils.loadPrivateKey(file+"secretKey/pkcs8.pem"));
// //生成upload需上传的三个文件
//
// //writeStringToFile(sign,dirPath.toString()+"/"+fileName+".sign");
// String checkFile = createCheckFile(fileName,batchNo);
// writeStringToFile(checkFile,dirPath.toString()+"/"+fileName+".check");
//
// try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(dirPath.toString() + "/" + fileName + ".zip"))) {
// addFileToZip(dirPath.toString() + "/" + fileName + ".bin", fileName + ".bin", zos);
// addFileToZip(dirPath.toString() + "/" + fileName + ".sign", fileName + ".sign", zos);
// addFileToZip(dirPath.toString() + "/" + fileName + ".check", fileName + ".check", zos);
//
// MultipartFile multipartFile = convertZipToMultipartFile(new File(dirPath.toString() + "/" + fileName + ".zip"));
// FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
// if (result != null) {
// for (String url : result.getResult().keySet()) {
// model.setUploadFile(url);
// sftpUploadAndUnzip(url,batchNo);
// }
// }
// } catch (IOException e) {
// model.setUploadStatus(UploadStatusEnum.未生成.getName());
// e.printStackTrace();
// model.setIcbcRecordInfos(JSONObject.toJSONString(model.getRecordDTOS()));
// model.setUploadFileName(fileName);
// model.setBatchNo(batchNo);
// this.saveOrUpdate(model);
//
// LambdaUpdateWrapper<IcbcWithholdRecord> icbcWithholdRecordUp = new LambdaUpdateWrapper<>();
// icbcWithholdRecordUp.set(BaseEntity::getIsDelete,"1");
// icbcWithholdRecordUp.eq(IcbcWithholdRecord::getBatchNo,batchNo);
// icbcWithholdRecordService.getBaseMapper().update(null ,icbcWithholdRecordUp);
// } finally {
// cleanup(dirPath);
// }
// }
/**
* 生成文件
......@@ -433,7 +487,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
model.setReceiptFile(url);
}
this.saveOrUpdate(model);
this.downloadAndSaveZipFile(model.getReceiptFile(),batchNo,"回盘文件",response);
this.downloadAndSaveZipFile(model.getReceiptFile(),batchNo,"批扣回单",response);
}
} catch ( Exception e) {
logger.error("平台上传文件失败");
......@@ -602,7 +656,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
* @param batchNo 批次号
*/
@Async
public void sftpUploadAndUnzip(String fileUrl,String batchNo,String uploader ) {
public void sftpUploadAndUnzip(String fileUrl,String batchNo ) {
Path currentWorkingDir = Paths.get("");
Path dirPath = currentWorkingDir.resolve(batchNo);
try {
......@@ -831,7 +885,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
List<IcbcWithhold> icbcWithholds = this.getBaseMapper().selectList(wrapper);
for (IcbcWithhold icbcWithhold : icbcWithholds) {
sftpUploadAndUnzip(icbcWithhold.getUploadFile(),icbcWithhold.getBatchNo(),realName);
sftpUploadAndUnzip(icbcWithhold.getUploadFile(),icbcWithhold.getBatchNo());
}
......@@ -842,11 +896,15 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
wrapper.in(BaseEntity::getSequenceNbr,ids);
List<IcbcWithhold> icbcWithholds = this.getBaseMapper().selectList(wrapper);
for (IcbcWithhold icbcWithhold : icbcWithholds) {
long l = System.currentTimeMillis();
try {
fileGeneration(icbcWithhold);
System.out.println("bbbbbbbbbbbbbbbbbbb"+String.valueOf(System.currentTimeMillis()-l) );
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment