Explorar el Código

对接重点工程

bihuisong hace 1 año
padre
commit
99d6d380e4

+ 6 - 0
src/main/java/com/sooka/sponest/dataexchange/remoteapi/fallback/center/event/RemoteEventBaseServiceFallbackFactory.java

@@ -6,6 +6,7 @@ import com.sooka.sponest.dataexchange.exchange.domian.DataExchangeEntity;
 import com.sooka.sponest.dataexchange.exchange.domian.LoginBody;
 import com.sooka.sponest.dataexchange.remoteapi.service.center.auth.RemoteAuthBaseService;
 import com.sooka.sponest.dataexchange.remoteapi.service.center.event.RemoteEventBaseService;
+import com.sooka.sponest.dataexchange.sendChange.domian.CenterdataTKeyProjects;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.cloud.openfeign.FallbackFactory;
@@ -38,6 +39,11 @@ public class RemoteEventBaseServiceFallbackFactory implements FallbackFactory<Re
             public R<?> getDataSubscribeTo() {
                 return null;
             }
+
+            @Override
+            public R<?> projects(CenterdataTKeyProjects centerdataTKeyProjects) {
+                return null;
+            }
         };
     }
 }

+ 9 - 0
src/main/java/com/sooka/sponest/dataexchange/remoteapi/service/center/event/RemoteEventBaseService.java

@@ -7,6 +7,7 @@ import com.sooka.sponest.dataexchange.exchange.domian.LoginBody;
 import com.sooka.sponest.dataexchange.remoteapi.fallback.center.auth.RemoteAuthBaseServiceFallbackFactory;
 import com.sooka.sponest.dataexchange.remoteapi.fallback.center.event.RemoteEventBaseServiceFallbackFactory;
 import com.sooka.sponest.dataexchange.remoteapi.service.ModulesServiceNameContants;
+import com.sooka.sponest.dataexchange.sendChange.domian.CenterdataTKeyProjects;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 
@@ -30,4 +31,12 @@ public interface RemoteEventBaseService {
     @PostMapping("/getDataSubscribeTo")
     public R<?> getDataSubscribeTo();
 
+    /**
+     * 重点工程
+     * @param centerdataTKeyProjects
+     * @return
+     */
+    @PostMapping("/projects")
+    public R<?> projects(CenterdataTKeyProjects centerdataTKeyProjects);
+
 }

+ 141 - 0
src/main/java/com/sooka/sponest/dataexchange/sendChange/controller/EngineeringController.java

@@ -0,0 +1,141 @@
+package com.sooka.sponest.dataexchange.sendChange.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.file.FilePrefixUtils;
+import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.system.api.RemoteConfigService;
+import com.ruoyi.system.api.RemoteFileService;
+import com.ruoyi.system.api.domain.SysFile;
+import com.sooka.sponest.dataexchange.exchange.domian.DataExchangeEntity;
+import com.sooka.sponest.dataexchange.remoteapi.service.center.event.RemoteEventBaseService;
+import com.sooka.sponest.dataexchange.sendChange.domian.CenterdataTKeyProjects;
+import com.sooka.sponest.dataexchange.sendChange.domian.CenterdataTKeyProjectsPictures;
+import com.sooka.sponest.dataexchange.util.RestUtil;
+import com.sooka.sponest.dataexchange.util.spring.SpringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@Controller
+@RequestMapping("/sendChange")
+public class EngineeringController {
+
+    @Resource
+    private RemoteEventBaseService remoteEventBaseService;
+    @Resource
+    private RemoteConfigService remoteConfigService;
+    //    @Value("${}")
+    private String url;
+
+
+    /**
+     * 重点工程
+     * @param
+     * @return
+     */
+    @PostMapping("/pushEngineeringData")
+    @ResponseBody
+    public R<?> pushEngineeringData(@RequestBody CenterdataTKeyProjects centerdataTKeyProjects) {
+        log.info("dataExchangeEntity:{}",centerdataTKeyProjects);
+        if (StringUtils.isNotEmpty(SecurityUtils.getToken())) {
+            R<?> result = remoteEventBaseService.projects(centerdataTKeyProjects);
+            if (result.getCode() == 200) {
+                return R.ok("推送成功");
+            } else {
+                return R.fail(result.getMsg());
+            }
+        } else {
+            return R.fail("推送失败");
+        }
+    }
+
+
+    @PostMapping("/receiveEngineeringData")
+    @ResponseBody
+    public R<?> receiveEngineeringData(@RequestBody CenterdataTKeyProjectsPictures centerdataTKeyProjectsPictures) {
+        System.out.println(centerdataTKeyProjectsPictures);
+        R<String> appUrl = remoteConfigService.remotegetConfigKey("appUrl");
+        List<String> pictureList = new ArrayList<>();
+        for (String picture : centerdataTKeyProjectsPictures.getSchedulePictures()) {
+            pictureList.add(appUrl.getData().toString() + picture);
+        }
+        centerdataTKeyProjectsPictures.setSchedulePictures(pictureList);
+        // TODO: 2024/1/16 0016 待修改
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("", centerdataTKeyProjectsPictures);
+        try {
+            RestUtil.post(url, jsonObject);
+        } catch (Exception e) {
+            log.info("重点工程报错");
+        }
+        return R.ok("接收成功");
+    }
+
+    /**
+     * 重点区域
+     * @param
+     * @return
+     */
+    @PostMapping("/pushAreaData")
+    @ResponseBody
+    public R<?> pushAreaData(@RequestBody DataExchangeEntity dataExchangeEntity) {
+        log.info("dataExchangeEntity:{}",dataExchangeEntity);
+        List<String> pictureList = new ArrayList<>();
+        if (StringUtils.isNotEmpty(SecurityUtils.getToken()) && !CollectionUtils.isEmpty(dataExchangeEntity.getEventPicture())) {
+            for (String picture : dataExchangeEntity.getEventPicture()) {
+                if (!"image".equals(FilePrefixUtils.getUrlSuffix(picture))) {
+                    log.error("事件图片必须为图片格式---{}", dataExchangeEntity);
+                    return R.fail("事件图片必须为图片格式");
+                } else {
+                    MultipartFile multipartFile = FilePrefixUtils.urlToMultipartFile(picture, System.currentTimeMillis() + ".jpg");
+                    SysFile sysFile = SpringUtils.getBean(RemoteFileService.class).upload(multipartFile).getData();
+                    pictureList.add(sysFile.getUrl());
+                }
+            }
+            dataExchangeEntity.setPictureUrlList(pictureList);
+            R<?> result = remoteEventBaseService.insert3rdSystemEvent(dataExchangeEntity);
+            if (result.getCode() == 200) {
+                return R.ok("推送成功");
+            } else {
+                return R.fail(result.getMsg());
+            }
+        } else {
+            return R.fail("推送失败");
+        }
+    }
+
+
+    @PostMapping("/receiveAreaData")
+    @ResponseBody
+    public R<?> receiveAreaData(@RequestBody DataExchangeEntity dataExchangeEntity) {
+        System.out.println(dataExchangeEntity);
+        R<String> appUrl = remoteConfigService.remotegetConfigKey("appUrl");
+        List<String> pictureList = new ArrayList<>();
+        for (String picture : dataExchangeEntity.getEventPicture()) {
+            pictureList.add(appUrl.getData().toString() + picture);
+        }
+        dataExchangeEntity.setEventPicture(pictureList);
+        // TODO: 2024/1/9 0009 待修改
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("", dataExchangeEntity);
+        try {
+            RestUtil.post(url, jsonObject);
+        } catch (Exception e) {
+            log.info("远程调用119报错");
+        }
+        return R.ok("接收成功");
+    }
+}

