添加了委托申请修改时可以修改的内容,并更正了修改记录,添加了送检时预览PDF版本鉴定委托书与鉴定事项确认书的接口

master
杨海航 2 months ago
parent 20d3e00fdd
commit f5c7f04bff
  1. 13
      src/main/java/digital/laboratory/platform/entrustment/controller/EntrustmentController.java
  2. 8
      src/main/java/digital/laboratory/platform/entrustment/dto/ApprovedUpdateEntrustDTO.java
  3. 32
      src/main/java/digital/laboratory/platform/entrustment/dto/MaterialDTO.java
  4. 4
      src/main/java/digital/laboratory/platform/entrustment/service/EntrustmentService.java
  5. 178
      src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustAlterApplyServiceImpl.java
  6. 81
      src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustmentServiceImpl.java
  7. 2
      src/main/resources/mapper/EntrustAlterApplyMapper.xml

@ -2395,4 +2395,17 @@ public class EntrustmentController {
Entrustment entrustment = entrustmentService.getById(id);
return R.ok(entrustment);
}
@ApiOperation("预览鉴定事项确认书,只在送检单位填写完委托与检材后才能进行预览")
@GetMapping("/previewEntrustLetterPDF")
public void previewEntrustLetterPDF(String entrustId, HttpServletResponse servletResponse) throws Exception {
entrustmentService.previewEntrustLetterPDF(entrustId, servletResponse);
}
@ApiOperation("预览鉴定委托书,只在送检单位填写完委托与检材后才能进行预览")
@GetMapping("/previewEntrustPDF")
public void previewEntrustPDF(String entrustId, HttpServletResponse servletResponse) throws Exception {
entrustmentService.previewEntrustPDF(entrustId, servletResponse);
}
}

