yaozhixue 1 éve
szülő
commit
bc3c1b43c0

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/base/BaseService.java

@@ -119,7 +119,7 @@ public class BaseService {
     }
 
 
-    public void initFile(String id){
+    public void initFile(File id){
         FileOutputStream fos = null;
         BufferedInputStream bis = null ;
         int BUFFER_SIZE = 1024;

+ 0 - 1
src/main/java/com/zfire/jiasm/syncdata/common/OldForNewUploadLogic.java

@@ -328,7 +328,6 @@ public class OldForNewUploadLogic {
 
 	@Nullable
 	private String getImage(String picture, WebsitSH websitSH) {
-		SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
 		String oldFile;
 		String newFile;
 		String greeImageIdN;

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/download/order/InstallBusinessApi.java

@@ -76,7 +76,7 @@ public class InstallBusinessApi {
         // 提取待落本地表的数据
         lcls = itfTblAzAssignLcLsDownloadService.lambdaQuery()
                 .eq(ItfTblAzAssignLcLsDownload::getSynStatus, SynStatusEnum.UN_SYN.getCode())
-                .lt(ItfTblAzAssignLcLsDownload::getSynTimes, 3)
+                .lt(ItfTblAzAssignLcLsDownload::getSynTimes, 2)
                 // .eq(ItfTblAzAssignLcLsDownload::getSynReqId,5999)// 测试使用
                 .orderByAsc(ItfTblAzAssignLcLsDownload::getSynReqId)
                 .list();

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/download/order/RepairBusinessApi.java

@@ -82,7 +82,7 @@ public class RepairBusinessApi {
         repairRec = itfTblAssignDownloadService.lambdaQuery()
                 .eq(ItfTblAssignDownload::getSynStatus, 0)
                 // .eq(ItfTblAssignDownload::getSynReqId, 1359)// 测试使用
-                .lt(ItfTblAssignDownload::getSynTimes, 3)
+                .lt(ItfTblAssignDownload::getSynTimes, 2)
                 .orderByAsc(ItfTblAssignDownload::getSynReqId)
                 .list();
 

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/download/worker/GLPPWXGQueryAdd.java

@@ -108,7 +108,7 @@ public class GLPPWXGQueryAdd {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
         // 创建目录
-        publicService.creatMkdir();
+        // publicService.creatMkdir();
 
         log.info("开始生成网点师傅保险证件信息: \uF0B7{}",sdf.format(new Date()));
 

+ 0 - 2
src/main/java/com/zfire/jiasm/syncdata/service/impl/GLPPWXGQueryAddServiceImpl.java

@@ -248,7 +248,6 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                 // 生成图片
                 processCertInfo(item);
                 workerCertUpList.add(item);
-
                 updateWorkerCertInfo(workerCertUpList, 100);
             } catch (Exception ex) {
                 ex.printStackTrace();
@@ -756,7 +755,6 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
     }
 
     private String putCert(String image) throws IOException {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
         String fileId = "";
         String id = publicService.path(image);
         File newFile = publicService.createf(id);

+ 0 - 4
src/main/java/com/zfire/jiasm/syncdata/service/impl/GLPPWXGQueryUpdateServiceImpl.java

@@ -444,10 +444,6 @@ public class GLPPWXGQueryUpdateServiceImpl implements GLPPWXGQueryUpdateService
 
     @NotNull
     private String putCert(String image) throws Exception {
-        /*String id = IdWorker.getIdStr()+".jpeg";
-        if (image.contains(".jpeg")){
-            id = IdWorker.getIdStr();
-        }*/
         String id = publicService.path(image);
         File nFile = new File(id);
 

+ 1 - 3
src/main/java/com/zfire/jiasm/syncdata/service/impl/InstallProduceDataUploadServiceImpl.java

@@ -548,7 +548,6 @@ public class InstallProduceDataUploadServiceImpl implements InstallProduceDataUp
     }
 
     private void uploadOrderDetailFile(@NotNull OutJiasmToGreeUploadTaskList ojtutl, Map<String, List<SysDictRef>> CategoryRefmap, OrderBase orderBase) {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
         String oldFile ="";
         String newFile ="";
         // 根据产品类别名称 生成不同的完工明细数据
@@ -889,10 +888,9 @@ public class InstallProduceDataUploadServiceImpl implements InstallProduceDataUp
     }
 
     private boolean uploadImage(OrderBase orderBase, OrderInstallDetailCode code) {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
         String oldFile;
         String newFile;
-        oldFile = sdfs.format(new Date())+code.getPath();
+        oldFile = publicService.path(code.getPath());
         File nFile = new File(oldFile);
 
         baseService.saveToFile(ossUtil.getUrlWw(code.getPath()),nFile);

+ 5 - 6
src/main/java/com/zfire/jiasm/syncdata/service/impl/OrderBaseInstallCjOrWgServiceImpl.java

@@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
@@ -796,8 +797,7 @@ public class OrderBaseInstallCjOrWgServiceImpl implements orderBaseInstallCjOrWg
         }
     }
 
-    public void uploadOrderDetailFilePiture(@NotNull OutJiasmToGreeUploadTaskList ojtutl, Map<String, List<SysDictRef>> CategoryRefmap, OrderBase orderBase) {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
+    public void uploadOrderDetailFilePiture(@NotNull OutJiasmToGreeUploadTaskList ojtutl, Map<String, List<SysDictRef>> CategoryRefmap, OrderBase orderBase) throws IOException {
         String oldFile ="";
         String newFile ="";
         // 根据产品类别名称 生成不同的完工明细数据
@@ -821,7 +821,7 @@ public class OrderBaseInstallCjOrWgServiceImpl implements orderBaseInstallCjOrWg
             if (StringUtils.isEmpty(file.getBrandFilePath())){
                 // 上传图片
                 oldFile = publicService.path(file.getFilePath());
-                File nFile = new File(oldFile);
+                File nFile = publicService.createf(oldFile);
 
                 baseService.saveToFile(ossUtil.getUrlWw(file.getFilePath()),nFile);
                 // 获取文件
@@ -1470,12 +1470,11 @@ public class OrderBaseInstallCjOrWgServiceImpl implements orderBaseInstallCjOrWg
         return Boolean.TRUE;
     }
 
-    public boolean uploadImage(OrderBase orderBase, OrderInstallDetailCode code, Long synReqId) {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
+    public boolean uploadImage(OrderBase orderBase, OrderInstallDetailCode code, Long synReqId) throws IOException {
         String oldFile;
         String newFile;
         oldFile = publicService.path(code.getPath());
-        File nFile = new File(oldFile);
+        File nFile = publicService.createf(oldFile);
 
         baseService.saveToFile(ossUtil.getUrlWw(code.getPath()),nFile);
         // 获取文件

+ 2 - 1
src/main/java/com/zfire/jiasm/syncdata/service/impl/PublicServiceImpl.java

@@ -1495,7 +1495,8 @@ public class PublicServiceImpl implements PublicService {
     @Override
     public String path(String f){
         SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
-        return sdfs.format(new Date())+f;
+        String filedir = "syncdata/" + sdfs.format(new Date()) + f;
+        return filedir;
     }
 
     @Override

+ 5 - 5
src/main/java/com/zfire/jiasm/syncdata/service/impl/RepairProduceDataUploadServiceImpl.java

@@ -36,6 +36,7 @@ import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.io.File;
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -1015,7 +1016,7 @@ public class RepairProduceDataUploadServiceImpl implements RepairProduceDataUplo
         generateRepairDetailOrReason(brand, orderBase);
     }
 
-    public Boolean dataInit(OutJiasmToGreeUploadTaskList sourceData, String newDykh, OrderBase orderBase) {
+    public Boolean dataInit(OutJiasmToGreeUploadTaskList sourceData, String newDykh, OrderBase orderBase) throws IOException {
         // 同步工单的pgid,pguuid
         upOrderBasePgid(orderBase, newDykh);
         // 同步维修工单产品信息 pgid
@@ -1293,7 +1294,7 @@ public class RepairProduceDataUploadServiceImpl implements RepairProduceDataUplo
         }
     }
 
-    public void generateFileInit(OrderBase orderBase) {
+    public void generateFileInit(OrderBase orderBase) throws IOException {
         // 提取采集的数据
         List<OrderRepairDetail> orderRepairDetails = orderRepairDetailService.lambdaQuery()
                 .eq(OrderRepairDetail::getOrderBaseId, orderBase.getId())
@@ -1344,8 +1345,7 @@ public class RepairProduceDataUploadServiceImpl implements RepairProduceDataUplo
         odfs.clear();
     }
 
-    public void OrderDetailFileUpload(OrderBase orderBase, OrderRepairDetail detail){
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
+    public void OrderDetailFileUpload(OrderBase orderBase, OrderRepairDetail detail) throws IOException {
         String oldFile ="";
         String newFile ="";
         // 提取数据采集附件数据
@@ -1360,7 +1360,7 @@ public class RepairProduceDataUploadServiceImpl implements RepairProduceDataUplo
             if (StringUtils.isEmpty(file.getBrandFilePath())){
                 // 上传图片
                 oldFile = publicService.path(file.getFilePath());
-                File nFile = new File(oldFile);
+                File nFile = publicService.createf(oldFile);
 
                 baseService.saveToFile(ossUtil.getUrlWw(file.getFilePath()),nFile);
                 // 获取文件

+ 5 - 9
src/main/java/com/zfire/jiasm/syncdata/service/impl/UploadWorkeCertificateServiceImpl.java

@@ -51,13 +51,10 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
 
     @Override
     public void procesUploadWorkeCert() {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
         List<WorkerCert> recs = new ArrayList<>();
         List<WorkerBrandAccount> workerWdnos = new ArrayList<>();
         String fileo ="";
         String filet ="";
-        String fid1 = "";
-        String fid2 = "";
         String fid3 = "";
         Integer count = 0;
 
@@ -173,7 +170,6 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
      *               不为空正常生成
      */
     private String uploadInsureCert(WorkerBrandAccount wdno) throws Exception {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
         String fileo ="";
         String fid1 = "";
         InsureWorkerRecord wk = insureWorkerRecordService.lambdaQuery()
@@ -183,11 +179,12 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
         if (StringUtils.isEmpty(wk.getOutVoucher())){
             // 生成图片
             if (StringUtils.isEmpty(wk.getVoucher())){
-                fid1 = sdfs.format(new Date())+"bx.jpg";
-                baseService.initFile(fid1);
+                fid1 = publicService.path("bx.jpg");
+                File nFile = publicService.createf(fid1);
+                baseService.initFile(nFile);
             } else {
-                fid1 = IdWorker.getIdStr() + ".jpg";
-                File nFile = new File(fid1);
+                fid1 = publicService.path(wk.getVoucher());
+                File nFile = publicService.createf(fid1);
                 baseService.saveToFile(ossUtil.getUrlWw(wk.getVoucher()),nFile);
             }
             fileo = fid1;
@@ -198,7 +195,6 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
 
 
     private String uploadInsureBx(WorkerBrandAccount wdno) throws Exception {
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
         String fileo ="";
         String fid1 = "";
 

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/service/impl/UploadWorkerTOGreeServiceImpl.java

@@ -271,7 +271,7 @@ public class UploadWorkerTOGreeServiceImpl implements UploadWorkerTOGreeService
             }
         }
 
-        // 使用商户网点的位置
+        // 使用商户网点的位置 一般是存在的
         BrandWebsit bw = brandWebsitService.lambdaQuery()
                 .eq(BrandWebsit::getBrandWebsitNumber, dot.getBrandWebsitId())
                 .last("limit 1").one();

+ 3 - 2
src/main/java/com/zfire/jiasm/syncdata/test.java

@@ -108,8 +108,7 @@ public class test {
         String formatTime = sdf.format(date);
         System.out.println(formatTime);
 
-        SimpleDateFormat sdfs = new SimpleDateFormat("yyyyMM/");
-        System.out.println(sdfs.format(new Date()));
+
 
         String s = "1_p_230720_S9219801_cAwTQeZ4rP-Np3f-2RFN76.png";
         if (s.contains(",")){
@@ -162,6 +161,8 @@ public class test {
         Date newDate = calendar.getTime();
         System.out.println("减去一年后的日期: " + newDate);
 
+
+
     }