update
This commit is contained in:
@@ -1515,8 +1515,8 @@ public class EntrustmentController {
|
||||
@SysLog("创建鉴定委托书")
|
||||
@GetMapping("/el")
|
||||
// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')")
|
||||
public void bizGetPDFEntrustmentLetter(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
|
||||
entrustmentService.bizGetPDFEntrustmentLetter(id, theHttpServletRequest, httpServletResponse);
|
||||
public String bizGetPDFEntrustmentLetter(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
|
||||
return entrustmentService.bizGetPDFEntrustmentLetter(id, theHttpServletRequest, httpServletResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -210,7 +210,7 @@ public class EntrustmentIdentificationMaterialController {
|
||||
* sample2Quantity
|
||||
* sample2BoxId
|
||||
*
|
||||
* @param identificationMaterial
|
||||
* @param List<EntrustmentIdentificationMaterial>
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -243,10 +243,10 @@ public class EntrustmentIdentificationMaterialController {
|
||||
@SysLog("受理人保存检材信息")
|
||||
@PutMapping("/accept_save")
|
||||
@PreAuthorize("@pms.hasPermission('EntrustmentAccept')")
|
||||
public R<EntrustmentIdentificationMaterial> bizAccept_Save(@RequestBody EntrustmentIdentificationMaterial identificationMaterial, HttpServletRequest theHttpServletRequest) {
|
||||
public R<List<EntrustmentIdentificationMaterial>> bizAccept_Save(@RequestBody List<EntrustmentIdentificationMaterial> materialList, HttpServletRequest theHttpServletRequest) {
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||
return R.ok(entrustmentIdentificationMaterialService.bizAccept_Save(identificationMaterial, dlpUser), "保存检材信息成功");
|
||||
return R.ok(entrustmentIdentificationMaterialService.bizAccept_Save(materialList, dlpUser), "保存检材信息成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -919,20 +919,20 @@ public class EntrustmentIdentificationMaterialController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加复秤信息的保存接口 还没增加权限控制
|
||||
*
|
||||
* @param id
|
||||
* @param sample1RepeatWeigh
|
||||
* @param sample2RepeatWeigh
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saveRepWeigh")
|
||||
@ApiOperation(value = "保存复秤信息", notes = "保存复秤信息")
|
||||
@GlobalTransactional
|
||||
public R saveRepWeigh(String id, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag) {
|
||||
return R.ok(entrustmentIdentificationMaterialService.saveRepWeigh(id, sample1RepeatWeigh, sample2RepeatWeigh, isUseBalance, sampleFlag), "保存成功");
|
||||
}
|
||||
// /**
|
||||
// * 添加复秤信息的保存接口 还没增加权限控制
|
||||
// *
|
||||
// * @param id
|
||||
// * @param sample1RepeatWeigh
|
||||
// * @param sample2RepeatWeigh
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("/saveRepWeigh")
|
||||
// @ApiOperation(value = "保存复秤信息", notes = "保存复秤信息")
|
||||
// @GlobalTransactional
|
||||
// public R saveRepWeigh(String id, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag) {
|
||||
// return R.ok(entrustmentIdentificationMaterialService.saveRepWeigh(id, sample1RepeatWeigh, sample2RepeatWeigh, isUseBalance, sampleFlag), "保存成功");
|
||||
// }
|
||||
|
||||
//增加留存样
|
||||
@PostMapping("/settingRetained")
|
||||
|
||||
@@ -488,7 +488,7 @@ public class EntrustmentIdentificationMaterial extends BaseEntity {
|
||||
private String analysisOptionValue;
|
||||
|
||||
/**
|
||||
* 数据来源,用于区别数据来自自身系统还是外部系统
|
||||
* 数据来源,用于区别数据来自自身系统还是外部系统 、0:本系统 1:禁毒大数据平台
|
||||
*/
|
||||
@ApiModelProperty(value = "数据来源")
|
||||
private Integer dataSources;
|
||||
@@ -511,6 +511,12 @@ public class EntrustmentIdentificationMaterial extends BaseEntity {
|
||||
*/
|
||||
@ApiModelProperty(value = "提取时间--贵阳新增需求")
|
||||
private LocalDateTime drawTime;
|
||||
/**
|
||||
* 提取时间--贵阳新增需求
|
||||
*/
|
||||
@ApiModelProperty(value = "提取时间--贵阳新增需求 打印转为字符串")
|
||||
@TableField(exist = false)
|
||||
private String printDrawTime;
|
||||
|
||||
/**
|
||||
* 提取地点--贵阳新增需求
|
||||
@@ -524,6 +530,16 @@ public class EntrustmentIdentificationMaterial extends BaseEntity {
|
||||
@ApiModelProperty(value = "包装是否完整--贵阳新增需求")
|
||||
private Boolean packComplete;
|
||||
|
||||
/* 留存样个数--贵阳新增需求
|
||||
*/
|
||||
@ApiModelProperty(value = "留存样个数--贵阳新增需求")
|
||||
private Integer rtSampleQuantity;
|
||||
|
||||
/* 留存样个数--贵阳新增需求
|
||||
*/
|
||||
@ApiModelProperty(value = "检材备注--贵阳新增需求")
|
||||
private String remark;
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
public String getOrderNo1() {
|
||||
|
||||
@@ -81,7 +81,7 @@ public interface EntrustmentIdentificationMaterialService extends IService<Entru
|
||||
|
||||
EntrustmentIdentificationMaterial bizApprove_Apply(EntrustmentIdentificationMaterial identificationMaterial, Integer opCode, DLPUser dlpUser);
|
||||
|
||||
EntrustmentIdentificationMaterial bizAccept_Save(EntrustmentIdentificationMaterial identificationMaterial, DLPUser dlpUser);
|
||||
List<EntrustmentIdentificationMaterial> bizAccept_Save(List<EntrustmentIdentificationMaterial> materialList, DLPUser dlpUser);
|
||||
|
||||
EntrustmentIdentificationMaterial bizAccept_Apply(EntrustmentIdentificationMaterial identificationMaterial, Integer opCode, DLPUser dlpUser);
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface EntrustmentIdentificationMaterialService extends IService<Entru
|
||||
|
||||
EntrustmentIdentificationMaterial deleteById(String id);
|
||||
|
||||
boolean saveRepWeigh(String id, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag);
|
||||
boolean saveRepWeigh(EntrustmentIdentificationMaterial entrustmentIdentificationMaterial, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag);
|
||||
|
||||
EntrustmentIdentificationMaterial settingRetained(String id, int flag);
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ public interface EntrustmentService extends IService<Entrustment> {
|
||||
|
||||
Entrustment bizDeliver_Apply(Entrustment entrust, Integer opCode, DLPUser dlpUser);
|
||||
|
||||
void bizGetPDFEntrustmentLetter(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse);
|
||||
String bizGetPDFEntrustmentLetter(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse);
|
||||
|
||||
Entrustment bizAccept_Save(Entrustment entrust, DLPUser dlpUser);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package digital.laboratory.platform.entrustment.service.impl;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -609,122 +610,132 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntrustmentIdentificationMaterial bizAccept_Save(EntrustmentIdentificationMaterial identificationMaterial, DLPUser dlpUser) {
|
||||
public List<EntrustmentIdentificationMaterial> bizAccept_Save(List<EntrustmentIdentificationMaterial> materialList, DLPUser dlpUser) {
|
||||
|
||||
// 检查委托原来的状态
|
||||
EntrustmentIdentificationMaterial im = this.getById(identificationMaterial.getId());
|
||||
if (im == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId()));
|
||||
}
|
||||
for (EntrustmentIdentificationMaterial identificationMaterial : materialList) {
|
||||
|
||||
if ((im.getAcceptPassed() != null) && (im.getAcceptPassed() != 0)) {
|
||||
throw new RuntimeException(String.format("检材只能在未受理状态才能保存"));
|
||||
}
|
||||
// 检查委托原来的状态
|
||||
EntrustmentIdentificationMaterial im = this.getById(identificationMaterial.getId());
|
||||
if (im == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId()));
|
||||
}
|
||||
|
||||
Entrustment entrustment = entrustmentService.getById(im.getEntrustmentId());
|
||||
if (entrustment == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的委托", im.getEntrustmentId()));
|
||||
}
|
||||
if ((im.getAcceptPassed() != null) && (im.getAcceptPassed() != 0)) {
|
||||
throw new RuntimeException(String.format("检材只能在未受理状态才能保存"));
|
||||
}
|
||||
|
||||
if (entrustment.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus()) {
|
||||
throw new RuntimeException("委托不在正在受理状态");
|
||||
}
|
||||
Entrustment entrustment = entrustmentService.getById(im.getEntrustmentId());
|
||||
if (entrustment == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的委托", im.getEntrustmentId()));
|
||||
}
|
||||
|
||||
// if (!dlpUser.getId().equals(entrustment.getAcceptClaimUser())) {
|
||||
// throw new RuntimeException(String.format("委托的受理任务是由其他人认领的。认领用户是: %s", entrustment.getAcceptClaimUser()));
|
||||
// }
|
||||
if (entrustment.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus()) {
|
||||
throw new RuntimeException("委托不在正在受理状态");
|
||||
}
|
||||
if (identificationMaterial.getSample1RepeatWeigh() != null) {
|
||||
im.setSample1RepeatWeigh(identificationMaterial.getSample1RepeatWeigh());
|
||||
im.setSample2RepeatWeigh(identificationMaterial.getSample2RepeatWeigh());
|
||||
this.saveRepWeigh(im, im.getSample1RepeatWeigh().doubleValue(), im.getSample2RepeatWeigh().doubleValue(), false, "");
|
||||
}
|
||||
// if (!dlpUser.getId().equals(entrustment.getAcceptClaimUser())) {
|
||||
// throw new RuntimeException(String.format("委托的受理任务是由其他人认领的。认领用户是: %s", entrustment.getAcceptClaimUser()));
|
||||
// }
|
||||
|
||||
|
||||
//-------------------
|
||||
// 更新数据库表数据
|
||||
//-------------------
|
||||
im.setFundQuantity(identificationMaterial.getFundQuantity());
|
||||
im.setQuantity(identificationMaterial.getQuantity());
|
||||
//-------------------
|
||||
// 更新数据库表数据
|
||||
//-------------------
|
||||
// im.setFundQuantity(identificationMaterial.getFundQuantity());
|
||||
// im.setQuantity(identificationMaterial.getQuantity());
|
||||
//
|
||||
// im.setProvidedSample1No(identificationMaterial.getProvidedSample1No());
|
||||
// im.setProvidedSample1FundQuantity(identificationMaterial.getProvidedSample1FundQuantity());
|
||||
// im.setProvidedSample1Quantity(identificationMaterial.getProvidedSample1Quantity());
|
||||
//
|
||||
// im.setProvidedSample2Present(identificationMaterial.getProvidedSample2Present());
|
||||
// im.setProvidedSample2No(identificationMaterial.getProvidedSample2No());
|
||||
// im.setProvidedSample2FundQuantity(identificationMaterial.getProvidedSample2FundQuantity());
|
||||
// im.setProvidedSample2Quantity(identificationMaterial.getProvidedSample2Quantity());
|
||||
// im.setSplitedSample(identificationMaterial.getSplitedSample());
|
||||
// im.setRemark(identificationMaterial.getRemark());
|
||||
im.setRemark(identificationMaterial.getRemark());
|
||||
im.setPack(identificationMaterial.getPack());
|
||||
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
||||
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No())) {
|
||||
im.setProvidedSample1No(sampleService.getNewProvidedSampleNo(im.getImNo(), 1));
|
||||
}
|
||||
//}
|
||||
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) {
|
||||
im.setProvidedSample2No(sampleService.getNewProvidedSampleNo(im.getImNo(), 2));
|
||||
}
|
||||
}
|
||||
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
||||
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getSample1No())) {
|
||||
im.setSample1No(sampleService.getNewSampleNo(im.getImNo(), 1));
|
||||
}
|
||||
//}
|
||||
if ((identificationMaterial.getSample2Present() != null) && identificationMaterial.getSample2Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getSample2No())) {
|
||||
im.setSample2No(sampleService.getNewSampleNo(im.getImNo(), 2));
|
||||
}
|
||||
}
|
||||
// im.setSample1No(identificationMaterial.getSample1No());
|
||||
// im.setSample1FundQuantity(identificationMaterial.getSample1FundQuantity());
|
||||
// im.setSample1Quantity(identificationMaterial.getSample1Quantity());
|
||||
// im.setSample1BoxId(identificationMaterial.getSample1BoxId());
|
||||
//
|
||||
// im.setSample2Present(identificationMaterial.getSample2Present());
|
||||
// im.setSample2No(identificationMaterial.getSample2No());
|
||||
// im.setSample2FundQuantity(identificationMaterial.getSample2FundQuantity());
|
||||
// im.setSample2Quantity(identificationMaterial.getSample2Quantity());
|
||||
// im.setSample2BoxId(identificationMaterial.getSample2BoxId());
|
||||
//
|
||||
//
|
||||
//
|
||||
// UpdateWrapper<EntrustmentIdentificationMaterial> updateWrapper = new UpdateWrapper<EntrustmentIdentificationMaterial>();
|
||||
// updateWrapper.eq("id", im.getId()); // 查询条件是 id 相等
|
||||
//
|
||||
// updateWrapper.set("fund_quantity", im.getFundQuantity());
|
||||
// updateWrapper.set("quantity", im.getQuantity());
|
||||
//
|
||||
// updateWrapper.set("provided_sample1_no", im.getProvidedSample1No());
|
||||
// updateWrapper.set("provided_sample1_fund_quantity", im.getProvidedSample1FundQuantity());
|
||||
// updateWrapper.set("provided_sample1_quantity", im.getProvidedSample1Quantity());
|
||||
//
|
||||
// updateWrapper.set("provided_sample2_present", im.getProvidedSample2Present());
|
||||
// updateWrapper.set("provided_sample2_no", im.getProvidedSample2No());
|
||||
// updateWrapper.set("provided_sample2_fund_quantity", im.getProvidedSample2FundQuantity());
|
||||
// updateWrapper.set("provided_sample2_quantity", im.getProvidedSample2Quantity());
|
||||
//
|
||||
// updateWrapper.set("splited_sample", im.getSplitedSample());
|
||||
//
|
||||
// //updateWrapper.set("sample1_present", im.getSample1Present());
|
||||
// updateWrapper.set("sample1_no", im.getSample1No());
|
||||
// updateWrapper.set("sample1_fund_quantity", im.getSample1FundQuantity());
|
||||
// updateWrapper.set("sample1_quantity", im.getSample1Quantity());
|
||||
// updateWrapper.set("sample1_box_id", im.getSample1BoxId());
|
||||
// updateWrapper.set("sample2_present", im.getSample2Present());
|
||||
// updateWrapper.set("sample2_no", im.getSample2No());
|
||||
// updateWrapper.set("sample2_fund_quantity", im.getSample2FundQuantity());
|
||||
// updateWrapper.set("sample2_quantity", im.getSample2Quantity());
|
||||
// updateWrapper.set("sample2_box_id", im.getSample2BoxId());
|
||||
// updateWrapper.set("remark", im.getRemark());
|
||||
// updateWrapper.set("pack", im.getPack());
|
||||
|
||||
im.setProvidedSample1No(identificationMaterial.getProvidedSample1No());
|
||||
im.setProvidedSample1FundQuantity(identificationMaterial.getProvidedSample1FundQuantity());
|
||||
im.setProvidedSample1Quantity(identificationMaterial.getProvidedSample1Quantity());
|
||||
if (!this.updateById(im)) {
|
||||
throw new RuntimeException("保存检材信息失败");
|
||||
}
|
||||
|
||||
im.setProvidedSample2Present(identificationMaterial.getProvidedSample2Present());
|
||||
im.setProvidedSample2No(identificationMaterial.getProvidedSample2No());
|
||||
im.setProvidedSample2FundQuantity(identificationMaterial.getProvidedSample2FundQuantity());
|
||||
im.setProvidedSample2Quantity(identificationMaterial.getProvidedSample2Quantity());
|
||||
|
||||
im.setSplitedSample(identificationMaterial.getSplitedSample());
|
||||
|
||||
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
||||
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No())) {
|
||||
im.setProvidedSample1No(sampleService.getNewProvidedSampleNo(im.getImNo(), 1));
|
||||
}
|
||||
//}
|
||||
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) {
|
||||
im.setProvidedSample2No(sampleService.getNewProvidedSampleNo(im.getImNo(), 2));
|
||||
// 从数据库表中取出保存的委托对象, 后续的操作我们以此为准
|
||||
im = this.getById(identificationMaterial.getId());
|
||||
if (im == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
im.setSample1No(identificationMaterial.getSample1No());
|
||||
im.setSample1FundQuantity(identificationMaterial.getSample1FundQuantity());
|
||||
im.setSample1Quantity(identificationMaterial.getSample1Quantity());
|
||||
im.setSample1BoxId(identificationMaterial.getSample1BoxId());
|
||||
|
||||
im.setSample2Present(identificationMaterial.getSample2Present());
|
||||
im.setSample2No(identificationMaterial.getSample2No());
|
||||
im.setSample2FundQuantity(identificationMaterial.getSample2FundQuantity());
|
||||
im.setSample2Quantity(identificationMaterial.getSample2Quantity());
|
||||
im.setSample2BoxId(identificationMaterial.getSample2BoxId());
|
||||
|
||||
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
||||
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getSample1No())) {
|
||||
im.setSample1No(sampleService.getNewSampleNo(im.getImNo(), 1));
|
||||
}
|
||||
//}
|
||||
if ((identificationMaterial.getSample2Present() != null) && identificationMaterial.getSample2Present()) {
|
||||
if (StrUtil.isBlank(identificationMaterial.getSample2No())) {
|
||||
im.setSample2No(sampleService.getNewSampleNo(im.getImNo(), 2));
|
||||
}
|
||||
}
|
||||
|
||||
UpdateWrapper<EntrustmentIdentificationMaterial> updateWrapper = new UpdateWrapper<EntrustmentIdentificationMaterial>();
|
||||
updateWrapper.eq("id", im.getId()); // 查询条件是 id 相等
|
||||
|
||||
updateWrapper.set("fund_quantity", im.getFundQuantity());
|
||||
updateWrapper.set("quantity", im.getQuantity());
|
||||
|
||||
updateWrapper.set("provided_sample1_no", im.getProvidedSample1No());
|
||||
updateWrapper.set("provided_sample1_fund_quantity", im.getProvidedSample1FundQuantity());
|
||||
updateWrapper.set("provided_sample1_quantity", im.getProvidedSample1Quantity());
|
||||
|
||||
updateWrapper.set("provided_sample2_present", im.getProvidedSample2Present());
|
||||
updateWrapper.set("provided_sample2_no", im.getProvidedSample2No());
|
||||
updateWrapper.set("provided_sample2_fund_quantity", im.getProvidedSample2FundQuantity());
|
||||
updateWrapper.set("provided_sample2_quantity", im.getProvidedSample2Quantity());
|
||||
|
||||
updateWrapper.set("splited_sample", im.getSplitedSample());
|
||||
|
||||
//updateWrapper.set("sample1_present", im.getSample1Present());
|
||||
updateWrapper.set("sample1_no", im.getSample1No());
|
||||
updateWrapper.set("sample1_fund_quantity", im.getSample1FundQuantity());
|
||||
updateWrapper.set("sample1_quantity", im.getSample1Quantity());
|
||||
updateWrapper.set("sample1_box_id", im.getSample1BoxId());
|
||||
updateWrapper.set("sample2_present", im.getSample2Present());
|
||||
updateWrapper.set("sample2_no", im.getSample2No());
|
||||
updateWrapper.set("sample2_fund_quantity", im.getSample2FundQuantity());
|
||||
updateWrapper.set("sample2_quantity", im.getSample2Quantity());
|
||||
updateWrapper.set("sample2_box_id", im.getSample2BoxId());
|
||||
|
||||
if (!this.update(null, updateWrapper)) {
|
||||
throw new RuntimeException("保存检材信息失败");
|
||||
}
|
||||
|
||||
// 从数据库表中取出保存的委托对象, 后续的操作我们以此为准
|
||||
im = this.getById(identificationMaterial.getId());
|
||||
if (im == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId()));
|
||||
}
|
||||
return im;
|
||||
return materialList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1155,11 +1166,10 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveRepWeigh(String id, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag) {
|
||||
|
||||
public boolean saveRepWeigh(EntrustmentIdentificationMaterial entrustmentIdentificationMaterial, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag) {
|
||||
BigDecimal data1 = new BigDecimal(sample1RepeatWeigh);
|
||||
BigDecimal data2 = new BigDecimal(!Double.isNaN(sample2RepeatWeigh) ? sample2RepeatWeigh : 0);
|
||||
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = this.getById(id);
|
||||
// EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = this.getById(id);
|
||||
entrustmentIdentificationMaterial.setSample1RepeatWeigh(data1);
|
||||
entrustmentIdentificationMaterial.setSample2RepeatWeigh(data2);
|
||||
//设置样本的重量
|
||||
@@ -1232,156 +1242,166 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
|
||||
Entrustment entrustment = entrustmentService.getById(identificationMaterialList.get(0).getEntrustmentId());
|
||||
|
||||
|
||||
if (!dlpUser.isStaff() && entrustment.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()) {
|
||||
throw new RuntimeException(String.format("你已提交过该委托,无法再添加检材信息!"));
|
||||
}
|
||||
for (EntrustmentIdentificationMaterial identificationMaterial : identificationMaterialList) {
|
||||
String id = IdWorker.get32UUID().toUpperCase();
|
||||
if (entrustment.getDataSources() == 1) {
|
||||
EntrustOfThirdSys entrustOfThirdSys = synchronizeDataService.getOne(new LambdaQueryWrapper<EntrustOfThirdSys>().eq(EntrustOfThirdSys::getEntrustMainId, entrustment.getId()));
|
||||
EntrustMaterialOfThirdSys entrustMaterialOfThirdSys = new EntrustMaterialOfThirdSys();
|
||||
entrustMaterialOfThirdSys.setEntrustId(entrustOfThirdSys.getId());
|
||||
entrustMaterialOfThirdSys.setId(id);
|
||||
List<EntrustMaterialOfThirdSys> list = synchronizeMaterialVoService.list(new LambdaQueryWrapper<EntrustMaterialOfThirdSys>().eq(EntrustMaterialOfThirdSys::getEntrustId, entrustOfThirdSys.getId()));
|
||||
entrustMaterialOfThirdSys.setOrder_index(((Integer) (list.size() + 1)).toString());
|
||||
entrustMaterialOfThirdSys.setName(identificationMaterial.getName());
|
||||
String unitByZhCn = ConvertUtils.getUnitByZhCn(identificationMaterial.getUnit());
|
||||
entrustMaterialOfThirdSys.setUnit(unitByZhCn);
|
||||
entrustMaterialOfThirdSys.setSampleUnit(unitByZhCn);
|
||||
entrustMaterialOfThirdSys.setColorType(identificationMaterial.getColor());
|
||||
entrustMaterialOfThirdSys.setShapeType(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType()));
|
||||
entrustMaterialOfThirdSys.setPackageType(identificationMaterial.getPackName());
|
||||
entrustMaterialOfThirdSys.setAmount(identificationMaterial.getQuantity());
|
||||
List<DrugLite> candidateDrugs = identificationMaterial.getCandidateDrugs();
|
||||
List<String> stringList = new ArrayList<>();
|
||||
|
||||
for (DrugLite candidateDrug : candidateDrugs) {
|
||||
String name = candidateDrug.getName();
|
||||
stringList.add(name);
|
||||
}
|
||||
String listJSONString = JSON.toJSONString(stringList);
|
||||
entrustMaterialOfThirdSys.setTargetObjectTypeList(listJSONString);
|
||||
String analysisType = "";
|
||||
switch (identificationMaterial.getAnalysisOption()) {
|
||||
case 1:
|
||||
analysisType = "qualitative";
|
||||
break;
|
||||
case 2:
|
||||
analysisType = "ration";
|
||||
break;
|
||||
case 3:
|
||||
analysisType = "qualitativeAndRation";
|
||||
break;
|
||||
case 4:
|
||||
analysisType = "relevance";
|
||||
break;
|
||||
case 5:
|
||||
analysisType = "other";
|
||||
break;
|
||||
}
|
||||
entrustMaterialOfThirdSys.setAnalysisType(analysisType);
|
||||
synchronizeMaterialVoService.save(entrustMaterialOfThirdSys);
|
||||
}
|
||||
|
||||
String entrustmentId = identificationMaterial.getEntrustmentId();
|
||||
|
||||
if (StrUtil.isBlank(identificationMaterial.getCaseId())) {
|
||||
throw new RuntimeException(String.format("检材必须与某个案件关联, 必须提供 caseId"));
|
||||
}
|
||||
CaseEvent cj = caseEventService.getById(identificationMaterial.getCaseId());
|
||||
if (cj == null) {
|
||||
throw new RuntimeException(String.format("不存在 id 为 %s 的案件", identificationMaterial.getCaseId()));
|
||||
}
|
||||
if (StrUtil.isBlank(cj.getCaseNo())) {
|
||||
throw new RuntimeException(String.format("对应的案件资料不完整, 不存在案件编号。请先完善案件资料"));
|
||||
}
|
||||
|
||||
////若提前创建好了物证,则关联通过物证编号关联检材编号即可;
|
||||
if (StrUtil.isNotBlank(identificationMaterial.getEvidenceId())) {
|
||||
CaseEvidence caseEvidence = caseEvidenceService.getById(identificationMaterial.getEvidenceId());
|
||||
identificationMaterial.setImNo(this.getNewIdentificationMaterialNo(caseEvidence.getEvidenceNo()));
|
||||
|
||||
if (StringUtils.isNotBlank(identificationMaterial.getId()) && StringUtils.isNotBlank(identificationMaterial.getSample1No())) {
|
||||
identificationMaterial = this.putUpdateById(identificationMaterial, dlpUser);
|
||||
} else {
|
||||
String newEvidenceCode = caseEvidenceService.getNewEvidenceCode(cj.getCaseNo());
|
||||
String materialNo = this.getNewIdentificationMaterialNo(newEvidenceCode);
|
||||
identificationMaterial.setImNo(materialNo);
|
||||
}
|
||||
Boolean copyAttachemnts = false;
|
||||
if (copyAttachemnts == null) {
|
||||
copyAttachemnts = false;
|
||||
}
|
||||
String id = IdWorker.get32UUID().toUpperCase();
|
||||
if (entrustment.getDataSources() == 1) {
|
||||
EntrustOfThirdSys entrustOfThirdSys = synchronizeDataService.getOne(new LambdaQueryWrapper<EntrustOfThirdSys>().eq(EntrustOfThirdSys::getEntrustMainId, entrustment.getId()));
|
||||
EntrustMaterialOfThirdSys entrustMaterialOfThirdSys = new EntrustMaterialOfThirdSys();
|
||||
entrustMaterialOfThirdSys.setEntrustId(entrustOfThirdSys.getId());
|
||||
entrustMaterialOfThirdSys.setId(id);
|
||||
List<EntrustMaterialOfThirdSys> list = synchronizeMaterialVoService.list(new LambdaQueryWrapper<EntrustMaterialOfThirdSys>().eq(EntrustMaterialOfThirdSys::getEntrustId, entrustOfThirdSys.getId()));
|
||||
entrustMaterialOfThirdSys.setOrder_index(((Integer) (list.size() + 1)).toString());
|
||||
entrustMaterialOfThirdSys.setName(identificationMaterial.getName());
|
||||
String unitByZhCn = ConvertUtils.getUnitByZhCn(identificationMaterial.getUnit());
|
||||
entrustMaterialOfThirdSys.setUnit(unitByZhCn);
|
||||
entrustMaterialOfThirdSys.setSampleUnit(unitByZhCn);
|
||||
entrustMaterialOfThirdSys.setColorType(identificationMaterial.getColor());
|
||||
entrustMaterialOfThirdSys.setShapeType(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType()));
|
||||
entrustMaterialOfThirdSys.setPackageType(identificationMaterial.getPackName());
|
||||
entrustMaterialOfThirdSys.setAmount(identificationMaterial.getQuantity());
|
||||
List<DrugLite> candidateDrugs = identificationMaterial.getCandidateDrugs();
|
||||
List<String> stringList = new ArrayList<>();
|
||||
|
||||
|
||||
if (StrUtil.isBlank(entrustmentId)) {
|
||||
throw new RuntimeException(String.format("检材必须与某个委托关联, 必须提供 entrustmentId"));
|
||||
}
|
||||
|
||||
identificationMaterial.setId(id);
|
||||
//设置一些初始属性
|
||||
identificationMaterial.setCheckPassed(0);
|
||||
identificationMaterial.setApprovePassed(0);
|
||||
identificationMaterial.setAcceptPassed(0);
|
||||
|
||||
identificationMaterial.setPackName(identificationMaterial.getPack());
|
||||
identificationMaterial.setTypeName(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType()));
|
||||
|
||||
identificationMaterial.setFormName(identificationMaterial.getForm());
|
||||
//设置序号,这里我们按先后顺序,给插入的检材排一个序号
|
||||
identificationMaterial.setOrderNo(getWtOrderNo(identificationMaterial.getEntrustmentId()));
|
||||
//如果传来了样本1的质量,我们要将它赋给Sample1Quantity
|
||||
if (identificationMaterial.getSample1Quantity() == null) {
|
||||
identificationMaterial.setSample1Quantity(identificationMaterial.getProvidedSample1Quantity());
|
||||
}
|
||||
//保存采样人
|
||||
saveCollectors(identificationMaterial, dlpUser);
|
||||
|
||||
List<EntrustmentIdentificationMaterial> list = this.list(new LambdaQueryWrapper<EntrustmentIdentificationMaterial>().eq(EntrustmentIdentificationMaterial::getProvidedSample1No, identificationMaterial.getProvidedSample1No()));
|
||||
//如果在创建检材这
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No()) && list != null && list.size() > 0) {
|
||||
identificationMaterial.setProvidedSample1No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 1));
|
||||
}
|
||||
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) {
|
||||
//如果委托单位分样了
|
||||
//如果委托单位分样了
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) {
|
||||
identificationMaterial.setProvidedSample2No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 2));
|
||||
}
|
||||
//受理的时候应该有2个样
|
||||
identificationMaterial = settingAcceptSampleInfoDivide(identificationMaterial);
|
||||
//如果分样了,并且传入了样本2的值,那么我们将这个值要赋给sample2Quantity,以便受理的时候使用
|
||||
if (identificationMaterial.getProvidedSample2Quantity() != null) {
|
||||
identificationMaterial.setSample2Quantity(identificationMaterial.getProvidedSample2Quantity());
|
||||
}
|
||||
} else {
|
||||
//委托单位没分样
|
||||
identificationMaterial = settingAcceptSampleInfoNoDivide(identificationMaterial);
|
||||
}
|
||||
//默认肯定有一个是分析样是永远存在的,添加的时候,先将这个样本生成出来,所以受理时候的分样信息有一个是存在的,同理如果送检时候的分样信息,也是默认有一个存在的,这个在分样的时候,通过接口调用产生
|
||||
//这里判断委托单位是否分样
|
||||
//identificationMaterial.setSample1No(sampleService.getNewSampleNo(identificationMaterial.getImNo(),1));
|
||||
|
||||
identificationMaterial.setCreateBy(dlpUser.getId());
|
||||
identificationMaterial.setCreateTime(LocalDateTime.now());
|
||||
identificationMaterial.setAcceptNo(null);
|
||||
identificationMaterial.setSample1RepeatWeigh(null);
|
||||
identificationMaterial.setSample2RepeatWeigh(null);
|
||||
|
||||
|
||||
//判断检材的重量不能大于物证的重量 暂不判断,因为可能单位不统一
|
||||
if (this.save(identificationMaterial)) {
|
||||
// 新增检材记录成功
|
||||
try {
|
||||
if (copyAttachemnts) {
|
||||
List<String> fileList = ossFile.fileList(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId());
|
||||
for (String fileName : fileList) {
|
||||
String srcFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId() + "/" + fileName;
|
||||
String destFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getEntrustmentId() + "/" + identificationMaterial.getId() + "/" + fileName;
|
||||
ossFile.fileCopy(srcFileName, destFileName);
|
||||
}
|
||||
for (DrugLite candidateDrug : candidateDrugs) {
|
||||
String name = candidateDrug.getName();
|
||||
stringList.add(name);
|
||||
}
|
||||
String listJSONString = JSON.toJSONString(stringList);
|
||||
entrustMaterialOfThirdSys.setTargetObjectTypeList(listJSONString);
|
||||
String analysisType = "";
|
||||
switch (identificationMaterial.getAnalysisOption()) {
|
||||
case 1:
|
||||
analysisType = "qualitative";
|
||||
break;
|
||||
case 2:
|
||||
analysisType = "ration";
|
||||
break;
|
||||
case 3:
|
||||
analysisType = "qualitativeAndRation";
|
||||
break;
|
||||
case 4:
|
||||
analysisType = "relevance";
|
||||
break;
|
||||
case 5:
|
||||
analysisType = "other";
|
||||
break;
|
||||
}
|
||||
entrustMaterialOfThirdSys.setAnalysisType(analysisType);
|
||||
synchronizeMaterialVoService.save(entrustMaterialOfThirdSys);
|
||||
}
|
||||
|
||||
String entrustmentId = identificationMaterial.getEntrustmentId();
|
||||
|
||||
if (StrUtil.isBlank(identificationMaterial.getCaseId())) {
|
||||
throw new RuntimeException(String.format("检材必须与某个案件关联, 必须提供 caseId"));
|
||||
}
|
||||
CaseEvent cj = caseEventService.getById(identificationMaterial.getCaseId());
|
||||
if (cj == null) {
|
||||
throw new RuntimeException(String.format("不存在 id 为 %s 的案件", identificationMaterial.getCaseId()));
|
||||
}
|
||||
if (StrUtil.isBlank(cj.getCaseNo())) {
|
||||
throw new RuntimeException(String.format("对应的案件资料不完整, 不存在案件编号。请先完善案件资料"));
|
||||
}
|
||||
|
||||
////若提前创建好了物证,则关联通过物证编号关联检材编号即可;
|
||||
if (StrUtil.isNotBlank(identificationMaterial.getEvidenceId())) {
|
||||
CaseEvidence caseEvidence = caseEvidenceService.getById(identificationMaterial.getEvidenceId());
|
||||
identificationMaterial.setImNo(this.getNewIdentificationMaterialNo(caseEvidence.getEvidenceNo()));
|
||||
|
||||
} else {
|
||||
String newEvidenceCode = caseEvidenceService.getNewEvidenceCode(cj.getCaseNo());
|
||||
String materialNo = this.getNewIdentificationMaterialNo(newEvidenceCode);
|
||||
identificationMaterial.setImNo(materialNo);
|
||||
}
|
||||
Boolean copyAttachemnts = false;
|
||||
if (copyAttachemnts == null) {
|
||||
copyAttachemnts = false;
|
||||
}
|
||||
|
||||
|
||||
if (StrUtil.isBlank(entrustmentId)) {
|
||||
throw new RuntimeException(String.format("检材必须与某个委托关联, 必须提供 entrustmentId"));
|
||||
}
|
||||
|
||||
identificationMaterial.setId(id);
|
||||
//设置一些初始属性
|
||||
identificationMaterial.setCheckPassed(0);
|
||||
identificationMaterial.setApprovePassed(0);
|
||||
identificationMaterial.setAcceptPassed(0);
|
||||
|
||||
identificationMaterial.setPackName(identificationMaterial.getPack());
|
||||
Integer entrustmentType = entrustment.getEntrustmentType();
|
||||
//检材继承委托类型
|
||||
if (entrustmentType == 0) {
|
||||
identificationMaterial.setTypeName("常规毒品");
|
||||
} else if (entrustmentType == 1) {
|
||||
identificationMaterial.setTypeName("生物样本");
|
||||
}
|
||||
// identificationMaterial.setTypeName(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType()));
|
||||
identificationMaterial.setFormName(identificationMaterial.getForm());
|
||||
//设置序号,这里我们按先后顺序,给插入的检材排一个序号
|
||||
identificationMaterial.setOrderNo(getWtOrderNo(identificationMaterial.getEntrustmentId()));
|
||||
//如果传来了样本1的质量,我们要将它赋给Sample1Quantity
|
||||
if (identificationMaterial.getSample1Quantity() == null) {
|
||||
identificationMaterial.setSample1Quantity(identificationMaterial.getProvidedSample1Quantity());
|
||||
}
|
||||
//保存采样人
|
||||
saveCollectors(identificationMaterial, dlpUser);
|
||||
|
||||
List<EntrustmentIdentificationMaterial> list = this.list(new LambdaQueryWrapper<EntrustmentIdentificationMaterial>().eq(EntrustmentIdentificationMaterial::getProvidedSample1No, identificationMaterial.getProvidedSample1No()));
|
||||
//如果在创建检材这
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No()) || (list != null && list.size() > 0)) {
|
||||
identificationMaterial.setProvidedSample1No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 1));
|
||||
}
|
||||
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) {
|
||||
//如果委托单位分样了
|
||||
//如果委托单位分样了
|
||||
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) {
|
||||
identificationMaterial.setProvidedSample2No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 2));
|
||||
}
|
||||
//受理的时候应该有2个样
|
||||
identificationMaterial = settingAcceptSampleInfoDivide(identificationMaterial);
|
||||
//如果分样了,并且传入了样本2的值,那么我们将这个值要赋给sample2Quantity,以便受理的时候使用
|
||||
if (identificationMaterial.getProvidedSample2Quantity() != null) {
|
||||
identificationMaterial.setSample2Quantity(identificationMaterial.getProvidedSample2Quantity());
|
||||
}
|
||||
} else {
|
||||
//委托单位没分样
|
||||
identificationMaterial = settingAcceptSampleInfoNoDivide(identificationMaterial);
|
||||
}
|
||||
//默认肯定有一个是分析样是永远存在的,添加的时候,先将这个样本生成出来,所以受理时候的分样信息有一个是存在的,同理如果送检时候的分样信息,也是默认有一个存在的,这个在分样的时候,通过接口调用产生
|
||||
//这里判断委托单位是否分样
|
||||
//identificationMaterial.setSample1No(sampleService.getNewSampleNo(identificationMaterial.getImNo(),1));
|
||||
|
||||
identificationMaterial.setCreateBy(dlpUser.getId());
|
||||
identificationMaterial.setCreateTime(LocalDateTime.now());
|
||||
identificationMaterial.setAcceptNo(null);
|
||||
identificationMaterial.setSample1RepeatWeigh(null);
|
||||
identificationMaterial.setSample2RepeatWeigh(null);
|
||||
identificationMaterial.setColor("");
|
||||
|
||||
|
||||
//判断检材的重量不能大于物证的重量 暂不判断,因为可能单位不统一
|
||||
if (this.save(identificationMaterial)) {
|
||||
// 新增检材记录成功
|
||||
try {
|
||||
if (copyAttachemnts) {
|
||||
List<String> fileList = ossFile.fileList(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId());
|
||||
for (String fileName : fileList) {
|
||||
String srcFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId() + "/" + fileName;
|
||||
String destFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getEntrustmentId() + "/" + identificationMaterial.getId() + "/" + fileName;
|
||||
ossFile.fileCopy(srcFileName, destFileName);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(String.format("复制物证附件到新建的检材附件目录出错: %s", e.getMessage()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(String.format("复制物证附件到新建的检材附件目录出错: %s", e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1598,12 +1618,14 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//用作于处理一些打印委托书或鉴定事项确认书时的字段类型转换
|
||||
|
||||
@Override
|
||||
public void conformityDrugs(List<EntrustmentIdentificationMaterial> list) {
|
||||
if (list != null && list.size() > 0) {
|
||||
for (EntrustmentIdentificationMaterial material : list) {
|
||||
Integer analysisOption = material.getAnalysisOption();
|
||||
material.setQuantity(material.getQuantity().setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
switch (analysisOption) {
|
||||
case 1:
|
||||
material.setAnalysisOptionValue("定性分析");
|
||||
@@ -1622,14 +1644,15 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
break;
|
||||
|
||||
}
|
||||
material.setPrintExtractionTime(LocalDateTimeUtil.format(material.getExtractionTime(), "yyyy-MM-dd"));
|
||||
material.setPrintDrawTime(LocalDateTimeUtil.format(material.getDrawTime(), "yyyy-MM-dd"));
|
||||
List<DrugLite> candidateDrugs = material.getCandidateDrugs();
|
||||
String drugsValue = "";
|
||||
if (candidateDrugs == null || candidateDrugs.size() == 0) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < candidateDrugs.size(); i++) {
|
||||
DrugLite drugLite = candidateDrugs.get(i);
|
||||
String toJSONString = JSONObject.toJSONString(candidateDrugs.get(i));
|
||||
DrugLite drugLite = JSONObject.parseObject(toJSONString, DrugLite.class);
|
||||
if (i == 0) {
|
||||
drugsValue = drugLite.getName();
|
||||
} else {
|
||||
@@ -1640,5 +1663,4 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.security.Principal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -277,7 +278,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
if (StringUtils.isNotBlank(maxAcceptNo)) {
|
||||
//判断跨年的情况,如果跨年肯定现在年份和之前年份不一样,如果是新的一年编号应该从新编号
|
||||
String seqNo = maxAcceptNo.substring(maxAcceptNo.lastIndexOf("-") + 1);
|
||||
int newCount = Integer.valueOf(seqNo) + 1;
|
||||
int newCount = Integer.parseInt(seqNo) + 1;
|
||||
// String second_part = "";
|
||||
// second_part = fillByZero(newCount);
|
||||
newAcceptNo = first_part + splitSymbol + newCount;
|
||||
@@ -672,8 +673,10 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
eg.setFormName(StringUtils.isNotBlank(item.getColor()) ? item.getColor() + item.getFormName() : "" + item.getFormName());
|
||||
eg.setSpecies(item.getTypeName());
|
||||
eg.setPack(item.getPack());
|
||||
eg.setDrugsValue(item.getDrugsValue());
|
||||
eg.setRtSampleQuantity(item.getRtSampleQuantity());
|
||||
eg.setRemark(item.getRemark());
|
||||
BigDecimal totalSampleMass = new BigDecimal(0);
|
||||
|
||||
//因为现在有的检材可以不用复称,例如送来的一支电子烟,所以我们用送检的数量与单位进行描述即可
|
||||
if (item.getSample1RepeatWeigh() == null || item.getSample1RepeatWeigh().compareTo(BigDecimal.ZERO) == 0) {
|
||||
eg.setAnalysisSampleDes(item.getSample1Quantity() + item.getUnit());
|
||||
@@ -684,11 +687,11 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
} else {
|
||||
eg.setRetainedSampleDes(new BigDecimal(0) + item.getUnit());
|
||||
}
|
||||
eg.setTotalSampleDes(totalSampleMass + item.getUnit());
|
||||
eg.setTotalSampleDes(totalSampleMass.setScale(2, BigDecimal.ROUND_HALF_UP) + item.getUnit());
|
||||
} else {
|
||||
eg.setAnalysisSampleDes(item.getSample1RepeatWeigh() + "克");
|
||||
eg.setRetainedSampleDes(item.getSample2RepeatWeigh() + "克");
|
||||
eg.setTotalSampleDes((item.getSample1RepeatWeigh() == null ? new BigDecimal(0) : item.getSample1RepeatWeigh()).add(item.getSample2RepeatWeigh() == null ? new BigDecimal(0) : item.getSample2RepeatWeigh()) + "克");
|
||||
eg.setTotalSampleDes((item.getSample1RepeatWeigh() == null ? new BigDecimal(0) : item.getSample1RepeatWeigh()).add(item.getSample2RepeatWeigh() == null ? new BigDecimal(0) : item.getSample2RepeatWeigh()).setScale(2, BigDecimal.ROUND_HALF_UP) + "克");
|
||||
}
|
||||
materialListForBookVoList.add(eg);
|
||||
});
|
||||
@@ -1394,6 +1397,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>query()
|
||||
.eq("entrustment_id", entrustment.getId())
|
||||
.orderByAsc("create_time"));
|
||||
if (materialList == null || materialList.size() == 0) {
|
||||
throw new RuntimeException("请至少添加一个检材后再提交!");
|
||||
}
|
||||
entrustment.setEntrustRequirement(this.buildEntrustReq(materialList));
|
||||
this.updateById(entrustment);
|
||||
result = entrustment;
|
||||
@@ -2131,7 +2137,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bizGetPDFEntrustmentLetter(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
|
||||
public String bizGetPDFEntrustmentLetter(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
|
||||
|
||||
System.out.println("bizGenerateEntrustmentWord.................");
|
||||
Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||
@@ -2140,17 +2146,20 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
EntrustmentVO ev = getEntrustmentVOAndVaildData(id, dlpUser);
|
||||
String entrustmentLetterFileName = "鉴定委托书" + "-" + ev.getEntrustmentNo();
|
||||
// 转换临时目录中的 word 文档为 PDF
|
||||
String pdfFilePath = OSSDirectoryConstants.DOCUMENT_ENTRUSTMENT_DIRECTORY + "/" + ev.getId() + "/" + entrustmentLetterFileName + ".pdf";
|
||||
String pdfFilePath = OSSDirectoryConstants.DOCUMENT_ENTRUSTMENT_DIRECTORY + "/" + ev.getId() + "/" + entrustmentLetterFileName + ".docx";
|
||||
try {
|
||||
if (!ossFile.objectExist(pdfFilePath)) {
|
||||
GenerateEntrustmentLetterPDF(ev);
|
||||
return pdfFilePath;
|
||||
}
|
||||
ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream());
|
||||
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(entrustmentLetterFileName));
|
||||
return pdfFilePath;
|
||||
// ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream());
|
||||
// httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(entrustmentLetterFileName));
|
||||
} catch (Exception e) {
|
||||
System.out.println(String.format("minioFile objectExist() Exception. %s", e.getLocalizedMessage()));
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2203,9 +2212,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
throw new RuntimeException("保存委托日期失败");
|
||||
}
|
||||
}
|
||||
String oldIdentificationBrief = ev.getOldIdentificationBrief();
|
||||
String oldIdentificationResult = ev.getOldIdentificationResult();
|
||||
String oldIdentification = "";
|
||||
switch (oldIdentificationBrief) {
|
||||
switch (oldIdentificationResult) {
|
||||
case "首次鉴定":
|
||||
oldIdentification = "☑首次鉴定;□补充鉴定;□重新鉴定";
|
||||
break;
|
||||
@@ -2278,23 +2287,21 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
|
||||
//------------
|
||||
ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray());
|
||||
fosWord.close();
|
||||
|
||||
|
||||
//MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord);
|
||||
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "image/jpg", fisWord);
|
||||
Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
|
||||
// MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "image/jpg", fisWord);
|
||||
//// Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
|
||||
//// fisWord.close();
|
||||
// ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
|
||||
//// IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_BUFFER_SIZE);
|
||||
// ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
|
||||
// outPDF.close();
|
||||
|
||||
boolean fileSave = ossFile.fileSave(OSSDirectoryConstants.DOCUMENT_ENTRUSTMENT_DIRECTORY + "/" + ev.getId() + "/" + entrustmentLetterFileName + ".docx", fisWord);
|
||||
fosWord.close();
|
||||
fisWord.close();
|
||||
|
||||
|
||||
ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
|
||||
IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_BUFFER_SIZE);
|
||||
ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
|
||||
outPDF.close();
|
||||
|
||||
boolean fileSave = ossFile.fileSave(OSSDirectoryConstants.DOCUMENT_ENTRUSTMENT_DIRECTORY + "/" + ev.getId() + "/" + entrustmentLetterFileName + ".pdf", isPDF);
|
||||
isPDF.close();
|
||||
|
||||
System.out.println(String.format("转换为 PDF 结束"));
|
||||
System.out.println(String.format("转换为 Word 结束"));
|
||||
return fileSave;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,4 +22,8 @@ public class MaterialListForBookVo {
|
||||
private String totalSampleDes;//总计描述
|
||||
private String species;//种类
|
||||
private String pack;//包装
|
||||
|
||||
private String drugsValue;//疑似物种类
|
||||
private Integer rtSampleQuantity;//留存样个数
|
||||
private String remark;//备注
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ spring:
|
||||
|
||||
# 文件上传相关 支持阿里云、华为云、腾讯、minio
|
||||
oss:
|
||||
endpoint: http://127.0.0.1:9000
|
||||
endpoint: dlp-minio:9000
|
||||
accessKey: admin
|
||||
secretKey: 87990016
|
||||
bucket-name: dlpfiles
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
WHERE entrustment_no LIKE concat(#{prefix}, '%')
|
||||
</select>
|
||||
<select id="getMaxEntrustAcceptNo" parameterType="String" resultType="java.lang.String">
|
||||
SELECT MAX(accept_no) AS maxno
|
||||
SELECT MAX(CAST(SUBSTRING(accept_no, 6) AS UNSIGNED)) AS maxno
|
||||
FROM b_entrustment
|
||||
WHERE accept_no LIKE concat(#{prefix}, '%')
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user