update 调整身分信息相关接口

develop
hhb@hotmail.com 4 days ago
parent af0a57f04a
commit 84a8c702a9

@ -22,6 +22,7 @@ import cn.teammodel.test.LessonRecordQueryService;
import cn.teammodel.utils.GroupUtil;
import cn.teammodel.utils.SchoolDateUtil;
import com.azure.cosmos.models.CosmosPatchOperations;
import com.azure.cosmos.models.PartitionKey;
import com.azure.spring.data.cosmos.core.query.CosmosPageRequest;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -1396,14 +1397,14 @@ public class TeacherServiceImpl implements TeacherService {
public void update(TeacherDto teacherDto) {
try {
String id = teacherDto.getTmdId();
String code = String.format(teacherDto.getCode(), id);
String code = teacherDto.getCode() + "-" + id;
PtTeacherInfo ptTeacherInfo = ptTeacherRepository.findByIdAndCode(id, code);
// 局部更新
CosmosPatchOperations operations = CosmosPatchOperations.create();
if (ptTeacherInfo != null) {
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) {
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) {
try {
String id = teacherDto.getTmdId();
String code = String.format(teacherDto.getCode(), id);
String code = teacherDto.getCode() + "-" + id;
PtTeacherInfo ptTeacherInfo = ptTeacherRepository.findByIdAndCode(id, code);
if (ptTeacherInfo != null) {
Map<String, Object> result = new HashMap<>();

Loading…
Cancel
Save