Browse Source

重点工程

hanfucheng 1 year ago
parent
commit
d09e4936cd

+ 17 - 3
src/main/java/com/sooka/sponest/data/generalbusiness/controller/CenterdataTKeyProjectsController.java

@@ -1,6 +1,7 @@
 package com.sooka.sponest.data.generalbusiness.controller;
 
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -159,15 +160,28 @@ public class CenterdataTKeyProjectsController extends BaseController {
     @ApiOperation(value = "接受报文", notes = "接受报文")
     @Log(title = "接受报文", businessType = BusinessType.INSERT)
     @PostMapping("/receivedMessage")
-    public AjaxResult receivedMessage(@Validated @RequestBody List<CenterdataTKeyProjects> centerdataTKeyProjects) {
+    public AjaxResult receivedMessage(@RequestBody List<CenterdataTKeyProjects> centerdataTKeyProjects) {
         for (CenterdataTKeyProjects projects : centerdataTKeyProjects){
+            if (StringUtils.isEmpty(projects.getProjectId())||StringUtils.isEmpty(projects.getProjectName())||StringUtils.isEmpty(projects.getLongitude())||
+                    StringUtils.isEmpty(projects.getLatitude())||StringUtils.isEmpty(projects.getTerritoriality())||StringUtils.isEmpty(projects.getPrincipal())||
+                    StringUtils.isEmpty(projects.getPhone())||StringUtils.isEmpty(projects.getConstructionSite())||StringUtils.isEmpty(projects.getNature())||
+            StringUtils.isEmpty(projects.getIntroduction())){
+                return AjaxResult.error(5002,"缺少必要参数");
+            }
             if (projects.getEndTime()!=null&&projects.getStartTime()!=null){
                 if (projects.getEndTime().compareTo(projects.getStartTime())<0){
-                    return AjaxResult.error("项目名称'"+projects.getProjectName()+"'的计划竣工时间不能小于开复工时间");
+                    return AjaxResult.error(5003,"计划竣工时间不能小于开复工时间");
                 }
             }
         }
-        return toAjax(centerdataTKeyProjectsService.receivedMessage(centerdataTKeyProjects));
+        int result;
+        try {
+            result = centerdataTKeyProjectsService.receivedMessage(centerdataTKeyProjects);
+        }catch (Exception e){
+            logger.error(e.getMessage());
+            return AjaxResult.error("数据格式错误");
+        }
+        return toAjax(result);
     }
 
     /*