parent
b6494cccb9
commit
6c2189db65
@ -0,0 +1,50 @@ |
||||
package digital.laboratory.platform.imr.controller; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import digital.laboratory.platform.common.core.util.R; |
||||
import digital.laboratory.platform.imr.query.DrugHandingOverApplyQuery; |
||||
import digital.laboratory.platform.imr.service.DrugHandingOverApplyService; |
||||
import digital.laboratory.platform.imr.vo.DrugHandingOverApplyVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@RestController |
||||
@RequestMapping("/handingOverApply") |
||||
@Api(value = "DrugHandingOverApplyController", tags = "毒品送样申请相关接口") |
||||
public class DrugHandingOverApplyController { |
||||
|
||||
@Resource |
||||
private DrugHandingOverApplyService drugHandingOverApplyService; |
||||
|
||||
@ApiOperation("创建毒品送缴申请-委托单位操作") |
||||
@PostMapping("/save") |
||||
public R save() { |
||||
DrugHandingOverApplyVO vo = drugHandingOverApplyService.create(); |
||||
if (vo == null) { |
||||
return R.failed("保存数据失败!"); |
||||
} |
||||
return R.ok(vo); |
||||
} |
||||
|
||||
@ApiOperation("创建毒品送缴申请-委托单位操作") |
||||
@PostMapping("/page") |
||||
public R page(@RequestBody DrugHandingOverApplyQuery query) { |
||||
IPage<DrugHandingOverApplyVO> voiPage = drugHandingOverApplyService.voPage(query); |
||||
return R.ok(voiPage); |
||||
} |
||||
|
||||
@ApiOperation("删除毒品送缴申请-委托单位操作") |
||||
@PostMapping("/delete") |
||||
public R delete(@RequestBody List<String> ids) { |
||||
boolean success = drugHandingOverApplyService.delete(ids); |
||||
return R.ok(success); |
||||
} |
||||
} |
@ -1,274 +0,0 @@ |
||||
package digital.laboratory.platform.imr.controller; |
||||
|
||||
import cn.hutool.core.io.file.FileNameUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import digital.laboratory.platform.common.core.util.R; |
||||
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||
import digital.laboratory.platform.imr.dto.QueryStorageDTO; |
||||
import digital.laboratory.platform.imr.entity.StorageCell; |
||||
import digital.laboratory.platform.imr.entity.StorageCupboard; |
||||
import digital.laboratory.platform.imr.mapper.StorageCellMapper; |
||||
import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; |
||||
import digital.laboratory.platform.imr.service.StorageCellService; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import javax.activation.MimetypesFileTypeMap; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.security.Principal; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import digital.laboratory.platform.common.oss.service.OssFile; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 前端控制器 |
||||
* |
||||
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 |
||||
* 这里写什么: |
||||
* 为前端提供数据, 接受前端的数据 |
||||
* 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 |
||||
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 |
||||
* 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 |
||||
*/ |
||||
@RestController |
||||
@RequiredArgsConstructor |
||||
@RequestMapping("/storage_cell" ) |
||||
@Api(value = "storage_cell", tags = "存储柜子对应格子管理") |
||||
public class StorageCellController { |
||||
|
||||
private final StorageCellService storageCellService; |
||||
|
||||
|
||||
private final StorageCellMapper cellMapper; |
||||
|
||||
private final StorageCupboardMapper cupboardMapper; |
||||
|
||||
|
||||
private final OssFile ossFile; |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* @param id id |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||
@GetMapping("/{id}" ) |
||||
@PreAuthorize("@pms.hasPermission('imr_storage_cell_get')" ) |
||||
public R<StorageCell> getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
StorageCell storageCell = storageCellService.getById(id); |
||||
return R.ok(storageCell); |
||||
//return R.ok(storageCellService.getById(id));
|
||||
} |
||||
|
||||
/** |
||||
* 上传图片 |
||||
* @param cellId |
||||
* @param file |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
|
||||
|
||||
@ApiOperation(value = "上传格子图片", notes = "上传格子图片") |
||||
@PostMapping(value = " /{cellId}") |
||||
//@PreAuthorize("@pms.hasPermission('roomUpload')")
|
||||
public R uploadAttachmentObj(@PathVariable("cellId") String cellId, @RequestPart("file") MultipartFile file) throws Exception { |
||||
|
||||
StorageCell storageCell = cellMapper.selectById(cellId); |
||||
if (storageCell != null) { |
||||
|
||||
String path = "cell" + "/" + cellId; |
||||
String fileName = FileNameUtil.getName(file.getOriginalFilename()); |
||||
boolean r = ossFile.fileUpload(file, path); |
||||
Map<String, String> ResultData = new HashMap<>(); |
||||
ResultData.put("fileName", fileName); |
||||
ResultData.put("path", path); |
||||
|
||||
if (r) { |
||||
//修改数据库
|
||||
storageCell.setCellPhoto(path); |
||||
storageCell.setFileName(fileName); |
||||
cellMapper.updateById(storageCell); |
||||
return R.ok(ResultData, "上传成功"); |
||||
} |
||||
return R.failed("上传失败"); |
||||
} |
||||
return R.failed(null, "这个格子不存在"); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*HairSample hs = hairSampleService.getById(hairSampleId); |
||||
if (hs != null) { |
||||
try { |
||||
// 获取样品所属的任务信息
|
||||
HairJob hairJob = hairJobService.getById(hs.getJobId()); |
||||
if (hairJob == null) { |
||||
throw new RuntimeException(String.format("任务id为 %s 的任务不存在", hs.getJobId())); |
||||
} |
||||
String rootId; |
||||
// 获取根任务id
|
||||
if (hairJob.getRootTaskId().equals("0")) { |
||||
rootId = hairJob.getId(); |
||||
} else { |
||||
rootId = hairJob.getRootTaskId(); |
||||
} |
||||
ossFile.fileGet("hair_job" + "/" + rootId + "/" + hairSampleId + "/" + fileName, httpServletResponse.getOutputStream()); |
||||
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(hs.getPicture())); |
||||
} catch (AmazonS3Exception s3e) { |
||||
httpServletResponse.sendError(s3e.getStatusCode(), s3e.toString()); |
||||
} catch (Exception e) { |
||||
httpServletResponse.sendError(501, e.toString()); |
||||
} |
||||
} |
||||
else { |
||||
httpServletResponse.sendError(404, "不存在这个毛发样品"); |
||||
}*/ |
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "柜子列表查询接口--存储管理", notes = "柜子列表查询接口--存储管理") |
||||
@GetMapping("/cell/list" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public R<IPage<StorageCell>> getStorageRoomPage(QueryStorageDTO dto){ |
||||
|
||||
|
||||
Page<StorageCell> page = new Page<>(); |
||||
|
||||
IPage<StorageCell> storageList = cellMapper.getStorageCellPage(page,Wrappers.<StorageCell>query() |
||||
.eq(!dto.getId().isEmpty(),"id",dto.getId()) |
||||
.orderByDesc("create_time") |
||||
); |
||||
return R.ok(storageList,"查询成功"); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* |
||||
* @param dto |
||||
* @return |
||||
*/ |
||||
@ApiOperation(value = "格子分页查询--入库模块使用", notes = "格子分页查询--入库模块使用") |
||||
@GetMapping("/page" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public R<IPage<StorageCell>> getStorageRoomList(QueryStorageDTO dto) { |
||||
|
||||
Page<StorageCell> page = new Page<>(dto.getCurrent(),dto.getSize()); |
||||
|
||||
IPage<StorageCell> storage = cellMapper.getStorageCellPage(page,Wrappers.<StorageCell>query() |
||||
.eq("cupboard_id",dto.getId()) |
||||
.orderByDesc("sort") |
||||
); |
||||
return R.ok(storage,"查询成功"); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "通过格子id删除图片", notes = "通过格子id删除图片") |
||||
@SysLog("通过id删除" ) |
||||
@DeleteMapping("/deletePicture/{cellId}" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_cell_del')" )
|
||||
public R deleteById(@PathVariable("cellId") String cellId) throws Exception { |
||||
|
||||
|
||||
StorageCell storageCell = cellMapper.selectById(cellId); |
||||
if(storageCell==null){ |
||||
throw new RuntimeException(String.format("当前格子数据不存在")); |
||||
} |
||||
if(storageCell.getCellPhoto()!=null && storageCell.getFileName()!=null ){ |
||||
//删除图片
|
||||
ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName()); |
||||
storageCell.setCellPhoto(""); |
||||
storageCell.setFileName(""); |
||||
cellMapper.updateById(storageCell); |
||||
} |
||||
return R.ok("删除成功"); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "批量删除格子", notes = "批量删除格子") |
||||
@SysLog("通过id删除" ) |
||||
@DeleteMapping("/deleteCell" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_cell_del')" )
|
||||
public R deleteById(@RequestBody List<String> cellIds) throws Exception { |
||||
|
||||
List<StorageCell> storageCells = cellMapper.selectBatchIds(cellIds); |
||||
|
||||
for (StorageCell storageCell : storageCells) { |
||||
if(storageCell.getStatus()){ |
||||
throw new RuntimeException(String.format("编号为"+storageCell.getCellNo()+"的格子已存放东西")); |
||||
} |
||||
} |
||||
for (StorageCell storageCell : storageCells) { |
||||
|
||||
//删除数据库数据
|
||||
cellMapper.deleteById(storageCell.getId()); |
||||
if(storageCell.getCellPhoto()!=null && storageCell.getFileName()!=null ){ |
||||
//删除图片
|
||||
ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName()); |
||||
} |
||||
//更新对应格子的规格数据
|
||||
StorageCupboard storageCupboard = cupboardMapper.selectById(storageCell.getCupboardId()); |
||||
storageCupboard.setSpecifications(storageCupboard.getSpecifications()-1);//删除一个减-
|
||||
//获取对应格子数量
|
||||
/*QueryWrapper<StorageCell> wrapper = new QueryWrapper<>(); |
||||
wrapper.eq("cupboard_id",storageCell.getCupboardId()); |
||||
cellMapper.selectCount(wrapper);*/ |
||||
cupboardMapper.updateById(storageCupboard); |
||||
} |
||||
return R.ok("删除成功"); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 通过柜子id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}" |
||||
*/ |
||||
@ApiOperation(value = "通过格子id和文件名获取图片--存储管理", notes = "通过格子id和文件名获取图片--存储管理") |
||||
@GetMapping("/getCellPicture/{cellId}/{fileName}") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public void getRoomPicture (@PathVariable("cellId") String cellId, |
||||
@PathVariable("fileName") String fileName, |
||||
HttpServletResponse httpServletResponse) throws Exception { |
||||
StorageCell storageCell = storageCellService.getById(cellId); |
||||
if (storageCell == null) { |
||||
throw new RuntimeException(String.format("当前柜子数据不存在")); |
||||
} |
||||
ossFile.fileGet("cell" + "/" + storageCell.getId() + "/" + fileName, httpServletResponse.getOutputStream()); |
||||
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageCell.getFileName())); |
||||
} |
||||
|
||||
} |
@ -1,354 +0,0 @@ |
||||
package digital.laboratory.platform.imr.controller; |
||||
|
||||
import cn.hutool.core.io.file.FileNameUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import digital.laboratory.platform.common.core.util.R; |
||||
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||
import digital.laboratory.platform.imr.dto.QueryStorageDTO; |
||||
import digital.laboratory.platform.imr.entity.StorageCell; |
||||
import digital.laboratory.platform.imr.entity.StorageCupboard; |
||||
import digital.laboratory.platform.imr.entity.StorageRoom; |
||||
import digital.laboratory.platform.imr.mapper.StorageCellMapper; |
||||
import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; |
||||
import digital.laboratory.platform.imr.service.StorageCupboardService; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import javax.activation.MimetypesFileTypeMap; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.security.Principal; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
import digital.laboratory.platform.common.oss.service.OssFile; |
||||
|
||||
import static com.alibaba.fastjson.util.IOUtils.stringSize; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 前端控制器 |
||||
* |
||||
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 |
||||
* 这里写什么: |
||||
* 为前端提供数据, 接受前端的数据 |
||||
* 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 |
||||
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 |
||||
* 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 |
||||
*/ |
||||
@RestController |
||||
@RequiredArgsConstructor |
||||
@RequestMapping("/storage_cupboard" ) |
||||
@Api(value = "storage_cupboard", tags = "柜子管理") |
||||
public class StorageCupboardController { |
||||
|
||||
private final StorageCupboardService storageCupboardService; |
||||
|
||||
|
||||
private final StorageCupboardMapper cupboardMapper; |
||||
|
||||
|
||||
private final StorageCellMapper cellMapper; |
||||
|
||||
private final OssFile ossFile; |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* @param id id |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||
@GetMapping("/{id}" ) |
||||
@PreAuthorize("@pms.hasPermission('imr_storage_cupboard_get')" ) |
||||
public R<StorageCupboard> getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
StorageCupboard storageCupboard = storageCupboardService.getById(id); |
||||
return R.ok(storageCupboard); |
||||
//return R.ok(storageCupboardService.getById(id));
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "柜子列表查询接口--存储管理", notes = "柜子列表查询接口--存储管理") |
||||
@GetMapping("/cupboard/list" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public R<IPage<StorageCupboard>> getStorageRoomPage(QueryStorageDTO dto){ |
||||
|
||||
|
||||
Page<StorageCupboard> page = new Page<>(dto.getCurrent(),dto.getSize()); |
||||
|
||||
IPage<StorageCupboard> storageCupboardList = cupboardMapper.getStorageCupboardPage(page,Wrappers.<StorageCupboard>query() |
||||
.eq(!dto.getId().isEmpty(),"id",dto.getId()) |
||||
.orderByDesc("create_time") |
||||
); |
||||
return R.ok(storageCupboardList,"查询成功"); |
||||
} |
||||
|
||||
|
||||
|
||||
/* @ApiOperation(value = "修改--上传柜子图片", notes = "修改--上传柜子图片") |
||||
@PostMapping(value = "/uploadCupboard/{cupboardId}") |
||||
//@PreAuthorize("@pms.hasPermission('roomUpload')")
|
||||
public R uploadAttachmentObj(@PathVariable("cupboardId") String cupboardId, @RequestPart("file") MultipartFile file) throws Exception { |
||||
|
||||
StorageCupboard storageCupboard = cupboardMapper.selectById(cupboardId); |
||||
if (storageCupboard != null) { |
||||
|
||||
String path = "cupboard" + "/" + cupboardId; |
||||
String fileName = FileNameUtil.getName(file.getOriginalFilename()); |
||||
boolean r = ossFile.fileUpload(file, path); |
||||
Map<String, String> ResultData = new HashMap<>(); |
||||
ResultData.put("fileName", fileName); |
||||
ResultData.put("path", path); |
||||
|
||||
if (r) { |
||||
//修改数据库
|
||||
storageCupboard.setCupboardPhoto(path); |
||||
storageCupboard.setFileName(fileName); |
||||
cupboardMapper.updateById(storageCupboard); |
||||
return R.ok(ResultData, "上传成功"); |
||||
} |
||||
return R.failed("上传失败"); |
||||
} |
||||
return R.failed(null, "这个柜子不存在"); |
||||
}*/ |
||||
|
||||
|
||||
/** |
||||
* 新增 |
||||
* @param storageCupboard |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "添加存储柜--存储管理", notes = "添加存储柜--存储管理") |
||||
@SysLog("添加存储柜--存储管理" ) |
||||
@PostMapping("/createStorageCupboard") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_add')" )
|
||||
public R<StorageCupboard> postAddObject(StorageCupboard storageCupboard, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false) MultipartFile file)throws Exception { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
if (storageCupboard.getRoomId() == null) { |
||||
throw new RuntimeException(String.format("柜子必须关联格子")); |
||||
} |
||||
if (storageCupboard.getSpecifications() == null) { |
||||
throw new RuntimeException(String.format("柜子必须要填写规格")); |
||||
} |
||||
if (storageCupboard.getCupboardNo() == null) { |
||||
throw new RuntimeException(String.format("柜子编号不能为空")); |
||||
} |
||||
|
||||
storageCupboard.setId(IdWorker.get32UUID().toUpperCase()); |
||||
|
||||
if (file != null) { |
||||
String path = "cupboard" + "/" + storageCupboard.getId(); |
||||
String fileName = FileNameUtil.getName(file.getOriginalFilename()); |
||||
boolean r = ossFile.fileUpload(file, path); |
||||
if (r) { |
||||
storageCupboard.setCupboardPhoto(path); |
||||
storageCupboard.setFileName(fileName); |
||||
cupboardMapper.insert(storageCupboard); |
||||
//根据柜子规格创建格子
|
||||
for (Integer a = 1; a <= storageCupboard.getSpecifications(); a++) { |
||||
StorageCell storageCell = new StorageCell(); |
||||
storageCell.setId(IdWorker.get32UUID().toUpperCase()); |
||||
storageCell.setStatus(true);//默认未存入东西
|
||||
storageCell.setCupboardId(storageCupboard.getId()); |
||||
//取柜子的编号前几位
|
||||
String head = storageCupboard.getCupboardNo().substring(0, 3); |
||||
//制定格子编号生成规则
|
||||
String str = "CL"; |
||||
String number = getNumber(a); |
||||
storageCell.setCellNo(str + head + number); |
||||
cellMapper.insert(storageCell); |
||||
} |
||||
return R.ok(storageCupboard, "创建成功"); |
||||
} else { |
||||
//删除图片
|
||||
ossFile.fileDelete("cupboard" + "/" + storageCupboard.getId() + "/" + fileName); |
||||
return R.failed("创建失败"); |
||||
} |
||||
} else { |
||||
cupboardMapper.insert(storageCupboard); |
||||
return R.ok(storageCupboard, "创建成功"); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 修改 |
||||
* @param storageCupboard |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "修改--存储管理(数据修改+图片修改)", notes = "修改--存储管理") |
||||
@SysLog("修改") |
||||
@PutMapping("/updateCupboard") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_edit')" )
|
||||
public R<StorageCupboard> putUpdateById (StorageCupboard storageCupboard, HttpServletRequest |
||||
theHttpServletRequest, @RequestPart(value = "file", required = false) MultipartFile file)throws Exception { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
StorageCupboard cupboard = storageCupboardService.getById(storageCupboard.getId());//数据库数据
|
||||
|
||||
if(cupboard==null){ |
||||
throw new RuntimeException(String.format("当前修改数据不存在")); |
||||
} |
||||
|
||||
if ((int)storageCupboard.getSpecifications()!=(int)cupboard.getSpecifications()) { |
||||
throw new RuntimeException(String.format("不允许修改")); |
||||
} |
||||
|
||||
if (file != null) { |
||||
String path = "cupboard" + "/" + storageCupboard.getId(); |
||||
String fileName = FileNameUtil.getName(file.getOriginalFilename()); |
||||
boolean r = ossFile.fileUpload(file, path); |
||||
if (r) { |
||||
storageCupboard.setCupboardPhoto(path); |
||||
storageCupboard.setFileName(fileName); |
||||
cupboardMapper.updateById(storageCupboard); |
||||
return R.ok(storageCupboard, "修改成功"); |
||||
} else { |
||||
return R.failed("修改失败"); |
||||
} |
||||
} else { |
||||
if(cupboard.getCupboardPhoto()!=null && cupboard.getFileName()!=null) { |
||||
//删除图片
|
||||
ossFile.fileDelete("cupboard" + "/" + cupboard.getId() + "/" + cupboard.getFileName()); |
||||
} |
||||
storageCupboard.setFileName(null); |
||||
storageCupboard.setCupboardPhoto(null); |
||||
cupboardMapper.updateById(storageCupboard); |
||||
return R.ok(storageCupboard, "修改成功"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* @param id id |
||||
* @return R |
||||
**/ |
||||
@ApiOperation(value = "通过id删除柜子--存储管理", notes = "通过id删除柜子--存储管理") |
||||
@SysLog("通过id删除") |
||||
@DeleteMapping("deleteCupboard/{id}") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" )
|
||||
public R<StorageCupboard> deleteById (@PathVariable String id, HttpServletRequest theHttpServletRequest) throws |
||||
Exception { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
QueryWrapper<StorageCell> wrapper = new QueryWrapper<>(); |
||||
wrapper.eq("cupboard_id", id); |
||||
List<StorageCell> storageCells = cellMapper.selectList(wrapper); |
||||
for (StorageCell storageCell : storageCells) { |
||||
if (!storageCell.getStatus()) { |
||||
throw new RuntimeException(String.format("当前柜子中"+storageCell.getCellNo()+"格子还存有物品")); |
||||
} |
||||
} |
||||
//删除柜子
|
||||
StorageCupboard storageCupboard = storageCupboardService.getById(id); |
||||
if (storageCupboard.getCupboardPhoto() != null && storageCupboard.getFileName() != null) { |
||||
//删除图片
|
||||
ossFile.fileDelete("cupboard" + "/" + storageCupboard.getId() + "/" + storageCupboard.getFileName()); |
||||
} |
||||
|
||||
if (storageCupboardService.removeById(id)) { |
||||
|
||||
QueryWrapper<StorageCell> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("cupboard_id",id); |
||||
cellMapper.delete(queryWrapper);//删除格子
|
||||
//删除对应格子照片
|
||||
for (StorageCell storageCell : storageCells) { |
||||
if (storageCell.getCellPhoto() != null && storageCell.getFileName() != null) { |
||||
//删除图片
|
||||
ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName()); |
||||
} |
||||
} |
||||
return R.ok(storageCupboard, "对象删除成功"); |
||||
} else { |
||||
return R.failed(storageCupboard, "对象删除失败"); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 通过柜子id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}" |
||||
*/ |
||||
@ApiOperation(value = "通过柜子id和文件名获取图片--存储管理", notes = "通过柜子id和文件名获取图片--存储管理") |
||||
@GetMapping("/getCupboardPicture/{cupboardId}/{fileName}") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public void getRoomPicture (@PathVariable("cupboardId") String cupboardId, |
||||
@PathVariable("fileName") String fileName, |
||||
HttpServletResponse httpServletResponse) throws Exception { |
||||
StorageCupboard storageCupboard = storageCupboardService.getById(cupboardId); |
||||
if (storageCupboard == null) { |
||||
throw new RuntimeException(String.format("当前柜子数据不存在")); |
||||
} |
||||
ossFile.fileGet("cupboard" + "/" + storageCupboard.getId() + "/" + fileName, httpServletResponse.getOutputStream()); |
||||
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageCupboard.getFileName())); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* |
||||
* @param |
||||
* @return |
||||
**/ |
||||
@ApiOperation(value = "柜子列表查询--下拉框的", notes = "柜子列表查询--下拉框的") |
||||
@GetMapping("/list/{roomId}") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public R<List<StorageCupboard>> getStorageRoomList (@PathVariable("roomId") String roomId ){ |
||||
|
||||
List<StorageCupboard> storage = cupboardMapper.getStorageCupboardList(Wrappers.<StorageCupboard>query() |
||||
.eq("room_id", roomId) |
||||
.ne("status", 0)//排除不可用的柜子
|
||||
.orderByDesc("sort") |
||||
); |
||||
return R.ok(storage, "查询成功"); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
public static String getNumber(Integer a){ |
||||
String number = ""; |
||||
Integer i = stringSize(a); |
||||
if(i==1){ |
||||
number="000"+a.toString(); |
||||
}else if(i==2){ |
||||
number="00"+a.toString(); |
||||
}else if(i==3){ |
||||
number="0"+a.toString(); |
||||
} |
||||
|
||||
return number; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -1,309 +0,0 @@ |
||||
package digital.laboratory.platform.imr.controller; |
||||
|
||||
import cn.hutool.core.io.file.FileNameUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants; |
||||
import digital.laboratory.platform.common.core.util.R; |
||||
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||
import digital.laboratory.platform.imr.entity.StorageCupboard; |
||||
import digital.laboratory.platform.imr.entity.StorageRoom; |
||||
import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; |
||||
import digital.laboratory.platform.imr.mapper.StorageRoomMapper; |
||||
import digital.laboratory.platform.imr.service.StorageRoomService; |
||||
import digital.laboratory.platform.common.oss.service.OssFile; |
||||
import digital.laboratory.platform.common.core.*; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import javax.activation.MimetypesFileTypeMap; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.security.Principal; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 前端控制器 |
||||
* |
||||
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 |
||||
* 这里写什么: |
||||
* 为前端提供数据, 接受前端的数据 |
||||
* 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 |
||||
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 |
||||
* 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 |
||||
*/ |
||||
@RestController |
||||
@RequiredArgsConstructor |
||||
@RequestMapping("/storage_room" ) |
||||
@Api(value = "storage_room", tags = "房间管理") |
||||
public class StorageRoomController { |
||||
|
||||
|
||||
|
||||
private final StorageRoomMapper roomMapper; |
||||
|
||||
private final StorageRoomService storageRoomService; |
||||
|
||||
|
||||
|
||||
private final StorageCupboardMapper cupboardMapper; |
||||
|
||||
private final OssFile ossFile; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* @ApiOperation(value = "上传房间图片", notes = "上传房间图片") |
||||
@PostMapping(value = "/uploadRoom/{roomId}") |
||||
@PreAuthorize("@pms.hasPermission('roomUpload')") |
||||
public R uploadAttachmentObj(@PathVariable("roomId") String roomId, @RequestPart("file") MultipartFile file) throws Exception { |
||||
|
||||
StorageRoom storageRoom = roomMapper.selectById(roomId); |
||||
if (storageRoom != null) { |
||||
|
||||
String path = "room" + "/" + roomId; |
||||
String fileName = FileNameUtil.getName(file.getOriginalFilename()); |
||||
boolean r = ossFile.fileUpload(file, path); |
||||
Map<String, String> ResultData = new HashMap<>(); |
||||
ResultData.put("fileName", fileName); |
||||
ResultData.put("path", path); |
||||
|
||||
if (r) { |
||||
//修改数据库
|
||||
storageRoom.setRoomPhoto(path); |
||||
storageRoom.setFileName(fileName); |
||||
roomMapper.updateById(storageRoom); |
||||
return R.ok(ResultData, "上传成功"); |
||||
} |
||||
return R.failed("上传失败"); |
||||
} |
||||
return R.failed(null, "这个房间不存在"); |
||||
}*/ |
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* @param id id |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||
@GetMapping("/{id}" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public R<StorageRoom> getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
StorageRoom storageRoom = storageRoomService.getById(id); |
||||
return R.ok(storageRoom); |
||||
//return R.ok(storageRoomService.getById(id));
|
||||
} |
||||
|
||||
/** |
||||
* 分页查询 |
||||
* @param roomName |
||||
* @return |
||||
*/ |
||||
@ApiOperation(value = "存储室列表查询接口--存储管理", notes = "存储室列表查询接口--存储管理") |
||||
@GetMapping("/room/list" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public R<List<StorageRoom>> getStorageRoomPage(String roomName){ |
||||
|
||||
List<StorageRoom> storageRoomList = roomMapper.getStorageRoomPage(Wrappers.<StorageRoom>query() |
||||
.like(!roomName.isEmpty(),"name",roomName) |
||||
.orderByDesc("create_time") |
||||
); |
||||
return R.ok(storageRoomList,"查询成功"); |
||||
} |
||||
|
||||
/** |
||||
* 新增 |
||||
* @param storageRoom |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "添加存储室--存储管理(上传或不上传图片)", notes = "添加存储室--存储管理") |
||||
@SysLog("添加存储室" ) |
||||
@PostMapping("/createStorageRoom") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_add')" )
|
||||
public R<StorageRoom> postAddObject(StorageRoom storageRoom, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false) MultipartFile file)throws Exception { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
|
||||
storageRoom.setId(IdWorker.get32UUID().toUpperCase()); |
||||
|
||||
if(file!=null){ |
||||
String path = "room" + "/" + storageRoom.getId(); |
||||
String fileName = FileNameUtil.getName(file.getOriginalFilename()); |
||||
boolean r = ossFile.fileUpload(file, path); |
||||
if (r) { |
||||
storageRoom.setRoomPhoto(path); |
||||
storageRoom.setFileName(fileName); |
||||
roomMapper.insert(storageRoom); |
||||
return R.ok(storageRoom, "创建成功"); |
||||
} |
||||
else { |
||||
//删除图片
|
||||
ossFile.fileDelete("room" + "/" + storageRoom.getId() + "/" + fileName); |
||||
return R.failed("创建失败"); |
||||
} |
||||
}else { |
||||
roomMapper.insert(storageRoom); |
||||
return R.ok(storageRoom, "创建成功"); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 修改 |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "修改--存储管理(数据修改+图片修改)", notes = "修改--存储管理") |
||||
@SysLog("修改" ) |
||||
@PutMapping("/updateRoom") |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_edit')" )
|
||||
public R<StorageRoom> putUpdateById(StorageRoom storageRoom, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false)MultipartFile file)throws Exception { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
|
||||
StorageRoom room = roomMapper.selectById(storageRoom.getId()); |
||||
if(room==null){ |
||||
throw new RuntimeException(String.format("存储室数据不存在")); |
||||
} |
||||
if(file!=null){ |
||||
String path = "room" + "/" + storageRoom.getId(); |
||||
String fileName = FileNameUtil.getName(file.getOriginalFilename()); |
||||
boolean r = ossFile.fileUpload(file, path); |
||||
if (r) { |
||||
storageRoom.setRoomPhoto(path); |
||||
storageRoom.setFileName(fileName); |
||||
roomMapper.updateById(storageRoom); |
||||
return R.ok(storageRoom, "修改成功"); |
||||
} |
||||
else { |
||||
return R.failed("修改失败"); |
||||
} |
||||
}else { |
||||
//判断数据库是否存储照片
|
||||
if(room.getRoomPhoto() != null && room.getFileName()!=null){ |
||||
//删除图片
|
||||
ossFile.fileDelete("room" + "/" + room.getId() + "/" + room.getFileName()); |
||||
} |
||||
//修改数据
|
||||
storageRoom.setFileName(""); |
||||
storageRoom.setRoomPhoto(""); |
||||
roomMapper.updateById(storageRoom); |
||||
return R.ok(storageRoom, "修改成功"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* @param id id |
||||
* @return R |
||||
*/ |
||||
@ApiOperation(value = "通过id删除房间--存储管理", notes = "通过id删除--存储管理") |
||||
@SysLog("通过id删除" ) |
||||
@DeleteMapping("deleteRoom/{id}" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" )
|
||||
public R<StorageRoom> deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) throws Exception { |
||||
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||
|
||||
QueryWrapper<StorageCupboard> wrapper = new QueryWrapper<>(); |
||||
wrapper.eq("room_id",id); |
||||
List<StorageCupboard> storageCupboards = cupboardMapper.selectList(wrapper); |
||||
|
||||
if (storageCupboards!=null){ |
||||
throw new RuntimeException(String.format("当前房间还存在柜子不允许删除")); |
||||
} |
||||
|
||||
StorageRoom storageRoom = storageRoomService.getById(id); |
||||
if(storageRoom.getRoomPhoto()!=null && storageRoom.getFileName()!=null){ |
||||
//删除图片
|
||||
ossFile.fileDelete("room" + "/" + storageRoom.getId() + "/" + storageRoom.getFileName()); |
||||
} |
||||
|
||||
if (storageRoomService.removeById(id)) { |
||||
return R.ok(storageRoom, "对象删除成功"); |
||||
} |
||||
else { |
||||
return R.failed(storageRoom, "对象删除失败"); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 通过房间id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}" |
||||
*/ |
||||
@ApiOperation(value = "通过房间id和文件名获取图片", notes = "通过房间id和文件名获取图片") |
||||
@GetMapping("/getRoomPicture/{roomId}/{fileName}" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public void getRoomPicture(@PathVariable("roomId") String roomId, |
||||
@PathVariable("fileName") String fileName, |
||||
HttpServletResponse httpServletResponse) throws Exception { |
||||
StorageRoom storageRoom = roomMapper.selectById(roomId); |
||||
if(storageRoom==null){ |
||||
throw new RuntimeException(String.format("当前房间数据不存在")); |
||||
} |
||||
ossFile.fileGet("room" + "/" + storageRoom.getId() + "/" + fileName, httpServletResponse.getOutputStream()); |
||||
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageRoom.getFileName())); |
||||
} |
||||
|
||||
|
||||
|
||||
/* |
||||
@ApiOperation(value = "删除图片", notes = "删除图片") |
||||
@SysLog("通过id删除" ) |
||||
@DeleteMapping("deleteRoom/{id}" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" )
|
||||
*/ |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 列表 |
||||
* @param |
||||
* @return |
||||
*/ |
||||
@ApiOperation(value = "房间列表查询--下拉框的", notes = "房间列表查询--下拉框的") |
||||
@GetMapping("/list" ) |
||||
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
|
||||
public R<List<StorageRoom>> getStorageRoomList() { |
||||
|
||||
List<StorageRoom> storage = roomMapper.getStorageRoomList(Wrappers.<StorageRoom>query() |
||||
.orderByDesc("sort") |
||||
); |
||||
return R.ok(storage,"查询成功"); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,38 @@ |
||||
package digital.laboratory.platform.imr.convert; |
||||
import cn.hutool.core.collection.CollUtil; |
||||
import com.google.common.collect.Lists; |
||||
|
||||
import digital.laboratory.platform.imr.entity.DrugHandingOverApply; |
||||
import digital.laboratory.platform.imr.enums.DrugHandingOverApplyStatus; |
||||
import digital.laboratory.platform.imr.vo.DrugHandingOverApplyVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 送缴申请转换类 |
||||
*/ |
||||
public class DrugHandingOverApplyConvert { |
||||
|
||||
public static DrugHandingOverApplyVO entityToVO(DrugHandingOverApply entity) { |
||||
if (entity == null) return null; |
||||
DrugHandingOverApplyVO drugHandingOverApplyVO = new DrugHandingOverApplyVO(); |
||||
drugHandingOverApplyVO.setId(entity.getId()); |
||||
drugHandingOverApplyVO.setHandingOverUser(entity.getHandingOverUser()); |
||||
drugHandingOverApplyVO.setHandingOverOrg(entity.getHandingOverOrg()); |
||||
drugHandingOverApplyVO.setHandingOverDate(entity.getHandingOverDate()); |
||||
drugHandingOverApplyVO.setApplyDate(entity.getApplyDate()); |
||||
drugHandingOverApplyVO.setStatus(entity.getStatus()); |
||||
drugHandingOverApplyVO.setStatusName(DrugHandingOverApplyStatus.fromStatus(entity.getStatus()).getDesc()); |
||||
drugHandingOverApplyVO.setRecipient(entity.getRecipient()); |
||||
drugHandingOverApplyVO.setReason(entity.getReason()); |
||||
return drugHandingOverApplyVO; |
||||
} |
||||
|
||||
public static List<DrugHandingOverApplyVO> entityToVOList(List<DrugHandingOverApply> entityList) { |
||||
List<DrugHandingOverApplyVO> drugHandingOverApplyVOlist = CollUtil.newArrayList(); |
||||
for (DrugHandingOverApply drugHandingOverApply :entityList) { |
||||
drugHandingOverApplyVOlist.add(entityToVO(drugHandingOverApply)); |
||||
} |
||||
return drugHandingOverApplyVOlist; |
||||
} |
||||
} |
@ -0,0 +1,64 @@ |
||||
package digital.laboratory.platform.imr.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.time.LocalDateTime; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 毒品库中关联的案事件信息 |
||||
* @TableName b_drug_handing_over_apply |
||||
*/ |
||||
@TableName(value ="b_drug_handing_over_apply") |
||||
@Data |
||||
public class DrugHandingOverApply extends BaseEntity { |
||||
/** |
||||
* 主键标识 |
||||
*/ |
||||
@TableId(value = "id", type = IdType.ASSIGN_ID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 送缴用户 |
||||
*/ |
||||
private String handingOverUser; |
||||
|
||||
/** |
||||
* 送缴单位 |
||||
*/ |
||||
private String handingOverOrg; |
||||
|
||||
/** |
||||
* 送缴日期 |
||||
*/ |
||||
private LocalDateTime handingOverDate; |
||||
|
||||
/** |
||||
* 申请日期 |
||||
*/ |
||||
private LocalDateTime applyDate; |
||||
|
||||
/** |
||||
* 送缴申请状态,0 待送缴 | 3 待接收 | 5 同意接收 | -5 拒绝接收 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 处理该申请,决定是否接收的用户id |
||||
*/ |
||||
private String recipient; |
||||
|
||||
/** |
||||
* 同意/拒绝 原因 |
||||
*/ |
||||
private String reason; |
||||
|
||||
@TableField(exist = false) |
||||
private static final long serialVersionUID = 1L; |
||||
} |
@ -1,77 +0,0 @@ |
||||
package digital.laboratory.platform.imr.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 11:48:03 |
||||
* @describe 实体类 |
||||
*/ |
||||
@Data |
||||
@TableName(value = "storage_cell", autoResultMap = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ApiModel(value = "存储格子") |
||||
public class StorageCell extends BaseEntity { |
||||
|
||||
/** |
||||
* 主键id |
||||
*/ |
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
@ApiModelProperty(value="主键id") |
||||
private String id; |
||||
|
||||
/** |
||||
* 格子编号 |
||||
*/ |
||||
@ApiModelProperty(value="格子编号") |
||||
private String cellNo; |
||||
|
||||
/** |
||||
* 状态:可用/不可用 |
||||
*/ |
||||
@ApiModelProperty(value="是否存放物品 true存放/false未存放") |
||||
private Boolean status; |
||||
|
||||
/** |
||||
* 排序 |
||||
*/ |
||||
@ApiModelProperty(value="排序") |
||||
private Long sort; |
||||
|
||||
/** |
||||
* 柜子id |
||||
*/ |
||||
@ApiModelProperty(value="柜子id") |
||||
private String cupboardId; |
||||
|
||||
/** |
||||
* 格子照片 |
||||
*/ |
||||
@ApiModelProperty(value="格子照片") |
||||
private String cellPhoto; |
||||
|
||||
/** |
||||
* 格子描述 |
||||
*/ |
||||
@ApiModelProperty(value="格子描述") |
||||
private String content; |
||||
|
||||
|
||||
/** |
||||
* 文件名称 |
||||
*/ |
||||
@ApiModelProperty(value="文件名称") |
||||
private String fileName; |
||||
|
||||
|
||||
|
||||
} |
@ -1,110 +0,0 @@ |
||||
package digital.laboratory.platform.imr.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import java.io.Serializable; |
||||
import java.time.LocalDateTime; |
||||
|
||||
import io.swagger.models.auth.In; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 11:45:58 |
||||
* @describe 实体类 |
||||
*/ |
||||
@Data |
||||
@TableName(value = "storage_cupboard", autoResultMap = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ApiModel(value = "") |
||||
public class StorageCupboard extends BaseEntity { |
||||
|
||||
/** |
||||
* 柜子id |
||||
*/ |
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
@ApiModelProperty(value="柜子id") |
||||
private String id; |
||||
|
||||
/** |
||||
* 柜子名称 |
||||
*/ |
||||
@ApiModelProperty(value="柜子名称") |
||||
private String name; |
||||
|
||||
/** |
||||
* 柜子编号 |
||||
*/ |
||||
@ApiModelProperty(value="柜子编号") |
||||
private String cupboardNo; |
||||
|
||||
/** |
||||
* 规格 |
||||
*/ |
||||
@ApiModelProperty(value="规格") |
||||
private Integer specifications; |
||||
|
||||
/** |
||||
* 存储类型(测试) |
||||
*/ |
||||
@ApiModelProperty(value="存储类型(测试)") |
||||
private String storageType; |
||||
|
||||
/** |
||||
* 状态(存满/为存满)--测试数据 |
||||
*/ |
||||
@ApiModelProperty(value="状态(true.正常使用;false停止使用)--测试数据") |
||||
private Boolean status; |
||||
|
||||
/** |
||||
* 房间id |
||||
*/ |
||||
@ApiModelProperty(value="房间id") |
||||
private String roomId; |
||||
|
||||
/** |
||||
* 柜子照片 |
||||
*/ |
||||
@ApiModelProperty(value="柜子照片") |
||||
private String cupboardPhoto; |
||||
|
||||
|
||||
|
||||
/** |
||||
* updateBy |
||||
*/ |
||||
@ApiModelProperty(value="updateBy") |
||||
private String updateBy; |
||||
|
||||
|
||||
/** |
||||
* 排序 |
||||
*/ |
||||
@ApiModelProperty(value="排序") |
||||
private Long sort; |
||||
|
||||
|
||||
/** |
||||
* 文件名称 |
||||
*/ |
||||
@ApiModelProperty(value="文件名称") |
||||
private String fileName; |
||||
|
||||
|
||||
@ApiModelProperty(value="类型:柜子/货架") |
||||
private String cupboardType; |
||||
|
||||
|
||||
@ApiModelProperty(value="1规则/-1不规则") |
||||
private Integer rule; |
||||
|
||||
|
||||
|
||||
} |
@ -1,75 +0,0 @@ |
||||
package digital.laboratory.platform.imr.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import java.io.Serializable; |
||||
import java.time.LocalDateTime; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 11:44:05 |
||||
* @describe 实体类 |
||||
*/ |
||||
@Data |
||||
@TableName(value = "storage_room", autoResultMap = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ApiModel(value = "房间") |
||||
public class StorageRoom extends BaseEntity { |
||||
|
||||
/** |
||||
* 主键id |
||||
*/ |
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
@ApiModelProperty(value="主键id") |
||||
private String id; |
||||
|
||||
/** |
||||
* 房间名称(冷冻356) |
||||
*/ |
||||
@ApiModelProperty(value="房间名称(冷冻356)") |
||||
private String name; |
||||
|
||||
/** |
||||
* 房间位置(3楼356) |
||||
*/ |
||||
@ApiModelProperty(value="房间位置(3楼356)") |
||||
private String roomLocation; |
||||
|
||||
/** |
||||
* 房间照片 |
||||
*/ |
||||
@ApiModelProperty(value="房间照片") |
||||
private String roomPhoto; |
||||
|
||||
|
||||
|
||||
/** |
||||
* updateBy |
||||
*/ |
||||
@ApiModelProperty(value="updateBy") |
||||
private String updateBy; |
||||
|
||||
|
||||
/** |
||||
* 排序 |
||||
*/ |
||||
@ApiModelProperty(value="排序") |
||||
private Long sort; |
||||
|
||||
|
||||
/** |
||||
* 文件名称 |
||||
*/ |
||||
@ApiModelProperty(value="文件名称") |
||||
private String fileName; |
||||
|
||||
|
||||
} |
@ -0,0 +1,32 @@ |
||||
package digital.laboratory.platform.imr.enums; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
@Getter |
||||
public enum DrugHandingOverApplyStatus { |
||||
|
||||
WAIT_HANDING_OVER(0, "待送缴"), |
||||
WAIT_ACCEPT(3, "待接收"), |
||||
AGREE_ACCEPT(5, "同意接收"), |
||||
REJECT_ACCEPT(-5, "拒绝接收") |
||||
; |
||||
|
||||
private final Integer status; |
||||
|
||||
private final String desc; |
||||
|
||||
DrugHandingOverApplyStatus(Integer status, String desc) { |
||||
this.status = status; |
||||
this.desc = desc; |
||||
} |
||||
|
||||
public static DrugHandingOverApplyStatus fromStatus(Integer status) { |
||||
for (DrugHandingOverApplyStatus drugHandingOverApplyStatus : values()) { |
||||
if (drugHandingOverApplyStatus.getStatus().equals(status)) { |
||||
return drugHandingOverApplyStatus; |
||||
} |
||||
} |
||||
throw new IllegalArgumentException("No enum constant with code: " + status); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package digital.laboratory.platform.imr.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import digital.laboratory.platform.imr.entity.DrugHandingOverApply; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ChenJiangBao |
||||
* @description 针对表【b_drug_handing_over_apply(毒品库中关联的案事件信息)】的数据库操作Mapper |
||||
* @createDate 2025-01-08 17:30:46 |
||||
* @Entity generator.entity.DrugHandingOverApply |
||||
*/ |
||||
@Mapper |
||||
public interface DrugHandingOverApplyMapper extends BaseMapper<DrugHandingOverApply> { |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -1,27 +0,0 @@ |
||||
package digital.laboratory.platform.imr.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import digital.laboratory.platform.imr.entity.StorageCell; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Mapper 接口 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe Mapper 类 |
||||
*/ |
||||
@Mapper |
||||
public interface StorageCellMapper extends BaseMapper<StorageCell> { |
||||
|
||||
/* |
||||
格子分页 |
||||
*/ |
||||
IPage<StorageCell> getStorageCellPage(@Param("page") Page<StorageCell> page,@Param(Constants.WRAPPER) QueryWrapper<StorageCell> qw); |
||||
} |
@ -1,26 +0,0 @@ |
||||
package digital.laboratory.platform.imr.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import digital.laboratory.platform.imr.entity.StorageCupboard; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Mapper 接口 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe Mapper 类 |
||||
*/ |
||||
@Mapper |
||||
public interface StorageCupboardMapper extends BaseMapper<StorageCupboard> { |
||||
|
||||
List<StorageCupboard> getStorageCupboardList(@Param(Constants.WRAPPER)QueryWrapper<StorageCupboard> orderByDesc); |
||||
|
||||
IPage<StorageCupboard> getStorageCupboardPage(@Param("page") Page<StorageCupboard> page,@Param(Constants.WRAPPER) QueryWrapper<StorageCupboard> orderByDesc); |
||||
} |
@ -1,26 +0,0 @@ |
||||
package digital.laboratory.platform.imr.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import digital.laboratory.platform.imr.entity.StorageRoom; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Mapper 接口 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe Mapper 类 |
||||
*/ |
||||
@Mapper |
||||
public interface StorageRoomMapper extends BaseMapper<StorageRoom> { |
||||
|
||||
|
||||
|
||||
List<StorageRoom> getStorageRoomList(@Param(Constants.WRAPPER) QueryWrapper<StorageRoom> qw); |
||||
|
||||
List<StorageRoom> getStorageRoomPage(@Param(Constants.WRAPPER)QueryWrapper<StorageRoom> orderByDesc); |
||||
} |
@ -0,0 +1,23 @@ |
||||
package digital.laboratory.platform.imr.query; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@ApiModel(value = "DrugHandingOverApplyQuery", description = "毒品库送缴申请信息查询对象 Query") |
||||
public class DrugHandingOverApplyQuery extends BaseQuery{ |
||||
|
||||
@ApiModelProperty("时间范围查询类型,1 申请时间 | 2 送缴时间") |
||||
private Integer timeRangeType; |
||||
|
||||
|
||||
@ApiModelProperty("用户查询类型,1 送缴用户 | 2 接收用户") |
||||
private Integer userQueryType; |
||||
/** |
||||
* 用户 |
||||
*/ |
||||
@ApiModelProperty("用户id") |
||||
private String userId; |
||||
|
||||
} |
@ -0,0 +1,34 @@ |
||||
package digital.laboratory.platform.imr.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import digital.laboratory.platform.imr.entity.DrugHandingOverApply; |
||||
import digital.laboratory.platform.imr.query.DrugHandingOverApplyQuery; |
||||
import digital.laboratory.platform.imr.vo.DrugHandingOverApplyVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ChenJiangBao |
||||
* @description 针对表【b_drug_handing_over_apply(毒品库中关联的案事件信息)】的数据库操作Service |
||||
* @createDate 2025-01-08 17:30:46 |
||||
*/ |
||||
public interface DrugHandingOverApplyService extends IService<DrugHandingOverApply> { |
||||
|
||||
/** |
||||
* 创建毒品送缴申请-委托单位操作 |
||||
* @return |
||||
*/ |
||||
DrugHandingOverApplyVO create(); |
||||
|
||||
|
||||
/** |
||||
* 根据毒品送缴申请查询条件分页查询毒品送缴申请VO对象 |
||||
* |
||||
* @param query 查询条件 |
||||
* @return 分页后的毒品送缴申请视图对象列表 |
||||
*/ |
||||
IPage<DrugHandingOverApplyVO> voPage(DrugHandingOverApplyQuery query); |
||||
|
||||
boolean delete(List<String> ids); |
||||
} |
@ -1,14 +0,0 @@ |
||||
package digital.laboratory.platform.imr.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import digital.laboratory.platform.imr.entity.StorageCell; |
||||
|
||||
/** |
||||
* 服务类 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 服务类 |
||||
*/ |
||||
public interface StorageCellService extends IService<StorageCell> { |
||||
|
||||
} |
@ -1,14 +0,0 @@ |
||||
package digital.laboratory.platform.imr.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import digital.laboratory.platform.imr.entity.StorageCupboard; |
||||
|
||||
/** |
||||
* 服务类 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 服务类 |
||||
*/ |
||||
public interface StorageCupboardService extends IService<StorageCupboard> { |
||||
|
||||
} |
@ -1,19 +0,0 @@ |
||||
package digital.laboratory.platform.imr.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import digital.laboratory.platform.imr.entity.StorageRoom; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 服务类 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 服务类 |
||||
*/ |
||||
public interface StorageRoomService extends IService<StorageRoom> { |
||||
|
||||
|
||||
} |
@ -0,0 +1,121 @@ |
||||
package digital.laboratory.platform.imr.service.impl; |
||||
|
||||
import cn.hutool.core.util.StrUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
//import com.lcsoft.dlp.common.aop.annotation.DlpResultProc;
|
||||
import digital.laboratory.platform.common.core.exception.ValidateCodeException; |
||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||
import digital.laboratory.platform.common.security.util.SecurityUtils; |
||||
import digital.laboratory.platform.imr.convert.DrugHandingOverApplyConvert; |
||||
import digital.laboratory.platform.imr.entity.DrugHandingOverApply; |
||||
import digital.laboratory.platform.imr.enums.DrugHandingOverApplyStatus; |
||||
import digital.laboratory.platform.imr.query.DrugHandingOverApplyQuery; |
||||
import digital.laboratory.platform.imr.service.DrugHandingOverApplyService; |
||||
import digital.laboratory.platform.imr.mapper.DrugHandingOverApplyMapper; |
||||
import digital.laboratory.platform.imr.vo.DrugHandingOverApplyVO; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ChenJiangBao |
||||
* @description 针对表【b_drug_handing_over_apply(毒品库中关联的案事件信息)】的数据库操作Service实现 |
||||
* @createDate 2025-01-08 17:30:46 |
||||
*/ |
||||
@Service |
||||
public class DrugHandingOverApplyServiceImpl extends ServiceImpl<DrugHandingOverApplyMapper, DrugHandingOverApply> |
||||
implements DrugHandingOverApplyService{ |
||||
|
||||
/** |
||||
* 创建毒品送缴申请-委托单位操作 |
||||
* @return |
||||
*/ |
||||
@Override |
||||
// @DlpResultProc
|
||||
public DrugHandingOverApplyVO create() { |
||||
DLPUser user = SecurityUtils.getUser(); |
||||
DrugHandingOverApply entity = new DrugHandingOverApply(); |
||||
entity.setHandingOverUser(user.getId()); |
||||
entity.setHandingOverOrg(user.getOrgId()); |
||||
entity.setApplyDate(LocalDateTime.now()); |
||||
entity.setStatus(DrugHandingOverApplyStatus.WAIT_HANDING_OVER.getStatus()); |
||||
if (super.save(entity)) { |
||||
return DrugHandingOverApplyConvert.entityToVO(entity); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 根据毒品送缴申请查询条件分页查询毒品送缴申请VO对象 |
||||
* |
||||
* @param query 查询条件 |
||||
* @return 分页后的毒品送缴申请视图对象列表 |
||||
*/ |
||||
@Override |
||||
public IPage<DrugHandingOverApplyVO> voPage(DrugHandingOverApplyQuery query) { |
||||
LambdaQueryWrapper<DrugHandingOverApply> lambdaQueryWrapper = appendQueryCriteria(query); |
||||
Page<DrugHandingOverApply> page = super.page(new Page<>(query.getCurrent(), query.getSize()), lambdaQueryWrapper); |
||||
|
||||
IPage<DrugHandingOverApplyVO> voPage = new Page<>(); |
||||
BeanUtils.copyProperties(page, voPage, "records"); |
||||
voPage.setRecords(DrugHandingOverApplyConvert.entityToVOList(page.getRecords())); |
||||
return voPage; |
||||
} |
||||
|
||||
/** |
||||
* 删除送缴申请 |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public boolean delete(List<String> ids) { |
||||
List<DrugHandingOverApply> drugHandingOverApplies = super.listByIds(ids); |
||||
for (DrugHandingOverApply drugHandingOverApply : drugHandingOverApplies) { |
||||
if (!drugHandingOverApply.getStatus().equals(DrugHandingOverApplyStatus.WAIT_HANDING_OVER.getStatus())) { |
||||
throw new ValidateCodeException(String.format("id为 %s 的申请已经送缴,不能删除!")); |
||||
} |
||||
} |
||||
return super.removeByIds(ids); |
||||
} |
||||
|
||||
/** |
||||
* 根据给定的查询条件构建LambdaQueryWrapper查询对象 |
||||
* |
||||
* @param query 查询条件对象,包含时间范围类型、用户查询类型等 |
||||
* @return 构建的LambdaQueryWrapper查询对象 |
||||
*/ |
||||
private LambdaQueryWrapper<DrugHandingOverApply> appendQueryCriteria(DrugHandingOverApplyQuery query) { |
||||
DLPUser user = SecurityUtils.getUser(); |
||||
Integer timeRangeType = query.getTimeRangeType(); |
||||
Integer userQueryType = query.getUserQueryType(); |
||||
LambdaQueryWrapper<DrugHandingOverApply> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
||||
lambdaQueryWrapper.eq(!user.isStaff(), DrugHandingOverApply::getHandingOverOrg, user.getOrgId()); |
||||
if (timeRangeType != null) { |
||||
if (timeRangeType == 1) { |
||||
lambdaQueryWrapper.ge(query.getStartDate() != null, DrugHandingOverApply::getApplyDate, query.getStartDate()) |
||||
.le(query.getEndDate() != null, DrugHandingOverApply::getApplyDate, query.getEndDate()); |
||||
} else if (timeRangeType == 2) { |
||||
lambdaQueryWrapper.ge(query.getStartDate() != null, DrugHandingOverApply::getHandingOverDate, query.getStartDate()) |
||||
.le(query.getEndDate() != null, DrugHandingOverApply::getHandingOverDate, query.getEndDate()); |
||||
} |
||||
} |
||||
|
||||
if (userQueryType != null) { |
||||
if (userQueryType == 1) { |
||||
lambdaQueryWrapper.eq(StrUtil.isNotBlank(query.getUserId()), DrugHandingOverApply::getHandingOverUser, query.getUserId()); |
||||
} else if (userQueryType == 2) { |
||||
lambdaQueryWrapper.eq(StrUtil.isNotBlank(query.getUserId()), DrugHandingOverApply::getRecipient, query.getUserId()); |
||||
} |
||||
} |
||||
return lambdaQueryWrapper; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -1,18 +0,0 @@ |
||||
package digital.laboratory.platform.imr.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import digital.laboratory.platform.imr.entity.StorageCell; |
||||
import digital.laboratory.platform.imr.mapper.StorageCellMapper; |
||||
import digital.laboratory.platform.imr.service.StorageCellService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* 服务实现类 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 服务实现类 |
||||
*/ |
||||
@Service |
||||
public class StorageCellServiceImpl extends ServiceImpl<StorageCellMapper, StorageCell> implements StorageCellService { |
||||
|
||||
} |
@ -1,18 +0,0 @@ |
||||
package digital.laboratory.platform.imr.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import digital.laboratory.platform.imr.entity.StorageCupboard; |
||||
import digital.laboratory.platform.imr.mapper.StorageCupboardMapper; |
||||
import digital.laboratory.platform.imr.service.StorageCupboardService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* 服务实现类 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 服务实现类 |
||||
*/ |
||||
@Service |
||||
public class StorageCupboardServiceImpl extends ServiceImpl<StorageCupboardMapper, StorageCupboard> implements StorageCupboardService { |
||||
|
||||
} |
@ -1,18 +0,0 @@ |
||||
package digital.laboratory.platform.imr.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import digital.laboratory.platform.imr.entity.StorageRoom; |
||||
import digital.laboratory.platform.imr.mapper.StorageRoomMapper; |
||||
import digital.laboratory.platform.imr.service.StorageRoomService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* 服务实现类 |
||||
* |
||||
* @author Zhang Xiaolong created at 2023-03-17 |
||||
* @describe 服务实现类 |
||||
*/ |
||||
@Service |
||||
public class StorageRoomServiceImpl extends ServiceImpl<StorageRoomMapper, StorageRoom> implements StorageRoomService { |
||||
|
||||
} |
@ -0,0 +1,85 @@ |
||||
package digital.laboratory.platform.imr.vo; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
//import com.lcsoft.dlp.common.aop.annotation.DlpFeign;
|
||||
import digital.laboratory.platform.imr.component.DateUtils; |
||||
import digital.laboratory.platform.sys.feign.RemoteOrgService; |
||||
import digital.laboratory.platform.sys.feign.RemoteUserService; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
/** |
||||
* 毒品库中关联的委托单位的送缴申请信息 |
||||
* @TableName b_drug_handing_over_apply |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "DrugHandingOverApplyVO", description = "毒品库中关联的委托单位的送缴申请信息 VO") |
||||
public class DrugHandingOverApplyVO { |
||||
/** |
||||
* 主键标识 |
||||
*/ |
||||
@ApiModelProperty("主键标识") |
||||
private String id; |
||||
|
||||
/** |
||||
* 送缴用户 |
||||
*/ |
||||
@ApiModelProperty("送缴用户 id") |
||||
private String handingOverUser; |
||||
|
||||
@ApiModelProperty("送缴用户 名称") |
||||
// @DlpFeign(feignClient = RemoteUserService.class, methodName = "innerGetById", params = {"handingOverUser"}, resultField = "name")
|
||||
private String handingOverUserName; |
||||
|
||||
/** |
||||
* 送缴单位 |
||||
*/ |
||||
@ApiModelProperty("送缴单位id") |
||||
private String handingOverOrg; |
||||
|
||||
@ApiModelProperty("送缴单位名称") |
||||
// @DlpFeign(feignClient = RemoteOrgService.class, methodName = "getById", params = {"handingOverOrg"}, resultField = "name")
|
||||
private String handingOverOrgName; |
||||
|
||||
/** |
||||
* 送缴日期 |
||||
*/ |
||||
@ApiModelProperty("送缴时间") |
||||
@JsonFormat(pattern = DateUtils.yyyy_MM_dd_HH_mm_ss, timezone = DateUtils.TIME_ZONE) |
||||
private LocalDateTime handingOverDate; |
||||
|
||||
/** |
||||
* 申请时间 |
||||
*/ |
||||
@ApiModelProperty("申请时间") |
||||
@JsonFormat(pattern = DateUtils.yyyy_MM_dd_HH_mm_ss, timezone = DateUtils.TIME_ZONE) |
||||
private LocalDateTime applyDate; |
||||
|
||||
/** |
||||
* 送缴申请状态,0 待送缴 | 3 待接收 | 5 同意接收 | -5 拒绝接收 |
||||
*/ |
||||
@ApiModelProperty("送缴申请状态,0 待送缴 | 3 待接收 | 5 同意接收 | -5 拒绝接收") |
||||
private Integer status; |
||||
|
||||
@ApiModelProperty("送缴申请状态,0 待送缴 | 3 待接收 | 5 同意接收 | -5 拒绝接收") |
||||
private String statusName; |
||||
|
||||
/** |
||||
* 处理该申请,决定是否接收的用户id |
||||
*/ |
||||
@ApiModelProperty("处理该申请,决定是否接收的用户id") |
||||
private String recipient; |
||||
|
||||
@ApiModelProperty("处理该申请,决定是否接收的用户 姓名") |
||||
// @DlpFeign(feignClient = RemoteUserService.class, methodName = "innerGetById", params = {"recipient"}, resultField = "name")
|
||||
private String recipientName; |
||||
|
||||
/** |
||||
* 同意/拒绝 原因 |
||||
*/ |
||||
@ApiModelProperty("同意/拒绝 原因") |
||||
private String reason; |
||||
} |
@ -0,0 +1,26 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="digital.laboratory.platform.imr.mapper.DrugHandingOverApplyMapper"> |
||||
|
||||
<resultMap id="BaseResultMap" type="digital.laboratory.platform.imr.entity.DrugHandingOverApply"> |
||||
<id property="id" column="id" jdbcType="VARCHAR"/> |
||||
<result property="handingOverUser" column="handing_over_user" jdbcType="VARCHAR"/> |
||||
<result property="handingOverOrg" column="handing_over_org" jdbcType="VARCHAR"/> |
||||
<result property="handingOverDate" column="handing_over_date" jdbcType="TIMESTAMP"/> |
||||
<result property="status" column="status" jdbcType="VARCHAR"/> |
||||
<result property="reason" column="reason" jdbcType="VARCHAR"/> |
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/> |
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/> |
||||
</resultMap> |
||||
|
||||
<sql id="Base_Column_List"> |
||||
id,handing_over_user,handing_over_org, |
||||
handing_over_date,status,reason, |
||||
create_time,update_time,create_by, |
||||
update_by |
||||
</sql> |
||||
</mapper> |
@ -1,34 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
||||
<mapper namespace="digital.laboratory.platform.imr.mapper.StorageCellMapper"> |
||||
|
||||
<resultMap id="storageCellMap" type="digital.laboratory.platform.imr.entity.StorageCell"> |
||||
<id property="id" column="id"/> |
||||
<result property="cellNo" column="cell_no"/> |
||||
<result property="status" column="status"/> |
||||
<result property="sort" column="sort"/> |
||||
<result property="cupboardId" column="cupboard_id"/> |
||||
<result property="cellPhoto" column="cell_photo"/> |
||||
<result property="createBy" column="create_by"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateBy" column="update_By"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
<result property="content" column="content"/> |
||||
<result property="fileName" column="file_name"/> |
||||
</resultMap> |
||||
|
||||
<!--getStorageCellPage--> |
||||
|
||||
<sql id="cellMap"> |
||||
select cell.* |
||||
from dlp_identification_material_repository.storage_cell cell |
||||
</sql> |
||||
<!--getStorageRoomList 柜子列表 –>--> |
||||
<select id="getStorageCellPage" resultMap="storageCellMap"> |
||||
<include refid="cellMap"/> |
||||
${ew.customSqlSegment} |
||||
</select > |
||||
|
||||
</mapper> |
@ -1,40 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
||||
<mapper namespace="digital.laboratory.platform.imr.mapper.StorageCupboardMapper"> |
||||
|
||||
<resultMap id="storageCupboardMap" type="digital.laboratory.platform.imr.entity.StorageCupboard"> |
||||
<id property="id" column="id"/> |
||||
<result property="name" column="name"/> |
||||
<result property="cupboardNo" column="cupboard_no"/> |
||||
<result property="specifications" column="specifications"/> |
||||
<result property="storageType" column="storage_type"/> |
||||
<result property="status" column="status"/> |
||||
<result property="roomId" column="room_id"/> |
||||
<result property="cupboardPhoto" column="cupboard_photo"/> |
||||
<result property="createBy" column="create_by"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateBy" column="update_By"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
<result property="sort" column="sort"/> |
||||
<result property="fileName" column="file_name"/> |
||||
</resultMap> |
||||
|
||||
<!--getStorageCupboardList--> |
||||
|
||||
<sql id="cupboardMap"> |
||||
select cupboard.* |
||||
from dlp_identification_material_repository.storage_cupboard cupboard |
||||
</sql> |
||||
<!--getStorageRoomList 柜子列表 –>--> |
||||
<select id="getStorageCupboardList" resultMap="storageCupboardMap"> |
||||
<include refid="cupboardMap"/> |
||||
${ew.customSqlSegment} |
||||
</select > |
||||
|
||||
<select id="getStorageCupboardPage" resultMap="storageCupboardMap"> |
||||
<include refid="cupboardMap"/> |
||||
${ew.customSqlSegment} |
||||
</select > |
||||
</mapper> |
@ -1,40 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
||||
<mapper namespace="digital.laboratory.platform.imr.mapper.StorageRoomMapper"> |
||||
|
||||
<resultMap id="storageRoomMap" type="digital.laboratory.platform.imr.entity.StorageRoom"> |
||||
<id property="id" column="id"/> |
||||
<result property="name" column="name"/> |
||||
<result property="roomLocation" column="room_location"/> |
||||
<result property="roomPhoto" column="room_photo"/> |
||||
<result property="createBy" column="create_by"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateBy" column="update_By"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
<result property="sort" column="sort"/> |
||||
<result property="fileName" column="file_name"/> |
||||
</resultMap> |
||||
|
||||
|
||||
|
||||
<sql id="roomMap"> |
||||
select room.* |
||||
from dlp_identification_material_repository.storage_room room |
||||
</sql> |
||||
<!--getStorageRoomList 房间列表 --> |
||||
<select id="getStorageRoomList" resultMap="storageRoomMap"> |
||||
<include refid="roomMap"/> |
||||
${ew.customSqlSegment} |
||||
</select> |
||||
|
||||
|
||||
<select id="getStorageRoomPage" resultMap="storageRoomMap"> |
||||
<include refid="roomMap"/> |
||||
${ew.customSqlSegment} |
||||
</select> |
||||
|
||||
|
||||
|
||||
</mapper> |
Loading…
Reference in new issue