|
@@ -1,9 +1,15 @@
|
|
|
package com.fdkankan.manage_jp.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.manage_jp.common.OssPath;
|
|
|
import com.fdkankan.manage_jp.common.PageInfo;
|
|
|
import com.fdkankan.manage_jp.common.ResultCode;
|
|
|
import com.fdkankan.manage_jp.entity.Company;
|
|
@@ -13,13 +19,11 @@ import com.fdkankan.manage_jp.entity.SceneProEdit;
|
|
|
import com.fdkankan.manage_jp.exception.BusinessException;
|
|
|
import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage_jp.mapper.ISceneProMapper;
|
|
|
-import com.fdkankan.manage_jp.service.ICompanyService;
|
|
|
-import com.fdkankan.manage_jp.service.IScenePlusService;
|
|
|
-import com.fdkankan.manage_jp.service.ISceneProEditService;
|
|
|
-import com.fdkankan.manage_jp.service.ISceneProService;
|
|
|
+import com.fdkankan.manage_jp.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.manage_jp.vo.request.SceneParam;
|
|
|
import com.fdkankan.manage_jp.vo.response.SceneVo;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -37,6 +41,7 @@ import java.util.stream.Collectors;
|
|
|
* @since 2022-12-30
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro> implements ISceneProService {
|
|
|
|
|
|
@Autowired
|
|
@@ -47,6 +52,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
ISceneProEditService sceneProEditService;
|
|
|
@Autowired
|
|
|
ICompanyService companyService;
|
|
|
+ @Autowired
|
|
|
+ IScenePlusExtService scenePlusExtService;
|
|
|
+ @Autowired
|
|
|
+ FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -120,4 +129,46 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteByNum(String num) {
|
|
|
+ ScenePro scenePro = this.getByNum(num);
|
|
|
+ if(scenePro!=null){
|
|
|
+ this.removeById(scenePro.getId());
|
|
|
+ this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),"I");
|
|
|
+ }
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
+ if(scenePlus!=null){
|
|
|
+ scenePlusService.removeById(scenePlus.getId());
|
|
|
+ scenePlusExtService.delByPlus(scenePlus.getId());
|
|
|
+ this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePro.getNum()),"A");
|
|
|
+ }
|
|
|
+ if(num.contains("SS")){
|
|
|
+ laserService.delete(num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void updateOssStatus(String path,String recStatus) {
|
|
|
+ try {
|
|
|
+ if(!fYunFileServiceInterface.fileExist(path)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String data = fYunFileServiceInterface.getFileContent(path);
|
|
|
+ if(StringUtils.isBlank(data)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ jsonObject.put("recStatus",recStatus);
|
|
|
+ String json = JSONUtil.toJsonStr(jsonObject);
|
|
|
+ FileUtils.writeFile(OssPath.localStatusPath ,json);
|
|
|
+ log.info("updateOssStatus--localPath:{},ossPath:{}",OssPath.localStatusPath,path);
|
|
|
+ fYunFileServiceInterface.uploadFile(OssPath.localStatusPath,path);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ FileUtil.del(OssPath.localStatusPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|