|
@@ -46,6 +46,8 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
InsureWorkerCommercialFileService insureWorkerCommercialFileService;
|
|
|
@Resource
|
|
|
WorkerMrbxService workerMrbxService;
|
|
|
+ @Resource
|
|
|
+ WebsitWorkerService websitWorkerService;
|
|
|
|
|
|
|
|
|
|
|
@@ -194,7 +196,7 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
}
|
|
|
|
|
|
|
|
|
- private String uploadInsureBx(WorkerBrandAccount wdno) throws Exception {
|
|
|
+ private String uploadInsureBxBak(WorkerBrandAccount wdno) throws Exception {
|
|
|
String fileo ="";
|
|
|
String fid1 = "";
|
|
|
|
|
@@ -322,6 +324,62 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
return fid1;*/
|
|
|
}
|
|
|
|
|
|
+ private String uploadInsureBx(WorkerBrandAccount wdno) throws Exception {
|
|
|
+ String fileo ="";
|
|
|
+ String fid1 = "";
|
|
|
+ String outInsureCert = "";
|
|
|
+
|
|
|
+ WebsitWorker iwcf = websitWorkerService.lambdaQuery()
|
|
|
+ .eq(WebsitWorker::getWorkerId, wdno.getWorkerId())
|
|
|
+ .eq(WebsitWorker::getWebsitId, wdno.getWebsitId())
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (iwcf != null){
|
|
|
+ if (StringUtils.isNotEmpty(iwcf.getOutInsureCert())){
|
|
|
+ // 已上传就不需要再上传
|
|
|
+ return fid1;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(iwcf.getInsureFiles())){
|
|
|
+ // 上传
|
|
|
+ if (iwcf.getInsureFiles().contains(",")){
|
|
|
+ int num=0;
|
|
|
+
|
|
|
+ List<String> result = Arrays.asList(iwcf.getInsureFiles().split(","));
|
|
|
+ for (String p:result){
|
|
|
+ fid1 = publicService.path(p);
|
|
|
+ File nFile = publicService.createf(fid1);
|
|
|
+ baseService.saveToFile(ossUtil.getUrlWw(iwcf.getFileUrl()),nFile);
|
|
|
+ fileo = fid1;
|
|
|
+ uploadInitFileBx(fileo, fid1, wdno.getBrandWebsitId());
|
|
|
+ if (StringUtils.isEmpty(fid1)){
|
|
|
+ return fid1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (num>0){
|
|
|
+ outInsureCert = fid1;
|
|
|
+ } else {
|
|
|
+ outInsureCert= outInsureCert +","+fid1;
|
|
|
+ }
|
|
|
+ new File(fid1).delete();
|
|
|
+ num = num +1 ;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ fid1 = publicService.path(iwcf.getInsureFiles());
|
|
|
+ File nFile = publicService.createf(fid1);
|
|
|
+ baseService.saveToFile(ossUtil.getUrlWw(iwcf.getFileUrl()),nFile);
|
|
|
+ fileo = fid1;
|
|
|
+ uploadInitFileBx(fileo, fid1, wdno.getBrandWebsitId());
|
|
|
+ if (StringUtils.isEmpty(fid1)){
|
|
|
+ return fid1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iwcf.setOutInsureCert(outInsureCert);
|
|
|
+ iwcf.updateById();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 师傅必买保险,所以不会不存在
|
|
|
+ return fid1;
|
|
|
+ }
|
|
|
+
|
|
|
private Boolean uploadFileexc(String fileo, String filet, String wdno,WorkerCert item) throws Exception {
|
|
|
Boolean uploadfile = Boolean.TRUE;
|
|
|
Boolean onlyone = Boolean.FALSE;
|
|
@@ -538,6 +596,42 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private String uploadInitFileBx(String fileo, String fid1,String wdno) throws Exception {
|
|
|
+ String fileId="";
|
|
|
+ if (StringUtils.isNotEmpty(fileo)){
|
|
|
+ // 1: 获取签名信息
|
|
|
+ GreeFileResponseHelper response = greeLogic.ossGetSignt(wdno,"GET");
|
|
|
+ if (response.getStatusCode() == 200){
|
|
|
+ ResultData resultData = JSONObject.parseObject(response.getData().toString(), ResultData.class);
|
|
|
+ resultData.getExtData().setDir(resultData.getExtData().getDir()+"/"+fid1);
|
|
|
+ // 2:文件上传
|
|
|
+ PostObjectSample ossPostObject = new PostObjectSample();
|
|
|
+ String result = ossPostObject.PostObject(fileo, resultData.getExtData());
|
|
|
+ // 3: 保存文件
|
|
|
+ if (StringUtils.isEmpty(result.trim())){
|
|
|
+ Map<String,String>req = new HashMap<>();
|
|
|
+ // 生成对象
|
|
|
+ getSaveFileInfo(fid1, resultData, req);
|
|
|
+ GreeFileSaveHelper responses = greeLogic.greePostSaveFile(req);
|
|
|
+
|
|
|
+ if (responses.getStatusCode() == 200){
|
|
|
+ fileId = responses.getData().getId();
|
|
|
+ } else {
|
|
|
+ // 失败
|
|
|
+ log.info("保存保险证件文件到格力总部失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.info("保险证件上传图片到OSS失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.info("获取签名信息失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return fileId;
|
|
|
+ }
|
|
|
+
|
|
|
private Integer getCount(List<WorkerBrandAccount> workerWdnos, Integer count) {
|
|
|
for (WorkerBrandAccount w: workerWdnos){
|
|
|
if (StringUtils.isEmpty(w.getBrandWebsitId())){
|