Merge branch 'develop_master' into develop_migration
# Conflicts: # adc-da-jwtLogin/src/main/java/com/adc/da/login/security/WebMvcConfig.java
This commit is contained in:
@@ -40,6 +40,13 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
addInterceptor.excludePathPatterns("/api/person/userInfo/getByUserInfoCode");
|
addInterceptor.excludePathPatterns("/api/person/userInfo/getByUserInfoCode");
|
||||||
addInterceptor.excludePathPatterns("/api/att/attFile/upload");
|
addInterceptor.excludePathPatterns("/api/att/attFile/upload");
|
||||||
addInterceptor.excludePathPatterns("/api/sarStandardsInfo/sar-standards-info/exportStandardsInfoExcel");
|
addInterceptor.excludePathPatterns("/api/sarStandardsInfo/sar-standards-info/exportStandardsInfoExcel");
|
||||||
|
//pcms项目数据下发开放接口
|
||||||
|
addInterceptor.excludePathPatterns("/api/sarStandProjectLibrary/save");
|
||||||
|
addInterceptor.excludePathPatterns("/slrs/sar-stand-project-team/save");
|
||||||
|
//tc模块结构单元数据
|
||||||
|
addInterceptor.excludePathPatterns("/api/sarModelTree/save");
|
||||||
|
addInterceptor.excludePathPatterns("/api/DataSync/importUserData");
|
||||||
|
addInterceptor.excludePathPatterns("/api/DataSync/importOrgData");
|
||||||
|
|
||||||
// 添加自定义拦截器,并拦截对应 url
|
// 添加自定义拦截器,并拦截对应 url
|
||||||
addInterceptor.addPathPatterns("/**");
|
addInterceptor.addPathPatterns("/**");
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.adc.da.scheduled;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.DataSync.DataSyncController;
|
||||||
|
import com.adc.da.slrs.DataSync.service.IDataSyncService;
|
||||||
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时同步用户和组织机构信息
|
||||||
|
*/
|
||||||
|
@EnableScheduling
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ScheduledSync {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDataSyncService iDataSyncService;
|
||||||
|
|
||||||
|
|
||||||
|
// @Scheduled(cron = "0 */40 * * * ?") //40分钟执行同步一次
|
||||||
|
// @Scheduled(cron="*/5 * * * * ?")
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void syncSchedulingTasks() throws Exception {
|
||||||
|
iDataSyncService.orgDataSync(); //时间短
|
||||||
|
iDataSyncService.dataSync(); //时间长
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.adc.da.slrs.DataSync;
|
package com.adc.da.slrs.DataSync;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.DataSync.service.IDataSyncService;
|
||||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||||
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
||||||
import com.adc.da.slrs.sarInstitution.service.impl.TsInstitutionServiceImpl;
|
import com.adc.da.slrs.sarInstitution.service.impl.TsInstitutionServiceImpl;
|
||||||
@@ -17,9 +18,11 @@ import com.adc.da.sys.service.IOrgEOService;
|
|||||||
import com.adc.da.sys.service.impl.OrgEOServiceImpl;
|
import com.adc.da.sys.service.impl.OrgEOServiceImpl;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -30,120 +33,25 @@ import java.util.*;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Api(description = "|SarStandPutTime|")
|
@Api(description = "|SarStandPutTime|")
|
||||||
@RequestMapping("/DataSync")
|
@RequestMapping("/${restPath}/DataSync")
|
||||||
public class DataSyncController {
|
public class DataSyncController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ITsPositionService tsPositionService;
|
private IDataSyncService iDataSyncService;
|
||||||
@Autowired
|
|
||||||
ITsUserService tsUserService;
|
|
||||||
@Autowired
|
|
||||||
ITsInstitutionService tsInstitutionService;
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("同步用户数据")
|
@ApiOperation("同步用户数据")
|
||||||
@PostMapping("/importUserData")
|
@PostMapping("/importUserData")
|
||||||
public String importUserData() throws Exception {
|
public String importUserData() throws Exception {
|
||||||
SyncUserService syncUserService = new SyncUserService();
|
return iDataSyncService.dataSync();
|
||||||
List<String> res = syncUserService.syncFotonUser();
|
|
||||||
//存放岗位信息
|
|
||||||
Map<String, String> positionMap = new HashMap<>();
|
|
||||||
Map<String, String> useDistinct = new HashMap<>();
|
|
||||||
TsPosition position = new TsPosition();
|
|
||||||
position.setCurrent(1);
|
|
||||||
position.setPageSize(100000);
|
|
||||||
IPage<TsPosition> iPage = tsPositionService.getPosition(position);
|
|
||||||
List<TsPosition> positions=iPage.getRecords();
|
|
||||||
if (!positions.isEmpty()) {
|
|
||||||
positions.forEach(tsPosition -> {
|
|
||||||
positionMap.put(tsPosition.getName(), tsPosition.getId());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
for (String s : res) {
|
|
||||||
//获取到所有用户数据
|
|
||||||
List<TsUser> tsUsers = new ArrayList<>();
|
|
||||||
|
|
||||||
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
|
||||||
jsonArray.forEach(object -> {
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
|
||||||
//先获取岗位以及岗位id
|
|
||||||
TsUser tsUser = new TsUser();
|
|
||||||
UserOrgEO userOrgEO = new UserOrgEO();
|
|
||||||
//设置岗位
|
|
||||||
if (null != jsonObject.getString("title")) {
|
|
||||||
if (null == positionMap.get(jsonObject.getString("title"))) {
|
|
||||||
TsPosition tsPosition = new TsPosition();
|
|
||||||
tsPosition.setId(String.valueOf(UUID.randomUUID()));
|
|
||||||
tsPosition.setName(jsonObject.getString("title"));
|
|
||||||
tsPositionService.addPosition(tsPosition);
|
|
||||||
//放入岗位的map集合中
|
|
||||||
positionMap.put(tsPosition.getName(), tsPosition.getId());
|
|
||||||
//放入类中
|
|
||||||
tsUser.setPositionName(tsPosition.getName());
|
|
||||||
tsUser.setPositionId(tsPosition.getId());
|
|
||||||
} else {
|
|
||||||
tsUser.setPositionName(jsonObject.getString("title").trim());
|
|
||||||
tsUser.setPositionId(positionMap.get(jsonObject.getString("title").trim()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//设置其他数据
|
|
||||||
Timestamp createTime = new Timestamp(new Date().getTime());
|
|
||||||
tsUser.setState(jsonObject.getString("userStatus"));
|
|
||||||
tsUser.setUname(null!=jsonObject.getString("name")?jsonObject.getString("name"):"");
|
|
||||||
tsUser.setValidFlag("0");
|
|
||||||
tsUser.setDisableFlag("0");
|
|
||||||
tsUser.setCreationTime(createTime);
|
|
||||||
tsUser.setUserId(jsonObject.getString("userid"));
|
|
||||||
tsUser.setAccount(jsonObject.getString("userid"));
|
|
||||||
tsUser.setInstitutionId(null!=jsonObject.getString("orgNumber")?jsonObject.getString("orgNumber"):"" );
|
|
||||||
tsUser.setInstitutionName(null!=jsonObject.getString("orgName")?jsonObject.getString("orgName"):"" );
|
|
||||||
if (null == useDistinct.get(jsonObject.getString("userid"))) {
|
|
||||||
tsUsers.add(tsUser);
|
|
||||||
|
|
||||||
}
|
|
||||||
useDistinct.put(tsUser.getUserId(),tsUser.getUserId());
|
|
||||||
});
|
|
||||||
tsUserService.saveBatch(tsUsers);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("同步组织机构")
|
@ApiOperation("同步组织机构")
|
||||||
@PostMapping("/importOrgData")
|
@PostMapping("/importOrgData")
|
||||||
public String importOrgData() throws Exception {
|
public String importOrgData() throws Exception {
|
||||||
SyncUserService syncUserService = new SyncUserService();
|
return iDataSyncService.orgDataSync();
|
||||||
List<String> res = syncUserService.syncFotonOrg();
|
|
||||||
|
|
||||||
//获取到所有用户数据
|
|
||||||
List<String> strings=new ArrayList<>();
|
|
||||||
|
|
||||||
tsInstitutionService.clearData();
|
|
||||||
for (String s : res) {
|
|
||||||
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
|
||||||
jsonArray.forEach(object -> {
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
|
||||||
strings.add(jsonObject.getString("parentOrgNumber"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
for (String s : res) {
|
|
||||||
List<TsInstitution> tsInstitutions = new ArrayList<>();
|
|
||||||
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
|
||||||
jsonArray.forEach(object -> {
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
|
||||||
TsInstitution tsInstitution=new TsInstitution();
|
|
||||||
tsInstitution.setId(jsonObject.getString("orgNumber"));
|
|
||||||
tsInstitution.setName(jsonObject.getString("orgName"));
|
|
||||||
tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0");
|
|
||||||
tsInstitution.setParentId(jsonObject.getString("parentOrgNumber"));
|
|
||||||
//部门为"null"的数据不保存
|
|
||||||
if (!"null".equals(jsonObject.getString("orgName"))){
|
|
||||||
tsInstitutions.add(tsInstitution);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tsInstitutionService.saveBatch(tsInstitutions);
|
|
||||||
}
|
|
||||||
return "1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.adc.da.slrs.DataSync.service;
|
||||||
|
|
||||||
|
public interface IDataSyncService {
|
||||||
|
|
||||||
|
public String dataSync() throws Exception;
|
||||||
|
|
||||||
|
public String orgDataSync() throws Exception;
|
||||||
|
}
|
||||||
+173
@@ -0,0 +1,173 @@
|
|||||||
|
package com.adc.da.slrs.DataSync.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.DataSync.service.IDataSyncService;
|
||||||
|
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||||
|
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
||||||
|
import com.adc.da.slrs.sarPosition.entity.TsPosition;
|
||||||
|
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
|
||||||
|
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||||
|
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||||
|
import com.adc.da.sync.service.SyncUserService;
|
||||||
|
import com.adc.da.sys.entity.UserOrgEO;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DataSyncServiceImpl implements IDataSyncService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ITsPositionService tsPositionService;
|
||||||
|
@Autowired
|
||||||
|
ITsUserService tsUserService;
|
||||||
|
@Autowired
|
||||||
|
ITsInstitutionService tsInstitutionService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String dataSync() throws Exception {
|
||||||
|
SyncUserService syncUserService = new SyncUserService();
|
||||||
|
List<String> res = syncUserService.syncFotonUser();
|
||||||
|
//存放岗位信息
|
||||||
|
Map<String, String> positionMap = new HashMap<>();
|
||||||
|
Map<String, String> useDistinct = new HashMap<>();
|
||||||
|
TsPosition position = new TsPosition();
|
||||||
|
position.setCurrent(1);
|
||||||
|
position.setPageSize(100000);
|
||||||
|
IPage<TsPosition> iPage = tsPositionService.getPosition(position);
|
||||||
|
List<TsPosition> positions=iPage.getRecords();
|
||||||
|
if (!positions.isEmpty()) {
|
||||||
|
positions.forEach(tsPosition -> {
|
||||||
|
positionMap.put(tsPosition.getName(), tsPosition.getId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到数据时,删除系统表中所有用户信息
|
||||||
|
*/
|
||||||
|
if (res.size()>0){
|
||||||
|
tsUserService.deleteUser();
|
||||||
|
}
|
||||||
|
for (String s : res) {
|
||||||
|
//获取到所有用户数据
|
||||||
|
List<TsUser> tsUsers = new ArrayList<>();
|
||||||
|
|
||||||
|
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
||||||
|
jsonArray.forEach(object -> {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
||||||
|
//先获取岗位以及岗位id
|
||||||
|
TsUser tsUser = new TsUser();
|
||||||
|
UserOrgEO userOrgEO = new UserOrgEO();
|
||||||
|
//设置岗位
|
||||||
|
if (null != jsonObject.getString("title")) {
|
||||||
|
//通过岗位名称查询系统表中是否有岗位,有则设定用户的岗位为系统中的岗位,否则新增
|
||||||
|
if (null == positionMap.get(jsonObject.getString("title"))) {
|
||||||
|
TsPosition tsPosition = new TsPosition();
|
||||||
|
tsPosition.setId(String.valueOf(UUID.randomUUID()));
|
||||||
|
tsPosition.setName(jsonObject.getString("title"));
|
||||||
|
tsPositionService.addPosition(tsPosition);
|
||||||
|
//放入岗位的map集合中
|
||||||
|
positionMap.put(tsPosition.getName(), tsPosition.getId());
|
||||||
|
//放入类中
|
||||||
|
tsUser.setPositionName(tsPosition.getName());
|
||||||
|
tsUser.setPositionId(tsPosition.getId());
|
||||||
|
} else {
|
||||||
|
tsUser.setPositionName(jsonObject.getString("title").trim());
|
||||||
|
tsUser.setPositionId(positionMap.get(jsonObject.getString("title").trim()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//设置其他数据
|
||||||
|
Timestamp createTime = new Timestamp(new Date().getTime());
|
||||||
|
tsUser.setState(jsonObject.getString("userStatus"));
|
||||||
|
tsUser.setUname(null!=jsonObject.getString("name")?jsonObject.getString("name"):"");
|
||||||
|
tsUser.setValidFlag("0");
|
||||||
|
tsUser.setDisableFlag("0");
|
||||||
|
tsUser.setCreationTime(createTime);
|
||||||
|
tsUser.setUserId(jsonObject.getString("userid"));
|
||||||
|
tsUser.setAccount(jsonObject.getString("userid"));
|
||||||
|
tsUser.setInstitutionId(null!=jsonObject.getString("orgNumber")?jsonObject.getString("orgNumber"):"" );
|
||||||
|
tsUser.setInstitutionName(null!=jsonObject.getString("orgName")?jsonObject.getString("orgName"):"" );
|
||||||
|
if (null == useDistinct.get(jsonObject.getString("userid"))) {
|
||||||
|
tsUsers.add(tsUser);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// //测试数据删除
|
||||||
|
// if (! "anbin".equals(jsonObject.getString("userid"))){
|
||||||
|
//
|
||||||
|
// //测试数据修改
|
||||||
|
// if ("anbing".equals(jsonObject.getString("userid"))){
|
||||||
|
// tsUser.setUname("DDDDDD");
|
||||||
|
// tsUsers.add(tsUser);
|
||||||
|
// } else if (null == useDistinct.get(jsonObject.getString("userid"))) {
|
||||||
|
// tsUsers.add(tsUser);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
useDistinct.put(tsUser.getUserId(),tsUser.getUserId());
|
||||||
|
});
|
||||||
|
tsUserService.saveBatch(tsUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
//测试数据添加
|
||||||
|
// TsUser addUser = new TsUser();
|
||||||
|
// addUser.setState("FFFFFFF");
|
||||||
|
// addUser.setUname("zhaokaiyao");
|
||||||
|
// addUser.setValidFlag("0");
|
||||||
|
// addUser.setDisableFlag("0");
|
||||||
|
// addUser.setCreationTime(new Timestamp(new Date().getTime()));
|
||||||
|
// addUser.setUserId("FFFFFFF");
|
||||||
|
// addUser.setAccount("zhaokaiyao");
|
||||||
|
// addUser.setInstitutionId("10022745");
|
||||||
|
// addUser.setInstitutionName("福田营销其他");
|
||||||
|
//
|
||||||
|
// List<TsUser> addUserList = Arrays.asList(addUser);
|
||||||
|
// tsUserService.saveBatch(addUserList);
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String orgDataSync() throws Exception {
|
||||||
|
SyncUserService syncUserService = new SyncUserService();
|
||||||
|
List<String> res = syncUserService.syncFotonOrg();
|
||||||
|
|
||||||
|
//获取到所有用户数据
|
||||||
|
List<String> strings=new ArrayList<>();
|
||||||
|
|
||||||
|
tsInstitutionService.clearData();
|
||||||
|
for (String s : res) {
|
||||||
|
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
||||||
|
jsonArray.forEach(object -> {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
||||||
|
strings.add(jsonObject.getString("parentOrgNumber"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for (String s : res) {
|
||||||
|
List<TsInstitution> tsInstitutions = new ArrayList<>();
|
||||||
|
JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results"));
|
||||||
|
jsonArray.forEach(object -> {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
||||||
|
TsInstitution tsInstitution=new TsInstitution();
|
||||||
|
tsInstitution.setId(jsonObject.getString("orgNumber"));
|
||||||
|
tsInstitution.setName(jsonObject.getString("orgName"));
|
||||||
|
tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0");
|
||||||
|
tsInstitution.setParentId(jsonObject.getString("parentOrgNumber"));
|
||||||
|
//部门为"null"的数据不保存
|
||||||
|
if (!"null".equals(jsonObject.getString("orgName"))){
|
||||||
|
tsInstitutions.add(tsInstitution);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tsInstitutionService.saveBatch(tsInstitutions);
|
||||||
|
}
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
-4
@@ -3,14 +3,18 @@ package com.adc.da.slrs.sarModelTree.controller;
|
|||||||
|
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.http.Result;
|
import com.adc.da.http.Result;
|
||||||
|
import com.adc.da.slrs.sarModelTree.entity.ResponseResult;
|
||||||
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
|
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
|
||||||
|
import com.adc.da.slrs.sarModelTree.service.ISarModuleTreeService;
|
||||||
|
import com.adc.da.slrs.sarModelTree.service.impl.SarModuleTreeServiceImpl;
|
||||||
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.Company;
|
||||||
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.Head;
|
||||||
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.ResponseDto;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.adc.da.base.web.BaseController;
|
import com.adc.da.base.web.BaseController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,10 +35,14 @@ public class SarModelTreeController extends BaseController<SarModelTree> {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISarModelTreeService iSarModelTreeService;
|
private ISarModelTreeService iSarModelTreeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISarModuleTreeService iSarModuleTreeService;
|
||||||
|
|
||||||
@ApiOperation("查询父所有资源")
|
@ApiOperation("查询父所有资源")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public ResponseMessage<List<SarModelTree>> getAll(SarModelTree sarVppsTree){
|
public ResponseMessage<List<SarModelTree>> getAll(SarModelTree sarVppsTree){
|
||||||
List<SarModelTree> tsResources = iSarModelTreeService.getAll(sarVppsTree);
|
// List<SarModelTree> tsResources = iSarModelTreeService.getAll(sarVppsTree);
|
||||||
|
List<SarModelTree> tsResources = iSarModuleTreeService.getAll(sarVppsTree);
|
||||||
return Result.success(tsResources);
|
return Result.success(tsResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,4 +54,16 @@ public class SarModelTreeController extends BaseController<SarModelTree> {
|
|||||||
List<SarModelTree> tsResources = iSarModelTreeService.recursionGetChildren(tree);
|
List<SarModelTree> tsResources = iSarModelTreeService.recursionGetChildren(tree);
|
||||||
return Result.success(tsResources);
|
return Result.success(tsResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("同步模块单元信息")
|
||||||
|
@PostMapping("/save")
|
||||||
|
public ResponseDto save(@RequestBody String json){
|
||||||
|
//todo 实现解析并存储的到数据库
|
||||||
|
Head head = iSarModuleTreeService.analysisJsonAndStorage(json);
|
||||||
|
ResponseDto responseDto = new ResponseDto(head);
|
||||||
|
return responseDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.adc.da.slrs.sarModelTree.dao;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.sarModelTree.entity.SarModuleTree;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
public interface SarModuleTreeDao extends BaseMapper<SarModuleTree> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.adc.da.slrs.sarModelTree.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步数据时使用的返回给其他系统的结果
|
||||||
|
*/
|
||||||
|
public class ResponseResult {
|
||||||
|
private String GUID; //序列号 业务主键
|
||||||
|
|
||||||
|
private String MESSAGE; //接口信息 失败时,详细的失败原因
|
||||||
|
|
||||||
|
private String STATUS; //接口状态 B(失败),S(成功)
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.adc.da.slrs.sarModelTree.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sar_module_tree")
|
||||||
|
public class SarModuleTree {
|
||||||
|
|
||||||
|
@SerializedName("GUID")
|
||||||
|
@TableId
|
||||||
|
private String guid;
|
||||||
|
@SerializedName("FTVSTYPE1")
|
||||||
|
@TableField("FTVSTYPE1")
|
||||||
|
private String ftvstype1;
|
||||||
|
|
||||||
|
|
||||||
|
@SerializedName("FTVSTYPE2")
|
||||||
|
@TableField("FTVSTYPE2")
|
||||||
|
private String ftvstype2;
|
||||||
|
|
||||||
|
@SerializedName("FTVSTYPE3")
|
||||||
|
@TableField("FTVSTYPE3")
|
||||||
|
private String ftvstype3;
|
||||||
|
|
||||||
|
@SerializedName("FTVSTYPE4")
|
||||||
|
@TableField("FTVSTYPE4")
|
||||||
|
private String ftvstype4;
|
||||||
|
|
||||||
|
@SerializedName("FTVSTYPE5")
|
||||||
|
@TableField("FTVSTYPE5")
|
||||||
|
private String ftvstype5;
|
||||||
|
|
||||||
|
@SerializedName("FTVSTYPE6")
|
||||||
|
@TableField("FTVSTYPE6")
|
||||||
|
private String ftvstype6;
|
||||||
|
|
||||||
|
@SerializedName("FTVSTYPE7")
|
||||||
|
@TableField("FTVSTYPE7")
|
||||||
|
private String ftvstype7;
|
||||||
|
|
||||||
|
@SerializedName("FTVSTYPE9")
|
||||||
|
@TableField("FTVSTYPE9")
|
||||||
|
private String ftvstype9;
|
||||||
|
|
||||||
|
@SerializedName("ACLUSERNAMES")
|
||||||
|
@TableField("ACLUSERNAMES")
|
||||||
|
private String aclusernames;
|
||||||
|
|
||||||
|
@SerializedName("CREATOR")
|
||||||
|
@TableField("CREATOR")
|
||||||
|
private String creator;
|
||||||
|
|
||||||
|
@SerializedName("SERIESID")
|
||||||
|
@TableField("SERIESID")
|
||||||
|
private String seriesid; //SF_ID
|
||||||
|
|
||||||
|
@SerializedName("RESERVED")
|
||||||
|
@TableField("RESERVED")
|
||||||
|
private String reserved; //SE_ID
|
||||||
|
|
||||||
|
@SerializedName("STARTED")
|
||||||
|
@TableField("STARTED")
|
||||||
|
private String started; //SU_ID
|
||||||
|
|
||||||
|
@SerializedName("CREATIONDATE")
|
||||||
|
@TableField("CREATIONDATE")
|
||||||
|
private String creationdate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.adc.da.slrs.sarModelTree.service;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
||||||
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.Head;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ISarModuleTreeService {
|
||||||
|
|
||||||
|
List<SarModelTree> getAll(SarModelTree sarModelTree);
|
||||||
|
|
||||||
|
List<SarModelTree> recursionGetChildren(SarModelTree parent);
|
||||||
|
|
||||||
|
public Head analysisJsonAndStorage(String json);
|
||||||
|
|
||||||
|
}
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
package com.adc.da.slrs.sarModelTree.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.sarModelTree.dao.SarModuleTreeDao;
|
||||||
|
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
||||||
|
import com.adc.da.slrs.sarModelTree.entity.SarModuleTree;
|
||||||
|
import com.adc.da.slrs.sarModelTree.service.ISarModuleTreeService;
|
||||||
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.Head;
|
||||||
|
import com.adc.da.util.UUIDUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SarModuleTreeServiceImpl extends ServiceImpl<SarModuleTreeDao, SarModuleTree> implements ISarModuleTreeService {
|
||||||
|
|
||||||
|
@Autowired()
|
||||||
|
private SarModuleTreeServiceImpl sarModuleTreeService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SarModelTree> getAll(SarModelTree sarModelTree) {
|
||||||
|
QueryWrapper<SarModuleTree> treeQueryWrapper = new QueryWrapper<>();
|
||||||
|
treeQueryWrapper.groupBy("FTVSTYPE1");
|
||||||
|
List<SarModuleTree> moduleTreeList = this.baseMapper.selectList(treeQueryWrapper);
|
||||||
|
|
||||||
|
//把SarModuleTree类型的list集合转换为SarModelTree类型的list集合
|
||||||
|
List<SarModelTree> sarModelTreeList = moduleTreeList.stream().map(SarModuleTree -> {
|
||||||
|
SarModelTree modelTree = new SarModelTree();
|
||||||
|
modelTree.setId(SarModuleTree.getGuid());
|
||||||
|
modelTree.setName(SarModuleTree.getFtvstype1());
|
||||||
|
// modelTree.setModel("TS"+SarModuleTree.get);
|
||||||
|
return modelTree;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return sarModelTreeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SarModelTree> recursionGetChildren(SarModelTree parent) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Head analysisJsonAndStorage(String json) {
|
||||||
|
//获取头部 返回结果需要
|
||||||
|
Head head = new Head();
|
||||||
|
try{
|
||||||
|
|
||||||
|
//把字符串转换成对象
|
||||||
|
JsonObject parse = JsonParser.parseString(json).getAsJsonObject();
|
||||||
|
|
||||||
|
|
||||||
|
//要把jsonObject里的HEAD强转成JsonObject类型
|
||||||
|
JsonObject HEAD = (JsonObject) parse.get("HEAD");
|
||||||
|
//因为是最后要取的值了,所以就拿到之后把它转换成String类型
|
||||||
|
HEAD.get("CONSUMER").getAsString();
|
||||||
|
|
||||||
|
head.setBIZTRANSACTIONID(HEAD.get("BIZTRANSACTIONID").getAsString());
|
||||||
|
|
||||||
|
//获取json中的list
|
||||||
|
JsonArray list = (JsonArray)parse.get("LIST");
|
||||||
|
Gson gson = new Gson();
|
||||||
|
List<SarModuleTree> moduleTreeList = new LinkedList<>();
|
||||||
|
list.forEach(item->{
|
||||||
|
JsonObject objectJson=(JsonObject) item;
|
||||||
|
SarModuleTree sarModuleTree = gson.fromJson(objectJson, SarModuleTree.class);
|
||||||
|
sarModuleTree.setGuid(UUIDUtils.randomUUID20());
|
||||||
|
moduleTreeList.add(sarModuleTree);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//进行全量覆盖即删除表中所有数据,之后插入新的数据
|
||||||
|
sarModuleTreeService.remove(null);
|
||||||
|
sarModuleTreeService.saveBatch(moduleTreeList);
|
||||||
|
head.setSUCCESSCOUNT(String.valueOf(moduleTreeList.size()));
|
||||||
|
}catch (Exception e){
|
||||||
|
head.setERRORCODE("2");
|
||||||
|
head.setRESULT("业务失败需要重做,失败原因: "+e.getMessage());
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
head.setERRORCODE("0");
|
||||||
|
head.setRESULT("成功");
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+1
@@ -230,6 +230,7 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
|
|||||||
Head head = sarStandProjectLibraryService.AnalysisJsonAndStorage(jsonStr);
|
Head head = sarStandProjectLibraryService.AnalysisJsonAndStorage(jsonStr);
|
||||||
ArrayList<Company> companies = new ArrayList<>();
|
ArrayList<Company> companies = new ArrayList<>();
|
||||||
ResponseDto responseDto = new ResponseDto(head,companies);
|
ResponseDto responseDto = new ResponseDto(head,companies);
|
||||||
|
//todo 未确定返回内容
|
||||||
Company company = new Company();
|
Company company = new Company();
|
||||||
company.setCOMPANY_CODE("");
|
company.setCOMPANY_CODE("");
|
||||||
company.setFISCAL_YEAR("");
|
company.setFISCAL_YEAR("");
|
||||||
|
|||||||
+11
-4
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarStandProjectLibrary.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@Data
|
@Data
|
||||||
public class ResponseDto {
|
public class ResponseDto {
|
||||||
@@ -17,14 +18,20 @@ public class ResponseDto {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
List<Company> LIST;
|
List<?> LIST;
|
||||||
|
|
||||||
public ResponseDto(Head HEAD, List<Company> LIST) {
|
public ResponseDto(Head HEAD, List<?> LIST) {
|
||||||
this.HEAD = HEAD;
|
this.HEAD = HEAD;
|
||||||
this.LIST = LIST;
|
this.LIST = LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseDto() {
|
public ResponseDto(Head HEAD) {
|
||||||
|
ArrayList<Company> companies = new ArrayList<>();
|
||||||
|
Company company = new Company();
|
||||||
|
company.setCOMPANY_CODE("");
|
||||||
|
company.setFISCAL_YEAR("");
|
||||||
|
companies.add(company);
|
||||||
|
this.LIST=companies;
|
||||||
|
this.HEAD=HEAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -41,6 +41,7 @@ public class SarStandProjectTeamController extends BaseController<SarStandProjec
|
|||||||
public ResponseDto save(@RequestBody String jsonStr){
|
public ResponseDto save(@RequestBody String jsonStr){
|
||||||
Head head = sarStandProjectTeamService.AnalysisJsonAndStorage(jsonStr);
|
Head head = sarStandProjectTeamService.AnalysisJsonAndStorage(jsonStr);
|
||||||
ArrayList<Company> companies = new ArrayList<>();
|
ArrayList<Company> companies = new ArrayList<>();
|
||||||
|
//todo 未确定返回内容
|
||||||
Company company = new Company();
|
Company company = new Company();
|
||||||
company.setCOMPANY_CODE("");
|
company.setCOMPANY_CODE("");
|
||||||
company.setFISCAL_YEAR("");
|
company.setFISCAL_YEAR("");
|
||||||
|
|||||||
@@ -3,10 +3,7 @@ package com.adc.da.slrs.sarUser.dao;
|
|||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Delete;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,6 +17,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface TsUserDao extends BaseMapper<TsUser> {
|
public interface TsUserDao extends BaseMapper<TsUser> {
|
||||||
|
|
||||||
|
@Update("truncate table ts_user")
|
||||||
|
void deleteUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户已经绑定的岗位ID
|
* 查询用户已经绑定的岗位ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ITsUserService extends IService<TsUser> {
|
public interface ITsUserService extends IService<TsUser> {
|
||||||
|
|
||||||
|
void deleteUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过机构ID查询人员
|
* 通过机构ID查询人员
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TsPositionDao tsPositionDao;
|
private TsPositionDao tsPositionDao;
|
||||||
|
|
||||||
|
|
||||||
|
public void deleteUser(){
|
||||||
|
tsUserDao.deleteUser();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过机构ID查询人员
|
* 通过机构ID查询人员
|
||||||
* @return List<TsUser>
|
* @return List<TsUser>
|
||||||
|
|||||||
@@ -732,6 +732,7 @@
|
|||||||
|
|
||||||
<select id="selectAllItemsByIds" resultType="com.adc.da.slrs.sarStandItems.entity.SarStandItemsDto">
|
<select id="selectAllItemsByIds" resultType="com.adc.da.slrs.sarStandItems.entity.SarStandItemsDto">
|
||||||
select ID,STAND_ID,ITEMS_NUM,ITEMS_NAME,RESPONSIBLE_UNIT,SVPPS,APPLY_ARCTIC,CLAIM_TYPE,BUS_STAND_COVER,DUTY_ENGINEER as responsibleEngineer,XCXSSRQ as xcxssrq,ZCCSSRQ as zccssrq ,read_content as technicalRequir ,compared_with_previous as changePoint
|
select ID,STAND_ID,ITEMS_NUM,ITEMS_NAME,RESPONSIBLE_UNIT,SVPPS,APPLY_ARCTIC,CLAIM_TYPE,BUS_STAND_COVER,DUTY_ENGINEER as responsibleEngineer,XCXSSRQ as xcxssrq,ZCCSSRQ as zccssrq ,read_content as technicalRequir ,compared_with_previous as changePoint
|
||||||
|
,TERMS_CONDITIONS as termsConditions
|
||||||
from SAR_STAND_ITEMS
|
from SAR_STAND_ITEMS
|
||||||
where FILE_TYPE=#{type}
|
where FILE_TYPE=#{type}
|
||||||
<if test="ids != null">
|
<if test="ids != null">
|
||||||
|
|||||||
Reference in New Issue
Block a user