|
|
|
@ -42,158 +42,162 @@ import java.util.List; |
|
|
|
|
* |
|
|
|
|
* @author Zhang Xiaolong created at 2023-03-10 |
|
|
|
|
* @describe (标准储备溶液配制及使用记录表) 前端控制器 |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 |
|
|
|
|
* 这里写什么: |
|
|
|
|
* 为前端提供数据, 接受前端的数据 |
|
|
|
|
* 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 |
|
|
|
|
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 |
|
|
|
|
* 为前端提供数据, 接受前端的数据 |
|
|
|
|
* 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 |
|
|
|
|
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 |
|
|
|
|
* 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 |
|
|
|
|
*/ |
|
|
|
|
@RestController |
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@RequestMapping("/standard_reserve_solution" ) |
|
|
|
|
@RequestMapping("/standard_reserve_solution") |
|
|
|
|
@Api(value = "standard_reserve_solution", tags = "(标准储备溶液配制及使用记录表)管理") |
|
|
|
|
public class StandardReserveSolutionController { |
|
|
|
|
|
|
|
|
|
private final StandardReserveSolutionService standardReserveSolutionService; |
|
|
|
|
|
|
|
|
|
private final OssFile ossFile; |
|
|
|
|
private final StandardReserveSolutionService standardReserveSolutionService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id查询(标准储备溶液配制及使用记录表) |
|
|
|
|
* @param id id |
|
|
|
|
* @return R |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
|
|
|
|
@GetMapping( ) |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_get')" ) |
|
|
|
|
public R<StandardReserveSolutionVO> getById(String id, HttpServletRequest theHttpServletRequest) { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
private final OssFile ossFile; |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id); |
|
|
|
|
return R.ok(standardReserveSolutionVOById); |
|
|
|
|
//return R.ok(standardReserveSolutionService.getById(standardReserveSolutionId));
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 通过id查询(标准储备溶液配制及使用记录表) |
|
|
|
|
* |
|
|
|
|
* @param id id |
|
|
|
|
* @return R |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
|
|
|
|
@GetMapping() |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_get')") |
|
|
|
|
public R<StandardReserveSolutionVO> getById(String id, HttpServletRequest theHttpServletRequest) { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id); |
|
|
|
|
return R.ok(standardReserveSolutionVOById); |
|
|
|
|
//return R.ok(standardReserveSolutionService.getById(standardReserveSolutionId));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* 分页查询 |
|
|
|
|
* @param page 分页对象 |
|
|
|
|
* |
|
|
|
|
* @param page 分页对象 |
|
|
|
|
* @param solutionName (标准储备溶液配制及使用记录表) |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
|
|
|
|
@GetMapping("/page" ) |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_page')" ) |
|
|
|
|
public R<IPage<StandardReserveSolutionVO>> getStandardReserveSolutionPage(Page<StandardReserveSolution> page, String solutionName, @DateTimeFormat(pattern = "yyyy-MM-dd")@JsonFormat(pattern = "yyyy-MM-dd") DateTime startTime, @DateTimeFormat(pattern = "yyyy-MM-dd")@JsonFormat(pattern = "yyyy-MM-dd") DateTime endTime , HttpServletRequest theHttpServletRequest) throws ParseException { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
IPage<StandardReserveSolutionVO> standardReserveSolutionSList = standardReserveSolutionService.getStandardReserveSolutionVOList(page,Wrappers.<StandardReserveSolution>query() |
|
|
|
|
.like(StrUtil.isNotBlank(solutionName),"solution_name",solutionName) |
|
|
|
|
.ge(startTime!=null,"create_time",startTime) |
|
|
|
|
.le(endTime!=null,"create_time",endTime) |
|
|
|
|
.orderByDesc("create_time")); |
|
|
|
|
return R.ok(standardReserveSolutionSList); |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_page')") |
|
|
|
|
public R<IPage<StandardReserveSolutionVO>> getStandardReserveSolutionPage(Page<StandardReserveSolution> page, String solutionName, @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") DateTime startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") DateTime endTime, HttpServletRequest theHttpServletRequest) throws ParseException { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
IPage<StandardReserveSolutionVO> standardReserveSolutionSList = standardReserveSolutionService.getStandardReserveSolutionVOList(page, Wrappers.<StandardReserveSolution>query() |
|
|
|
|
.like(StrUtil.isNotBlank(solutionName), "solution_name", solutionName) |
|
|
|
|
.ge(startTime != null, "create_time", startTime) |
|
|
|
|
.le(endTime != null, "create_time", endTime) |
|
|
|
|
.orderByDesc("create_time")); |
|
|
|
|
return R.ok(standardReserveSolutionSList); |
|
|
|
|
// return R.ok(standardReserveSolutionService.page(page, Wrappers.query(standardReserveSolution)));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新增(标准储备溶液配制及使用记录表) |
|
|
|
|
* |
|
|
|
|
* @param standardReserveSolutionDTO (标准储备溶液配制及使用记录表) |
|
|
|
|
* @return R |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "新增(标准储备溶液配制及使用记录表)", notes = "新增(标准储备溶液配制及使用记录表)") |
|
|
|
|
@SysLog("新增(标准储备溶液配制及使用记录表)" ) |
|
|
|
|
@SysLog("新增(标准储备溶液配制及使用记录表)") |
|
|
|
|
@PostMapping |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_add')" ) |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_add')") |
|
|
|
|
public R<StandardReserveSolutionVO> postAddObject(@RequestBody StandardReserveSolutionDTO standardReserveSolutionDTO, HttpServletRequest theHttpServletRequest) { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionVO standardReserveSolutionVO = standardReserveSolutionService.addById(standardReserveSolutionDTO, dlpUser); |
|
|
|
|
|
|
|
|
|
if (standardReserveSolutionVO!=null){ |
|
|
|
|
return R.ok(standardReserveSolutionVO,"配置成功"); |
|
|
|
|
}else return R.failed("配置失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新增(标准储备溶液配制及使用记录表) |
|
|
|
|
* @return R |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "入库(标准储备溶液配制及使用记录表)", notes = "入库(标准储备溶液配制及使用记录表)") |
|
|
|
|
@SysLog("入库(标准储备溶液配制及使用记录表)" ) |
|
|
|
|
@PostMapping("warehousing") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_warehousing')" ) |
|
|
|
|
public R<StandardReserveSolutionFullVO> warehousingById(@RequestBody StandardReserveSolutionFullDTO standardReserveSolutionFullDTO, HttpServletRequest theHttpServletRequest) { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionFullVO standardReserveSolutionFullVO = standardReserveSolutionService.warehousingById(standardReserveSolutionFullDTO); |
|
|
|
|
|
|
|
|
|
if (standardReserveSolutionFullVO!=null){ |
|
|
|
|
return R.ok(standardReserveSolutionFullVO,"入库成功"); |
|
|
|
|
}else return R.failed("入库失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id查询(标准储备溶液配制及使用记录表) |
|
|
|
|
* @param id id |
|
|
|
|
* @return R |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "通过id查询标准储备溶液入库记录", notes = "通过id查询标准储备溶液入库记录") |
|
|
|
|
@GetMapping( "/full") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_full')" ) |
|
|
|
|
public R<StandardReserveSolutionVO> getFullVOById(String id, HttpServletRequest theHttpServletRequest) { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionFullVO byFullVOId = standardReserveSolutionService.getByFullVOId(id); |
|
|
|
|
|
|
|
|
|
return R.ok(byFullVOId); |
|
|
|
|
//return R.ok(standardReserveSolutionService.getById(standardReserveSolutionId));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**-------标准储备溶液配制及使用记录表打印*/ |
|
|
|
|
/** |
|
|
|
|
* 标准储备溶液配制及使用记录表打印 |
|
|
|
|
* |
|
|
|
|
* @param id |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "标准储备溶液配制及使用记录表打印", notes = "标准储备溶液配制及使用记录表打印") |
|
|
|
|
@SysLog("标准储备溶液配制及使用记录表打印") |
|
|
|
|
@PostMapping("/print") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_print')") |
|
|
|
|
public void bizGetPDFInventory(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) { |
|
|
|
|
System.out.println("bizApplyWord................."); |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id); |
|
|
|
|
|
|
|
|
|
List<SolutionUseFormVO> voList = standardReserveSolutionVOById.getSolutionUseFormVOList(); |
|
|
|
|
|
|
|
|
|
if (voList.isEmpty()){ |
|
|
|
|
|
|
|
|
|
throw new RuntimeException(String.format("未查询到使用记录,无法打印")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String applyFileName = "标准储备溶液配制及使用记录表-"+id; |
|
|
|
|
|
|
|
|
|
String pdfFilePath = "document" + "/"+"standardReserveSolution" + "/" + id + "/" + applyFileName + ".pdf"; |
|
|
|
|
try { |
|
|
|
|
//直接调用pdf方法
|
|
|
|
|
standardReserveSolutionService.standardReserveSolutionTablePDF(standardReserveSolutionVOById,theHttpServletRequest,httpServletResponse); |
|
|
|
|
ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream()); |
|
|
|
|
httpServletResponse.setContentType(applyFileName); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
System.out.println(String.format("minioFile objectExist() Exception. %s", e.getLocalizedMessage())); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionVO standardReserveSolutionVO = standardReserveSolutionService.addById(standardReserveSolutionDTO, dlpUser); |
|
|
|
|
|
|
|
|
|
if (standardReserveSolutionVO != null) { |
|
|
|
|
return R.ok(standardReserveSolutionVO, "配置成功"); |
|
|
|
|
} else return R.failed("配置失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新增(标准储备溶液配制及使用记录表) |
|
|
|
|
* |
|
|
|
|
* @return R |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "入库(标准储备溶液配制及使用记录表)", notes = "入库(标准储备溶液配制及使用记录表)") |
|
|
|
|
@SysLog("入库(标准储备溶液配制及使用记录表)") |
|
|
|
|
@PostMapping("warehousing") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_warehousing')") |
|
|
|
|
public R<StandardReserveSolutionFullVO> warehousingById(@RequestBody StandardReserveSolutionFullDTO standardReserveSolutionFullDTO, HttpServletRequest theHttpServletRequest) { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionFullVO standardReserveSolutionFullVO = standardReserveSolutionService.warehousingById(standardReserveSolutionFullDTO); |
|
|
|
|
|
|
|
|
|
if (standardReserveSolutionFullVO != null) { |
|
|
|
|
return R.ok(standardReserveSolutionFullVO, "入库成功"); |
|
|
|
|
} else return R.failed("入库失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id查询(标准储备溶液配制及使用记录表) |
|
|
|
|
* |
|
|
|
|
* @param id id |
|
|
|
|
* @return R |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "通过id查询标准储备溶液入库记录", notes = "通过id查询标准储备溶液入库记录") |
|
|
|
|
@GetMapping("/full") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_full')") |
|
|
|
|
public R<StandardReserveSolutionVO> getFullVOById(String id, HttpServletRequest theHttpServletRequest) { |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionFullVO byFullVOId = standardReserveSolutionService.getByFullVOId(id); |
|
|
|
|
|
|
|
|
|
return R.ok(byFullVOId); |
|
|
|
|
//return R.ok(standardReserveSolutionService.getById(standardReserveSolutionId));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**-------标准储备溶液配制及使用记录表打印*/ |
|
|
|
|
/** |
|
|
|
|
* 标准储备溶液配制及使用记录表打印 |
|
|
|
|
* |
|
|
|
|
* @param id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation(value = "标准储备溶液配制及使用记录表打印", notes = "标准储备溶液配制及使用记录表打印") |
|
|
|
|
@SysLog("标准储备溶液配制及使用记录表打印") |
|
|
|
|
@PostMapping("/print") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('reagent_standard_reserve_solution_print')") |
|
|
|
|
public void bizGetPDFInventory(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) { |
|
|
|
|
System.out.println("bizApplyWord................."); |
|
|
|
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
|
|
|
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id); |
|
|
|
|
|
|
|
|
|
List<SolutionUseFormVO> voList = standardReserveSolutionVOById.getSolutionUseFormVOList(); |
|
|
|
|
|
|
|
|
|
if (voList.isEmpty()) { |
|
|
|
|
|
|
|
|
|
throw new RuntimeException(String.format("未查询到使用记录,无法打印")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String applyFileName = "标准储备溶液配制及使用记录表-" + id; |
|
|
|
|
|
|
|
|
|
String pdfFilePath = "document" + "/" + "standardReserveSolution" + "/" + id + "/" + applyFileName + ".pdf"; |
|
|
|
|
try { |
|
|
|
|
//直接调用pdf方法
|
|
|
|
|
standardReserveSolutionService.standardReserveSolutionTablePDF(standardReserveSolutionVOById, theHttpServletRequest, httpServletResponse); |
|
|
|
|
ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream()); |
|
|
|
|
httpServletResponse.setContentType(applyFileName); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
System.out.println(String.format("minioFile objectExist() Exception. %s", e.getLocalizedMessage())); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|