+ 70 - 0
src/main/java/com/sooka/sponest/dataexchange/sendChange/domian/CenterdataTForestImportarea.java

@@ -0,0 +1,70 @@
+package com.sooka.sponest.dataexchange.sendChange.domian;
+
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 重点区域
+ */
+
+@Data
+public class CenterdataTForestImportarea {
+
+    // 主键id
+    private String id;
+
+    // 创建人
+    private Long createBy;
+
+    // 创建人姓名
+    private String createName;
+
+    // 创建时间
+    private Date createTime;
+
+    // 更新人
+    private Long updateBy;
+
+    // 更新人姓名
+    private String updateName;
+
+    // 更新时间
+    private Date updateTime;
+
+    // 数据状态(1-可用 2-不可用)
+    private String deptStatus;
+
+    // 数据所属部门(政或党的id)
+    private Long deptId;
+
+    // 部门名称
+    private String deptName;
+
+    // 纬度
+    private String latitude;
+
+    // 经度
+    private String longitude;
+
+    // 区域名称
+    private String areaName;
+
+    // 区域基本信息
+    private String areaInfo;
+
+    // 区域类型
+    private String areaType;
+
+    // 工程类型
+    private String projectType;
+
+    // 工程级别
+    private String projectLevel;
+
+    // 附件
+    private String photoId;
+
+
+}

+ 45 - 0
src/main/java/com/sooka/sponest/dataexchange/sendChange/domian/CenterdataTKeyProjects.java

@@ -0,0 +1,45 @@
+package com.sooka.sponest.dataexchange.sendChange.domian;
+
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 重点工程
+ */
+@Data
+public class CenterdataTKeyProjects {
+
+    private String projectName;
+    private String environment;
+    private String principal;
+    private String phone;
+    private String constructionSite;
+    private String longitude;
+    private String latitude;
+    private String introduction;
+    private String territoriality;
+    private String parkLongitude;
+    private String totalInvest;
+    private String legalUnit;
+    private String secretaryDuties;
+    private String industryType;
+    private String nature;
+    private String yearInvest;
+    private String secretary;
+    private String parkLatitude;
+    private String secretaryPhone;
+    private String startTime;
+    private String endTime;
+    private String continuationProjectInvest;
+    private String continuationProjectStartTime;
+    private String joinStatisticalBank;
+    private String joinStatistical;
+    private String joinStatisticalInvest;
+    private String thisYearCumulativeInvestment;
+    private String realityCompletedTime;
+    private String springStartProject;
+    private String id;
+
+}

+ 17 - 0
src/main/java/com/sooka/sponest/dataexchange/sendChange/domian/CenterdataTKeyProjectsPictures.java

@@ -0,0 +1,17 @@
+package com.sooka.sponest.dataexchange.sendChange.domian;
+
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 重点工程图片
+ */
+@Data
+public class CenterdataTKeyProjectsPictures {
+
+
+    private List<String> schedulePictures;
+
+}