|
@@ -3,6 +3,8 @@ package com.usoftchina.smartschool.school.basic.service.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
+import com.usoftchina.smartschool.account.api.AccountApi;
|
|
|
|
|
+import com.usoftchina.smartschool.account.dto.AccountRegDTO;
|
|
|
import com.usoftchina.smartschool.context.BaseContextHolder;
|
|
import com.usoftchina.smartschool.context.BaseContextHolder;
|
|
|
import com.usoftchina.smartschool.exception.BizException;
|
|
import com.usoftchina.smartschool.exception.BizException;
|
|
|
import com.usoftchina.smartschool.page.PageRequest;
|
|
import com.usoftchina.smartschool.page.PageRequest;
|
|
@@ -33,9 +35,10 @@ public class TeacherServiceImpl implements TeacherService{
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SysTeacherMapper sysTeacherMapper;
|
|
private SysTeacherMapper sysTeacherMapper;
|
|
|
-
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private DataImportMapper dataImportMapper;
|
|
private DataImportMapper dataImportMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private AccountApi accountApi;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public PageInfo<SysTeacher> getListData(PageRequest page, ListReqDTO listReqDTO) {
|
|
public PageInfo<SysTeacher> getListData(PageRequest page, ListReqDTO listReqDTO) {
|
|
@@ -75,7 +78,9 @@ public class TeacherServiceImpl implements TeacherService{
|
|
|
//新增教师
|
|
//新增教师
|
|
|
if (StringUtils.isEmpty(formdata.getTeacher_id()) || "0".equals(formdata.getTeacher_id().toString())) {
|
|
if (StringUtils.isEmpty(formdata.getTeacher_id()) || "0".equals(formdata.getTeacher_id().toString())) {
|
|
|
sysTeacherMapper.insertSelective(formdata);
|
|
sysTeacherMapper.insertSelective(formdata);
|
|
|
-
|
|
|
|
|
|
|
+ if (!StringUtils.isEmpty(formdata.getTeacher_phone())) {
|
|
|
|
|
+ createAccount(formdata);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
//更新教师
|
|
//更新教师
|
|
|
sysTeacherMapper.updateByPrimaryKeySelective(formdata);
|
|
sysTeacherMapper.updateByPrimaryKeySelective(formdata);
|
|
@@ -83,6 +88,18 @@ public class TeacherServiceImpl implements TeacherService{
|
|
|
return new DocBaseDTO(formdata.getTeacher_id(), null, null);
|
|
return new DocBaseDTO(formdata.getTeacher_id(), null, null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新建账户信息
|
|
|
|
|
+ */
|
|
|
|
|
+ private void createAccount(SysTeacher sysTeacher) {
|
|
|
|
|
+ AccountRegDTO accountRegDTO = new AccountRegDTO();
|
|
|
|
|
+ accountRegDTO.setUser_phone(sysTeacher.getTeacher_phone());
|
|
|
|
|
+ accountRegDTO.setUser_pass("111111");
|
|
|
|
|
+ Long roleId = sysTeacherMapper.selectRoleId();
|
|
|
|
|
+ accountRegDTO.setRoleId(roleId);
|
|
|
|
|
+ accountApi.register(accountRegDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public void saveToFormal(Integer id, boolean update) {
|
|
public void saveToFormal(Integer id, boolean update) {
|