Merge branch 'main' of http://47.112.118.149:10082/xgxt_sd/zhxg_java
# Conflicts: # srs-admin/src/main/resources/application.yml
This commit is contained in:
@@ -152,21 +152,12 @@ public class CphSqlServerDataController extends BaseController {
|
|||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// //同步辅导员
|
//同步辅导员
|
||||||
// @RequestMapping("/synchronousEmployEEInfoList")
|
|
||||||
// public AjaxResult synchronousEmployEEInfoList(){
|
|
||||||
// //startPage();
|
|
||||||
// List<Map> list=sqlServerDataService.getEmployEEInfoList();
|
|
||||||
// iCphTeacherService.sqlserverSynchronousMYSQL(list);//同步辅导员
|
|
||||||
// iCphTeacherService.Usertb();
|
|
||||||
// return success();
|
|
||||||
// }
|
|
||||||
//同步教职工
|
|
||||||
@RequestMapping("/synchronousEmployEEInfoList")
|
@RequestMapping("/synchronousEmployEEInfoList")
|
||||||
public AjaxResult synchronousEmployEEInfoList(){
|
public AjaxResult synchronousEmployEEInfoList(){
|
||||||
//startPage();
|
//startPage();
|
||||||
List<Map> list=sqlServerDataService.getEmployEEInfoList();
|
List<Map> list=sqlServerDataService.getEmployEEInfoList();
|
||||||
iCphTeacherService.sqlserverSynchronousMYSQL(list);//同步教职工
|
iCphTeacherService.sqlserverSynchronousMYSQL(list);//同步辅导员
|
||||||
iCphTeacherService.Usertb();
|
iCphTeacherService.Usertb();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import com.srs.common.core.controller.BaseController;
|
|||||||
import com.srs.common.core.domain.AjaxResult;
|
import com.srs.common.core.domain.AjaxResult;
|
||||||
import com.srs.common.core.page.TableDataInfo;
|
import com.srs.common.core.page.TableDataInfo;
|
||||||
import com.srs.comprehensive.service.ICphTeacherService;
|
import com.srs.comprehensive.service.ICphTeacherService;
|
||||||
|
import com.srs.comprehensive.service.ISrsMajorsService;
|
||||||
import com.srs.comprehensive.service.SyncDataService;
|
import com.srs.comprehensive.service.SyncDataService;
|
||||||
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.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -20,6 +22,8 @@ public class SyncDataController extends BaseController {
|
|||||||
SyncDataService syncDataService;
|
SyncDataService syncDataService;
|
||||||
@Autowired
|
@Autowired
|
||||||
ICphTeacherService iCphTeacherService;
|
ICphTeacherService iCphTeacherService;
|
||||||
|
@Autowired
|
||||||
|
ISrsMajorsService iSrsMajorsService;
|
||||||
@RequestMapping("/getEmployEEInfoList")
|
@RequestMapping("/getEmployEEInfoList")
|
||||||
public TableDataInfo getEmployEEInfoList(){
|
public TableDataInfo getEmployEEInfoList(){
|
||||||
startPage();
|
startPage();
|
||||||
@@ -30,8 +34,22 @@ public class SyncDataController extends BaseController {
|
|||||||
@RequestMapping("/synchronousEmployEEInfoList")
|
@RequestMapping("/synchronousEmployEEInfoList")
|
||||||
public AjaxResult synchronousEmployEEInfoList(){
|
public AjaxResult synchronousEmployEEInfoList(){
|
||||||
List<Map> list=syncDataService.getEmployEEInfoList();
|
List<Map> list=syncDataService.getEmployEEInfoList();
|
||||||
iCphTeacherService.sqlserverSynchronousMYSQL(list);//同步教职工
|
iCphTeacherService.synchronousMYSQL(list);//同步教职工
|
||||||
//iCphTeacherService.Usertb();
|
iCphTeacherService.UsertbNew();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
//中间表专业信息
|
||||||
|
@RequestMapping("/getSpecialtyInfoList")
|
||||||
|
public TableDataInfo getSpecialtyInfoList(String zydm){
|
||||||
|
startPage();
|
||||||
|
List<Map> list=syncDataService.getSpecialtyInfoList(zydm);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
//同步专业
|
||||||
|
@RequestMapping("/synchronousSpecialtyInfoList")
|
||||||
|
public AjaxResult synchronousSpecialtyInfoList(){
|
||||||
|
List<Map> list=syncDataService.getSpecialtyALLInfo();
|
||||||
|
iSrsMajorsService.synchronousMYSQL(list);//同步专业
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface SyncDataMapper {
|
public interface SyncDataMapper {
|
||||||
public List<Map> getEmployEEInfoList();//教职工
|
public List<Map> getEmployEEInfoList();//教职工
|
||||||
|
public List<Map> getSpecialtyInfoList(String zydm);//专业
|
||||||
|
public List<Map> getSpecialtyALLInfo();//所有专业
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,8 +117,10 @@ public interface ICphTeacherService
|
|||||||
public Map<String, Integer> teacherDataSync();
|
public Map<String, Integer> teacherDataSync();
|
||||||
|
|
||||||
void sqlserverSynchronousMYSQL(List<Map> list);
|
void sqlserverSynchronousMYSQL(List<Map> list);
|
||||||
|
void synchronousMYSQL(List<Map> list);
|
||||||
|
|
||||||
void Usertb();
|
void Usertb();
|
||||||
|
void UsertbNew();
|
||||||
|
|
||||||
void insertUserrole(List<SysUser> insertUser);
|
void insertUserrole(List<SysUser> insertUser);
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public interface ISrsMajorsService
|
|||||||
public Map<String,Object> dataSync();
|
public Map<String,Object> dataSync();
|
||||||
|
|
||||||
void sqlserverSynchronousMYSQL(List<Map> list);
|
void sqlserverSynchronousMYSQL(List<Map> list);
|
||||||
|
void synchronousMYSQL(List<Map> list);
|
||||||
//根据专业名称获取专业id
|
//根据专业名称获取专业id
|
||||||
public Long getMajorIdByName(String name);
|
public Long getMajorIdByName(String name);
|
||||||
//获取学生的专业名称
|
//获取学生的专业名称
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface SyncDataService {
|
public interface SyncDataService {
|
||||||
List<Map> getEmployEEInfoList();//教职工
|
List<Map> getEmployEEInfoList();//教职工
|
||||||
|
List<Map> getSpecialtyInfoList(String zydm);//专业
|
||||||
|
List<Map> getSpecialtyALLInfo();//所有专业
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -354,116 +354,116 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
|||||||
}
|
}
|
||||||
|
|
||||||
//同步辅导员
|
//同步辅导员
|
||||||
// @Override
|
@Override
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
// public void sqlserverSynchronousMYSQL(List<Map> list) {
|
public void sqlserverSynchronousMYSQL(List<Map> list) {
|
||||||
// //辅导员列表
|
//辅导员列表
|
||||||
// List<CphTeacher> cphTeachers = cphTeacherMapper.selectTeacherList();
|
List<CphTeacher> cphTeachers = cphTeacherMapper.selectTeacherList();
|
||||||
// //查找重复值
|
//查找重复值
|
||||||
// List<Map> updateMap = list.stream()
|
List<Map> updateMap = list.stream()
|
||||||
// .filter(obj1 -> cphTeachers
|
.filter(obj1 -> cphTeachers
|
||||||
// .stream().anyMatch(obj2 -> {
|
.stream().anyMatch(obj2 -> {
|
||||||
// Object xhObj = obj1.get("zgh");
|
Object xhObj = obj1.get("zgh");
|
||||||
// if (xhObj != null) {
|
if (xhObj != null) {
|
||||||
// String zgh = xhObj.toString();
|
String zgh = xhObj.toString();
|
||||||
// return obj2.getEmployeeId().equals(zgh);
|
return obj2.getEmployeeId().equals(zgh);
|
||||||
// }
|
}
|
||||||
// return false;
|
return false;
|
||||||
// }))
|
}))
|
||||||
// .collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//
|
|
||||||
// //添加需要
|
//添加需要
|
||||||
// List<String> kshList2 = cphTeachers.stream()
|
List<String> kshList2 = cphTeachers.stream()
|
||||||
// .map(CphTeacher::getEmployeeId)
|
.map(CphTeacher::getEmployeeId)
|
||||||
// .collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//
|
|
||||||
// List<Map> insertMap = list.stream()
|
List<Map> insertMap = list.stream()
|
||||||
// .filter(obj -> {
|
.filter(obj -> {
|
||||||
// Object xhObj = obj.get("zgh");
|
Object xhObj = obj.get("zgh");
|
||||||
// return xhObj != null && !kshList2.contains(xhObj.toString());
|
return xhObj != null && !kshList2.contains(xhObj.toString());
|
||||||
// })
|
})
|
||||||
// .collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// //添加
|
//添加
|
||||||
// List<CphTeacher> insertStudentList = new ArrayList<>();
|
List<CphTeacher> insertStudentList = new ArrayList<>();
|
||||||
// for (Map map:insertMap){
|
for (Map map:insertMap){
|
||||||
// CphTeacher cphTeacher = new CphTeacher();
|
CphTeacher cphTeacher = new CphTeacher();
|
||||||
// Object xmObj = map.get("xm");
|
Object xmObj = map.get("xm");
|
||||||
// if (xmObj != null) {
|
if (xmObj != null) {
|
||||||
// cphTeacher.setName(xmObj.toString());
|
cphTeacher.setName(xmObj.toString());
|
||||||
// }
|
}
|
||||||
// Object xbObj = map.get("xb");
|
Object xbObj = map.get("xb");
|
||||||
// if (xbObj != null) {
|
if (xbObj != null) {
|
||||||
// String s = xbObj.toString();
|
String s = xbObj.toString();
|
||||||
// if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
||||||
// cphTeacher.setGender(xbObj.toString());
|
cphTeacher.setGender(xbObj.toString());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// Object zghObj = map.get("zgh");
|
Object zghObj = map.get("zgh");
|
||||||
// if (zghObj != null) {
|
if (zghObj != null) {
|
||||||
// cphTeacher.setEmployeeId(zghObj.toString());
|
cphTeacher.setEmployeeId(zghObj.toString());
|
||||||
// }
|
}
|
||||||
// //学院id
|
//学院id
|
||||||
// Object yxdmObj = map.get("yxdm");
|
Object yxdmObj = map.get("yxdm");
|
||||||
// if (yxdmObj!=null) {
|
if (yxdmObj!=null) {
|
||||||
// Long deptId = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
Long deptId = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||||
// if (deptId != null) {
|
if (deptId != null) {
|
||||||
// cphTeacher.setDeptId(deptId);
|
cphTeacher.setDeptId(deptId);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// cphTeacher.setStatus("1");
|
cphTeacher.setStatus("1");
|
||||||
// cphTeacher.setCreateTime(DateUtils.getNowDate());
|
cphTeacher.setCreateTime(DateUtils.getNowDate());
|
||||||
// insertStudentList.add(cphTeacher);
|
insertStudentList.add(cphTeacher);
|
||||||
// }
|
}
|
||||||
// if (insertStudentList.size()!=0) {
|
if (insertStudentList.size()!=0) {
|
||||||
// cphTeacherMapper.insertBatchSomeColumn(insertStudentList);
|
cphTeacherMapper.insertBatchSomeColumn(insertStudentList);
|
||||||
// }
|
}
|
||||||
// //修改
|
//修改
|
||||||
// List<CphTeacher> updateSrsStudent = new ArrayList<>();
|
List<CphTeacher> updateSrsStudent = new ArrayList<>();
|
||||||
// for (Map map:updateMap){
|
for (Map map:updateMap){
|
||||||
// CphTeacher cphTeacher = new CphTeacher();
|
CphTeacher cphTeacher = new CphTeacher();
|
||||||
// Object xmObj = map.get("xm");
|
Object xmObj = map.get("xm");
|
||||||
// if (xmObj != null) {
|
if (xmObj != null) {
|
||||||
// cphTeacher.setName(xmObj.toString());
|
cphTeacher.setName(xmObj.toString());
|
||||||
// }
|
}
|
||||||
// Object xbObj = map.get("xb");
|
Object xbObj = map.get("xb");
|
||||||
// if (xbObj != null) {
|
if (xbObj != null) {
|
||||||
// String s = xbObj.toString();
|
String s = xbObj.toString();
|
||||||
// if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
||||||
// cphTeacher.setGender(xbObj.toString());
|
cphTeacher.setGender(xbObj.toString());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// Object zghObj = map.get("zgh");
|
Object zghObj = map.get("zgh");
|
||||||
// if (zghObj != null) {
|
if (zghObj != null) {
|
||||||
// cphTeacher.setEmployeeId(zghObj.toString());
|
cphTeacher.setEmployeeId(zghObj.toString());
|
||||||
// }
|
}
|
||||||
// //学院id
|
//学院id
|
||||||
// Object yxdmObj = map.get("yxdm");
|
Object yxdmObj = map.get("yxdm");
|
||||||
// if (yxdmObj!=null) {
|
if (yxdmObj!=null) {
|
||||||
// Long ksh = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
Long ksh = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||||
// if (ksh != null) {
|
if (ksh != null) {
|
||||||
// cphTeacher.setDeptId(ksh);
|
cphTeacher.setDeptId(ksh);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// cphTeacher.setUpdateTime(DateUtils.getNowDate());
|
cphTeacher.setUpdateTime(DateUtils.getNowDate());
|
||||||
// updateSrsStudent.add(cphTeacher);
|
updateSrsStudent.add(cphTeacher);
|
||||||
// }
|
}
|
||||||
// /*if (updateSrsStudent.size()!=0) {
|
/*if (updateSrsStudent.size()!=0) {
|
||||||
// List<List<CphTeacher>> lists = ListSliceUtil.updateSlice(updateSrsStudent);
|
List<List<CphTeacher>> lists = ListSliceUtil.updateSlice(updateSrsStudent);
|
||||||
// if (lists != null) {
|
if (lists != null) {
|
||||||
// for (List<CphTeacher> studentList : lists) {
|
for (List<CphTeacher> studentList : lists) {
|
||||||
// cphTeacherMapper.updateSrsClassList(studentList);
|
cphTeacherMapper.updateSrsClassList(studentList);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }*/
|
}*/
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
//同步教职工表
|
//同步教职工表
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void sqlserverSynchronousMYSQL(List<Map> list) {
|
public void synchronousMYSQL(List<Map> list) {
|
||||||
List<QgzxTeacher> insertTeacherList = new ArrayList<>();//添加集合
|
List<QgzxTeacher> insertTeacherList = new ArrayList<>();//添加集合
|
||||||
List<QgzxTeacher> updateTeacherList = new ArrayList<>();//修改集合
|
List<QgzxTeacher> updateTeacherList = new ArrayList<>();//修改集合
|
||||||
for (Map<String, Object> map : list) {
|
for (Map<String, Object> map : list) {
|
||||||
@@ -555,6 +555,77 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
|||||||
System.out.println(updateUser.size());
|
System.out.println(updateUser.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//同步到用户表
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void UsertbNew(){
|
||||||
|
//同步到user表
|
||||||
|
List<QgzxTeacher> qgzxTeachers = qgzxTeacherMapper.selectTeacherList();//所有职工
|
||||||
|
List<SysUser> sysUserList = sysUserMapper.selectUserLisrS();//所以用户
|
||||||
|
List<SysUser> insertUser = new ArrayList<>();//需要添加的集合
|
||||||
|
List<SysUser> updateUser = new ArrayList<>();//需要修改的集合
|
||||||
|
for (QgzxTeacher qgzxTeacher:qgzxTeachers){
|
||||||
|
int i=0;//添加标记
|
||||||
|
for (SysUser sysUser:sysUserList){
|
||||||
|
//修改
|
||||||
|
if (Objects.equals(qgzxTeacher.getEmployeeId(), sysUser.getUserName())){
|
||||||
|
SysUser sysUser1 = new SysUser();
|
||||||
|
sysUser1.setUserName(qgzxTeacher.getEmployeeId());
|
||||||
|
sysUser1.setDeptId(qgzxTeacher.getDeptId());
|
||||||
|
if(qgzxTeacher.getStatus().equals("11")){
|
||||||
|
sysUser1.setStatus("0");
|
||||||
|
}
|
||||||
|
else if (qgzxTeacher.getStatus().equals("4")){
|
||||||
|
sysUser1.setStatus("0");
|
||||||
|
}else {
|
||||||
|
sysUser1.setStatus("1");
|
||||||
|
}
|
||||||
|
updateUser.add(sysUser1);
|
||||||
|
i=0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i=1;
|
||||||
|
}
|
||||||
|
//添加
|
||||||
|
if (i==1){
|
||||||
|
SysUser sysUser = new SysUser();
|
||||||
|
sysUser.setUserName(qgzxTeacher.getEmployeeId());
|
||||||
|
if (qgzxTeacher.getDeptId()!=null){
|
||||||
|
sysUser.setDeptId(qgzxTeacher.getDeptId());
|
||||||
|
}
|
||||||
|
sysUser.setSex(Objects.equals(qgzxTeacher.getGender(), "男") ?"0":"1");
|
||||||
|
sysUser.setNickName(qgzxTeacher.getName());
|
||||||
|
sysUser.setPassword(SecurityUtils.encryptPassword("#A"+qgzxTeacher.getEmployeeId()+"A#"));
|
||||||
|
if(qgzxTeacher.getStatus().equals("11")){
|
||||||
|
sysUser.setStatus("0");
|
||||||
|
}
|
||||||
|
else if (qgzxTeacher.getStatus().equals("4")){
|
||||||
|
sysUser.setStatus("0");
|
||||||
|
}else {
|
||||||
|
sysUser.setStatus("1");
|
||||||
|
}
|
||||||
|
insertUser.add(sysUser);
|
||||||
|
|
||||||
|
}
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
|
if (insertUser.size()!=0){
|
||||||
|
sysUserMapper.insertUserListInfo(insertUser);
|
||||||
|
insertUserroleNew(insertUser);
|
||||||
|
}
|
||||||
|
if (updateUser.size()!=0) {
|
||||||
|
List<List<SysUser>> listList1 = ListSliceUtil.updateSlice(updateUser);//切割修改集合
|
||||||
|
if (listList1 != null) {
|
||||||
|
for (List<SysUser> userList : listList1) {
|
||||||
|
sysUserMapper.updateUserListInfo(userList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println(insertUser.size());
|
||||||
|
System.out.println(updateUser.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void insertUserrole(List<SysUser> insertUser){
|
public void insertUserrole(List<SysUser> insertUser){
|
||||||
List<SysUserRole> userRoleList=new ArrayList<>();
|
List<SysUserRole> userRoleList=new ArrayList<>();
|
||||||
for (SysUser sysUser:insertUser){
|
for (SysUser sysUser:insertUser){
|
||||||
@@ -565,6 +636,16 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
|||||||
}
|
}
|
||||||
sysUserRoleMapper.batchUserRole(userRoleList);
|
sysUserRoleMapper.batchUserRole(userRoleList);
|
||||||
}
|
}
|
||||||
|
public void insertUserroleNew(List<SysUser> insertUser){
|
||||||
|
List<SysUserRole> userRoleList=new ArrayList<>();
|
||||||
|
for (SysUser sysUser:insertUser){
|
||||||
|
SysUserRole sysRole = new SysUserRole();
|
||||||
|
sysRole.setUserId(sysUser.getUserId());
|
||||||
|
sysRole.setRoleId(124L);//统一设为教职工角色
|
||||||
|
userRoleList.add(sysRole);
|
||||||
|
}
|
||||||
|
sysUserRoleMapper.batchUserRole(userRoleList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> exportSXZZ(CphExport param) {
|
public List<Map<String, Object>> exportSXZZ(CphExport param) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.srs.comprehensive.domain.SrsMajors;
|
import com.srs.comprehensive.domain.SrsMajors;
|
||||||
import com.srs.comprehensive.service.ISrsMajorsService;
|
import com.srs.comprehensive.service.ISrsMajorsService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Service业务层处理
|
* 【请填写功能名称】Service业务层处理
|
||||||
@@ -251,4 +252,98 @@ public class SrsMajorsServiceImpl implements ISrsMajorsService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//同步专业
|
||||||
|
@Override
|
||||||
|
public void synchronousMYSQL(List<Map> list) {
|
||||||
|
List<SrsMajors> srsMajors = srsMajorsMapper.selectSrsmajorsList();//数据库存在的专业列表
|
||||||
|
//查找重复值
|
||||||
|
List<Map> updateMap = list.stream()
|
||||||
|
.filter(obj1 -> srsMajors
|
||||||
|
.stream().anyMatch(obj2 -> {
|
||||||
|
Object xhObj = obj1.get("zydm");
|
||||||
|
if (xhObj != null) {
|
||||||
|
String xh = xhObj.toString();
|
||||||
|
return obj2.getMajorCode().equals(xh);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
//添加需要
|
||||||
|
List<String> kshList2 = srsMajors.stream()
|
||||||
|
.map(SrsMajors::getMajorCode)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<Map> insertMap = list.stream()
|
||||||
|
.filter(obj -> {
|
||||||
|
Object xhObj = obj.get("zydm");
|
||||||
|
return xhObj != null && !kshList2.contains(xhObj.toString());
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
//添加
|
||||||
|
List<SrsMajors> insertStudentList = new ArrayList<>();
|
||||||
|
for (Map map:insertMap){
|
||||||
|
SrsMajors srsMajors1 = new SrsMajors();
|
||||||
|
Object zydmobj=map.get("zydm");
|
||||||
|
if (zydmobj!=null) {
|
||||||
|
srsMajors1.setMajorCode(zydmobj.toString());
|
||||||
|
}
|
||||||
|
Object zymcobj=map.get("zymc");
|
||||||
|
if (zymcobj!=null) {
|
||||||
|
srsMajors1.setMajorName(zymcobj.toString());
|
||||||
|
}
|
||||||
|
srsMajors1.setStatus("0");
|
||||||
|
|
||||||
|
if (map.get("yxmc")!=null) {
|
||||||
|
//使用代码查询学院id
|
||||||
|
Long yxdm = srsMajorsMapper.selectOldDeptIdByDeptName(map.get("yxmc").toString());
|
||||||
|
if (yxdm != null) {
|
||||||
|
srsMajors1.setCollegeId(yxdm);//学院id
|
||||||
|
} else {
|
||||||
|
srsMajors1.setCollegeId(0L);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
srsMajors1.setCollegeId(0L);
|
||||||
|
}
|
||||||
|
srsMajors1.setCreateTime(DateUtils.getNowDate());
|
||||||
|
insertStudentList.add(srsMajors1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
List<SrsMajors> updateSrsStudent = new ArrayList<>();
|
||||||
|
for (Map map:updateMap){
|
||||||
|
SrsMajors srsMajors1 = new SrsMajors();
|
||||||
|
Object zydmobj=map.get("zydm");
|
||||||
|
if (zydmobj!=null) {
|
||||||
|
srsMajors1.setMajorCode(zydmobj.toString());
|
||||||
|
}
|
||||||
|
Object zymcobj=map.get("zymc");
|
||||||
|
if (zymcobj!=null) {
|
||||||
|
srsMajors1.setMajorName(zymcobj.toString());
|
||||||
|
}
|
||||||
|
if (map.get("yxmc")!=null) {
|
||||||
|
//使用代码查询学院id
|
||||||
|
Long yxdm = srsMajorsMapper.selectOldDeptIdByDeptName(map.get("yxmc").toString());
|
||||||
|
if (yxdm != null) {
|
||||||
|
srsMajors1.setCollegeId(yxdm);//学院id
|
||||||
|
} else {
|
||||||
|
srsMajors1.setCollegeId(0L);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
srsMajors1.setCollegeId(0L);
|
||||||
|
}
|
||||||
|
srsMajors1.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
updateSrsStudent.add(srsMajors1);
|
||||||
|
}
|
||||||
|
if (insertStudentList.size()!=0) {
|
||||||
|
srsMajorsMapper.insertBatchSomeColumn(insertStudentList);
|
||||||
|
}
|
||||||
|
List<List<SrsMajors>> lists = ListSliceUtil.updateSlice(updateSrsStudent);
|
||||||
|
if (lists != null) {
|
||||||
|
for (List<SrsMajors> studentList : lists) {
|
||||||
|
srsMajorsMapper.updateSrsStudentList(studentList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.srs.comprehensive.service.impl;
|
package com.srs.comprehensive.service.impl;
|
||||||
|
|
||||||
|
import com.srs.common.annotation.DataSource;
|
||||||
|
import com.srs.common.enums.DataSourceType;
|
||||||
import com.srs.comprehensive.mapper.SyncDataMapper;
|
import com.srs.comprehensive.mapper.SyncDataMapper;
|
||||||
import com.srs.comprehensive.service.SyncDataService;
|
import com.srs.comprehensive.service.SyncDataService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -16,4 +18,13 @@ public class SyncDataServiceImpl implements SyncDataService {
|
|||||||
public List<Map> getEmployEEInfoList() {
|
public List<Map> getEmployEEInfoList() {
|
||||||
return syncDataMapper.getEmployEEInfoList();
|
return syncDataMapper.getEmployEEInfoList();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map> getSpecialtyInfoList(String zydm) {
|
||||||
|
return syncDataMapper.getSpecialtyInfoList(zydm);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map> getSpecialtyALLInfo(){
|
||||||
|
return syncDataMapper.getSpecialtyALLInfo();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,15 @@
|
|||||||
END as xb,TBD.BMMC as ksmc,TBD.BMMC as yxmc,TBD.BMBH as ksh,TBA.ZGDQZTDM as zgzt from from_gxsdxyxxzx_teacher TBA LEFT JOIN from_gxsdxyxxzx_xzbm TBD ON TBA.SZBMBH=TBD.BMBH
|
END as xb,TBD.BMMC as ksmc,TBD.BMMC as yxmc,TBD.BMBH as ksh,TBA.ZGDQZTDM as zgzt from from_gxsdxyxxzx_teacher TBA LEFT JOIN from_gxsdxyxxzx_xzbm TBD ON TBA.SZBMBH=TBD.BMBH
|
||||||
WHERE TBA.ZGLBDM LIKE '1%'
|
WHERE TBA.ZGLBDM LIKE '1%'
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getSpecialtyInfoList" resultType="java.util.Map" parameterType="String">
|
||||||
|
select b.JXZYBH as zydm,b.JXZYJC as zyjc,b.JXZYMC as zymc,a.BMMC yxmc from from_gxsdxyxxzx_xzbm a left join from_gxsdxyxxzx_zyxx b on a.BMBH=b.JXZYSSYXBBH
|
||||||
|
<where>
|
||||||
|
b.JXZYBH is not null
|
||||||
|
<if test="zydm != null and zydm!= '' ">and b.JXZYBH=#{zydm}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="getSpecialtyALLInfo" resultType="java.util.Map">
|
||||||
|
select b.JXZYBH as zydm,b.JXZYJC as zyjc,b.JXZYMC as zymc,a.BMMC yxmc from from_gxsdxyxxzx_xzbm a left join from_gxsdxyxxzx_zyxx b on a.BMBH=b.JXZYSSYXBBH
|
||||||
|
where b.JXZYBH is not null
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -77,17 +77,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertBatchSomeColumn" parameterType="java.util.List">
|
<insert id="insertBatchSomeColumn" parameterType="java.util.List">
|
||||||
insert into qgzx_teacher(name,gender,age,employee_id,dept_id,status,create_time)
|
insert into qgzx_teacher(name,gender,employee_id,dept_id,status,create_time)
|
||||||
values
|
values
|
||||||
<foreach item="entity" collection="list" separator="," open="(" close=")">
|
<foreach item="entity" collection="list" separator="," >
|
||||||
(
|
(
|
||||||
<if test="entity.name != null and entity.name != ''">#{entity.name},</if>
|
<if test="entity.name != null and entity.name != ''">#{entity.name}</if>,
|
||||||
<if test="entity.gender != null and entity.gender != ''">#{entity.gender},</if>
|
<if test="entity.gender != null and entity.gender != ''">#{entity.gender}</if>,
|
||||||
<if test="entity.age!=null">#{entity.age},</if>
|
<if test="entity.employeeId != null and entity.employeeId != ''">#{entity.employeeId}</if>,
|
||||||
<if test="entity.employeeId != null and entity.employeeId != ''">#{entity.employeeId},</if>
|
<if test="entity.deptId !=null">#{entity.deptId}</if>,
|
||||||
<if test="entity.deptId!=null">#{entity.deptId},</if>
|
<if test="entity.status != null and entity.status != ''">#{entity.status}</if>,
|
||||||
<if test="entity.status != null and entity.status != ''">#{entity.status},</if>
|
<if test="entity.createTime !=null">#{entity.createTime}</if>
|
||||||
<if test="entity.createTime!=null">#{entity.createTime},</if>
|
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -291,19 +291,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
nick_name,
|
nick_name,
|
||||||
sex,
|
sex,
|
||||||
password,
|
password,
|
||||||
|
status,
|
||||||
create_time
|
create_time
|
||||||
)
|
)
|
||||||
values
|
values
|
||||||
<foreach collection="userList" item="item" index="i" separator=",">
|
<foreach collection="userList" item="item" index="i" separator=",">
|
||||||
(
|
(
|
||||||
#{item.userName},
|
#{item.userName},
|
||||||
<if test="item.deptId != null">#{item.deptId}</if>
|
<if test="item.deptId != null">#{item.deptId}</if>
|
||||||
<if test="item.deptId == null">null</if>,
|
<if test="item.deptId == null">null</if>,
|
||||||
#{item.nickName},
|
#{item.nickName},
|
||||||
<if test="item.sex != null">#{item.sex}</if>
|
<if test="item.sex != null">#{item.sex}</if>
|
||||||
<if test="item.sex == null">"2"</if>,
|
<if test="item.sex == null">'2'</if>,
|
||||||
#{item.password},
|
#{item.password},
|
||||||
sysdate())
|
<if test="item.status != null">#{item.status}</if>
|
||||||
|
<if test="item.status == null">null</if>,
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateUserListInfo" parameterType="java.util.List">
|
<update id="updateUserListInfo" parameterType="java.util.List">
|
||||||
@@ -335,6 +339,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
when user_name=#{i.userName} then sysdate()
|
when user_name=#{i.userName} then sysdate()
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</trim>
|
||||||
|
<trim prefix="status=case" suffix="end,">
|
||||||
|
<foreach collection="studentList" item="i" index="index">
|
||||||
|
when user_name=#{i.userName} then #{i.status}
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
</trim>
|
</trim>
|
||||||
where user_name in
|
where user_name in
|
||||||
<foreach collection="studentList" separator="," item="i" index="index" open="(" close=")">
|
<foreach collection="studentList" separator="," item="i" index="index" open="(" close=")">
|
||||||
|
|||||||
Reference in New Issue
Block a user