@ -21,7 +21,7 @@ public class ApprovedUpdateEntrustDTO {
@NotBlank(message = "关联的委托id不能为空!")
private String entrustId;
@ApiModelProperty(value="委托日期, 鉴定委托书打印日期")
@ApiModelProperty(value = "委托日期, 鉴定委托书打印日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime entrustmentTime;
@ -37,6 +37,12 @@ public class ApprovedUpdateEntrustDTO {
@ApiModelProperty(value = "委托检材列表")
private List<MaterialDTO> materialList;
@ApiModelProperty(value = "案发时间")
private LocalDateTime happenTime;
@ApiModelProperty(value = "委托类型,0:常规毒品,1:生物样本")
private Integer entrustmentType;
@ApiModelProperty(value = "是否完成, true:已完成(标记该申请已完成,该申请将不在允许修改), false:未完成(不改变状态)")
private Boolean finished;
}

@ -1,10 +1,14 @@
package digital.laboratory.platform.entrustment.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import digital.laboratory.platform.entrustment.json.DynamicBigDecimalSerializer;
import digital.laboratory.platform.sys.entity.DrugLite;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
// 使用内部类MaterialDTO
@ -23,4 +27,32 @@ public class MaterialDTO {
@ApiModelProperty(value = "候选毒品列表(drug 对象的 json array)")
private List<DrugLite> candidateDrugs;
@ApiModelProperty(value = "检材性状")
private String form;
@ApiModelProperty(value = "留存样个数--贵阳新增需求")
private Integer rtSampleQuantity;
@ApiModelProperty(value = "检材数量, 例如 3.8 克 或 4.5毫升")
@JsonSerialize(using = DynamicBigDecimalSerializer.class)
private BigDecimal quantity;
@ApiModelProperty(value = "计量单位, 例如 3.8 克 或 4.5毫升")
private String unit;
@ApiModelProperty(value = "提取时间--贵阳新增需求")
private LocalDateTime drawTime;
@ApiModelProperty(value = "提取地点--贵阳新增需求")
private String drawPlace;
@ApiModelProperty(value = "检材年龄,用于后续统计各年龄阶段的数据--贵阳新增需求")
private Integer materialAge;
@ApiModelProperty(value = "性别,针对生物样本检材")
private String biologyGender;
@ApiModelProperty(value = "检材类别")
private String typeName;
}

@ -216,4 +216,8 @@ public interface EntrustmentService extends IService<Entrustment> {
Boolean isEligibleForSubmission(String entrustId, Integer materialCount);
List<Deliverer> getDelivererList(DLPUser dlpUser);
void previewEntrustLetterPDF(String entrustId, HttpServletResponse servletResponse) throws Exception;
void previewEntrustPDF(String entrustId, HttpServletResponse servletResponse) throws Exception;
}

@ -3,6 +3,7 @@ package digital.laboratory.platform.entrustment.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -35,6 +36,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -45,13 +48,13 @@ import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author ChenJiangBao
* @description 针对表b_entrust_alter_apply(申请修改委托消息表)的数据库操作Service实现
* @createDate 2024-10-31 17:35:01
*/
* @author ChenJiangBao
* @description 针对表b_entrust_alter_apply(申请修改委托消息表)的数据库操作Service实现
* @createDate 2024-10-31 17:35:01
*/
@Service
public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyMapper, EntrustAlterApply>
implements EntrustAlterApplyService{
implements EntrustAlterApplyService {
@Resource
private OssFile ossFile;
@ -81,6 +84,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
/**
* 保存消息
*
* @param dto 保存的参数
* @return
*/
@ -91,7 +95,6 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
if (isApplying(dto.getEntrustId())) {
throw new ValidateCodeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!");
}
EntrustAlterApply entrustAlterApply = new EntrustAlterApply();
if (StrUtil.isBlank(dto.getId())) {
entrustAlterApply.setEntrustId(dto.getEntrustId());
@ -121,6 +124,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
/**
* 审批委托申请修改
*
* @param approveDTO
* @return
*/
@ -155,12 +159,13 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
/**
* 修改消息
*
* @param dto
* @return
*/
@Override
public Boolean update(EntrustAlterApplyDTO dto) {
if(StrUtil.isBlank(dto.getId())){
if (StrUtil.isBlank(dto.getId())) {
throw new ValidateCodeException("修改的记录id不能为空");
}
EntrustAlterApply oldInfo = super.getById(dto.getId());
@ -180,12 +185,13 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
/**
* 删除委托申请修改消息
*
* @param ids
* @return
*/
@Override
public Boolean delete(List<String> ids) {
List<EntrustAlterApplyVO> entrustAlterAppliesVOS = baseMapper.getEntrustAlterApplyVOList(Wrappers.<EntrustAlterApply>query().in("eaa.id",ids));
List<EntrustAlterApplyVO> entrustAlterAppliesVOS = baseMapper.getEntrustAlterApplyVOList(Wrappers.<EntrustAlterApply>query().in("eaa.id", ids));
DLPUser user = SecurityUtils.getUser();
entrustAlterAppliesVOS.forEach(e -> {
if (!e.getApplicant().equals(user.getId())) {
@ -195,11 +201,12 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
throw new ValidateCodeException(String.format("案件名称为 %s 的记录不在可删除的状态,无法删除!", e.getCaseName()));
}
});
return super.remove(Wrappers.<EntrustAlterApply>lambdaUpdate().in(EntrustAlterApply::getId,ids));
return super.remove(Wrappers.<EntrustAlterApply>lambdaUpdate().in(EntrustAlterApply::getId, ids));
}
/**
* 修改委托案件简要鉴定要求, 并删除已生成的鉴定事项确认书和委托书
*
* @param dto
* @return
*/
@ -214,29 +221,67 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
caseEventService.update(Wrappers.<CaseEvent>lambdaUpdate().eq(CaseEvent::getId, entrustment.getCaseId())
.set(CaseEvent::getCaseBrief, dto.getCaseBrief())
.set(CaseEvent::getCaseName, dto.getCaseName())
.set(CaseEvent::getHappenTime, dto.getHappenTime())
);
// 添加更新记录 | <br> 代表换行
LocalDateTime opDate = null; // 操作的时间,这里也用来标识是否有更新
boolean isTypeName = false;
if (!oldCaseInfo.getCaseBrief().equals(dto.getCaseBrief())) {
opDate = LocalDateTime.now();
updateRecordBuilder.append(opDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:").append("<br>该委托案件的案件简要由 [").append(oldCaseInfo.getCaseBrief()).append("] 更改为 [").append(dto.getCaseBrief()).append("] 。");
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:");
updateRecordBuilder.append("<br>该委托案件的案件简要由 [").append(oldCaseInfo.getCaseBrief()).append("] 更改为 [").append(dto.getCaseBrief()).append("] 。");
}
if (!oldCaseInfo.getCaseName().equals(dto.getCaseName())) {
if (opDate == null) {
opDate = LocalDateTime.now();
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:");
}
updateRecordBuilder.append("<br>该委托案件的案件名称由 [").append(oldCaseInfo.getCaseName()).append("] 更改为 [").append(dto.getCaseName()).append("] 。");
}
if (dto.getHappenTime() != null && !oldCaseInfo.getHappenTime().equals(dto.getHappenTime().toLocalDate())) {
if (opDate == null) {
opDate = LocalDateTime.now();
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:");
}
updateRecordBuilder.append("<br>该委托案件的案发时间由 [").append(oldCaseInfo.getHappenTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))).append("] 更改为 [").append(dto.getHappenTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))).append("] 。");
}
if (dto.getEntrustmentTime() != null && entrustment.getEntrustmentTime().equals(dto.getEntrustmentTime())) {
if (opDate == null) {
opDate = LocalDateTime.now();
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:");
}
updateRecordBuilder.append("<br>该委托案件的委托时间由 [").append(entrustment.getEntrustmentTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("] 更改为 [").append(dto.getEntrustmentTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("] 。");
}
entrustment.setEntrustmentTime(dto.getEntrustmentTime()); // 修改委托时间
if (dto.getEntrustmentType() != null && dto.getEntrustmentType() != entrustment.getEntrustmentType()) {
isTypeName = true;
entrustment.setEntrustmentType(dto.getEntrustmentType());
if (opDate == null) {
opDate = LocalDateTime.now();
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:");
}
updateRecordBuilder.append("<br>该委托案件的委托类型由 [").append(entrustment.getEntrustmentType() == 0 ? "常规毒品" : "生物样本").append("] 更改为 [").append(dto.getEntrustmentType() == 0 ? "常规毒品" : "生物样本").append("] 。");
}
// 2.修改检材 信息
// 这里之所以要取未更新前的信息是为了留痕
Map<String, EntrustmentIdentificationMaterial> oldInfoMap = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery()
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustId)
.orderByAsc(EntrustmentIdentificationMaterial::getOrderNo))
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustId)
.orderByAsc(EntrustmentIdentificationMaterial::getOrderNo))
.stream().collect(Collectors.toMap(EntrustmentIdentificationMaterial::getId, Function.identity()));
List<EntrustmentIdentificationMaterial> entrustmentIdentificationMaterialList = processUpdateEntrustMaterialInfo(
dto.getMaterialList(),
oldInfoMap,
updateRecordBuilder,
opDate
opDate,
isTypeName
);
entrustmentIdentificationMaterialService.updateBatchById(entrustmentIdentificationMaterialList);
// 3. 更新委托鉴定要求和委托时间
entrustment.setEntrustmentTime(dto.getEntrustmentTime()); // 修改委托时间
updateEntrustmentRequirement(entrustment, dto.getEntrustRequirement(), updateRecordBuilder, opDate);
// 如果确认完成,则删除鉴定事项确认书和委托书,并更新申请状态为已完成
if (dto.getFinished()) {
@ -257,7 +302,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
* @param opDate
* @return 更新后的委托鉴定材料对象列表
*/
private List<EntrustmentIdentificationMaterial> processUpdateEntrustMaterialInfo(List<MaterialDTO> materialList, Map<String, EntrustmentIdentificationMaterial> oldInfoMap, StringBuilder updateRecordBuilder, LocalDateTime opDate) {
private List<EntrustmentIdentificationMaterial> processUpdateEntrustMaterialInfo(List<MaterialDTO> materialList, Map<String, EntrustmentIdentificationMaterial> oldInfoMap, StringBuilder updateRecordBuilder, LocalDateTime opDate, boolean isTypeName) {
Integer index = 1;
List<EntrustmentIdentificationMaterial> entrustmentIdentificationMaterialList = new ArrayList<>();
for (MaterialDTO item : materialList) {
@ -273,7 +318,25 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
boolean equalsName = oldMaterial.getName().equals(name);
boolean equalsAnalysisOption = oldMaterial.getAnalysisOption().equals(analysisOption);
boolean equalsDrugInfo = oldDrugsStr.equals(renewDrugsStr);
if (equalsName && equalsAnalysisOption && equalsDrugInfo) {
boolean equalsForm = oldMaterial.getForm().equals(item.getForm());
BigDecimal oldQuantity = oldMaterial.getQuantity();
BigDecimal newQuantity = item.getQuantity();
// 设置保留两位小数,四舍五入
oldQuantity = oldQuantity.setScale(2, RoundingMode.HALF_UP);
newQuantity = newQuantity.setScale(2, RoundingMode.HALF_UP);
boolean equalsQuantity = oldQuantity.equals(newQuantity);
boolean equalsUnit = oldMaterial.getUnit().equals(item.getUnit());
boolean equalsDrawTime = oldMaterial.getDrawTime().equals(item.getDrawTime());
boolean equalsDrawPlace = oldMaterial.getDrawPlace().equals(item.getDrawPlace());
boolean equalsMaterialAge = true;
boolean equalsBiologyGender = true;
if (item.getMaterialAge() != null && oldMaterial.getMaterialAge() != null) {
equalsMaterialAge = oldMaterial.getMaterialAge().equals(item.getMaterialAge());
}
if (item.getBiologyGender() != null && oldMaterial.getBiologyGender() != null) {
equalsBiologyGender = oldMaterial.getBiologyGender().equals(item.getBiologyGender());
}
if (equalsName && equalsAnalysisOption && equalsDrugInfo && equalsForm && equalsQuantity && equalsUnit && equalsDrawTime && equalsDrawPlace && equalsMaterialAge && equalsBiologyGender) {
// 信息并没有修改,不操作
continue;
}
@ -290,7 +353,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
.append("<br>")
.append(index++)
.append(".原检材编号为 [")
.append(oldMaterial.getImNo())
.append(StringUtils.isNotBlank(oldMaterial.getAcceptNo()) ? oldMaterial.getAcceptNo() : oldMaterial.getImNo())
.append("] 的检材信息");
if (!equalsName) {
updateRecordBuilder
@ -313,6 +376,63 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
.append("] 更改为 [")
.append(renewDrugsStr).append("]");
}
if (!equalsForm) {
updateRecordBuilder
.append("<br> - 性状由 [")
.append(oldMaterial.getForm())
.append("] 更改为 [")
.append(item.getForm()).append("]");
}
if (!equalsQuantity) {
updateRecordBuilder
.append("<br> - 重量/体积由 [")
.append(oldMaterial.getQuantity())
.append("] 更改为 [")
.append(item.getQuantity()).append("]");
}
if (!equalsUnit) {
updateRecordBuilder
.append("<br> - 单位由 [")
.append(oldMaterial.getUnit())
.append("] 更改为 [")
.append(item.getUnit()).append("]");
}
if (!equalsDrawTime) {
updateRecordBuilder
.append("<br> - 提取时间由 [")
.append(oldMaterial.getDrawTime())
.append("] 更改为 [")
.append(item.getDrawTime()).append("]");
}
if (!equalsDrawPlace) {
updateRecordBuilder
.append("<br> - 提取地点由 [")
.append(oldMaterial.getDrawPlace())
.append("] 更改为 [")
.append(item.getDrawPlace()).append("]");
}
if (!equalsMaterialAge) {
updateRecordBuilder
.append("<br> - 年龄由 [")
.append(oldMaterial.getMaterialAge())
.append("] 更改为 [")
.append(item.getMaterialAge()).append("]");
}
if (!equalsBiologyGender) {
updateRecordBuilder
.append("<br> - 性别由 [")
.append(oldMaterial.getBiologyGender())
.append("] 更改为 [")
.append(item.getBiologyGender()).append("]");
}
updateRecordBuilder.append("。");
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = new EntrustmentIdentificationMaterial();
entrustmentIdentificationMaterial.setId(materialId);
@ -321,6 +441,27 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
entrustmentIdentificationMaterial.setAnalysisOption(analysisOption);
// 因为检材的受理编号字段设置了null值也会更新,导致修改会把acceptNo更新为空, 为了防止这个情况,取出acceptNo在设置进去
entrustmentIdentificationMaterial.setAcceptNo(oldMaterial.getAcceptNo());
entrustmentIdentificationMaterial.setForm(item.getForm());
entrustmentIdentificationMaterial.setFormName(item.getForm());
entrustmentIdentificationMaterial.setRtSampleQuantity(item.getRtSampleQuantity());
entrustmentIdentificationMaterial.setQuantity(item.getQuantity());
entrustmentIdentificationMaterial.setSample1RepeatWeigh(item.getQuantity());
entrustmentIdentificationMaterial.setUnit(item.getUnit());
entrustmentIdentificationMaterial.setDrawTime(item.getDrawTime());
entrustmentIdentificationMaterial.setDrawPlace(item.getDrawPlace());
if (isTypeName) {
if (oldMaterial.getTypeName().equals("常规毒品")) {
entrustmentIdentificationMaterial.setTypeName("生物样本");
} else if (oldMaterial.getTypeName().equals("生物样本")) {
entrustmentIdentificationMaterial.setTypeName("常规毒品");
}
}
if (item.getMaterialAge() != null) {
entrustmentIdentificationMaterial.setMaterialAge(item.getMaterialAge());
}
if (item.getBiologyGender() != null) {
entrustmentIdentificationMaterial.setBiologyGender(item.getBiologyGender());
}
entrustmentIdentificationMaterialList.add(entrustmentIdentificationMaterial);
}
return entrustmentIdentificationMaterialList;
@ -328,6 +469,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
/**
* 判断当前委托是否在申请中的状态
*
* @param entrustId
* @return
*/
@ -371,6 +513,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
/**
* 删除委托书和鉴定事项确认书
*
* @param entrustmentNo
* @param entrustmentId
*/
@ -427,6 +570,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
/**
* 填充VO信息
*
* @param e
*/
private void fillVOInfo(EntrustAlterApplyVO e) {

@ -40,7 +40,6 @@ import digital.laboratory.platform.entrustment.entity.*;
import digital.laboratory.platform.entrustment.enums.AnalysisOptionEnums;
import digital.laboratory.platform.entrustment.enums.EntrustAlterApplyStatus;
import digital.laboratory.platform.entrustment.enums.EntrustStatusConstants;
import digital.laboratory.platform.entrustment.event.PushDataToLabsCareEvent;
import digital.laboratory.platform.entrustment.handler.AppStartupRunner;
import digital.laboratory.platform.entrustment.mapper.EntrustmentMapper;
import digital.laboratory.platform.entrustment.misc.ProcessFlowMapper;
@ -458,8 +457,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
/**
* 构造鉴定事项确认书的数据
*
* @param caseEvent 案件信息
* @param entrustment 委托信息
* @param caseEvent 案件信息
* @param entrustment 委托信息
* @param materialList 委托检材列表信息
* @param isAccepted -1 未受理0 1 受理之后的状态
* @return
@ -605,7 +604,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
* 构造封装质量
*
* @param materialList 检材列表
* @param flag A 分析样 R 留存样 其他 分析+留存
* @param flag A 分析样 R 留存样 其他 分析+留存
* @return 构造封装质量
*/
private BigDecimal getAllMaterialMount(List<EntrustmentIdentificationMaterial> materialList, String flag) {
@ -2050,7 +2049,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
/**
* 获取委托vo类并验证数据是否合法
*
* @param id 委托id
* @param id 委托id
* @param dlpUser 当前用户
* @return
*/
@ -3085,7 +3084,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
+ entrustGroupByStatusMap.getOrDefault(EntrustStatusConstants.ENTRUST_STATUS_WAITING_CONFIRM.getStatus(), Collections.EMPTY_LIST).size();
markersVOS.add(new MarkersVO("案件委托", deliverCount, "待送检"));
markersVOS.add(new MarkersVO("案件委托", entrustList.stream().filter(entrust -> entrust.getReturnOrNot() != null &&entrust.getReturnOrNot().equals(-1)).collect(Collectors.toList()).size(), "已退回"));
markersVOS.add(new MarkersVO("案件委托", entrustList.stream().filter(entrust -> entrust.getReturnOrNot() != null && entrust.getReturnOrNot().equals(-1)).collect(Collectors.toList()).size(), "已退回"));
markersVOS.add(new MarkersVO("案件委托", entrustGroupByStatusMap.getOrDefault(EntrustStatusConstants.ENTRUST_STATUS_COMPLETED.getStatus(), Collections.EMPTY_LIST).size(), "已完成"));
@ -3605,4 +3604,74 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
}
}
@Override
public void previewEntrustLetterPDF(String entrustId, HttpServletResponse servletResponse) throws Exception {
EntrustmentVO ev = this.getEntrustmentVOById(entrustId);
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery()
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustId));
if (materialList == null || materialList.size() == 0) {
throw new RuntimeException("请至少先添加一个检材后再进行打印!");
}
String identifyItemsConfirmLetterFileName = "鉴定事项确认书-" + ev.getEntrustmentNo();
String downFile = OSSDirectoryConstants.IDENTIFY_BOOK_DIRECTORY + "/" + entrustId + "/" + identifyItemsConfirmLetterFileName + ".docx";
boolean ret = !ossFile.objectExist(downFile);
if (!ossFile.objectExist(downFile) || ev.getStatus() <= EntrustStatusConstants.ENTRUST_STATUS_WAITING_ACCEPT.getStatus()) {
this.generateIdentifyItemsBook(ev.getId());
}
String pdfFilePath = OSSDirectoryConstants.IDENTIFY_BOOK_DIRECTORY + "/" + ev.getId() + "/" + identifyItemsConfirmLetterFileName + ".pdf";
ByteArrayOutputStream fosWord = new ByteArrayOutputStream();
ossFile.fileGet(downFile, fosWord);
ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray());
fosWord.close();
// 转换临时目录中的 word 文档为 PDF
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", identifyItemsConfirmLetterFileName + ".docx", "image/jpg", fisWord);
Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
fisWord.close();
org.apache.commons.io.output.ByteArrayOutputStream outPDF = new org.apache.commons.io.output.ByteArrayOutputStream();
IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE);
ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
outPDF.close();
ossFile.fileSave(pdfFilePath, isPDF);
isPDF.close();
ossFile.fileGet(pdfFilePath, servletResponse.getOutputStream());
System.out.println(String.format("转换为 PDF 结束"));
}
@Override
public void previewEntrustPDF(String entrustId, HttpServletResponse servletResponse) throws Exception {
EntrustmentVO ev = this.getEntrustmentVOById(entrustId);
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery()
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustId));
if (materialList == null || materialList.size() == 0) {
throw new RuntimeException("请至少先添加一个检材后再进行打印!");
}
String entrustmentLetterFileName = "鉴定委托书" + "-" + ev.getEntrustmentNo();
String downFile = OSSDirectoryConstants.DOCUMENT_ENTRUSTMENT_DIRECTORY + "/" + ev.getId() + "/" + entrustmentLetterFileName + ".docx";
boolean ret = !ossFile.objectExist(downFile);
if (!ossFile.objectExist(downFile) || ev.getStatus() <= EntrustStatusConstants.ENTRUST_STATUS_WAITING_ACCEPT.getStatus()) {
GenerateEntrustmentLetterPDF(ev);
}
String pdfFilePath = OSSDirectoryConstants.DOCUMENT_ENTRUSTMENT_DIRECTORY + "/" + ev.getId() + "/" + entrustmentLetterFileName + ".pdf";
ByteArrayOutputStream fosWord = new ByteArrayOutputStream();
ossFile.fileGet(downFile, fosWord);
ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray());
fosWord.close();
// 转换临时目录中的 word 文档为 PDF
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "image/jpg", fisWord);
Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
fisWord.close();
org.apache.commons.io.output.ByteArrayOutputStream outPDF = new org.apache.commons.io.output.ByteArrayOutputStream();
IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE);
ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
outPDF.close();
ossFile.fileSave(pdfFilePath, isPDF);
isPDF.close();
ossFile.fileGet(pdfFilePath, servletResponse.getOutputStream());
System.out.println(String.format("转换为 PDF 结束"));
}
}

@ -66,7 +66,7 @@
AND eaa.apply_org_id = #{query.clientOrgId}
</if>
</where>
ORDER BY eaa.apply_date DESC
ORDER BY eaa.create_time DESC
</select>
<select id="getEntrustAlterApplyVOOne"

Loading…
Cancel
Save