fix:报告formData增加委托id
This commit is contained in:
@@ -18,7 +18,7 @@ public interface ReportDocumentMainCorrelationService {
|
||||
|
||||
public static final String CorrelationType_entrust = "entrust";
|
||||
|
||||
List<ReportDocumentMainCorrelationDO> listByMainId(Long mainId);
|
||||
List<ReportDocumentMainCorrelationDO> listByMainId(Long mainId, String correlationType);
|
||||
|
||||
void deleteByMainId(Long mainId);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentMai
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentMainCorrelationSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
@@ -35,10 +36,12 @@ public class ReportDocumentMainCorrelationServiceImpl implements ReportDocumentM
|
||||
|
||||
|
||||
@Override
|
||||
public List<ReportDocumentMainCorrelationDO> listByMainId(Long mainId) {
|
||||
public List<ReportDocumentMainCorrelationDO> listByMainId(Long mainId, String correlationType) {
|
||||
LambdaQueryWrapper<ReportDocumentMainCorrelationDO> query = new LambdaQueryWrapper<>();
|
||||
query.eq(ReportDocumentMainCorrelationDO::getMainId, mainId);
|
||||
query.orderByAsc(ReportDocumentMainCorrelationDO::getId);
|
||||
if(!ObjectUtils.isEmpty(correlationType))
|
||||
query.eq(ReportDocumentMainCorrelationDO::getCorrelationType, correlationType);
|
||||
query.orderByAsc(ReportDocumentMainCorrelationDO::getCreateTime);
|
||||
return reportDocumentMainCorrelationMapper.selectList(query);
|
||||
}
|
||||
|
||||
|
||||
@@ -303,10 +303,24 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
//保存报告
|
||||
@Override
|
||||
public void doSave(ReportDocumentMainSaveReqVO updateReqVO) {
|
||||
Long id = updateReqVO.getId();
|
||||
// 校验存在
|
||||
validateReportDocumentMainExists(updateReqVO.getId());
|
||||
validateReportDocumentMainExists(id);
|
||||
// 更新
|
||||
ReportDocumentMainDO updateObj = BeanUtils.toBean(updateReqVO, ReportDocumentMainDO.class);
|
||||
|
||||
//处理委托id
|
||||
String formDataStr = updateReqVO.getFormData();
|
||||
if(!ObjectUtils.isEmpty(formDataStr)){
|
||||
JSONObject formData = JSONObject.parseObject(formDataStr);
|
||||
List<ReportDocumentMainCorrelationDO> correlationList = reportDocumentMainCorrelationService.listByMainId(id, ReportDocumentMainCorrelationService.CorrelationType_entrust);
|
||||
if(!correlationList.isEmpty()){
|
||||
Long entrustId = correlationList.get(0).getCorrelationId();
|
||||
if(entrustId != null)
|
||||
formData.put("entrustId", entrustId.toString());
|
||||
}
|
||||
updateObj.setFormData(formData.toJSONString());
|
||||
}
|
||||
reportDocumentMainMapper.updateById(updateObj);
|
||||
List<ReportDocumentDataSaveReqVO> reportDocumentDataList = updateReqVO.getReportDocumentDataList();
|
||||
if(!reportDocumentDataList.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user