|
|
@ -22,6 +22,7 @@ import cn.teammodel.test.LessonRecordQueryService;
|
|
|
|
import cn.teammodel.utils.GroupUtil;
|
|
|
|
import cn.teammodel.utils.GroupUtil;
|
|
|
|
import cn.teammodel.utils.SchoolDateUtil;
|
|
|
|
import cn.teammodel.utils.SchoolDateUtil;
|
|
|
|
import com.azure.cosmos.models.CosmosPatchOperations;
|
|
|
|
import com.azure.cosmos.models.CosmosPatchOperations;
|
|
|
|
|
|
|
|
import com.azure.cosmos.models.PartitionKey;
|
|
|
|
import com.azure.spring.data.cosmos.core.query.CosmosPageRequest;
|
|
|
|
import com.azure.spring.data.cosmos.core.query.CosmosPageRequest;
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
@ -1396,14 +1397,14 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
public void update(TeacherDto teacherDto) {
|
|
|
|
public void update(TeacherDto teacherDto) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String id = teacherDto.getTmdId();
|
|
|
|
String id = teacherDto.getTmdId();
|
|
|
|
String code = String.format(teacherDto.getCode(), id);
|
|
|
|
String code = teacherDto.getCode() + "-" + id;
|
|
|
|
PtTeacherInfo ptTeacherInfo = ptTeacherRepository.findByIdAndCode(id, code);
|
|
|
|
PtTeacherInfo ptTeacherInfo = ptTeacherRepository.findByIdAndCode(id, code);
|
|
|
|
// 局部更新
|
|
|
|
// 局部更新
|
|
|
|
CosmosPatchOperations operations = CosmosPatchOperations.create();
|
|
|
|
CosmosPatchOperations operations = CosmosPatchOperations.create();
|
|
|
|
if (ptTeacherInfo != null) {
|
|
|
|
if (ptTeacherInfo != null) {
|
|
|
|
operations.set("/identity", teacherDto.getIdentity());
|
|
|
|
operations.set("/identity", teacherDto.getIdentity());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ptTeacherRepository.save(id, PK.buildOf(teacherDto.getCode(), teacherDto.getTmdId()), PtTeacherInfo.class, operations);
|
|
|
|
ptTeacherRepository.save(id, new PartitionKey(code), PtTeacherInfo.class, operations);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据更新失败: " + ex.getMessage());
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据更新失败: " + ex.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1413,7 +1414,7 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
public Map<String, Object> findIdentityByTmdId(TeacherDto teacherDto) {
|
|
|
|
public Map<String, Object> findIdentityByTmdId(TeacherDto teacherDto) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String id = teacherDto.getTmdId();
|
|
|
|
String id = teacherDto.getTmdId();
|
|
|
|
String code = String.format(teacherDto.getCode(), id);
|
|
|
|
String code = teacherDto.getCode() + "-" + id;
|
|
|
|
PtTeacherInfo ptTeacherInfo = ptTeacherRepository.findByIdAndCode(id, code);
|
|
|
|
PtTeacherInfo ptTeacherInfo = ptTeacherRepository.findByIdAndCode(id, code);
|
|
|
|
if (ptTeacherInfo != null) {
|
|
|
|
if (ptTeacherInfo != null) {
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|