| | |
| | | import com.whyc.pojo.FgcdFiledownload; |
| | | import com.whyc.pojo.Response; |
| | | import com.whyc.util.CmdUtil; |
| | | import com.whyc.util.FileDirPath; |
| | | import com.whyc.util.FileUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class FgcdFiledownloadService { |
| | |
| | | boolean bl=sendCmd(CmdUtil.CMD_DOLADCANCLE,0,0,null,devId); |
| | | return new Response().set(1,bl); |
| | | } |
| | | //读取指定设备服务器文件列表 |
| | | public Response getDevFileName(int devId,String battName) { |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | String root=fileDirName+ File.separator+"FDFiles"+File.separator+devId+File.separator+battName; |
| | | List list = new ArrayList<>(); |
| | | list= FileUtil.getStaticFilePath(new File(root),list); |
| | | return new Response().setII(1,list!=null,list,"读取指定设备服务器文件列表"); |
| | | } |
| | | //判断文件是否在服务器上 |
| | | public Response JudgeDevFileName(int devId, String battName, String fileName) { |
| | | boolean bl=true; |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | String root=fileDirName+ File.separator+"FDFiles"+File.separator+devId+File.separator+battName+File.separator+fileName; |
| | | File file=new File(root); |
| | | if (file == null || !file.exists()) { |
| | | bl=false; |
| | | } |
| | | return new Response().set(1,bl); |
| | | } |
| | | } |