|
@@ -1,14 +1,18 @@
|
|
|
package com.sooka.sponest.data.generalbusiness.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
+import com.ruoyi.common.core.utils.bean.BeanUtils;
|
|
|
import com.ruoyi.common.core.web.controller.BaseController;
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
|
import com.ruoyi.common.log.annotation.Log;
|
|
|
import com.ruoyi.common.log.enums.BusinessType;
|
|
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|
|
+import com.ruoyi.system.api.domain.SysUser;
|
|
|
import com.sooka.sponest.data.generalbusiness.domain.CenterdataTKeyProjects;
|
|
|
+import com.sooka.sponest.data.generalbusiness.domain.CenterdataTKeyProjectsBo;
|
|
|
import com.sooka.sponest.data.generalbusiness.service.ICenterdataTKeyProjectsService;
|
|
|
import com.sooka.sponest.data.utils.ExcelUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -20,7 +24,11 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 重点工程Controller
|
|
@@ -160,13 +168,31 @@ public class CenterdataTKeyProjectsController extends BaseController {
|
|
|
@ApiOperation(value = "接受报文", notes = "接受报文")
|
|
|
@Log(title = "接受报文", businessType = BusinessType.INSERT)
|
|
|
@PostMapping("/receivedMessage")
|
|
|
- public AjaxResult receivedMessage(@RequestBody List<CenterdataTKeyProjects> centerdataTKeyProjects) {
|
|
|
- for (CenterdataTKeyProjects projects : centerdataTKeyProjects){
|
|
|
+ public AjaxResult receivedMessage(@RequestBody Map<String,Object> map) {
|
|
|
+ List list = JSON.parseArray(JSON.toJSONString(map.get("list")));
|
|
|
+ List<CenterdataTKeyProjects> centerdataTKeyProjectsList=new ArrayList<>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
+ list.forEach(item->{
|
|
|
+ CenterdataTKeyProjects centerdataTKeyProjects= new CenterdataTKeyProjects();
|
|
|
+ CenterdataTKeyProjectsBo centerdataTKeyProjectsBo= JSON.parseObject(JSON.toJSONString(item), CenterdataTKeyProjectsBo.class);
|
|
|
+ BeanUtils.copyProperties(centerdataTKeyProjectsBo,centerdataTKeyProjects);
|
|
|
+ try {
|
|
|
+ centerdataTKeyProjects.setEndTime(sdf.parse(centerdataTKeyProjectsBo.getEndTime()));
|
|
|
+ centerdataTKeyProjects.setRealityCompletedTime(sdf.parse(centerdataTKeyProjectsBo.getRealityCompletedTime()));
|
|
|
+ centerdataTKeyProjects.setStartTime(sdf.parse(centerdataTKeyProjectsBo.getStartTime()));
|
|
|
+ centerdataTKeyProjects.setContinuationProjectStartTime(sdf.parse(centerdataTKeyProjectsBo.getContinuationProjectStartTime()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ centerdataTKeyProjectsList.add(centerdataTKeyProjects);
|
|
|
+
|
|
|
+ });
|
|
|
+ for (CenterdataTKeyProjects projects : centerdataTKeyProjectsList ){
|
|
|
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,"缺少必要参数");
|
|
|
+ return AjaxResult.error(5002, "缺少必要参数");
|
|
|
}
|
|
|
if (projects.getEndTime()!=null&&projects.getStartTime()!=null){
|
|
|
if (projects.getEndTime().compareTo(projects.getStartTime())<0){
|
|
@@ -174,9 +200,19 @@ public class CenterdataTKeyProjectsController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- int result;
|
|
|
- try {
|
|
|
- result = centerdataTKeyProjectsService.receivedMessage(centerdataTKeyProjects);
|
|
|
+ int result = 0;
|
|
|
+ try {Object userInfoObject = map.get("userInfo");
|
|
|
+ if (userInfoObject instanceof Map) {
|
|
|
+ Map<String, Object> userInfoMap = (Map<String, Object>) userInfoObject;
|
|
|
+ SysUser sysUser = new SysUser(); // 创建SysUser实体类对象
|
|
|
+
|
|
|
+ // 将userInfoMap中的属性值赋值给sysUser对象的对应属性
|
|
|
+ sysUser.setDeptId(Long.valueOf(userInfoMap.get("deptId").toString()));
|
|
|
+ sysUser.setDeptNames(userInfoMap.get("deptNames").toString());
|
|
|
+ sysUser.setUserId(Long.valueOf(userInfoMap.get("userId").toString()));
|
|
|
+ sysUser.setNickName(userInfoMap.get("nickName").toString());
|
|
|
+ result = centerdataTKeyProjectsService.receivedMessage(centerdataTKeyProjectsList,sysUser);
|
|
|
+ }
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.getMessage());
|
|
|
return AjaxResult.error("数据格式错误");
|
|
@@ -195,4 +231,5 @@ public class CenterdataTKeyProjectsController extends BaseController {
|
|
|
public R pushMessage(@PathVariable String[] ids) {
|
|
|
return centerdataTKeyProjectsService.pushMessage(ids);
|
|
|
}
|
|
|
+
|
|
|
}
|