管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-04-22 cc816055746ae0ffa870734e5a411b2a2aabb96a
src/main/java/com/lf/server/service/show/ExportService.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSON;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.all.StaticData;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.show.ExportEntity;
import com.lf.server.entity.sys.UserEntity;
@@ -25,7 +26,7 @@
 */
@Service
public class ExportService {
    @Value("${sys.path.exportServer}")
    @Value("${sys.exportServer}")
    private String exportServer;
    @Autowired
@@ -52,7 +53,7 @@
        }
        ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class);
        if (msg == null || msg.getCode() != 200) {
        if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) {
            return null;
        }
@@ -62,7 +63,7 @@
            return null;
        }
        DownloadEntity de = getDownloadEntity(ue, file);
        DownloadEntity de = getDownloadEntity(ue, entity, file);
        int rows = downloadService.insert(de);
        return rows > 0 ? de.getGuid() : null;
@@ -72,12 +73,12 @@
     * 获取Map数据
     */
    private Map<String, Object> getMapData(ExportEntity entity) {
        Map<String, Object> map = new HashMap<String, Object>();
        Map<String, Object> map = new HashMap<String, Object>(3);
        Field[] fields = entity.getClass().getDeclaredFields();
        for (Field field : fields) {
            try {
                if (field.getName() == "serialVersionUID") {
                if ("serialVersionUID".equals(field.getName())) {
                    continue;
                }
@@ -96,15 +97,18 @@
    /**
     * 获取下载实体类
     */
    private DownloadEntity getDownloadEntity(UserEntity ue, String file) throws Exception {
    private DownloadEntity getDownloadEntity(UserEntity ue, ExportEntity entity, String file) throws Exception {
        DownloadEntity de = new DownloadEntity();
        de.setName(FileHelper.getFileName(file));
        // 1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析,6-统计报告,7-附件文件,8-瓦片文件
        de.setType(2);
        de.setSizes(FileHelper.sizeToMb(new File(file).length()));
        de.setDepid(ue.getDepid());
        de.setDcount(0);
        // de.setPwd(null)
        de.setUrl(FileHelper.getRelativePath(file));
        de.setDescr("专题图文件");
        // de.setDescr("专题图文件")
        de.setDescr(StringHelper.isEmpty(entity.getTitle()) ? "专题图文件" : entity.getTitle().trim());
        de.setGuid(FileHelper.getFileMd5(file));
        de.setCreateUser(ue.getId());
        // de.setGeom(null)